diff --git a/ruoyi-ui/src/App.vue b/ruoyi-ui/src/App.vue
index 60325ff4..a2c4b872 100644
--- a/ruoyi-ui/src/App.vue
+++ b/ruoyi-ui/src/App.vue
@@ -1,12 +1,16 @@
+
+
diff --git a/ruoyi-ui/src/assets/styles/ruoyi.scss b/ruoyi-ui/src/assets/styles/ruoyi.scss
index e3912cec..4d3cf312 100644
--- a/ruoyi-ui/src/assets/styles/ruoyi.scss
+++ b/ruoyi-ui/src/assets/styles/ruoyi.scss
@@ -250,9 +250,10 @@
}
.avatar-upload-preview {
- position: absolute;
+ position: relative;
top: 50%;
- transform: translate(50%, -50%);
+ left: 50%;
+ transform: translate(-50%, -50%);
width: 200px;
height: 200px;
border-radius: 50%;
diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue
index e9d60c92..3edf44ac 100644
--- a/ruoyi-ui/src/views/system/user/index.vue
+++ b/ruoyi-ui/src/views/system/user/index.vue
@@ -576,8 +576,8 @@ export default {
this.form = response.data.user;
this.postOptions = response.data.posts;
this.roleOptions = response.data.roles;
- this.form.postIds = response.data.postIds;
- this.form.roleIds = response.data.roleIds;
+ this.$set(this.form, "postIds", response.data.postIds);
+ this.$set(this.form, "roleIds", response.data.roleIds);
this.open = true;
this.title = "修改用户";
this.form.password = "";
@@ -667,4 +667,3 @@ export default {
}
};
-
diff --git a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue
index d094602a..66922b38 100644
--- a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue
+++ b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue
@@ -24,7 +24,7 @@
-
+
选择
@@ -32,19 +32,19 @@
-
+
-
+
-
+
-
+
-
+
提 交
@@ -56,6 +56,7 @@
import store from "@/store";
import { VueCropper } from "vue-cropper";
import { uploadAvatar } from "@/api/system/user";
+import { debounce } from '@/utils'
export default {
components: { VueCropper },
@@ -80,7 +81,8 @@ export default {
fixedBox: true, // 固定截图框大小 不允许改变
filename: ''
},
- previews: {}
+ previews: {},
+ resizeHandler: null
};
},
methods: {
@@ -91,6 +93,16 @@ export default {
// 打开弹出层结束时的回调
modalOpened() {
this.visible = true;
+ if (!this.resizeHandler) {
+ this.resizeHandler = debounce(() => {
+ this.refresh()
+ }, 100)
+ }
+ window.addEventListener("resize", this.resizeHandler)
+ },
+ // 刷新组件
+ refresh() {
+ this.$refs.cropper.refresh();
},
// 覆盖默认的上传行为
requestUpload() {
@@ -144,6 +156,7 @@ export default {
closeDialog() {
this.options.img = store.getters.avatar
this.visible = false;
+ window.removeEventListener("resize", this.resizeHandler)
}
}
};
@@ -173,3 +186,4 @@ export default {
border-radius: 50%;
}
+