Kaynağa Gözat

feat: 更新mock文件

BaiLuoYan 3 gün önce
ebeveyn
işleme
020cd8f887
6 değiştirilmiş dosya ile 598 ekleme ve 823 silme
  1. 598 0
      mock/api.ts
  2. 0 176
      mock/listTableList.ts
  3. 0 115
      mock/notices.ts
  4. 0 324
      mock/requestRecord.mock.js
  5. 0 5
      mock/route.ts
  6. 0 203
      mock/user.ts

+ 598 - 0
mock/api.ts

@@ -0,0 +1,598 @@
+import { Request, Response } from 'express';
+
+const now = Math.floor(Date.now() / 1000);
+
+const deptTree = [
+  {
+    id: 1,
+    parentId: 0,
+    name: '研发部',
+    path: '/1',
+    sort: 1,
+    deptType: 'DEV',
+    remark: '',
+    status: 1,
+    createTime: now - 86400 * 30,
+    children: [
+      {
+        id: 4,
+        parentId: 1,
+        name: '前端组',
+        path: '/1/4',
+        sort: 1,
+        deptType: 'DEV',
+        remark: '',
+        status: 1,
+        createTime: now - 86400 * 28,
+      },
+      {
+        id: 5,
+        parentId: 1,
+        name: '后端组',
+        path: '/1/5',
+        sort: 2,
+        deptType: 'DEV',
+        remark: '',
+        status: 1,
+        createTime: now - 86400 * 28,
+      },
+    ],
+  },
+  {
+    id: 2,
+    parentId: 0,
+    name: '市场部',
+    path: '/2',
+    sort: 2,
+    deptType: 'NORMAL',
+    remark: '',
+    status: 1,
+    createTime: now - 86400 * 30,
+  },
+  {
+    id: 3,
+    parentId: 0,
+    name: '运营部',
+    path: '/3',
+    sort: 3,
+    deptType: 'NORMAL',
+    remark: '',
+    status: 1,
+    createTime: now - 86400 * 30,
+  },
+];
+
+const products = [
+  {
+    id: 1,
+    code: 'crm',
+    name: 'CRM 系统',
+    appKey: 'ak_crm_001',
+    remark: '客户关系管理',
+    status: 1,
+    createTime: now - 86400 * 20,
+  },
+  {
+    id: 2,
+    code: 'oa',
+    name: 'OA 系统',
+    appKey: 'ak_oa_002',
+    remark: '办公自动化',
+    status: 1,
+    createTime: now - 86400 * 15,
+  },
+  {
+    id: 3,
+    code: 'mall',
+    name: '电商后台',
+    appKey: 'ak_mall_003',
+    remark: '',
+    status: 2,
+    createTime: now - 86400 * 10,
+  },
+];
+
+const users = [
+  {
+    id: 1,
+    username: 'superadmin',
+    nickname: '超级管理员',
+    avatar: '',
+    email: '[email protected]',
+    phone: '13800000001',
+    remark: '',
+    deptId: 0,
+    status: 1,
+    createTime: now - 86400 * 60,
+  },
+  {
+    id: 2,
+    username: 'zhangsan',
+    nickname: '张三',
+    avatar: '',
+    email: '[email protected]',
+    phone: '13800000002',
+    remark: '前端开发',
+    deptId: 4,
+    status: 1,
+    createTime: now - 86400 * 25,
+  },
+  {
+    id: 3,
+    username: 'lisi',
+    nickname: '李四',
+    avatar: '',
+    email: '[email protected]',
+    phone: '13800000003',
+    remark: '销售',
+    deptId: 2,
+    status: 1,
+    createTime: now - 86400 * 20,
+  },
+  {
+    id: 4,
+    username: 'wangwu',
+    nickname: '王五',
+    avatar: '',
+    email: '[email protected]',
+    phone: '13800000004',
+    remark: '运营',
+    deptId: 3,
+    status: 2,
+    createTime: now - 86400 * 18,
+  },
+];
+
+const roles = [
+  {
+    id: 1,
+    productCode: 'crm',
+    name: '销售经理',
+    remark: '管理销售团队',
+    status: 1,
+    permsLevel: 10,
+    createTime: now - 86400 * 15,
+  },
+  {
+    id: 2,
+    productCode: 'crm',
+    name: '普通销售',
+    remark: '',
+    status: 1,
+    permsLevel: 20,
+    createTime: now - 86400 * 15,
+  },
+  {
+    id: 3,
+    productCode: 'crm',
+    name: '客服',
+    remark: '只读权限',
+    status: 1,
+    permsLevel: 30,
+    createTime: now - 86400 * 15,
+  },
+  {
+    id: 4,
+    productCode: 'oa',
+    name: '审批管理员',
+    remark: '',
+    status: 1,
+    permsLevel: 10,
+    createTime: now - 86400 * 10,
+  },
+];
+
+const perms = [
+  {
+    id: 1,
+    productCode: 'crm',
+    name: '查看客户列表',
+    code: 'customer:list',
+    remark: '',
+    status: 1,
+    createTime: now - 86400 * 14,
+  },
+  {
+    id: 2,
+    productCode: 'crm',
+    name: '创建客户',
+    code: 'customer:create',
+    remark: '',
+    status: 1,
+    createTime: now - 86400 * 14,
+  },
+  {
+    id: 3,
+    productCode: 'crm',
+    name: '编辑客户',
+    code: 'customer:update',
+    remark: '',
+    status: 1,
+    createTime: now - 86400 * 14,
+  },
+  {
+    id: 4,
+    productCode: 'crm',
+    name: '删除客户',
+    code: 'customer:delete',
+    remark: '',
+    status: 1,
+    createTime: now - 86400 * 14,
+  },
+  {
+    id: 5,
+    productCode: 'crm',
+    name: '查看订单',
+    code: 'order:list',
+    remark: '',
+    status: 1,
+    createTime: now - 86400 * 14,
+  },
+  {
+    id: 6,
+    productCode: 'crm',
+    name: '创建订单',
+    code: 'order:create',
+    remark: '',
+    status: 1,
+    createTime: now - 86400 * 14,
+  },
+  {
+    id: 7,
+    productCode: 'crm',
+    name: '导出报表',
+    code: 'report:export',
+    remark: '',
+    status: 1,
+    createTime: now - 86400 * 14,
+  },
+];
+
+const members = [
+  {
+    id: 1,
+    productCode: 'crm',
+    userId: 2,
+    username: 'zhangsan',
+    nickname: '张三',
+    memberType: 'MEMBER',
+    status: 1,
+    createTime: now - 86400 * 12,
+  },
+  {
+    id: 2,
+    productCode: 'crm',
+    userId: 3,
+    username: 'lisi',
+    nickname: '李四',
+    memberType: 'MEMBER',
+    status: 1,
+    createTime: now - 86400 * 10,
+  },
+  {
+    id: 3,
+    productCode: 'oa',
+    userId: 2,
+    username: 'zhangsan',
+    nickname: '张三',
+    memberType: 'DEVELOPER',
+    status: 1,
+    createTime: now - 86400 * 8,
+  },
+];
+
+function ok(data: any) {
+  return { success: true, errorCode: 0, errorMessage: 'ok', showType: 0, data };
+}
+
+function okList(list: any[], total?: number) {
+  return {
+    success: true,
+    errorCode: 0,
+    errorMessage: 'ok',
+    showType: 0,
+    data: { list, total: total ?? list.length },
+  };
+}
+
+function fail(code: number, msg: string) {
+  return { success: false, errorCode: code, errorMessage: msg, showType: 2 };
+}
+
+export default {
+  'POST /api/dept/tree': (_req: Request, res: Response) => {
+    res.json(ok(deptTree));
+  },
+
+  'POST /api/dept/create': (req: Request, res: Response) => {
+    res.json(ok({ id: Math.floor(Math.random() * 1000) + 100 }));
+  },
+
+  'POST /api/dept/update': (_req: Request, res: Response) => {
+    res.json(ok(null));
+  },
+
+  'POST /api/dept/delete': (req: Request, res: Response) => {
+    const { id } = req.body;
+    const dept = deptTree.find((d) => d.id === id);
+    if (dept && dept.children && dept.children.length > 0) {
+      res.json(fail(400, '该部门下存在子部门,无法删除'));
+      return;
+    }
+    res.json(ok(null));
+  },
+
+  'POST /api/product/list': (req: Request, res: Response) => {
+    const { page = 1, pageSize = 20 } = req.body;
+    const start = (page - 1) * pageSize;
+    res.json(okList(products.slice(start, start + pageSize), products.length));
+  },
+
+  'POST /api/product/detail': (req: Request, res: Response) => {
+    const { id } = req.body;
+    const item = products.find((p) => p.id === id);
+    if (!item) {
+      res.json(fail(404, '产品不存在'));
+      return;
+    }
+    res.json(ok(item));
+  },
+
+  'POST /api/product/create': (_req: Request, res: Response) => {
+    res.json(
+      ok({
+        id: 100,
+        code: 'new_product',
+        appKey: 'ak_new_product_100',
+        adminUser: 'admin_new_product',
+        credentialsTicket: 'ticket_mock_abc123',
+        credentialsExpiresAt: now + 300,
+      }),
+    );
+  },
+
+  'POST /api/product/update': (_req: Request, res: Response) => {
+    res.json(ok(null));
+  },
+
+  'POST /api/product/fetchInitialCredentials': (_req: Request, res: Response) => {
+    res.json(
+      ok({
+        appKey: 'ak_new_product_100',
+        appSecret: 'sk_mock_secret_xyz789',
+        adminUser: 'admin_new_product',
+        adminPassword: 'P@ssw0rd123',
+      }),
+    );
+  },
+
+  'POST /api/user/list': (req: Request, res: Response) => {
+    const { page = 1, pageSize = 20, productCode } = req.body;
+    const list = users.map((u) => ({
+      ...u,
+      memberType: productCode
+        ? (members.find((m) => m.userId === u.id && m.productCode === productCode)?.memberType ??
+          '')
+        : undefined,
+    }));
+    const start = (page - 1) * pageSize;
+    res.json(okList(list.slice(start, start + pageSize), list.length));
+  },
+
+  'POST /api/user/detail': (req: Request, res: Response) => {
+    const { id } = req.body;
+    const item = users.find((u) => u.id === id);
+    if (!item) {
+      res.json(fail(404, '用户不存在'));
+      return;
+    }
+    res.json(ok({ ...item, roleIds: id === 3 ? [2] : [] }));
+  },
+
+  'POST /api/user/create': (_req: Request, res: Response) => {
+    res.json(ok({ id: Math.floor(Math.random() * 1000) + 100 }));
+  },
+
+  'POST /api/user/update': (_req: Request, res: Response) => {
+    res.json(ok(null));
+  },
+
+  'POST /api/user/updateStatus': (_req: Request, res: Response) => {
+    res.json(ok(null));
+  },
+
+  'POST /api/user/bindRoles': (_req: Request, res: Response) => {
+    res.json(ok(null));
+  },
+
+  'POST /api/user/setPerms': (_req: Request, res: Response) => {
+    res.json(ok(null));
+  },
+
+  'POST /api/user/userPerms': (req: Request, res: Response) => {
+    const { userId } = req.body;
+    const mockPerms =
+      userId === 3
+        ? [
+            { permId: 7, effect: 'ALLOW' },
+            { permId: 6, effect: 'DENY' },
+          ]
+        : [];
+    res.json(ok({ perms: mockPerms }));
+  },
+
+  'POST /api/role/list': (req: Request, res: Response) => {
+    const { productCode, page = 1, pageSize = 20 } = req.body;
+    const filtered = roles.filter((r) => r.productCode === productCode);
+    const start = (page - 1) * pageSize;
+    res.json(okList(filtered.slice(start, start + pageSize), filtered.length));
+  },
+
+  'POST /api/role/detail': (req: Request, res: Response) => {
+    const { id } = req.body;
+    const item = roles.find((r) => r.id === id);
+    if (!item) {
+      res.json(fail(404, '角色不存在'));
+      return;
+    }
+    const permIds = id === 1 ? [1, 2, 3, 4, 5, 6, 7] : id === 2 ? [1, 2, 5, 6] : [1, 5];
+    res.json(ok({ ...item, permIds }));
+  },
+
+  'POST /api/role/create': (_req: Request, res: Response) => {
+    res.json(ok({ id: Math.floor(Math.random() * 1000) + 100 }));
+  },
+
+  'POST /api/role/update': (_req: Request, res: Response) => {
+    res.json(ok(null));
+  },
+
+  'POST /api/role/delete': (_req: Request, res: Response) => {
+    res.json(ok(null));
+  },
+
+  'POST /api/role/bindPerms': (_req: Request, res: Response) => {
+    res.json(ok(null));
+  },
+
+  'POST /api/perm/list': (req: Request, res: Response) => {
+    const { productCode, page = 1, pageSize = 20 } = req.body;
+    const filtered = perms.filter((p) => p.productCode === productCode);
+    const start = (page - 1) * pageSize;
+    res.json(okList(filtered.slice(start, start + pageSize), filtered.length));
+  },
+
+  'POST /api/member/list': (req: Request, res: Response) => {
+    const { productCode, page = 1, pageSize = 20 } = req.body;
+    const filtered = members.filter((m) => m.productCode === productCode);
+    const start = (page - 1) * pageSize;
+    res.json(okList(filtered.slice(start, start + pageSize), filtered.length));
+  },
+
+  'POST /api/member/add': (_req: Request, res: Response) => {
+    res.json(ok({ id: Math.floor(Math.random() * 1000) + 100 }));
+  },
+
+  'POST /api/member/update': (_req: Request, res: Response) => {
+    res.json(ok(null));
+  },
+
+  'POST /api/member/remove': (_req: Request, res: Response) => {
+    res.json(ok(null));
+  },
+
+  'POST /api/captcha/get': (_req: Request, res: Response) => {
+    res.json(
+      ok({
+        id: 'captcha_mock_001',
+        base64image:
+          'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==',
+      }),
+    );
+  },
+
+  'POST /api/capjs/endpoint': (_req: Request, res: Response) => {
+    res.json(ok({ data: '' }));
+  },
+
+  'POST /api/auth/adminLogin': (req: Request, res: Response) => {
+    const { username, password, managementKey } = req.body;
+    if (managementKey !== 'mock-key') {
+      res.json(fail(401, 'managementKey 无效'));
+      return;
+    }
+    if (username === 'superadmin' && password === '123456') {
+      res.json(
+        ok({
+          accessToken: 'mock_access_token_superadmin',
+          refreshToken: 'mock_refresh_token_superadmin',
+          expires: now + 7200,
+          userInfo: {
+            userId: 1,
+            username: 'superadmin',
+            nickname: '超级管理员',
+            avatar: '',
+            email: '[email protected]',
+            phone: '13800000001',
+            isSuperAdmin: 1,
+            mustChangePassword: 0,
+            memberType: '',
+            perms: [],
+          },
+        }),
+      );
+      return;
+    }
+    res.json(fail(401, '用户名或密码错误'));
+  },
+
+  'POST /api/auth/adminLogin/cap': (req: Request, res: Response) => {
+    const { username, password, managementKey } = req.body;
+    if (managementKey !== 'mock-key') {
+      res.json(fail(401, 'managementKey 无效'));
+      return;
+    }
+    if (username === 'superadmin' && password === '123456') {
+      res.json(
+        ok({
+          accessToken: 'mock_access_token_superadmin',
+          refreshToken: 'mock_refresh_token_superadmin',
+          expires: now + 7200,
+          userInfo: {
+            userId: 1,
+            username: 'superadmin',
+            nickname: '超级管理员',
+            avatar: '',
+            email: '[email protected]',
+            phone: '13800000001',
+            isSuperAdmin: 1,
+            mustChangePassword: 0,
+            memberType: '',
+            perms: [],
+          },
+        }),
+      );
+      return;
+    }
+    res.json(fail(401, '用户名或密码错误'));
+  },
+
+  'POST /api/auth/logout': (_req: Request, res: Response) => {
+    res.json(ok(null));
+  },
+
+  'POST /api/auth/refreshToken': (_req: Request, res: Response) => {
+    res.json(
+      ok({
+        accessToken: 'mock_access_token_refreshed',
+        refreshToken: 'mock_refresh_token_refreshed',
+        expires: now + 7200,
+        userInfo: {
+          userId: 1,
+          username: 'superadmin',
+          nickname: '超级管理员',
+          avatar: '',
+          email: '[email protected]',
+          phone: '13800000001',
+          isSuperAdmin: 1,
+          mustChangePassword: 0,
+          memberType: '',
+          perms: [],
+        },
+      }),
+    );
+  },
+
+  'POST /api/auth/updateInfo': (_req: Request, res: Response) => {
+    res.json(ok(null));
+  },
+
+  'POST /api/auth/changePassword': (req: Request, res: Response) => {
+    const { oldPassword } = req.body;
+    if (oldPassword !== '123456') {
+      res.json(fail(400, '原密码错误'));
+      return;
+    }
+    res.json(ok(null));
+  },
+};

+ 0 - 176
mock/listTableList.ts

@@ -1,176 +0,0 @@
-import dayjs from 'dayjs';
-import { Request, Response } from 'express';
-import { parse } from 'url';
-
-// mock tableListDataSource
-const genList = (current: number, pageSize: number) => {
-  const tableListDataSource: API.RuleListItem[] = [];
-
-  for (let i = 0; i < pageSize; i += 1) {
-    const index = (current - 1) * 10 + i;
-    tableListDataSource.push({
-      key: index,
-      disabled: i % 6 === 0,
-      href: 'https://ant.design',
-      avatar: [
-        'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-      ][i % 2],
-      name: `TradeCode ${index}`,
-      owner: '曲丽丽',
-      desc: '这是一段描述',
-      callNo: Math.floor(Math.random() * 1000),
-      status: Math.floor(Math.random() * 10) % 4,
-      updatedAt: dayjs().format('YYYY-MM-DD'),
-      createdAt: dayjs().format('YYYY-MM-DD'),
-      progress: Math.ceil(Math.random() * 100),
-    });
-  }
-  tableListDataSource.reverse();
-  return tableListDataSource;
-};
-
-let tableListDataSource = genList(1, 100);
-
-function getRule(req: Request, res: Response, u: string) {
-  let realUrl = u;
-  if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
-    realUrl = req.url;
-  }
-  const { current = 1, pageSize = 10 } = req.query;
-  const params = parse(realUrl, true).query as unknown as API.PageParams &
-    API.RuleListItem & {
-      sorter: any;
-      filter: any;
-    };
-
-  let dataSource = [...tableListDataSource].slice(
-    ((current as number) - 1) * (pageSize as number),
-    (current as number) * (pageSize as number),
-  );
-  if (params.sorter) {
-    const sorter = JSON.parse(params.sorter);
-    dataSource = dataSource.sort((prev, next) => {
-      let sortNumber = 0;
-      (Object.keys(sorter) as Array<keyof API.RuleListItem>).forEach((key) => {
-        let nextSort = next?.[key] as number;
-        let preSort = prev?.[key] as number;
-        if (sorter[key] === 'descend') {
-          if (preSort - nextSort > 0) {
-            sortNumber += -1;
-          } else {
-            sortNumber += 1;
-          }
-          return;
-        }
-        if (preSort - nextSort > 0) {
-          sortNumber += 1;
-        } else {
-          sortNumber += -1;
-        }
-      });
-      return sortNumber;
-    });
-  }
-  if (params.filter) {
-    const filter = JSON.parse(params.filter as any) as {
-      [key: string]: string[];
-    };
-    if (Object.keys(filter).length > 0) {
-      dataSource = dataSource.filter((item) => {
-        return (Object.keys(filter) as Array<keyof API.RuleListItem>).some((key) => {
-          if (!filter[key]) {
-            return true;
-          }
-          if (filter[key].includes(`${item[key]}`)) {
-            return true;
-          }
-          return false;
-        });
-      });
-    }
-  }
-
-  if (params.name) {
-    dataSource = dataSource.filter((data) => data?.name?.includes(params.name || ''));
-  }
-  const result = {
-    data: dataSource,
-    total: tableListDataSource.length,
-    success: true,
-    pageSize,
-    current: parseInt(`${params.current}`, 10) || 1,
-  };
-
-  return res.json(result);
-}
-
-function postRule(req: Request, res: Response, u: string, b: Request) {
-  let realUrl = u;
-  if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
-    realUrl = req.url;
-  }
-
-  const body = (b && b.body) || req.body;
-  const { method, name, desc, key } = body;
-
-  switch (method) {
-    /* eslint no-case-declarations:0 */
-    case 'delete':
-      tableListDataSource = tableListDataSource.filter((item) => key.indexOf(item.key) === -1);
-      break;
-    case 'post':
-      (() => {
-        const i = Math.ceil(Math.random() * 10000);
-        const newRule: API.RuleListItem = {
-          key: tableListDataSource.length,
-          href: 'https://ant.design',
-          avatar: [
-            'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-            'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-          ][i % 2],
-          name,
-          owner: '曲丽丽',
-          desc,
-          callNo: Math.floor(Math.random() * 1000),
-          status: Math.floor(Math.random() * 10) % 2,
-          updatedAt: dayjs().format('YYYY-MM-DD'),
-          createdAt: dayjs().format('YYYY-MM-DD'),
-          progress: Math.ceil(Math.random() * 100),
-        };
-        tableListDataSource.unshift(newRule);
-        return res.json(newRule);
-      })();
-      return;
-
-    case 'update':
-      (() => {
-        let newRule = {};
-        tableListDataSource = tableListDataSource.map((item) => {
-          if (item.key === key) {
-            newRule = { ...item, desc, name };
-            return { ...item, desc, name };
-          }
-          return item;
-        });
-        return res.json(newRule);
-      })();
-      return;
-    default:
-      break;
-  }
-
-  const result = {
-    list: tableListDataSource,
-    pagination: {
-      total: tableListDataSource.length,
-    },
-  };
-
-  res.json(result);
-}
-
-export default {
-  'GET /api/rule': getRule,
-  'POST /api/rule': postRule,
-};

+ 0 - 115
mock/notices.ts

@@ -1,115 +0,0 @@
-import { Request, Response } from 'express';
-
-const getNotices = (req: Request, res: Response) => {
-  res.json({
-    data: [
-      {
-        id: '000000001',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/MSbDR4FR2MUAAAAAAAAAAAAAFl94AQBr',
-        title: '你收到了 14 份新周报',
-        datetime: '2017-08-09',
-        type: 'notification',
-      },
-      {
-        id: '000000002',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/hX-PTavYIq4AAAAAAAAAAAAAFl94AQBr',
-        title: '你推荐的 曲妮妮 已通过第三轮面试',
-        datetime: '2017-08-08',
-        type: 'notification',
-      },
-      {
-        id: '000000003',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/jHX5R5l3QjQAAAAAAAAAAAAAFl94AQBr',
-        title: '这种模板可以区分多种通知类型',
-        datetime: '2017-08-07',
-        read: true,
-        type: 'notification',
-      },
-      {
-        id: '000000004',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/Wr4mQqx6jfwAAAAAAAAAAAAAFl94AQBr',
-        title: '左侧图标用于区分不同的类型',
-        datetime: '2017-08-07',
-        type: 'notification',
-      },
-      {
-        id: '000000005',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/Mzj_TbcWUj4AAAAAAAAAAAAAFl94AQBr',
-        title: '内容不要超过两行字,超出时自动截断',
-        datetime: '2017-08-07',
-        type: 'notification',
-      },
-      {
-        id: '000000006',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/eXLzRbPqQE4AAAAAAAAAAAAAFl94AQBr',
-        title: '曲丽丽 评论了你',
-        description: '描述信息描述信息描述信息',
-        datetime: '2017-08-07',
-        type: 'message',
-        clickClose: true,
-      },
-      {
-        id: '000000007',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/w5mRQY2AmEEAAAAAAAAAAAAAFl94AQBr',
-        title: '朱偏右 回复了你',
-        description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
-        datetime: '2017-08-07',
-        type: 'message',
-        clickClose: true,
-      },
-      {
-        id: '000000008',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/wPadR5M9918AAAAAAAAAAAAAFl94AQBr',
-        title: '标题',
-        description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
-        datetime: '2017-08-07',
-        type: 'message',
-        clickClose: true,
-      },
-      {
-        id: '000000009',
-        title: '任务名称',
-        description: '任务需要在 2017-01-12 20:00 前启动',
-        extra: '未开始',
-        status: 'todo',
-        type: 'event',
-      },
-      {
-        id: '000000010',
-        title: '第三方紧急代码变更',
-        description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
-        extra: '马上到期',
-        status: 'urgent',
-        type: 'event',
-      },
-      {
-        id: '000000011',
-        title: '信息安全考试',
-        description: '指派竹尔于 2017-01-09 前完成更新并发布',
-        extra: '已耗时 8 天',
-        status: 'doing',
-        type: 'event',
-      },
-      {
-        id: '000000012',
-        title: 'ABCD 版本发布',
-        description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
-        extra: '进行中',
-        status: 'processing',
-        type: 'event',
-      },
-    ],
-  });
-};
-
-export default {
-  'GET /api/notices': getNotices,
-};

+ 0 - 324
mock/requestRecord.mock.js

@@ -1,324 +0,0 @@
-module.exports = {
-  'GET /api/currentUser': {
-    data: {
-      name: 'Serati Ma',
-      avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png',
-      userid: '00000001',
-      email: '[email protected]',
-      signature: '海纳百川,有容乃大',
-      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',
-      geographic: {
-        province: { label: '浙江省', key: '330000' },
-        city: { label: '杭州市', key: '330100' },
-      },
-      address: '西湖区工专路 77 号',
-      phone: '0752-268888888',
-    },
-  },
-  'GET /api/rule': {
-    data: [
-      {
-        key: 99,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 99',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 503,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 81,
-      },
-      {
-        key: 98,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 98',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 164,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 12,
-      },
-      {
-        key: 97,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 97',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 174,
-        status: '1',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 81,
-      },
-      {
-        key: 96,
-        disabled: true,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 96',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 914,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 7,
-      },
-      {
-        key: 95,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 95',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 698,
-        status: '2',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 82,
-      },
-      {
-        key: 94,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 94',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 488,
-        status: '1',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 14,
-      },
-      {
-        key: 93,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 93',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 580,
-        status: '2',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 77,
-      },
-      {
-        key: 92,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 92',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 244,
-        status: '3',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 58,
-      },
-      {
-        key: 91,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 91',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 959,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 66,
-      },
-      {
-        key: 90,
-        disabled: true,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 90',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 958,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 72,
-      },
-      {
-        key: 89,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 89',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 301,
-        status: '2',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 2,
-      },
-      {
-        key: 88,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 88',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 277,
-        status: '1',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 12,
-      },
-      {
-        key: 87,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 87',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 810,
-        status: '1',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 82,
-      },
-      {
-        key: 86,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 86',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 780,
-        status: '3',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 22,
-      },
-      {
-        key: 85,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 85',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 705,
-        status: '3',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 12,
-      },
-      {
-        key: 84,
-        disabled: true,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 84',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 203,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 79,
-      },
-      {
-        key: 83,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 83',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 491,
-        status: '2',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 59,
-      },
-      {
-        key: 82,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 82',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 73,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 100,
-      },
-      {
-        key: 81,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 81',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 406,
-        status: '3',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 61,
-      },
-      {
-        key: 80,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 80',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 112,
-        status: '2',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 20,
-      },
-    ],
-    total: 100,
-    success: true,
-    pageSize: 20,
-    current: 1,
-  },
-  'POST /api/login/outLogin': { data: {}, success: true },
-  'POST /api/login/account': {
-    status: 'ok',
-    type: 'account',
-    currentAuthority: 'admin',
-  },
-};

+ 0 - 5
mock/route.ts

@@ -1,5 +0,0 @@
-export default {
-  '/api/auth_routes': {
-    '/form/advanced-form': { authority: ['admin', 'user'] },
-  },
-};

+ 0 - 203
mock/user.ts

@@ -1,203 +0,0 @@
-import { Request, Response } from 'express';
-
-const waitTime = (time: number = 100) => {
-  return new Promise((resolve) => {
-    setTimeout(() => {
-      resolve(true);
-    }, time);
-  });
-};
-
-async function getFakeCaptcha(req: Request, res: Response) {
-  await waitTime(2000);
-  return res.json('captcha-xxx');
-}
-
-const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION } = process.env;
-
-/**
- * 当前用户的权限,如果为空代表没登录
- * current user access, if is '', user need login
- * 如果是 pro 的预览,默认是有权限的
- */
-let access = ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site' ? 'admin' : '';
-
-const getAccess = () => {
-  return access;
-};
-
-// 代码中会兼容本地 service mock 以及部署站点的静态数据
-export default {
-  // 支持值为 Object 和 Array
-  'GET /api/currentUser': (req: Request, res: Response) => {
-    if (!getAccess()) {
-      res.status(401).send({
-        data: {
-          isLogin: false,
-        },
-        errorCode: '401',
-        errorMessage: '请先登录!',
-        success: true,
-      });
-      return;
-    }
-    res.send({
-      success: true,
-      data: {
-        name: 'Serati Ma',
-        avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
-        userid: '00000001',
-        email: '[email protected]',
-        signature: '海纳百川,有容乃大',
-        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',
-        access: getAccess(),
-        geographic: {
-          province: {
-            label: '浙江省',
-            key: '330000',
-          },
-          city: {
-            label: '杭州市',
-            key: '330100',
-          },
-        },
-        address: '西湖区工专路 77 号',
-        phone: '0752-268888888',
-      },
-    });
-  },
-  // GET POST 可省略
-  'GET /api/users': [
-    {
-      key: '1',
-      name: 'John Brown',
-      age: 32,
-      address: 'New York No. 1 Lake Park',
-    },
-    {
-      key: '2',
-      name: 'Jim Green',
-      age: 42,
-      address: 'London No. 1 Lake Park',
-    },
-    {
-      key: '3',
-      name: 'Joe Black',
-      age: 32,
-      address: 'Sidney No. 1 Lake Park',
-    },
-  ],
-  'POST /api/login/account': async (req: Request, res: Response) => {
-    const { password, username, type } = req.body;
-    await waitTime(2000);
-    if (password === 'ant.design' && username === 'admin') {
-      res.send({
-        status: 'ok',
-        type,
-        currentAuthority: 'admin',
-      });
-      access = 'admin';
-      return;
-    }
-    if (password === 'ant.design' && username === 'user') {
-      res.send({
-        status: 'ok',
-        type,
-        currentAuthority: 'user',
-      });
-      access = 'user';
-      return;
-    }
-    if (type === 'mobile') {
-      res.send({
-        status: 'ok',
-        type,
-        currentAuthority: 'admin',
-      });
-      access = 'admin';
-      return;
-    }
-
-    res.send({
-      status: 'error',
-      type,
-      currentAuthority: 'guest',
-    });
-    access = 'guest';
-  },
-  'POST /api/login/outLogin': (req: Request, res: Response) => {
-    access = '';
-    res.send({ data: {}, success: true });
-  },
-  'POST /api/register': (req: Request, res: Response) => {
-    res.send({ status: 'ok', currentAuthority: 'user', success: true });
-  },
-  'GET /api/500': (req: Request, res: Response) => {
-    res.status(500).send({
-      timestamp: 1513932555104,
-      status: 500,
-      error: 'error',
-      message: 'error',
-      path: '/base/category/list',
-    });
-  },
-  'GET /api/404': (req: Request, res: Response) => {
-    res.status(404).send({
-      timestamp: 1513932643431,
-      status: 404,
-      error: 'Not Found',
-      message: 'No message available',
-      path: '/base/category/list/2121212',
-    });
-  },
-  'GET /api/403': (req: Request, res: Response) => {
-    res.status(403).send({
-      timestamp: 1513932555104,
-      status: 403,
-      error: 'Forbidden',
-      message: 'Forbidden',
-      path: '/base/category/list',
-    });
-  },
-  'GET /api/401': (req: Request, res: Response) => {
-    res.status(401).send({
-      timestamp: 1513932555104,
-      status: 401,
-      error: 'Unauthorized',
-      message: 'Unauthorized',
-      path: '/base/category/list',
-    });
-  },
-
-  'GET  /api/login/captcha': getFakeCaptcha,
-};