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