From 658245fa44094ad44cf42b4d4df8104e7acb36d5 Mon Sep 17 00:00:00 2001 From: song Date: Fri, 10 Dec 2021 18:53:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=8C=E5=96=84=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + rest/燕园.http | 2 +- src/App.vue | 43 ++++++++++++++ src/components/Upload/Upload.vue | 67 +++++++++++++++------- src/mixins/tool.js | 4 +- src/pagesYanyuan/input-code/input-code.vue | 4 ++ src/pagesYanyuan/scan-code/scan-code.vue | 60 +++++++++---------- src/store/yanyuan/mutations.js | 29 +++++++++- src/store/yanyuan/state.js | 3 + 9 files changed, 157 insertions(+), 56 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63efd66..0f2f181 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -95,6 +95,7 @@ - | 项目列表, 项目url | [32e005b](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/32e005b) - | 项目列表排序 | [224c58b](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/224c58b) - | 项目合并整理,设置页面添加 | [725491a](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/725491a) + - | 首页用户身份判断 | [ac81030](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/ac81030) - | 首页项目样式改变 | [8514c85](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/8514c85) diff --git a/rest/燕园.http b/rest/燕园.http index 1fe8f01..033538b 100644 --- a/rest/燕园.http +++ b/rest/燕园.http @@ -121,7 +121,7 @@ Authorization: Bearer {{login.response.body.$.data.token}} { "param":{ - "id":"6" + "id":"3" } } ###体验账号升级 diff --git a/src/App.vue b/src/App.vue index 7a1abb6..0b5c8f2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -8,6 +8,15 @@ export default { async onLaunch(options) { // TODO: this 先判断是不是通过扫二维码进来的 console.log('options: ', options); + if (options.scene === 1047) { + // 扫描小程序码 + if (options.query && options.query.scene) { + const scene = options.query.scene; + const toolCode = scene.substring(scene.length - 10); + this.setEnterByCode(true); + this.setToolCode(toolCode); + } + } this.getSystemInfo(); // 获取系统设备信息 @@ -35,13 +44,16 @@ export default { computed: { ...mapGetters(['useStorage']), ...mapState('user', ['token']), + ...mapState('yanyuan', ['enterByCode', 'toolCode']), }, methods: { ...mapActions('user', ['getToken']), ...mapActions('socket', ['initSocket']), + ...mapActions('yanyuan', ['getBindTool']), ...mapMutations(['setSystemInfo']), ...mapMutations('user', ['setToken', 'setUser']), + ...mapMutations('yanyuan', ['setIdentityInfo', 'setToolCode', 'setEnterByCode']), // 登录 async signin() { @@ -51,6 +63,11 @@ export default { this.setUser(data); this.setToken(data.token); this.noPhone(data); + // 首页用户身份判断 + await this.homeIdentity(); + if (this.enterByCode && this.toolCode) { + await this.bindTool(); + } } else { this.$t.ui.showToast('返回数据异常'); } @@ -81,6 +98,32 @@ export default { }, }); }, + + /** + * 首页用户身份判断 + */ + async homeIdentity() { + try { + const data = await this.$u.api.homeIdentity(); + this.setIdentityInfo(data); + } catch (error) { + console.log('error: ', error); + } + }, + + /** + * 绑定工具箱 + */ + async bindTool() { + console.log('绑定工具箱'); + try { + const params = { toolCode: this.toolCode }; + await this.getBindTool(params); + this.initTool(); + } catch (error) { + console.error('error: ', error); + } + }, }, }; diff --git a/src/components/Upload/Upload.vue b/src/components/Upload/Upload.vue index 2a29a92..621a317 100644 --- a/src/components/Upload/Upload.vue +++ b/src/components/Upload/Upload.vue @@ -14,12 +14,7 @@ : 'icons3' " > - +