优化网站导航模块

This commit is contained in:
2024-08-23 22:28:24 +08:00
parent 1d81fa9270
commit 13832d9de0
964 changed files with 90774 additions and 31362 deletions
+16
View File
@@ -1,4 +1,5 @@
import { isNumber } from 'ele-admin-pro';
import { listWebsite } from '@/api/cms/website';
// 解析域名结构
export function getHost(): any {
@@ -104,3 +105,18 @@ export function getProductCode(): string | null {
export function navSubDomain(path): string {
return `${window.location.protocol}//${path}.${getRootDomain()}`;
}
// 获取网站域名(推荐使用)
export function getSiteDomain(): string {
const siteDomain = localStorage.getItem('Domain');
if (!siteDomain) {
listWebsite({ limit: 1 }).then((list) => {
if (list.length > 0) {
const d = list[0];
localStorage.setItem('Domain', `${d.prefix}${d.domain}`);
return `${d.prefix}${d.domain}`;
}
});
}
return `${localStorage.getItem('Domain')}`;
}