fix: 🐛 合并冲突解决

This commit is contained in:
hxr 2024-01-10 23:16:41 +08:00
commit a7233960e3
21 changed files with 711 additions and 1411 deletions

View File

@ -1,14 +1,8 @@
## 开发环境
# 变量必须以 VITE_ 为前缀才能暴露给外部读取
NODE_ENV='development'
# 应用端口
VITE_APP_PORT = 3000
# API请求前缀
# 代理前缀
VITE_APP_BASE_API = '/dev-api'
# proxy代理配置
VITE_APP_API_URL = 'http://vapi.youlai.tech' # 线上接口
# VITE_APP_API_URL = 'http://localhost:8989' # 本地接口本地启动后端https://gitee.com/youlaiorg/youlai-boot
# VITE_APP_API_URL = 'http://localhost:3000' # 本地Mock

View File

@ -1,9 +1,6 @@
## 生产环境
NODE_ENV='production'
VITE_APP_PORT = 3000
# API请求前缀
# 代理前缀
VITE_APP_BASE_API = '/prod-api'
# proxy代理配置
VITE_APP_API_URL = "http://vapi.youlai.tech"

View File

@ -1,168 +0,0 @@
import { MockMethod } from "vite-plugin-mock";
const article_list: any = [];
const count = 100;
for (let i = 0; i < count; i++) {
article_list.push({
id: i,
timestamp: new Date().getTime(),
author: `Author ${i}`,
reviewer: `reviewer ${i}`,
title: `Title ${i}`,
importance: Math.floor(Math.random() * 3) + 1,
type: ["CN", "US", "JP", "EU"][Math.floor(Math.random() * 4)],
status: ["published", "draft"][Math.floor(Math.random() * 2)],
display_time: new Date().toISOString(),
pageviews: Math.floor(Math.random() * (5000 - 300)) + 300,
remark: `remark ${i}`,
});
}
export default [
{
url: "/api/v1/article/list",
timeout: 200,
method: "get",
response: ({ query }) => {
const { importance, type, title, page = 1, limit = 10, sort } = query;
let mock_list = article_list.filter((item: any) => {
if (importance && item.importance !== +importance) return false;
if (type && item.type !== type) return false;
if (title && item.title.indexOf(title) < 0) return false;
if (item.status === "deleted") return false;
return true;
});
if (sort === "-id") {
mock_list = mock_list.reverse();
}
const page_list = mock_list.filter(
(item: any, index: number) =>
index < limit * page && index >= limit * (page - 1)
);
return {
code: "00000",
data: { total: mock_list.length, page: page, items: page_list },
msg: "一切ok",
};
},
},
{
url: "/api/v1/article/detail",
timeout: 200,
method: "get",
response: ({ query }) => {
const { id } = query;
for (const article of article_list) {
if (article.id === +id) {
return {
code: "00000",
data: article,
msg: "一切ok",
};
}
}
},
},
{
url: "/api/v1/article/pv",
timeout: 200,
method: "get",
response: ({ query }) => {
const { id } = query;
for (const article of article_list) {
if (article.id === +id) {
return {
code: "00000",
data: {
pv: article.pageviews,
pvData: [
{ key: "PC", pv: 1024 },
{ key: "mobile", pv: 1024 },
{ key: "ios", pv: 1024 },
{ key: "android", pv: 1024 },
],
},
msg: "一切ok",
};
}
}
},
},
{
url: "/api/v1/article/update",
timeout: 200,
method: "post",
response: ({ body }) => {
const { id, ...updatedFields } = body;
// 查找要更新的文章
const articleToUpdate = article_list.find(
(article: any) => article.id === id
);
// 如果找到了要更新的文章
if (articleToUpdate) {
// 使用 Object.assign 方法更新文章
Object.assign(articleToUpdate, updatedFields);
return {
code: "00000",
data: {
article: articleToUpdate,
},
msg: "一切ok",
};
} else {
console.error(`Article with id ${id} not found.`);
}
},
},
{
url: "/api/v1/article/create",
timeout: 200,
method: "post",
response: ({ body }) => {
const { title, author, importance, type, status, remark, timestamp } =
body;
// article_list最大的id值;
const maxId = article_list.reduce((maxId: number, article: any) => {
return Math.max(maxId, article.id);
}, -1);
const article = {
id: maxId + 1,
timestamp,
author,
reviewer: `reviewer ${maxId + 1}`,
title,
importance,
type,
status,
display_time: new Date(timestamp).toISOString(),
pageviews: Math.floor(Math.random() * (5000 - 300)) + 300,
remark,
};
article_list.push(article);
return {
code: "00000",
data: {
article,
},
msg: "一切ok",
};
},
},
{
url: "/api/v1/article/delete",
timeout: 200,
method: "post",
response: ({ body }) => {
const { id } = body;
const index = article_list.findIndex((article: any) => article.id === id);
article_list.splice(index, 1);
return {
code: "00000",
msg: "一切ok",
};
},
},
] as MockMethod[];

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

@ -0,0 +1,48 @@
import path from "path";
import { createDefineMock } from "vite-plugin-mock-dev-server";
const defineMock = createDefineMock((mock) => {
mock.url = path.join(import.meta.env.VITE_APP_BASE_API, mock.url); // 路径会拼接为: /dev-api + url
});
export default defineMock([
{
url: "/api/v1/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: "/api/v1/auth/login",
method: ["POST"],
body: {
code: "00000",
data: {
accessToken:
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImp0aSI6IjE2YWJkNTlkOTAxNzQwZDliYmI3ZjczODBhZDkyNzNhIiwidXNlcklkIjoyLCJ1c2VybmFtZSI6ImFkbWluIiwiZGVwdElkIjoxLCJkYXRhU2NvcGUiOjEsImF1dGhvcml0aWVzIjpbIlJPTEVfQURNSU4iXSwiZXhwIjoxNjkxMTAzMzgyfQ.P4cuIfmPepl3HuguhMS7NXn5a7IUPpsLbmtA_rHOhHk",
tokenType: "Bearer",
refreshToken: null,
expires: null,
},
msg: "一切ok",
},
},
{
url: "/api/v1/auth/logout",
method: ["DELETE"],
body: {
code: "00000",
data: {},
msg: "string",
},
},
]);

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

@ -0,0 +1,33 @@
import path from "path";
import { createDefineMock } from "vite-plugin-mock-dev-server";
const defineMock = createDefineMock((mock) => {
mock.url = path.join(import.meta.env.VITE_APP_BASE_API, mock.url); // 路径会拼接为: /dev-api + url
});
export default defineMock([
{
url: "/api/v1/dept/options",
method: ["GET"],
body: {
code: "00000",
data: [
{
value: 1,
label: "有来技术",
children: [
{
value: 2,
label: "研发部门",
},
{
value: 3,
label: "测试部门",
},
],
},
],
msg: "一切ok",
},
},
]);

View File

@ -1,30 +0,0 @@
import { MockMethod } from "vite-plugin-mock";
export default [
{
url: "/api/v1/dept/options",
method: "get",
response: () => {
return {
code: "00000",
data: [
{
value: 1,
label: "有来技术",
children: [
{
value: 2,
label: "研发部门",
},
{
value: 3,
label: "测试部门",
},
],
},
],
msg: "一切ok",
};
},
},
] as MockMethod[];

View File

@ -1,11 +1,16 @@
import { MockMethod } from "vite-plugin-mock";
import path from "path";
import { createDefineMock } from "vite-plugin-mock-dev-server";
export default [
const defineMock = createDefineMock((mock) => {
mock.url = path.join(import.meta.env.VITE_APP_BASE_API, mock.url); // 路径会拼接为: /dev-api + url
});
export default defineMock([
{
url: "/api/v1/dict/:code/options",
method: "get",
response: ({ url }) => {
const typeCode = url.match(/\/api\/v1\/dict\/(\w+)\/options/)[1];
method: ["GET"],
body: ({ params }) => {
const typeCode = params.code;
let list = null;
@ -33,4 +38,4 @@ export default [
};
},
},
] as MockMethod[];
]);

412
mock/menu.mock.ts Normal file
View File

@ -0,0 +1,412 @@
import path from "path";
import { createDefineMock } from "vite-plugin-mock-dev-server";
const defineMock = createDefineMock((mock) => {
mock.url = path.join(import.meta.env.VITE_APP_BASE_API, mock.url); // 路径会拼接为: /dev-api + url
});
export default defineMock([
{
url: "/api/v1/menus/routes", // 路径会拼接为: /dev-api/api/v1/menus/routes
method: ["GET"],
body: {
code: "00000",
data: [
{
path: "/system",
component: "Layout",
redirect: "/system/user",
meta: {
title: "系统管理",
icon: "system",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "user",
component: "system/user/index",
name: "User",
meta: {
title: "用户管理",
icon: "user",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "role",
component: "system/role/index",
name: "Role",
meta: {
title: "角色管理",
icon: "role",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "menu",
component: "system/menu/index",
name: "Menu",
meta: {
title: "菜单管理",
icon: "menu",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "dept",
component: "system/dept/index",
name: "Dept",
meta: {
title: "部门管理",
icon: "tree",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "dict",
component: "system/dict/index",
name: "DictType",
meta: {
title: "字典管理",
icon: "dict",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
],
},
{
path: "/api",
component: "Layout",
meta: {
title: "接口",
icon: "api",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "apidoc",
component: "demo/api-doc",
name: "Apidoc",
meta: {
title: "接口文档",
icon: "api",
hidden: false,
roles: ["ADMIN"],
keepAlive: false,
},
},
],
},
{
path: "/external-link",
component: "Layout",
redirect: "noredirect",
meta: {
title: "外部链接",
icon: "link",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "https://juejin.cn/post/7228990409909108793",
meta: {
title: "document",
icon: "document",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
],
},
{
path: "/multi-level",
component: "Layout",
redirect: "/multi-level/multi-level1",
meta: {
title: "多级菜单",
icon: "multi_level",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "multi-level1",
component: "demo/multi-level/level1",
redirect: "/multi-level/multi-level2",
meta: {
title: "菜单一级",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "multi-level2",
component: "demo/multi-level/children/level2",
redirect: "/multi-level/multi-level2/multi-level3-1",
meta: {
title: "菜单二级",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "multi-level3-1",
component: "demo/multi-level/children/children/level3-1",
name: "MultiLevel31",
meta: {
title: "菜单三级-1",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "multi-level3-2",
component: "demo/multi-level/children/children/level3-2",
name: "MultiLevel32",
meta: {
title: "菜单三级-2",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
],
},
],
},
],
},
{
path: "/component",
component: "Layout",
meta: {
title: "组件封装",
icon: "menu",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "wang-editor",
component: "demo/wang-editor",
name: "wang-editor",
meta: {
title: "富文本编辑器",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "upload",
component: "demo/upload",
name: "upload",
meta: {
title: "图片上传",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "icon-selector",
component: "demo/icon-selector",
name: "icon-selector",
meta: {
title: "图标选择器",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "dict-demo",
component: "demo/dict",
name: "DictDemo",
meta: {
title: "字典组件",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "taginput",
component: "demo/taginput",
name: "taginput",
meta: {
title: "标签输入框",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "signature",
component: "demo/signature",
name: "signature",
meta: {
title: "签名",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "table",
component: "demo/table",
name: "Table",
meta: {
title: "表格",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
],
},
{
path: "/table",
component: "Layout",
meta: {
title: "Table",
icon: "table",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "dynamic-table",
component: "demo/table/dynamic-table/index",
name: "DynamicTable",
meta: {
title: "动态Table",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "drag-table",
component: "demo/table/drag-table",
name: "DragTable",
meta: {
title: "拖拽Table",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "complex-table",
component: "demo/table/complex-table",
name: "ComplexTable",
meta: {
title: "综合Table",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
],
},
{
path: "/function",
component: "Layout",
meta: {
title: "功能演示",
icon: "menu",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "permission",
component: "demo/permission/page",
name: "Permission",
meta: {
title: "Permission",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "icon-demo",
component: "demo/icons",
name: "Icons",
meta: {
title: "图标",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "websocket",
component: "demo/websocket",
name: "Websocket",
meta: {
title: "Websocket",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "other",
component: "demo/other",
meta: {
title: "敬请期待...",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
],
},
],
msg: "一切ok",
},
},
]);

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

@ -0,0 +1,63 @@
import path from "path";
import { createDefineMock } from "vite-plugin-mock-dev-server";
const defineMock = createDefineMock((mock) => {
mock.url = path.join(import.meta.env.VITE_APP_BASE_API, mock.url); // 路径会拼接为: /dev-api + url
});
export default defineMock([
{
url: "/api/v1/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",
},
},
]);

View File

@ -1,165 +0,0 @@
import { MockMethod } from "vite-plugin-mock";
export default [
{
url: "/api/v1/roles/options",
method: "get",
response: () => {
return {
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: "/api/v1/roles/page",
method: "get",
response: () => {
return {
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: "ADMIN1",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
{
id: 6,
name: "系统管理员3",
code: "ADMIN1",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
{
id: 7,
name: "系统管理员4",
code: "ADMIN1",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
{
id: 8,
name: "系统管理员5",
code: "ADMIN1",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
{
id: 9,
name: "系统管理员6",
code: "ADMIN1",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
{
id: 10,
name: "系统管理员7",
code: "ADMIN1",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
{
id: 11,
name: "系统管理员8",
code: "ADMIN1",
status: 1,
sort: 2,
createTime: "2021-03-25 12:39:54",
updateTime: null,
},
],
total: 11,
},
msg: "一切ok",
};
},
},
] as MockMethod[];

View File

@ -1,412 +0,0 @@
import { MockMethod } from "vite-plugin-mock";
const url = "/api/v1/menus/routes";
const method = "get";
const data = {
code: "00000",
data: [
{
path: "/system",
component: "Layout",
redirect: "/system/user",
meta: {
title: "系统管理",
icon: "system",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "user",
component: "system/user/index",
name: "User",
meta: {
title: "用户管理",
icon: "user",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "role",
component: "system/role/index",
name: "Role",
meta: {
title: "角色管理",
icon: "role",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "menu",
component: "system/menu/index",
name: "Menu",
meta: {
title: "菜单管理",
icon: "menu",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "dept",
component: "system/dept/index",
name: "Dept",
meta: {
title: "部门管理",
icon: "tree",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "dict",
component: "system/dict/index",
name: "DictType",
meta: {
title: "字典管理",
icon: "dict",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
],
},
{
path: "/api",
component: "Layout",
meta: {
title: "接口",
icon: "api",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "apidoc",
component: "demo/api-doc",
name: "Apidoc",
meta: {
title: "接口文档",
icon: "api",
hidden: false,
roles: ["ADMIN"],
keepAlive: false,
},
},
],
},
{
path: "/external-link",
component: "Layout",
redirect: "noredirect",
meta: {
title: "外部链接",
icon: "link",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "https://juejin.cn/post/7228990409909108793",
meta: {
title: "document",
icon: "document",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
],
},
{
path: "/multi-level",
component: "Layout",
redirect: "/multi-level/multi-level1",
meta: {
title: "多级菜单",
icon: "multi_level",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "multi-level1",
component: "demo/multi-level/level1",
redirect: "/multi-level/multi-level2",
meta: {
title: "菜单一级",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "multi-level2",
component: "demo/multi-level/children/level2",
redirect: "/multi-level/multi-level2/multi-level3-1",
meta: {
title: "菜单二级",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "multi-level3-1",
component: "demo/multi-level/children/children/level3-1",
name: "MultiLevel31",
meta: {
title: "菜单三级-1",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "multi-level3-2",
component: "demo/multi-level/children/children/level3-2",
name: "MultiLevel32",
meta: {
title: "菜单三级-2",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
],
},
],
},
],
},
{
path: "/component",
component: "Layout",
meta: {
title: "组件封装",
icon: "menu",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "wang-editor",
component: "demo/wang-editor",
name: "wang-editor",
meta: {
title: "富文本编辑器",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "upload",
component: "demo/upload",
name: "upload",
meta: {
title: "图片上传",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "icon-selector",
component: "demo/icon-selector",
name: "icon-selector",
meta: {
title: "图标选择器",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "dict-demo",
component: "demo/dict",
name: "DictDemo",
meta: {
title: "字典组件",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "taginput",
component: "demo/taginput",
name: "taginput",
meta: {
title: "标签输入框",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "signature",
component: "demo/signature",
name: "signature",
meta: {
title: "签名",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "table",
component: "demo/table",
name: "Table",
meta: {
title: "表格",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
],
},
{
path: "/table",
component: "Layout",
meta: {
title: "Table",
icon: "table",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "dynamic-table",
component: "demo/table/dynamic-table/index",
name: "DynamicTable",
meta: {
title: "动态Table",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "drag-table",
component: "demo/table/drag-table",
name: "DragTable",
meta: {
title: "拖拽Table",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "complex-table",
component: "demo/table/complex-table",
name: "ComplexTable",
meta: {
title: "综合Table",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
],
},
{
path: "/function",
component: "Layout",
meta: {
title: "功能演示",
icon: "menu",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
children: [
{
path: "permission",
component: "demo/permission/page",
name: "Permission",
meta: {
title: "Permission",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "icon-demo",
component: "demo/icons",
name: "Icons",
meta: {
title: "图标",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "websocket",
component: "demo/websocket",
name: "Websocket",
meta: {
title: "Websocket",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
{
path: "other",
component: "demo/other",
meta: {
title: "敬请期待...",
icon: "",
hidden: false,
roles: ["ADMIN"],
keepAlive: true,
},
},
],
},
],
msg: "一切ok",
};
export default [
{
url: url,
method: method,
response: () => {
return data;
},
},
] as MockMethod[];

View File

@ -1,3 +1,135 @@
import path from "path";
import { createDefineMock } from "vite-plugin-mock-dev-server";
const defineMock = createDefineMock((mock) => {
mock.url = path.join(import.meta.env.VITE_APP_BASE_API, mock.url); // 路径会拼接为: /dev-api + url
});
export default defineMock([
{
url: "/api/v1/users/me",
method: ["GET"],
body: {
code: "00000",
data: {
userId: 2,
nickname: "系统管理员",
avatar:
"https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif",
roles: ["ADMIN"],
perms: [
"sys:menu:delete",
"sys:dept:edit",
"sys:dict_type:add",
"sys:dict:edit",
"sys:dict:delete",
"sys:dict_type:edit",
"sys:menu:add",
"sys:user:add",
"sys:role:edit",
"sys:dept:delete",
"sys:user:edit",
"sys:user:delete",
"sys:user:reset_pwd",
"sys:dept:add",
"sys:role:delete",
"sys:dict_type:delete",
"sys:menu:edit",
"sys:dict:add",
"sys:role:add",
],
},
msg: "一切ok",
},
},
{
url: "/api/v1/users/page",
method: ["GET"],
body: {
code: "00000",
data: {
list: [
{
id: 2,
username: "admin",
nickname: "系统管理员",
mobile: "17621210366",
genderLabel: "男",
avatar:
"https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif",
email: null,
status: 1,
deptName: "有来技术",
roleNames: "系统管理员",
createTime: "2019-10-10",
},
{
id: 3,
username: "test",
nickname: "测试小用户",
mobile: "17621210366",
genderLabel: "男",
avatar:
"https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif",
email: null,
status: 1,
deptName: "测试部门",
roleNames: "访问游客",
createTime: "2021-06-04",
},
],
total: 2,
},
msg: "一切ok",
},
},
{
url: "/api/v1/users/:userId/form",
method: ["GET"],
body: ({ params }) => {
const userId = params.userId;
let formData = null;
if (userId == 2) {
formData = {
id: 2,
username: "admin",
nickname: "系统管理员",
mobile: "17621210366",
gender: 1,
avatar:
"https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif",
email: "",
status: 1,
deptId: 1,
roleIds: [2],
};
} else if (userId == 3) {
formData = {
id: 3,
username: "test",
nickname: "测试小用户",
mobile: "17621210366",
gender: 1,
avatar:
"https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif",
email: "youlaitech@163.com",
status: 1,
deptId: 3,
roleIds: [3],
};
}
return {
code: "00000",
data: formData,
msg: "一切ok",
};
},
},
]);
import { defineMock } from "vite-plugin-mock-dev-server";
export default defineMock([

View File

@ -50,7 +50,6 @@
"echarts": "^5.4.3",
"element-plus": "^2.4.4",
"lodash-es": "^4.17.21",
"mockjs": "^1.1.0",
"net": "^1.0.2",
"nprogress": "^0.2.0",
"path-browserify": "^1.0.1",
@ -108,7 +107,7 @@
"unplugin-icons": "^0.16.6",
"unplugin-vue-components": "^0.24.1",
"vite": "^5.0.10",
"vite-plugin-mock": "^3.0.0",
"vite-plugin-mock-dev-server": "^1.4.3",
"vite-plugin-svg-icons": "^2.0.1",
"vue-tsc": "^1.8.27"
},

View File

@ -1,27 +0,0 @@
<template>
<div>
<div class="mb-[15px]">Your roles: {{ roles }}</div>
Switch roles:
<el-radio-group v-model="switchRoles">
<el-radio-button label="EDITOR" />
<el-radio-button label="ADMIN" />
</el-radio-group>
</div>
</template>
<script setup lang="ts">
import { useUserStoreHook } from "@/store/modules/user";
import { storeToRefs } from "pinia";
const emit = defineEmits(["change"]);
const store = storeToRefs(useUserStoreHook());
const { roles } = store.user.value;
const switchRoles = computed({
get: () => roles[0],
set: (val) => {
Object.assign(roles, [val]);
emit("change");
},
});
</script>

View File

@ -1,21 +0,0 @@
<template>
<div class="app-container">
<switch-roles @change="handleRolesChange" />
</div>
</template>
<script setup lang="ts">
import router from "@/router";
import SwitchRoles from "./components/SwitchRoles.vue";
defineOptions({
// eslint-disable-next-line
name: "PagePermission",
inheritAttrs: false,
});
function handleRolesChange() {
console.log("roles changed");
router.push({ path: "/permission/page?" + new Date() });
}
</script>

View File

@ -1,257 +0,0 @@
/* eslint-disable */
import * as XLSX from "xlsx";
// TODO: this is a toy example, may be file-saver is a better choice
// import { saveAs } from 'file-saver'
function saveAs(blob, fileName) {
const type = fileName.split(".")[1];
console.log(type);
const file = new window.File([blob], fileName, { type: type });
console.log(file);
// 创建一个指向 File 对象的 URL
const url = URL.createObjectURL(file);
// 创建一个 a 标签
const a = document.createElement("a");
a.href = url;
a.download = fileName;
// 将 a 标签添加到文档中
document.body.appendChild(a);
// 模拟点击 a 标签,开始下载
a.click();
// 下载完成后,从文档中移除 a 标签,并释放 URL
document.body.removeChild(a);
URL.revokeObjectURL(url);
return file;
}
function generateArray(table) {
var out = [];
var rows = table.querySelectorAll("tr");
var ranges = [];
for (var R = 0; R < rows.length; ++R) {
var outRow = [];
var row = rows[R];
var columns = row.querySelectorAll("td");
for (var C = 0; C < columns.length; ++C) {
var cell = columns[C];
var colspan = cell.getAttribute("colspan");
var rowspan = cell.getAttribute("rowspan");
var cellValue = cell.innerText;
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//Skip ranges
ranges.forEach(function (range) {
if (
R >= range.s.r &&
R <= range.e.r &&
outRow.length >= range.s.c &&
outRow.length <= range.e.c
) {
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
}
});
//Handle Row Span
if (rowspan || colspan) {
rowspan = rowspan || 1;
colspan = colspan || 1;
ranges.push({
s: {
r: R,
c: outRow.length,
},
e: {
r: R + rowspan - 1,
c: outRow.length + colspan - 1,
},
});
}
//Handle Value
outRow.push(cellValue !== "" ? cellValue : null);
//Handle Colspan
if (colspan) for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
}
out.push(outRow);
}
return [out, ranges];
}
function datenum(v, date1904) {
if (date1904) v += 1462;
var epoch = Date.parse(v);
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}
function sheet_from_array_of_arrays(data, opts) {
var ws = {};
var range = {
s: {
c: 10000000,
r: 10000000,
},
e: {
c: 0,
r: 0,
},
};
for (var R = 0; R != data.length; ++R) {
for (var C = 0; C != data[R].length; ++C) {
if (range.s.r > R) range.s.r = R;
if (range.s.c > C) range.s.c = C;
if (range.e.r < R) range.e.r = R;
if (range.e.c < C) range.e.c = C;
var cell = {
v: data[R][C],
};
if (cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({
c: C,
r: R,
});
if (typeof cell.v === "number") cell.t = "n";
else if (typeof cell.v === "boolean") cell.t = "b";
else if (cell.v instanceof Date) {
cell.t = "n";
cell.z = XLSX.SSF._table[14];
cell.v = datenum(cell.v);
} else cell.t = "s";
ws[cell_ref] = cell;
}
}
if (range.s.c < 10000000) ws["!ref"] = XLSX.utils.encode_range(range);
return ws;
}
function Workbook() {
if (!(this instanceof Workbook)) return new Workbook();
this.SheetNames = [];
this.Sheets = {};
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xff;
return buf;
}
export function export_table_to_excel(id) {
var theTable = document.getElementById(id);
var oo = generateArray(theTable);
var ranges = oo[1];
/* original data */
var data = oo[0];
var ws_name = "SheetJS";
var wb = new Workbook(),
ws = sheet_from_array_of_arrays(data);
/* add ranges to worksheet */
// ws['!cols'] = ['apple', 'banan'];
ws["!merges"] = ranges;
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
bookType: "xlsx",
bookSST: false,
type: "binary",
});
saveAs(
new Blob([s2ab(wbout)], {
type: "application/octet-stream",
}),
"test.xlsx"
);
}
export function export_json_to_excel({
multiHeader = [],
header,
data,
filename,
merges = [],
autoWidth = true,
bookType = "xlsx",
} = {}) {
/* original data */
filename = filename || "excel-list";
data = [...data];
data.unshift(header);
for (let i = multiHeader.length - 1; i > -1; i--) {
data.unshift(multiHeader[i]);
}
var ws_name = "SheetJS";
var wb = new Workbook(),
ws = sheet_from_array_of_arrays(data);
if (merges.length > 0) {
if (!ws["!merges"]) ws["!merges"] = [];
merges.forEach((item) => {
ws["!merges"].push(XLSX.utils.decode_range(item));
});
}
if (autoWidth) {
/*设置worksheet每列的最大宽度*/
const colWidth = data.map((row) =>
row.map((val) => {
/*先判断是否为null/undefined*/
if (val == null) {
return {
wch: 10,
};
} else if (val.toString().charCodeAt(0) > 255) {
/*再判断是否为中文*/
return {
wch: val.toString().length * 2,
};
} else {
return {
wch: val.toString().length,
};
}
})
);
/*以第一行为初始值*/
let result = colWidth[0];
for (let i = 1; i < colWidth.length; i++) {
for (let j = 0; j < colWidth[i].length; j++) {
if (result[j]["wch"] < colWidth[i][j]["wch"]) {
result[j]["wch"] = colWidth[i][j]["wch"];
}
}
}
ws["!cols"] = result;
}
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
bookType: bookType,
bookSST: false,
type: "binary",
});
saveAs(
new Blob([s2ab(wbout)], {
type: "application/octet-stream",
}),
`${filename}.${bookType}`
);
}

View File

@ -1,175 +0,0 @@
<template>
<div class="app-container">
<!-- Note that row-key is necessary to get a correct row order. -->
<el-table
class="draggable"
ref="dragTable"
v-loading="listLoading"
:data="list"
row-key="id"
border
fit
highlight-current-row
style="width: 100%"
>
<el-table-column align="center" label="ID" width="65">
<template #default="{ row }">
<span>{{ row.id }}</span>
</template>
</el-table-column>
<el-table-column width="180px" align="center" label="Date">
<template #default="{ row }">
<span>{{ formatDate(row.timestamp) }}</span>
</template>
</el-table-column>
<el-table-column min-width="300px" label="Title">
<template #default="{ row }">
<span>{{ row.title }}</span>
</template>
</el-table-column>
<el-table-column width="110px" align="center" label="Author">
<template #default="{ row }">
<span>{{ row.author }}</span>
</template>
</el-table-column>
<el-table-column width="110px" label="Importance">
<template #default="{ row }">
<svg-icon
v-for="n in +row.importance ? +row.importance : 0"
:key="n"
icon-class="star"
class="icon-star"
/>
</template>
</el-table-column>
<el-table-column align="center" label="Readings" width="95">
<template #default="{ row }">
<span>{{ row.pageviews }}</span>
</template>
</el-table-column>
<el-table-column class-name="status-col" label="Status" width="110">
<template #default="{ row }">
<el-tag :type="statusType(row.status)">
{{ row.status }}
</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="Drag" width="80">
<template #default="{}">
<svg-icon class="drag-handler" icon-class="drag" />
</template>
</el-table-column>
</el-table>
<div class="show-d"><el-tag>The default order :</el-tag> {{ oldList }}</div>
<div class="show-d">
<el-tag>The after dragging order :</el-tag>
{{ list.map((v: any) => v.id) }}
</div>
</div>
</template>
<script setup lang="ts">
import { default as Sortable, SortableEvent } from "sortablejs";
import { fetchList } from "@/api/article";
defineOptions({
// eslint-disable-next-line
name: "DragTable",
inheritAttrs: false,
});
interface List {
id: number;
timestamp: number;
title: string;
pageviews: number;
status: string;
}
const listLoading = ref<boolean>(true);
const list: Ref = ref<List[]>([]);
const oldList = ref<List[]>([]);
const formatDate = (timestamp: any) => {
const date = new Date(timestamp);
return date
.toLocaleString("zh-CN", {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
hour12: false,
})
.replace(/\//g, "-");
};
const statusType = (status: string): any => {
const statusMap = {
published: "success",
draft: "info",
deleted: "danger",
};
return statusMap[status as keyof typeof statusMap];
};
//
const rowDrag = function () {
//
const tbody = document.querySelector(
".draggable .el-table__body-wrapper tbody"
);
if (!tbody) return;
Sortable.create(tbody as HTMLElement, {
//
draggable: ".draggable .el-table__row",
onEnd(event: SortableEvent) {
if (event.oldIndex !== undefined && event.newIndex !== undefined) {
const currRow = list.value.splice(event.oldIndex, 1)[0];
list.value.splice(event.newIndex, 0, currRow);
}
},
});
};
onMounted(() => {
fetchList({}).then((res) => {
listLoading.value = false;
list.value = res.data.items;
oldList.value = list.value.map((v: any) => v.id);
rowDrag();
});
});
</script>
<style>
.sortable-ghost {
color: #fff !important;
background: #42b983 !important;
opacity: 0.8;
}
</style>
<style scoped>
.icon-star {
margin-right: 2px;
}
.drag-handler {
width: 20px;
height: 20px;
cursor: pointer;
}
.show-d {
margin-top: 15px;
}
</style>

View File

@ -1,55 +0,0 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-checkbox-group v-model="checkboxVal">
<el-checkbox label="apple"> apple </el-checkbox>
<el-checkbox label="banana"> banana </el-checkbox>
<el-checkbox label="orange"> orange </el-checkbox>
</el-checkbox-group>
</div>
<el-table
:key="key"
:data="tableData"
border
fit
highlight-current-row
style="width: 100%"
>
<el-table-column prop="name" label="fruitName" width="180" />
<el-table-column v-for="fruit in formThead" :key="fruit" :label="fruit">
<template #default="scope">
{{ scope.row[fruit] }}
</template>
</el-table-column>
</el-table>
</div>
</template>
<script setup lang="ts">
const defaultFormThead = ["apple", "banana"];
const tableData = [
{
name: "fruit-1",
apple: "apple-10",
banana: "banana-10",
orange: "orange-10",
},
{
name: "fruit-2",
apple: "apple-20",
banana: "banana-20",
orange: "orange-20",
},
];
let key = 1; // table key
const formTheadOptions = ["apple", "banana", "orange"];
const checkboxVal = ref(defaultFormThead); // checkboxVal
const formThead = ref(defaultFormThead); // Default header
watch(checkboxVal, (valArr) => {
formThead.value = formTheadOptions.filter((i) => valArr.indexOf(i) >= 0);
key = key + 1; // table In order to ensure the table will be re-rendered each time
});
</script>

View File

@ -1,45 +0,0 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-checkbox-group v-model="formThead">
<el-checkbox label="apple"> apple </el-checkbox>
<el-checkbox label="banana"> banana </el-checkbox>
<el-checkbox label="orange"> orange </el-checkbox>
</el-checkbox-group>
</div>
<el-table
:data="tableData"
border
fit
highlight-current-row
style="width: 100%"
>
<el-table-column prop="name" label="fruitName" width="180" />
<el-table-column v-for="fruit in formThead" :key="fruit" :label="fruit">
<template #default="scope">
{{ scope.row[fruit] }}
</template>
</el-table-column>
</el-table>
</div>
</template>
<script setup lang="ts">
const formThead = ref(["apple", "banana"]);
const tableData = [
{
name: "fruit-1",
apple: "apple-10",
banana: "banana-10",
orange: "orange-10",
},
{
name: "fruit-2",
apple: "apple-20",
banana: "banana-20",
orange: "orange-20",
},
];
</script>

View File

@ -1,24 +0,0 @@
<template>
<div class="app-container">
<div style="margin: 0 0 5px 20px">
Fixed header, sorted by header order,
</div>
<fixed-thead />
<div style="margin: 30px 0 5px 20px">
Not fixed header, sorted by click order
</div>
<unfixed-thead />
</div>
</template>
<script setup lang="ts">
import FixedThead from "./components/FixedThead.vue";
import UnfixedThead from "./components/UnfixedThead.vue";
defineOptions({
// eslint-disable-next-line
name: "DynamicTable",
inheritAttrs: false,
});
</script>

View File

@ -9,8 +9,8 @@ import Icons from "unplugin-icons/vite";
import IconsResolver from "unplugin-icons/resolver";
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
import mockDevServerPlugin from "vite-plugin-mock-dev-server";
import { viteMockServe } from "vite-plugin-mock";
import vueJsx from "@vitejs/plugin-vue-jsx";
import UnoCSS from "unocss/vite";
@ -47,15 +47,14 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
open: true,
proxy: {
/**
*
* http://localhost:3000/dev-api/users (F12可见请求路径) => http://localhost:8989/users (实际请求后端 API 路径)
*
* env.VITE_APP_BASE_API: /dev-api
* env.VITE_APP_API_URL: http://localhost:8989
*/
[env.VITE_APP_BASE_API]: {
changeOrigin: true,
target: env.VITE_APP_API_URL,
// 线上接口地址
target: "http://vapi.youlai.tech",
// 开发接口地址
// target: http://localhost:8989
rewrite: (path) =>
path.replace(new RegExp("^" + env.VITE_APP_BASE_API), ""),
},
@ -107,11 +106,8 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
// 指定symbolId格式
symbolId: "icon-[dir]-[name]",
}),
viteMockServe({
ignore: /^\_/,
mockPath: "mock",
enable: mode === "development",
}),
// 开启 mock
mockDevServerPlugin(),
],
// 预加载项目必需的组件
optimizeDeps: {