Compare commits
No commits in common. "d0bf9c0768948bb8facc7867d0a6c846c302a6a1" and "a25be335e66fae683c54bd176b5b7338f42450c1" have entirely different histories.
d0bf9c0768
...
a25be335e6
|
@ -26,7 +26,12 @@ 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()],
|
||||
|
|
|
@ -113,6 +113,9 @@ const emits = defineEmits(['setLayout'])
|
|||
function setLayout() {
|
||||
emits('setLayout');
|
||||
}
|
||||
watch(()=> userStore.avatar,() => {
|
||||
userImg.value = userStore.avatar;
|
||||
},{deep:true})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -36,7 +36,6 @@ 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;
|
||||
|
@ -47,8 +46,8 @@ const useUserStore = defineStore(
|
|||
} else {
|
||||
this.roles = ['ROLE_DEFAULT']
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
this.id = user.userId
|
||||
this.userName = user.userName
|
||||
this.nickName = user.nickName;
|
||||
|
@ -71,7 +70,7 @@ const useUserStore = defineStore(
|
|||
this.plainpwd = user.plainpwd;
|
||||
|
||||
this.roles = res.roles;
|
||||
|
||||
|
||||
resolve(res)
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
|
|
|
@ -99,7 +99,6 @@ 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
|
||||
|
|
|
@ -84,7 +84,7 @@ const title = ref('修改头像')
|
|||
|
||||
//图片裁剪数据
|
||||
const options = reactive({
|
||||
img: userStore.user.avatar, // 裁剪图片的地址
|
||||
img: userStore.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.user.avatar = options.img
|
||||
userStore.avatar = options.img
|
||||
ElMessage({
|
||||
message: '上传成功',
|
||||
type: 'success',
|
||||
|
|
Loading…
Reference in New Issue