|
|
@ -26,7 +26,7 @@ |
|
|
|
</view> |
|
|
|
<view class="form-item"> |
|
|
|
<text class="label">性别</text> |
|
|
|
<radio-group> |
|
|
|
<radio-group @change="onGenderChange"> |
|
|
|
<label class="radio"> |
|
|
|
<radio value="男" color="#27ba9b" :checked="profile?.gender === '男'" /> |
|
|
|
男 |
|
|
@ -45,6 +45,7 @@ |
|
|
|
start="1900-01-01" |
|
|
|
:end="new Date()" |
|
|
|
:value="profile?.birthday" |
|
|
|
@change="onBirthdayChange" |
|
|
|
> |
|
|
|
<view v-if="profile?.birthday">{{ profile?.birthday }}</view> |
|
|
|
<view class="placeholder" v-else>请选择日期</view> |
|
|
@ -54,7 +55,12 @@ |
|
|
|
<!-- #ifdef MP-WEIXIN --> |
|
|
|
<view class="form-item"> |
|
|
|
<text class="label">城市</text> |
|
|
|
<picker class="picker" mode="region" :value="profile?.fullLocation?.split(' ')"> |
|
|
|
<picker |
|
|
|
class="picker" |
|
|
|
mode="region" |
|
|
|
:value="profile?.fullLocation?.split(' ')" |
|
|
|
@change="onFullLocationChange" |
|
|
|
> |
|
|
|
<view v-if="profile?.fullLocation">{{ profile?.fullLocation }}</view> |
|
|
|
<view class="placeholder" v-else>请选择城市</view> |
|
|
|
</picker> |
|
|
@ -62,7 +68,7 @@ |
|
|
|
<!-- #endif --> |
|
|
|
<view class="form-item"> |
|
|
|
<text class="label">职业</text> |
|
|
|
<input class="input" type="text" placeholder="请填写职业" :value="profile?.profession" /> |
|
|
|
<input class="input" type="text" placeholder="请填写职业" v-model="profile.profession" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- 提交按钮 --> |
|
|
@ -125,10 +131,36 @@ const onAvatarChange = () => { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 修改性别 |
|
|
|
const onGenderChange: UniHelper.RadioGroupOnChange = (ev) => { |
|
|
|
profile.value.gender = ev.detail.value as Gender |
|
|
|
} |
|
|
|
|
|
|
|
// 修改生日 |
|
|
|
const onBirthdayChange: UniHelper.DatePickerOnChange = (ev) => { |
|
|
|
profile.value.birthday = ev.detail.value |
|
|
|
} |
|
|
|
|
|
|
|
// 修改城市 |
|
|
|
let fullLocationCode: [string, string, string] = ['', '', ''] |
|
|
|
const onFullLocationChange: UniHelper.RegionPickerOnChange = (ev) => { |
|
|
|
// 修改前端界面 |
|
|
|
profile.value.fullLocation = ev.detail.value.join(' ') |
|
|
|
// 提交后端更新 |
|
|
|
fullLocationCode = ev.detail.code! |
|
|
|
} |
|
|
|
|
|
|
|
const onSubmit = async () => { |
|
|
|
//修改个人信息 |
|
|
|
const { nickname, gender, birthday, profession } = profile.value |
|
|
|
const res = await putMemberProfileAPI({ |
|
|
|
nickname: profile.value.nickname, |
|
|
|
nickname, |
|
|
|
gender, |
|
|
|
birthday, |
|
|
|
profession, |
|
|
|
provinceCode: fullLocationCode[0] || undefined, |
|
|
|
cityCode: fullLocationCode[1] || undefined, |
|
|
|
countyCode: fullLocationCode[2] || undefined, |
|
|
|
}) |
|
|
|
// 更新Store昵称 |
|
|
|
memberStore.profile!.nickname = res.result.nickname |
|
|
|