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,