Merge pull request 'fix:上传存图片路径之前取的缓存接口getUserProfile(),并且去掉前缀dev-api保证图片回显;' (#137) from yangws into main

Reviewed-on: #137
This commit is contained in:
yangws 2024-08-15 14:11:32 +08:00
commit 2a4dac58ac
4 changed files with 11 additions and 5 deletions

View File

@ -50,3 +50,9 @@ export function updateUserInfo(data) {
data: data
})
}
export function getUserInfo(userId) {
return request({
url: '/system/user/' + userId,
method: 'get'
})
}

View File

@ -37,7 +37,7 @@ const useUserStore = defineStore('user', {
return new Promise((resolve, reject) => {
getInfo()
.then((res) => {
res.user.avatar = import.meta.env.VITE_APP_BASE_API + res.user.avatar
// res.user.avatar = import.meta.env.VITE_APP_BASE_API + res.user.avatar
const user = res.user
this.user = user
const avatar = user.avatar == '' || user.avatar == null ? defAva : user.avatar

View File

@ -97,10 +97,10 @@ const state = reactive({
postGroup: {}
})
function getUser() {
async function getUser() {
getUserProfile().then((response) => {
response.data.avatar = import.meta.env.VITE_APP_BASE_API + response.data.avatar
state.user = response.data
// response.data.avatar = import.meta.env.VITE_APP_BASE_API + response.data.avatar
Object.assign(state.user,response.data)
state.roleGroup = response.roleGroup
state.postGroup = response.postGroup
})

View File

@ -68,7 +68,7 @@ function uploadImg(data) {
/** 关闭窗口 */
function closeDialog() {
// options.img = userStore.avatar
options.img = userStore.user.avatar
options.visible = false
}
const cancle = () => {