|
|
@ -1,9 +1,9 @@ |
|
|
<script> |
|
|
<script> |
|
|
import toolMixin from '@/mixins/tool'; |
|
|
// import toolMixin from '@/mixins/tool'; |
|
|
import { mapActions, mapGetters, mapMutations, mapState } from 'vuex'; |
|
|
import { mapActions, mapGetters, mapMutations, mapState } from 'vuex'; |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
mixins: [toolMixin], |
|
|
// mixins: [toolMixin], |
|
|
|
|
|
|
|
|
async onLaunch(options) { |
|
|
async onLaunch(options) { |
|
|
// TODO: this 先判断是不是通过扫二维码进来的 |
|
|
// TODO: this 先判断是不是通过扫二维码进来的 |
|
|
@ -44,16 +44,14 @@ export default { |
|
|
computed: { |
|
|
computed: { |
|
|
...mapGetters(['useStorage']), |
|
|
...mapGetters(['useStorage']), |
|
|
...mapState('user', ['token']), |
|
|
...mapState('user', ['token']), |
|
|
...mapState('yanyuan', ['enterByCode', 'toolCode']), |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
methods: { |
|
|
methods: { |
|
|
...mapActions('user', ['getToken']), |
|
|
...mapActions('user', ['getToken']), |
|
|
...mapActions('socket', ['initSocket']), |
|
|
...mapActions('socket', ['initSocket']), |
|
|
...mapActions('yanyuan', ['getBindTool']), |
|
|
|
|
|
...mapMutations(['setSystemInfo']), |
|
|
...mapMutations(['setSystemInfo']), |
|
|
...mapMutations('user', ['setToken', 'setUser']), |
|
|
...mapMutations('user', ['setToken', 'setUser']), |
|
|
...mapMutations('yanyuan', ['setIdentityInfo', 'setToolCode', 'setEnterByCode']), |
|
|
...mapMutations('yanyuan', ['setToolCode', 'setEnterByCode']), |
|
|
|
|
|
|
|
|
// 登录 |
|
|
// 登录 |
|
|
async signin() { |
|
|
async signin() { |
|
|
@ -63,11 +61,6 @@ export default { |
|
|
this.setUser(data); |
|
|
this.setUser(data); |
|
|
this.setToken(data.token); |
|
|
this.setToken(data.token); |
|
|
this.noPhone(data); |
|
|
this.noPhone(data); |
|
|
// 首页用户身份判断 |
|
|
|
|
|
await this.homeIdentity(); |
|
|
|
|
|
if (this.enterByCode && this.toolCode) { |
|
|
|
|
|
await this.bindTool(); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
this.$t.ui.showToast('返回数据异常'); |
|
|
this.$t.ui.showToast('返回数据异常'); |
|
|
} |
|
|
} |
|
|
@ -98,31 +91,6 @@ export default { |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 首页用户身份判断 |
|
|
|
|
|
*/ |
|
|
|
|
|
async homeIdentity() { |
|
|
|
|
|
try { |
|
|
|
|
|
const data = await this.$u.api.homeIdentity(); |
|
|
|
|
|
this.setIdentityInfo(data); |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.error('error: ', error); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 绑定工具箱 |
|
|
|
|
|
*/ |
|
|
|
|
|
async bindTool() { |
|
|
|
|
|
try { |
|
|
|
|
|
const params = { toolCode: this.toolCode }; |
|
|
|
|
|
await this.getBindTool(params); |
|
|
|
|
|
this.initTool(); |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.error('error: ', error); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
|
</script> |
|
|
</script> |
|
|
|