|
|
@ -5,9 +5,10 @@ export default { |
|
|
|
async onLaunch(options) { |
|
|
|
console.log('options: ', options); |
|
|
|
this.checkNetwork(); // 监听网络状态 |
|
|
|
this.getSystemInfo(); // 获取系统设备信息 |
|
|
|
|
|
|
|
/* #ifdef MP-WEIXIN */ |
|
|
|
await this.signin(); |
|
|
|
this.initSocket(); |
|
|
|
/* #endif */ |
|
|
|
|
|
|
|
/* #ifdef H5 */ |
|
|
@ -23,9 +24,8 @@ export default { |
|
|
|
this.noPhone(data.phone); |
|
|
|
} |
|
|
|
} |
|
|
|
// FIXME: 这里重复书写的 |
|
|
|
this.initSocket(); |
|
|
|
/* #endif */ |
|
|
|
this.initSocket(); |
|
|
|
}, |
|
|
|
|
|
|
|
computed: { |
|
|
@ -36,7 +36,7 @@ export default { |
|
|
|
methods: { |
|
|
|
...mapActions('user', ['getToken']), |
|
|
|
...mapActions('socket', ['initSocket']), |
|
|
|
...mapMutations(['setNetworkConnected']), |
|
|
|
...mapMutations(['setNetworkConnected', 'setSystemInfo']), |
|
|
|
...mapMutations('user', ['setToken', 'setUser']), |
|
|
|
|
|
|
|
// 检查网络状态 设置store里的网络状态变量 |
|
|
@ -79,6 +79,18 @@ export default { |
|
|
|
this.$u.route('/pages/phone-bind/phone-bind'); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取系统设备信息 |
|
|
|
getSystemInfo() { |
|
|
|
uni.getSystemInfo({ |
|
|
|
success: result => { |
|
|
|
this.setSystemInfo(result); |
|
|
|
}, |
|
|
|
fail: error => { |
|
|
|
console.error('getSystemInfo fail:', error); |
|
|
|
}, |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|