From 220781f04483f17e2a68255b5420a02a5fc06540 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Wed, 13 Aug 2025 17:11:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=A1=861114?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/business/ueditor.vue | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/components/business/ueditor.vue b/src/components/business/ueditor.vue index 0e1485f..bb1a3c3 100644 --- a/src/components/business/ueditor.vue +++ b/src/components/business/ueditor.vue @@ -46,6 +46,18 @@ // 获取用户store实例 const userStore = useUserStore() + // 根据环境动态设置UEditor路径 + const isProduction = computed(() => { + return apiBase.includes('dev-casedata.igandan.com') || apiBase.includes('casedata.igandan.com') + }) + + const ueditorBasePath = computed(() => { + if (isProduction.value) { + return '/admin/web/UEditorPlus/' + } + return '/UEditorPlus/' + }) + const props = defineProps({ // 内容 modelValue: { @@ -86,8 +98,8 @@ const editorConfig = reactive({ // 基础路径配置 - 必须正确设置,避免路径拼接问题 - UEDITOR_HOME_URL: '/UEditorPlus/', - UEDITOR_CORS_URL: '/UEditorPlus/', + UEDITOR_HOME_URL: ueditorBasePath.value, + UEDITOR_CORS_URL: ueditorBasePath.value, // 不从服务器加载配置,使用本地配置 loadConfigFromServer: false, @@ -387,8 +399,8 @@ // 组件挂载后的处理 onMounted(() => { // 在UEditor加载前设置全局配置,避免路径问题 - window.UEDITOR_HOME_URL = '/UEditorPlus/'; - window.UEDITOR_CORS_URL = '/UEditorPlus/'; + window.UEDITOR_HOME_URL = ueditorBasePath.value; + window.UEDITOR_CORS_URL = ueditorBasePath.value; // 设置UEditor的全局上传成功回调 window.UEDITOR_CONFIG = window.UEDITOR_CONFIG || {};