From 9e688c65d336a256a7380a6a774039442e992ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?piexlMax=28=E5=A5=87=E6=B7=BC?= Date: Mon, 1 Sep 2025 15:17:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(richtext):=20=E4=B8=BA=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E7=BC=96=E8=BE=91=E5=99=A8=E4=B8=8A=E4=BC=A0=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=B7=BB=E5=8A=A0token=E8=AE=A4=E8=AF=81=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加用户token到图片上传请求头中,确保有权限的用户才能上传文件 --- web/src/components/richtext/rich-edit.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/src/components/richtext/rich-edit.vue b/web/src/components/richtext/rich-edit.vue index 6cb27714..cf248fb9 100644 --- a/web/src/components/richtext/rich-edit.vue +++ b/web/src/components/richtext/rich-edit.vue @@ -27,6 +27,7 @@ import { ElMessage } from 'element-plus' import { getUrl } from '@/utils/image' + import { useUserStore } from '@/pinia/modules/user' const emits = defineEmits(['change', 'update:modelValue']) @@ -35,6 +36,7 @@ emits('update:modelValue', valueHtml.value) } + const userStore = useUserStore() const props = defineProps({ modelValue: { type: String, @@ -53,6 +55,9 @@ editorConfig.MENU_CONF['uploadImage'] = { fieldName: 'file', server: basePath + '/fileUploadAndDownload/upload?noSave=1', + headers: { + 'x-token': userStore.token, + }, customInsert(res, insertFn) { if (res.code === 0) { const urlPath = getUrl(res.data.file.url)