视频长传修改逻辑

This commit is contained in:
zhangsir
2024-11-08 13:39:10 +08:00
parent 2576fdd070
commit 638d6c5677
7 changed files with 352 additions and 12 deletions

View File

@@ -3,6 +3,7 @@
* 下载课件,一期是直接在新的窗口打开文件的地址就可以了。不采用流的方式下载 * 下载课件,一期是直接在新的窗口打开文件的地址就可以了。不采用流的方式下载
*/ */
import ajax from '@/utils/xajax.js' import ajax from '@/utils/xajax.js'
import ajax2 from '@/utils/xajax2.js'
/** /**
* 分页查询,课件的管理列表 * 分页查询,课件的管理列表
@@ -49,6 +50,9 @@ const findList = function(data) {
const saveUpload = function(data) { const saveUpload = function(data) {
return ajax.post('/xboe/m/course/file/upload/save', data); return ajax.post('/xboe/m/course/file/upload/save', data);
} }
const saveUpload2 = function(data) {
return ajax2.post('/xboe/m/course/file/upload/save', data);
}
/** /**
* 批量更新,上传时,一个一个上传,下面的列表的保存,使用此方法 * 批量更新,上传时,一个一个上传,下面的列表的保存,使用此方法
@@ -85,6 +89,7 @@ const detail = function(id) {
export default { export default {
pageList, pageList,
saveUpload, saveUpload,
saveUpload2,
batchUpdate, batchUpdate,
detail, detail,
delFile delFile

View File

@@ -51,6 +51,9 @@
</el-radio-group> </el-radio-group>
<br/> <br/>
</div> </div>
<div style="margin-left: 28px;margin-top: 10px;display: flex;">视频时长
<el-input-number style="width:146px;margin-left:5px;" v-model="curriculumData.duration" size="mini" :min="1" :max="999999999" label="描述文字" controls-position="right"></el-input-number>
</div>
</div> </div>
</div> </div>
<div style="margin-top:35px;text-align: center"> <el-button type="primary" @click="saveData()" size="mini">保存</el-button> </div> <div style="margin-top:35px;text-align: center"> <el-button type="primary" @click="saveData()" size="mini">保存</el-button> </div>
@@ -77,6 +80,9 @@
</el-radio> --> </el-radio> -->
</el-radio-group> </el-radio-group>
</div> </div>
<div style="margin-left: 28px;margin-top: 10px;display: flex;">音频时长
<el-input-number style="width:146px;margin-left:5px;" v-model="curriculumData.duration" size="mini" :min="1" :max="999999999" label="描述文字" controls-position="right"></el-input-number>
</div>
</div> </div>
<div style="margin-top:35px;text-align: center;"> <el-button type="primary" @click="saveData()" size="mini">保存</el-button> </div> <div style="margin-top:35px;text-align: center;"> <el-button type="primary" @click="saveData()" size="mini">保存</el-button> </div>
</div> </div>
@@ -325,6 +331,7 @@
completeSetup:0, completeSetup:0,
second:5, second:5,
setupTage:0, setupTage:0,
duration: 0,
}, },
homework:{courseId: '', name:'', content:'', file:'', deadTime: '', submitMode: 3}, homework:{courseId: '', name:'', content:'', file:'', deadTime: '', submitMode: 3},
homeworkChange:{}, homeworkChange:{},
@@ -390,6 +397,7 @@
this.curriculumData =JSON.parse(newVal.content); this.curriculumData =JSON.parse(newVal.content);
}else{ }else{
this.curriculumData.url=newVal.content; this.curriculumData.url=newVal.content;
this.curriculumData.duration = newVal.duration;
} }
} }
} }
@@ -412,6 +420,7 @@
completeSetup:0, completeSetup:0,
second:5, second:5,
setupTage:0, setupTage:0,
duration: 0,
}; };
//this.assess //this.assess
}, },
@@ -503,6 +512,10 @@
this.content.content=JSON.stringify(this.linkInfo); this.content.content=JSON.stringify(this.linkInfo);
} }
} else if(this.content.contentType==10 || this.content.contentType==20) { } else if(this.content.contentType==10 || this.content.contentType==20) {
if(!this.curriculumData.duration){
this.$message.error("请手动输入课件时长");
return;
}
this.content.content=JSON.stringify(this.curriculumData); this.content.content=JSON.stringify(this.curriculumData);
} }
let jsonData={ let jsonData={
@@ -639,6 +652,7 @@
this.content.content=cfile.filePath; this.content.content=cfile.filePath;
} }
} }
this.curriculumData.duration = cfile.duration;
this.content.courseId=this.course.id; this.content.courseId=this.course.id;
this.content.duration=cfile.duration;//时长 this.content.duration=cfile.duration;//时长
this.content.sortIndex=1; this.content.sortIndex=1;

View File

@@ -90,6 +90,7 @@
}, },
data(){ data(){
return { return {
successParams: {},
uploadFileUrl: process.env.VUE_APP_BASE_API + "/xboe/sys/xuploader/file/upload", // 上传的图片服务器地址 uploadFileUrl: process.env.VUE_APP_BASE_API + "/xboe/sys/xuploader/file/upload", // 上传的图片服务器地址
data:{ data:{
dir:'course' dir:'course'
@@ -172,7 +173,7 @@
}, },
// 上传成功回调 // 上传成功回调
handleUploadSuccess(res, file) { handleUploadSuccess(res, file) {
//console.log(res); console.log(res,file,'resfile')
if(res.status == 200) { if(res.status == 200) {
//上传到课件库 //上传到课件库
//console.log(res.result); //console.log(res.result);
@@ -186,6 +187,12 @@
duration:this.duration, duration:this.duration,
remark:'课程中直接上传' remark:'课程中直接上传'
} }
if(res.result.fileType == 'mp4'||res.result.fileType == 'mp3'){
this.successParams = courseWare
this.courseFile = {fileName:res.result.displayName,id: '1',resType:'10'}
this.$message({message:"上传成功",type:'success',offset:100});
return
}
apiCourseFile.saveUpload(courseWare).then(rs=>{ apiCourseFile.saveUpload(courseWare).then(rs=>{
if(rs.status==200){ if(rs.status==200){
this.courseFile=rs.result; this.courseFile=rs.result;
@@ -249,7 +256,19 @@
}, },
chooseCourseFile(ccfile){ chooseCourseFile(ccfile){
this.$emit('choose', ccfile); if(ccfile.resType == 10){
apiCourseFile.saveUpload(this.successParams).then(rs=>{
if(rs.status==200){
this.$emit('choose', rs.result);
}else{
this.$message.error(rs.message);
}
}).catch(err=>{
console.log(err,'errrrrr')
})
}else{
this.$emit('choose', ccfile);
}
} }
} }
} }

View File

@@ -75,6 +75,9 @@
</el-radio> --> </el-radio> -->
</el-radio-group> </el-radio-group>
</div> </div>
<div style="margin-left: 28px;margin-top: 10px;display: flex;">视频时长
<el-input-number style="width:146px;margin-left:5px;" v-model="cware.curriculumData.duration" size="mini" :min="1" :max="999999999" label="描述文字" controls-position="right"></el-input-number>
</div>
</div> </div>
</div> </div>
<div style="margin-top:35px;text-align: center;"> <el-button :loading="loading" type="primary" @click="saveContent(1)" size="mini">保存</el-button> </div> <div style="margin-top:35px;text-align: center;"> <el-button :loading="loading" type="primary" @click="saveContent(1)" size="mini">保存</el-button> </div>
@@ -102,6 +105,9 @@
</el-radio-group> </el-radio-group>
<br/> <br/>
</div> </div>
<div style="margin-left: 28px;margin-top: 10px;display: flex;">音频时长
<el-input-number style="width:146px;margin-left:5px;" v-model="cware.curriculumData.duration" size="mini" :min="1" :max="999999999" label="描述文字" controls-position="right"></el-input-number>
</div>
</div> </div>
<div style="margin-top:35px;text-align: center;"> <el-button :loading="loading" type="primary" @click="saveContent(1)" size="mini">保存</el-button> </div> <div style="margin-top:35px;text-align: center;"> <el-button :loading="loading" type="primary" @click="saveContent(1)" size="mini">保存</el-button> </div>
</div> </div>
@@ -657,6 +663,7 @@
completeSetup:0, completeSetup:0,
second:5, second:5,
setupTage:0, setupTage:0,
duration: 0,
}, },
}, },
pdfTip:'',//pdf文件的提示 pdfTip:'',//pdf文件的提示
@@ -835,10 +842,12 @@
} }
} }
if(con.contentType==10 || con.contentType==20){ if(con.contentType==10 || con.contentType==20){
console.log(con.content,'con.content')
if(con.content.startsWith('\{')){ if(con.content.startsWith('\{')){
$this.cware.curriculumData=JSON.parse(con.content); $this.cware.curriculumData=JSON.parse(con.content);
}else{ }else{
$this.cware.curriculumData.url=con.content; $this.cware.curriculumData.url=con.content;
$this.cware.curriculumData.duration = con.duration;
} }
} }
$this.cwareChange = deepClone($this.cware); $this.cwareChange = deepClone($this.cware);
@@ -986,6 +995,7 @@
this.cware.content.contentName=row.name; this.cware.content.contentName=row.name;
this.cware.content.content=row.filePath; this.cware.content.content=row.filePath;
this.cware.curriculumData.url = row.filePath; this.cware.curriculumData.url = row.filePath;
this.cware.curriculumData.duration=row.duration;
this.cware.content.duration=row.duration;//时长 this.cware.content.duration=row.duration;//时长
this.cware.findShow=false; this.cware.findShow=false;
if(this.cware.content.contentType==40){ if(this.cware.content.contentType==40){
@@ -1067,6 +1077,11 @@
this.$message.error("请选择课件"); this.$message.error("请选择课件");
return; return;
} }
if(!this.cware.curriculumData.duration){
this.$message.error("请手动输入课件时长");
this.loading=false;
return;
}
postData.content.content=JSON.stringify(this.cware.curriculumData); postData.content.content=JSON.stringify(this.cware.curriculumData);
this.cwareChange.curriculumData = deepClone(this.cware.curriculumData) this.cwareChange.curriculumData = deepClone(this.cware.curriculumData)
} }
@@ -1216,6 +1231,7 @@
this.cware.curriculumData.url = cfile.filePath; this.cware.curriculumData.url = cfile.filePath;
} }
} }
this.cware.curriculumData.duration=cfile.duration;
this.cware.content.duration=cfile.duration;//时长 this.cware.content.duration=cfile.duration;//时长
this.saveContent(1); this.saveContent(1);

View File

@@ -12,6 +12,7 @@
:show-file-list="showList" :show-file-list="showList"
:data="data" :data="data"
:headers="headers" :headers="headers"
:on-remove="handleRemove"
class="upload-file-uploader" class="upload-file-uploader"
ref="upload" ref="upload"
> >
@@ -142,6 +143,9 @@ export default {
}, },
}, },
methods: { methods: {
handleRemove(file, fileList){
this.$emit('isTrue',false)
},
// 上传前校检格式和大小 // 上传前校检格式和大小
handleBeforeUpload(file) { handleBeforeUpload(file) {
if(this.beforeMsg){ if(this.beforeMsg){
@@ -186,6 +190,8 @@ export default {
if(this.loading) { if(this.loading) {
this.isLoading = true; this.isLoading = true;
} }
this.$emit('isTrue',true)
this.$emit('isFalse',true)
return true; return true;
}, },
// 文件个数超出 // 文件个数超出
@@ -195,6 +201,7 @@ export default {
// 上传失败 // 上传失败
handleUploadError(err) { handleUploadError(err) {
this.isLoading = false; this.isLoading = false;
this.$emit('isTrue',false)
this.$message({message:"上传失败, 请重试",type:'error',offset:100}); this.$message({message:"上传失败, 请重试",type:'error',offset:100});
}, },
// 上传成功回调 // 上传成功回调
@@ -217,16 +224,13 @@ export default {
if(delIdx>-1){ if(delIdx>-1){
fileList.splice(delIdx,1); fileList.splice(delIdx,1);
} }
this.$emit("success", res);
} else { } else {
this.isLoading = false; this.isLoading = false;
if(this.limit == 1){ //this.fileList = [];
this.fileList = [];
}
this.$message({message:"上传失败",type:'error',offset:100}); this.$message({message:"上传失败",type:'error',offset:100});
} }
// this.$emit("success", res); this.$emit("success", res);
}, },
// 删除文件 // 删除文件
handleDelete(index) { handleDelete(index) {

233
src/utils/xajax2.js Normal file
View File

@@ -0,0 +1,233 @@
import axios from 'axios'
import qs from 'qs'
import { Notification, MessageBox, Message } from 'element-ui'
import store from '@/store'
import { getToken } from '@/utils/token'
import errorCode from '@/utils/errorCode'
/**
*request请求 axios.request(config)
*requestJson请求 axios.request(config)
*get请求 axios.get(url[, config])
*post请求 axios.post(url[, data[, config]])
*postJson请求 axios.post(url[, data[, config]])
*put请求 axios.put(url[, data[, config]])
*putJson请求 axios.put(url[, data[, config]])
*patch请求 axios.patch(url[, data[, config]])
*patchJson请求 axios.patch(url[, data[, config]])
*delete请求 axios.delete(url[, config])
*/
//const ReLoginUrl="/login";
const ReLoginUrl=process.env.VUE_APP_LOGIN_URL;
const TokenName='XBOE-Access-Token';
/**axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'**/
//只是用于发送json对象数据时使用post,put,patch
const jsonRequest=axios.create({
headers:{'Content-Type':'application/json;charset=utf-8'},
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API,
//超时
timeout: 60000,
});
//发送json对象的拦截器
jsonRequest.interceptors.request.use(config => {
//是否需要设置 token
const isToken = (config.headers || {}).isToken === false
if (getToken() && !isToken) {
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
}
return config
}, error => {
console.log(error)
Promise.reject(error)
})
// 响应拦截器
jsonRequest.interceptors.response.use(res => {
const code = res.data.status || 200;
if(code===200){
return res.data
}else{
if(code == 6001){ //针对于老系统的处理
store.dispatch('LogOut').then(() => {
location.href = ReLoginUrl;
})
}else if(code === 401){
store.dispatch('LogOut').then(() => {
location.href = ReLoginUrl;
})
}else if(code === 402){
store.dispatch('LogOut').then(() => {
location.href = ReLoginUrl;
})
}else if(code===403){
var msg='当前操作没有权限';
Message({message: msg, type: 'error'});
return Promise.reject(new Error(msg))
//return res.data;
}else if(code===302){
location.href = ReLoginUrl;
}else{
//Message({message: res.data.message, type: 'error'});
//console.log('err:' + res.data.error);
//return Promise.reject(new Error(res.data.message))
return res.data;
}
}
},
error => {
console.log('err' + error)
let { message } = error;
if (message == "Network Error") {
message = "网络异常,请稍后重试";
}
else if (message.includes("timeout")) {
message = "系统接口请求超时";
//location.href = this.webBaseUrl + ReLoginUrl;
}
else if (message.includes("Request failed with status code")) {
message = "系统接口" + message.substr(message.length - 3) + "异常";
}
Message({
message: message,
type: 'error',
duration: 5 * 1000
})
return Promise.reject(error)
}
)
//用于普通的发送请求
const formRequest=axios.create({
headers:{'Content-Type':'application/x-www-form-urlencoded'},
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API,
//超时
timeout: 10000,
})
//发送json对象的拦截器
formRequest.interceptors.request.use(config => {
//是否需要设置 token
const isToken = (config.headers || {}).isToken === false
if (getToken() && !isToken) {
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
}
return config
}, error => {
console.log(error)
Promise.reject(error)
});
formRequest.interceptors.response.use(res => {
const code = res.data.status || 200;
if(code===200){
return res.data
}else{
if(code == 6001){ //针对于老系统的处理,因为老系统是字符串,所以这里不使用三等于号
store.dispatch('LogOut').then(() => {
location.href = ReLoginUrl;
})
}else if(code === 401){
store.dispatch('LogOut').then(() => {
location.href = ReLoginUrl;
})
}else if(code === 402){
store.dispatch('LogOut').then(() => {
location.href = ReLoginUrl;
})
}else if(code===403){
var msg='当前操作没有权限';
Message({message: msg, type: 'error'});
return Promise.reject(new Error(msg))
}else if(code===302){
location.href = ReLoginUrl;
}else{
//Message({message: res.data.message, type: 'error'});
//console.log('err' + res.data.error);
//return Promise.reject(new Error(res.data.message))
return res.data;//返回给用户做业务处理
}
}
},
error => {
console.log('err' + error)
let { message } = error;
if (message == "Network Error") {
message = "网络异常,请稍后重试";
}
else if (message.includes("timeout")) {
message = "接口超时,请检查是否上传成功";
//location.href = this.webBaseUrl + ReLoginUrl;
}
else if (message.includes("Request failed with status code")) {
message = "系统接口" + message.substr(message.length - 3) + "异常";
}
Message({
message: message,
type: 'error',
duration: 5 * 1000
})
return Promise.reject(error)
}
)
//request请求
const request=function(cfg){
if(cfg.data){
cfg.data=qs.stringify(cfg.data);
}
};
//requestJson请求
const requestJson=jsonRequest.request;
//get请求
const get=formRequest.request;
//post请求
const post=function(url,data,config){
if(data){
data=qs.stringify(data);
}
return formRequest.post(url,data,config);
}
//post请求
const postForm=function(url,data,config){
return formRequest.post(url,data,config);
}
//postJson请求
const postJson=jsonRequest.post;
//put请求
const put=function(url,data,config){
if(data){
data=qs.stringify(data);
}
return formRequest.put(url,data,config);
}
//putJson请求
const putJson=jsonRequest.put;
//patch请求
const patch=function(url,data,config){
if(data){
data=qs.stringify(data);
}
return formRequest.patch(url,data,config);
}
//patchJson请求
const patchJson=jsonRequest.patch;
//delete请求
const del=formRequest.delete;
export default {
request,
requestJson,
get,
post,
postJson,
put,
putJson,
patch,
patchJson,
del,
postForm
}

View File

@@ -149,7 +149,7 @@
<el-checkbox v-model="deviceMobile" @change="isVisible(1)" label="移动端可见" border></el-checkbox> <el-checkbox v-model="deviceMobile" @change="isVisible(1)" label="移动端可见" border></el-checkbox>
<el-checkbox v-model="devicePc" @change="isVisible(2)" label="pc端可见" border></el-checkbox> <el-checkbox v-model="devicePc" @change="isVisible(2)" label="pc端可见" border></el-checkbox>
</div> </div>
<file-upload scorm="zip" dir="files" :beforeMsg="needOrg" :showList="true" :value="imageShowUrl" :limit="5" @success="handleUploadSuccess" @remove="handleRemoveSuccess"></file-upload> <file-upload scorm="zip" dir="files" @isFalse="isFalseChange" @isTrue="isTrueChange" :beforeMsg="needOrg" :showList="true" :value="imageShowUrl" :limit="5" @success="handleUploadSuccess" @remove="handleRemoveSuccess"></file-upload>
</div> </div>
</div> </div>
@@ -159,7 +159,7 @@
<el-table-column prop="fileName" label="文件名称"></el-table-column> <el-table-column prop="fileName" label="文件名称"></el-table-column>
<el-table-column prop="name" label="课件名称"> <el-table-column prop="name" label="课件名称">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input type="text" v-model="scope.row.name"></el-input> <el-input type="text" maxlength="50" v-model="scope.row.name"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="resType" label="类型" width="80"> <el-table-column prop="resType" label="类型" width="80">
@@ -169,7 +169,8 @@
</el-table-column> </el-table-column>
<el-table-column prop="duration" label="时长(分)" width="100"> <el-table-column prop="duration" label="时长(分)" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input type="number" size="small" v-model="scope.row.minute"></el-input> <!-- <el-input type="number" :stpe="1" min="0" size="small" step-strictly v-model="scope.row.minute"></el-input> -->
<el-input-number style="width: 78px;" :max="999" controls-position="right" size="small" :min="0" v-model="scope.row.minute" :step="1" step-strictly></el-input-number>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="可见性" width="100"> <el-table-column label="可见性" width="100">
@@ -194,7 +195,7 @@
<span slot="footer"> <span slot="footer">
<!-- <el-button type="infor" @click="isVisible(1)">移动端可见</el-button> <!-- <el-button type="infor" @click="isVisible(1)">移动端可见</el-button>
<el-button type="infor" @click="isVisible(2)">pc端可见</el-button> --> <el-button type="infor" @click="isVisible(2)">pc端可见</el-button> -->
<el-button type="primary" @click="saveUpload()">保存</el-button> <el-button type="primary" @click="saveUpload()" :loading="isTrue">保存</el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog v-if="coursewareShow" title="预览课件" :close-on-click-modal="false" width="800px" :visible.sync="coursewareShow" custom-class="g-dialog"> <el-dialog v-if="coursewareShow" title="预览课件" :close-on-click-modal="false" width="800px" :visible.sync="coursewareShow" custom-class="g-dialog">
@@ -280,6 +281,8 @@ export default {
}, },
data() { data() {
return { return {
isTrue: false,
isFalse: false,
resOwnerListMap: [], resOwnerListMap: [],
//fileBaseUrl: process.env.VUE_APP_FILE_BASE_URL, //fileBaseUrl: process.env.VUE_APP_FILE_BASE_URL,
fileBaseUrl:this.$xpage.constants.fileBaseUrl, //获成动态获取的处理 fileBaseUrl:this.$xpage.constants.fileBaseUrl, //获成动态获取的处理
@@ -392,6 +395,12 @@ export default {
this.search(); this.search();
}, },
methods: { methods: {
isTrueChange(val){
this.isTrue = val
},
isFalseChange(val){
this.isFalse = val
},
beforeCheck(){ beforeCheck(){
if(!this.upload.orgId ||!this.upload.orgName){ if(!this.upload.orgId ||!this.upload.orgName){
return false; return false;
@@ -555,7 +564,7 @@ export default {
// remark: 备注说明,可以为空,不填 // remark: 备注说明,可以为空,不填
}; };
//try { //try {
coueseFile.saveUpload(data).then(res=>{ coueseFile.saveUpload2(data).then(res=>{
if(res.status==200){ if(res.status==200){
//console.log('上传文件成功:'+rs.result.displayName); //console.log('上传文件成功:'+rs.result.displayName);
res.result.device1 = true; res.result.device1 = true;
@@ -564,12 +573,18 @@ export default {
if(res.result.duration){ if(res.result.duration){
res.result.minute=Math.round(res.result.duration/60); //四舍五入 res.result.minute=Math.round(res.result.duration/60); //四舍五入
} }
if(res.result.duration==0){
this.$message.error('上传的视频时长不能为0请手动编辑时长');
}
this.fileList.push(res.result); this.fileList.push(res.result);
this.isTrue = false;
}else{ }else{
this.$message.error(res.message); this.$message.error(res.message);
this.isFalse = false
} }
}).catch (error=>{ }).catch (error=>{
console.log(error,'error') console.log(error,'error')
this.isFalse = false
//this.$message.error(error); //this.$message.error(error);
}); });
// const { result, status } = coueseFile.saveUpload(data); // const { result, status } = coueseFile.saveUpload(data);
@@ -598,16 +613,26 @@ export default {
}, },
handleCloseCheck(done){ handleCloseCheck(done){
//console.log('关闭的处理aaaaa'); //console.log('关闭的处理aaaaa');
if(this.isTrue&&this.isFalse){
this.$message.error('文件正在上传中,请耐心等待');
return false;
}
if(this.fileList.length>0){ if(this.fileList.length>0){
this.$message.error('有待保存的上传文件,请执行保存操作'); this.$message.error('有待保存的上传文件,请执行保存操作');
return false; return false;
}else{ }else{
this.isTrue = false
this.isFalse = false
return done(true); return done(true);
} }
}, },
// 文件上传保存 // 文件上传保存
saveUpload() { saveUpload() {
if(this.fileList.length<=0){
this.$message.error('请上传文件');
return;
}
if(!this.upload.orgName){ if(!this.upload.orgName){
this.$message.success('请选择资源归属'); this.$message.success('请选择资源归属');
return; return;
@@ -628,6 +653,20 @@ export default {
item.duration = item.minute ? parseFloat(item.minute) * 60 : 1800; item.duration = item.minute ? parseFloat(item.minute) * 60 : 1800;
}); });
this.loading = true; this.loading = true;
const messageD = this.fileList.some(item =>{
if(item.name == ''){
this.$message.error('课件名称不能为空');
return true;
}else if(!item.minute||item.minute == undefined){
this.$message.error('时长不能为空并且不能为0');
return true;
}else{
return false
}
})
if(messageD){
return
}
coueseFile.batchUpdate(this.fileList).then(rs => { coueseFile.batchUpdate(this.fileList).then(rs => {
if (rs.status === 200) { if (rs.status === 200) {
this.$message.success('保存成功'); this.$message.success('保存成功');
@@ -793,6 +832,16 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .el-input-number.is-controls-right .el-input__inner{
padding-right: 20px;
padding-left: 8px;
}
::v-deep .el-input-number__decrease{
width: 16px;
}
::v-deep .el-input-number__increase{
width: 16px;
}
.butpost{ .butpost{
position: absolute; position: absolute;
right: 1%; right: 1%;