<template>
  <div id="mainInfo">
    <el-row>
      <el-col :span="24" class="info">
        <el-col :span="24" class="login">
          <el-tabs v-model="activeName">
            <el-tab-pane label="登录" name="first" class="dengli">
              <el-form ref="form" :model="forms" label-width="0px">
                <el-form-item label="">
                  <el-radio-group v-model="form.role">
                    <el-radio label="管理员"></el-radio>
                    <el-radio label="企业管理员 "></el-radio>
                    <el-radio label="个人"></el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item> <el-input v-model="forms.name" placeholder="用户名"></el-input> </el-form-item>
                <el-form-item> <el-input v-model="forms.password" placeholder="密码"></el-input> </el-form-item>
                <el-button type="primary" @click="clickUrldl(forms)">登录</el-button>
              </el-form>
            </el-tab-pane>
            <el-tab-pane label="注册" name="second">
              <el-form ref="form" :model="form" label-width="0px">
                <el-form-item label="">
                  <el-radio-group v-model="form.role">
                    <el-radio label="管理员"></el-radio>
                    <el-radio label="企业管理员 "></el-radio>
                    <el-radio label="个人"></el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item> <el-input v-model="form.name" placeholder="用户名称"></el-input> </el-form-item>
                <el-form-item> <el-input v-model="form.password" placeholder="登录密码"></el-input> </el-form-item>

                <el-form-item> <el-input v-model="form.cardnumber" placeholder="身份证号"></el-input> </el-form-item>
                <el-form-item> <el-input v-model="form.phone" placeholder="电话号码"></el-input> </el-form-item>
                <el-form-item> <el-input v-model="form.email" placeholder="邮箱"></el-input> </el-form-item>

                <!-- <el-form-item label="头像图片" label-width="4.5rem">
                  <el-upload
                    class="avatar-uploader"
                    action="https://jsonplaceholder.typicode.com/posts/"
                    :show-file-list="false"
                    :on-success="handleAvatarSuccess"
                    :before-upload="beforeAvatarUpload"
                  >
                    <img v-if="imageUrl" :src="form.img_path" class="avatar" />
                    <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                  </el-upload>
                </el-form-item>

                <el-form-item label="身份证正面" label-width="5.5rem">
                  <el-upload
                    class="avatar-uploader"
                    action="https://jsonplaceholder.typicode.com/posts/"
                    :show-file-list="false"
                    :on-success="handleAvatarSuccess"
                    :before-upload="beforeAvatarUpload"
                  >
                    <img v-if="imageUrl" :src="form.cardfile_a" class="avatar" />
                    <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                  </el-upload>
                </el-form-item>

                <el-form-item label="身份证背面" label-width="5.5rem">
                  <el-upload
                    class="avatar-uploader"
                    action="https://jsonplaceholder.typicode.com/posts/"
                    :show-file-list="false"
                    :on-success="handleAvatarSuccess"
                    :before-upload="beforeAvatarUpload"
                  >
                    <img v-if="imageUrl" :src="form.cardfile_b" class="avatar" />
                    <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                  </el-upload>
                </el-form-item> -->
                <!-- <el-form-item label="组织机构图片" label-width="6.5rem">
                  <el-upload
                    class="avatar-uploader"
                    action="https://jsonplaceholder.typicode.com/posts/"
                    :show-file-list="false"
                    :on-success="handleAvatarSuccess"
                    :before-upload="beforeAvatarUpload"
                  >
                    <img v-if="imageUrl" :src="form.img_qy" class="avatar" />
                    <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                  </el-upload>
                </el-form-item> -->

                <el-form-item> <el-input v-model="form.address" placeholder="地址"></el-input> </el-form-item>
                <el-form-item label="">
                  <el-radio-group v-model="form.is_qy">
                    <el-radio label="个人" value="0"></el-radio>
                    <el-radio label="法人" value="1"></el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item> <el-input v-model="form.institution_type" placeholder="机构类型"></el-input> </el-form-item>
                <el-form-item> <el-input v-model="form.institution_name" placeholder="机构名称"></el-input> </el-form-item>
                <el-form-item> <el-input v-model="form.institution_code" placeholder="机构代码"></el-input> </el-form-item>
                <el-form-item> <el-input v-model="form.institution_nature" placeholder="机构性质"></el-input> </el-form-item>
                <el-form-item> <el-input v-model="form.office_phone" placeholder="办公电话"></el-input> </el-form-item>
                <el-form-item> <el-input v-model="form.profession" placeholder="所属行业"></el-input> </el-form-item>
                <el-form-item> <el-input v-model="form.token" placeholder="令牌"></el-input> </el-form-item>
                <!-- <el-button type="primary" @click="submitForm('ruleForm')">注册</el-button> -->
                <el-button type="primary" @click="clickUrl()">注册</el-button>
              </el-form>
            </el-tab-pane>
          </el-tabs>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'mainInfo',
  props: {
    form: null,
    forms: null,
  },
  components: {},
  data: () => ({
    activeName: 'second',
  }),
  created() {},
  computed: {},
  methods: {
    clickUrl() {
      this.$emit('onsave', { data: this.form });
    },
    // handleAvatarSuccess(res, file) {
    //   this.imageUrl = URL.createObjectURL(file.raw);
    // },
    // beforeAvatarUpload(file) {
    //   const isJPG = file.type === 'image/jpeg';
    //   const isLt2M = file.size / 1024 / 1024 < 2;

    //   if (!isJPG) {
    //     this.$message.error('上传头像图片只能是 JPG 格式!');
    //   }
    //   if (!isLt2M) {
    //     this.$message.error('上传头像图片大小不能超过 2MB!');
    //   }
    //   return isJPG && isLt2M;
    // },
  },
};
</script>

<style lang="less" scoped>
// .shangchuan {
//   height: 100px;
// }
.info {
  height: 1800px;
  overflow: hidden;
  background-color: #fff;
}
.info .image {
  width: 100%;
  height: 560px;
}
.info .login {
  position: absolute;
  right: 450px;
  top: 60px;
  width: 300px;
  height: 420px;
}

/deep/.el-tabs--top .el-tabs__item.is-top:nth-child(2) {
  padding-left: 65px;
}
/deep/.el-tabs__item {
  padding: 0px 60px 0 0px;
  height: 40px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  line-height: 40px;
  text-align: center;
  display: inline-block;
  list-style: none;
  font-size: 24px;
  font-weight: 500;
  color: #303133;
  position: relative;
  width: 150px;
}

/deep/.el-button--primary {
  color: #fff;
  background-color: #409eff;
  border-color: #409eff;
  width: 300px;
}

/deep/.el-form-item__content {
  line-height: 20px;
  position: relative;
  font-size: 14px;
  height: 24px;
}

/deep/.el-input__inner {
  -webkit-appearance: none;
  border-radius: 0px;

  color: #606266;
  font-size: inherit;
  height: 30px;
  line-height: 30px;
  outline: 0;
  padding: 0 15px;
  width: 100%;
}
.denglu {
  width: 150px;
}

.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  margin: 0px 0 0 48px;
  font-size: 28px;
  color: #8c939d;
  width: 100px;
  height: 100px;
  line-height: 45px;
  text-align: center;
}
.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>
