import Mock from "mockjs";

const data = Mock.mock({
  "items|4": [
    {
      "title|+1": [
        "个税手续费返还！税局喊你去拿钱~",
        "不用照发票一样降低",
        "个税手续费返还！税局喊你去拿钱~",
        "不用照发票一样降低",
      ],
      "date|+1": ["2020-04-01", "2020-04-02", "2020-04-03", "2020-04-04"],
    },
  ],
});
const accountData = Mock.mock({
  "items|+1": [
    {
      time: "2020.04",
      bank: "2",
      cash: "200",
      total: "202",
    },
  ],
});
const accountImg = Mock.mock({
  "items|4": [
    {
      "src|+1": [
        "https://cms-cdn.jchl.com/vfs_home/publish/100/100001/100001012/100001012005/5fb675b3-b1d5-418d-b1a2-49dd82e5cff0.jpg",
        "https://cms-cdn.jchl.com/vfs_home/publish/100/100001/100001012/100001012005/a773f615-d8ef-4dc7-8220-c0d079df77cf.png",
        "https://cms-cdn.jchl.com/vfs_home/publish/100/100001/100001012/100001012005/8d71e49a-0b3d-4b90-be94-790a3d993589.jpg",
      ],
    },
  ],
});
export default [
  {
    url: `/account-list`,
    type: "post",
    response: (req, res, next) => {
      // req.body 可获取post参数
      // req.query 可获取get参数
      const items = data.items;
      return {
        body: {
          total: items.length,
          items: items,
        },
        head: {
          errorCode: "0",
          data: null,
        },
      };
    },
  },
  {
    url: `/account-data`,
    type: "post",
    response: (req, res, next) => {
      // req.body 可获取post参数
      // req.query 可获取get参数
      const items = accountData.items;
      return {
        body: {
          total: items.length,
          items: items,
        },
        head: {
          errorCode: "0",
          data: null,
        },
      };
    },
  },
  {
    url: `/account-img`,
    type: "post",
    response: (req, res, next) => {
      // req.body 可获取post参数
      // req.query 可获取get参数
      const items = accountImg.items;
      return {
        body: {
          total: items.length,
          items: items,
        },
        head: {
          errorCode: "0",
          data: null,
        },
      };
    },
  },
];
