Browse Source

个人信息其他信息修改

template
liruiqiang 2 months ago
parent
commit
de6b732b69
  1. 40
      src/pagesMember/profile/profile.vue

40
src/pagesMember/profile/profile.vue

@ -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

Loading…
Cancel
Save