Files
YschcmsFront/src/components/theme/ThemePreviewFrame.vue
T
chenxing 6ee9ab5684
build / build (push) Successful in 2m43s
feat(site-layer): 学校站点分层方案C落地(docs/13)+栏目管理增强+管理端三修复+首页视觉升级管理端+审计复检T1~T5(docs/15)整合批次-URL站点段/site/{siteCode}无component镜像层(去name防重名,router-view跳过推进渲染)+身份条SiteSwitcher自绘(徽章#577afb/#ff9900+分组下拉✓+path次级列+Esc/外点收起)+URL唯一事实源syncSiteFromRoute(非法/跨校/主站码当子站段告警打回同页主站,localStorage降级刷新首帧兜底)+菜单剥段高亮stripSiteSeg/withSiteSeg补段+menuRoute镜像层防重影+跳转收敛adminPathOf(工作台进入/全部站点总览/站点管理行进入管理纯URL切站);栏目管理-上级栏目可选可改(禁选自身及后代防成环)+批量添加BatchAddCategory(行序写排序号单行失败不中断)+单页wangEditor富文本预览字数分区+categoryIds契约前端/types/mock三处统一+SchoolLayout高度链.layout-wrap修复+ArticleListPanel fixed模式;管理端三修复-皮肤预览Modal全屏(ThemePreviewFrame可选fill prop)+SiteManage补themeUnregistered声明+长图文编辑器随内容增高;管理端视觉升级配套-SiteConfigForm 12新键+BannerManage gallery展示位切换+栏目homeStyle下拉+PortalPreview侧栏同步;审计复检-新增siteRouter.spec真实路由集成7用例(镜像层matched3层/守卫子站码定向主站前缀/越权回工作台/旧链带id重定向)+sitePath空白容错+siteLayer持久化round-trip与身份条次级入口(docs/15);vitest 99/99+build通过+S1~S10 GUI走查全过
2026-09-10 11:11:23 +08:00

89 lines
2.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { computed } from "vue";
import { themePreviewUrl } from "@/api/module/cms";
import { FormModelValue } from "@/utils/themeParamForm";
/**
* 主题预览框(方案 §5.5/§6.3):iframe 加载 /api/theme/preview(同源 CAS 会话,
* no-store),参数变更由父级 debounce 后更新 src。内容源站点不存在时提示。
*/
const props = withDefaults(
defineProps<{
/** 预览内容源站点门户路径(W4:sitePath 语义,取该站栏目/文章/轮播渲染) */
sitePath?: string;
theme?: string;
themeParams?: FormModelValue;
/** 填满父容器高度(皮肤包管理全屏预览弹窗);默认固定高,向导/编辑弹窗内不变 */
fill?: boolean;
}>(),
{ fill: false }
);
const src = computed(() => {
if (!props.sitePath || !props.theme) return "";
return themePreviewUrl(props.sitePath, props.theme, props.themeParams || {});
});
</script>
<template>
<div class="theme-preview" :class="{ 'theme-preview--fill': fill }">
<template v-if="!sitePath || !theme">
<div class="preview-empty">
无可用内容源站点 —— 预览需要借用一个已有站点的内容
<p class="hint">请先创建/启用一个站点(或初始化演示数据)后再预览</p>
</div>
</template>
<iframe
v-else
:key="src"
:src="src"
class="preview-frame"
title="主题预览"
/>
</div>
</template>
<style scoped lang="scss">
.theme-preview {
width: 100%;
background: #f0f2f5;
border: 1px solid #e5e6eb;
border-radius: 6px;
overflow: hidden;
}
.preview-frame {
width: 100%;
height: 560px;
border: 0;
display: block;
}
.preview-empty {
height: 200px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #888;
font-size: 13px;
.hint {
margin-top: 6px;
color: #bbb;
font-size: 12px;
}
}
.theme-preview--fill {
height: 100%;
display: flex;
flex-direction: column;
.preview-frame {
height: auto;
flex: 1;
min-height: 420px;
}
.preview-empty {
height: auto;
flex: 1;
}
}
</style>