|
|
@ -22,7 +22,7 @@ |
|
|
|
</view> |
|
|
|
<view class="form-item"> |
|
|
|
<text class="label">昵称</text> |
|
|
|
<input class="input" type="text" placeholder="请填写昵称" :value="profile?.nickname" /> |
|
|
|
<input class="input" type="text" placeholder="请填写昵称" v-model="profile.nickname" /> |
|
|
|
</view> |
|
|
|
<view class="form-item"> |
|
|
|
<text class="label">性别</text> |
|
|
@ -66,7 +66,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- 提交按钮 --> |
|
|
|
<button class="form-button">保 存</button> |
|
|
|
<button class="form-button" @tap="onSubmit">保 存</button> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
@ -75,13 +75,13 @@ |
|
|
|
import { onLoad } from '@dcloudio/uni-app' |
|
|
|
import { ref } from 'vue' |
|
|
|
import type { Gender, ProfileDetail } from '@/types/member' |
|
|
|
import { getMemberProfileAPI } from '@/services/profile' |
|
|
|
import { getMemberProfileAPI, putMemberProfileAPI } from '@/services/profile' |
|
|
|
|
|
|
|
// 获取屏幕边界到安全区域距离 |
|
|
|
const { safeAreaInsets } = uni.getSystemInfoSync() |
|
|
|
|
|
|
|
// 获取个人信息 |
|
|
|
const profile = ref<ProfileDetail>() |
|
|
|
// 获取个人信息,修改个人信息需提供初始值 |
|
|
|
const profile = ref({} as ProfileDetail) |
|
|
|
const getMemberProfileData = async () => { |
|
|
|
const res = await getMemberProfileAPI() |
|
|
|
profile.value = res.result |
|
|
@ -120,6 +120,17 @@ const onAvatarChange = () => { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const onSubmit = async () => { |
|
|
|
//修改个人信息 |
|
|
|
const res = await putMemberProfileAPI({ |
|
|
|
nickname: profile.value.nickname, |
|
|
|
}) |
|
|
|
// 成功提示 |
|
|
|
uni.showToast({ |
|
|
|
icon: 'success', |
|
|
|
title: '保存成功', |
|
|
|
}) |
|
|
|
} |
|
|
|
onLoad(() => { |
|
|
|
getMemberProfileData() |
|
|
|
}) |
|
|
|