mockJS

作者: 4leafclover | 来源:发表于2021-01-21 11:54 被阅读0次
    'GET /monix/data/getDict': (req: any, res: any) => {
        // 添加跨域请求头
        const common = {
          errorCode: 'E000000',
          msg: '调用成功',
          success: '1',
          data: {},
        }
        let data = {}
        switch (req.query.dictType) {
          case '0': {
            data = {
              data: {
                dataList: [
                  {code: "D", name: "DIVORCE"}
                  ,{code: "N", name: "MARRIED-NONREGISTERED"}
                  ,{code: "R", name: "MARRIED-REGISTERED"}
                  ,{code: "O", name: "OTHERS"}
                  ,{code: "S", name: "SEPARATE"}
                  ,{code: "U", name: "SINGLE"}
                  ,{code: "W", name: "WIDOW"}
                ],
              },
            }
            break
          }
          case '1': {
            data = {
              data: {
                dataList: [
                  {code: "16", name: "BACHELOR'S DEGREE"}
                  ,{code: "20", name: "DOCTORATE'S DEGREE"}
                  ,{code: "12", name: "HIGH SCHOOL"}
                  ,{code: "14", name: "HIGH VOCATIONAL CERTIFICATE/DIPLOMA"}
                  ,{code: "18", name: "MASTER'S DEGREE"}
                  ,{code: "22", name: "OTHERS"}
                  ,{code: "10", name: "PRIMARY SCHOOL"}
                  ,{code: "13", name: "VOCATIONAL CERTIFICATE"}
                ],
              },
            }
            break
          }
          case '2': {
            data = {
              data: {
                dataList: [
                  {code: "Ms", name: "Miss/Ms."}
                  ,{code: "Mr", name: "Mr."}
                  ,{code: "Mrs", name: "Mrs."}
                ],
              },
            }
            break
          }
          case '3': {
            data = {
              data: {
                dataList: [
                  {code: "1", name: "Business owner"}
                  ,{code: "2", name: "Employee"}
                  ,{code: "3", name: "Self-employed"}
                ],
              },
            }
            break
          }
        }
        res.json({ ...common, ...data })
      },
    

    相关文章

      网友评论

          本文标题:mockJS

          本文链接:https://www.haomeiwen.com/subject/yabrzktx.html