zhuhao_dev #58

Merged
zhuhao merged 2 commits from zhuhao_dev into main 2024-07-24 14:49:34 +08:00
5 changed files with 8 additions and 14 deletions

View File

@ -26,12 +26,7 @@ export default defineConfig({
target: 'http://192.168.2.52:7863',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '')
},
'/profile': {
target: 'http://192.168.2.52:7863',
ws: true,
changeOrigin: true
},
}
},
},
plugins: [vue(), WindiCSS()],

View File

@ -113,9 +113,6 @@ const emits = defineEmits(['setLayout'])
function setLayout() {
emits('setLayout');
}
watch(()=> userStore.avatar,() => {
userImg.value = userStore.avatar;
},{deep:true})
</script>
<style lang="scss" scoped>

View File

@ -36,6 +36,7 @@ const useUserStore = defineStore(
getInfo() {
return new Promise((resolve, reject) => {
getInfo().then(res => {
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;
@ -46,8 +47,8 @@ const useUserStore = defineStore(
} else {
this.roles = ['ROLE_DEFAULT']
}
this.id = user.userId
this.userName = user.userName
this.nickName = user.nickName;
@ -70,7 +71,7 @@ const useUserStore = defineStore(
this.plainpwd = user.plainpwd;
this.roles = res.roles;
resolve(res)
}).catch(error => {
reject(error)

View File

@ -99,6 +99,7 @@ const state = reactive({
function getUser() {
getUserProfile().then((response) => {
response.data.avatar = import.meta.env.VITE_APP_BASE_API + response.data.avatar
state.user = response.data
state.roleGroup = response.roleGroup
state.postGroup = response.postGroup

View File

@ -84,7 +84,7 @@ const title = ref('修改头像')
//
const options = reactive({
img: userStore.avatar, //
img: userStore.user.avatar, //
autoCrop: true, //
autoCropWidth: 200, //
autoCropHeight: 200, //
@ -155,7 +155,7 @@ function uploadImg() {
uploadAvatar(formData).then((response) => {
open.value = false
options.img = import.meta.env.VITE_APP_BASE_API + response.imgUrl
userStore.avatar = options.img
userStore.user.avatar = options.img
ElMessage({
message: '上传成功',
type: 'success',