From 0a76c58cf403ab325a4867e58ec2e87d56697ba5 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期四, 17 七月 2025 15:28:45 +0800
Subject: [PATCH] 对接口,新建富文本页面
---
small-program/App.vue | 43 +++++++++++++++++++++++++++----------------
1 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/small-program/App.vue b/small-program/App.vue
index 22c1eea..a3cecd4 100644
--- a/small-program/App.vue
+++ b/small-program/App.vue
@@ -5,26 +5,37 @@
...mapState(['userInfo','openid'])
},
onLaunch: function() {
- var that = this;
- console.log(this.userInfo)
- if (!this.userInfo || JSON.stringify(this.userInfo) == '{}') {
- uni.login({
- provider: 'weixin',
- success: async function (loginRes) {
- let { code } = loginRes;
- let res = await that.$u.api.wxLogin({ code })
- if (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()
+ var that = this;
+ if (!this.openid || this.openid =='') {
+ uni.login({
+ provider: 'weixin',
+ success: async function (loginRes) {
+ let { code } = loginRes;
+ let res = await that.$u.api.wxLogin({ code })
+ if (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()
+ }
}
- }
- });
- }
+ });
+ }
},
onShow: function() {
console.log('App Show')
+ var that =this
+ let res = this.$u.api.getMemberInfo({}).then(res =>{
+ if (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