fix: 修复子路径部署静态资源引用

- 修复 admin 与 usercenter 登录验证码资源在 /flow 子路径下的加载路径

- 统一 logo、空状态图、兜底头像与模型服务商图标的 BASE_URL 处理

- 补齐 usercenter 公共布局与 loading 注入的子路径兼容
This commit is contained in:
2026-03-20 13:02:39 +08:00
parent 39a6daf8fe
commit 07d8193e80
15 changed files with 102 additions and 19 deletions

View File

@@ -14,6 +14,7 @@ defineProps({
},
});
const emptyImageUrl = `${import.meta.env.BASE_URL || '/'}empty.png`;
const themeMode = ref(preferences.theme.mode);
watch(
() => preferences.theme.mode,
@@ -26,7 +27,7 @@ watch(
<template>
<div class="res-container">
<JsonViewer v-if="value" :value="value" copyable :theme="themeMode" />
<ElEmpty image="/empty.png" v-else />
<ElEmpty :image="emptyImageUrl" v-else />
</div>
</template>

View File

@@ -17,6 +17,7 @@ const props = withDefaults(defineProps<PageDataProps>(), {
pageSizes: () => [10, 20, 50, 100],
extraQueryParams: () => ({}),
});
const emptyImageUrl = `${import.meta.env.BASE_URL || '/'}empty.png`;
// 响应式数据
const pageList = ref([]);
@@ -119,6 +120,6 @@ onMounted(() => {
/>
</div>
</template>
<ElEmpty image="/empty.png" v-else />
<ElEmpty :image="emptyImageUrl" v-else />
</div>
</template>

View File

@@ -12,6 +12,9 @@ import { useAuthStore } from '#/store';
defineOptions({ name: 'Login' });
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
const authStore = useAuthStore();
const assetBase = import.meta.env.BASE_URL || '/';
const captchaAssetBase = `${assetBase}tac`;
const captchaButtonUrl = `${assetBase}tac-btn.png`;
const formSchema = computed((): EasyFlowFormSchema[] => {
return [
@@ -69,11 +72,11 @@ function onSubmit(values: any) {
const style = {
logoUrl: null, // 去除logo
// logoUrl: "/xx/xx/xxx.png" // 替换成自定义的logo
btnUrl: '/tac-btn.png',
btnUrl: captchaButtonUrl,
};
window
// @ts-ignore
.initTAC('/tac', config, style)
.initTAC(captchaAssetBase, config, style)
.then((tac: any) => {
tac.init(); // 调用init则显示验证码
})

View File

@@ -19,6 +19,7 @@ const props = withDefaults(defineProps<ExecResultProps>(), {
showMessage: true,
pollingData: {},
});
const emptyImageUrl = `${import.meta.env.BASE_URL || '/'}empty.png`;
const finalNode = computed(() => {
const nodes = props.nodeJson;
@@ -93,7 +94,7 @@ function getResult(res: any) {
<ShowJson :value="result" />
</div>
<div>
<ElEmpty image="/empty.png" v-if="!result" />
<ElEmpty :image="emptyImageUrl" v-if="!result" />
</div>
</div>
</template>

View File

@@ -16,6 +16,7 @@ const ids = reactive({
const conversationInfo = ref<any>();
const messageList = ref<any[]>([]);
const loading = ref(true);
const logoUrl = `${import.meta.env.BASE_URL || '/'}logo.svg`;
onMounted(() => {
if (route.params.id) {
@@ -80,7 +81,7 @@ function getMessageList() {
</div>
<!-- Right -->
<img src="/logo.svg" class="w-40 max-sm:w-28" />
<img :src="logoUrl" class="w-40 max-sm:w-28" />
</div>
</ElHeader>
<ElMain class="relative max-sm:mt-2 max-sm:!p-0" v-loading="loading">