diff --git a/pom.xml b/pom.xml index 2a41e630..607b1ba9 100644 --- a/pom.xml +++ b/pom.xml @@ -443,3 +443,4 @@ + diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java index f43ecab7..9ef6737f 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java @@ -4,6 +4,7 @@ import com.ruoyi.framework.interceptor.PlusWebInvokeTimeInterceptor; import com.yomahub.tlog.web.interceptor.TLogWebInterceptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.http.CacheControl; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; diff --git a/ruoyi-ui/src/App.vue b/ruoyi-ui/src/App.vue index 391d951c..29de49f1 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 e9608771..ca7c6f96 100644 --- a/ruoyi-ui/src/assets/styles/ruoyi.scss +++ b/ruoyi-ui/src/assets/styles/ruoyi.scss @@ -264,9 +264,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 72bb9423..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 = ""; diff --git a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue index d094602a..bd1d23b6 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) } } };