个人中心页面路径配置
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<up-cell-group>
|
||||
<up-cell title="头像">
|
||||
<template #value>
|
||||
<image :src="data.userInfo.avatar?data.userInfo.avatar:'../../static/default/avatar.png'" mode="" @click="uploadImg"
|
||||
<image :src="data.userInfo.avatar?data.userInfo.avatar:'../../static/default/avatar.png'" mode="aspectFill" @click="uploadImg"
|
||||
style="width: 111rpx;height: 111rpx;border-radius: 50%;"></image>
|
||||
</template>
|
||||
</up-cell>
|
||||
@@ -26,7 +26,7 @@
|
||||
import { reactive } from 'vue';
|
||||
import { onShow} from '@dcloudio/uni-app'
|
||||
import config from '@/commons/config.js';
|
||||
import {selectUserById} from '@/api/user/user.js';
|
||||
import { selectUserById, updateUsers } from '@/api/user/user.js';
|
||||
|
||||
let data = reactive({
|
||||
userInfo: {
|
||||
@@ -37,7 +37,6 @@
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
// console.log(1)
|
||||
getUserInfo()
|
||||
})
|
||||
|
||||
@@ -46,9 +45,7 @@
|
||||
*/
|
||||
async function getUserInfo () {
|
||||
let res = await selectUserById()
|
||||
if ( res.code == 0 ) {
|
||||
data.userInfo = res.data
|
||||
}
|
||||
data.userInfo = res
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,25 +127,25 @@
|
||||
title: '温馨提示',
|
||||
content: '确定保存信息',
|
||||
confirmColor: '#ff7581',
|
||||
success: e => {
|
||||
success: async e => {
|
||||
if (e.confirm) {
|
||||
http.request({
|
||||
url:'app/user/updateUsers',
|
||||
method: 'post',
|
||||
data: {
|
||||
let res = await updateUsers({
|
||||
userName: data.userInfo.userName,
|
||||
avatar: data.userInfo.avatar,
|
||||
phone: data.userInfo.phone,
|
||||
}
|
||||
}).then(res => {
|
||||
uni.showToast({
|
||||
title: '保存成功',
|
||||
icon: "none"
|
||||
})
|
||||
setTimeout(function() {
|
||||
uni.navigateBack()
|
||||
}, 1000)
|
||||
uni.showToast({
|
||||
title: '保存成功',
|
||||
icon: "none"
|
||||
})
|
||||
let userInfo = uni.getStorageSync('userInfo');
|
||||
userInfo.userName = data.userInfo.userName
|
||||
userInfo.avatar = data.userInfo.avatar
|
||||
userInfo.phone = data.userInfo.phone
|
||||
uni.setStorageSync('userInfo', userInfo);
|
||||
setTimeout(function() {
|
||||
uni.navigateBack()
|
||||
}, 1000)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user