<template>
  <div id="loginMain">
    <el-row class="loginMains">
      <el-col :span="6"><p>&nbsp;</p></el-col>
      <el-col :span="12">
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane label="登录" name="first">
            <el-col :span="24">
              <el-form ref="form" :model="form" label-width="80px">
                <el-form-item label="用户名称">
                  <el-input v-model="form.name" placeholder="请输入用户名称"></el-input>
                </el-form-item>
                <el-form-item label="登录密码">
                  <el-input v-model="form.password" placeholder="请输入登录密码"></el-input>
                </el-form-item>
                <el-form-item label="用户类别">
                  <el-radio v-model="form.role" label="1">管理员</el-radio>
                  <el-radio v-model="form.role" label="2">个人</el-radio>
                  <el-radio v-model="form.role" label="3">企业管理员</el-radio>
                </el-form-item>
                <el-col :span="24" class="loginSubmit"><el-button type="primary" @click="loginSubmit">登录</el-button></el-col>
              </el-form>
            </el-col>
          </el-tab-pane>
          <el-tab-pane label="注册" name="second">
            <el-col :span="24">
              <el-form ref="forms" :model="forms" label-width="80px">
                <el-form-item label="用户名称">
                  <el-input v-model="forms.name" placeholder="请输入用户名称"></el-input>
                </el-form-item>
                <el-form-item label="登录密码">
                  <el-input v-model="forms.password" placeholder="请输入登录密码" show-password></el-input>
                </el-form-item>
                <el-form-item label="身份证号">
                  <el-input v-model="forms.cardnumber" placeholder="请输入身份证号"></el-input>
                </el-form-item>
                <el-form-item label="电话号码">
                  <el-input v-model="forms.phone" placeholder="请输入电话号码"></el-input>
                </el-form-item>
                <el-form-item label="邮箱">
                  <el-input v-model="forms.email" placeholder="请输入邮箱"></el-input>
                </el-form-item>
                <el-form-item label="地址">
                  <el-input v-model="forms.addr" placeholder="请输入地址"></el-input>
                </el-form-item>
                <el-form-item label="头像图片" prop="img_path">
                  <upload :limit="1" :data="forms.img_path" type="imgpath" :url="'/files/imgpath/upload'" @upload="uploadSuccess"></upload>
                </el-form-item>
                <el-form-item label="个人/法人">
                  <el-radio v-model="forms.is_qy" label="0">个人</el-radio>
                  <el-radio v-model="forms.is_qy" label="1">法人</el-radio>
                </el-form-item>
                <el-form-item label="身份证正面">
                  <upload :limit="1" :data="forms.cardfile_a" type="cardfilea" :url="'/files/cardfilea/upload'" @upload="uploadSuccess"></upload>
                </el-form-item>
                <el-form-item label="身份证背面">
                  <upload :limit="1" :data="forms.cardfile_b" type="cardfileb" :url="'/files/cardfileb/upload'" @upload="uploadSuccess"></upload>
                </el-form-item>
                <el-form-item label="组织机构图片">
                  <upload :limit="1" :data="forms.img_qy" type="imgqy" :url="'/files/imgqy/upload'" @upload="uploadSuccess"></upload>
                </el-form-item>
                <el-form-item label="个人简介" placeholder="请输入个人简介">
                  <el-input type="textarea" v-model="forms.resume"></el-input>
                </el-form-item>
                <el-form-item label="专业领域" placeholder="请输入专业领域">
                  <el-input v-model="forms.major"></el-input>
                </el-form-item>
                <el-form-item label="机构类型" placeholder="请输入机构类型">
                  <el-input v-model="forms.institution_type"></el-input>
                </el-form-item>
                <el-form-item label="机构名称" placeholder="请输入机构名称">
                  <el-input v-model="forms.institution_name"></el-input>
                </el-form-item>
                <el-form-item label="机构代码" placeholder="请输入机构代码">
                  <el-input v-model="forms.institution_code"></el-input>
                </el-form-item>
                <el-form-item label="机构性质" placeholder="请输入机构性质">
                  <el-input v-model="forms.institution_nature"></el-input>
                </el-form-item>
                <el-form-item label="办公电话" placeholder="请输入办公电话">
                  <el-input v-model="forms.office_phone"></el-input>
                </el-form-item>
                <el-form-item label="所属行业" placeholder="请输入所属行业">
                  <el-input v-model="forms.profession"></el-input>
                </el-form-item>
                <el-form-item label="用户类别">
                  <el-radio v-model="forms.role" label="1">管理员</el-radio>
                  <el-radio v-model="forms.role" label="2">个人</el-radio>
                  <el-radio v-model="forms.role" label="3">企业管理员</el-radio>
                </el-form-item>
                <el-col :span="24" class="loginSubmit"><el-button type="primary" @click="registerSubmit">登录</el-button></el-col>
              </el-form>
            </el-col>
          </el-tab-pane>
        </el-tabs>
      </el-col>
      <el-col :span="6"><p>&nbsp;</p></el-col>
    </el-row>
  </div>
</template>

<script>
import upload from '@/components/upload.vue';
export default {
  name: 'loginMain',
  props: {
    form: null,
    forms: null,
  },
  components: {
    upload,
  },
  data: () => ({
    activeName: 'first',
  }),
  created() {},
  computed: {},
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
    },
    loginSubmit() {
      this.$emit('submitDate', { data: this.form, id: this.form.id });
    },
    registerSubmit() {
      this.$emit('submitDates', { data: this.forms, id: this.forms.id });
    },
    uploadSuccess({ type, data }) {
      this.$set(this.forms, `${type}`, data.uri);
    },
  },
};
</script>

<style lang="less" scoped>
.loginMains {
  min-height: 800px;
  padding: 40px 0;
  background-color: #fff;
}
/deep/.el-tabs__header {
  margin: 0;
}
/deep/.el-tabs__nav-wrap::after {
  background-color: transparent;
}
/deep/.el-tabs--top .el-tabs__item.is-top:nth-child(2) {
  padding-left: 50px;
}
/deep/.el-tabs--top .el-tabs__item.is-top:last-child {
  padding-right: 50px;
}
/deep/.el-tabs__active-bar {
  background-color: transparent;
}
/deep/.el-tabs__nav {
  margin: 0 130px;
}
/deep/.el-tabs__item {
  padding: 0 60px;
  height: 70px;
  line-height: 70px;
  font-size: 30px;
}
.loginSubmit {
  text-align: center;
}
</style>
