Commit fc048527 by xuyl

限制视频大小

1 parent b9e55c33
...@@ -199,7 +199,7 @@ ...@@ -199,7 +199,7 @@
</div> </div>
<div class="displayIro"> <div class="displayIro">
<p class="title">预告视频</p> <p class="title">预告视频</p>
<p class="intro">视频大小不超过30M</p> <p class="intro">视频大小不超过20M</p>
</div> </div>
<el-button class="upload-panel">上传视频 <el-button class="upload-panel">上传视频
<input type="file" accept="video/*" @change="e => handleVideoChange(e)" <input type="file" accept="video/*" @change="e => handleVideoChange(e)"
...@@ -410,6 +410,11 @@ export default { ...@@ -410,6 +410,11 @@ export default {
handleVideoChange(e) { handleVideoChange(e) {
const self = this; const self = this;
let file = e.target.files[0]; let file = e.target.files[0];
const size = file.size / 1024 / 1024;
if (size > 20) {
this.$message.error("上传视频大小不能超过20M");
return;
}
self.loading = true; self.loading = true;
upload.init().then(res => { upload.init().then(res => {
if (res.status == 0) { if (res.status == 0) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!