diff --git a/CHANGELOG.md b/CHANGELOG.md index 78d280c..44ac6e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 0.1.0 (2021-09-02) +# 0.1.0 (2021-09-09) ### 🌟 新功能 范围|描述|commitId @@ -55,6 +55,7 @@ - | 细节调整,添加project-webview | 4d9050b - | 绑定手机号 | 52e0352 - | 缓存修改 | 63e1f0d + - | 获取用户收取那,提交用户信息 | a3c54f1 - | 角色栏实现 | 94cd671 - | 设置小红点 | 9316bcb - | 距调整pc端 | 5069aa1 diff --git a/src/App.vue b/src/App.vue index 8bcef53..ce88e44 100644 --- a/src/App.vue +++ b/src/App.vue @@ -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); + }, + }); + }, }, }; diff --git a/src/components/Upload/Upload.vue b/src/components/Upload/Upload.vue index 75f7cfd..f23e6e9 100644 --- a/src/components/Upload/Upload.vue +++ b/src/components/Upload/Upload.vue @@ -27,6 +27,7 @@ export default { }); }, 2000); } catch (error) { + console.log('error: ', error); this.$emit('error', error); } }, diff --git a/src/mixins/userAuth.js b/src/mixins/userAuth.js index ec42012..ffbe93f 100644 --- a/src/mixins/userAuth.js +++ b/src/mixins/userAuth.js @@ -1,9 +1,11 @@ -import { mapState } from 'vuex'; +import { mapMutations, mapState } from 'vuex'; + import { waitTokenRequest } from '@/utils/cacheAndRequest'; export default { computed: mapState('user', ['token', 'user']), methods: { + ...mapMutations('user', ['setUser']), // 获取授权 openAuth() { if (this.user && this.user.wxInfo && this.user.wxInfo.nickname) return; // 用户信息里有微信信息就不用再获取了 @@ -20,9 +22,9 @@ export default { /* #ifdef MP-WEIXIN */ uni.getUserProfile({ desc: 'TALL仅需要获取您的基本用户信息', - success: res => { + success: async res => { const { avatarUrl, city, country, gender, language, nickName, province } = res.userInfo; - this.$u.api.updateUserInfo({ + const data = await this.$u.api.updateUserInfo({ city, country, headImgUrl: avatarUrl, @@ -31,6 +33,10 @@ export default { province, sex: gender, }); + console.log('data: ', data); + const { user } = this; + user.wxInfo = data; + this.setUser(user); }, fail: error => { console.log('error: ', error); diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index dc7b800..6facca9 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -3,8 +3,10 @@ + + diff --git a/src/pages/phone-bind/phone-bind.vue b/src/pages/phone-bind/phone-bind.vue index 28c9bde..39d1aeb 100644 --- a/src/pages/phone-bind/phone-bind.vue +++ b/src/pages/phone-bind/phone-bind.vue @@ -27,7 +27,7 @@