forked from huge/frontEnd/hugeOA

..
liyj
2020-06-28 e3831a6e7d20a22b1addc8752ccbf47786296975
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
/* eslint-disable */
const delay = require("mocker-api/utils/delay"); // 延时 模拟请求异步问题
 
const data = {
  "GET /yaoren-app/login/token": {
    data: {
      userId: 1,
      userName: "何晏波",
      userSex: 6
    },
    statusCode: "200"
  },
  "GET /yaoren-app/bannerData": {
    data: {
      urls: [
        "https://gzol.oss-cn-qingdao.aliyuncs.com/20190906161007.png",
        "https://gzol.oss-cn-qingdao.aliyuncs.com/20190926100637.png",
        "https://gzol.oss-cn-qingdao.aliyuncs.com/20190926103054.png",
        "https://gzol.oss-cn-qingdao.aliyuncs.com/20190926115113.png"
      ]
    },
    statusCode: "200"
  },
  "GET /yaoren-app/api/:id": (req, res) => {
    const { id } = req.params;
    return res.json({
      data: {
        id: new Date(),
        title: "what time is it"
      },
      statusCode: "200"
    });
  },
  "POST /yaoren-app/api/login/account": (req, res) => {
    const { password, username } = req.body;
    if (password === "888888" && username === "admin") {
      return res.json({
        data: {
          status: "ok",
          token: "dskfjkdfjsjsafljklfj"
        },
        statusCode: "200"
      });
    } else {
      return res.status(403).json({
        data: {
          status: "error"
        },
        statusCode: "403"
      });
    }
  }
};
 
//使用delay方法可以延迟返回数据
module.exports = delay(data, 0);