提交 c19b75fe authored 作者: 翟畅's avatar 翟畅

zc文件上传限制

上级 59ffad79
<template>
<div> <!-- 导入 -->
<el-dialog :title="title" :visible.sync="dialogImport" :close-on-click-modal="false" :before-close="close" @open="openDialog()" width="430px" class="importDialog">
<div class="importTip">操作提示:全部上传完成前请勿关闭窗口,避免数据丢失!</div>
<div class="importTip">操作提示:单次上传最多20个文件,全部上传完成前请勿关闭窗口,避免数据丢失!</div>
<el-upload
class="upload-demo"
ref="upload"
:accept="accept"
multiple
:limit="20"
:action="`${courseUrl}${action}`"
:on-progress="getListLength"
:on-preview="handlePreview"
:on-remove="handleRemove"
:file-list="fileList"
:on-exceed="handleExceed"
:on-success="handleSuccess"
:before-upload="beforeUpload">
<el-button type="primary" plain size="small">选择文件(可多选)</el-button>
</el-upload>
<div class="tipNum">
<div class="selectLength">共选择上传数量:{{currentFileList.length}}</div>
<div class="uploadLength">已成功上传数量:{{commonList.length}}</div>
</div>
<div class="relationBook" v-if="type!='book'">
所属图书:
<el-select value-key="id" v-model="bookList.name" class="global_width" clearable filterable remote default-first-option placeholder="请输入并关联所属图书" :remote-method="getBookList" @clear="resourceBookList=[]" @change="selectChange">
......@@ -83,6 +89,7 @@ export default {
resourceBookList:[],
showRelationDialog:false,
bookList: {},
currentFileList:[],
}
},
methods: {
......@@ -104,6 +111,9 @@ export default {
handlePreview() {
},
getListLength(event, file, fileList){
this.currentFileList = fileList
},
handleRemove(file, fileList) {//移除
this.bookEpub = []
if(this.type == 'book') {
......@@ -151,7 +161,7 @@ export default {
}
},
handleExceed(files, fileList) { //上传限制
this.$message.warning(`当前限制选择 10 个文件`);
this.$message.warning(`当前限制选择 20 个文件`);
},
beforeUpload(file) {
let type = file.name.slice(file.name.lastIndexOf('.')+1).toLowerCase()
......@@ -284,9 +294,25 @@ export default {
padding: 0 6px;
}
.relationBook{
padding-top: 20px;
padding-top: 5px;
.book_list{
padding-top: 10px;
}
}
.tipNum{
height: 30px;
display: flex;
justify-content: center;
align-items: center;
margin: 15px auto;
.selectLength{
font-size: 16px;
color: #DE0000;
padding-right:40px;
}
.uploadLength{
font-size: 16px;
color: #219177;
}
}
</style>
\ No newline at end of file
......@@ -9,6 +9,7 @@
multiple
:limit="10"
:action="`${pdfFileUrl}`"
:on-progress="getListLength"
:on-preview="handlePreview"
:on-remove="handleRemove"
:file-list="fileList"
......@@ -17,6 +18,10 @@
:before-upload="beforeUpload">
<el-button type="primary" plain size="small">选择文件(可多选)</el-button>
</el-upload>
<div class="tipNum">
<div class="selectLength">共选择上传数量:{{currentFileList.length}}</div>
<div class="uploadLength">已成功上传数量:{{commonList.length}}</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="cancelAll">全部取消</el-button>
<el-button size="small" style="background:#1F71FF;color:#fff" @click="importSubmit" :loading="sending">全部上传</el-button>
......@@ -62,6 +67,7 @@ export default {
pdfFileUrl,
bookEpub: [],
commonList: [],
currentFileList:[],
}
},
methods: {
......@@ -117,6 +123,9 @@ export default {
}
}
},
getListLength(event, file, fileList){
this.currentFileList = fileList
},
handleSuccess(response, file, fileList) {
this.$message.success('上传成功')
if(this.type == 'pdf') { //pdf
......@@ -178,4 +187,20 @@ export default {
margin-top: 14px;
padding: 0 6px;
}
.tipNum{
height: 30px;
display: flex;
justify-content: center;
align-items: center;
margin: 15px auto;
.selectLength{
font-size: 16px;
color: #DE0000;
padding-right:40px;
}
.uploadLength{
font-size: 16px;
color: #219177;
}
}
</style>
\ No newline at end of file
......@@ -168,8 +168,9 @@ import { getSelectionIds } from "@/filters/getIds";
import editPrice from "@/components/dialog/editPrice";
import editSort from "@/components/dialog/editSort";
import importDia from "@/components/dialog/import";
import { pcUrl } from '@/utils/global'
import { baseUrl, pcUrl, requestPath} from '@/utils/global'
import QRCode from "qrcodejs2";
import queryString from "query-string";
export default {
name:'video_module',
components: {
......@@ -179,6 +180,7 @@ export default {
},
data() {
return {
requestPath,
topBtn:[],
lineBtn:[],
classisyFlag:false,
......@@ -341,9 +343,31 @@ export default {
qrCodeLine: () => {
this.qrCodeCreate(id)
},
batchExportQrBtn: () => {
this.getBatchExport()
}
};
status[btnName]();
},
getBatchExport(){
if (this.isExist(this.chooiceList)) {//至少选中一条
let ids = getSelectionIds(this.chooiceList);
let data = {
ids:ids
}
let {...params} = data
let tempParams = {}
for (const key in params) {
if (({}).hasOwnProperty.call(params, key) && params[key]!== null && params[key]!== '' && params[key]!== undefined) {
tempParams[key] = params[key]
}
}
let paramStr = queryString.stringify(tempParams)
confirm.apply(this, ["确定批量导出选中的视频二维码吗?"]).then(() => {
window.open(`${process.env.VUE_APP_BASE_API}${requestPath.resource}/video-library/batch/download?${paramStr}`)
});
}
},
qrCodeCreate(id){
this.centerQRDialogVisible = true
setTimeout(() => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论