diff --git a/src/views/mp/components/img.png b/src/views/mp/components/img.png deleted file mode 100644 index c25a6e76..00000000 Binary files a/src/views/mp/components/img.png and /dev/null differ diff --git a/src/views/mp/material/components/Waterfall.vue b/src/views/mp/material/components/ImageTable.vue similarity index 100% rename from src/views/mp/material/components/Waterfall.vue rename to src/views/mp/material/components/ImageTable.vue diff --git a/src/views/mp/material/components/Upload.vue b/src/views/mp/material/components/UploadFile.vue similarity index 98% rename from src/views/mp/material/components/Upload.vue rename to src/views/mp/material/components/UploadFile.vue index 541dbc20..3ab62224 100644 --- a/src/views/mp/material/components/Upload.vue +++ b/src/views/mp/material/components/UploadFile.vue @@ -20,7 +20,6 @@ - - - diff --git a/src/views/mp/material/components/UploadVideo.vue b/src/views/mp/material/components/UploadVideo.vue index 5da7d980..816711d1 100644 --- a/src/views/mp/material/components/UploadVideo.vue +++ b/src/views/mp/material/components/UploadVideo.vue @@ -123,5 +123,3 @@ const handleUploadSuccess: UploadProps['onSuccess'] = (res: any) => { emit('uploaded') } - - diff --git a/src/views/mp/material/components/VideoTable.vue b/src/views/mp/material/components/VideoTable.vue index 3bd2fe00..81472959 100644 --- a/src/views/mp/material/components/VideoTable.vue +++ b/src/views/mp/material/components/VideoTable.vue @@ -57,5 +57,3 @@ const handleDownload = (url: string) => { window.open(url, '_blank') } - - diff --git a/src/views/mp/material/components/VoiceTable.vue b/src/views/mp/material/components/VoiceTable.vue index 44bd01da..6f37e1a0 100644 --- a/src/views/mp/material/components/VoiceTable.vue +++ b/src/views/mp/material/components/VoiceTable.vue @@ -49,5 +49,3 @@ const emit = defineEmits<{ (e: 'delete', v: number) }>() - - diff --git a/src/views/mp/material/components/upload.ts b/src/views/mp/material/components/upload.ts index 37441f5b..239665a2 100644 --- a/src/views/mp/material/components/upload.ts +++ b/src/views/mp/material/components/upload.ts @@ -1,10 +1,9 @@ import type { UploadProps, UploadRawFile } from 'element-plus' import { getAccessToken } from '@/utils/auth' - -const message = useMessage() - -const HEADERS = { Authorization: 'Bearer ' + getAccessToken() } -const UPLOAD_URL = 'http://127.0.0.1:8000/upload/' //import.meta.env.VITE_BASE_URL + '/admin-api/mp/material/upload-permanent' +const message = useMessage() // 消息 +const HEADERS = { Authorization: 'Bearer ' + getAccessToken() } // 请求头 +// const UPLOAD_URL = 'http://127.0.0.1:8000/upload/' // 上传地址 +const UPLOAD_URL = import.meta.env.VITE_BASE_URL + '/admin-api/mp/material/upload-permanent' // 上传地址 enum MaterialType { Image = 'image', @@ -22,7 +21,6 @@ const beforeUpload = (rawFile: UploadRawFile, materialType: MaterialType): boole let allowTypes: string[] = [] let maxSizeMB = 0 let name = '' - switch (materialType) { case MaterialType.Image: allowTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/bmp', 'image/jpg'] @@ -38,18 +36,18 @@ const beforeUpload = (rawFile: UploadRawFile, materialType: MaterialType): boole allowTypes = ['video/mp4'] maxSizeMB = 10 name = '视频' + break } - + // 格式不正确 if (!allowTypes.includes(rawFile.type)) { message.error(`上传${name}格式不对!`) return false } - + // 大小不正确 if (rawFile.size / 1024 / 1024 > maxSizeMB) { message.error(`上传${name}大小不能超过${maxSizeMB}M!`) return false } - return true } diff --git a/src/views/mp/material/index.vue b/src/views/mp/material/index.vue index 40c03968..54bf488f 100644 --- a/src/views/mp/material/index.vue +++ b/src/views/mp/material/index.vue @@ -15,14 +15,15 @@ - 支持 bmp/png/jpeg/jpg/gif 格式,大小不超过 2M - - + + + 语音 - 格式支持 mp3/wma/wav/amr,文件大小不超过 2M,播放长度不超过 60s - - + @@ -70,7 +70,6 @@ > - @@ -84,21 +83,18 @@ - - -