<template>
  <div id="form-1">
    <van-row>
      <van-col span="24" class="main">
        <van-form @submit="onSubmit" label-width="4em">
          <van-field name="radio" label="用户类型" :rules="[{ required: true, message: '用户类型' }]">
            <template #input>
              <van-radio-group v-model="form.type" direction="horizontal">
                <van-radio name="1">咨询师</van-radio>
                <van-radio name="2">代理师</van-radio>
                <van-radio name="3">分析师</van-radio>
              </van-radio-group>
            </template>
          </van-field>
          <van-field v-model="form.phone" name="phone" label="账号" :rules="[{ required: true, message: '账号' }]" />
          <van-field v-model="form.name" name="name" label="联系电话" :rules="[{ required: true, message: '联系电话' }]" />
          <van-field
            v-model="form.password"
            name="password"
            label="登录密码"
            type="password"
            :rules="[{ required: true, message: '登录密码' }]"
            v-if="!form.id"
          />
          <van-field v-model="form.card" name="card" label="身份证号" :rules="[{ required: false, message: '身份证号' }]" />
          <van-field v-model="form.email" name="email" label="电子邮箱" :rules="[{ required: false, message: '电子邮箱' }]" />
          <van-field v-model="form.address" name="address" label="联系地址" :rules="[{ required: false, message: '联系地址' }]" />
          <van-field v-model="form.zwzc" name="zwzc" label="职务职称" :rules="[{ required: false, message: '职务职称' }]" />
          <van-field v-model="form.school" name="school" label="院校" :rules="[{ required: false, message: '院校' }]" />
          <van-field v-model="form.major" name="major" label="专业" :rules="[{ required: false, message: '专业' }]" />
          <van-field v-model="form.word_tel" name="word_tel" label="办公电话" :rules="[{ required: false, message: '办公电话' }]" />
          <div style="margin: 16px">
            <van-button round block type="info" native-type="submit">提交</van-button>
          </div>
        </van-form>
      </van-col>
    </van-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'form-1',
  props: {
    form: { type: Object },
  },
  components: {},
  data: function () {
    return {};
  },
  created() {},
  methods: {
    onSubmit() {
      this.$emit('onSubmit', this.form);
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped></style>
