This commit is contained in:
2024-10-23 21:10:25 +08:00
commit a9c9bfb2d3
238 changed files with 49119 additions and 0 deletions

43
mock/auth.mock.ts Normal file
View File

@ -0,0 +1,43 @@
import { defineMock } from "./base";
export default defineMock([
{
url: "auth/captcha",
method: ["GET"],
body: {
code: "00000",
data: {
captchaKey: "534b8ef2b0a24121bec76391ddd159f9",
captchaBase64:
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAkCAIAAADNSmkJAAAFKUlEQVR4Xu2ZXUwcVRiGV70wMWo08V5NvPXCrDbFaGpMaZW2hqQxaoiJTRsaMBCNSYtpa2JTKiFSelFa+Q/QZcMWqEhBlh+htbEpZhMrBQrlJ0hBywLLyrJ0WZbje3bqOvPNLHPWrDvdOE9ONmfe78zkzMs335wzWJhJQrBQweS/wTQ6QWgYHdoIOcecOe05O+t2WkutO+p2ZF3Ksg/YV9ZW6FATYajR3nveg60H9327r3O8c35lHgp+r05dPdJzBL73TPSQ8SaCKIxGLsPlop+K0JHrEkPuoT31e5qGmmjARACF0agYyGVNlyVm/pzZXrN9fHGcBkz0UBid+31u93i3XFFT80vN8cvHqWqih8Lo1NpUqS5vwh3vnd223VQ10UNh9NbyrcFQUK6oCawHUipSqGqiB83oBf+CXFGDMp1mS6OqiR4Ko7FexkpOrqhpHGw82nOUqiZ6KIzGrkRuorW0dJMmOy+hOCfYGzb2RBFv6HRO0gEJw/U7y+pgL1bwmTxexN6sZ31TdEwEhdG+gA+7EqyXpUO1uZH20cWL8hMTRt1N9tBXzCJrOIRoCPJpSO2RAp4HmtCdIfZ+2JWgEBN9LbR28seTGU0Zue1tMLp+YIAMSADzfvbkKX4/eb28j4YODiGin3heqmIlLja5hAUCu+nmGY3JWKvpMAlqNGgebsauBOvlqSX+JEx7p7EbTLen53XlzfmWUioqXikrc68Y8N2juJ/fyVsNChGHEE//rBANYWaZz+TRQqpLaBgNsPfDrgSpbS21YtV87IdjrlkX9JZbt5DOma2t9ITo5F+5glN22WwL/n+yDv00mw06orKxOqQ5+J04hhViwzAXETIcJDVm8uxZqktoGx2Nj9t43Wgaul/ERQiGQvtbWnDWgZYW9CXlQFjZ/7ciyHNn+Z2MexTimIeLz59TiIln0M1e+IbPpOAaDUnEYPTi6iqKxpbycs/qKo1tCslfKcffPn9enuMiPPY1vxO/ckeFQ4h46cdGqUWoidE/y54q5tPY5WDrGzQqIXot4BgchEE57e00IMCw2/1qZSVO/7SjA78o9INzcxsbrL+fnTnDDh9mmZn8F30oG1Hm+nABv5mQMopDS/h1HxtqTzWbABMe9sxpPoe9zezeOo1GELqWhPS8t46M0IAYHbdvR1aHbaOjbjfLz2eFhez6dba4yAfgF30o0BFVE8+Mjh/wFxPI+I5mAEHU6Ls+38vhTFwOBGhMDF8gkFpbC5ffsdv/uBs6dIj19dExEtARVXv9YNbop8NFY3aZ6gRRo+tu3IBHnzmdNCBMXldXJKPfL74WzWUJRE+coDUknqsOdZXQbAJYwluVTbOZI3Qt8GFzMwxyjo3RgBiN4fr+elXVpZGRLWXl6PdOTtJBSlBDUK/lnIrjOlrtqWYTQDJaF6FrTXu9sOa1ysrVoM5HVE1GFxZQcyJ/p+xzv6K/rbr6N6+XDpUBl0tKFIrbz78qWB6YnWFMCBld4XLBms+7df75ook/GNzb0GCV7U1Qfz9p64TyQWNjYD3qe9rj4SMJtQP3MyjSDPzWIRHPjH7X4YAvfXoPuyZf9Pbi3PcuXIh4mp3NllYC6XY79C+jl2o8PBipxjnBttn4MgMNnWgfcRJGPI2OL8hTj3LloIlmRicvBhiNykvecpqoa3RSY4DRcLAwyicuOepVR1JjgNFYHWONHL04czTX0UmNAUYD7Pr+xc4wqTHGaBb2OtZvHUmNYUazcA2J6etdUmOk0f8rTKMTxF91RG0D1SwYGwAAAABJRU5ErkJggg==",
},
msg: "一切ok",
},
},
{
url: "auth/login",
method: ["POST"],
body: {
code: "00000",
data: {
accessToken:
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImRlcHRJZCI6MSwiZGF0YVNjb3BlIjoxLCJ1c2VySWQiOjIsImlhdCI6MTcyODE5MzA1MiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9BRE1JTiJdLCJqdGkiOiJhZDg3NzlhZDZlYWY0OWY3OTE4M2ZmYmI5OWM4MjExMSJ9.58YHwL3sNNC22jyAmOZeSm-7MITzfHb_epBIz7LvWeA",
tokenType: "Bearer",
refreshToken: null,
expires: null,
},
msg: "一切ok",
},
},
{
url: "auth/logout",
method: ["DELETE"],
body: {
code: "00000",
data: {},
msg: "string",
},
},
]);

10
mock/base.ts Normal file
View File

@ -0,0 +1,10 @@
import path from "path";
import { createDefineMock } from "vite-plugin-mock-dev-server";
export const defineMock = createDefineMock((mock) => {
// 拼接url
mock.url = path.join(
import.meta.env.VITE_APP_BASE_API + "/api/v1/",
mock.url
);
});

153
mock/dept.mock.ts Normal file
View File

@ -0,0 +1,153 @@
import { defineMock } from "./base";
export default defineMock([
{
url: "dept/options",
method: ["GET"],
body: {
code: "00000",
data: [
{
value: 1,
label: "有来技术",
children: [
{
value: 2,
label: "研发部门",
},
{
value: 3,
label: "测试部门",
},
],
},
],
msg: "一切ok",
},
},
{
url: "dept",
method: ["GET"],
body: {
code: "00000",
data: [
{
id: 1,
parentId: 0,
name: "有来技术",
code: "YOULAI",
sort: 1,
status: 1,
children: [
{
id: 2,
parentId: 1,
name: "研发部门",
code: "RD001",
sort: 1,
status: 1,
children: [],
createTime: null,
updateTime: "2022-04-19 12:46",
},
{
id: 3,
parentId: 1,
name: "测试部门",
code: "QA001",
sort: 1,
status: 1,
children: [],
createTime: null,
updateTime: "2022-04-19 12:46",
},
],
createTime: null,
updateTime: null,
},
],
msg: "一切ok",
},
},
// 新增部门
{
url: "dept",
method: ["POST"],
body({ body }) {
return {
code: "00000",
data: null,
msg: "新增部门" + body.name + "成功",
};
},
},
// 获取部门表单数据
{
url: "dept/:id/form",
method: ["GET"],
body: ({ params }) => {
return {
code: "00000",
data: deptMap[params.id],
msg: "一切ok",
};
},
},
// 修改部门
{
url: "dept/:id",
method: ["PUT"],
body({ body }) {
return {
code: "00000",
data: null,
msg: "修改部门" + body.name + "成功",
};
},
},
// 删除部门
{
url: "dept/:id",
method: ["DELETE"],
body({ params }) {
return {
code: "00000",
data: null,
msg: "删除部门" + params.id + "成功",
};
},
},
]);
// 部门映射表数据
const deptMap: Record<string, any> = {
1: {
id: 1,
name: "有来技术",
code: "YOULAI",
parentId: 0,
status: 1,
sort: 1,
},
2: {
id: 2,
name: "研发部门",
code: "RD001",
parentId: 1,
status: 1,
sort: 1,
},
3: {
id: 3,
name: "测试部门",
code: "QA001",
parentId: 1,
status: 1,
sort: 1,
},
};

216
mock/dict-data.mock.ts Normal file
View File

@ -0,0 +1,216 @@
import { defineMock } from "./base";
export default defineMock([
{
url: "dict-data/page",
method: ["GET"],
body: {
code: "00000",
data: {
list: [
{
id: 1,
dictCode: "gender",
label: "男",
value: "1",
sort: 1,
status: 1,
},
{
id: 2,
dictCode: "gender",
label: "女",
value: "2",
sort: 2,
status: 1,
},
{
id: 3,
dictCode: "gender",
label: "保密",
value: "0",
sort: 3,
status: 1,
},
],
total: 3,
},
msg: "一切ok",
},
},
{
url: "dict-data/:dictCode/options",
method: ["GET"],
body: ({ params }) => {
const dictCode = params.dictCode;
let list = null;
if (dictCode == "gender") {
list = [
{
value: "1",
label: "男",
},
{
value: "2",
label: "女",
},
{
value: "0",
label: "保密",
},
];
} else if (dictCode == "notice_level") {
list = [
{
value: "L",
label: "低",
tag: "info",
},
{
value: "M",
label: "中",
tag: "warning",
},
{
value: "H",
label: "高",
tag: "danger",
},
];
} else if (dictCode == "notice_type") {
list = [
{
value: "1",
label: "系统升级",
tag: "success",
},
{
value: "2",
label: "系统维护",
tag: "primary",
},
{
value: "3",
label: "安全警告",
tag: "danger",
},
{
value: "4",
label: "假期通知",
tag: "success",
},
{
value: "5",
label: "公司新闻",
tag: "primary",
},
{
value: "99",
label: "其他",
tag: "info",
},
];
}
return {
code: "00000",
data: list,
msg: "一切ok",
};
},
},
// 新增字典数据
{
url: "dict-data",
method: ["POST"],
body({ body }) {
return {
code: "00000",
data: null,
msg: "新增字典" + body.name + "成功",
};
},
},
// 获取字典数据表单
{
url: "dict-data/:id/form",
method: ["GET"],
body: ({ params }) => {
return {
code: "00000",
data: dictMap[params.id],
msg: "一切ok",
};
},
},
// 修改字典数据
{
url: "dict-data/:id",
method: ["PUT"],
body({ body }) {
return {
code: "00000",
data: null,
msg: "修改字典数据" + body.name + "成功",
};
},
},
// 删除字典
{
url: "dict-data/:id",
method: ["DELETE"],
body({ params }) {
return {
code: "00000",
data: null,
msg: "删除字典" + params.id + "成功",
};
},
},
]);
// 字典数据映射表数据
const dictMap: Record<string, any> = {
1: {
code: "00000",
data: {
id: 1,
value: "1",
label: "男",
sort: 1,
status: 1,
tagType: "primary",
},
msg: "一切ok",
},
2: {
code: "00000",
data: {
id: 2,
value: "2",
label: "女",
sort: 2,
status: 1,
tagType: "danger",
},
msg: "一切ok",
},
3: {
code: "00000",
data: {
id: 3,
value: "0",
label: "保密",
sort: 3,
status: 1,
tagType: "info",
},
msg: "一切ok",
},
};

181
mock/dict.mock.ts Normal file
View File

@ -0,0 +1,181 @@
import { defineMock } from "./base";
export default defineMock([
{
url: "dict/page",
method: ["GET"],
body: {
code: "00000",
data: {
list: [
{
id: 1,
name: "性别",
dictCode: "gender",
status: 1,
},
],
total: 1,
},
msg: "一切ok",
},
},
// 新增字典
{
url: "dict",
method: ["POST"],
body({ body }) {
return {
code: "00000",
data: null,
msg: "新增字典" + body.name + "成功",
};
},
},
// 获取字典表单数据
{
url: "dict/:id/form",
method: ["GET"],
body: ({ params }) => {
return {
code: "00000",
data: dictMap[params.id],
msg: "一切ok",
};
},
},
// 修改字典
{
url: "dict/:id",
method: ["PUT"],
body({ body }) {
return {
code: "00000",
data: null,
msg: "修改字典" + body.name + "成功",
};
},
},
// 删除字典
{
url: "dict/:id",
method: ["DELETE"],
body({ params }) {
return {
code: "00000",
data: null,
msg: "删除字典" + params.id + "成功",
};
},
},
// 所有字典列表
{
url: "dict/list",
method: ["GET"],
body() {
return {
code: "00000",
data: [
{
name: "通知级别",
dictCode: "notice_level",
dictDataList: [
{
value: "L",
label: "低",
tagType: "info",
},
{
value: "M",
label: "中",
tagType: "warning",
},
{
value: "H",
label: "高",
tagType: "danger",
},
],
},
{
name: "通知类型",
dictCode: "notice_type",
dictDataList: [
{
value: "1",
label: "系统升级",
tagType: "success",
},
{
value: "2",
label: "系统维护",
tagType: "primary",
},
{
value: "3",
label: "安全警告",
tagType: "danger",
},
{
value: "4",
label: "假期通知",
tagType: "success",
},
{
value: "5",
label: "公司新闻",
tagType: "primary",
},
{
value: "99",
label: "其他",
tagType: "info",
},
],
},
{
name: "性别",
dictCode: "gender",
dictDataList: [
{
value: "1",
label: "男",
tagType: "primary",
},
{
value: "2",
label: "女",
tagType: "danger",
},
{
value: "0",
label: "保密",
tagType: "info",
},
],
},
],
msg: "一切ok",
};
},
},
]);
// 字典映射表数据
const dictMap: Record<string, any> = {
1: {
code: "00000",
data: {
id: 1,
name: "性别",
dictCode: "gender",
status: 1,
},
msg: "一切ok",
},
};

225
mock/log.mock.ts Normal file
View File

@ -0,0 +1,225 @@
import { defineMock } from "./base";
export default defineMock([
{
url: "logs/page",
method: ["GET"],
body: {
code: "00000",
data: {
list: [
{
id: 36192,
module: "菜单",
content: "菜单列表",
requestUri: "/api/v1/menus",
method: null,
ip: "183.156.148.241",
region: "浙江省 杭州市",
browser: "Chrome 109.0.0.0",
os: "OSX",
executionTime: 5,
createBy: null,
createTime: "2024-07-07 20:38:47",
operator: "系统管理员",
},
{
id: 36190,
module: "字典",
content: "字典分页列表",
requestUri: "/api/v1/dict/page",
method: null,
ip: "183.156.148.241",
region: "浙江省 杭州市",
browser: "Chrome 109.0.0.0",
os: "OSX",
executionTime: 9,
createBy: null,
createTime: "2024-07-07 20:38:45",
operator: "系统管理员",
},
{
id: 36193,
module: "部门",
content: "部门列表",
requestUri: "/api/v1/dept",
method: null,
ip: "192.168.31.134",
region: "0 内网IP",
browser: "Chrome 125.0.0.0",
os: "Windows 10 or Windows Server 2016",
executionTime: 27,
createBy: null,
createTime: "2024-07-07 20:38:45",
operator: "系统管理员",
},
{
id: 36191,
module: "菜单",
content: "菜单列表",
requestUri: "/api/v1/menus",
method: null,
ip: "192.168.31.134",
region: "0 内网IP",
browser: "Chrome 125.0.0.0",
os: "Windows 10 or Windows Server 2016",
executionTime: 39,
createBy: null,
createTime: "2024-07-07 20:38:44",
operator: "系统管理员",
},
{
id: 36189,
module: "角色",
content: "角色分页列表",
requestUri: "/api/v1/roles/page",
method: null,
ip: "192.168.31.134",
region: "0 内网IP",
browser: "Chrome 125.0.0.0",
os: "Windows 10 or Windows Server 2016",
executionTime: 55,
createBy: null,
createTime: "2024-07-07 20:38:43",
operator: "系统管理员",
},
{
id: 36188,
module: "用户",
content: "用户分页列表",
requestUri: "/api/v1/users/page",
method: null,
ip: "192.168.31.134",
region: "0 内网IP",
browser: "Chrome 125.0.0.0",
os: "Windows 10 or Windows Server 2016",
executionTime: 92,
createBy: null,
createTime: "2024-07-07 20:38:42",
operator: "系统管理员",
},
{
id: 36187,
module: "登录",
content: "登录",
requestUri: "/api/v1/auth/login",
method: null,
ip: "192.168.31.134",
region: "0 内网IP",
browser: "Chrome 125.0.0.0",
os: "Windows 10 or Windows Server 2016",
executionTime: 19340,
createBy: null,
createTime: "2024-07-07 20:38:09",
operator: "系统管理员",
},
{
id: 36186,
module: "登录",
content: "登录",
requestUri: "/api/v1/auth/login",
method: null,
ip: "192.168.31.134",
region: "0 内网IP",
browser: "Chrome 125.0.0.0",
os: "Windows 10 or Windows Server 2016",
executionTime: 19869,
createBy: null,
createTime: "2024-07-07 20:37:59",
operator: "系统管理员",
},
{
id: 36185,
module: "登录",
content: "登录",
requestUri: "/api/v1/auth/login",
method: null,
ip: "112.103.111.59",
region: "黑龙江省 哈尔滨市",
browser: "Chrome 97.0.4692.98",
os: "Android",
executionTime: 96,
createBy: null,
createTime: "2024-07-07 20:37:21",
operator: "系统管理员",
},
{
id: 36184,
module: "登录",
content: "登录",
requestUri: "/api/v1/auth/login",
method: null,
ip: "114.86.204.190",
region: "上海 上海市",
browser: "Chrome 125.0.0.0",
os: "Windows 10 or Windows Server 2016",
executionTime: 89,
createBy: null,
createTime: "2024-07-07 20:29:37",
operator: "系统管理员",
},
],
total: 36188,
},
msg: "一切ok",
},
},
{
url: "logs/visit-trend",
method: ["GET"],
body: {
code: "00000",
data: {
dates: [
"2024-06-30",
"2024-07-01",
"2024-07-02",
"2024-07-03",
"2024-07-04",
"2024-07-05",
"2024-07-06",
"2024-07-07",
],
pvList: [1751, 5168, 4882, 5301, 4721, 4885, 1901, 1003],
uvList: null,
ipList: [207, 566, 565, 631, 579, 496, 222, 152],
},
msg: "一切ok",
},
},
{
url: "logs/visit-stats",
method: ["GET"],
body: {
code: "00000",
data: [
{
type: "pv",
title: "浏览量",
todayCount: 1003,
totalCount: 36193,
growthRate: -0.35,
granularityLabel: "日",
},
{
type: "uv",
title: "访客数",
todayCount: 100,
totalCount: 2000,
growthRate: 0,
granularityLabel: "日",
},
{
type: "ip",
title: "IP数",
todayCount: 152,
totalCount: 3234,
growthRate: -0.2,
granularityLabel: "日",
},
],
msg: "一切ok",
},
},
]);

1711
mock/menu.mock.ts Normal file

File diff suppressed because it is too large Load Diff

419
mock/notice.mock.ts Normal file
View File

@ -0,0 +1,419 @@
import { defineMock } from "./base";
export default defineMock([
{
url: "notices/page",
method: ["GET"],
body: {
code: "00000",
data: {
list: [
{
id: 1,
title: "v2.12.0 新增系统日志,访问趋势统计功能。",
publishStatus: 1,
type: 1,
publisherName: "系统管理员",
level: "L",
publishTime: "2024-09-30 17:21",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
{
id: 2,
title: "v2.13.0 新增菜单搜索。",
publishStatus: 1,
type: 1,
publisherName: "系统管理员",
level: "L",
publishTime: "2024-09-30 17:22",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
{
id: 3,
title: "\r\nv2.14.0 新增个人中心。",
publishStatus: 1,
type: 1,
publisherName: "系统管理员",
level: "L",
publishTime: "2024-09-30 17:23",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
{
id: 4,
title: "v2.15.0 登录页面改造。",
publishStatus: 1,
type: 1,
publisherName: "系统管理员",
level: "L",
publishTime: "2024-09-30 17:24",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
{
id: 5,
title: "v2.16.0 通知公告、字典翻译组件。",
publishStatus: 1,
type: 1,
publisherName: "系统管理员",
level: "L",
publishTime: "2024-09-30 17:25",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
{
id: 6,
title: "系统将于本周六凌晨 2 点进行维护,预计维护时间为 2 小时。",
publishStatus: 1,
type: 2,
publisherName: "系统管理员",
level: "L",
publishTime: "2024-09-30 17:26",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
{
id: 7,
title: "最近发现一些钓鱼邮件,请大家提高警惕,不要点击陌生链接。",
publishStatus: 1,
type: 3,
publisherName: "系统管理员",
level: "L",
publishTime: "2024-09-30 17:27",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
{
id: 8,
title: "国庆假期从 10 月 1 日至 10 月 7 日放假,共 7 天。",
publishStatus: 1,
type: 4,
publisherName: "系统管理员",
level: "L",
publishTime: "2024-09-30 17:28",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
{
id: 9,
title: "公司将在 10 月 15 日举办新产品发布会,敬请期待。",
publishStatus: 1,
type: 5,
publisherName: "系统管理员",
level: "L",
publishTime: "2024-09-30 17:29",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
{
id: 10,
title:
"v2.16.1 版本修复了 WebSocket 重复连接导致的后台线程阻塞问题,优化了通知公告。",
publishStatus: 1,
type: 1,
publisherName: "系统管理员",
level: "L",
publishTime: "2024-09-30 17:30",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
],
total: 10,
},
msg: "一切ok",
},
},
// 新增通知
{
url: "notices",
method: ["POST"],
body({ body }) {
return {
code: "00000",
data: null,
msg: "新增成功",
};
},
},
// 获取通知表单数据
{
url: "notices/:id/form",
method: ["GET"],
body: ({ params }) => {
return {
code: "00000",
data: noticeMap[params.id],
msg: "一切ok",
};
},
},
// 获取通知详情
{
url: "notices/:id/detail",
method: ["GET"],
body: ({ params }) => {
return {
code: "00000",
data: noticeMap[params.id],
msg: "一切ok",
};
},
},
// 修改通知
{
url: "roles/:id",
method: ["PUT"],
body({ body }) {
return {
code: "00000",
data: null,
msg: "修改通知" + body.name + "成功",
};
},
},
// 删除通知
{
url: "roles/:id",
method: ["DELETE"],
body({ params }) {
return {
code: "00000",
data: null,
msg: "删除通知" + params.id + "成功",
};
},
},
// 我的通知分页列表
{
url: "notices/my-page",
method: ["GET"],
body: {
code: "00000",
data: {
list: [
{
id: 10,
title:
"v2.16.1 版本修复了 WebSocket 重复连接导致的后台线程阻塞问题,优化了通知公告。",
type: 1,
level: "L",
publisherName: "系统管理员",
publishTime: "2024-09-30 17:30",
isRead: 0,
},
{
id: 9,
title: "公司将在 10 月 15 日举办新产品发布会,敬请期待。",
type: 5,
level: "L",
publisherName: "系统管理员",
publishTime: "2024-09-30 17:29",
isRead: 0,
},
{
id: 8,
title: "国庆假期从 10 月 1 日至 10 月 7 日放假,共 7 天。",
type: 4,
level: "L",
publisherName: "系统管理员",
publishTime: "2024-09-30 17:28",
isRead: 0,
},
{
id: 7,
title: "最近发现一些钓鱼邮件,请大家提高警惕,不要点击陌生链接。",
type: 3,
level: "L",
publisherName: "系统管理员",
publishTime: "2024-09-30 17:27",
isRead: 0,
},
{
id: 6,
title: "系统将于本周六凌晨 2 点进行维护,预计维护时间为 2 小时。",
type: 2,
level: "L",
publisherName: "系统管理员",
publishTime: "2024-09-30 17:26",
isRead: 0,
},
],
total: 10,
},
msg: "一切ok",
},
},
]);
// 通知映射表数据
const noticeMap: Record<string, any> = {
1: {
id: 1,
title: "v2.12.0 新增系统日志,访问趋势统计功能。",
publishStatus: 1,
type: 1,
publisherName: "系统管理员",
level: "L",
levelLabel: null,
publishTime: "2024-09-30 17:21",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
2: {
id: 2,
title: "v2.13.0 新增菜单搜索。",
publishStatus: 1,
type: 1,
publisherName: "系统管理员",
level: "L",
levelLabel: null,
publishTime: "2024-09-30 17:22",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
3: {
id: 3,
title: "\r\nv2.14.0 新增个人中心。",
publishStatus: 1,
type: 1,
publisherName: "系统管理员",
level: "L",
levelLabel: null,
publishTime: "2024-09-30 17:23",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
4: {
id: 4,
title: "v2.15.0 登录页面改造。",
publishStatus: 1,
type: 1,
publisherName: "系统管理员",
level: "L",
levelLabel: null,
publishTime: "2024-09-30 17:24",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
5: {
id: 5,
title: "v2.16.0 通知公告、字典翻译组件。",
publishStatus: 1,
type: 1,
publisherName: "系统管理员",
level: "L",
levelLabel: null,
publishTime: "2024-09-30 17:25",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
6: {
id: 6,
title: "系统将于本周六凌晨 2 点进行维护,预计维护时间为 2 小时。",
publishStatus: 1,
type: 2,
publisherName: "系统管理员",
level: "L",
levelLabel: null,
publishTime: "2024-09-30 17:26",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
7: {
id: 7,
title: "最近发现一些钓鱼邮件,请大家提高警惕,不要点击陌生链接。",
publishStatus: 1,
type: 3,
publisherName: "系统管理员",
level: "L",
levelLabel: null,
publishTime: "2024-09-30 17:27",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
8: {
id: 8,
title: "国庆假期从 10 月 1 日至 10 月 7 日放假,共 7 天。",
publishStatus: 1,
type: 4,
publisherName: "系统管理员",
level: "L",
levelLabel: null,
publishTime: "2024-09-30 17:28",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
9: {
id: 9,
title: "公司将在 10 月 15 日举办新产品发布会,敬请期待。",
publishStatus: 1,
type: 5,
publisherName: "系统管理员",
level: "L",
levelLabel: null,
publishTime: "2024-09-30 17:29",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
10: {
id: 10,
title:
"v2.16.1 版本修复了 WebSocket 重复连接导致的后台线程阻塞问题,优化了通知公告。",
publishStatus: 1,
type: 1,
publisherName: "系统管理员",
level: "L",
levelLabel: null,
publishTime: "2024-09-30 17:30",
isRead: null,
targetType: 1,
createTime: "2024-09-28 11:21",
revokeTime: "2024-09-30 17:21",
},
};

335
mock/role.mock.ts Normal file
View File

@ -0,0 +1,335 @@
import { defineMock } from "./base";
export default defineMock([
{
url: "roles/options",
method: ["GET"],
body: {
code: "00000",
data: [
{
value: 2,
label: "系统管理员",
},
{
value: 4,
label: "系统管理员1",
},
{
value: 5,
label: "系统管理员2",
},
{
value: 6,
label: "系统管理员3",
},
{
value: 7,
label: "系统管理员4",
},
{
value: 8,
label: "系统管理员5",
},
{
value: 9,
label: "系统管理员6",
},
{
value: 10,
label: "系统管理员7",
},
{
value: 11,
label: "系统管理员8",
},
{
value: 12,
label: "系统管理员9",
},
{
value: 3,
label: "访问游客",
},
],
msg: "一切ok",
},
},
{
url: "roles/page",
method: ["GET"],
body: {
code: "00000",
data: {
list: [
{
id: 2,
name: "系统管理员",
code: "ADMIN",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
{
id: 3,
name: "访问游客",
code: "GUEST",
status: 1,
sort: 3,
createTime: "2021-05-26 15:49:05",
updateTime: "2019-05-05 16:00:00",
},
{
id: 4,
name: "系统管理员1",
code: "ADMIN1",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
{
id: 5,
name: "系统管理员2",
code: "ADMIN2",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
{
id: 6,
name: "系统管理员3",
code: "ADMIN3",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
{
id: 7,
name: "系统管理员4",
code: "ADMIN4",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
{
id: 8,
name: "系统管理员5",
code: "ADMIN5",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
{
id: 9,
name: "系统管理员6",
code: "ADMIN6",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: "2023-12-04 11:43:15",
},
{
id: 10,
name: "系统管理员7",
code: "ADMIN7",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
{
id: 11,
name: "系统管理员8",
code: "ADMIN8",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
],
total: 10,
},
msg: "一切ok",
},
},
// 新增角色
{
url: "roles",
method: ["POST"],
body({ body }) {
return {
code: "00000",
data: null,
msg: "新增角色" + body.name + "成功",
};
},
},
// 获取角色表单数据
{
url: "roles/:id/form",
method: ["GET"],
body: ({ params }) => {
return {
code: "00000",
data: roleMap[params.id],
msg: "一切ok",
};
},
},
// 修改角色
{
url: "roles/:id",
method: ["PUT"],
body({ body }) {
return {
code: "00000",
data: null,
msg: "修改角色" + body.name + "成功",
};
},
},
// 删除角色
{
url: "roles/:id",
method: ["DELETE"],
body({ params }) {
return {
code: "00000",
data: null,
msg: "删除角色" + params.id + "成功",
};
},
},
// 获取角色拥有的菜单ID
{
url: "roles/:id/menuIds",
method: ["GET"],
body: ({ params }) => {
return {
code: "00000",
data: [
1, 2, 31, 32, 33, 88, 3, 70, 71, 72, 4, 73, 75, 74, 5, 76, 77, 78, 6,
79, 81, 84, 85, 86, 87, 40, 41, 26, 30, 20, 21, 22, 23, 24, 89, 90,
91, 36, 37, 38, 39, 93, 94, 95, 97, 102, 89, 90, 91, 93, 94, 95, 97,
102, 103, 104,
],
msg: "一切ok",
};
},
},
// 保存角色菜单
{
url: "roles/:id/menus",
method: ["PUT"],
body: {
code: "00000",
data: null,
msg: "一切ok",
},
},
]);
// 角色映射表数据
const roleMap: Record<string, any> = {
2: {
id: 2,
name: "系统管理员",
code: "ADMIN",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
3: {
id: 3,
name: "访问游客",
code: "GUEST",
status: 1,
sort: 3,
createTime: "2021-05-26 15:49:05",
updateTime: "2019-05-05 16:00:00",
},
4: {
id: 4,
name: "系统管理员1",
code: "ADMIN1",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
5: {
id: 5,
name: "系统管理员2",
code: "ADMIN2",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
6: {
id: 6,
name: "系统管理员3",
code: "ADMIN3",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
7: {
id: 7,
name: "系统管理员4",
code: "ADMIN4",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
8: {
id: 8,
name: "系统管理员5",
code: "ADMIN5",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
9: {
id: 9,
name: "系统管理员6",
code: "ADMIN6",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: "2023-12-04 11:43:15",
},
10: {
id: 10,
name: "系统管理员7",
code: "ADMIN7",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
11: {
id: 11,
name: "系统管理员8",
code: "ADMIN8",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
};

245
mock/user.mock.ts Normal file
View File

@ -0,0 +1,245 @@
import { defineMock } from "./base";
export default defineMock([
{
url: "users/me",
method: ["GET"],
body: {
code: "00000",
data: {
userId: 2,
username: "admin",
nickname: "系统管理员",
avatar:
"https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif",
roles: ["ADMIN"],
perms: [
"sys:notice:edit",
"sys:menu:delete",
"sys:dict:edit",
"sys:notice:query",
"sys:dict:delete",
"sys:config:add",
"sys:config:refresh",
"sys:menu:add",
"sys:user:add",
"sys:user:export",
"sys:role:edit",
"sys:dept:delete",
"sys:config:update",
"sys:user:password:reset",
"sys:notice:revoke",
"sys:user:import",
"sys:user:delete",
"sys:dict_type:delete",
"sys:dict:add",
"sys:role:add",
"sys:notice:publish",
"sys:notice:delete",
"sys:dept:edit",
"sys:dict_type:edit",
"sys:user:query",
"sys:user:edit",
"sys:config:delete",
"sys:dept:add",
"sys:notice:add",
"sys:role:delete",
"sys:menu:edit",
"sys:config:query",
],
},
msg: "一切ok",
},
},
{
url: "users/page",
method: ["GET"],
body: {
code: "00000",
data: {
list: [
{
id: 2,
username: "admin",
nickname: "系统管理员",
mobile: "17621210366",
gender: 1,
avatar:
"https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif",
email: "",
status: 1,
deptId: 1,
roleIds: [2],
},
{
id: 3,
username: "test",
nickname: "测试小用户",
mobile: "17621210366",
gender: 1,
avatar:
"https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif",
email: "youlaitech@163.com",
status: 1,
deptId: 3,
roleIds: [3],
},
],
total: 2,
},
msg: "一切ok",
},
},
// 新增用户
{
url: "users",
method: ["POST"],
body({ body }) {
return {
code: "00000",
data: null,
msg: "新增用户" + body.nickname + "成功",
};
},
},
// 获取用户表单数据
{
url: "users/:userId/form",
method: ["GET"],
body: ({ params }) => {
return {
code: "00000",
data: userMap[params.userId],
msg: "一切ok",
};
},
},
// 修改用户
{
url: "users/:userId",
method: ["PUT"],
body({ body }) {
return {
code: "00000",
data: null,
msg: "修改用户" + body.nickname + "成功",
};
},
},
// 删除用户
{
url: "users/:userId",
method: ["DELETE"],
body({ params }) {
return {
code: "00000",
data: null,
msg: "删除用户" + params.id + "成功",
};
},
},
// 重置密码
{
url: "users/:userId/password/reset",
method: ["PUT"],
body({ query }) {
return {
code: "00000",
data: null,
msg: "重置密码成功,新密码为:" + query.password,
};
},
},
// 导出Excel
{
url: "users/_export",
method: ["GET"],
headers: {
"Content-Disposition":
"attachment; filename=%E7%94%A8%E6%88%B7%E5%88%97%E8%A1%A8.xlsx",
"Content-Type":
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
},
},
{
url: "users/profile",
method: ["GET"],
body: {
code: "00000",
data: {
id: 2,
username: "admin",
nickname: "系统管理员",
avatar:
"https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif",
gender: 1,
mobile: "17621210366",
email: null,
deptName: "有来技术",
roleNames: "系统管理员",
createTime: "2019-10-10",
},
},
},
{
url: "users/profile",
method: ["PUT"],
body({ query }) {
return {
code: "00000",
data: null,
msg: "修改个人信息成功",
};
},
},
{
url: "users/password",
method: ["PUT"],
body({ query }) {
return {
code: "00000",
data: null,
msg: "修改密码成功",
};
},
},
]);
// 用户映射表数据
const userMap: Record<string, any> = {
2: {
id: 2,
username: "admin",
nickname: "系统管理员",
mobile: "17621210366",
gender: 1,
avatar:
"https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif",
email: "",
status: 1,
deptId: 1,
roleIds: [2],
},
3: {
id: 3,
username: "test",
nickname: "测试小用户",
mobile: "17621210366",
gender: 1,
avatar:
"https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif",
email: "youlaitech@163.com",
status: 1,
deptId: 3,
roleIds: [3],
},
};