feat(site): 重构网站信息模块并添加应用信息相关功能
- 新增 AppInfo 接口,用于存储应用信息 - 修改 getSiteInfo API 调用路径 - 更新 site store 中的数据结构和相关方法,支持应用信息- 调整 dashboard 页面中显示的网站信息,改为应用信息
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import type { PageParam } from '@/api';
|
import type { PageParam } from '@/api';
|
||||||
import {CmsWebsiteSetting} from "@/api/cms/cmsWebsiteSetting/model";
|
import {CmsWebsiteSetting} from "@/api/cms/cmsWebsiteSetting/model";
|
||||||
|
import {CmsNavigation} from "@/api/cms/cmsNavigation/model";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 网站信息记录表
|
* 网站信息记录表
|
||||||
@@ -121,6 +122,33 @@ export interface CmsWebsite {
|
|||||||
setting?: CmsWebsiteSetting;
|
setting?: CmsWebsiteSetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface AppInfo {
|
||||||
|
appId?: number;
|
||||||
|
appName?: string;
|
||||||
|
description?: string;
|
||||||
|
keywords?: string;
|
||||||
|
appCode?: string;
|
||||||
|
mpQrCode?: string;
|
||||||
|
title?: string;
|
||||||
|
logo?: string;
|
||||||
|
icon?: string;
|
||||||
|
domain?: string;
|
||||||
|
running?: number;
|
||||||
|
version?: number;
|
||||||
|
expirationTime?: string;
|
||||||
|
expired?: boolean;
|
||||||
|
expiredDays?: number;
|
||||||
|
soon?: number;
|
||||||
|
statusIcon?: string;
|
||||||
|
statusText?: string;
|
||||||
|
config?: Object;
|
||||||
|
serverTime?: Object;
|
||||||
|
topNavs?: CmsNavigation[];
|
||||||
|
bottomNavs?: CmsNavigation[];
|
||||||
|
setting?: Object;
|
||||||
|
createTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 网站信息记录表搜索条件
|
* 网站信息记录表搜索条件
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export async function getTenantInfo(): Promise<Company> {
|
|||||||
*/
|
*/
|
||||||
export async function getSiteInfo() {
|
export async function getSiteInfo() {
|
||||||
const res = await request.get<ApiResult<CmsWebsite>>(
|
const res = await request.get<ApiResult<CmsWebsite>>(
|
||||||
MODULES_API_URL + '/cms/cms-website/getSiteInfo',
|
MODULES_API_URL + '/cms/getSiteInfo',
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
lang: getLang()
|
lang: getLang()
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
* 网站信息 store
|
* 应用信息 store
|
||||||
*/
|
*/
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { getSiteInfo } from '@/api/layout';
|
import { getSiteInfo } from '@/api/layout';
|
||||||
import { CmsWebsite } from '@/api/cms/cmsWebsite/model';
|
import {AppInfo, CmsWebsite} from '@/api/cms/cmsWebsite/model';
|
||||||
|
|
||||||
export interface SiteState {
|
export interface SiteState {
|
||||||
// 网站信息
|
// 应用信息
|
||||||
siteInfo: CmsWebsite | null;
|
siteInfo: AppInfo | null;
|
||||||
// 加载状态
|
// 加载状态
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
// 最后更新时间
|
// 最后更新时间
|
||||||
@@ -28,45 +28,65 @@ export const useSiteStore = defineStore({
|
|||||||
|
|
||||||
getters: {
|
getters: {
|
||||||
/**
|
/**
|
||||||
* 获取网站名称
|
* 获取应用ID
|
||||||
*/
|
*/
|
||||||
websiteName: (state): string => {
|
appId: (state): number | undefined => {
|
||||||
return state.siteInfo?.websiteName || '';
|
return state.siteInfo?.appId;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取应用名称
|
||||||
|
*/
|
||||||
|
appName: (state): string => {
|
||||||
|
return state.siteInfo?.appName || '';
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取网站Logo
|
* 获取应用Logo
|
||||||
*/
|
*/
|
||||||
websiteLogo: (state): string => {
|
logo: (state): string => {
|
||||||
return state.siteInfo?.websiteLogo || '/logo.png';
|
return state.siteInfo?.logo || '/logo.png';
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取网站描述
|
* 获取应用描述
|
||||||
*/
|
*/
|
||||||
websiteComments: (state): string => {
|
description: (state): string => {
|
||||||
return state.siteInfo?.comments || '';
|
return state.siteInfo?.description || '';
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取小程序码
|
* 获取小程序码
|
||||||
*/
|
*/
|
||||||
websiteDarkLogo: (state): string => {
|
mpQrCode: (state): string => {
|
||||||
return state.siteInfo?.websiteDarkLogo || '';
|
return state.siteInfo?.mpQrCode || '';
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取网站域名
|
* 获取应用域名
|
||||||
*/
|
*/
|
||||||
websiteDomain: (state): string => {
|
domain: (state): string => {
|
||||||
return state.siteInfo?.domain || '';
|
return state.siteInfo?.domain || '';
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取网站ID
|
* 获取应用版本
|
||||||
|
* @param state
|
||||||
*/
|
*/
|
||||||
websiteId: (state): number | undefined => {
|
version: (state): string => {
|
||||||
return state.siteInfo?.websiteId;
|
if(state.siteInfo?.version == 10){
|
||||||
|
return '基础版'
|
||||||
|
}
|
||||||
|
if(state.siteInfo?.version == 20){
|
||||||
|
return '专业版'
|
||||||
|
}
|
||||||
|
if(state.siteInfo?.version == 30){
|
||||||
|
return '企业版'
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
|
||||||
|
statusText: (state): string => {
|
||||||
|
return state.siteInfo?.statusText || '';
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,7 +111,7 @@ export const useSiteStore = defineStore({
|
|||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
/**
|
/**
|
||||||
* 获取网站信息
|
* 获取应用信息
|
||||||
* @param forceRefresh 是否强制刷新
|
* @param forceRefresh 是否强制刷新
|
||||||
*/
|
*/
|
||||||
async fetchSiteInfo(forceRefresh = false) {
|
async fetchSiteInfo(forceRefresh = false) {
|
||||||
@@ -117,7 +137,7 @@ export const useSiteStore = defineStore({
|
|||||||
|
|
||||||
return data;
|
return data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取网站信息失败:', error);
|
console.error('获取应用信息失败:', error);
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
@@ -125,7 +145,7 @@ export const useSiteStore = defineStore({
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新网站信息
|
* 更新应用信息
|
||||||
*/
|
*/
|
||||||
updateSiteInfo(siteInfo: Partial<CmsWebsite>) {
|
updateSiteInfo(siteInfo: Partial<CmsWebsite>) {
|
||||||
if (this.siteInfo) {
|
if (this.siteInfo) {
|
||||||
|
|||||||
@@ -11,20 +11,20 @@
|
|||||||
:height="80"
|
:height="80"
|
||||||
:preview="false"
|
:preview="false"
|
||||||
style="border-radius: 8px"
|
style="border-radius: 8px"
|
||||||
:src="siteStore.websiteLogo"
|
:src="siteStore.logo"
|
||||||
fallback="/logo.png"
|
fallback="/logo.png"
|
||||||
/>
|
/>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="14">
|
<a-col :span="14">
|
||||||
<div class="system-info">
|
<div class="system-info">
|
||||||
<h2 class="ele-text-heading">{{ siteStore.websiteName }}</h2>
|
<h2 class="ele-text-heading">{{ siteStore.appName }}</h2>
|
||||||
<p class="ele-text-secondary">{{ siteStore.websiteComments }}</p>
|
<p class="ele-text-secondary">{{ siteStore.description }}</p>
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-tag color="blue">版本 {{ systemInfo.version }}</a-tag>
|
<a-tag color="blue">{{ siteStore.version }}</a-tag>
|
||||||
<a-tag color="green">{{ systemInfo.status }}</a-tag>
|
<a-tag color="green">{{ siteStore.statusText }}</a-tag>
|
||||||
<a-popover title="小程序码">
|
<a-popover title="小程序码">
|
||||||
<template #content>
|
<template #content>
|
||||||
<p><img :src="siteStore.websiteDarkLogo" alt="小程序码" width="300" height="300"></p>
|
<p><img :src="siteStore.mpQrCode" alt="小程序码" width="300" height="300"></p>
|
||||||
</template>
|
</template>
|
||||||
<a-tag>
|
<a-tag>
|
||||||
<QrcodeOutlined/>
|
<QrcodeOutlined/>
|
||||||
|
|||||||
@@ -11,20 +11,20 @@
|
|||||||
:height="80"
|
:height="80"
|
||||||
:preview="false"
|
:preview="false"
|
||||||
style="border-radius: 8px"
|
style="border-radius: 8px"
|
||||||
:src="siteStore.websiteLogo"
|
:src="siteStore.logo"
|
||||||
fallback="/logo.png"
|
fallback="/logo.png"
|
||||||
/>
|
/>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="14">
|
<a-col :span="14">
|
||||||
<div class="system-info">
|
<div class="system-info">
|
||||||
<h2 class="ele-text-heading">{{ siteStore.websiteName }}</h2>
|
<h2 class="ele-text-heading">{{ siteStore.appName }}</h2>
|
||||||
<p class="ele-text-secondary">{{ siteStore.websiteComments }}</p>
|
<p class="ele-text-secondary">{{ siteStore.description }}</p>
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-tag color="blue">版本 {{ systemInfo.version }}</a-tag>
|
<a-tag color="blue">{{ siteStore.version }}</a-tag>
|
||||||
<a-tag color="green">{{ systemInfo.status }}</a-tag>
|
<a-tag color="green">{{ siteStore.statusText }}</a-tag>
|
||||||
<a-popover title="小程序码">
|
<a-popover title="小程序码">
|
||||||
<template #content>
|
<template #content>
|
||||||
<p><img :src="siteStore.websiteDarkLogo" alt="小程序码" width="300" height="300"></p>
|
<p><img :src="siteStore.mpQrCode" alt="小程序码" width="300" height="300"></p>
|
||||||
</template>
|
</template>
|
||||||
<a-tag>
|
<a-tag>
|
||||||
<QrcodeOutlined/>
|
<QrcodeOutlined/>
|
||||||
|
|||||||
Reference in New Issue
Block a user