From 90a44da738af6515911bc843303655059865113e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E5=B9=B3=E8=89=BA?= <52643018@qq.com> Date: Wed, 15 Sep 2021 18:36:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E4=BF=AE=E6=94=B9=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E8=B5=84=E6=96=99=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/user/my/setting.vue | 3 +- pages/user/my/vipinfo.vue | 92 +++++++++++++++++++++++++++++++++------ 2 files changed, 81 insertions(+), 14 deletions(-) diff --git a/pages/user/my/setting.vue b/pages/user/my/setting.vue index 879cdbc..fa8dc8c 100644 --- a/pages/user/my/setting.vue +++ b/pages/user/my/setting.vue @@ -7,7 +7,8 @@ 昵称 - {{ userInfo.nick_name || userInfo.mobile }} + {{ userInfo.nick_name || userInfo.mobile }} + diff --git a/pages/user/my/vipinfo.vue b/pages/user/my/vipinfo.vue index f9f6b95..fde77ee 100644 --- a/pages/user/my/vipinfo.vue +++ b/pages/user/my/vipinfo.vue @@ -10,7 +10,7 @@ *姓名 - + @@ -20,7 +20,7 @@ 国籍 - + @@ -30,7 +30,7 @@ 性别 - + @@ -40,7 +40,7 @@ 出生日期 - + @@ -50,7 +50,7 @@ 身份证号 - + @@ -60,8 +60,8 @@ 通讯地址 - - {{ marriage[marriage_index] || '请选择' }} + + {{ info.address.join('') || '请选择' }} @@ -69,8 +69,8 @@ - - + + @@ -80,7 +80,7 @@ 家庭地址 - + @@ -90,7 +90,7 @@ 学历 - + @@ -99,7 +99,7 @@ 温馨提示:身份证号出生日期不支持线上修改,如需修改请前往服务台办理。 - + @@ -108,12 +108,71 @@ export default { data() { return { - marriage: ['已婚', '未婚'], + info: { + name: '', + native_place: '', + sex: '', + birthday: '', + id_number: '', + address: [], + address_detail: '', + home_address: '', + education: '' + }, + token: '' } }, + onLoad(){ + var token = this.$cookieStorage.get('user_token'); + this.token = token; + this.getMeInfo(); + }, methods: { + getMeInfo(){ + this.$http.get({ + api: 'api/me', + header: { + Authorization: this.token + } + }).then(res => { + let detail = res.data.data; + let info = this.info; + info.name = detail.name; + info.sex = detail.sex; + info.birthday = detail.birthday; + // todo 其他信息待补充... + this.info = info; + }) + }, getValue(current, event){ this[current +'_index'] = event.detail.value; + }, + addressChange(event){ + this.info.address = event.detail.value; + }, + submit(){ + console.log(this.info); + uni.showLoading({ + title: '正在保存中' + }); + // TODO 其他参数待传入对接 + this.$http.post({ + api: 'api/users/update/info', + data: { + name: this.info.name, + // education: this.info.education + }, + header: { + Authorization: this.token, + Accept: 'application/json' + } + }).then(res => { + uni.hideLoading(); + this.$msg('保存成功', {icon: 'success'}); + }).catch(err => { + uni.hideLoading(); + this.$msg('保存失败', {icon: 'error'}); + }) } } } @@ -151,6 +210,13 @@ justify-content: space-between; // border-bottom: 1rpx solid rgba(0, 0, 0, 0.1); } + .address-picker{ + font-size: 28rpx; + color: #777777; + display: inline-block; + width: 400rpx; + text-align: right; + } /deep/.input-placeholder { font-size: 28rpx; color: #777;