|
|
|
@ -2,6 +2,8 @@ import Axios from 'axios' |
|
|
|
|
import Api from '@/api' |
|
|
|
|
import Setting from '@/setting' |
|
|
|
|
import Util from '@/libs/util' |
|
|
|
|
import store from '@/store' |
|
|
|
|
import { Loading } from 'element-ui' |
|
|
|
|
export default { |
|
|
|
|
//skin:'oxide-dark',
|
|
|
|
|
language: 'zh_CN', |
|
|
|
@ -409,6 +411,13 @@ export default { |
|
|
|
|
token: Util.local.get(Setting.tokenKey) |
|
|
|
|
}, |
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
if (data.code === 401) { |
|
|
|
|
Util.errorMsg(data.msg) |
|
|
|
|
setTimeout(() => { |
|
|
|
|
store.dispatch('user/logout') |
|
|
|
|
}, 1000) |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
succFun(data.url) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
@ -424,12 +433,26 @@ export default { |
|
|
|
|
if (meta.filetype === 'media') { |
|
|
|
|
// 动态创建上传input,并进行模拟点击上传操作,达到本地上传视频效果。
|
|
|
|
|
let input = document.createElement('input');//创建一个隐藏的input
|
|
|
|
|
input.setAttribute('type', 'file'); |
|
|
|
|
input.setAttribute("accept", ".mp4"); |
|
|
|
|
input.setAttribute('type', 'file') |
|
|
|
|
input.setAttribute("accept", ".mp4") |
|
|
|
|
input.onchange = function () { |
|
|
|
|
let file = this.files[0]; |
|
|
|
|
let fd = new FormData(); |
|
|
|
|
fd.append("file", file); |
|
|
|
|
let file = this.files[0] |
|
|
|
|
let fd = new FormData() |
|
|
|
|
fd.append("file", file) |
|
|
|
|
// const el = document.createElement('div')
|
|
|
|
|
// el.className = 'tinymce-loadel'
|
|
|
|
|
// el.style.position = 'absolute'
|
|
|
|
|
// el.style.width = '100%'
|
|
|
|
|
// el.style.height = '100%'
|
|
|
|
|
// document.querySelector('.tox-dialog').appendChild(el)
|
|
|
|
|
const load = Loading.service({ |
|
|
|
|
lock: true, |
|
|
|
|
text: '正在上传', |
|
|
|
|
spinner: 'el-icon-loading', |
|
|
|
|
background: 'rgba(0, 0, 0, 0.7)', |
|
|
|
|
zIndex: 30000, |
|
|
|
|
customClass: 'tinymce-load' |
|
|
|
|
}) |
|
|
|
|
Axios({ |
|
|
|
|
method: 'post', |
|
|
|
|
url: Api.upload, |
|
|
|
@ -439,8 +462,18 @@ export default { |
|
|
|
|
token: Util.local.get(Setting.tokenKey) |
|
|
|
|
}, |
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
if (data.code === 401) { |
|
|
|
|
Util.errorMsg(data.msg) |
|
|
|
|
setTimeout(() => { |
|
|
|
|
store.dispatch('user/logout') |
|
|
|
|
}, 1000) |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
load.close() |
|
|
|
|
callback(data.url) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(res => { |
|
|
|
|
load.close() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//触发点击
|
|
|
|
|
input.click(); |
|
|
|
|