From b147206385871bf2b4c9d5854587bd568ded926d Mon Sep 17 00:00:00 2001 From: zhangkai <847704969@qq.com> Date: Fri, 13 Jun 2025 15:15:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=AD=BE=E5=90=8D=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packageA/my/person-detail.vue | 25 ++++++++++-- packageB/names/index.vue | 77 +++++++++++++++++++++++++++-------- pages.json | 3 +- pages/my/index.vue | 6 ++- 4 files changed, 88 insertions(+), 23 deletions(-) diff --git a/packageA/my/person-detail.vue b/packageA/my/person-detail.vue index 34b63af..a951784 100644 --- a/packageA/my/person-detail.vue +++ b/packageA/my/person-detail.vue @@ -17,13 +17,24 @@ 昵称设置 - + {{niName}} + + + 签名 + + + + {{signature}} + + + 银行卡 @@ -159,7 +170,10 @@ border: 'none', fontFamily: "YouSheBiaoTiHei" }, + //昵称 niName: '', + //签名 + signature: '带着热爱,在搭子圈里撒野~', realname: '', gender: '', // ages: '', @@ -228,6 +242,7 @@ } }, onLoad(options) { + debugger if (options) { this.typeop = options.type; } @@ -236,7 +251,8 @@ this.niName = userInfo.nickname this.realname = userInfo.username this.avatar = userInfo.avatar - this.$refs.datetimePicker.setFormatter(this.formatter) + this.signature = userInfo.bio != '' ? userInfo.bio : '带着热爱,在搭子圈里撒野~' + // this.$refs.datetimePicker.setFormatter(this.formatter) // this.handelData() // this.getDetail() }, @@ -259,9 +275,10 @@ url: '/packageB/card/index' }) }, - toName(){ + toName(e){ + debugger; uni.navigateTo({ - url: '/packageB/names/index' + url: '/packageB/names/index?type='+ e }) }, getSfInfo() { diff --git a/packageB/names/index.vue b/packageB/names/index.vue index 2e3f631..17d093e 100644 --- a/packageB/names/index.vue +++ b/packageB/names/index.vue @@ -1,12 +1,23 @@ @@ -15,30 +26,57 @@ export default { data() { return { + istype:false, + title:"", form: { nickname: '', + bio: '' }, } }, - onLoad() { - this.form.nickname = uni.getStorageSync('userInfo').nickname; + onLoad(options) { + if (options.type == 'nc') { + this.istype = true; + this.title = '修改昵称' + this.form.nickname = uni.getStorageSync('userInfo').nickname; + }else{ + this.istype = false; + this.title = '修改签名' + this.form.bio = uni.getStorageSync('userInfo').bio; + } + }, methods: { save() { - if (this.form.nickname == '') { - uni.showToast({ - title: '请输入昵称', - icon: "none", - duration: 1500, - }); - return; + if (this.istype) { + if (this.form.nickname == '') { + uni.showToast({ + title: '请输入昵称', + icon: "none", + duration: 1500, + }); + return; + } + }else{ + if (this.form.bio == '') { + uni.showToast({ + title: '请输入签名', + icon: "none", + duration: 1500, + }); + return; + } } + + let nickname = this.form.nickname; + let bio = this.form.bio; uni.$u.http .post("/api/user/profile", { nickname: nickname, - update_fields: ['nickname'] + bio: bio, + update_fields: ['nickname','bio'] }) .then((res) => { console.log(res); @@ -53,11 +91,18 @@ export default { }, 1500); } }); - uni.setStorageSync('userInfo', { - ...uni.getStorageSync('userInfo'), - nickname: nickname - }); - uni.setStorageSync('niName', nickname); + if (this.istype) { + uni.setStorageSync('userInfo', { + ...uni.getStorageSync('userInfo'), + nickname: nickname + }); + uni.setStorageSync('niName', nickname); + }else{ + uni.setStorageSync('userInfo', { + ...uni.getStorageSync('userInfo'), + bio: bio + }); + } } else { uni.showToast({ title: res.msg, diff --git a/pages.json b/pages.json index 8e3a9db..bb28346 100644 --- a/pages.json +++ b/pages.json @@ -314,7 +314,8 @@ { "path": "names/index", "style": { - "navigationBarTitleText": "昵称修改" + "navigationBarTitleText": "", + "navigationStyle": "custom" } },{ "path": "wallet/index", diff --git a/pages/my/index.vue b/pages/my/index.vue index e1e60da..8a09ebd 100644 --- a/pages/my/index.vue +++ b/pages/my/index.vue @@ -12,11 +12,11 @@ style="display: flex;align-items: center;;margin-bottom: 20rpx;font-weight: 800;font-size: 34rpx;color: #181818;"> {{ userName }} - + - 带着热爱,在搭子圈里撒野~ + {{ bio || '带着热爱,在搭子圈里撒野~'}} @@ -195,6 +195,7 @@ hotList: [], showPopup: false, userName: '请登录', + bio:'', actives: 0, pushActives: 0, show: false, @@ -753,6 +754,7 @@ this.showPopup = false this.userName = res.data.user_info.nickname; + this.bio = res.data.user_info.bio; this.avatar = res.data.user_info.avatar; this.actives = res.data.activity_info.join_num; this.pushActives = res.data.activity_info.release_num;