update code

dev_xd
haha 2024-09-01 22:29:20 +08:00
parent 10063c973d
commit 3a787ef690
5 changed files with 36 additions and 6 deletions

View File

@ -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);
}

View File

@ -6,3 +6,6 @@ VITE_APP_ENV = 'development'
# 若依管理系统/开发环境
VITE_APP_BASE_API = '/dev-api'
VUE_APP_FILE_API='/statics'

View File

@ -9,3 +9,5 @@ VITE_APP_BASE_API = '/prod-api'
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip
VUE_APP_FILE_API='/statics'

View File

@ -79,9 +79,12 @@
<dict-tag :options="pro_craft_post" :value="scope.row.craftPost" />
</template>
</el-table-column>
<el-table-column label="培训文件主图" align="center" prop="trainFileImage" width="100">
<el-table-column label="视频路径" align="center" prop="videoUrl" width="200px">
<template #default="scope">
<image-preview :src="scope.row.trainFileImage" :width="50" :height="50" />
<video height="80" width="200" controls :key="scope.row.trainFilePath" v-if="scope.row.trainFilePath">
<source :src="scope.row.trainFilePath" type="video/mp4"/>
您的浏览器不支持Video标签
</video>
</template>
</el-table-column>
<el-table-column label="培训文件时长" align="center" prop="trainFileTimes">
@ -153,7 +156,7 @@
<template #append></template>
</el-input>
</el-form-item>
<el-form-item label="视频文件" prop="trainFilePath">
<el-form-item label="视频文件" prop="trainFilePath" :class="form.trainFilePath?'has-video':'no-video'" class="fitem-video">
<file-upload v-model="form.trainFilePath" :limit="1" :fileType="['mp4']" :fileSize="100"/>
</el-form-item>
@ -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;
}
}
}
}
}
</style>

View File

@ -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