export default {
  id: 'profile',
  title: '个人信息',
  showProgress: true,
  progress: 0,
  get: {
    action: '/zws/v1/enrollment/profiles?project_id=1001',
    callback(data) {
      data.date_of_starting_to_work = data.date_of_starting_to_work + ''
      data.city = `${data.address_province + ''}-${data.address_city + ''}`
      return data
    }
  },
  update: {
    action: '/zws/v1/enrollment/profiles',
    data: { project_id: 1001 },
    beforeRequest(data) {
      let [province, city] = data.city.split('-')
      data.address_province = province
      data.address_city = city
      return [
        'real_name_cn',
        'real_name_en',
        'id_type',
        'id_number',
        'birthday',
        'gender',
        'nationality',
        'address_province',
        'address_city',
        'date_of_starting_to_work',
        'phone_number',
        'email',
        'qq_account',
        'we_chat_account',
        'mailing_address',
        'emergency_contact_name',
        'emergency_contacts_phone',
        'english_level',
        'english_score',
        'channel'
      ].reduce((result, key) => {
        result[key] = data[key]
        return result
      }, {})
    }
  },
  form: {
    options: {
      labelWidth: '150px'
    },
    items: [
      {
        type: 'input-form',
        label: '姓名',
        model: 'real_name_cn',
        placeholder: '请输入姓名',
        rules: [{ required: true, message: '请输入姓名', trigger: 'blur' }]
      },
      {
        type: 'input-form',
        label: '英文名（姓名全拼）',
        model: 'real_name_en',
        placeholder: '请输入英文名',
        rules: [{ required: true, message: '请输入英文名', trigger: 'blur' }]
      },
      {
        type: 'select-form',
        values: [
          { label: '居民身份证', value: 0 },
          { label: '港澳台身份证', value: 1 },
          { label: '护照号', value: 2 },
          { label: '军官证', value: 3 },
          { label: '其他', value: 9 }
        ],
        label: '证件类型',
        model: 'id_type',
        placeholder: '请选择证件类型',
        rules: [
          { required: true, message: '请选择证件类型', trigger: 'change' }
        ]
      },
      {
        type: 'input-form',
        label: '证件号码',
        model: 'id_number',
        placeholder: '请输入证件号码',
        rules: [{ required: true, message: '请输入证件号码', trigger: 'blur' }]
      },
      {
        type: 'date-picker-form',
        elemType: 'date',
        label: '出生日期',
        model: 'birthday',
        placeholder: '请选择出生日期',
        attrs: { 'value-format': 'yyyy-MM-dd' },
        rules: [{ required: true, message: '请选择出生日期', trigger: 'blur' }]
      },
      {
        type: 'radio-group-form',
        values: [
          { label: '男', value: 1 },
          { label: '女', value: 2 }
        ],
        label: '性别',
        model: 'gender',
        rules: [{ required: true, message: '请选择性别', trigger: 'change' }]
      },
      {
        type: 'select-form',
        values: [
          { label: '中国', value: 1 },
          { label: '其他国家', value: 9 }
        ],
        label: '国籍',
        model: 'nationality',
        placeholder: '请选择国籍',
        rules: [{ required: true, message: '请选择国籍', trigger: 'blur' }]
      },
      {
        type: 'city-select-form',
        label: '现居住城市',
        model: 'city',
        separator: '-',
        rules: [{ required: true, message: '请选择居住城市', trigger: 'blur' }]
      },
      {
        type: 'date-picker-form',
        elemType: 'year',
        label: '参加工作年份',
        model: 'date_of_starting_to_work',
        attrs: { 'value-format': 'yyyy' },
        placeholder: '请选择参加工作年份',
        rules: [
          { required: true, message: '请选择参加工作年份', trigger: 'blur' }
        ]
      },
      {
        type: 'input-form',
        label: '手机号',
        model: 'phone_number',
        placeholder: '请输入手机号',
        rules: [{ required: true, message: '请输入手机号', trigger: 'blur' }]
      },
      {
        type: 'input-form',
        label: '邮箱',
        model: 'email',
        placeholder: '请输入邮箱',
        rules: [{ required: true, message: '请输入邮箱', trigger: 'blur' }],
        hint: '（后续报名信息将发送至此邮箱，请认真填写）'
      },
      {
        type: 'input-form',
        label: 'QQ号',
        model: 'qq_account',
        placeholder: '请输入QQ号',
        rules: [{ required: true, message: '请输入QQ号', trigger: 'blur' }]
      },
      {
        type: 'input-form',
        label: '微信号',
        model: 'we_chat_account',
        placeholder: '请输入微信号',
        rules: [{ required: true, message: '请输入微信号', trigger: 'blur' }]
      },
      {
        type: 'input-form',
        label: '邮寄地址',
        model: 'mailing_address',
        placeholder: '请输入邮寄地址',
        rules: [{ required: true, message: '请输入邮寄地址', trigger: 'blur' }]
      },
      {
        type: 'input-form',
        label: '紧急联系人',
        model: 'emergency_contact_name',
        placeholder: '请输入紧急联系人',
        rules: [
          { required: true, message: '请输入紧急联系人', trigger: 'blur' }
        ]
      },
      {
        type: 'input-form',
        label: '紧急联系电话',
        model: 'emergency_contacts_phone',
        placeholder: '请输入紧急联系电话',
        rules: [
          { required: true, message: '请输入紧急联系电话', trigger: 'blur' }
        ]
      },
      {
        type: 'select-form',
        values: [
          { label: '请选择', value: 0 },
          { label: '四级', value: 4 },
          { label: '六级', value: 3 },
          { label: '托福', value: 1 },
          { label: '雅思', value: 2 }
        ],
        label: '英语水平',
        model: 'english_level',
        rules: [
          { required: true, message: '请选择英语水平', trigger: 'change' }
        ]
      },
      {
        type: 'input-form',
        label: '托福/雅思成绩',
        model: 'english_score',
        rules: [
          { required: true, message: '请输入托福/雅思成绩', trigger: 'blur' }
        ]
      },
      {
        type: 'select-form',
        values: [
          { label: '请选择', value: 0 },
          { label: '紫荆教育官方网站', value: 11 },
          { label: '紫荆教育官方微信公众号', value: 12 },
          { label: '紫荆教育学位项目老学员推荐', value: 13 },
          { label: '紫荆教育Kelley项目系列活动', value: 14 },
          {
            label: '紫荆教育其他活动公开课、大讲堂、沙龙等',
            value: 15
          },
          { label: '紫荆教育员工或者老师推荐', value: 16 },
          { label: '公司人力资源推荐', value: 17 },
          {
            label: '报纸杂志网站广告微博微信公众号论坛等第三方媒体、社交平台',
            value: 18
          },
          {
            label: '网络搜索，如百度、必应、谷歌等',
            value: 19
          },
          { label: '其他', value: 9 }
        ],
        label: '了解途径',
        model: 'channel',
        defaultValue: 0,
        rules: [
          { required: true, message: '请选择了解途径', trigger: 'change' }
        ]
      }
    ]
  }
}
