From 71ff7f99c674784f18f2fc882c89f4b100826a36 Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Sat, 5 Jul 2025 12:51:03 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=88=86=E4=BA=AB):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E7=BB=9F=E8=AE=A1=E6=8E=A5=E5=8F=A3=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=86=E4=BA=AB=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在recyclingDestination.js中添加获取推广人数的API接口 - 统一分享链接路径为/pages/index/index并使用用户ID作为分享ID - 在index.vue中增加分享ID存储逻辑 - 优化用户登录后的信息存储流程 --- api/model/recyclingDestination.js | 6 ++++++ main.js | 4 ++-- pages/component/home.vue | 6 +++--- pages/index/index.vue | 7 +++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/api/model/recyclingDestination.js b/api/model/recyclingDestination.js index 5e139a0..0fe8ba1 100644 --- a/api/model/recyclingDestination.js +++ b/api/model/recyclingDestination.js @@ -32,6 +32,12 @@ const api = { method: 'POST', auth : true, }, + // 查询当前用户直推间推了多少人 + getPromotionCount: { + url: '/recycle-admin/applet/promotion/getPromotionCount', + method: 'GET', + auth : true, + }, } export default api \ No newline at end of file diff --git a/main.js b/main.js index fb1ea58..72e5195 100644 --- a/main.js +++ b/main.js @@ -34,7 +34,7 @@ export function createApp() { const logoImage = uni.getStorageSync('logoImage') || '' return { title: '欢迎体验'+(logoName), - path: '/pages/component/home?shareId=' + (userInfo.shareId || ''), + path: '/pages/index/index?shareId=' + (userInfo.id || ''), imageUrl: logoImage } }, @@ -43,7 +43,7 @@ export function createApp() { const userInfo = uni.getStorageSync('userInfo') || {}; return { title: '欢迎体验'+(logoName), - query: 'shareId=' + (userInfo.shareId || ''), + query: 'shareId=' + (userInfo.id || ''), imageUrl: logoImage } } diff --git a/pages/component/home.vue b/pages/component/home.vue index 4bd4ea8..aa60f97 100644 --- a/pages/component/home.vue +++ b/pages/component/home.vue @@ -607,9 +607,9 @@ onLoad(query) { // 保存query参数 this.queryParams = query - if (query.shareId) { - uni.setStorageSync('shareId', query.shareId) - } + if (query.shareId) { + uni.setStorageSync('shareId', query.shareId) + } // 检查App数据是否已经准备好 if (!getApp().globalData.isAppDataReady) { diff --git a/pages/index/index.vue b/pages/index/index.vue index 1c2cf8b..63cf20d 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -76,7 +76,10 @@ return item ? item.keyContent : '' } }, - onLoad() { + onLoad(query) { + if (query.shareId) { + uni.setStorageSync('shareId', query.shareId) + } this.getConfigData() }, methods: { @@ -183,6 +186,7 @@ uni.hideLoading(); // console.log(res) uni.setStorageSync('token', res.result.token); + uni.setStorageSync('userInfo', res.result.userInfo) uni.setStorageSync('openid', res.result.userInfo && res.result.userInfo .appletOpenid); getApp().globalData.login_status = true; @@ -193,7 +197,6 @@ url: '/pages/wxUserInfo' }); } else { - uni.setStorageSync('userInfo', userInfo) uni.reLaunch({ url: '/pages/component/home' });