diff --git a/packageA/my/person-detail.vue b/packageA/my/person-detail.vue index 79a5716..0a1da48 100644 --- a/packageA/my/person-detail.vue +++ b/packageA/my/person-detail.vue @@ -17,9 +17,10 @@ 昵称设置 - - + + + {{niName}} @@ -61,8 +62,8 @@ - 退出账号 - 保存 + 退出账号 + - + @@ -257,6 +258,11 @@ url: '/packageB/card/index' }) }, + toName(){ + uni.navigateTo({ + url: '/packageB/names/index' + }) + }, getSfInfo() { uni.$u.http.get('/api/school.real_name/info').then(res => { console.log(res); @@ -283,9 +289,20 @@ // birthday: this.birthday, // realname: this.realname, // gender: this.gender == '男' ? '1' : '0', - update_fields: ['nickname', 'birthday', 'realname', 'gender', 'work', 'avatar'] + update_fields: [ + 'nickname', + // 'birthday', + // 'realname', + // 'gender', + // 'work', + 'avatar' + ] }).then(res => { if (res.code == 1) { + uni.setStorageSync('userInfo', { + ...uni.getStorageSync('userInfo'), + avatar: avatar + }); this.getDetail() this.$refs.uToast.show({ type: 'success', @@ -402,6 +419,7 @@ that.avatar = group.data.fullurl console.log(group.data) console.log(that.avata) + that.submit(); } }); } diff --git a/packageB/names/index.vue b/packageB/names/index.vue new file mode 100644 index 0000000..2e3f631 --- /dev/null +++ b/packageB/names/index.vue @@ -0,0 +1,111 @@ + + + + + diff --git a/pages.json b/pages.json index f4ef68a..8e3a9db 100644 --- a/pages.json +++ b/pages.json @@ -78,7 +78,8 @@ } ], - "subPackages": [{ + "subPackages": [ + { "root": "packageA", "pages": [{ "path": "afterSales/index", @@ -309,7 +310,13 @@ }, { "root": "packageB", - "pages": [{ + "pages": [ + { + "path": "names/index", + "style": { + "navigationBarTitleText": "昵称修改" + } + },{ "path": "wallet/index", "style": { "navigationBarTitleText": "我的钱包" diff --git a/pages/my/index.vue b/pages/my/index.vue index f6995e4..6cdcc20 100644 --- a/pages/my/index.vue +++ b/pages/my/index.vue @@ -5,9 +5,9 @@ class="con-center flex flex-start flex-column"> - + - + {{ userName }} @@ -19,7 +19,7 @@ 带着热爱,在搭子圈里撒野~ + style="width: 50rpx; height: 50rpx;position: absolute;right: 0;" @click="clickTop"> @@ -822,7 +822,7 @@ // }, - clickTop(val) { + clickTop() { // uni.navigateTo({ // url: '/packageA/my/person-detail' // }) @@ -832,7 +832,1432 @@ this.showPopup = true } else { uni.navigateTo({ - url: "/packageA/my/person-detail?type=" + val, + url: "/packageA/my/person-detail", + }) + } + }, + checkTokenAndRequest() { + if (uni.getStorageSync('token')) { + this.number(); + } + }, + // 定时器 + startTimer() { + if (!this.timer) { // 确保定时器只启动一次 + this.timer = setInterval(() => { + this.checkTokenAndRequest(); + }, 10000); // 每隔 10 秒执行一次 + } + }, + stopTimer() { + if (this.timer) { + clearInterval(this.timer); + this.timer = null; + } + }, + // 未读消息 + number() { + let that = this + uni.$u.http.get('/api/school/message/message_count', { + params: {}, + }).then(res => { + if (res.code == 1) { + that.$store.commit('setNumber', res.data.unread_number); + that.unread_number = res.data.unread_number + uni.setStorageSync('unread_number', res.data.unread_number) + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + }).catch(error => {}); + }, + + } + } + + + + +