From e1726ca03a491278a886e7c29b5abfb5a7cd409d Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Wed, 20 Mar 2024 20:21:25 +0800 Subject: [PATCH] =?UTF-8?q?flat:=20=E7=99=BB=E9=99=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 30 +++---------------- pages.json | 11 +++++++ pages/index/index.vue | 9 +++++- pages/login/blank.vue | 70 +++++++++++++++++++++++++++++++++++++++++++ store/models/auth.js | 6 +++- store/models/user.js | 2 +- 6 files changed, 99 insertions(+), 29 deletions(-) create mode 100644 pages/login/blank.vue diff --git a/App.vue b/App.vue index 9ffc910..355badd 100644 --- a/App.vue +++ b/App.vue @@ -15,33 +15,11 @@ export default { onLaunch: function(options) { - console.log(options.query) if(options.query.token) { - const { token } = options - this.$store.dispatch("LoginByUsername", { - username: 'admin', - password: "admin", - key: '', - code: '1111', - type: "account", - token: options.query.token, - tenantId: website.tenantId - }).then((resp) => { - this.$store.dispatch('refreshAuthState').then(() => { - that.loading = false - var auth = this.auth - if (!auth.bankCardState) { - that.goSign(0) - } else { - uni.switchTab({ - url: '/pages/index/index' - }) - } - }) - }).catch((err) => { - this.loading = false - // this.$refs.code.refushCode() - }); + uni.reLaunch({ + url: '/pages/login/blank?token=' + options.query.token + }) + this.$store.commit('changeLoginType', options.query.token) } else if (this.$store.state.user.token) { this.$store.dispatch('startRefreshTokenTimer') this.$store.dispatch('startRefreshNewsTimer') diff --git a/pages.json b/pages.json index bec9215..b143863 100644 --- a/pages.json +++ b/pages.json @@ -358,6 +358,17 @@ "navigationBarTitleText": "推送政策", "enablePullDownRefresh": false } + }, + { + "path": "pages/login/blank", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationBarTextStyle": "white", + "navigationBarShadow": { + "colorType": "none" + } + } } ], "subPackages": [ diff --git a/pages/index/index.vue b/pages/index/index.vue index 93db827..517fbe3 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -275,8 +275,15 @@ swiperType:1,//轮播图类型:冀联:1、衡水3 }; }, - onLoad: function() {}, + onLoad: function(options) { }, onShow: function() { + console.log(this.$store.state.auth.loginType, 'index') + // if(this.$store.state.auth.loginType !== 0) { + // uni.reLaunch({ + // url: '/pages/login/blank' + // }) + // return + // } if (!this.$store.state.user.token) { uni.reLaunch({ url: '/pages/login/login' diff --git a/pages/login/blank.vue b/pages/login/blank.vue new file mode 100644 index 0000000..eaddfab --- /dev/null +++ b/pages/login/blank.vue @@ -0,0 +1,70 @@ + + + + + \ No newline at end of file diff --git a/store/models/auth.js b/store/models/auth.js index d167b45..6b630f2 100644 --- a/store/models/auth.js +++ b/store/models/auth.js @@ -31,7 +31,8 @@ const auth = { }) || false, authInfo: getStore({ name: 'authInfo' - }) || [] + }) || [], + loginType: 0, // 0 }, actions: { //刷新token @@ -109,6 +110,9 @@ const auth = { } }, mutations: { + changeLoginType(state, payload) { + state.loginType = payload + }, SET_AUTH_LABOR: (state, status) => { state.laborState = status setStore({ diff --git a/store/models/user.js b/store/models/user.js index d035caa..af24443 100644 --- a/store/models/user.js +++ b/store/models/user.js @@ -76,6 +76,7 @@ const user = { return new Promise((resolve, reject) => { loginByUsername(userInfo.tenantId, userInfo.username, md5(userInfo.password), userInfo.type, userInfo.key, userInfo.code, userInfo.token).then(res => { + const data = res.data; if (data.error_description) { uni.showToast({ @@ -88,7 +89,6 @@ const user = { commit('SET_TENANT_ID', data.tenant_id); commit('SET_USER_INFO', data); dispatch('refreshAuthState') - cons.log('开始1') dispatch('startRefreshNewsTimer') startRefreshToken(); }