个人中心优化

This commit is contained in:
GaoHao 2025-01-21 17:22:26 +08:00
parent d1153659cb
commit ef55dc901e
1 changed files with 21 additions and 20 deletions

View File

@ -12,11 +12,11 @@
<input v-model="data.userInfo.userName" align="right" placeholder="请输入用户名" />
</template>
</up-cell>
<up-cell title="手机">
<!-- <up-cell title="手机">
<template #value>
<input :disabled="data.userInfo.phone?true:false" v-model="data.userInfo.phone" align="right" placeholder="请输入联系电话" />
<input v-model="data.userInfo.phone" align="right" placeholder="请输入联系电话" />
</template>
</up-cell>
</up-cell> -->
</up-cell-group>
<view class="save" @click="save">保存</view>
</view>
@ -62,7 +62,8 @@
if (index === 0) {
//
//
let url = data.userInfo.avatar;
console.log()
let url = data.userInfo.avatar||'../../static/default/avatar.png';
let arr = []
arr.push(url)
uni.previewImage({
@ -108,20 +109,20 @@
})
return
}
if (!data.userInfo.phone) {
uni.showToast({
title: "手机号不能空",
icon: "none"
})
return
}
if (checkPhone(data.userInfo.phone) == false) {
uni.showToast({
title: "手机号格式不正确",
icon: "none"
})
return
}
// if (!data.userInfo.phone) {
// uni.showToast({
// title: "",
// icon: "none"
// })
// return
// }
// if (checkPhone(data.userInfo.phone) == false) {
// uni.showToast({
// title: "",
// icon: "none"
// })
// return
// }
uni.showModal({
title: '温馨提示',
@ -132,7 +133,7 @@
let res = await updateUsers({
userName: data.userInfo.userName,
avatar: data.userInfo.avatar,
phone: data.userInfo.phone,
// phone: data.userInfo.phone,
})
uni.showToast({
title: '保存成功',
@ -141,7 +142,7 @@
let userInfo = uni.getStorageSync('userInfo');
userInfo.userName = data.userInfo.userName
userInfo.avatar = data.userInfo.avatar
userInfo.phone = data.userInfo.phone
// userInfo.phone = data.userInfo.phone
uni.setStorageSync('userInfo', userInfo);
setTimeout(function() {
uni.navigateBack()