|
|
@ -2,6 +2,8 @@ import Axios from 'axios' |
|
|
|
import Api from '@/api' |
|
|
|
import Api from '@/api' |
|
|
|
import Setting from '@/setting' |
|
|
|
import Setting from '@/setting' |
|
|
|
import Util from '@/libs/util' |
|
|
|
import Util from '@/libs/util' |
|
|
|
|
|
|
|
import store from '@/store' |
|
|
|
|
|
|
|
import { Loading } from 'element-ui' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
//skin:'oxide-dark',
|
|
|
|
//skin:'oxide-dark',
|
|
|
|
language: 'zh_CN', |
|
|
|
language: 'zh_CN', |
|
|
@ -409,6 +411,13 @@ export default { |
|
|
|
token: Util.local.get(Setting.tokenKey) |
|
|
|
token: Util.local.get(Setting.tokenKey) |
|
|
|
}, |
|
|
|
}, |
|
|
|
}).then(({ data }) => { |
|
|
|
}).then(({ data }) => { |
|
|
|
|
|
|
|
if (data.code === 401) { |
|
|
|
|
|
|
|
Util.errorMsg(data.msg) |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
store.dispatch('user/logout') |
|
|
|
|
|
|
|
}, 1000) |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
succFun(data.url) |
|
|
|
succFun(data.url) |
|
|
|
}).catch(res => { }) |
|
|
|
}).catch(res => { }) |
|
|
|
}, |
|
|
|
}, |
|
|
@ -424,12 +433,26 @@ export default { |
|
|
|
if (meta.filetype === 'media') { |
|
|
|
if (meta.filetype === 'media') { |
|
|
|
// 动态创建上传input,并进行模拟点击上传操作,达到本地上传视频效果。
|
|
|
|
// 动态创建上传input,并进行模拟点击上传操作,达到本地上传视频效果。
|
|
|
|
let input = document.createElement('input');//创建一个隐藏的input
|
|
|
|
let input = document.createElement('input');//创建一个隐藏的input
|
|
|
|
input.setAttribute('type', 'file'); |
|
|
|
input.setAttribute('type', 'file') |
|
|
|
input.setAttribute("accept", ".mp4"); |
|
|
|
input.setAttribute("accept", ".mp4") |
|
|
|
input.onchange = function () { |
|
|
|
input.onchange = function () { |
|
|
|
let file = this.files[0]; |
|
|
|
let file = this.files[0] |
|
|
|
let fd = new FormData(); |
|
|
|
let fd = new FormData() |
|
|
|
fd.append("file", file); |
|
|
|
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({ |
|
|
|
Axios({ |
|
|
|
method: 'post', |
|
|
|
method: 'post', |
|
|
|
url: Api.upload, |
|
|
|
url: Api.upload, |
|
|
@ -439,8 +462,18 @@ export default { |
|
|
|
token: Util.local.get(Setting.tokenKey) |
|
|
|
token: Util.local.get(Setting.tokenKey) |
|
|
|
}, |
|
|
|
}, |
|
|
|
}).then(({ data }) => { |
|
|
|
}).then(({ data }) => { |
|
|
|
|
|
|
|
if (data.code === 401) { |
|
|
|
|
|
|
|
Util.errorMsg(data.msg) |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
store.dispatch('user/logout') |
|
|
|
|
|
|
|
}, 1000) |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
load.close() |
|
|
|
callback(data.url) |
|
|
|
callback(data.url) |
|
|
|
}).catch(res => { }) |
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
load.close() |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
//触发点击
|
|
|
|
//触发点击
|
|
|
|
input.click(); |
|
|
|
input.click(); |
|
|
|