|
|
@ -15,26 +15,38 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="detail-content-item"> |
|
|
|
<view class="detail-content-item"> |
|
|
|
<view class="detail-item-title">昵称</view> |
|
|
|
<view class="detail-item-title">昵称</view> |
|
|
|
<view class="detail-item-content">{{user.nickname}} |
|
|
|
<view class="detail-item-content"> |
|
|
|
|
|
|
|
<u-input v-model="user.name" inputAlign="right" ></u-input> |
|
|
|
<u-icon class="arrow-right" name="arrow-right"></u-icon> |
|
|
|
<u-icon class="arrow-right" name="arrow-right"></u-icon> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="detail-content-item"> |
|
|
|
<view class="detail-content-item" @click="$refs.datetimepicker.open()"> |
|
|
|
<view class="detail-item-title">生日</view> |
|
|
|
<view class="detail-item-title">生日</view> |
|
|
|
<view class="detail-item-content">{{user.birthday}} |
|
|
|
<view class="detail-item-content"> |
|
|
|
|
|
|
|
<u-text :text="birthday" size="28" color="#636363"></u-text> |
|
|
|
|
|
|
|
<uv-datetime-picker |
|
|
|
|
|
|
|
ref="datetimepicker" |
|
|
|
|
|
|
|
v-model="user.birthday" |
|
|
|
|
|
|
|
mode="date" |
|
|
|
|
|
|
|
minDate="1900-01-01" |
|
|
|
|
|
|
|
@confirm="birthdayConfirm" |
|
|
|
|
|
|
|
></uv-datetime-picker> |
|
|
|
<u-icon class="arrow-right" name="arrow-right"></u-icon> |
|
|
|
<u-icon class="arrow-right" name="arrow-right"></u-icon> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="detail-content-item"> |
|
|
|
<view class="detail-content-item"> |
|
|
|
<view class="detail-item-title">手机</view> |
|
|
|
<view class="detail-item-title">手机</view> |
|
|
|
<view class="detail-item-content">{{user.phone}} |
|
|
|
<view class="detail-item-content"> |
|
|
|
|
|
|
|
<u-input v-model="user.phone" inputAlign="right" ></u-input> |
|
|
|
<u-icon class="arrow-right" name="arrow-right"></u-icon> |
|
|
|
<u-icon class="arrow-right" name="arrow-right"></u-icon> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="detail-content-item"> |
|
|
|
<view class="detail-content-item" @click="$refs.sexPicker.open()"> |
|
|
|
<view class="detail-item-title">性别</view> |
|
|
|
<view class="detail-item-title">性别</view> |
|
|
|
<view class="detail-item-content">{{user.sex}} |
|
|
|
<view class="detail-item-content"> |
|
|
|
|
|
|
|
<u-text :text="sexTitle" size="28" color="#636363"></u-text> |
|
|
|
|
|
|
|
<uv-picker ref="sexPicker" @confirm="sexConfirm" :default-index="[sexChecked]" key-name="title" v-model="user.sex" :columns="sexs"></uv-picker> |
|
|
|
<u-icon class="arrow-right" name="arrow-right"></u-icon> |
|
|
|
<u-icon class="arrow-right" name="arrow-right"></u-icon> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -45,6 +57,9 @@ |
|
|
|
<view class="detail-item-background"></view> |
|
|
|
<view class="detail-item-background"></view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view @click="submit" class="detail-logout-button"> |
|
|
|
|
|
|
|
修改信息 |
|
|
|
|
|
|
|
</view> |
|
|
|
<view class="detail-logout-button"> |
|
|
|
<view class="detail-logout-button"> |
|
|
|
退出登录 |
|
|
|
退出登录 |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -63,19 +78,28 @@ |
|
|
|
} from '@/config/host.js' |
|
|
|
} from '@/config/host.js' |
|
|
|
import api from '@/utils/functions.js'; |
|
|
|
import api from '@/utils/functions.js'; |
|
|
|
import HeaderNav from '@/components/HeaderNav/Index.vue'; |
|
|
|
import HeaderNav from '@/components/HeaderNav/Index.vue'; |
|
|
|
|
|
|
|
import log from "@/utils/log"; |
|
|
|
|
|
|
|
import {updateUserDetail, userDetail} from "@/api/user"; |
|
|
|
|
|
|
|
import functions from "@/utils/functions.js"; |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
components:{ |
|
|
|
components:{ |
|
|
|
HeaderNav |
|
|
|
HeaderNav |
|
|
|
}, |
|
|
|
}, |
|
|
|
data: { |
|
|
|
data: { |
|
|
|
|
|
|
|
sexChecked:0, |
|
|
|
|
|
|
|
sexTitle:'', |
|
|
|
|
|
|
|
birthday:'', |
|
|
|
|
|
|
|
show:false, |
|
|
|
|
|
|
|
sexShow:false, |
|
|
|
|
|
|
|
sexs:[[{title: '男', value: 1}, {title:'女', value:2}]], |
|
|
|
staticImage:{ |
|
|
|
staticImage:{ |
|
|
|
wallpaperBgImage:imghost+'/static/image/background.png', |
|
|
|
wallpaperBgImage:imghost+'/static/image/background.png', |
|
|
|
}, |
|
|
|
}, |
|
|
|
user:{ |
|
|
|
user:{ |
|
|
|
avatar:imghost+'/static/image/banner.png', |
|
|
|
avatar:imghost+'/static/image/banner.png', |
|
|
|
nickname:'清晨的风', |
|
|
|
name:'清晨的风', |
|
|
|
background:imghost+'/static/image/banner.png', |
|
|
|
background:imghost+'/static/image/banner.png', |
|
|
|
sex:'女', |
|
|
|
sex:1, |
|
|
|
phone:'15012345678', |
|
|
|
phone:'15012345678', |
|
|
|
coupons:221, |
|
|
|
coupons:221, |
|
|
|
id:88685, |
|
|
|
id:88685, |
|
|
@ -83,10 +107,43 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
onLoad() { |
|
|
|
|
|
|
|
this.setSexTitle(); |
|
|
|
|
|
|
|
this.getUserDetail(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
getUserDetail(){ |
|
|
|
|
|
|
|
userDetail().then(({ data }) => { |
|
|
|
|
|
|
|
this.user = data; |
|
|
|
|
|
|
|
this.birthday = this.user.birthday ? this.user.birthday : '2000-01-01' |
|
|
|
|
|
|
|
this.user.birthday = this.birthday |
|
|
|
|
|
|
|
this.user.sex = this.user.sex === 1 ? 1 : 2; |
|
|
|
|
|
|
|
this.setSexTitle(this.user.sex); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
sexConfirm(v){ |
|
|
|
|
|
|
|
log(v); |
|
|
|
|
|
|
|
this.user.sex = v.value[0].value; |
|
|
|
|
|
|
|
this.setSexTitle(v.value[0].value); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
birthdayConfirm(v){ |
|
|
|
|
|
|
|
this.birthday = uni.$u.timeFormat(v.value, 'yyyy-mm-dd'); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
submit(){ |
|
|
|
|
|
|
|
if(this.user.birthday ){ |
|
|
|
|
|
|
|
this.user.birthday = uni.$u.timeFormat(this.user.birthday, 'yyyy-mm-dd') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
updateUserDetail(this.user).then((data) =>{ |
|
|
|
|
|
|
|
uni.setStorageSync('user', data.data); |
|
|
|
|
|
|
|
functions.success("修改成功").then(() =>{ |
|
|
|
|
|
|
|
uni.navigateBack(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
setSexTitle(v){ |
|
|
|
|
|
|
|
log(v); |
|
|
|
|
|
|
|
this.sexTitle = [0, '男', '女'][v ? v : this.user.sex]; |
|
|
|
|
|
|
|
log(this.sexTitle); |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
onPageScroll(res) { |
|
|
|
onPageScroll(res) { |
|
|
|
|
|
|
|
|
|
|
|