|
@@ -67,7 +67,14 @@ function buildShortUUID(prefix = '') {
|
|
|
const random = Math.floor(Math.random() * 1000000000)
|
|
|
return prefix + '_' + random + String(time)
|
|
|
}
|
|
|
-
|
|
|
+function buildUUID() {
|
|
|
+ const date = new Date()
|
|
|
+ const uuid =
|
|
|
+ Math.random().toString().replace('.', '') +
|
|
|
+ Math.random().toString().replace('.', '') +
|
|
|
+ date.getTime()
|
|
|
+ return uuid
|
|
|
+}
|
|
|
function onMountedOrActivated(hook) {
|
|
|
let mounted
|
|
|
onMounted(() => {
|
|
@@ -146,10 +153,13 @@ const initOptions = computed(() => {
|
|
|
content_css: '/resource/tinymce/skins/ui/oxide/content.min.css',
|
|
|
images_upload_handler(blobInfo, succFun, failFun) {
|
|
|
const file = blobInfo.blob()
|
|
|
- console.log(file)
|
|
|
const url = import.meta.env.VITE_UPLOAD_URL
|
|
|
const formData = new FormData()
|
|
|
- formData.append('path', file['name'])
|
|
|
+ const arr = file.name.split('.')
|
|
|
+ if (arr.length > 1) {
|
|
|
+ const suffix = arr[arr.length - 1]
|
|
|
+ formData.append('path', `${buildUUID()}.${suffix}`)
|
|
|
+ }
|
|
|
formData.append('file', file)
|
|
|
request.upload({ url: url, data: formData }).then((result) => {
|
|
|
succFun(result['data'])
|