From 3a787ef69040ab07f679870376faf7d712ad41b1 Mon Sep 17 00:00:00 2001 From: haha Date: Sun, 1 Sep 2024 22:29:20 +0800 Subject: [PATCH] update code --- .../yanzhu/file/utils/FileUploadUtils.java | 3 +++ yanzhu-ui-vue3/.env.development | 3 +++ yanzhu-ui-vue3/.env.production | 4 +++- .../views/manage/busTrainingVideo/index.vue | 24 +++++++++++++++---- yanzhu-ui-vue3/vite.config.js | 8 ++++++- 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/utils/FileUploadUtils.java b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/utils/FileUploadUtils.java index 742ac23e..0dd1649e 100644 --- a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/utils/FileUploadUtils.java +++ b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/utils/FileUploadUtils.java @@ -4,6 +4,8 @@ import java.io.File; import java.io.IOException; import java.nio.file.Paths; import java.util.Objects; + +import com.yanzhu.common.core.utils.file.ImageUtils; import org.apache.commons.io.FilenameUtils; import org.springframework.web.multipart.MultipartFile; import com.yanzhu.common.core.exception.file.FileNameLengthLimitExceededException; @@ -80,6 +82,7 @@ public class FileUploadUtils String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath(); file.transferTo(Paths.get(absPath)); + return getPathFileName(fileName); } diff --git a/yanzhu-ui-vue3/.env.development b/yanzhu-ui-vue3/.env.development index af9ba008..01a6d187 100644 --- a/yanzhu-ui-vue3/.env.development +++ b/yanzhu-ui-vue3/.env.development @@ -6,3 +6,6 @@ VITE_APP_ENV = 'development' # 若依管理系统/开发环境 VITE_APP_BASE_API = '/dev-api' + + +VUE_APP_FILE_API='/statics' \ No newline at end of file diff --git a/yanzhu-ui-vue3/.env.production b/yanzhu-ui-vue3/.env.production index cbabf899..f267b38d 100644 --- a/yanzhu-ui-vue3/.env.production +++ b/yanzhu-ui-vue3/.env.production @@ -8,4 +8,6 @@ VITE_APP_ENV = 'production' VITE_APP_BASE_API = '/prod-api' # 是否在打包时开启压缩,支持 gzip 和 brotli -VITE_BUILD_COMPRESS = gzip \ No newline at end of file +VITE_BUILD_COMPRESS = gzip + +VUE_APP_FILE_API='/statics' \ No newline at end of file diff --git a/yanzhu-ui-vue3/src/views/manage/busTrainingVideo/index.vue b/yanzhu-ui-vue3/src/views/manage/busTrainingVideo/index.vue index fb80d830..2e835e84 100644 --- a/yanzhu-ui-vue3/src/views/manage/busTrainingVideo/index.vue +++ b/yanzhu-ui-vue3/src/views/manage/busTrainingVideo/index.vue @@ -79,9 +79,12 @@ - + @@ -153,7 +156,7 @@ - + @@ -328,6 +331,8 @@ function handleUpdate(row) { function submitForm() { proxy.$refs["busTrainingVideoRef"].validate(valid => { if (valid) { + let path=form.value.trainFilePath; + form.value.trainFilePath=path.substring( path.indexOf("/statics/")); if (form.value.id != null) { updateBusTrainingVideo(form.value).then(response => { proxy.$modal.msgSuccess("修改成功"); @@ -390,6 +395,17 @@ getDeptTree(); } } .bus-training-video-dlg{ - + .fitem-video{ + &.has-video{ + .el-form-item__content{ + .upload-file-uploader{ + display: none; + } + .el-upload__tip{ + display: none; + } + } + } + } } \ No newline at end of file diff --git a/yanzhu-ui-vue3/vite.config.js b/yanzhu-ui-vue3/vite.config.js index fed40228..1400798d 100644 --- a/yanzhu-ui-vue3/vite.config.js +++ b/yanzhu-ui-vue3/vite.config.js @@ -34,7 +34,13 @@ export default defineConfig(({ mode, command }) => { target: 'http://localhost:8080', changeOrigin: true, rewrite: (p) => p.replace(/^\/dev-api/, '') - } + }, + '/statics': { + target: `http://localhost:9300/statics/`, + changeOrigin: true, + rewrite: (p) => p.replace(/^\/statics/, '') + }, + } }, //fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file