后台上传视频

master
lion 2 years ago
parent d9774f38b1
commit 90434ca0c9

@ -120,7 +120,7 @@
<el-upload style="width: 300px" ref="upload" multiple :on-success=" <el-upload style="width: 300px" ref="upload" multiple :on-success="
(response, file, fileList) => (response, file, fileList) =>
successHandle(response, file, fileList, 'video_id') successHandle(response, file, fileList, 'video_id')
" :before-upload="uploadBefore" accept=".mp4,.avi,.wmv" :action="action" :file-list="video_id" " :before-upload="uploadBefore" accept=".mp4,.avi,.wmv,.mp3" :action="action" :file-list="video_id"
:auto-upload="false" :on-remove=" :auto-upload="false" :on-remove="
(file, fileList) => removeHande(file, fileList, 'video_id') (file, fileList) => removeHande(file, fileList, 'video_id')
"> ">
@ -128,7 +128,7 @@
<el-button style="margin-left: 10px" size="small" type="success" <el-button style="margin-left: 10px" size="small" type="success"
@click="$refs['upload'].submit()">开始上传</el-button> @click="$refs['upload'].submit()">开始上传</el-button>
<div slot="tip" class="el-upload__tip"> <div slot="tip" class="el-upload__tip">
支持文件格式.mp4 .avi .wmv 支持文件格式.mp4 .avi .wmv .mp3
<br />单个文件不能超过300M <br />单个文件不能超过300M
</div> </div>
</el-upload> </el-upload>

@ -125,7 +125,7 @@
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-upload :file-list="fileList" accept="picture" :limit="1" class="avatar-uploader" :action="action" <el-upload :file-list="fileList" accept=".mp4,.avi,.wmv,.mp3" :limit="1" class="avatar-uploader" :action="action"
:show-file-list="true" :on-error="uploadFailAuto" :on-success="uploadSuccessAuto" :show-file-list="true" :on-error="uploadFailAuto" :on-success="uploadSuccessAuto"
:before-upload="uploadBeforeAuto"> :before-upload="uploadBeforeAuto">
<el-button size="small" type="primary">点击上传</el-button> <el-button size="small" type="primary">点击上传</el-button>
@ -279,14 +279,16 @@ import { index as menulist} from "@/api/index";
this.detail.audio_file = response.url this.detail.audio_file = response.url
}, },
uploadBeforeAuto(file) { uploadBeforeAuto(file) {
if ((file.size / 1000) > 20240) { // if ((file.size / 1000) > 20240) {
Message({ // Message({
type: 'warning', // type: 'warning',
message: '上传图片大小超过20M' // message: '20M'
}) // })
return false // return false
} // }
}, },
// //
uploadFail(err) { uploadFail(err) {
console.log(err) console.log(err)

Loading…
Cancel
Save