- index.html 插 A 类 loader:唯一接入点,FOUC 门/manifest 预取/主题 link 追加与排序 全由通道 yh-theme-init.js 承担,主题升级走 /static 通道,本应用无需重新构建 - vite.config 加 /static dev 代理(YH_THEME_PROXY_TARGET 可覆盖,默认线上通道) - host.config 回写 __APP_CONFIG__.serviceHost(仅同源):init 的 appearance 请求有硬性 同源限制,跨源会被直接跳过;本地 dev 保持空串走同源 /api 代理 - 顶栏头像接平台键 yh-avatar,监听 yh-appearance-updated,userInfo 兜底 - view-ui-plus 声明锁 1.3.24(对齐通道皮肤生成版本)
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
* 点一下就等于发出一句完整请求
|
||||
* 3. 使用提示 —— 常驻说明"信息不全也没关系",降低首次使用门槛
|
||||
*/
|
||||
import { computed, ref } from "vue";
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from "vue";
|
||||
import { Message } from "view-ui-plus";
|
||||
import { baseApi } from "@/api/module/agent";
|
||||
import conf from "@/assets/config/host.config";
|
||||
@@ -23,6 +23,25 @@ const emit = defineEmits<{
|
||||
(e: "new-session"): void;
|
||||
}>();
|
||||
|
||||
/* 头像:平台键 yh-avatar(yh-theme-init 外观补齐段写入)优先,本仓用户信息兜底;
|
||||
监听平台事件重读,不轮询、不手写清理(清键归 init,规范 §3) */
|
||||
const yhAvatar = ref("");
|
||||
const readYhAvatar = () => {
|
||||
let v: string | null = null;
|
||||
try {
|
||||
v = localStorage.getItem("yh-avatar");
|
||||
} catch {
|
||||
v = null;
|
||||
}
|
||||
yhAvatar.value = v || "";
|
||||
};
|
||||
onMounted(() => {
|
||||
readYhAvatar();
|
||||
document.addEventListener("yh-appearance-updated", readYhAvatar);
|
||||
});
|
||||
onBeforeUnmount(() => document.removeEventListener("yh-appearance-updated", readYhAvatar));
|
||||
const avatarUrl = computed(() => yhAvatar.value || props.user?.profilePicture || "");
|
||||
|
||||
/**
|
||||
* 退出登录(同时也是"换个账号登录"的唯一入口)。
|
||||
*
|
||||
@@ -196,7 +215,7 @@ function pick(m: { key: string; sample: string }) {
|
||||
<p>写操作提交前可核对,确认无误再提交。</p>
|
||||
</div>
|
||||
<div class="sb__user">
|
||||
<Avatar :src="user?.profilePicture" size="small" class="sb__avatar">
|
||||
<Avatar :src="avatarUrl" size="small" class="sb__avatar">
|
||||
{{ (user?.name || "访").slice(0, 1) }}
|
||||
</Avatar>
|
||||
<span class="sb__user-text">
|
||||
|
||||
Reference in New Issue
Block a user