export default {
  id: 'answer',
  title: '学习目的',
  showProgress: true,
  progress: 0,
  get: {
    action: '/zws/v1/enrollment/answers?project_id=1001',
    callback(data) {
      let [first = {}, second = {}] = data
      return {
        qid1: first.qid || 1,
        question1:
          first.question ||
          '您为什么要申请美国印第安纳大学Kelley商学院金融学硕士项目？（200字以上，1000字以内）',
        answer1: first.answer,
        qid2: second.qid || 2,
        question2:
          second.question ||
          '您的短期和长期职业发展目标是什么？您打算如何达成此愿景？（200字以上，1000字以内）',
        answer2: second.answer
      }
    }
  },
  update: {
    action: '/zws/v1/enrollment/answers/batch-upload',
    data: { project_id: 1001 },
    beforeRequest(data) {
      return {
        records: [
          { qid: data.qid1, question: data.question1, answer: data.answer1 },
          { qid: data.qid2, question: data.question2, answer: data.answer2 }
        ]
      }
    }
  },
  form: {
    items: [
      {
        type: 'input-form',
        label:
          '您为什么要申请美国印第安纳大学Kelley商学院金融学硕士项目？（200字以上，1000字以内）',
        model: 'answer1',
        attrs: {
          type: 'textarea',
          rows: '8',
          maxlength: '1000',
          'show-word-limit': true
        },
        rules: [
          {
            required: true,
            message: '请输入',
            trigger: 'blur'
          },
          {
            min: 200,
            max: 1000,
            message: '长度在 200 到 1000 个字符',
            trigger: 'blur'
          }
        ]
      },
      {
        type: 'input-form',
        label:
          '您的短期和长期职业发展目标是什么？您打算如何达成此愿景？（200字以上，1000字以内）',
        model: 'answer2',
        attrs: {
          type: 'textarea',
          rows: '8',
          maxlength: '1000',
          'show-word-limit': true
        },
        rules: [
          {
            required: true,
            message: '请输入',
            trigger: 'blur'
          },
          {
            min: 200,
            max: 1000,
            message: '长度在 200 到 1000 个字符',
            trigger: 'blur'
          }
        ]
      }
    ]
  }
}
