|
|
|
@ -1,7 +1,5 @@ |
|
|
|
|
import Axios from 'axios' |
|
|
|
|
import Api from '@/api' |
|
|
|
|
import Setting from '@/setting' |
|
|
|
|
import Util from '@/libs/util' |
|
|
|
|
import Oss from '@/components/upload/upload.js' |
|
|
|
|
import { Loading } from 'element-ui' |
|
|
|
|
export default { |
|
|
|
|
//skin:'oxide-dark',
|
|
|
|
|
language:'zh_CN', |
|
|
|
@ -312,21 +310,25 @@ export default { |
|
|
|
|
powerpaste_allow_local_images: true, |
|
|
|
|
powerpaste_word_import: 'clean', |
|
|
|
|
powerpaste_html_import: 'clean', |
|
|
|
|
urlconverter_callback: (url, node, onSave, name) => { |
|
|
|
|
if (node === 'img' && url.startsWith('blob:')) { |
|
|
|
|
// Do some custom URL conversion
|
|
|
|
|
tinymce.activeEditor && tinymce.activeEditor.uploadImages() |
|
|
|
|
} |
|
|
|
|
// Return new URL
|
|
|
|
|
return url |
|
|
|
|
}, |
|
|
|
|
// 自定义上传
|
|
|
|
|
images_upload_handler: function (blobInfo, succFun, failFun) { |
|
|
|
|
const form = new FormData() |
|
|
|
|
form.append('file', blobInfo.blob()), |
|
|
|
|
Axios({ |
|
|
|
|
method: 'post', |
|
|
|
|
url: Api.upload, |
|
|
|
|
data: form, |
|
|
|
|
headers: { |
|
|
|
|
'Content-Type': 'multipart/form-data', |
|
|
|
|
token: Util.local.get(Setting.tokenKey) |
|
|
|
|
}, |
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
succFun(data.url) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
const blob = blobInfo.blob() |
|
|
|
|
// blob转换为file
|
|
|
|
|
const file = new File([blob], blobInfo.filename(), { |
|
|
|
|
type: 'application/json', |
|
|
|
|
lastModified: Date.now() |
|
|
|
|
}); |
|
|
|
|
Oss.upload(file).then(res => { |
|
|
|
|
succFun(res.url) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
//自定义文件选择器的回调内容 此方法只有在点击上方图片按钮才会触发
|
|
|
|
|
file_picker_callback: function (callback, value, meta) { |
|
|
|
@ -344,19 +346,13 @@ export default { |
|
|
|
|
input.setAttribute("accept", ".mp4"); |
|
|
|
|
input.onchange = function(){ |
|
|
|
|
let file = this.files[0]; |
|
|
|
|
let fd = new FormData(); |
|
|
|
|
fd.append("file", file); |
|
|
|
|
Axios({ |
|
|
|
|
method: 'post', |
|
|
|
|
url: Api.upload, |
|
|
|
|
data: fd, |
|
|
|
|
headers: { |
|
|
|
|
'Content-Type': 'multipart/form-data', |
|
|
|
|
token: Util.local.get(Setting.tokenKey) |
|
|
|
|
}, |
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
callback(data.url) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
const load = Loading.service() |
|
|
|
|
Oss.upload(file).then(res => { |
|
|
|
|
load.close() |
|
|
|
|
callback(res.url) |
|
|
|
|
}).catch(e => { |
|
|
|
|
load.close() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//触发点击
|
|
|
|
|
input.click(); |
|
|
|
|