diff --git a/project.config.json b/project.config.json index e5dde6d..defca11 100644 --- a/project.config.json +++ b/project.config.json @@ -61,5 +61,5 @@ } ] }, - "appid": "wxa4a28b299df7d921" + "appid": "wxbdf6f933281b1eb4" } \ No newline at end of file diff --git a/src/app.ts b/src/app.ts index e8835f0..d8bc7db 100644 --- a/src/app.ts +++ b/src/app.ts @@ -17,20 +17,22 @@ App({ // 测试号 wx2b0bb13edf717c1d // dev // appid:wxbdf6f933281b1eb4 - // url: 'https://m.shizhong.hbraas.com', - // upFileUrl: 'https://m.shizhong.hbraas.com/', - // imageUrl: 'https://m.shizhong.hbraas.com/api/shizhong/', + url: 'https://m.shizhong.hbraas.com', + upFileUrl: 'https://m.shizhong.hbraas.com/', + imageUrl: 'https://m.shizhong.hbraas.com/api/shizhong/', // pro // appid:wxa4a28b299df7d921 - url: 'https://m.shizhong.hbsaas.com', - upFileUrl: 'https://m.shizhong.hbsaas.com/', - imageUrl: 'https://m.shizhong.hbsaas.com/api/shizhong/', + // url: 'https://m.shizhong.hbsaas.com', + // upFileUrl: 'https://m.shizhong.hbsaas.com/', + // imageUrl: 'https://m.shizhong.hbsaas.com/api/shizhong/', loginState: '', isLogin: 0, isAnswer: '0', scene: null, + + backPath: '', }, onLaunch() { Page = page as WechatMiniprogram.Page.Constructor; @@ -63,7 +65,7 @@ App({ this.globalData.scene = parseScene(options.query.scene); } }, - waitLogin(waitLoginState = false, requireLogin = false) { + waitLogin(waitLoginState = false, requireLogin = false, bakcPath = '') { let time: number; return new Promise((resolve) => { time = setInterval(() => { @@ -73,8 +75,10 @@ App({ if (waitLoginState) { resolve(true); } else if (isLogin === 0 || !isLogin) { + this.globalData.backPath = bakcPath; wx.reLaunch({ url: '/pages/login/index' }); } else if (requireLogin && isLogin === 999) { + this.globalData.backPath = bakcPath; wx.reLaunch({ url: '/pages/login/index' }); } else { resolve(true); diff --git a/src/pages/article/index.scss b/src/pages/article/index.scss index c837f62..79d314b 100644 --- a/src/pages/article/index.scss +++ b/src/pages/article/index.scss @@ -1,5 +1,5 @@ .page { - padding: 48rpx 32rpx 200rpx; + padding: 48rpx 20rpx 200rpx; .page-title { font-size: 44rpx; diff --git a/src/pages/article/index.ts b/src/pages/article/index.ts index 66a5c2c..65a9105 100644 --- a/src/pages/article/index.ts +++ b/src/pages/article/index.ts @@ -246,9 +246,18 @@ Page({ this.setData({ toastShow: false, }); - wx.navigateBack(); + wx.navigateBack({ + fail() { + wx.reLaunch({ + url: '/pages/classify/index', + }); + }, + }); }, handleAuthConform() { + const { BookId, ChapterId } = this.data; + const backPath = `/pages/article/index?id=${BookId}&cid=${ChapterId}`; + app.globalData.backPath = backPath; wx.navigateTo({ url: '/pages/login/index?back=1', }); diff --git a/src/pages/article/index.wxml b/src/pages/article/index.wxml index adefd9f..87cfb70 100644 --- a/src/pages/article/index.wxml +++ b/src/pages/article/index.wxml @@ -39,7 +39,7 @@ - + { this.getCateList(); @@ -185,9 +185,10 @@ Page({ }, handleDetail(e) { const { id } = e.currentTarget.dataset; - app.waitLogin(false, true).then(() => { + const backPath = `/pages/article/index?id=${id}`; + app.waitLogin(false, true, backPath).then(() => { wx.navigateTo({ - url: `/pages/article/index?id=${id}`, + url: backPath, }); }); }, diff --git a/src/pages/home/index.scss b/src/pages/home/index.scss index f2502c2..27cab64 100644 --- a/src/pages/home/index.scss +++ b/src/pages/home/index.scss @@ -43,7 +43,7 @@ page { } } .swiper { - margin: 36rpx 32rpx 0; + margin: 36rpx 32rpx -52rpx; height: 318rpx; .wx-swiper-dots { @@ -89,7 +89,7 @@ page { } .cards { - margin: 0 32rpx; + margin: 52rpx 32rpx 0; display: grid; gap: 28rpx 26rpx; grid-template-columns: repeat(2, 1fr); diff --git a/src/pages/login/index.ts b/src/pages/login/index.ts index 273b903..35ddd78 100644 --- a/src/pages/login/index.ts +++ b/src/pages/login/index.ts @@ -136,7 +136,9 @@ Page({ }, submitCallback() { app.globalData.isLogin = 1; - wx.reLaunch({ url: '/pages/home/index' }); + const backPath = app.globalData.backPath; + wx.reLaunch({ url: backPath || '/pages/home/index' }); + app.globalData.backPath = ''; }, handleProtool() { this.setData({ @@ -149,6 +151,7 @@ Page({ handleVisitor() { if (app.globalData.isLogin !== 1) { app.globalData.isLogin = 999; + app.globalData.backPath = ''; } wx.reLaunch({ url: '/pages/home/index', diff --git a/src/pages/search/index.ts b/src/pages/search/index.ts index f72b2ac..c386fd7 100644 --- a/src/pages/search/index.ts +++ b/src/pages/search/index.ts @@ -65,10 +65,11 @@ Page({ wx.navigateBack(); }, handleDetail(e) { - const { id } = e.currentTarget.dataset; - app.waitLogin(false, true).then(() => { + const { id, cid } = e.currentTarget.dataset; + const backPath = `/pages/article/index?id=${id}&cid=${cid}`; + app.waitLogin(false, true, backPath).then(() => { wx.navigateTo({ - url: `/pages/article/index?id=${id}`, + url: backPath, }); }); }, diff --git a/src/pages/search/index.wxml b/src/pages/search/index.wxml index cd71eac..5c0facf 100644 --- a/src/pages/search/index.wxml +++ b/src/pages/search/index.wxml @@ -23,7 +23,14 @@ /> 以下为搜到的内容 - + {{item.ChapterName}} diff --git a/typings/index.d.ts b/typings/index.d.ts index 3dcb740..fb8efe7 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -8,9 +8,10 @@ interface IAppOption { isLogin: 0 | 1 | 999; isAnswer: '0' | '1'; scene: null | { [key: string]: any }; + backPath: string; }; userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback; - waitLogin: (waitLoginState?: boolean, requireLogin?: boolean) => Promise; + waitLogin: (waitLoginState?: boolean, requireLogin?: boolean, backPath?: string) => Promise; getMenuInfo: (arg0: WechatMiniprogram.Page.Instance) => void; getUserInfo: (arg0: WechatMiniprogram.Page.Instance, arg1?: (arg0: any) => void) => void; }