From 296add5afc03bf211557f2b56dd3b1e61df1d239 Mon Sep 17 00:00:00 2001 From: lzx_win <2602107437@qq.com> Date: Wed, 15 Oct 2025 11:58:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF):=20?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E5=A4=84?= =?UTF-8?q?=E7=90=86=E5=92=8C=E5=88=86=E4=BA=AB=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在分享功能中添加失败回调处理 - 修复H5环境下用户信息存储格式问题并自动触发分享 - 在App.vue中添加用户信息获取逻辑 - 移除login.vue中冗余的分享导入和调用 --- App.vue | 14 +++++++++++++- stores/index.js | 3 ++- subPages/login/login.vue | 7 ------- utils/share.js | 3 +++ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/App.vue b/App.vue index 4d95363..fb72a82 100644 --- a/App.vue +++ b/App.vue @@ -32,10 +32,22 @@ // } await this.$store.dispatch('initData') console.log('配置数据初始化完成') + + if(uni.getStorageSync('token')){ + this.getUserInfo() + } }, onHide: function() { console.log('App Hide') - } + }, + async getUserInfo() { + const res = await this.$api.login.getUserInfo(); + if (res.code === 200) { + this.userInfo = res.result; + // 存储用户信息到store + this.$store.dispatch('updateUserInfo', this.userInfo) + } + }, } diff --git a/stores/index.js b/stores/index.js index 3f8e3ce..fe30112 100644 --- a/stores/index.js +++ b/stores/index.js @@ -64,7 +64,8 @@ const store = new Vuex.Store({ setUserInfo(state, data) { state.userInfo = data // #ifdef H5 - localStorage.setItem('userInfo', data) + localStorage.setItem('userInfo', JSON.stringify(data)) + share() // #endif }, setQrcode(state, data) { diff --git a/subPages/login/login.vue b/subPages/login/login.vue index 0e9f6e3..b2a2f20 100644 --- a/subPages/login/login.vue +++ b/subPages/login/login.vue @@ -63,9 +63,6 @@