From f93f455134ff234be9d257c0f432c8052f1c32cd Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期五, 18 七月 2025 19:20:05 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- small-program/App.vue | 61 +++++++++++++++++++++++------- 1 files changed, 46 insertions(+), 15 deletions(-) diff --git a/small-program/App.vue b/small-program/App.vue index 1ed19d8..9bfe61a 100644 --- a/small-program/App.vue +++ b/small-program/App.vue @@ -12,30 +12,61 @@ success: async function (loginRes) { let { code } = loginRes; let res = await that.$u.api.wxLogin({ code }) - if (res&& res.code === 200) { + if (res && res.code === 200) { that.$store.commit('setToken', res.data.token) that.$store.commit('setOpenid', res.data.openid) that.$store.commit('setUserInfo', res.data.member) - that.$isResolve() + uni.getLocation({ + type: 'wgs84', + success: (addr) => { + that.$store.commit('setPosition', { latitude: addr.latitude, longitude: addr.longitude }) + that.$isResolve() + }, + fail: (err) => { + console.error('鑾峰彇浣嶇疆澶辫触', err); + that.$isResolve() + } + }); + } } }); - } + } else { + var that = this + let res = this.$u.api.getMemberInfo({}).then(res =>{ + if (res && res.code === 200) { + that.$store.commit('setUserInfo', res.data) + uni.getLocation({ + type: 'wgs84', + success: (addr) => { + that.$store.commit('setPosition', { latitude: addr.latitude, longitude: addr.longitude }) + that.$isResolve() + }, + fail: (err) => { + console.error('鑾峰彇浣嶇疆澶辫触', err); + that.$isResolve() + } + }); + } else { + that.$store.commit('setToken','') + that.$store.commit('setUserInfo',{}) + uni.getLocation({ + type: 'wgs84', + success: (addr) => { + that.$store.commit('setPosition', { latitude: addr.latitude, longitude: addr.longitude }) + that.$isResolve() + }, + fail: (err) => { + console.error('鑾峰彇浣嶇疆澶辫触', err); + that.$isResolve() + } + }); + } + }) + } }, onShow: function() { console.log('App Show') - var that =this - let res = this.$u.api.getMemberInfo({}).then(res =>{ - if (res && res.code ===200) { - that.$store.commit('setUserInfo', res.data) - that.$isResolve() - }else{ - that.$store.commit('setToken','') - that.$store.commit('setUserInfo',{}) - that.$isResolve() - } - }) - }, onHide: function() { console.log('App Hide') -- Gitblit v1.9.3