优化网站导航模块
This commit is contained in:
@@ -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')}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user