import Mock from 'mockjs'

function getList() {
  const json = {code: 200, success: true, msg: '操作成功'};
  const list = [];

  list.push(Mock.mock({
    id: '@increment',
    name: '蒋涛',
    'sex|0-1': 1,
    'age|1-99': 1,
    identity: '123456789987654321',
  }))
  
  for (let index = 0; index < 1000; index++) {
    list.push(Mock.mock({
      id: '@increment',
      name: Mock.mock('@cname'),
      'sex|0-1': 1,
      'age|1-99': 1,
      identity: Mock.mock('@id'),
    }))
  }

  json.data = {
    total: list.length,
    size: 20,
    current: 1,
    searchCount: true,
    pages: 1,
    records: list,
  };
  return json;
}

export default ({mock}) => {
  if (!mock) return;
  Mock.mock(/\/api\/jobslink-talents\/wage\/mission/, 'get', getList);
}
