Showing
1 changed file
with
4 additions
and
1 deletions
| @@ -25,6 +25,8 @@ | @@ -25,6 +25,8 @@ | ||
| 25 | import { useI18n } from '/@/hooks/web/useI18n'; | 25 | import { useI18n } from '/@/hooks/web/useI18n'; |
| 26 | import { JWT_TOKEN_KEY } from '/@/enums/cacheEnum'; | 26 | import { JWT_TOKEN_KEY } from '/@/enums/cacheEnum'; |
| 27 | import { getAuthCache } from '/@/utils/auth'; | 27 | import { getAuthCache } from '/@/utils/auth'; |
| 28 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
| 29 | + | ||
| 28 | export default defineComponent({ | 30 | export default defineComponent({ |
| 29 | name: 'TinymceImageUpload', | 31 | name: 'TinymceImageUpload', |
| 30 | components: { Upload }, | 32 | components: { Upload }, |
| @@ -39,6 +41,7 @@ | @@ -39,6 +41,7 @@ | ||
| 39 | }, | 41 | }, |
| 40 | emits: ['uploading', 'done', 'error'], | 42 | emits: ['uploading', 'done', 'error'], |
| 41 | setup(props, { emit }) { | 43 | setup(props, { emit }) { |
| 44 | + const { createMessage } = useMessage(); | ||
| 42 | let uploading = false; | 45 | let uploading = false; |
| 43 | const token: string = getAuthCache(JWT_TOKEN_KEY); | 46 | const token: string = getAuthCache(JWT_TOKEN_KEY); |
| 44 | const { uploadUrl } = useGlobSetting(); | 47 | const { uploadUrl } = useGlobSetting(); |
| @@ -55,7 +58,6 @@ | @@ -55,7 +58,6 @@ | ||
| 55 | }); | 58 | }); |
| 56 | 59 | ||
| 57 | function handleChange(info: Recordable) { | 60 | function handleChange(info: Recordable) { |
| 58 | - console.log(info); | ||
| 59 | const file = info.file; | 61 | const file = info.file; |
| 60 | const status = file?.status; | 62 | const status = file?.status; |
| 61 | const url = file?.response?.fileStaticUri; | 63 | const url = file?.response?.fileStaticUri; |
| @@ -72,6 +74,7 @@ | @@ -72,6 +74,7 @@ | ||
| 72 | loading.value = false; | 74 | loading.value = false; |
| 73 | uploading = false; | 75 | uploading = false; |
| 74 | } else if (status === 'error') { | 76 | } else if (status === 'error') { |
| 77 | + createMessage.error('图片上传失败'); | ||
| 75 | emit('error'); | 78 | emit('error'); |
| 76 | loading.value = false; | 79 | loading.value = false; |
| 77 | uploading = false; | 80 | uploading = false; |