From d702db24c30576ea4a7e47457755eba1afdfa3cf Mon Sep 17 00:00:00 2001 From: lyc Date: Thu, 18 Jul 2024 15:24:06 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=AE=9E=E9=99=85=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/components/file-image/index.vue | 2 -- src/renderer/src/components/upload-dialog/index.vue | 1 - src/renderer/src/layout/components/Header.vue | 1 - src/renderer/src/utils/request.js | 8 +------- 4 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/renderer/src/components/file-image/index.vue b/src/renderer/src/components/file-image/index.vue index 4dc3732..081612d 100644 --- a/src/renderer/src/components/file-image/index.vue +++ b/src/renderer/src/components/file-image/index.vue @@ -5,8 +5,6 @@ - + \ No newline at end of file +.app-container{ + padding-top: 20px; + height: 100%; +} + diff --git a/src/renderer/src/views/profile/userAvatar.vue b/src/renderer/src/views/profile/userAvatar.vue index 1c289a4..a495bd6 100644 --- a/src/renderer/src/views/profile/userAvatar.vue +++ b/src/renderer/src/views/profile/userAvatar.vue @@ -26,7 +26,7 @@
- +
@@ -67,12 +67,13 @@ From acf0018a9c928d95a6eec4694d05ba2380726390 Mon Sep 17 00:00:00 2001 From: yangws <1607839436@qq.com> Date: Thu, 18 Jul 2024 15:41:31 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E7=9A=84=E5=8A=9F=E8=83=BD=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/views/profile/userAvatar.vue | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/renderer/src/views/profile/userAvatar.vue b/src/renderer/src/views/profile/userAvatar.vue index a495bd6..b27e59f 100644 --- a/src/renderer/src/views/profile/userAvatar.vue +++ b/src/renderer/src/views/profile/userAvatar.vue @@ -94,8 +94,6 @@ const options = reactive({ }) // 是否显示遮罩和大图 const show = ref(false) -//监听是否拖动 -const random = ref('') // 遮罩的坐标(样式) const layerPosition = reactive({ left: 0, @@ -108,6 +106,8 @@ const largePosition = reactive({ }) const cropper = ref(null) const { elementX, elementY } = useMouseInElement(cropper) +//监听是否拖动 +const transform = ref({}) /** 编辑头像 */ function editCropper() { @@ -168,19 +168,16 @@ function uploadImg() { /** 实时预览 */ function realTime(data) { options.previews = data - random.value = getRandomValue() -} -// 生成一个随机数的函数监听滑动的改变 -const getRandomValue = () => { - return Math.random() + transform.value = Object.assign({}, data.img) } + /** 关闭窗口 */ function closeDialog() { options.img = userStore.avatar console.log(userStore.avatar,'userStore.avatar') options.visible = false } -watch(random, () => { +watch(transform, () => { // 根据得到数据设置样式数据和是否显示数据 show.value = true // 计算坐标 From bdc67a6a0e66a73f3ed386b0e6014b0604fb68c7 Mon Sep 17 00:00:00 2001 From: yangws <1607839436@qq.com> Date: Thu, 18 Jul 2024 16:00:46 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E6=9B=B4=E6=94=B9=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E7=9A=84=E5=90=8C=E6=97=B6=E6=9B=B4=E6=94=B9=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/layout/components/Header.vue | 5 ++++- src/renderer/src/views/profile/userAvatar.vue | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/layout/components/Header.vue b/src/renderer/src/layout/components/Header.vue index c63f241..32b5059 100644 --- a/src/renderer/src/layout/components/Header.vue +++ b/src/renderer/src/layout/components/Header.vue @@ -53,7 +53,7 @@ const { ipcRenderer } = window.electron || {} const isMaxSize = ref(false) const router = useRouter() const currentRoute = ref('') -const userImg = new URL(userStore.user.avatar, import.meta.url) +const userImg = ref(new URL(userStore.user.avatar, import.meta.url)) const menus = ref([ { @@ -128,6 +128,9 @@ const emits = defineEmits(['setLayout']) function setLayout() { emits('setLayout'); } +watch(()=> userStore.avatar,() => { + userImg.value = userStore.avatar; +},{deep:true})