From a5f40b4c2590a3d61592f1918d689d4932545248 Mon Sep 17 00:00:00 2001 From: liukangdong <898885815@qq.com> Date: 星期三, 22 一月 2025 15:06:38 +0800 Subject: [PATCH] ll --- h5/pages/login.vue | 70 +++++++++++++++++++++++++---------- 1 files changed, 50 insertions(+), 20 deletions(-) diff --git a/h5/pages/login.vue b/h5/pages/login.vue index b742a89..840eba8 100644 --- a/h5/pages/login.vue +++ b/h5/pages/login.vue @@ -29,7 +29,9 @@ loginPost, getUserInfo, sendSMsPost, - ywWxAuthorize + ywWxAuthorize, + + getRecordByUserPoint } from '@/api' import { mapState, @@ -45,11 +47,19 @@ code: '' }, downTime: 0, - code: '111' - // code: '' + code: '' } }, - + onLoad(option) { + console.log('onLoad'); + // https://zhcg.fnwtzx.com/#/pages/login?type=0&ywid=ywid + if (option.ywid || option.ywid == 0) { + uni.setStorageSync('ywinfo', { + type: option.type, + ywid: option.ywid + }) + } + }, onShow() { // return var that = this @@ -66,19 +76,31 @@ ywWxAuthorize({ code: code || this.code }).then(res => { - if (res.code === 200) { + if (res.code === 200) { console.log('res', res); that.$store.commit('setOpenId', res.data.openid) - if (res.data.token && res.data.token != '') { + if (res.data.token && res.data.token != '') { that.$store.commit('setToken', res.data.token) getUserInfo().then(ress => { that.$store.commit('setUserInfo', ress.data) }) - setTimeout(() => { - uni.redirectTo({ - url: "/pages/index" + const ywinfo = uni.getStorageSync('ywinfo') || {} + if (ywinfo.ywid && (ywinfo.type || ywinfo.type == 0)) { + getRecordByUserPoint({pointCode: ywinfo.ywid}).then(res => { + if(res.data && res.data.id){ + uni.setStorageSync('ywinfo', {}) + uni.redirectTo({ + url: "/pages/polling/point?id=" + res.data.id + }) + } }) - }, 300) + } else { + setTimeout(() => { + uni.redirectTo({ + url: "/pages/index" + }) + }, 300) + } } } }) @@ -92,12 +114,6 @@ } }, - // onBackPress(options) { - // uni.redirectTo({ - // url: '/pages/login/login' - // }) - // return true - // }, methods: { ...mapMutations(["setToken", "setUserInfo"]), onLogin() { @@ -122,10 +138,24 @@ this.setToken(res.data) this.showToast('鐧诲綍鎴愬姛') getUserInfo().then(ress => { - this.setUserInfo(ress.data) - uni.redirectTo({ - url: "/pages/index" - }) + this.setUserInfo(ress.data) + const ywinfo = uni.getStorageSync('ywinfo') || {} + if (ywinfo.ywid && (ywinfo.type || ywinfo.type == 0)) { + getRecordByUserPoint({pointCode: ywinfo.ywid}).then(res => { + getRecordByUserPoint({pointCode: ywinfo.ywid}).then(res => { + if(res.data && res.data.id){ + uni.setStorageSync('ywinfo', {}) + uni.redirectTo({ + url: "/pages/polling/point?id=" + res.data.id + }) + } + }) + }) + } else { + uni.redirectTo({ + url: "/pages/index" + }) + } }) } }) -- Gitblit v1.9.3