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'
"
>
-
+