Browse Source

对接修改会员资料接口

master
邓平艺 4 years ago
parent
commit
90a44da738
  1. 3
      pages/user/my/setting.vue
  2. 92
      pages/user/my/vipinfo.vue

3
pages/user/my/setting.vue

@ -7,7 +7,8 @@
昵称 昵称
</view> </view>
<view class="lf-flex"> <view class="lf-flex">
<view class="lf-font-28 lf-color-555">{{ userInfo.nick_name || userInfo.mobile }}</view><text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text>
<view class="lf-font-28 lf-color-555">{{ userInfo.nick_name || userInfo.mobile }}</view>
<text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text>
</view> </view>
</view> </view>
</view> </view>

92
pages/user/my/vipinfo.vue

@ -10,7 +10,7 @@
*姓名 *姓名
</view> </view>
<view class="lf-flex"> <view class="lf-flex">
<input type="text" class="edit-input" placeholder="182****5380" />
<input type="text" class="edit-input" v-model="info.name" placeholder="请输入姓名" />
</view> </view>
</view> </view>
</view> </view>
@ -20,7 +20,7 @@
国籍 国籍
</view> </view>
<view class="lf-flex"> <view class="lf-flex">
<input type="text" class="edit-input" placeholder="请输入你的国籍" />
<input type="text" class="edit-input" v-model="info.native_place" placeholder="请输入你的国籍" />
</view> </view>
</view> </view>
</view> </view>
@ -30,7 +30,7 @@
性别 性别
</view> </view>
<view class="lf-flex"> <view class="lf-flex">
<input type="text" class="edit-input" placeholder="" />
<input type="text" class="edit-input" :value="info.sex" :disabled="true" placeholder="未填写" />
</view> </view>
</view> </view>
</view> </view>
@ -40,7 +40,7 @@
出生日期 出生日期
</view> </view>
<view class="lf-flex"> <view class="lf-flex">
<input type="text" class="edit-input" placeholder="1999-12-12" />
<input type="text" class="edit-input" :value="info.birthday" :disabled="true" placeholder="未填写" />
</view> </view>
</view> </view>
</view> </view>
@ -50,7 +50,7 @@
身份证号 身份证号
</view> </view>
<view class="lf-flex"> <view class="lf-flex">
<input type="text" class="edit-input" placeholder="450111199912122232(不可修改)" />
<input type="text" class="edit-input" :value="info.id_number" :disabled="true" placeholder="未填写" />
</view> </view>
</view> </view>
</view> </view>
@ -60,8 +60,8 @@
通讯地址 通讯地址
</view> </view>
<view class="lf-flex"> <view class="lf-flex">
<picker mode="selector" @change="getValue('marriage', $event)" :range="marriage" :value="marriage_index">
<text class="lf-font-28 lf-color-777">{{ marriage[marriage_index] || '请选择' }}</text>
<picker mode="region" :value="info.address" @change="addressChange" >
<text class="address-picker">{{ info.address.join('') || '请选择' }}</text>
</picker> </picker>
</view> </view>
</view> </view>
@ -69,8 +69,8 @@
<view class="lf-p-l-32 lf-p-r-32"> <view class="lf-p-l-32 lf-p-r-32">
<view class="set-tag lf-border-bottom"> <view class="set-tag lf-border-bottom">
<view class="lf-font-28 lf-color-black"></view> <view class="lf-font-28 lf-color-black"></view>
<view class="lf-flex">
<input type="text" class="edit-input" placeholder="请输入您的详细地址" />
<view class="lf-flex lf-w-100">
<input type="text" class="edit-input lf-w-100" v-model="info.address_detail" placeholder="请输入您的详细地址" />
</view> </view>
</view> </view>
</view> </view>
@ -80,7 +80,7 @@
家庭地址 家庭地址
</view> </view>
<view class="lf-flex"> <view class="lf-flex">
<input type="text" class="edit-input" placeholder="请输入您的家庭地址" />
<input type="text" class="edit-input" v-model="info.home_address" placeholder="请输入您的家庭地址" />
</view> </view>
</view> </view>
</view> </view>
@ -90,7 +90,7 @@
学历 学历
</view> </view>
<view class="lf-flex"> <view class="lf-flex">
<input type="text" class="edit-input" placeholder="请输入您的学历" />
<input type="text" class="edit-input" v-model="info.education" placeholder="请输入您的学历" />
</view> </view>
</view> </view>
</view> </view>
@ -99,7 +99,7 @@
温馨提示身份证号出生日期不支持线上修改如需修改请前往服务台办理 温馨提示身份证号出生日期不支持线上修改如需修改请前往服务台办理
</view> </view>
<button class="set-btn" hover-class="lf-opacity">保存</button>
<button class="set-btn" hover-class="lf-opacity" @click="submit">保存</button>
</view> </view>
</template> </template>
@ -108,12 +108,71 @@
export default { export default {
data() { data() {
return { 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: { 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){ getValue(current, event){
this[current +'_index'] = event.detail.value; 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; justify-content: space-between;
// border-bottom: 1rpx solid rgba(0, 0, 0, 0.1); // 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 { /deep/.input-placeholder {
font-size: 28rpx; font-size: 28rpx;
color: #777; color: #777;

Loading…
Cancel
Save