Commit 8438d384 authored by wangwei's avatar wangwei

课包编辑 编写

parent 0b58c3ed
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=referrer content=never><link rel=stylesheet href=https:////at.alicdn.com/t/font_746649_x1rivf5f5.css><link rel=stylesheet href=https://unpkg.com/element-ui@2.4.9/lib/theme-chalk/index.css><title>唱唱启蒙-后台</title></head><body><script src=https://unpkg.com/vue@2.5.17/dist/vue.js></script><script src=https://unpkg.com/vuex@3.0.1/dist/vuex.min.js></script><script src=https://unpkg.com/axios@0.18.0/dist/axios.min.js></script><script src=https://unpkg.com/element-ui@2.4.9/lib/index.js></script><div id=app></div><script type=text/javascript src=/static/js/manifest.24e25cd7a2cf26982067.js></script><script type=text/javascript src=/static/js/vendor.44e1e5644ae24f910e52.js></script><script type=text/javascript src=/static/js/app.18d9ba04e79d5018e975.js></script></body><script>let el = document.getElementsByTagName("script"); <!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=referrer content=never><link rel=stylesheet href=https:////at.alicdn.com/t/font_746649_x1rivf5f5.css><link rel=stylesheet href=https://unpkg.com/element-ui@2.4.9/lib/theme-chalk/index.css><title>唱唱启蒙-后台</title></head><body><script src=https://unpkg.com/vue@2.5.17/dist/vue.js></script><script src=https://unpkg.com/vuex@3.0.1/dist/vuex.min.js></script><script src=https://unpkg.com/axios@0.18.0/dist/axios.min.js></script><script src=https://unpkg.com/element-ui@2.4.9/lib/index.js></script><div id=app></div><script type=text/javascript src=/static/js/manifest.03ebcbf6633e7fdd8576.js></script><script type=text/javascript src=/static/js/vendor.44e1e5644ae24f910e52.js></script><script type=text/javascript src=/static/js/app.18d9ba04e79d5018e975.js></script></body><script>let el = document.getElementsByTagName("script");
el.onerror = function(a,b,c){ el.onerror = function(a,b,c){
console.log('error:',a,b,c); console.log('error:',a,b,c);
}; };
......
This source diff could not be displayed because it is too large. You can view the blob instead.
!function(e){var c=window.webpackJsonp;window.webpackJsonp=function(a,r,t){for(var d,o,b,i=0,u=[];i<a.length;i++)o=a[i],f[o]&&u.push(f[o][0]),f[o]=0;for(d in r)Object.prototype.hasOwnProperty.call(r,d)&&(e[d]=r[d]);for(c&&c(a,r,t);u.length;)u.shift()();if(t)for(i=0;i<t.length;i++)b=n(n.s=t[i]);return b};var a={},f={42:0};function n(c){if(a[c])return a[c].exports;var f=a[c]={i:c,l:!1,exports:{}};return e[c].call(f.exports,f,f.exports,n),f.l=!0,f.exports}n.e=function(e){var c=f[e];if(0===c)return new Promise(function(e){e()});if(c)return c[2];var a=new Promise(function(a,n){c=f[e]=[a,n]});c[2]=a;var r=document.getElementsByTagName("head")[0],t=document.createElement("script");t.type="text/javascript",t.charset="utf-8",t.async=!0,t.timeout=12e4,n.nc&&t.setAttribute("nonce",n.nc),t.src=n.p+"static/js/"+e+"."+{0:"53afe6475f3a9c5a4cb7",1:"2bcfd3a36e8e1d869d29",2:"4c183436d5446cece479",3:"1984648477db2ab41ac7",4:"8d048ac62c9635b95e1c",5:"56ccc28818550654eba5",6:"4c1a43dc0060d89ba9dd",7:"984e0ffc6b0871ee9622",8:"bb9cdd49f15f1a45fce6",9:"e56273193d82dc9daa87",10:"8f785e4335cdb987dc3d",11:"92c4756735cf7f92294c",12:"53d4e5a5ecf493cde3f2",13:"5eada2208ca5971fcf28",14:"8eb0f551a78806da01a0",15:"1c93652d6950e50d383e",16:"2dd9992de78fde8322d8",17:"82da55ae0d64f7599736",18:"692489712d3f7e7b75f2",19:"a54c6b36a122b4fd13bd",20:"a45e736554777aaeb89c",21:"70caa9fd338476f2acf7",22:"c4394f2a0fd74168b28b",23:"3c28a097b66ff5b3057e",24:"0c8eae9a6f96382f1a26",25:"8bae274439d940c1630b",26:"be3a2c64fca880ac9773",27:"a0ce4cf364c89e293f73",28:"586ff288516e66f5c379",29:"dad2437060a95a66b1a7",30:"fa9f517f244298c3ee8e",31:"de67c709d07948e5725e",32:"db1daa6bef63faedf8df",33:"dc5441f221181c75b830",34:"4eccfaf85ffe323736f9",35:"9fa70099b272fee5b92d",36:"59545b937a125c147025",37:"c7b7a8ab0c7da87074a3",38:"a329d65cf6c7338b630e",39:"58270d116696b8b057e7"}[e]+".js";var d=setTimeout(o,12e4);function o(){t.onerror=t.onload=null,clearTimeout(d);var c=f[e];0!==c&&(c&&c[1](new Error("Loading chunk "+e+" failed.")),f[e]=void 0)}return t.onerror=t.onload=o,r.appendChild(t),a},n.m=e,n.c=a,n.d=function(e,c,a){n.o(e,c)||Object.defineProperty(e,c,{configurable:!1,enumerable:!0,get:a})},n.n=function(e){var c=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(c,"a",c),c},n.o=function(e,c){return Object.prototype.hasOwnProperty.call(e,c)},n.p="/",n.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
v-if="!uploadType" v-if="!uploadType"
class="avatar-uploader" class="avatar-uploader"
:http-request="uploadFileImage" :http-request="uploadFileImage"
:before-upload="beforeAvatarUpload"
action="https://jsonplaceholder.typicode.com/posts/" action="https://jsonplaceholder.typicode.com/posts/"
:on-success="uploadImgSuccess" :on-success="uploadImgSuccess"
:show-file-list="false"> :show-file-list="false">
...@@ -42,8 +43,18 @@ ...@@ -42,8 +43,18 @@
} }
}, },
methods:{ methods:{
beforeAvatarUpload(file){
const isJPG = (file.type === 'image/jpeg' || file.type === 'image/png' );
const isLt2M = file.size / 1024 < 200;
if (!isJPG) {
this.$message.error('上传头像图片只能是 JPG 或 PNG 格式!');
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 200KB!');
}
return isJPG && isLt2M;
},
uploadFileImage(a){ uploadFileImage(a){
if( a.file.size < 200 * 1024) {
uploadFileApi({file:a.file,type:'local',obj:a}).then(res=>{ uploadFileApi({file:a.file,type:'local',obj:a}).then(res=>{
this.formData.cover = process.env.IMAGE_URL_HEAD + res.url; this.formData.cover = process.env.IMAGE_URL_HEAD + res.url;
this.$message({ this.$message({
...@@ -52,12 +63,6 @@ ...@@ -52,12 +63,6 @@
}); });
a.onSuccess('上传成功') a.onSuccess('上传成功')
}); });
}else{
this.$message({
type: 'error',
message: '文件过大'
});
}
}, },
uploadImgSuccess(a,b,c){ uploadImgSuccess(a,b,c){
} }
......
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
width="550px"> width="550px">
<el-form label-width="80px"> <el-form label-width="80px">
<el-form-item label="图片"> <el-form-item label="图片">
<el-upload <el-upload
action="/api/public/upload" action="/api/public/upload"
:http-request="uploadFile" :http-request="uploadFile"
:on-remove="removeFile" :on-remove="removeFile"
:before-upload="beforeAvatarUploadImg"
drag drag
:on-exceed="handleExceed" :on-exceed="handleExceed"
multiple multiple
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
:file-list="form.imgList"> :file-list="form.imgList">
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">只能上传png文件,且不超过100kb</div> <div class="el-upload__tip" slot="tip">只能上传png或jpg文件,且不超过150kb</div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="铺满"> <el-form-item label="铺满">
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
<el-upload <el-upload
action="/api/public/upload" action="/api/public/upload"
:http-request="uploadFileMp3" :http-request="uploadFileMp3"
:before-upload="beforeAvatarUploadAudio"
:on-remove="removeFileMp3" :on-remove="removeFileMp3"
drag drag
:on-exceed="handleExceed" :on-exceed="handleExceed"
...@@ -67,7 +68,7 @@ ...@@ -67,7 +68,7 @@
:file-list="radio"> :file-list="radio">
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">只能上传MP3文件,且不超过5MB</div> <div class="el-upload__tip" slot="tip">只能上传MP3文件,且不超过10MB</div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -79,6 +80,7 @@ ...@@ -79,6 +80,7 @@
</div> </div>
</template> </template>
<script> <script>
import tinymce from 'tinymce/tinymce' import tinymce from 'tinymce/tinymce'
import 'tinymce/themes/modern/theme' import 'tinymce/themes/modern/theme'
...@@ -132,6 +134,28 @@ ...@@ -132,6 +134,28 @@
}, },
methods:{ methods:{
beforeAvatarUploadImg(file){
const isJPG = (file.type === 'image/jpeg' || file.type === 'image/png' );
const isLt2M = file.size / 1024 < 150;
if (!isJPG) {
this.$message.error('上传头像图片只能是 JPG 或 PNG 格式!');
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 150KB!');
}
return isJPG && isLt2M;
},
beforeAvatarUploadAudio(file){
const isJPG = (file.type === 'audio/mp3' );
const isLt2M = file.size / 1024 / 1024 < 10;
if (!isJPG) {
this.$message.error('上传音频只能选择MP3格式!');
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 10MB!');
}
return isJPG && isLt2M;
},
imgInter(){ imgInter(){
if(this.form.imgList.length < 1){ if(this.form.imgList.length < 1){
this.$message({ this.$message({
...@@ -169,7 +193,6 @@ ...@@ -169,7 +193,6 @@
this.dialogVisible = false this.dialogVisible = false
}, },
uploadFile(a){ uploadFile(a){
if(a.file.size < 100*1024 && a.file.type === 'image/png'){
uploadFileApi({file:a.file,type:'local'}).then(res=>{ uploadFileApi({file:a.file,type:'local'}).then(res=>{
this.$message({ this.$message({
type: 'success', type: 'success',
...@@ -177,17 +200,8 @@ ...@@ -177,17 +200,8 @@
}); });
this.form.imgList = [{name:res.name,url:process.env.IMAGE_URL_HEAD + res.url}]; this.form.imgList = [{name:res.name,url:process.env.IMAGE_URL_HEAD + res.url}];
}) })
}else {
this.$message({
type: 'error',
message: '上传失败,图片格式或大小不正确!'
});
this.form.imgList = [];
}
}, },
uploadFileMp3(a){ uploadFileMp3(a){
console.log(a);
if(a.file.size < 1024*1024*5 && a.file.type === 'audio/mp3'){
uploadFileApi({file:a.file,type:'local'}).then(res=>{ uploadFileApi({file:a.file,type:'local'}).then(res=>{
this.$message({ this.$message({
type: 'success', type: 'success',
...@@ -195,13 +209,6 @@ ...@@ -195,13 +209,6 @@
}); });
this.radio = [{name:res.name,url:res.url}]; this.radio = [{name:res.name,url:res.url}];
}) })
}else {
this.$message({
type: 'error',
message: '上传失败,音频格式或大小不正确!'
});
this.form.imgList = [];
}
}, },
showDialogMP3(){ showDialogMP3(){
this.dialogVisibleMp3 = true this.dialogVisibleMp3 = true
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
v-if="!uploadType" v-if="!uploadType"
:http-request="uploadFileVideo" :http-request="uploadFileVideo"
:file-list="formData.video" :file-list="formData.video"
:before-upload="beforeAvatarVideo"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:on-remove="removeFileVideo" :on-remove="removeFileVideo"
action="https://jsonplaceholder.typicode.com/posts/" action="https://jsonplaceholder.typicode.com/posts/"
...@@ -28,11 +29,11 @@ ...@@ -28,11 +29,11 @@
<div class="el-upload__text"> <div class="el-upload__text">
将文件拖到此处,或<em>点击上传</em> 将文件拖到此处,或<em>点击上传</em>
<br> <br>
<span style="color: #888888;font-size: 12px">只能上传MP4或AVI文件</span> <span style="color: #888888;font-size: 12px">只能上传MP4文件</span>
</div> </div>
<div class="el-upload__tip" slot="tip"></div> <div class="el-upload__tip" slot="tip"></div>
</el-upload> </el-upload>
<el-input v-if="uploadType" v-for="data in formData.video" style="margin-bottom: 10px" v-model="data.url"> <el-input v-if="uploadType" v-for="(data,index) in formData.video" :key="index" style="margin-bottom: 10px" v-model="data.url">
<i slot="suffix" class="el-input__icon el-icon-delete" @click="delVideo(data)"></i> <i slot="suffix" class="el-input__icon el-icon-delete" @click="delVideo(data)"></i>
</el-input> </el-input>
<div v-if="uploadType" style="text-align: center"> <div v-if="uploadType" style="text-align: center">
...@@ -54,6 +55,7 @@ ...@@ -54,6 +55,7 @@
<el-upload <el-upload
v-if="!uploadType" v-if="!uploadType"
class="upload-demo" class="upload-demo"
:before-upload="beforeAvatarAudio"
:http-request="uploadFileAudio" :http-request="uploadFileAudio"
:file-list="formData.audio" :file-list="formData.audio"
:on-exceed="handleExceed" :on-exceed="handleExceed"
...@@ -68,14 +70,14 @@ ...@@ -68,14 +70,14 @@
<span style="color: #888888;font-size: 12px">只能上传MP3文件</span> <span style="color: #888888;font-size: 12px">只能上传MP3文件</span>
</div> </div>
</el-upload> </el-upload>
<el-input v-if="uploadType" v-for="data in formData.audio" style="margin-bottom: 10px" v-model="data.url"> <el-input v-if="uploadType" v-for="(data,index) in formData.audio" :key="index" style="margin-bottom: 10px" v-model="data.url">
<i slot="suffix" class="el-input__icon el-icon-delete" @click="delAudio(data)"></i> <i slot="suffix" class="el-input__icon el-icon-delete" @click="delAudio(data)"></i>
</el-input> </el-input>
<div v-if="uploadType" style="text-align: center"> <div v-if="uploadType" style="text-align: center">
<el-button @click="pushNewAudio">添加音频</el-button> <el-button @click="pushNewAudio">添加音频</el-button>
</div> </div>
</el-form-item> </el-form-item>
<div v-if="formData.change" v-for="(data,index) in formData.audio" class="mp3-block"> <div v-if="formData.change" v-for="(data,index) in formData.audio" :key="index" class="mp3-block">
<h3> <h3>
{{data.name}} {{data.name}}
</h3> </h3>
...@@ -83,6 +85,7 @@ ...@@ -83,6 +85,7 @@
<el-upload <el-upload
class="avatar-uploader" class="avatar-uploader"
:http-request="uploadFileImage" :http-request="uploadFileImage"
:before-upload="beforeAvatarImage"
:data="data" :data="data"
action="https://jsonplaceholder.typicode.com/posts/" action="https://jsonplaceholder.typicode.com/posts/"
:on-success="uploadImgSuccess" :on-success="uploadImgSuccess"
...@@ -116,6 +119,7 @@ ...@@ -116,6 +119,7 @@
drag drag
v-if="!uploadType" v-if="!uploadType"
:http-request="uploadFileVideo2" :http-request="uploadFileVideo2"
:before-upload="beforeAvatarVideo"
:file-list="formData.video2" :file-list="formData.video2"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:on-remove="removeFileVideo2" :on-remove="removeFileVideo2"
...@@ -129,7 +133,7 @@ ...@@ -129,7 +133,7 @@
</div> </div>
<div class="el-upload__tip" slot="tip"></div> <div class="el-upload__tip" slot="tip"></div>
</el-upload> </el-upload>
<el-input v-if="uploadType" v-for="data in formData.video2" style="margin-bottom: 10px" v-model="data.url"> <el-input v-if="uploadType" v-for="(data,index) in formData.video2" :key="index" style="margin-bottom: 10px" v-model="data.url">
<i slot="suffix" class="el-input__icon el-icon-delete" @click="delVideo2(data)"></i> <i slot="suffix" class="el-input__icon el-icon-delete" @click="delVideo2(data)"></i>
</el-input> </el-input>
<div v-if="uploadType" style="text-align: center"> <div v-if="uploadType" style="text-align: center">
...@@ -152,6 +156,7 @@ ...@@ -152,6 +156,7 @@
v-if="!uploadType" v-if="!uploadType"
class="upload-demo" class="upload-demo"
:http-request="uploadFileAudio2" :http-request="uploadFileAudio2"
:before-upload="beforeAvatarAudio"
:file-list="formData.audio2" :file-list="formData.audio2"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:on-remove="removeFileAudio2" :on-remove="removeFileAudio2"
...@@ -165,20 +170,21 @@ ...@@ -165,20 +170,21 @@
<span style="color: #888888;font-size: 12px">只能上传MP3文件</span> <span style="color: #888888;font-size: 12px">只能上传MP3文件</span>
</div> </div>
</el-upload> </el-upload>
<el-input v-if="uploadType" v-for="data in formData.audio2" style="margin-bottom: 10px" v-model="data.url"> <el-input v-if="uploadType" v-for="(data,index) in formData.audio2" :key="index" style="margin-bottom: 10px" v-model="data.url">
<i slot="suffix" class="el-input__icon el-icon-delete" @click="delAudio2(data)"></i> <i slot="suffix" class="el-input__icon el-icon-delete" @click="delAudio2(data)"></i>
</el-input> </el-input>
<div v-if="uploadType" style="text-align: center"> <div v-if="uploadType" style="text-align: center">
<el-button @click="pushNewAudio2">添加音频</el-button> <el-button @click="pushNewAudio2">添加音频</el-button>
</div> </div>
</el-form-item> </el-form-item>
<div v-if="formData.change2 && formData.age" v-for="(data,index) in formData.audio2" class="mp3-block"> <div v-if="formData.change2 && formData.age" v-for="(data,index) in formData.audio2" :key="index" class="mp3-block">
<h3> <h3>
{{data.name}} {{data.name}}
</h3> </h3>
<el-form-item :label="`音频${index + 1}图片`"> <el-form-item :label="`音频${index + 1}图片`">
<el-upload <el-upload
class="avatar-uploader" class="avatar-uploader"
:before-upload="beforeAvatarImage"
:http-request="uploadFileImage" :http-request="uploadFileImage"
:data="data" :data="data"
action="https://jsonplaceholder.typicode.com/posts/" action="https://jsonplaceholder.typicode.com/posts/"
...@@ -201,6 +207,7 @@ ...@@ -201,6 +207,7 @@
<el-upload <el-upload
class="upload-demo" class="upload-demo"
:http-request="uploadFileAudio" :http-request="uploadFileAudio"
:before-upload="beforeAvatarAudio"
:file-list="formData.audio" :file-list="formData.audio"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:on-remove="removeFileAudio" :on-remove="removeFileAudio"
...@@ -215,7 +222,7 @@ ...@@ -215,7 +222,7 @@
</div> </div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<div v-for="(data,index) in formData.audio" class="mp3-block"> <div v-for="(data,index) in formData.audio" :key="index" class="mp3-block">
<h3> <h3>
{{data.name}} {{data.name}}
</h3> </h3>
...@@ -223,6 +230,7 @@ ...@@ -223,6 +230,7 @@
<el-upload <el-upload
class="avatar-uploader" class="avatar-uploader"
:http-request="uploadFileImage" :http-request="uploadFileImage"
:before-upload="beforeAvatarImage"
:data="data" :data="data"
action="https://jsonplaceholder.typicode.com/posts/" action="https://jsonplaceholder.typicode.com/posts/"
:on-success="uploadImgSuccess" :on-success="uploadImgSuccess"
...@@ -255,36 +263,71 @@ ...@@ -255,36 +263,71 @@
} }
}, },
methods:{ methods:{
beforeAvatarImage(){
const isJPG = (file.type === 'image/jpeg' || file.type === 'image/png' );
const isLt2M = file.size / 1024 < 200;
if (!isJPG) {
this.$message.error('上传头像图片只能是 JPG 或 PNG 格式!');
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 200KB!');
}
return isJPG && isLt2M;
},
// 添加视频按钮
pushNewVideo(){ pushNewVideo(){
this.formData.video.push({name:'地址输入文件',url:''}) this.formData.video.push({name:'地址输入文件',url:''})
}, },
// 视频文件限制
beforeAvatarVideo(file){
const isJPG = (file.type === 'video/mp4' );
if (!isJPG) {
this.$message.error('上传视频只能是MP4格式!');
}
return isJPG;
},
// 音频文件限制
beforeAvatarAudio(file){
const isJPG = (file.type === 'audio/mp3' );
if (!isJPG) {
this.$message.error('上传视频只能是MP4格式!');
}
return isJPG;
},
// 添加音频按钮
pushNewAudio(){ pushNewAudio(){
this.formData.audio.push({name:'地址录入文件',url:'',title:'',tips:'',image:''}) this.formData.audio.push({name:'地址录入文件',url:'',title:'',tips:'',image:''})
}, },
// 删除视频
delVideo(data){ delVideo(data){
let i = this.formData.video.indexOf(data); let i = this.formData.video.indexOf(data);
this.formData.video.splice(i,1) this.formData.video.splice(i,1)
}, },
// 删除音频
delAudio(data){ delAudio(data){
let i = this.formData.audio.indexOf(data); let i = this.formData.audio.indexOf(data);
this.formData.audio.splice(i,1) this.formData.audio.splice(i,1)
}, },
// 添加视频2
pushNewVideo2(){ pushNewVideo2(){
this.formData.video2.push({name:'地址输入文件',url:''}) this.formData.video2.push({name:'地址输入文件',url:''})
}, },
// 添加音频2
pushNewAudio2(){ pushNewAudio2(){
this.formData.audio2.push({name:'地址录入文件',url:'',title:'',tips:'',image:''}) this.formData.audio2.push({name:'地址录入文件',url:'',title:'',tips:'',image:''})
}, },
// 珊瑚视频2
delVideo2(data){ delVideo2(data){
let i = this.formData.video2.indexOf(data); let i = this.formData.video2.indexOf(data);
this.formData.video2.splice(i,1) this.formData.video2.splice(i,1)
}, },
// 删除音频2
delAudio2(data){ delAudio2(data){
let i = this.formData.audio2.indexOf(data); let i = this.formData.audio2.indexOf(data);
this.formData.audio2.splice(i,1) this.formData.audio2.splice(i,1)
}, },
// 上传视频
uploadFileVideo(a){ uploadFileVideo(a){
if( a.file.type === 'video/mp4'){
uploadFileApi({file:a.file,type:'local',obj:a}).then(res=>{ uploadFileApi({file:a.file,type:'local',obj:a}).then(res=>{
this.$message({ this.$message({
type: 'success', type: 'success',
...@@ -292,15 +335,9 @@ ...@@ -292,15 +335,9 @@
}); });
this.formData.video.push({name:res.name,url:process.env.IMAGE_URL_HEAD + res.url}); this.formData.video.push({name:res.name,url:process.env.IMAGE_URL_HEAD + res.url});
}) })
}else {
this.$message({
type: 'error',
message: '上传失败,图片格式或大小不正确!'
});
}
}, },
// 上传视频2
uploadFileVideo2(a){ uploadFileVideo2(a){
if( a.file.type === 'video/mp4'){
uploadFileApi({file:a.file,type:'local',obj:a}).then(res=>{ uploadFileApi({file:a.file,type:'local',obj:a}).then(res=>{
this.$message({ this.$message({
type: 'success', type: 'success',
...@@ -308,15 +345,9 @@ ...@@ -308,15 +345,9 @@
}); });
this.formData.video2.push({name:res.name,url:process.env.IMAGE_URL_HEAD + res.url}); this.formData.video2.push({name:res.name,url:process.env.IMAGE_URL_HEAD + res.url});
}) })
}else {
this.$message({
type: 'error',
message: '上传失败,图片格式或大小不正确!'
});
}
}, },
// 上传音频
uploadFileAudio(a){ uploadFileAudio(a){
if( a.file.type === 'audio/mp3'){
uploadFileApi({file:a.file,type:'local',obj:a}).then(res=>{ uploadFileApi({file:a.file,type:'local',obj:a}).then(res=>{
this.$message({ this.$message({
type: 'success', type: 'success',
...@@ -325,15 +356,9 @@ ...@@ -325,15 +356,9 @@
a.onSuccess('上传成功') a.onSuccess('上传成功')
this.formData.audio.push({name:res.name,url:process.env.IMAGE_URL_HEAD + res.url,title:'',tips:'',image:''}); this.formData.audio.push({name:res.name,url:process.env.IMAGE_URL_HEAD + res.url,title:'',tips:'',image:''});
}) })
}else {
this.$message({
type: 'error',
message: '上传失败,图片格式或大小不正确!'
});
}
}, },
// 上传音频2
uploadFileAudio2(a){ uploadFileAudio2(a){
if( a.file.type === 'audio/mp3'){
uploadFileApi({file:a.file,type:'local',obj:a}).then(res=>{ uploadFileApi({file:a.file,type:'local',obj:a}).then(res=>{
this.$message({ this.$message({
type: 'success', type: 'success',
...@@ -342,23 +367,20 @@ ...@@ -342,23 +367,20 @@
a.onSuccess('上传成功'); a.onSuccess('上传成功');
this.formData.audio2.push({name:res.name,url:process.env.IMAGE_URL_HEAD + res.url,title:'',tips:'',image:''}); this.formData.audio2.push({name:res.name,url:process.env.IMAGE_URL_HEAD + res.url,title:'',tips:'',image:''});
}) })
}else {
this.$message({
type: 'error',
message: '上传失败,图片格式或大小不正确!'
});
this.form.imgList = [];
}
}, },
// 移除
removeFileVideo(file,fileList){ removeFileVideo(file,fileList){
this.formData.video = fileList this.formData.video = fileList
}, },
// 移除
removeFileVideo2(file,fileList){ removeFileVideo2(file,fileList){
this.formData.video2 = fileList this.formData.video2 = fileList
}, },
// 移除
removeFileAudio(file,fileList){ removeFileAudio(file,fileList){
this.formData.audio = fileList this.formData.audio = fileList
}, },
// 移除
removeFileAudio2(file,fileList){ removeFileAudio2(file,fileList){
this.formData.audio2 = fileList this.formData.audio2 = fileList
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment