Compare commits
3 Commits
62248dfafa
...
eff5688e42
Author | SHA1 | Date |
---|---|---|
朱浩 | eff5688e42 | |
朱浩 | 4e9c93da15 | |
朱浩 | a25be335e6 |
|
@ -26,12 +26,7 @@ export default defineConfig({
|
||||||
target: 'http://192.168.2.52:7863',
|
target: 'http://192.168.2.52:7863',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (p) => p.replace(/^\/dev-api/, '')
|
rewrite: (p) => p.replace(/^\/dev-api/, '')
|
||||||
},
|
}
|
||||||
'/profile': {
|
|
||||||
target: 'http://192.168.2.52:7863',
|
|
||||||
ws: true,
|
|
||||||
changeOrigin: true
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [vue(), WindiCSS()],
|
plugins: [vue(), WindiCSS()],
|
||||||
|
|
|
@ -113,9 +113,6 @@ const emits = defineEmits(['setLayout'])
|
||||||
function setLayout() {
|
function setLayout() {
|
||||||
emits('setLayout');
|
emits('setLayout');
|
||||||
}
|
}
|
||||||
watch(()=> userStore.avatar,() => {
|
|
||||||
userImg.value = userStore.avatar;
|
|
||||||
},{deep:true})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -36,6 +36,7 @@ const useUserStore = defineStore(
|
||||||
getInfo() {
|
getInfo() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getInfo().then(res => {
|
getInfo().then(res => {
|
||||||
|
res.user.avatar = import.meta.env.VITE_APP_BASE_API + res.user.avatar
|
||||||
const user = res.user
|
const user = res.user
|
||||||
this.user = user
|
this.user = user
|
||||||
const avatar = (user.avatar == "" || user.avatar == null) ? defAva : user.avatar;
|
const avatar = (user.avatar == "" || user.avatar == null) ? defAva : user.avatar;
|
||||||
|
|
|
@ -99,6 +99,7 @@ const state = reactive({
|
||||||
|
|
||||||
function getUser() {
|
function getUser() {
|
||||||
getUserProfile().then((response) => {
|
getUserProfile().then((response) => {
|
||||||
|
response.data.avatar = import.meta.env.VITE_APP_BASE_API + response.data.avatar
|
||||||
state.user = response.data
|
state.user = response.data
|
||||||
state.roleGroup = response.roleGroup
|
state.roleGroup = response.roleGroup
|
||||||
state.postGroup = response.postGroup
|
state.postGroup = response.postGroup
|
||||||
|
|
|
@ -84,7 +84,7 @@ const title = ref('修改头像')
|
||||||
|
|
||||||
//图片裁剪数据
|
//图片裁剪数据
|
||||||
const options = reactive({
|
const options = reactive({
|
||||||
img: userStore.avatar, // 裁剪图片的地址
|
img: userStore.user.avatar, // 裁剪图片的地址
|
||||||
autoCrop: true, // 是否默认生成截图框
|
autoCrop: true, // 是否默认生成截图框
|
||||||
autoCropWidth: 200, // 默认生成截图框宽度
|
autoCropWidth: 200, // 默认生成截图框宽度
|
||||||
autoCropHeight: 200, // 默认生成截图框高度
|
autoCropHeight: 200, // 默认生成截图框高度
|
||||||
|
@ -155,7 +155,7 @@ function uploadImg() {
|
||||||
uploadAvatar(formData).then((response) => {
|
uploadAvatar(formData).then((response) => {
|
||||||
open.value = false
|
open.value = false
|
||||||
options.img = import.meta.env.VITE_APP_BASE_API + response.imgUrl
|
options.img = import.meta.env.VITE_APP_BASE_API + response.imgUrl
|
||||||
userStore.avatar = options.img
|
userStore.user.avatar = options.img
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '上传成功',
|
message: '上传成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
|
Loading…
Reference in New Issue