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