From 950a9c2b62b73173f41869735e882889c8881e17 Mon Sep 17 00:00:00 2001 From: TianYu <332368756@qq.com> Date: Mon, 29 May 2023 15:37:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E6=8D=A2=E7=BB=91=E6=8E=A8=E5=B9=BF=E5=91=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-app/App.vue | 49 +++++++++++++++++++++++------------ yudao-ui-app/api/api.js | 9 +++++++ yudao-ui-app/store/getters.js | 1 + 3 files changed, 43 insertions(+), 16 deletions(-) diff --git a/yudao-ui-app/App.vue b/yudao-ui-app/App.vue index 3985d9038..55873cea7 100644 --- a/yudao-ui-app/App.vue +++ b/yudao-ui-app/App.vue @@ -5,7 +5,8 @@ import { refreshToken, getWeChatOpenId, - fetchTenantInfo + fetchTenantInfo, + fetchMemberChangeSpreadId } from "@/api/api"; import { HTTP_REQUEST_URL @@ -163,12 +164,27 @@ } // #endif }, - computed: mapGetters(['tenantId']), + computed: { + ...mapGetters(['tenantId', 'uid', 'spreadId']), + spreadDataChange() { + return { + uid: this.uid, + spreadId: this.spreadId + } + } + }, mounted() { this.initLoad() }, + watch: { + spreadDataChange: function() { + if (this.uid && this.spreadId) { + fetchMemberChangeSpreadId(this.spreadId) + } + } + }, methods: { - async initLoad(){ + async initLoad() { this.isQRCode() this.setSpreadId() if (this.$store.getters.isLogin && !this.$Cache.get('USER_INFO')) { @@ -195,7 +211,8 @@ const tenantId = this.$route.query.tenantId || '' const spreadId = this.$route.query.spreadId || '' const wechatUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx7e503d9cded34c07' - location.href =`${wechatUrl}&redirect_uri=${redirectUrl}/pages/member_application/index?tenantId=${tenantId}&spreadId=${spreadId}&response_type=code&scope=snsapi_base#wechat_redirect` + location.href = + `${wechatUrl}&redirect_uri=${redirectUrl}/pages/member_application/index?tenantId=${tenantId}&spreadId=${spreadId}&response_type=code&scope=snsapi_base#wechat_redirect` } }, // 获取租户信息 @@ -248,17 +265,17 @@ }); } }, - onShow:async function() { - // const res = await memberGradeInfo() - // if(res.data.some((item) => !!parseInt(item.isExist))){ - // uni.setTabBarItem({ - // index: 0, - // pagePath: '/pages/member_equity/index' - // }) - // uni.switchTab({ - // url:'/pages/member_equity/index' - // }) - // } + onShow: async function() { + // const res = await memberGradeInfo() + // if(res.data.some((item) => !!parseInt(item.isExist))){ + // uni.setTabBarItem({ + // index: 0, + // pagePath: '/pages/member_equity/index' + // }) + // uni.switchTab({ + // url:'/pages/member_equity/index' + // }) + // } // #ifdef H5 uni.getSystemInfo({ success(e) { @@ -319,4 +336,4 @@ height: 0; color: transparent; } - + \ No newline at end of file diff --git a/yudao-ui-app/api/api.js b/yudao-ui-app/api/api.js index 7432f97f3..f62839cc4 100644 --- a/yudao-ui-app/api/api.js +++ b/yudao-ui-app/api/api.js @@ -42,6 +42,15 @@ export function fetchTenantInfo(id) { return request.get('tenant/get?id=' + id, {}); } +/** + * 会员换绑推广员ID + */ +export function fetchMemberChangeSpreadId(id) { + return request.post("api/order/member/memberChangeTie", { + promoterId: id + }); +} + /** * 保存form_id * @param string formId diff --git a/yudao-ui-app/store/getters.js b/yudao-ui-app/store/getters.js index 0c404031b..a993e1d18 100644 --- a/yudao-ui-app/store/getters.js +++ b/yudao-ui-app/store/getters.js @@ -7,6 +7,7 @@ export default { uid: state => state.app.uid, tenantId: state => state.app.tenantId, openId: state => state.app.openId, + spreadId: state => state.app.spreadId, homeActive: state => state.app.homeActive, home: state => state.app.home, chatUrl: state => state.app.chatUrl,