andrew 4 年 前
コミット
56af7737db
共有7 個のファイルを変更した258 個の追加0 個の削除を含む
  1. 103
    0
      mock/notices.js
  2. 7
    0
      mock/route.js
  3. 148
    0
      mock/user.js
  4. バイナリ
      public/favicon.png
  5. バイナリ
      public/icons/icon-128x128.png
  6. バイナリ
      public/icons/icon-192x192.png
  7. バイナリ
      public/icons/icon-512x512.png

+ 103
- 0
mock/notices.js ファイルの表示

@@ -0,0 +1,103 @@
1
+const getNotices = (req, res) => {
2
+  res.json([
3
+    {
4
+      id: '000000001',
5
+      avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
6
+      title: '你收到了 14 份新周报',
7
+      datetime: '2017-08-09',
8
+      type: 'notification',
9
+    },
10
+    {
11
+      id: '000000002',
12
+      avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png',
13
+      title: '你推荐的 曲妮妮 已通过第三轮面试',
14
+      datetime: '2017-08-08',
15
+      type: 'notification',
16
+    },
17
+    {
18
+      id: '000000003',
19
+      avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png',
20
+      title: '这种模板可以区分多种通知类型',
21
+      datetime: '2017-08-07',
22
+      read: true,
23
+      type: 'notification',
24
+    },
25
+    {
26
+      id: '000000004',
27
+      avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png',
28
+      title: '左侧图标用于区分不同的类型',
29
+      datetime: '2017-08-07',
30
+      type: 'notification',
31
+    },
32
+    {
33
+      id: '000000005',
34
+      avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
35
+      title: '内容不要超过两行字,超出时自动截断',
36
+      datetime: '2017-08-07',
37
+      type: 'notification',
38
+    },
39
+    {
40
+      id: '000000006',
41
+      avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
42
+      title: '曲丽丽 评论了你',
43
+      description: '描述信息描述信息描述信息',
44
+      datetime: '2017-08-07',
45
+      type: 'message',
46
+      clickClose: true,
47
+    },
48
+    {
49
+      id: '000000007',
50
+      avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
51
+      title: '朱偏右 回复了你',
52
+      description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
53
+      datetime: '2017-08-07',
54
+      type: 'message',
55
+      clickClose: true,
56
+    },
57
+    {
58
+      id: '000000008',
59
+      avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
60
+      title: '标题',
61
+      description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
62
+      datetime: '2017-08-07',
63
+      type: 'message',
64
+      clickClose: true,
65
+    },
66
+    {
67
+      id: '000000009',
68
+      title: '任务名称',
69
+      description: '任务需要在 2017-01-12 20:00 前启动',
70
+      extra: '未开始',
71
+      status: 'todo',
72
+      type: 'event',
73
+    },
74
+    {
75
+      id: '000000010',
76
+      title: '第三方紧急代码变更',
77
+      description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
78
+      extra: '马上到期',
79
+      status: 'urgent',
80
+      type: 'event',
81
+    },
82
+    {
83
+      id: '000000011',
84
+      title: '信息安全考试',
85
+      description: '指派竹尔于 2017-01-09 前完成更新并发布',
86
+      extra: '已耗时 8 天',
87
+      status: 'doing',
88
+      type: 'event',
89
+    },
90
+    {
91
+      id: '000000012',
92
+      title: 'ABCD 版本发布',
93
+      description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
94
+      extra: '进行中',
95
+      status: 'processing',
96
+      type: 'event',
97
+    },
98
+  ]);
99
+};
100
+
101
+export default {
102
+  'GET /api/notices': getNotices,
103
+};

+ 7
- 0
mock/route.js ファイルの表示

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

+ 148
- 0
mock/user.js ファイルの表示

@@ -0,0 +1,148 @@
1
+function getFakeCaptcha(req, res) {
2
+  return res.json('captcha-xxx');
3
+} // 代码中会兼容本地 service mock 以及部署站点的静态数据
4
+
5
+export default {
6
+  // 支持值为 Object 和 Array
7
+  'GET /api/currentUser': {
8
+    name: 'Serati Ma',
9
+    avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
10
+    userid: '00000001',
11
+    email: 'antdesign@alipay.com',
12
+    signature: '海纳百川,有容乃大',
13
+    title: '交互专家',
14
+    group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED',
15
+    tags: [
16
+      {
17
+        key: '0',
18
+        label: '很有想法的',
19
+      },
20
+      {
21
+        key: '1',
22
+        label: '专注设计',
23
+      },
24
+      {
25
+        key: '2',
26
+        label: '辣~',
27
+      },
28
+      {
29
+        key: '3',
30
+        label: '大长腿',
31
+      },
32
+      {
33
+        key: '4',
34
+        label: '川妹子',
35
+      },
36
+      {
37
+        key: '5',
38
+        label: '海纳百川',
39
+      },
40
+    ],
41
+    notifyCount: 12,
42
+    unreadCount: 11,
43
+    country: 'China',
44
+    geographic: {
45
+      province: {
46
+        label: '浙江省',
47
+        key: '330000',
48
+      },
49
+      city: {
50
+        label: '杭州市',
51
+        key: '330100',
52
+      },
53
+    },
54
+    address: '西湖区工专路 77 号',
55
+    phone: '0752-268888888',
56
+  },
57
+  // GET POST 可省略
58
+  'GET /api/users': [
59
+    {
60
+      key: '1',
61
+      name: 'John Brown',
62
+      age: 32,
63
+      address: 'New York No. 1 Lake Park',
64
+    },
65
+    {
66
+      key: '2',
67
+      name: 'Jim Green',
68
+      age: 42,
69
+      address: 'London No. 1 Lake Park',
70
+    },
71
+    {
72
+      key: '3',
73
+      name: 'Joe Black',
74
+      age: 32,
75
+      address: 'Sidney No. 1 Lake Park',
76
+    },
77
+  ],
78
+  'POST /api/login/account': (req, res) => {
79
+    const { password, userName, type } = req.body;
80
+
81
+    if (password === 'ant.design' && userName === 'admin') {
82
+      res.send({
83
+        status: 'ok',
84
+        type,
85
+        currentAuthority: 'admin',
86
+      });
87
+      return;
88
+    }
89
+
90
+    if (password === 'ant.design' && userName === 'user') {
91
+      res.send({
92
+        status: 'ok',
93
+        type,
94
+        currentAuthority: 'user',
95
+      });
96
+      return;
97
+    }
98
+
99
+    res.send({
100
+      status: 'error',
101
+      type,
102
+      currentAuthority: 'guest',
103
+    });
104
+  },
105
+  'POST /api/register': (req, res) => {
106
+    res.send({
107
+      status: 'ok',
108
+      currentAuthority: 'user',
109
+    });
110
+  },
111
+  'GET /api/500': (req, res) => {
112
+    res.status(500).send({
113
+      timestamp: 1513932555104,
114
+      status: 500,
115
+      error: 'error',
116
+      message: 'error',
117
+      path: '/base/category/list',
118
+    });
119
+  },
120
+  'GET /api/404': (req, res) => {
121
+    res.status(404).send({
122
+      timestamp: 1513932643431,
123
+      status: 404,
124
+      error: 'Not Found',
125
+      message: 'No message available',
126
+      path: '/base/category/list/2121212',
127
+    });
128
+  },
129
+  'GET /api/403': (req, res) => {
130
+    res.status(403).send({
131
+      timestamp: 1513932555104,
132
+      status: 403,
133
+      error: 'Unauthorized',
134
+      message: 'Unauthorized',
135
+      path: '/base/category/list',
136
+    });
137
+  },
138
+  'GET /api/401': (req, res) => {
139
+    res.status(401).send({
140
+      timestamp: 1513932555104,
141
+      status: 401,
142
+      error: 'Unauthorized',
143
+      message: 'Unauthorized',
144
+      path: '/base/category/list',
145
+    });
146
+  },
147
+  'GET  /api/login/captcha': getFakeCaptcha,
148
+};

バイナリ
public/favicon.png ファイルの表示


バイナリ
public/icons/icon-128x128.png ファイルの表示


バイナリ
public/icons/icon-192x192.png ファイルの表示


バイナリ
public/icons/icon-512x512.png ファイルの表示