From d194009324236d8f9f8ba14bb2d8b34777c75d7f Mon Sep 17 00:00:00 2001 From: TianYu <332368756@qq.com> Date: Fri, 19 May 2023 17:34:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-app/App.vue | 42 ++++++++++--------- yudao-ui-app/config/cache.js | 2 + yudao-ui-app/pages/users/register/index.vue | 4 +- yudao-ui-app/pages/users/user_info/index.vue | 5 +-- .../pages/users/user_spread_code/index.vue | 3 +- yudao-ui-app/store/modules/app.js | 4 +- 6 files changed, 33 insertions(+), 27 deletions(-) diff --git a/yudao-ui-app/App.vue b/yudao-ui-app/App.vue index e354edfd0..883ad3717 100644 --- a/yudao-ui-app/App.vue +++ b/yudao-ui-app/App.vue @@ -174,27 +174,30 @@ // #endif }, computed: mapGetters(['tenantId']), - async mounted() { - this.isQRCode() - if (this.$store.getters.isLogin && !this.$Cache.get('USER_INFO')) { - await this.$store.dispatch('USERINFO'); - } - if (!this.$Cache.get('TENANT_ID') || this.$route.query.tenantId) { - this.getTenantId() - } else { - this.getTenantInfo() - } - if (!this.$Cache.get('OPEN_ID') && this.$route.query.code) { - this.getWxChatCode() - } - this.setSpreadId() - setInterval(() => { - if (this.$store.getters.isLogin) { - this.setRefreshToken() - } - }, 60000) + mounted() { + this.initLoad() }, methods: { + async initLoad(){ + this.isQRCode() + this.setSpreadId() + if (this.$store.getters.isLogin && !this.$Cache.get('USER_INFO')) { + await this.$store.dispatch('USERINFO'); + } + if (!this.$Cache.get('TENANT_ID') || this.$route.query.tenantId) { + this.getTenantId() + } else { + this.getTenantInfo() + } + if (!this.$Cache.get('OPEN_ID') && this.$route.query.code) { + this.getWxChatCode() + } + setInterval(() => { + if (this.$store.getters.isLogin) { + this.setRefreshToken() + } + }, 60000) + }, // 是否扫码跳转 isQRCode() { const redirectUrl = this.$route.query.redirectUrl || '' @@ -226,6 +229,7 @@ // 获取推广员ID setSpreadId() { const spreadId = this.$route.query.spreadId || '' + console.log('spreadId', spreadId) if (spreadId) { this.$store.commit("SET_SPREADID", spreadId); } diff --git a/yudao-ui-app/config/cache.js b/yudao-ui-app/config/cache.js index 5292828cb..e211f4324 100644 --- a/yudao-ui-app/config/cache.js +++ b/yudao-ui-app/config/cache.js @@ -8,6 +8,8 @@ module.exports = { TENANT_ID: 'TENANT_ID', // 微信openId OPEN_ID: 'OPEN_ID', + // 推广员ID + SPREAD_ID: 'SPREAD_ID', //用户信息 USER_INFO: 'USER_INFO', //租户信息 diff --git a/yudao-ui-app/pages/users/register/index.vue b/yudao-ui-app/pages/users/register/index.vue index 9779eac34..264f330af 100644 --- a/yudao-ui-app/pages/users/register/index.vue +++ b/yudao-ui-app/pages/users/register/index.vue @@ -61,7 +61,7 @@ realName: '', mobile: '', code: '', - spreadId: '' + promoterId: '' } } }, @@ -69,7 +69,7 @@ async onRegister() { this.loading = true try { - this.registerForm.spreadId = store.state.app.spreadId || '' + this.registerForm.promoterId = store.state.app.spreadId || '' const res = await register(this.registerForm) this.$util.Tips({ title: res.code === 0 ? '注册成功' : res.msg diff --git a/yudao-ui-app/pages/users/user_info/index.vue b/yudao-ui-app/pages/users/user_info/index.vue index 3e0a36703..696e6ff71 100644 --- a/yudao-ui-app/pages/users/user_info/index.vue +++ b/yudao-ui-app/pages/users/user_info/index.vue @@ -59,10 +59,7 @@ - - 退出登录 - + 退出登录 diff --git a/yudao-ui-app/pages/users/user_spread_code/index.vue b/yudao-ui-app/pages/users/user_spread_code/index.vue index 8aeb8bb6a..32bd3dd10 100644 --- a/yudao-ui-app/pages/users/user_spread_code/index.vue +++ b/yudao-ui-app/pages/users/user_spread_code/index.vue @@ -203,8 +203,10 @@ let that = this; let href = ''; // href = window.location.href.split('/pages')[0]; + console.log('uid', that.uid) const baseUrl = 'http://yuxy.perrymake.com'; const url =`${baseUrl}/pages/index/index?redirectUrl=${baseUrl}&tenantId=${that.tenantId}&spreadId=${that.uid}` + console.log('url', url) uQRCode.make({ canvasId: 'qrcode', // text: href + '/pages/index/index?spreadId=' + that.uid, @@ -212,7 +214,6 @@ size: this.qrcodeSize, margin: 10, success: res => { - console.log('res', res) that.PromotionCode = res; setTimeout(() => { that.PosterCanvas(this.base64List[0], that.PromotionCode, that.userInfo diff --git a/yudao-ui-app/store/modules/app.js b/yudao-ui-app/store/modules/app.js index eba34c8a0..536c1857d 100644 --- a/yudao-ui-app/store/modules/app.js +++ b/yudao-ui-app/store/modules/app.js @@ -7,6 +7,7 @@ import { UID, TENANT_ID, OPEN_ID, + SPREAD_ID, PLATFORM } from '../../config/cache'; import Cache from '../../utils/cache'; @@ -23,7 +24,7 @@ const state = { tenantInfo: Cache.get(TENANT_INFO)?JSON.parse(Cache.get(TENANT_INFO)):null, uid: Cache.get(UID) || null, tenantId: Cache.get(TENANT_ID) || '', - spreadId: '', + spreadId: Cache.get(SPREAD_ID) || '', openId: Cache.get(OPEN_ID) || '', homeActive: false, chatUrl: Cache.get('chatUrl') || '', @@ -52,6 +53,7 @@ const mutations = { }, SET_SPREADID(state, val){ state.spreadId = val; + Cache.set(SPREAD_ID, val); }, SET_OPENID(state, val){ state.openId = val;