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){
console.log('error:',a,b,c);
};
......
This diff is collapsed.
!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 @@
v-if="!uploadType"
class="avatar-uploader"
:http-request="uploadFileImage"
:before-upload="beforeAvatarUpload"
action="https://jsonplaceholder.typicode.com/posts/"
:on-success="uploadImgSuccess"
:show-file-list="false">
......@@ -42,8 +43,18 @@
}
},
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){
if( a.file.size < 200 * 1024) {
uploadFileApi({file:a.file,type:'local',obj:a}).then(res=>{
this.formData.cover = process.env.IMAGE_URL_HEAD + res.url;
this.$message({
......@@ -52,12 +63,6 @@
});
a.onSuccess('上传成功')
});
}else{
this.$message({
type: 'error',
message: '文件过大'
});
}
},
uploadImgSuccess(a,b,c){
}
......
......@@ -15,11 +15,11 @@
width="550px">
<el-form label-width="80px">
<el-form-item label="图片">
<el-upload
action="/api/public/upload"
:http-request="uploadFile"
:on-remove="removeFile"
:before-upload="beforeAvatarUploadImg"
drag
:on-exceed="handleExceed"
multiple
......@@ -27,7 +27,7 @@
:file-list="form.imgList">
<i class="el-icon-upload"></i>
<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-form-item>
<el-form-item label="铺满">
......@@ -59,6 +59,7 @@
<el-upload
action="/api/public/upload"
:http-request="uploadFileMp3"
:before-upload="beforeAvatarUploadAudio"
:on-remove="removeFileMp3"
drag
:on-exceed="handleExceed"
......@@ -67,7 +68,7 @@
:file-list="radio">
<i class="el-icon-upload"></i>
<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-form-item>
</el-form>
......@@ -79,6 +80,7 @@
</div>
</template>
<script>
import tinymce from 'tinymce/tinymce'
import 'tinymce/themes/modern/theme'
......@@ -132,6 +134,28 @@
},
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(){
if(this.form.imgList.length < 1){
this.$message({
......@@ -169,7 +193,6 @@
this.dialogVisible = false
},
uploadFile(a){
if(a.file.size < 100*1024 && a.file.type === 'image/png'){
uploadFileApi({file:a.file,type:'local'}).then(res=>{
this.$message({
type: 'success',
......@@ -177,17 +200,8 @@
});
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){
console.log(a);
if(a.file.size < 1024*1024*5 && a.file.type === 'audio/mp3'){
uploadFileApi({file:a.file,type:'local'}).then(res=>{
this.$message({
type: 'success',
......@@ -195,13 +209,6 @@
});
this.radio = [{name:res.name,url:res.url}];
})
}else {
this.$message({
type: 'error',
message: '上传失败,音频格式或大小不正确!'
});
this.form.imgList = [];
}
},
showDialogMP3(){
this.dialogVisibleMp3 = true
......
This diff is collapsed.
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