Browse Source

feat(分享): 添加推广统计接口并优化分享逻辑

- 在recyclingDestination.js中添加获取推广人数的API接口
- 统一分享链接路径为/pages/index/index并使用用户ID作为分享ID
- 在index.vue中增加分享ID存储逻辑
- 优化用户登录后的信息存储流程
master
前端-胡立永 3 weeks ago
parent
commit
71ff7f99c6
4 changed files with 16 additions and 7 deletions
  1. +6
    -0
      api/model/recyclingDestination.js
  2. +2
    -2
      main.js
  3. +3
    -3
      pages/component/home.vue
  4. +5
    -2
      pages/index/index.vue

+ 6
- 0
api/model/recyclingDestination.js View File

@ -32,6 +32,12 @@ const api = {
method: 'POST',
auth : true,
},
// 查询当前用户直推间推了多少人
getPromotionCount: {
url: '/recycle-admin/applet/promotion/getPromotionCount',
method: 'GET',
auth : true,
},
}
export default api

+ 2
- 2
main.js View File

@ -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
}
}


+ 3
- 3
pages/component/home.vue View File

@ -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) {


+ 5
- 2
pages/index/index.vue View File

@ -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'
});


Loading…
Cancel
Save