feat(app): 初始化项目配置和页面结构

- 添加 .dockerignore 和 .env.example 配置文件
- 添加 .gitignore 忽略规则配置
- 创建服务端代理API路由(_file、_modules、_server)
- 集成 Ant Design Vue 组件库并配置SSR样式提取
- 定义API响应类型封装
- 创建基础布局组件(blank、console)
- 实现应用中心页面和组件(AppsCenter)
- 添加文章列表测试页面
- 配置控制台导航菜单结构
- 实现控制台头部组件
- 创建联系页面表单
This commit is contained in:
2026-01-17 18:23:37 +08:00
commit 5e26fdc7fb
439 changed files with 56219 additions and 0 deletions

153
app/api/layout/index.ts Normal file
View File

@@ -0,0 +1,153 @@
import request from '@/utils/request';
import type { ApiResult } from '@/api';
import type { User } from '@/api/system/user/model';
import type { UpdatePasswordParam, NoticeResult } from './model';
import {SERVER_API_URL} from '@/config/setting';
import type { Company } from '@/api/system/company/model';
import type { CmsWebsite } from '@/api/cms/cmsWebsite/model';
import type { Menu } from "@/api/system/menu/model";
/**
* 获取当前登录的用户信息、菜单、权限、角色
*/
export async function getTenantInfo(): Promise<Company> {
const res = await request.get<ApiResult<Company>>(
SERVER_API_URL + '/auth/tenant'
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 获取网站信息 https://cms-api.websoft.top/api
*/
export async function getSiteInfo() {
const res = await request.get<ApiResult<CmsWebsite>>(
'/shop/getShopInfo',
{
params: {}
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 获取当前登录的用户信息、菜单、权限、角色
*/
export async function getUserInfo(): Promise<User> {
const res = await request.get<ApiResult<User>>(SERVER_API_URL + '/auth/user');
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改当前登录用户信息
*/
export async function updateLoginUser(data: User) {
const res = await request.put<ApiResult<unknown>>(
SERVER_API_URL + '/auth/user',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 获取服务器时间(实时)
* @return
*/
export async function getServerTime() {
const res = await request.get<ApiResult<any>>(
'/cms/website/getServerTime'
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 获取未来7天的日期
* @return
*/
export async function getNext7day() {
const res = await request.get<ApiResult<any>>(
'/cms/website/getNext7day'
);
console.log('res.data.code: ', res.data.code);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 向子模块传递token
* @param url
*/
export async function transferToken(url: string): Promise<string> {
const res = await request.get<ApiResult<unknown>>(url);
return Promise.reject(new Error(res.data.message));
}
/**
* 修改当前登录的用户密码
*/
export async function updatePassword(
data: UpdatePasswordParam
): Promise<string> {
const res = await request.put<ApiResult<unknown>>(
SERVER_API_URL + '/auth/password',
data
);
if (res.data.code === 0) {
return res.data.message ?? '修改成功';
}
return Promise.reject(new Error(res.data.message));
}
/**
* 创建完整网站并初始化
*/
export async function createCmsWebSite(data: CmsWebsite){
const res = await request.post<ApiResult<unknown>>(
SERVER_API_URL + '/superAdminRegister',data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 租户初始化
*/
export async function initialization(roleId?: number) {
const res = await request.get<ApiResult<Menu[]>>(
SERVER_API_URL + '/system/tenant/role-menu/' + roleId
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询未读通知
*/
export async function getUnreadNotice(): Promise<NoticeResult> {
return {
notice: [],
letter: [],
todo: []
};
}

View File

@@ -0,0 +1,74 @@
/**
* 首页布局样式
*/
export interface Layout {
// 内容区域的宽度
width?: string;
// 文字颜色
color?: string;
// 高亮颜色
hover?: string;
// 背景颜色
backgroundColor?: string;
headerStyle?: any;
siteNameStyle?: any;
}
/**
* 修改密码参数
*/
export interface UpdatePasswordParam {
// 新密码
password: string;
// 原始密码
oldPassword: string;
}
/**
* 通知数据格式
*/
export interface NoticeModel {
// 图标颜色
color?: string;
// 图标
icon?: string;
// 标题
title?: string;
// 时间
time?: string;
}
/**
* 私信数据格式
*/
export interface LetterModel {
// 头像
avatar?: string;
// 标题
title?: string;
// 内容
content?: string;
// 时间
time?: string;
}
/**
* 代办数据格式
*/
export interface TodoModel {
// 状态
status?: number;
// 标题
title?: string;
// 描述
description?: string;
}
/**
* 查询未读通知返回结果
*/
export interface NoticeResult {
notice: NoticeModel[];
letter: LetterModel[];
todo: TodoModel[];
}