Commit 2de0756e authored by wanghao's avatar wanghao

4 培训管理-上传视频优化

parent 406deb9d
...@@ -31,9 +31,9 @@ spring: ...@@ -31,9 +31,9 @@ spring:
servlet: servlet:
multipart: multipart:
# 单个文件大小 # 单个文件大小
max-file-size: 20MB max-file-size: 500MB
# 设置总上传的文件大小 # 设置总上传的文件大小
max-request-size: 100MB max-request-size: 500MB
# 服务模块 # 服务模块
devtools: devtools:
restart: restart:
......
...@@ -22,8 +22,9 @@ public class FileUploadUtils ...@@ -22,8 +22,9 @@ public class FileUploadUtils
{ {
/** /**
* 默认大小 50M * 默认大小 50M
* 20240725 因 培训管理 可上传500M培训视频 所以调整 成 500M
*/ */
public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024; public static final long DEFAULT_MAX_SIZE = 500 * 1024 * 1024;
/** /**
* 默认的文件名最大长度 100 * 默认的文件名最大长度 100
......
...@@ -168,6 +168,7 @@ ...@@ -168,6 +168,7 @@
}, },
removeVideo(index){ removeVideo(index){
this.$emit("remove", index); this.$emit("remove", index);
this.totalNum--;
}, },
handleFileClick(file, fileList) { handleFileClick(file, fileList) {
this.dialogImageUrl = file.response ? file.response.url : file.url; this.dialogImageUrl = file.response ? file.response.url : file.url;
......
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
/> />
<!-- 添加或修改培训管理对话框 --> <!-- 添加或修改培训管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body destroy-on-close> <el-dialog :title="title" :visible.sync="open" v-if="open" width="1000px" append-to-body destroy-on-close>
<el-form ref="form" :model="form" :rules="rules" label-width="110px"> <el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
...@@ -218,14 +218,15 @@ ...@@ -218,14 +218,15 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="视频地址" prop="videoUrl"> <el-form-item label="视频地址" prop="videoUrl">
<FileUpload <VideoUpload
listType="picture" listType="picture"
v-if="open"
:limit="1"
@resFun="getFileInfoVideo" @resFun="getFileInfoVideo"
@remove="listRemoveVideo" @remove="listRemoveVideo"
:fileArr="fileListVideo" :fileArr="fileListVideo"
:fileSize="500" :fileSize="500"
:fileType="['mp4']" :fileType="['mp4']"
:disabled="isView"
/> />
<el-input v-show="false" disabled v-model="form.videoUrl"></el-input> <el-input v-show="false" disabled v-model="form.videoUrl"></el-input>
</el-form-item> </el-form-item>
...@@ -259,12 +260,14 @@ import { listManage, getManage, delManage, addManage, updateManage, exportManage ...@@ -259,12 +260,14 @@ import { listManage, getManage, delManage, addManage, updateManage, exportManage
import Editor from '@/components/Editor'; import Editor from '@/components/Editor';
import FileUpload from "@/components/FileUpload"; import FileUpload from "@/components/FileUpload";
import uploadfile from "@/assets/uploadfile.png"; import uploadfile from "@/assets/uploadfile.png";
import VideoUpload from "@/components/VideoUpload";
import PeopleChoice from "@/components/PeopleChoice"; import PeopleChoice from "@/components/PeopleChoice";
export default { export default {
name: "Manage", name: "Manage",
components: { components: {
Editor, Editor,
FileUpload, FileUpload,
VideoUpload,
PeopleChoice PeopleChoice
}, },
data() { data() {
...@@ -389,6 +392,8 @@ export default { ...@@ -389,6 +392,8 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.isView = false;
this.fileListFile = [];
this.open = true; this.open = true;
/*this.$nextTick(() => { /*this.$nextTick(() => {
this.$refs.changePaple.changeNameList(undefined); this.$refs.changePaple.changeNameList(undefined);
...@@ -402,12 +407,18 @@ export default { ...@@ -402,12 +407,18 @@ export default {
const trainManageId = row.trainManageId || this.ids const trainManageId = row.trainManageId || this.ids
getManage(trainManageId).then(response => { getManage(trainManageId).then(response => {
this.form = response.data; this.form = response.data;
this.fileListVideo = this.form.video? [ // this.fileListVideo = this.form.videoUrl? [
{ // {
name: this.form.lessonName + "视频", // name: this.form.lessonName + "视频",
url: uploadfile, // url: uploadfile,
}, // },
]:[]; // ]:[];
if(this.form.videoUrl){
this.fileListVideo = this.form.videoUrl.split(',');
console.log("this.fileListVideo = " + this.fileListVideo)
}
this.fileListFile = this.form.annexUrl?[ this.fileListFile = this.form.annexUrl?[
{ {
name: this.form.lessonName + "附件", name: this.form.lessonName + "附件",
...@@ -428,7 +439,7 @@ export default { ...@@ -428,7 +439,7 @@ export default {
const trainManageId = row.trainManageId || this.ids const trainManageId = row.trainManageId || this.ids
getManage(trainManageId).then(response => { getManage(trainManageId).then(response => {
this.form = response.data; this.form = response.data;
this.fileListVideo = this.form.video? [ this.fileListVideo = this.form.videoUrl? [
{ {
name: this.form.lessonName + "视频", name: this.form.lessonName + "视频",
url: uploadfile, url: uploadfile,
...@@ -518,17 +529,19 @@ export default { ...@@ -518,17 +529,19 @@ export default {
}).catch(() => {}); }).catch(() => {});
}, },
getFileInfoVideo(res) { getFileInfoVideo(res) {
this.form.videoUrl = res.url; this.form.videoUrl = res.url;
this.fileListVideo = [
{ this.fileListVideo.push(res.url)
name: res.fileName, // this.fileListVideo = [
url: uploadfile, // {
}, // name: res.fileName,
]; // url: uploadfile,
// },
// ];
}, },
listRemoveVideo(e) { listRemoveVideo(e) {
// this.fileListVideo.splice(index,1);
this.fileListVideo = []; this.fileListVideo = [];
this.form.videoUrl = "";
// this.form.videoName = null; // this.form.videoName = null;
}, },
getFileInfoFile(res) { getFileInfoFile(res) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment