diff --git a/.env.development b/.env.development index 608035d7..9a788b27 100644 --- a/.env.development +++ b/.env.development @@ -1,6 +1,3 @@ -# 是否开启mock数据,关闭时需要自行对接后台接口 -VITE_USE_MOCK = true - # 资源公共路径,需要以 /开头和结尾 VITE_PUBLIC_PATH = / @@ -8,7 +5,7 @@ VITE_PUBLIC_PATH = / # 如果接口地址匹配到,则会转发到http://localhost:3000,防止本地出现跨域问题 # 可以有多个,注意多个不能换行,否则代理将会失效 VITE_PROXY = [["/basic-api","http://localhost:3000"],["/upload","http://localhost:3300/upload"]] -# VITE_PROXY=[["/api","https://vvbin.cn/test"]] +# VITE_PROXY=[["/api","https://xingyuv.com/test"]] # 是否删除Console.log VITE_DROP_CONSOLE = false diff --git a/.env.production b/.env.production index c8195ad0..b1211a7e 100644 --- a/.env.production +++ b/.env.production @@ -1,6 +1,3 @@ -# 是否开启mock -VITE_USE_MOCK = true - # 资源公共路径,需要以 / 开头和结尾 VITE_PUBLIC_PATH = / diff --git a/.env.test b/.env.test index 42f5bf11..adcf778d 100644 --- a/.env.test +++ b/.env.test @@ -1,7 +1,4 @@ NODE_ENV=production -# 是否开启mock -VITE_USE_MOCK = true - # 资源公共路径,需要以 / 开头和结尾 VITE_PUBLIC_PATH = / diff --git a/.eslintignore b/.eslintignore index e65f4ff8..897dede7 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,3 @@ - *.sh node_modules *.md diff --git a/.vscode/settings.json b/.vscode/settings.json index 252d7050..3657e7d9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -120,7 +120,6 @@ "esno", "vitejs", "sortablejs", - "mockjs", "codemirror", "iconify", "commitlint", diff --git a/README.md b/README.md index 490048f3..a868e729 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,6 @@ - **TypeScript**: 应用程序级 JavaScript 的语言 - **主题**:可配置的主题 - **国际化**:内置完善的国际化方案 -- **Mock 数据** 内置 Mock 数据方案 - **权限** 内置完善的动态路由权限生成方案 - **组件** 二次封装了多个常用的组件 @@ -60,7 +59,6 @@ - [Es6+](http://es6.ruanyifeng.com/) - 熟悉 es6 基本语法 - [Vue-Router-Next](https://next.router.vuejs.org/) - 熟悉 vue-router 基本使用 - [Ant-Design-Vue](https://2x.antdv.com/docs/vue/introduce-cn/) - ui 基本使用 -- [Mock.js](https://github.com/nuysoft/Mock) - mockjs 基本语法 ## 安装使用 diff --git a/build/vite/plugin/index.ts b/build/vite/plugin/index.ts index f55d0123..1af701eb 100644 --- a/build/vite/plugin/index.ts +++ b/build/vite/plugin/index.ts @@ -9,7 +9,6 @@ import VitePluginCertificate from 'vite-plugin-mkcert' import vueSetupExtend from 'unplugin-vue-setup-extend-plus/vite' import { configHtmlPlugin } from './html' import { configPwaConfig } from './pwa' -import { configMockPlugin } from './mock' import { configCompressPlugin } from './compress' import { configStyleImportPlugin } from './styleImport' import { configVisualizerConfig } from './visualizer' @@ -18,7 +17,7 @@ import { configSvgIconsPlugin } from './svgSprite' import { isProdFn } from '../../utils' export function createVitePlugins(mode: string, viteEnv: ViteEnv, isBuild: boolean) { - const { VITE_USE_MOCK, VITE_LEGACY, VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE } = viteEnv + const { VITE_LEGACY, VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE } = viteEnv const vitePlugins: (PluginOption | PluginOption[])[] = [ // have to @@ -46,9 +45,6 @@ export function createVitePlugins(mode: string, viteEnv: ViteEnv, isBuild: boole // vite-plugin-svg-icons vitePlugins.push(configSvgIconsPlugin(isBuild)) - // vite-plugin-mock - VITE_USE_MOCK && vitePlugins.push(configMockPlugin(isBuild)) - // vite-plugin-purge-icons vitePlugins.push(purgeIcons()) diff --git a/build/vite/plugin/mock.ts b/build/vite/plugin/mock.ts deleted file mode 100644 index f3632b02..00000000 --- a/build/vite/plugin/mock.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Mock plugin for development and production. - * https://github.com/anncwb/vite-plugin-mock - */ -import { viteMockServe } from 'vite-plugin-mock' - -export function configMockPlugin(isBuild: boolean) { - return viteMockServe({ - ignore: /^\_/, - mockPath: 'mock', - localEnabled: !isBuild, - prodEnabled: isBuild, - injectCode: ` - import { setupProdMockServer } from '../mock/_createProductionServer'; - - setupProdMockServer(); - ` - }) -} diff --git a/mock/_createProductionServer.ts b/mock/_createProductionServer.ts deleted file mode 100644 index 2119e733..00000000 --- a/mock/_createProductionServer.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer' - -// 问题描述 -// 1. `import.meta.globEager` 已被弃用, 需要升级vite版本,有兼容问题 -// 2. `vite-plugin-mock` 插件问题 https://github.com/vbenjs/vite-plugin-mock/issues/56 - -// const modules: Record = import.meta.glob("./**/*.ts", { -// import: "default", -// eager: true, -// }); - -// const mockModules = Object.keys(modules).reduce((pre, key) => { -// if (!key.includes("/_")) { -// pre.push(...(modules as Recordable)[key]); -// } -// return pre; -// }, [] as any[]); - -const modules = import.meta.globEager('./**/*.ts') - -const mockModules: any[] = [] -Object.keys(modules).forEach((key) => { - if (key.includes('/_')) { - return - } - mockModules.push(...(modules as Recordable)[key].default) -}) - -/** - * Used in a production environment. Need to manually import all modules - */ -export function setupProdMockServer() { - createProdMockServer(mockModules) -} diff --git a/mock/_util.ts b/mock/_util.ts deleted file mode 100644 index 903985c1..00000000 --- a/mock/_util.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Interface data format used to return a unified format -import { ResultEnum } from '@/enums/httpEnum' - -export function resultSuccess(result: T, { message = 'ok' } = {}) { - return { - code: ResultEnum.SUCCESS, - result, - message, - type: 'success' - } -} - -export function resultPageSuccess(page: number, pageSize: number, list: T[], { message = 'ok' } = {}) { - const pageData = pagination(page, pageSize, list) - - return { - ...resultSuccess({ - items: pageData, - total: list.length - }), - message - } -} - -export function resultError(message = 'Request failed', { code = ResultEnum.ERROR, result = null } = {}) { - return { - code, - result, - message, - type: 'error' - } -} - -export function pagination(pageNo: number, pageSize: number, array: T[]): T[] { - const offset = (pageNo - 1) * Number(pageSize) - return offset + Number(pageSize) >= array.length ? array.slice(offset, array.length) : array.slice(offset, offset + Number(pageSize)) -} - -export interface requestParams { - method: string - body: any - headers?: { authorization?: string } - query: any -} - -/** - * @description 本函数用于从request数据中获取token,请根据项目的实际情况修改 - * - */ -export function getRequestToken({ headers }: requestParams): string | undefined { - return headers?.authorization -} diff --git a/mock/demo/account.ts b/mock/demo/account.ts deleted file mode 100644 index 0af0978b..00000000 --- a/mock/demo/account.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { MockMethod } from 'vite-plugin-mock' -import { resultSuccess, resultError } from '../_util' -import { ResultEnum } from '../../src/enums/httpEnum' - -const userInfo = { - name: 'Vben', - userid: '00000001', - email: 'test@gmail.com', - signature: '海纳百川,有容乃大', - introduction: '微笑着,努力着,欣赏着', - title: '交互专家', - group: '某某某事业群-某某平台部-某某技术部-UED', - tags: [ - { - key: '0', - label: '很有想法的' - }, - { - key: '1', - label: '专注设计' - }, - { - key: '2', - label: '辣~' - }, - { - key: '3', - label: '大长腿' - }, - { - key: '4', - label: '川妹子' - }, - { - key: '5', - label: '海纳百川' - } - ], - notifyCount: 12, - unreadCount: 11, - country: 'China', - address: 'Xiamen City 77', - phone: '0592-268888888' -} - -export default [ - { - url: '/basic-api/account/getAccountInfo', - timeout: 1000, - method: 'get', - response: () => { - return resultSuccess(userInfo) - } - }, - { - url: '/basic-api/user/sessionTimeout', - method: 'post', - statusCode: 401, - response: () => { - return resultError() - } - }, - { - url: '/basic-api/user/tokenExpired', - method: 'post', - statusCode: 200, - response: () => { - return resultError('Token Expired!', { code: ResultEnum.TIMEOUT as number }) - } - } -] as MockMethod[] diff --git a/mock/demo/api-cascader.ts b/mock/demo/api-cascader.ts deleted file mode 100644 index a5458c8b..00000000 --- a/mock/demo/api-cascader.ts +++ /dev/null @@ -1,325 +0,0 @@ -import { MockMethod } from 'vite-plugin-mock' -import { resultSuccess } from '../_util' - -const areaList: any[] = [ - { - id: '530825900854620160', - code: '430000', - parentCode: '100000', - levelType: 1, - name: '湖南省', - province: '湖南省', - city: null, - district: null, - town: null, - village: null, - parentPath: '430000', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 16:33:42', - customized: false, - usable: true - }, - { - id: '530825900883980288', - code: '430100', - parentCode: '430000', - levelType: 2, - name: '长沙市', - province: '湖南省', - city: '长沙市', - district: null, - town: null, - village: null, - parentPath: '430000,430100', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 16:33:42', - customized: false, - usable: true - }, - { - id: '530825900951089152', - code: '430102', - parentCode: '430100', - levelType: 3, - name: '芙蓉区', - province: '湖南省', - city: '长沙市', - district: '芙蓉区', - town: null, - village: null, - parentPath: '430000,430100,430102', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 16:33:42', - customized: false, - usable: true - }, - { - id: '530825901014003712', - code: '430104', - parentCode: '430100', - levelType: 3, - name: '岳麓区', - province: '湖南省', - city: '长沙市', - district: '岳麓区', - town: null, - village: null, - parentPath: '430000,430100,430104', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 16:33:42', - customized: false, - usable: true - }, - { - id: '530825900988837888', - code: '430103', - parentCode: '430100', - levelType: 3, - name: '天心区', - province: '湖南省', - city: '长沙市', - district: '天心区', - town: null, - village: null, - parentPath: '430000,430100,430103', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 16:33:42', - customized: false, - usable: true - }, - { - id: '530826672489115648', - code: '430103002', - parentCode: '430103', - levelType: 4, - name: '坡子街街道', - province: '湖南省', - city: '长沙市', - district: '天心区', - town: '坡子街街道', - village: null, - parentPath: '430000,430100,430103,430103002', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-12-14 15:26:43', - customized: false, - usable: true - }, - { - id: '530840241171607552', - code: '430103002001', - parentCode: '430103002', - levelType: 5, - name: '八角亭社区', - province: '湖南省', - city: '长沙市', - district: '天心区', - town: '坡子街街道', - village: '八角亭社区', - parentPath: '430000,430100,430103,430103002,430103002001', - createTime: '2020-11-30 15:47:31', - updateTime: '2021-01-20 14:07:23', - customized: false, - usable: true - }, - { - id: '530840241200967680', - code: '430103002002', - parentCode: '430103002', - levelType: 5, - name: '西牌楼社区', - province: '湖南省', - city: '长沙市', - district: '天心区', - town: '坡子街街道', - village: '西牌楼社区', - parentPath: '430000,430100,430103,430103002,430103002002', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 17:30:41', - customized: false, - usable: true - }, - { - id: '530840241230327808', - code: '430103002003', - parentCode: '430103002', - levelType: 5, - name: '太平街社区', - province: '湖南省', - city: '长沙市', - district: '天心区', - town: '坡子街街道', - village: '太平街社区', - parentPath: '430000,430100,430103,430103002,430103002003', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 17:30:41', - customized: false, - usable: true - }, - { - id: '530840241259687936', - code: '430103002005', - parentCode: '430103002', - levelType: 5, - name: '坡子街社区', - province: '湖南省', - city: '长沙市', - district: '天心区', - town: '坡子街街道', - village: '坡子街社区', - parentPath: '430000,430100,430103,430103002,430103002005', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 17:30:41', - customized: false, - usable: true - }, - { - id: '530840241284853760', - code: '430103002006', - parentCode: '430103002', - levelType: 5, - name: '青山祠社区', - province: '湖南省', - city: '长沙市', - district: '天心区', - town: '坡子街街道', - village: '青山祠社区', - parentPath: '430000,430100,430103,430103002,430103002006', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 17:30:41', - customized: false, - usable: true - }, - { - id: '530840241310019584', - code: '430103002007', - parentCode: '430103002', - levelType: 5, - name: '沙河社区', - province: '湖南省', - city: '长沙市', - district: '天心区', - town: '坡子街街道', - village: '沙河社区', - parentPath: '430000,430100,430103,430103002,430103002007', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 17:30:41', - customized: false, - usable: true - }, - { - id: '530840241381322752', - code: '430103002008', - parentCode: '430103002', - levelType: 5, - name: '碧湘社区', - province: '湖南省', - city: '长沙市', - district: '天心区', - town: '坡子街街道', - village: '碧湘社区', - parentPath: '430000,430100,430103,430103002,430103002008', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 17:30:41', - customized: false, - usable: true - }, - { - id: '530840241410682880', - code: '430103002009', - parentCode: '430103002', - levelType: 5, - name: '创远社区', - province: '湖南省', - city: '长沙市', - district: '天心区', - town: '坡子街街道', - village: '创远社区', - parentPath: '430000,430100,430103,430103002,430103002009', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 17:30:41', - customized: false, - usable: true - }, - { - id: '530840241431654400', - code: '430103002010', - parentCode: '430103002', - levelType: 5, - name: '楚湘社区', - province: '湖南省', - city: '长沙市', - district: '天心区', - town: '坡子街街道', - village: '楚湘社区', - parentPath: '430000,430100,430103,430103002,430103002010', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 17:30:41', - customized: false, - usable: true - }, - { - id: '530840241465208832', - code: '430103002011', - parentCode: '430103002', - levelType: 5, - name: '西湖社区', - province: '湖南省', - city: '长沙市', - district: '天心区', - town: '坡子街街道', - village: '西湖社区', - parentPath: '430000,430100,430103,430103002,430103002011', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 17:30:41', - customized: false, - usable: true - }, - { - id: '530840241502957568', - code: '430103002012', - parentCode: '430103002', - levelType: 5, - name: '登仁桥社区', - province: '湖南省', - city: '长沙市', - district: '天心区', - town: '坡子街街道', - village: '登仁桥社区', - parentPath: '430000,430100,430103,430103002,430103002012', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 17:30:41', - customized: false, - usable: true - }, - { - id: '530840241553289216', - code: '430103002013', - parentCode: '430103002', - levelType: 5, - name: '文庙坪社区', - province: '湖南省', - city: '长沙市', - district: '天心区', - town: '坡子街街道', - village: '文庙坪社区', - parentPath: '430000,430100,430103,430103002,430103002013', - createTime: '2020-11-30 15:47:31', - updateTime: '2020-11-30 17:30:41', - customized: false, - usable: true - } -] -export default [ - { - url: '/basic-api/cascader/getAreaRecord', - timeout: 1000, - method: 'post', - response: ({ body }) => { - const { parentCode } = body || {} - if (!parentCode) { - return resultSuccess(areaList.filter((it) => it.code === '430000')) - } - return resultSuccess(areaList.filter((it) => it.parentCode === parentCode)) - } - } -] as MockMethod[] diff --git a/mock/demo/select-demo.ts b/mock/demo/select-demo.ts deleted file mode 100644 index f733a6e1..00000000 --- a/mock/demo/select-demo.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { MockMethod } from 'vite-plugin-mock' -import { resultSuccess } from '../_util' - -const demoList = (keyword, count = 20) => { - const result = { - list: [] as any[] - } - for (let index = 0; index < count; index++) { - result.list.push({ - name: `${keyword ?? ''}选项${index}`, - id: `${index}` - }) - } - return result -} - -export default [ - { - url: '/basic-api/select/getDemoOptions', - timeout: 1000, - method: 'get', - response: ({ query }) => { - const { keyword, count } = query - console.log(keyword) - return resultSuccess(demoList(keyword, count)) - } - } -] as MockMethod[] diff --git a/mock/demo/system.ts b/mock/demo/system.ts deleted file mode 100644 index 1522ed37..00000000 --- a/mock/demo/system.ts +++ /dev/null @@ -1,194 +0,0 @@ -import { MockMethod } from 'vite-plugin-mock' -import { resultError, resultPageSuccess, resultSuccess } from '../_util' - -const accountList = (() => { - const result: any[] = [] - for (let index = 0; index < 20; index++) { - result.push({ - id: `${index}`, - account: '@first', - email: '@email', - nickname: '@cname()', - role: '@first', - createTime: '@datetime', - remark: '@cword(10,20)', - 'status|1': ['0', '1'] - }) - } - return result -})() - -const roleList = (() => { - const result: any[] = [] - for (let index = 0; index < 4; index++) { - result.push({ - id: index + 1, - orderNo: `${index + 1}`, - roleName: ['超级管理员', '管理员', '文章管理员', '普通用户'][index], - roleValue: '@first', - createTime: '@datetime', - remark: '@cword(10,20)', - menu: [['0', '1', '2'], ['0', '1'], ['0', '2'], ['2']][index], - 'status|1': ['0', '1'] - }) - } - return result -})() - -const deptList = (() => { - const result: any[] = [] - for (let index = 0; index < 3; index++) { - result.push({ - id: `${index}`, - deptName: ['华东分部', '华南分部', '西北分部'][index], - orderNo: index + 1, - createTime: '@datetime', - remark: '@cword(10,20)', - 'status|1': ['0', '0', '1'], - children: (() => { - const children: any[] = [] - for (let j = 0; j < 4; j++) { - children.push({ - id: `${index}-${j}`, - deptName: ['研发部', '市场部', '商务部', '财务部'][j], - orderNo: j + 1, - createTime: '@datetime', - remark: '@cword(10,20)', - 'status|1': ['0', '1'], - parentDept: `${index}`, - children: undefined - }) - } - return children - })() - }) - } - return result -})() - -const menuList = (() => { - const result: any[] = [] - for (let index = 0; index < 3; index++) { - result.push({ - id: `${index}`, - icon: ['ion:layers-outline', 'ion:git-compare-outline', 'ion:tv-outline'][index], - component: 'LAYOUT', - type: '0', - menuName: ['Dashboard', '权限管理', '功能'][index], - permission: '', - orderNo: index + 1, - createTime: '@datetime', - 'status|1': ['0', '0', '1'], - children: (() => { - const children: any[] = [] - for (let j = 0; j < 4; j++) { - children.push({ - id: `${index}-${j}`, - type: '1', - menuName: ['菜单1', '菜单2', '菜单3', '菜单4'][j], - icon: 'ion:document', - permission: ['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index], - component: ['/dashboard/welcome/index', '/dashboard/analysis/index', '/dashboard/workbench/index', '/dashboard/test/index'][j], - orderNo: j + 1, - createTime: '@datetime', - 'status|1': ['0', '1'], - parentMenu: `${index}`, - children: (() => { - const children: any[] = [] - for (let k = 0; k < 4; k++) { - children.push({ - id: `${index}-${j}-${k}`, - type: '2', - menuName: '按钮' + (j + 1) + '-' + (k + 1), - icon: '', - permission: ['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index] + ':btn' + (k + 1), - component: [ - '/dashboard/welcome/index', - '/dashboard/analysis/index', - '/dashboard/workbench/index', - '/dashboard/test/index' - ][j], - orderNo: j + 1, - createTime: '@datetime', - 'status|1': ['0', '1'], - parentMenu: `${index}-${j}`, - children: undefined - }) - } - return children - })() - }) - } - return children - })() - }) - } - return result -})() - -export default [ - { - url: '/basic-api/system/getAccountList', - timeout: 100, - method: 'get', - response: ({ query }) => { - const { page = 1, pageSize = 20 } = query - return resultPageSuccess(page, pageSize, accountList) - } - }, - { - url: '/basic-api/system/getRoleListByPage', - timeout: 100, - method: 'get', - response: ({ query }) => { - const { page = 1, pageSize = 20 } = query - return resultPageSuccess(page, pageSize, roleList) - } - }, - { - url: '/basic-api/system/setRoleStatus', - timeout: 500, - method: 'post', - response: ({ query }) => { - const { id, status } = query - return resultSuccess({ id, status }) - } - }, - { - url: '/basic-api/system/getAllRoleList', - timeout: 100, - method: 'get', - response: () => { - return resultSuccess(roleList) - } - }, - { - url: '/basic-api/system/getDeptList', - timeout: 100, - method: 'get', - response: () => { - return resultSuccess(deptList) - } - }, - { - url: '/basic-api/system/getMenuList', - timeout: 100, - method: 'get', - response: () => { - return resultSuccess(menuList) - } - }, - { - url: '/basic-api/system/accountExist', - timeout: 500, - method: 'post', - response: ({ body }) => { - const { account } = body || {} - if (account && account.indexOf('admin') !== -1) { - return resultError('该字段不能包含admin') - } else { - return resultSuccess(`${account} can use`) - } - } - } -] as MockMethod[] diff --git a/mock/demo/table-demo.ts b/mock/demo/table-demo.ts deleted file mode 100644 index c00185b4..00000000 --- a/mock/demo/table-demo.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { MockMethod } from 'vite-plugin-mock' -import { Random } from 'mockjs' -import { resultPageSuccess } from '../_util' - -function getRandomPics(count = 10): string[] { - const arr: string[] = [] - for (let i = 0; i < count; i++) { - arr.push(Random.image('800x600', Random.color(), Random.color(), Random.title())) - } - return arr -} - -const demoList = (() => { - const result: any[] = [] - for (let index = 0; index < 200; index++) { - result.push({ - id: `${index}`, - beginTime: '@datetime', - endTime: '@datetime', - address: '@city()', - name: '@cname()', - name1: '@cname()', - name2: '@cname()', - name3: '@cname()', - name4: '@cname()', - name5: '@cname()', - name6: '@cname()', - name7: '@cname()', - name8: '@cname()', - radio1: `选项${index + 1}`, - radio2: `选项${index + 1}`, - radio3: `选项${index + 1}`, - avatar: Random.image('400x400', Random.color(), Random.color(), Random.first()), - imgArr: getRandomPics(Math.ceil(Math.random() * 3) + 1), - imgs: getRandomPics(Math.ceil(Math.random() * 3) + 1), - date: `@date('yyyy-MM-dd')`, - time: `@time('HH:mm')`, - 'no|100000-10000000': 100000, - 'status|1': ['normal', 'enable', 'disable'] - }) - } - return result -})() - -export default [ - { - url: '/basic-api/table/getDemoList', - timeout: 100, - method: 'get', - response: ({ query }) => { - const { page = 1, pageSize = 20 } = query - return resultPageSuccess(page, pageSize, demoList) - } - } -] as MockMethod[] diff --git a/mock/demo/tree-demo.ts b/mock/demo/tree-demo.ts deleted file mode 100644 index 48d1b5ff..00000000 --- a/mock/demo/tree-demo.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { MockMethod } from 'vite-plugin-mock' -import { resultSuccess } from '../_util' - -const demoTreeList = (keyword) => { - const result = { - list: [] as Recordable[] - } - for (let index = 0; index < 5; index++) { - const children: Recordable[] = [] - for (let j = 0; j < 3; j++) { - children.push({ - title: `${keyword ?? ''}选项${index}-${j}`, - value: `${index}-${j}`, - key: `${index}-${j}` - }) - } - result.list.push({ - title: `${keyword ?? ''}选项${index}`, - value: `${index}`, - key: `${index}`, - children - }) - } - return result -} - -export default [ - { - url: '/basic-api/tree/getDemoOptions', - timeout: 1000, - method: 'get', - response: ({ query }) => { - const { keyword } = query - console.log(keyword) - return resultSuccess(demoTreeList(keyword)) - } - } -] as MockMethod[] diff --git a/mock/sys/menu.ts b/mock/sys/menu.ts deleted file mode 100644 index 01502fcc..00000000 --- a/mock/sys/menu.ts +++ /dev/null @@ -1,270 +0,0 @@ -import { resultSuccess, resultError, getRequestToken, requestParams } from '../_util' -import { MockMethod } from 'vite-plugin-mock' -import { createFakeUserList } from './user' - -// single -const dashboardRoute = { - path: '/dashboard', - name: 'Dashboard', - component: 'LAYOUT', - redirect: '/dashboard/analysis', - meta: { - title: 'routes.dashboard.dashboard', - hideChildrenInMenu: true, - icon: 'bx:bx-home' - }, - children: [ - { - path: 'analysis', - name: 'Analysis', - component: '/dashboard/analysis/index', - meta: { - hideMenu: true, - hideBreadcrumb: true, - title: 'routes.dashboard.analysis', - currentActiveMenu: '/dashboard', - icon: 'bx:bx-home' - } - }, - { - path: 'workbench', - name: 'Workbench', - component: '/dashboard/workbench/index', - meta: { - hideMenu: true, - hideBreadcrumb: true, - title: 'routes.dashboard.workbench', - currentActiveMenu: '/dashboard', - icon: 'bx:bx-home' - } - } - ] -} - -const backRoute = { - path: 'back', - name: 'PermissionBackDemo', - meta: { - title: 'routes.demo.permission.back' - }, - - children: [ - { - path: 'page', - name: 'BackAuthPage', - component: '/demo/permission/back/index', - meta: { - title: 'routes.demo.permission.backPage' - } - }, - { - path: 'btn', - name: 'BackAuthBtn', - component: '/demo/permission/back/Btn', - meta: { - title: 'routes.demo.permission.backBtn' - } - } - ] -} - -const authRoute = { - path: '/permission', - name: 'Permission', - component: 'LAYOUT', - redirect: '/permission/front/page', - meta: { - icon: 'carbon:user-role', - title: 'routes.demo.permission.permission' - }, - children: [backRoute] -} - -const levelRoute = { - path: '/level', - name: 'Level', - component: 'LAYOUT', - redirect: '/level/menu1/menu1-1', - meta: { - icon: 'carbon:user-role', - title: 'routes.demo.level.level' - }, - - children: [ - { - path: 'menu1', - name: 'Menu1Demo', - meta: { - title: 'Menu1' - }, - children: [ - { - path: 'menu1-1', - name: 'Menu11Demo', - meta: { - title: 'Menu1-1' - }, - children: [ - { - path: 'menu1-1-1', - name: 'Menu111Demo', - component: '/demo/level/Menu111', - meta: { - title: 'Menu111' - } - } - ] - }, - { - path: 'menu1-2', - name: 'Menu12Demo', - component: '/demo/level/Menu12', - meta: { - title: 'Menu1-2' - } - } - ] - }, - { - path: 'menu2', - name: 'Menu2Demo', - component: '/demo/level/Menu2', - meta: { - title: 'Menu2' - } - } - ] -} - -const sysRoute = { - path: '/system', - name: 'System', - component: 'LAYOUT', - redirect: '/system/account', - meta: { - icon: 'ion:settings-outline', - title: 'routes.demo.system.moduleName' - }, - children: [ - { - path: 'account', - name: 'AccountManagement', - meta: { - title: 'routes.demo.system.account', - ignoreKeepAlive: true - }, - component: '/demo/system/account/index' - }, - { - path: 'account_detail/:id', - name: 'AccountDetail', - meta: { - hideMenu: true, - title: 'routes.demo.system.account_detail', - ignoreKeepAlive: true, - showMenu: false, - currentActiveMenu: '/system/account' - }, - component: '/demo/system/account/AccountDetail' - }, - { - path: 'role', - name: 'RoleManagement', - meta: { - title: 'routes.demo.system.role', - ignoreKeepAlive: true - }, - component: '/demo/system/role/index' - }, - - { - path: 'menu', - name: 'MenuManagement', - meta: { - title: 'routes.demo.system.menu', - ignoreKeepAlive: true - }, - component: '/demo/system/menu/index' - }, - { - path: 'dept', - name: 'DeptManagement', - meta: { - title: 'routes.demo.system.dept', - ignoreKeepAlive: true - }, - component: '/demo/system/dept/index' - }, - { - path: 'changePassword', - name: 'ChangePassword', - meta: { - title: 'routes.demo.system.password', - ignoreKeepAlive: true - }, - component: '/demo/system/password/index' - } - ] -} - -const linkRoute = { - path: '/link', - name: 'Link', - component: 'LAYOUT', - meta: { - icon: 'ion:tv-outline', - title: 'routes.demo.iframe.frame' - }, - children: [ - { - path: 'doc', - name: 'Doc', - meta: { - title: 'routes.demo.iframe.doc', - frameSrc: 'https://doc.vvbin.cn/' - } - }, - { - path: 'https://doc.vvbin.cn/', - name: 'DocExternal', - component: 'LAYOUT', - meta: { - title: 'routes.demo.iframe.docExternal' - } - } - ] -} - -export default [ - { - url: '/basic-api/getMenuList', - timeout: 1000, - method: 'get', - response: (request: requestParams) => { - const token = getRequestToken(request) - if (!token) { - return resultError('Invalid token!') - } - const checkUser = createFakeUserList().find((item) => item.token === token) - if (!checkUser) { - return resultError('Invalid user token!') - } - const id = checkUser.userId - let menu: Object[] - switch (id) { - case '1': - dashboardRoute.redirect = dashboardRoute.path + '/' + dashboardRoute.children[0].path - menu = [dashboardRoute, authRoute, levelRoute, sysRoute, linkRoute] - break - case '2': - dashboardRoute.redirect = dashboardRoute.path + '/' + dashboardRoute.children[1].path - menu = [dashboardRoute, authRoute, levelRoute, linkRoute] - break - default: - menu = [] - } - - return resultSuccess(menu) - } - } -] as MockMethod[] diff --git a/mock/sys/user.ts b/mock/sys/user.ts deleted file mode 100644 index 7ef24764..00000000 --- a/mock/sys/user.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { MockMethod } from 'vite-plugin-mock' -import { resultError, resultSuccess, getRequestToken, requestParams } from '../_util' - -export function createFakeUserList() { - return [ - { - userId: '1', - username: 'vben', - realName: 'Vben Admin', - avatar: '', - desc: 'manager', - password: '123456', - token: 'fakeToken1', - homePath: '/dashboard/analysis', - roles: [ - { - roleName: 'Super Admin', - value: 'super' - } - ] - }, - { - userId: '2', - username: 'test', - password: '123456', - realName: 'test user', - avatar: '', - desc: 'tester', - token: 'fakeToken2', - homePath: '/dashboard/workbench', - roles: [ - { - roleName: 'Tester', - value: 'test' - } - ] - } - ] -} - -const fakeCodeList: any = { - '1': ['1000', '3000', '5000'], - - '2': ['2000', '4000', '6000'] -} -export default [ - // mock user login - { - url: '/basic-api/login', - timeout: 200, - method: 'post', - response: ({ body }) => { - const { username, password } = body - const checkUser = createFakeUserList().find((item) => item.username === username && password === item.password) - if (!checkUser) { - return resultError('Incorrect account or password!') - } - const { userId, username: _username, token, realName, desc, roles } = checkUser - return resultSuccess({ - roles, - userId, - username: _username, - token, - realName, - desc - }) - } - }, - { - url: '/basic-api/getUserInfo', - method: 'get', - response: (request: requestParams) => { - const token = getRequestToken(request) - if (!token) return resultError('Invalid token') - const checkUser = createFakeUserList().find((item) => item.token === token) - if (!checkUser) { - return resultError('The corresponding user information was not obtained!') - } - return resultSuccess(checkUser) - } - }, - { - url: '/basic-api/getPermCode', - timeout: 200, - method: 'get', - response: (request: requestParams) => { - const token = getRequestToken(request) - if (!token) return resultError('Invalid token') - const checkUser = createFakeUserList().find((item) => item.token === token) - if (!checkUser) { - return resultError('Invalid token!') - } - const codeList = fakeCodeList[checkUser.userId] - - return resultSuccess(codeList) - } - }, - { - url: '/basic-api/logout', - timeout: 200, - method: 'get', - response: (request: requestParams) => { - const token = getRequestToken(request) - if (!token) return resultError('Invalid token') - const checkUser = createFakeUserList().find((item) => item.token === token) - if (!checkUser) { - return resultError('Invalid token!') - } - return resultSuccess(undefined, { message: 'Token has been destroyed' }) - } - }, - { - url: '/basic-api/testRetry', - statusCode: 405, - method: 'get', - response: () => { - return resultError('Error!') - } - } -] as MockMethod[] diff --git a/package.json b/package.json index b2c92f2d..7130fff5 100644 --- a/package.json +++ b/package.json @@ -21,13 +21,10 @@ "log": "conventional-changelog -p angular -i CHANGELOG.md -s", "clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite", "clean:lib": "rimraf node_modules", - "lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix", + "lint:eslint": "eslint --cache --max-warnings 0 \"src/**/*.{vue,ts,tsx}\" --fix", "lint:prettier": "prettier --write \"src/**/*.{js,json,ts,tsx,css,less,scss,vue,html,md}\"", "lint:style": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/", "lint:lint-staged": "lint-staged", - "test:unit": "jest", - "test:gzip": "npx http-server dist --cors --gzip -c-1", - "test:br": "npx http-server dist --cors --brotli -c-1", "npm:check": "npx npm-check-updates", "reinstall": "rimraf pnpm-lock.yaml && rimraf package.lock.json && rimraf node_modules && npm run bootstrap", "prepare": "husky install", @@ -51,7 +48,6 @@ "echarts": "^5.4.1", "intro.js": "^6.0.0", "lodash-es": "^4.17.21", - "mockjs": "^1.1.0", "nprogress": "^0.2.0", "path-to-regexp": "^6.2.1", "pinia": "^2.0.33", @@ -82,7 +78,6 @@ "@types/inquirer": "^9.0.3", "@types/intro.js": "^5.1.1", "@types/lodash-es": "^4.17.7", - "@types/mockjs": "^1.0.7", "@types/node": "^18.15.3", "@types/nprogress": "^0.2.0", "@types/qrcode": "^1.5.0", @@ -95,7 +90,6 @@ "@vitejs/plugin-vue": "^4.1.0", "@vitejs/plugin-vue-jsx": "^3.0.1", "@vue/compiler-sfc": "^3.2.47", - "@vue/test-utils": "^2.3.1", "autoprefixer": "^10.4.14", "conventional-changelog-cli": "^2.2.2", "cross-env": "^7.0.3", @@ -135,7 +129,6 @@ "vite-plugin-compression": "^0.5.1", "vite-plugin-html": "^3.2.0", "vite-plugin-mkcert": "^1.13.3", - "vite-plugin-mock": "^2.9.6", "vite-plugin-progress": "^0.0.6", "vite-plugin-purge-icons": "^0.9.2", "vite-plugin-pwa": "^0.14.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6dc40bd0..bab858dd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,7 +17,6 @@ specifiers: '@types/inquirer': ^9.0.3 '@types/intro.js': ^5.1.1 '@types/lodash-es': ^4.17.7 - '@types/mockjs': ^1.0.7 '@types/node': ^18.15.3 '@types/nprogress': ^0.2.0 '@types/qrcode': ^1.5.0 @@ -31,7 +30,6 @@ specifiers: '@vitejs/plugin-vue-jsx': ^3.0.1 '@vue/compiler-sfc': ^3.2.47 '@vue/runtime-core': ^3.2.47 - '@vue/test-utils': ^2.3.1 '@vueuse/core': ^9.13.0 '@zxcvbn-ts/core': ^2.2.1 ant-design-vue: ^3.2.15 @@ -59,7 +57,6 @@ specifiers: less: ^4.1.3 lint-staged: ^13.2.0 lodash-es: ^4.17.21 - mockjs: ^1.1.0 npm-run-all: ^4.1.5 nprogress: ^0.2.0 path-to-regexp: ^6.2.1 @@ -94,7 +91,6 @@ specifiers: vite-plugin-compression: ^0.5.1 vite-plugin-html: ^3.2.0 vite-plugin-mkcert: ^1.13.3 - vite-plugin-mock: ^2.9.6 vite-plugin-progress: ^0.0.6 vite-plugin-purge-icons: ^0.9.2 vite-plugin-pwa: ^0.14.4 @@ -128,7 +124,6 @@ dependencies: echarts: 5.4.1 intro.js: 6.0.0 lodash-es: 4.17.21 - mockjs: 1.1.0 nprogress: 0.2.0 path-to-regexp: 6.2.1 pinia: 2.0.33_p4srtwdgezcoeovfcc2yxzvaue @@ -159,7 +154,6 @@ devDependencies: '@types/inquirer': 9.0.3 '@types/intro.js': 5.1.1 '@types/lodash-es': 4.17.7 - '@types/mockjs': 1.0.7 '@types/node': 18.15.3 '@types/nprogress': 0.2.0 '@types/qrcode': 1.5.0 @@ -172,7 +166,6 @@ devDependencies: '@vitejs/plugin-vue': 4.1.0_vite@4.2.0+vue@3.2.47 '@vitejs/plugin-vue-jsx': 3.0.1_vite@4.2.0+vue@3.2.47 '@vue/compiler-sfc': 3.2.47 - '@vue/test-utils': 2.3.1_vue@3.2.47 autoprefixer: 10.4.14_postcss@8.4.21 conventional-changelog-cli: 2.2.2 cross-env: 7.0.3 @@ -212,7 +205,6 @@ devDependencies: vite-plugin-compression: 0.5.1_vite@4.2.0 vite-plugin-html: 3.2.0_vite@4.2.0 vite-plugin-mkcert: 1.13.3_vite@4.2.0 - vite-plugin-mock: 2.9.6_3a7irfe7b7ve75yvq4zwteqfdy vite-plugin-progress: 0.0.6_vite@4.2.0 vite-plugin-purge-icons: 0.9.2_vite@4.2.0 vite-plugin-pwa: 0.14.4_vite@4.2.0 @@ -2275,21 +2267,6 @@ packages: rollup: 2.79.1 dev: true - /@rollup/plugin-node-resolve/13.3.0_rollup@3.19.1: - resolution: {integrity: sha512-Lus8rbUo1eEcnS4yTFKLZrVumLPY+YayBdWXgFSHYhTT2iJbMhoaaBL3xl5NCdeRytErGr8tZ0L71BMRmnlwSw==} - engines: {node: '>= 10.0.0'} - peerDependencies: - rollup: ^2.42.0 - dependencies: - '@rollup/pluginutils': 3.1.0_rollup@3.19.1 - '@types/resolve': 1.17.1 - deepmerge: 4.3.0 - is-builtin-module: 3.2.1 - is-module: 1.0.0 - resolve: 1.22.1 - rollup: 3.19.1 - dev: true - /@rollup/plugin-replace/2.4.2_rollup@2.79.1: resolution: {integrity: sha512-IGcu+cydlUMZ5En85jxHH4qj2hta/11BHq95iHEyb2sbgiN0eCdzvUcHw5gt9pBL5lTi4JDYJ1acCoMGpTvEZg==} peerDependencies: @@ -2326,18 +2303,6 @@ packages: rollup: 2.79.1 dev: true - /@rollup/pluginutils/3.1.0_rollup@3.19.1: - resolution: {integrity: sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==} - engines: {node: '>= 8.0.0'} - peerDependencies: - rollup: ^1.20.0||^2.0.0 - dependencies: - '@types/estree': 0.0.39 - estree-walker: 1.0.1 - picomatch: 2.3.1 - rollup: 3.19.1 - dev: true - /@rollup/pluginutils/4.2.1: resolution: {integrity: sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==} engines: {node: '>= 8.0.0'} @@ -2458,10 +2423,6 @@ packages: resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==} dev: true - /@types/mockjs/1.0.7: - resolution: {integrity: sha512-OCxXz6hEaJOVpRwuJMiVY5a6LtJcih+br9gwB/Q8ooOBikvk5FpBQ31OlNimXo3EqKha1Z7PFBni+q9m+8NCWg==} - dev: true - /@types/mousetrap/1.6.11: resolution: {integrity: sha512-F0oAily9Q9QQpv9JKxKn0zMKfOo36KHCW7myYsmUyf2t0g+sBTbG3UleTPoguHdE1z3GLFr3p7/wiOio52QFjQ==} dev: false @@ -2858,18 +2819,6 @@ packages: /@vue/shared/3.2.47: resolution: {integrity: sha512-BHGyyGN3Q97EZx0taMQ+OLNuZcW3d37ZEVmEAyeoA9ERdGvm9Irc/0Fua8SNyOtV1w6BS4q25wbMzJujO9HIfQ==} - /@vue/test-utils/2.3.1_vue@3.2.47: - resolution: {integrity: sha512-tRtHRPEETQSUrqXgAewNZHm5iypxDFxwenfdcvMRm1kbGo4bcqHb1XHHlsaIjoDbLkuE2NYiF8vBQDNYrzlrSA==} - peerDependencies: - vue: ^3.0.1 - dependencies: - js-beautify: 1.14.6 - vue: 3.2.47 - optionalDependencies: - '@vue/compiler-dom': 3.2.47 - '@vue/server-renderer': 3.2.47_vue@3.2.47 - dev: true - /@vueuse/core/9.13.0_vue@3.2.47: resolution: {integrity: sha512-pujnclbeHWxxPRqXWmdkKV5OX4Wk4YeK7wusHqRwU0Q7EFusHoqNA/aPhB6KCh9hEqJkLAJo7bb0Lh9b+OIVzw==} dependencies: @@ -2933,10 +2882,6 @@ packages: through: 2.3.8 dev: true - /abbrev/1.1.1: - resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} - dev: true - /acorn-jsx/5.3.2_acorn@8.8.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -3648,6 +3593,7 @@ packages: /commander/10.0.0: resolution: {integrity: sha512-zS5PnTI22FIRM6ylNW8G4Ap0IEOyk62fhLSD0+uHRT9McRCLGpkVNvao4bjimpK/GShynyQkFFxHhwMcETmduA==} engines: {node: '>=14'} + dev: true /commander/2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -3692,30 +3638,11 @@ packages: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} dev: true - /config-chain/1.1.13: - resolution: {integrity: sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==} - dependencies: - ini: 1.3.8 - proto-list: 1.2.4 - dev: true - /connect-history-api-fallback/1.6.0: resolution: {integrity: sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==} engines: {node: '>=0.8'} dev: true - /connect/3.7.0: - resolution: {integrity: sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==} - engines: {node: '>= 0.10.0'} - dependencies: - debug: 2.6.9 - finalhandler: 1.1.2 - parseurl: 1.3.3 - utils-merge: 1.0.1 - transitivePeerDependencies: - - supports-color - dev: true - /consola/2.15.3: resolution: {integrity: sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==} dev: true @@ -4355,20 +4282,6 @@ packages: zrender: 5.4.1 dev: false - /editorconfig/0.15.3: - resolution: {integrity: sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==} - hasBin: true - dependencies: - commander: 2.20.3 - lru-cache: 4.1.5 - semver: 5.7.1 - sigmund: 1.0.1 - dev: true - - /ee-first/1.1.1: - resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} - dev: true - /ejs/3.1.8: resolution: {integrity: sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==} engines: {node: '>=0.10.0'} @@ -4397,11 +4310,6 @@ packages: resolution: {integrity: sha512-ucAnuBEhUK4boH2HjVYG5Q2mQyPorvv0u/ocS+zhdw0S8AlHYY+GOFhP1Gio5z4icpP2ivFSvhtFjQi8+T9ppw==} dev: false - /encodeurl/1.0.2: - resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==} - engines: {node: '>= 0.8'} - dev: true - /entities/1.1.2: resolution: {integrity: sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==} dev: true @@ -4675,12 +4583,6 @@ packages: dev: true optional: true - /esbuild/0.11.3: - resolution: {integrity: sha512-BzVRHcCtFepjS9WcqRjqoIxLqgpK21a8J4Zi4msSGxDxiXVO1IbcqT1KjhdDDnJxKfe7bvzZrvMEX+bVO0Elcw==} - hasBin: true - requiresBuild: true - dev: true - /esbuild/0.15.18: resolution: {integrity: sha512-x/R72SmW3sSFRm5zrrIjAhCeQSAWoni3CmHEqfQrZIQTM3lVCdehdwuIqaOtfC2slvpdlLa62GYoN8SxT23m6Q==} engines: {node: '>=12'} @@ -4746,10 +4648,6 @@ packages: engines: {node: '>=6'} dev: true - /escape-html/1.0.3: - resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} - dev: true - /escape-string-regexp/1.0.5: resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} engines: {node: '>=0.8.0'} @@ -5120,21 +5018,6 @@ packages: to-regex-range: 5.0.1 dev: true - /finalhandler/1.1.2: - resolution: {integrity: sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==} - engines: {node: '>= 0.8'} - dependencies: - debug: 2.6.9 - encodeurl: 1.0.2 - escape-html: 1.0.3 - on-finished: 2.3.0 - parseurl: 1.3.3 - statuses: 1.5.0 - unpipe: 1.0.0 - transitivePeerDependencies: - - supports-color - dev: true - /find-up/2.1.0: resolution: {integrity: sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==} engines: {node: '>=4'} @@ -5396,17 +5279,6 @@ packages: path-is-absolute: 1.0.1 dev: true - /glob/8.1.0: - resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} - engines: {node: '>=12'} - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 5.1.6 - once: 1.4.0 - dev: true - /glob/9.2.1: resolution: {integrity: sha512-Pxxgq3W0HyA3XUvSXcFhRSs+43Jsx0ddxcFrbjxNGkL2Ak5BAUBxLqI5G6ADDeCHLfzzXFhe0b1yYcctGmytMA==} engines: {node: '>=16 || 14 >=14.17'} @@ -5831,13 +5703,6 @@ packages: resolution: {integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==} dev: true - /is-builtin-module/3.2.1: - resolution: {integrity: sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==} - engines: {node: '>=6'} - dependencies: - builtin-modules: 3.3.0 - dev: true - /is-callable/1.2.7: resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} engines: {node: '>= 0.4'} @@ -6133,17 +5998,6 @@ packages: resolution: {integrity: sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==} dev: true - /js-beautify/1.14.6: - resolution: {integrity: sha512-GfofQY5zDp+cuHc+gsEXKPpNw2KbPddreEo35O6jT6i0RVK6LhsoYBhq5TvK4/n74wnA0QbK8gGd+jUZwTMKJw==} - engines: {node: '>=10'} - hasBin: true - dependencies: - config-chain: 1.1.13 - editorconfig: 0.15.3 - glob: 8.1.0 - nopt: 6.0.0 - dev: true - /js-sdsl/4.3.0: resolution: {integrity: sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==} dev: true @@ -6482,13 +6336,6 @@ packages: tslib: 2.5.0 dev: true - /lru-cache/4.1.5: - resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} - dependencies: - pseudomap: 1.0.2 - yallist: 2.1.2 - dev: true - /lru-cache/5.1.1: resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} dependencies: @@ -6748,12 +6595,6 @@ packages: is-extendable: 1.0.1 dev: true - /mockjs/1.1.0: - resolution: {integrity: sha512-eQsKcWzIaZzEZ07NuEyO4Nw65g0hdWAyurVol1IPl1gahRwY+svqzfgfey8U8dahLwG44d6/RwEzuK52rSa/JQ==} - hasBin: true - dependencies: - commander: 10.0.0 - /modify-values/1.0.1: resolution: {integrity: sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==} engines: {node: '>=0.10.0'} @@ -6884,14 +6725,6 @@ packages: resolution: {integrity: sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==} dev: true - /nopt/6.0.0: - resolution: {integrity: sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==} - engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} - hasBin: true - dependencies: - abbrev: 1.1.1 - dev: true - /normalize-package-data/2.5.0: resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} dependencies: @@ -7007,13 +6840,6 @@ packages: isobject: 3.0.1 dev: true - /on-finished/2.3.0: - resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==} - engines: {node: '>= 0.8'} - dependencies: - ee-first: 1.1.1 - dev: true - /once/1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: @@ -7168,11 +6994,6 @@ packages: engines: {node: '>= 0.10'} dev: true - /parseurl/1.3.3: - resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} - engines: {node: '>= 0.8'} - dev: true - /pascal-case/3.1.2: resolution: {integrity: sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==} dependencies: @@ -7235,6 +7056,7 @@ packages: /path-to-regexp/6.2.1: resolution: {integrity: sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==} + dev: false /path-type/3.0.0: resolution: {integrity: sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==} @@ -7482,10 +7304,6 @@ packages: engines: {node: '>=0.4.0'} dev: true - /proto-list/1.2.4: - resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==} - dev: true - /proxy-from-env/1.1.0: resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} @@ -7494,10 +7312,6 @@ packages: dev: true optional: true - /pseudomap/1.0.2: - resolution: {integrity: sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==} - dev: true - /punycode/2.3.0: resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} engines: {node: '>=6'} @@ -7994,10 +7808,6 @@ packages: get-intrinsic: 1.2.0 object-inspect: 1.12.3 - /sigmund/1.0.1: - resolution: {integrity: sha512-fCvEXfh6NWpm+YSuY2bpXb/VIihqWA6hLsgboC+0nl71Q7N7o2eaCW8mJa/NLvQhs6jpd3VZV4UiUQlV6+lc8g==} - dev: true - /signal-exit/3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} dev: true @@ -8189,11 +7999,6 @@ packages: object-copy: 0.1.0 dev: true - /statuses/1.5.0: - resolution: {integrity: sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==} - engines: {node: '>= 0.6'} - dev: true - /strict-uri-encode/1.1.0: resolution: {integrity: sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ==} engines: {node: '>=0.10.0'} @@ -8889,11 +8694,6 @@ packages: engines: {node: '>= 10.0.0'} dev: true - /unpipe/1.0.0: - resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} - engines: {node: '>= 0.8'} - dev: true - /unplugin-vue-setup-extend-plus/0.4.9: resolution: {integrity: sha512-4a4CvMkoZRuUHLQq1kkcuZ7HG85xM6MPMa+E1pEf5/PX6ovaCXwZ20qVOIQUIGkh3sHVp0VBhJaibHzC8hPtoA==} dependencies: @@ -8967,11 +8767,6 @@ packages: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} dev: true - /utils-merge/1.0.1: - resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} - engines: {node: '>= 0.4.0'} - dev: true - /uuid/3.4.0: resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==} deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. @@ -9053,29 +8848,6 @@ packages: - supports-color dev: true - /vite-plugin-mock/2.9.6_3a7irfe7b7ve75yvq4zwteqfdy: - resolution: {integrity: sha512-/Rm59oPppe/ncbkSrUuAxIQihlI2YcBmnbR4ST1RA2VzM1C0tEQc1KlbQvnUGhXECAGTaQN2JyasiwXP6EtKgg==} - engines: {node: '>=12.0.0'} - peerDependencies: - mockjs: '>=1.1.0' - vite: '>=2.0.0' - dependencies: - '@rollup/plugin-node-resolve': 13.3.0_rollup@3.19.1 - '@types/mockjs': 1.0.7 - chalk: 4.1.2 - chokidar: 3.5.3 - connect: 3.7.0 - debug: 4.3.4 - esbuild: 0.11.3 - fast-glob: 3.2.12 - mockjs: 1.1.0 - path-to-regexp: 6.2.1 - vite: 4.2.0_kfn5zdpk76mco3hnivyqwkouli - transitivePeerDependencies: - - rollup - - supports-color - dev: true - /vite-plugin-progress/0.0.6_vite@4.2.0: resolution: {integrity: sha512-pIK2TVEY4XFGrz10CQDdEufBBCDaV0geRHfXV3abGTBr+OF9O0Zmd3ZDrHJXDv4Rl3qAQP4BTCuPYQ3XqstmqA==} engines: {node: '>=14', pnpm: '>=7.0.0'} @@ -9645,10 +9417,6 @@ packages: engines: {node: '>=10'} dev: true - /yallist/2.1.2: - resolution: {integrity: sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==} - dev: true - /yallist/3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} dev: true diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 440861f2..6e3a5c5d 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -51,7 +51,6 @@ declare global { declare interface ViteEnv { VITE_PORT: number - VITE_USE_MOCK: boolean VITE_USE_PWA: boolean VITE_PUBLIC_PATH: string VITE_PROXY: [string, string][] diff --git a/tests/server/README.md b/tests/server/README.md deleted file mode 100644 index 14298dfc..00000000 --- a/tests/server/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Test Server - -It is used to start the test interface service, which can test the upload, websocket, login and other interfaces. - -## Usage - -```bash - -cd ./test/server - -pnpm install - -pnpm run start - -``` diff --git a/tests/server/controller/FileController.ts b/tests/server/controller/FileController.ts deleted file mode 100644 index 35e19acb..00000000 --- a/tests/server/controller/FileController.ts +++ /dev/null @@ -1,18 +0,0 @@ -import FileService from '../service/FileService' - -class FileController { - private service: FileService = new FileService() - - upload = async (ctx) => { - const files = ctx.request.files.file - console.log(files) - - if (files.length === undefined) { - this.service.upload(ctx, files, false) - } else { - this.service.upload(ctx, files, true) - } - } -} - -export default new FileController() diff --git a/tests/server/controller/UserController.ts b/tests/server/controller/UserController.ts deleted file mode 100644 index b42af32a..00000000 --- a/tests/server/controller/UserController.ts +++ /dev/null @@ -1,15 +0,0 @@ -import UserService from '../service/UserService' - -class UserController { - private service: UserService = new UserService() - - login = async (ctx) => { - ctx.body = await this.service.login() - } - - getUserInfoById = async (ctx) => { - ctx.body = await this.service.getUserInfoById() - } -} - -export default new UserController() diff --git a/tests/server/ecosystem.config.js b/tests/server/ecosystem.config.js deleted file mode 100644 index 98cc1384..00000000 --- a/tests/server/ecosystem.config.js +++ /dev/null @@ -1,18 +0,0 @@ -const { name } = require('./package.json') -const path = require('path') - -module.exports = { - apps: [ - { - name, - script: path.resolve(__dirname, './dist/index.js'), - instances: require('os').cpus().length, - autorestart: true, - watch: true, - env_production: { - NODE_ENV: 'production', - PORT: 8080 - } - } - ] -} diff --git a/tests/server/index.ts b/tests/server/index.ts deleted file mode 100644 index 321ccbe2..00000000 --- a/tests/server/index.ts +++ /dev/null @@ -1,63 +0,0 @@ -import Koa from 'koa' -import path from 'path' -import Router from 'koa-router' -import body from 'koa-body' -import cors from 'koa2-cors' -import koaStatic from 'koa-static' -import websockify from 'koa-websocket' -import route from 'koa-route' - -import AppRoutes from './routes' - -const PORT = 3300 - -const app = websockify(new Koa()) - -app.ws.use(function (ctx, next) { - ctx.websocket.send('connection succeeded!') - return next(ctx) -}) - -app.ws.use( - route.all('/test', function (ctx) { - // ctx.websocket.send('Hello World'); - ctx.websocket.on('message', function (message) { - // do something with the message from client - - if (message !== 'ping') { - const data = JSON.stringify({ - id: Math.ceil(Math.random() * 1000), - time: new Date().getTime(), - res: `${message}` - }) - ctx.websocket.send(data) - } - console.log(message) - }) - }) -) - -const router = new Router() - -// router -AppRoutes.forEach((route) => router[route.method](route.path, route.action)) - -app.use(cors()) -app.use( - body({ - encoding: 'gzip', - multipart: true, - formidable: { - // uploadDir: path.join(__dirname, '/upload/'), // 设置文件上传目录 - keepExtensions: true, - maxFieldsSize: 20 * 1024 * 1024 - } - }) -) -app.use(router.routes()) -app.use(router.allowedMethods()) -app.use(koaStatic(path.join(__dirname))) - -app.listen(PORT, () => { - console.log(`Application started successfully: http://localhost:${PORT}`) -}) diff --git a/tests/server/nodemon.json b/tests/server/nodemon.json deleted file mode 100644 index 59fa5afb..00000000 --- a/tests/server/nodemon.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "watch": ["src"], - "ext": "ts", - "exec": "ts-node -r tsconfig-paths/register index.ts", - "events": { - "restart": "clear" - } -} diff --git a/tests/server/package.json b/tests/server/package.json deleted file mode 100644 index cce2442d..00000000 --- a/tests/server/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "server", - "version": "1.0.0", - "license": "MIT", - "scripts": { - "start": "nodemon", - "build": "rimraf ./dist && tsup ./index.ts --dts --format cjs,esm ", - "prod": "npx pm2 start ecosystem.config.js --env production", - "restart": "pm2 restart ecosystem.config.js --env production", - "stop": "npx pm2 stop ecosystem.config.js" - }, - "dependencies": { - "fs-extra": "^10.0.1", - "koa": "^2.13.4", - "koa-body": "^4.2.0", - "koa-bodyparser": "^4.3.0", - "koa-route": "^3.2.0", - "koa-router": "^10.1.1", - "koa-static": "^5.0.0", - "koa-websocket": "^6.0.0", - "koa2-cors": "^2.0.6" - }, - "devDependencies": { - "@types/koa": "^2.13.4", - "@types/koa-bodyparser": "^5.0.2", - "@types/koa-router": "^7.4.4", - "@types/node": "^17.0.21", - "nodemon": "^2.0.15", - "pm2": "^5.2.0", - "rimraf": "^3.0.2", - "ts-node": "^10.7.0", - "tsconfig-paths": "^3.14.0", - "tsup": "^5.12.1", - "typescript": "^4.6.2" - } -} diff --git a/tests/server/routes.ts b/tests/server/routes.ts deleted file mode 100644 index 1aac884c..00000000 --- a/tests/server/routes.ts +++ /dev/null @@ -1,23 +0,0 @@ -import UserController from './controller/UserController' -import FileController from './controller/FileController' - -export default [ - // user - { - path: '/login', - method: 'post', - action: UserController.login - }, - { - path: '/getUserInfoById', - method: 'get', - action: UserController.getUserInfoById - }, - - // file - { - path: '/upload', - method: 'post', - action: FileController.upload - } -] diff --git a/tests/server/service/FileService.ts b/tests/server/service/FileService.ts deleted file mode 100644 index 3f9f4562..00000000 --- a/tests/server/service/FileService.ts +++ /dev/null @@ -1,54 +0,0 @@ -import path from 'path' -import fs from 'fs-extra' - -const uploadUrl = 'http://localhost:3300/static/upload' -const filePath = path.join(__dirname, '../static/upload/') - -fs.ensureDir(filePath) -export default class UserService { - async upload(ctx, files, isMultiple) { - let fileReader, fileResource, writeStream - - const fileFunc = function (file) { - fileReader = fs.createReadStream(file.path) - fileResource = filePath + `/${file.name}` - console.log(fileResource) - - writeStream = fs.createWriteStream(fileResource) - fileReader.pipe(writeStream) - } - - const returnFunc = function (flag) { - if (flag) { - let url = '' - for (let i = 0; i < files.length; i++) { - url += uploadUrl + `/${files[i].name},` - } - url = url.replace(/,$/gi, '') - ctx.body = { - url: url, - code: 0, - message: 'upload Success!' - } - } else { - ctx.body = { - url: uploadUrl + `/${files.name}`, - code: 0, - message: 'upload Success!' - } - } - } - console.log(isMultiple, files.length) - - if (isMultiple) { - for (let i = 0; i < files.length; i++) { - const f1 = files[i] - fileFunc(f1) - } - } else { - fileFunc(files) - } - fs.ensureDir(filePath) - returnFunc(isMultiple) - } -} diff --git a/tests/server/service/UserService.ts b/tests/server/service/UserService.ts deleted file mode 100644 index 7001875d..00000000 --- a/tests/server/service/UserService.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Result } from '../utils' - -const fakeUserInfo = { - userId: '1', - username: 'vben', - realName: 'Vben Admin', - desc: 'manager', - password: '123456', - token: 'fakeToken1', - roles: [ - { - roleName: 'Super Admin', - value: 'super' - } - ] -} -export default class UserService { - async login() { - return Result.success(fakeUserInfo) - } - - async getUserInfoById() { - return Result.success(fakeUserInfo) - } -} diff --git a/tests/server/tsconfig.json b/tests/server/tsconfig.json deleted file mode 100644 index 76203ed7..00000000 --- a/tests/server/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "declaration": false, - "removeComments": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "target": "es6", - "sourceMap": false, - "esModuleInterop": true, - "outDir": "./dist", - "baseUrl": "./" - }, - "exclude": ["node_modules"] -} diff --git a/tests/server/utils.ts b/tests/server/utils.ts deleted file mode 100644 index f5911a67..00000000 --- a/tests/server/utils.ts +++ /dev/null @@ -1,9 +0,0 @@ -export class Result { - static success(data: any) { - return { - code: 0, - success: true, - result: data - } - } -} diff --git a/tsconfig.json b/tsconfig.json index 3181a8da..0a65ad04 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,7 +27,6 @@ } }, "include": [ - "tests/**/*.ts", "src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", @@ -36,8 +35,7 @@ "src/types/**/*.ts", "build/**/*.ts", "build/**/*.d.ts", - "mock/**/*.ts", "vite.config.ts" ], - "exclude": ["node_modules", "tests/server/**/*.ts", "dist", "**/*.js"] + "exclude": ["node_modules", "dist", "**/*.js"] }