
import moment from 'moment'
export default [
  {
    url: '/form/save',
    type: 'post',
    response: (req, res, next) => {
      // req.body 可获取post参数
      // req.query 可获取get参数
      return {
        body: {},
        head: {
          errorCode: '0',
          data: null
        }
      }
    }
  }, {
    url: '/form/validate/name',
    type: 'post',
    response: (req, res, next) => {
      // req.body 可获取post参数
      // req.query 可获取get参数
      let errMsg = (Math.floor(Math.random() * 10) > 3) ? "" : "已存在该名称"
      return {
        body: {
          errMsg: errMsg
        },
        head: {
          errorCode: '0',
          data: null,
        }
      }
    }
  },
  {
    url: '/form/attributeForm',
    type: 'post',
    response: (req, res, next) => {
      // req.body 可获取post参数
      // req.query 可获取get参数
      return new Promise((res, rej) => {
        setTimeout(() => {
          res({
            body: {
              name: "李三",
              sortNo: 2,
              isCycle: Math.round(Math.random()),
              isUse: Math.round(Math.random()),
              dateStart: '2015-06-06',
              dateEnd: '2015-06-06',
              testType: ["A", "B"],
              isDefault: true,
              url: "99"
            },
            head: {
              errorCode: '0',
              data: null
            }
          })
        }, 2000)
      })
    }
  }
]
