From 96211fb16e2c33390be52f045b81fd8f71bc59af Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Thu, 7 Mar 2024 10:51:42 +0800 Subject: [PATCH] up --- App.vue | 1 - common/http.interceptor.js | 59 ++++- components/privacy-popup/privacy-popup.vue | 202 +++++++++++++++++ pages/index/index.vue | 246 ++++++++++++--------- pages/me/me.vue | 2 +- 5 files changed, 393 insertions(+), 117 deletions(-) create mode 100644 components/privacy-popup/privacy-popup.vue diff --git a/App.vue b/App.vue index 26ed54a..d7ca765 100644 --- a/App.vue +++ b/App.vue @@ -9,7 +9,6 @@ // this.$u.api.login({ // code: res.code // }).then(res => { - // this.$u.vuex('vuex_token', res.token) // this.$u.api.user().then(res=>{ // this.$u.vuex('vuex_user', res) // }) diff --git a/common/http.interceptor.js b/common/http.interceptor.js index e0d9d47..ee66e6b 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -39,12 +39,59 @@ const install = (Vue, vm) => { if (res.statusCode === 200) { if (res.data.hasOwnProperty("errcode")) { if (res.data?.errcode === 40001) { - - setTimeout(() => { - let origin = window.location.origin; - let pathname = window.location.pathname; - window.location.href = origin + pathname; - }, 1500) + uni.showModal({ + title:'用户信息已失效', + confirmText:'重新获取', + success:function(res){ + if(res.confirm){ + console.log("res",res) + uni.removeStorageSync('xtykt_lifeData') + uni.login({ + provider: 'weixin', + success: (res1) => { + uni.request({ + url:baseUrl+'/api/mobile/user/wechat-login', + data:{ + code:res1.code, + activity_tag : 'xtykt', + activity_list_id : 12 + }, + method: 'GET', + success: res2 => {uni.setStorageSync('xtykt_lifeData',{'vuex_token':res2.data.token}) + const currentPage = getCurrentPages()[getCurrentPages().length - 1]; + const currentPagePath ="/" + currentPage.route; + const currentPageOptions = currentPage.options; + const queryString = Object.keys(currentPageOptions) + .map(key => `${key}=${currentPageOptions[key]}`) + .join('&'); + // 使用uni.reLaunch方法刷新当前页面 + + uni.reLaunch({ + url: `${currentPagePath}?${queryString}` + }); + console.log("reLaunch",`${currentPagePath}?${queryString}`) + + }, + fail: (res3) => { + console.log("err",res3) + } + }); + }, + fail: (res4) => { + console.log("err",res4) + } + + }); + // login end + } + } + }) // showConfirm end + return + // setTimeout(() => { + // let origin = window.location.origin; + // let pathname = window.location.pathname; + // window.location.href = origin + pathname; + // }, 1500) } else { uni.showToast({ icon: "none", diff --git a/components/privacy-popup/privacy-popup.vue b/components/privacy-popup/privacy-popup.vue new file mode 100644 index 0000000..75eb56d --- /dev/null +++ b/components/privacy-popup/privacy-popup.vue @@ -0,0 +1,202 @@ + + + + + \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index 099929f..e9e842f 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -4,23 +4,26 @@ - + 斜塘街道基层党员冬训 + + + - - - - + + + @@ -33,29 +36,32 @@ {{item.title}} - + ————没有更多了———— - - -