feat(W4): 站点path全链路-portalUrlOf/previewPortalUrl纯函数,站点列/向导地址预览/预览frame sitePath,store携带path,mock嵌套路由,T-W4-16..18 绿51/51

This commit is contained in:
chenxing
2026-09-08 15:14:10 +08:00
parent 7b99ec398d
commit dedd4a6a3a
16 changed files with 297 additions and 37 deletions
+9 -5
View File
@@ -3,7 +3,8 @@ import { computed, onMounted, reactive, ref, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
import { Message } from "view-ui-plus";
import Utils from "@/utils/index";
import { assetUrl, siteApi, themeApi, themePreviewUrl } from "@/api/module/cms";
import { assetUrl, siteApi, themeApi } from "@/api/module/cms";
import { portalUrlOf } from "@/utils/sitePath";
import { useCmsStore } from "@/store";
import config from "@/assets/config/host.config";
import { SiteVo, ThemeVo } from "@/types/cms";
@@ -84,7 +85,7 @@ const columns = [
]);
},
},
{ title: "门户路径", key: "portalPath", minWidth: 200, tooltip: true, render: (h: any, p: any) => h("span", `/portal/${p.row.code}/`) },
{ title: "门户路径", key: "portalPath", minWidth: 200, tooltip: true, render: (h: any, p: any) => h("span", portalUrlOf(p.row)) },
{
title: "状态",
key: "status",
@@ -175,6 +176,8 @@ async function loadThemes() {
}
}
const editSitePath = ref<string>("");
function openWizard() {
wizardVisible.value = true;
}
@@ -184,6 +187,7 @@ function onWizardCreated() {
}
function openEdit(row: SiteVo) {
editSitePath.value = row.path || row.code;
Object.assign(form, {
id: row.id,
code: row.code,
@@ -264,7 +268,7 @@ async function save() {
}
function openPortal(row: SiteVo) {
window.open(`${config.serviceHost}/portal/${row.code}/`, "_blank");
window.open(`${config.serviceHost}${portalUrlOf(row)}`, "_blank");
}
/** 行级「进入管理」(docs/09 §3.3 子站管理入口):切当前操作站点后落文章列表;
@@ -287,7 +291,7 @@ function enterManage(row: SiteVo) {
rows.value.filter(s => s.id === main.id || s.parentSiteId === main.id)
);
}
store.setCurrentSite({ id: row.id, code: row.code, name: row.name });
store.setCurrentSite({ id: row.id, code: row.code, path: row.path || row.code, name: row.name });
router.push(`/sch/${main.code}/article`);
}
@@ -387,7 +391,7 @@ watch(() => store.currentSchool?.schId, () => run());
<!-- 编辑预览弹窗(iframe 加载 /api/theme/preview,no-store) -->
<Modal v-model="previewVisible" title="皮肤预览" :mask-closable="true" width="980px" footer-hide>
<ThemePreviewFrame v-if="previewVisible && editTheme" :site-code="form.code" :theme="form.theme" :theme-params="editThemeParams" />
<ThemePreviewFrame v-if="previewVisible && editTheme" :site-path="editSitePath" :theme="form.theme" :theme-params="editThemeParams" />
</Modal>
<!-- 新建站点三步向导(B1:校级锁定为本校主站下建院系子站) -->