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;