田源
2023-04-14 6c4d4b494ef9c8fb134ece79e3993038a0358639
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import Mock from 'mockjs'
 
function getFakeList() {
  const json = {code: 200, success: true, msg: '操作成功'};
  const list = [];
  list.push(
    {
      id: '1',
      paramName: '是否开启注册功能--mock测试',
      paramKey: 'account.registerUser',
      paramValue: 'true',
      remark: '描述',
    },
    {
      id: '2',
      paramName: '账号初始密码--mock测试',
      paramKey: 'account.initPassword',
      paramValue: '123456',
      remark: '描述',
    }
  );
  json.data = {
    total: 10,
    size: 10,
    current: 1,
    searchCount: true,
    pages: 1,
    records: list,
  };
  return json;
}
 
function getFakeDetail() {
  const json = {code: 200, success: true, msg: '操作成功'};
  json.data = {
    id: '1',
    paramName: '是否开启注册功能',
    paramKey: 'account.registerUser',
    paramValue: 'true',
    remark: '描述',
  };
  return json;
}
 
function fakeSuccess() {
  return {code: 200, success: true, msg: '操作成功'};
}
 
export default ({mock}) => {
  if (!mock) return;
  Mock.mock(/\/api\/blade-system\/param\/list/, 'get', getFakeList);
 
  Mock.mock(/\/api\/blade-system\/param\/detail/, 'get', getFakeDetail);
 
  Mock.mock(/\/api\/blade-system\/param\/submit/, 'post', fakeSuccess);
 
  Mock.mock(/\/api\/blade-system\/param\/remove/, 'post', fakeSuccess);
 
}