From 750a09d5b702f8e857f09ccc124565796f601d3f Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期四, 17 十一月 2022 13:50:35 +0800
Subject: [PATCH] 升级组件依赖到最新版本

---
 src/views/system/user/profile/userAvatar.vue |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/views/system/user/profile/userAvatar.vue b/src/views/system/user/profile/userAvatar.vue
index 383d9f2..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"
         />
@@ -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