From 69a246ac8a19604603b32a262eb32aee475ba3bc Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期二, 15 十一月 2022 14:24:34 +0800 Subject: [PATCH] 修复调度日志点击多次数据不变化的问题 --- src/views/system/user/profile/userAvatar.vue | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/views/system/user/profile/userAvatar.vue b/src/views/system/user/profile/userAvatar.vue index f8ceef9..81f9e44 100644 --- a/src/views/system/user/profile/userAvatar.vue +++ b/src/views/system/user/profile/userAvatar.vue @@ -11,6 +11,7 @@ :autoCropWidth="options.autoCropWidth" :autoCropHeight="options.autoCropHeight" :fixedBox="options.fixedBox" + :outputType="options.outputType" @realTime="realTime" v-if="visible" /> @@ -25,26 +26,26 @@ <el-row> <el-col :lg="2" :md="2"> <el-upload action="#" :http-request="requestUpload" :show-file-list="false" :before-upload="beforeUpload"> - <el-button size="small"> + <el-button> 閫夋嫨 <el-icon class="el-icon--right"><Upload /></el-icon> </el-button> </el-upload> </el-col> <el-col :lg="{span: 1, offset: 2}" :md="2"> - <el-button icon="Plus" size="small" @click="changeScale(1)"></el-button> + <el-button icon="Plus" @click="changeScale(1)"></el-button> </el-col> <el-col :lg="{span: 1, offset: 1}" :md="2"> - <el-button icon="Minus" size="small" @click="changeScale(-1)"></el-button> + <el-button icon="Minus" @click="changeScale(-1)"></el-button> </el-col> <el-col :lg="{span: 1, offset: 1}" :md="2"> - <el-button icon="RefreshLeft" size="small" @click="rotateLeft()"></el-button> + <el-button icon="RefreshLeft" @click="rotateLeft()"></el-button> </el-col> <el-col :lg="{span: 1, offset: 1}" :md="2"> - <el-button icon="RefreshRight" size="small" @click="rotateRight()"></el-button> + <el-button icon="RefreshRight" @click="rotateRight()"></el-button> </el-col> <el-col :lg="{span: 2, offset: 6}" :md="2"> - <el-button type="primary" size="small" @click="uploadImg()">鎻� 浜�</el-button> + <el-button type="primary" @click="uploadImg()">鎻� 浜�</el-button> </el-col> </el-row> </el-dialog> @@ -54,8 +55,9 @@ import "vue-cropper/dist/index.css"; import { VueCropper } from "vue-cropper"; import { uploadAvatar } from "@/api/system/user"; +import useUserStore from '@/store/modules/user' -const store = useStore(); +const userStore = useUserStore() const { proxy } = getCurrentInstance(); const open = ref(false); @@ -64,11 +66,12 @@ //鍥剧墖瑁佸壀鏁版嵁 const options = reactive({ - img: store.getters.avatar, // 瑁佸壀鍥剧墖鐨勫湴鍧� + img: userStore.avatar, // 瑁佸壀鍥剧墖鐨勫湴鍧� autoCrop: true, // 鏄惁榛樿鐢熸垚鎴浘妗� autoCropWidth: 200, // 榛樿鐢熸垚鎴浘妗嗗搴� autoCropHeight: 200, // 榛樿鐢熸垚鎴浘妗嗛珮搴� fixedBox: true, // 鍥哄畾鎴浘妗嗗ぇ灏� 涓嶅厑璁告敼鍙� + outputType:"png", // 榛樿鐢熸垚鎴浘涓篜NG鏍煎紡 previews: {} //棰勮鏁版嵁 }); @@ -116,7 +119,7 @@ uploadAvatar(formData).then(response => { open.value = false; options.img = import.meta.env.VITE_APP_BASE_API + response.imgUrl; - store.commit("SET_AVATAR", options.img); + userStore.avatar = options.img; proxy.$modal.msgSuccess("淇敼鎴愬姛"); visible.value = false; }); @@ -128,7 +131,7 @@ }; /** 鍏抽棴绐楀彛 */ function closeDialog() { - options.img = store.getters.avatar; + options.img = userStore.avatar; options.visible = false; }; </script> -- Gitblit v1.9.3