master
lion 3 years ago
parent fce2c5bf94
commit d378008ab8

@ -12,6 +12,19 @@
</div>
</div>
</template>
<template v-slot:type>
<div class="xy-table-item">
<div class="xy-table-item-label">
面向对象
</div>
<div class="xy-table-item-content">
<el-select clearable placeholder="请选择类型" v-model="form.type" style="width: 300px;">
<el-option v-for="item in types" :value="item.id" :key="item.id" :label="item.value">
</el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:expire_day>
<div class="xy-table-item">
<div class="xy-table-item-label">
@ -47,6 +60,21 @@
</div>
</div>
</template>
<template v-slot:file>
<div class="xy-table-item">
<div class="xy-table-item-label">资料上传</div>
<div class="xy-table-item-content">
<el-upload style="width: 620px" accept=".jpg,.png,.mp4" :multiple="true" class="upload-demo" :action="action"
:before-upload="uploadBeforePic" :on-success="picListSuccessHandler" :on-remove="picListRemoveHandler"
:file-list="fileList" list-type="picture" multiple>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">
只能上传jpg/png/mp4文件
</div>
</el-upload>
</div>
</div>
</template>
<template v-slot:content>
<div class="xy-table-item">
<div class="xy-table-item-label">
@ -62,34 +90,8 @@
</div> -->
</div>
</template>
<template v-slot:type>
<div class="xy-table-item">
<div class="xy-table-item-label">
面向对象
</div>
<div class="xy-table-item-content">
<el-select clearable placeholder="请选择类型" v-model="form.type" style="width: 300px;">
<el-option v-for="item in types" :value="item.id" :key="item.id" :label="item.value">
</el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:file>
<div class="xy-table-item">
<div class="xy-table-item-label">资料上传</div>
<div class="xy-table-item-content">
<el-upload style="width: 620px" :multiple="true" class="upload-demo" :action="action"
:before-upload="uploadBeforePic" :on-success="picListSuccessHandler" :on-remove="picListRemoveHandler"
:file-list="fileList" list-type="picture" multiple>
<el-button size="small" type="primary">点击上传</el-button>
<!-- <div slot="tip" class="el-upload__tip">
只能上传jpg/png/mp4文件且不超过10M
</div> -->
</el-upload>
</div>
</div>
</template>
<template v-slot:ask_list>
<div class="xy-table-item">
<div class="xy-table-item-label">测试题库</div>
@ -203,8 +205,8 @@ import xyTinymce from "@/components/XyTinymce/index.vue";
type: "",
rate: "",
minute: "",
content: "",
file: [],
content: "",
ask_list: []
},
//
@ -278,10 +280,26 @@ import xyTinymce from "@/components/XyTinymce/index.vue";
// },
//
uploadBeforePic(file) {
if (file.size / 1000 > 2048) {
this.$successMessage('上传图片大小超过2M', '', 'warning')
console.log(file)
// if (file.size / 1000 > 2048) {
// this.$successMessage('2M', '', 'warning')
// return false;
// }
//
let fileExtName = file.name.substring(file.name.lastIndexOf(".") + 1);
console.log(fileExtName)
if(
fileExtName === 'jpg' ||
fileExtName === 'png' ||
fileExtName === 'mp4'
){
//;
console.log('file',file);
}else{
this.$successMessage('只能上传.jpg、.png,.mp4类型的文件', '', 'warning')
return false;
}
},
picListSuccessHandler(res, file, fileList) {
this.form.file = fileList.map((item) => {

Loading…
Cancel
Save