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>
<view class="form-item"> <view class="form-item">
<text class="label">性别</text> <text class="label">性别</text>
<radio-group>
<radio-group @change="onGenderChange">
<label class="radio"> <label class="radio">
<radio value="男" color="#27ba9b" :checked="profile?.gender === '男'" /> <radio value="男" color="#27ba9b" :checked="profile?.gender === '男'" />
@ -45,6 +45,7 @@
start="1900-01-01" start="1900-01-01"
:end="new Date()" :end="new Date()"
:value="profile?.birthday" :value="profile?.birthday"
@change="onBirthdayChange"
> >
<view v-if="profile?.birthday">{{ profile?.birthday }}</view> <view v-if="profile?.birthday">{{ profile?.birthday }}</view>
<view class="placeholder" v-else>请选择日期</view> <view class="placeholder" v-else>请选择日期</view>
@ -54,7 +55,12 @@
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<view class="form-item"> <view class="form-item">
<text class="label">城市</text> <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 v-if="profile?.fullLocation">{{ profile?.fullLocation }}</view>
<view class="placeholder" v-else>请选择城市</view> <view class="placeholder" v-else>请选择城市</view>
</picker> </picker>
@ -62,7 +68,7 @@
<!-- #endif --> <!-- #endif -->
<view class="form-item"> <view class="form-item">
<text class="label">职业</text> <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>
</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 onSubmit = async () => {
// //
const { nickname, gender, birthday, profession } = profile.value
const res = await putMemberProfileAPI({ 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 // Store
memberStore.profile!.nickname = res.result.nickname memberStore.profile!.nickname = res.result.nickname

Loading…
Cancel
Save