diff --git a/src/components/answer/AnswerValueView.vue b/src/components/answer/AnswerValueView.vue index f2d3ddf..6b5af66 100644 --- a/src/components/answer/AnswerValueView.vue +++ b/src/components/answer/AnswerValueView.vue @@ -51,10 +51,12 @@ interface GroupView { const schemaFields = computed(() => flattenFields(props.groups)); -/** 附件地址由渲染期拼(值里只存相对 key,绝对 URL 不进答卷——契约 §3、方案 §4.3②) */ +/** 附件地址由渲染期拼(值里只存相对 key,绝对 URL 不进答卷——契约 §3、方案 §4.3②)。 + * P93:挂载点是 {ctx}/upload/*(Caddy 静态路由 + 后端 upload 映射),不是 /static/* + * ——/static 是平台主题通道的保留前缀,160 实测 /static/form/** 404、/{ctx}/upload/** 200。 */ function fileLinks(value: unknown): FileLink[] { if (!isFileArray(value)) return []; - const prefix = `${conf.serviceHost || ""}/static/`; + const prefix = `${conf.serviceHost || ""}/upload/`; return (value as FileValue[]).map((f) => ({ name: String(f.fileName ?? f.key ?? ""), url: prefix + String(f.key ?? "") diff --git a/src/components/fields/image/pc.vue b/src/components/fields/image/pc.vue index 27f3500..9032695 100644 --- a/src/components/fields/image/pc.vue +++ b/src/components/fields/image/pc.vue @@ -8,6 +8,10 @@ import type { FieldWidgetProps } from "../types"; import type { FileValue } from "@/types/formSchema"; import { Upload } from "view-ui-plus"; import { alovaInstance } from "@/utils/alova/alova-iview"; +import conf from "@/assets/config/host.config"; + +/** 附件回显基址:{ctx}/upload/(P93);serviceHost 空(dev 同源)时走 /upload 相对路径 */ +const fileBase = `${conf.serviceHost || ""}/upload`; const props = withDefaults(defineProps
- + +
×
{ target: "http://localhost:8086", changeOrigin: true, }, + // 附件/图片回显同源代理(P93:URL={serviceHost}/upload/{key},dev 下 serviceHost 空) + "/upload": { + target: "http://localhost:8086", + changeOrigin: true, + }, // 主题通道本地联调:dev 下 loader 走同源相对,manifest/CSS 经此代理到中央通道。 // 联调本地通道源:YschTheme 侧 npm run serve:static(默认 9527),再用 // YH_THEME_PROXY_TARGET=http://localhost:9527 覆盖本 target