改造文章管理系统

This commit is contained in:
2024-08-27 07:22:22 +08:00
parent 13832d9de0
commit 31ec8e057a
41 changed files with 4041 additions and 525 deletions

View File

@@ -14,6 +14,8 @@ export interface Article {
showType?: any;
// 文章类型
categoryId?: number;
// 栏目名称
categoryName?: string;
// 封面图
image?: string;
// 附件
@@ -63,6 +65,7 @@ export interface ArticleParam extends PageParam {
title?: string;
articleId?: number;
categoryId?: number;
navigationId?: number;
status?: string;
sortNumber?: string;
createTime?: string;
@@ -72,3 +75,10 @@ export interface ArticleParam extends PageParam {
// 商户编号
merchantCode?: string;
}
export interface ArticleCount {
totalNum?: number;
totalNum2?: number;
totalNum3?: number;
totalNum4?: number;
}

View File

@@ -0,0 +1,106 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { Components, ComponentsParam } from './model';
import { MODULES_API_URL } from '@/config/setting';
/**
* 分页查询组件
*/
export async function pageComponents(params: ComponentsParam) {
const res = await request.get<ApiResult<PageResult<Components>>>(
MODULES_API_URL + '/cms/components/page',
{
params
}
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询组件列表
*/
export async function listComponents(params?: ComponentsParam) {
const res = await request.get<ApiResult<Components[]>>(
MODULES_API_URL + '/cms/components',
{
params
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 添加组件
*/
export async function addComponents(data: Components) {
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/cms/components',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改组件
*/
export async function updateComponents(data: Components) {
const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/cms/components',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 删除组件
*/
export async function removeComponents(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/cms/components/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除组件
*/
export async function removeBatchComponents(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/cms/components/batch',
{
data
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 根据id查询组件
*/
export async function getComponents(id: number) {
const res = await request.get<ApiResult<Components>>(
MODULES_API_URL + '/cms/components/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}

View File

@@ -0,0 +1,43 @@
import type { PageParam } from '@/api';
/**
* 组件
*/
export interface Components {
// ID
id?: number;
// 组件标题
title?: string;
// 关联导航ID
navigationId?: number;
// 组件类型
type?: string;
// 页面关键词
keywords?: string;
// 页面描述
description?: string;
// 组件路径
path?: string;
// 组件图标
icon?: string;
// 用户ID
userId?: number;
// 排序(数字越小越靠前)
sortNumber?: number;
// 备注
comments?: string;
// 状态, 0正常, 1冻结
status?: number;
// 租户id
tenantId?: number;
// 创建时间
createTime?: string;
}
/**
* 组件搜索条件
*/
export interface ComponentsParam extends PageParam {
id?: number;
keywords?: string;
}

View File

@@ -39,6 +39,7 @@ export interface Design {
backgroundColor?: string;
// 关联网站导航ID
navigationId?: number;
buyUrl?: string;
}
/**
@@ -49,4 +50,5 @@ export interface DesignParam extends PageParam {
name?: number;
type?: number;
userId?: number;
navigationId?: number;
}

View File

@@ -0,0 +1,106 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { DesignRecord, DesignRecordParam } from './model';
import { MODULES_API_URL } from '@/config/setting';
/**
* 分页查询页面组件表
*/
export async function pageDesignRecord(params: DesignRecordParam) {
const res = await request.get<ApiResult<PageResult<DesignRecord>>>(
MODULES_API_URL + '/cms/design-record/page',
{
params
}
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询页面组件表列表
*/
export async function listDesignRecord(params?: DesignRecordParam) {
const res = await request.get<ApiResult<DesignRecord[]>>(
MODULES_API_URL + '/cms/design-record',
{
params
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 添加页面组件表
*/
export async function addDesignRecord(data: DesignRecord) {
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/cms/design-record',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改页面组件表
*/
export async function updateDesignRecord(data: DesignRecord) {
const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/cms/design-record',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 删除页面组件表
*/
export async function removeDesignRecord(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/cms/design-record/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除页面组件表
*/
export async function removeBatchDesignRecord(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/cms/design-record/batch',
{
data
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 根据id查询页面组件表
*/
export async function getDesignRecord(id: number) {
const res = await request.get<ApiResult<DesignRecord>>(
MODULES_API_URL + '/cms/design-record/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}

View File

@@ -0,0 +1,45 @@
import type { PageParam } from '@/api';
/**
* 页面组件表
*/
export interface DesignRecord {
// ID
id?: number;
// 关联导航ID
navigationId?: number;
// 组件
title?: string;
// 组件标识
dictCode?: string;
// 组件样式
styles?: string;
// 页面关键词
keywords?: string;
// 页面描述
description?: string;
// 页面路由地址
path?: string;
// 缩列图
photo?: string;
// 用户ID
userId?: number;
// 排序(数字越小越靠前)
sortNumber?: number;
// 备注
comments?: string;
// 状态, 0正常, 1冻结
status?: number;
// 租户id
tenantId?: number;
// 创建时间
createTime?: string;
}
/**
* 页面组件表搜索条件
*/
export interface DesignRecordParam extends PageParam {
id?: number;
keywords?: string;
}

View File

@@ -13,6 +13,8 @@ export interface Navigation {
hide?: number;
home?: number;
position?: number;
top?: number;
bottom?: number;
meta?: string;
children?: Navigation[];
disabled?: boolean;
@@ -39,4 +41,5 @@ export interface NavigationParam {
path?: string;
authority?: string;
parentId?: number;
navigationId?: number;
}

View File

@@ -31,6 +31,7 @@ export interface Website {
icpNo?: string;
policeNo?: string;
comments?: string;
statusText?: string;
sortNumber?: number;
createTime?: string;
disabled?: boolean;

View File

@@ -8,7 +8,7 @@ import { SERVER_API_URL } from '@/config/setting';
*/
export async function pageDictionaryData(params: DictionaryDataParam) {
const res = await request.get<ApiResult<PageResult<DictionaryData>>>(
SERVER_API_URL + '/system/dict-data/page',
SERVER_API_URL + '/system/dictionary-data/page',
{ params }
);
if (res.data.code === 0) {
@@ -22,7 +22,7 @@ export async function pageDictionaryData(params: DictionaryDataParam) {
*/
export async function listDictionaryData(params: DictionaryDataParam) {
const res = await request.get<ApiResult<DictionaryData[]>>(
SERVER_API_URL + '/system/dict-data',
SERVER_API_URL + '/system/dictionary-data',
{ params }
);
if (res.data.code === 0 && res.data.data) {
@@ -36,7 +36,7 @@ export async function listDictionaryData(params: DictionaryDataParam) {
*/
export async function addDictionaryData(data: DictionaryData) {
const res = await request.post<ApiResult<unknown>>(
SERVER_API_URL + '/system/dict-data',
SERVER_API_URL + '/system/dictionary-data',
data
);
if (res.data.code === 0) {
@@ -50,7 +50,7 @@ export async function addDictionaryData(data: DictionaryData) {
*/
export async function updateDictionaryData(data: DictionaryData) {
const res = await request.put<ApiResult<unknown>>(
SERVER_API_URL + '/system/dict-data',
SERVER_API_URL + '/system/dictionary-data',
data
);
if (res.data.code === 0) {
@@ -64,7 +64,7 @@ export async function updateDictionaryData(data: DictionaryData) {
*/
export async function removeDictionaryData(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/dict-data/' + id
SERVER_API_URL + '/system/dictionary-data/' + id
);
if (res.data.code === 0) {
return res.data.message;
@@ -77,7 +77,7 @@ export async function removeDictionaryData(id?: number) {
*/
export async function removeDictionaryDataBatch(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/dict-data/batch',
SERVER_API_URL + '/system/dictionary-data/batch',
{ data }
);
if (res.data.code === 0) {