mark
2022-10-25 f20a554bdb24e9dfde9dc6a69d78595944f61d15
src/views/register/components/SelectType.vue
@@ -7,26 +7,30 @@
      :validate-on-rule-change="false"
      label-width="76px"
    >
      <el-form-item label="类型" prop="type">
      <el-form-item label="类型" prop="userType">
        <el-radio-group
          v-model="info.type"
          v-model="info.userType"
          style="float: left; margin-top: 15px"
        >
          <el-radio :label="1">个人</el-radio>
          <el-radio :label="2">公司</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="真实姓名" prop="trueName" v-show="info.type == '1'">
      <el-form-item
        label="真实姓名"
        prop="trueName"
        v-show="info.userType == '1'"
      >
        <el-input v-model="info.trueName" placeholder="请输入"></el-input>
      </el-form-item>
      <el-form-item
        label="公司名称"
        prop="companyName"
        v-show="info.type == '2'"
        v-show="info.userType == '2'"
      >
        <el-input v-model="info.companyName" placeholder="请输入"></el-input>
      </el-form-item>
      <el-form-item label="联系人" prop="contact" v-show="info.type == '2'">
      <el-form-item label="联系人" prop="contact" v-show="info.userType == '2'">
        <el-input v-model="info.contact" placeholder="请输入"></el-input>
      </el-form-item>
      <el-form-item label="邮箱" prop="email">
@@ -124,9 +128,9 @@
  },
  computed: {
    infoRules() {
      if (this.info.type == 1) {
      if (this.info.userType == 1) {
        return {
          type: [{ required: true, message: "请选择类型" }],
          userType: [{ required: true, message: "请选择类型" }],
          trueName: [
            { required: true, message: "请填写真实姓名", trigger: "change" },
          ],
@@ -134,7 +138,7 @@
        };
      } else {
        return {
          type: [{ required: true, message: "请选择类型" }],
          userType: [{ required: true, message: "请选择类型" }],
          companyName: [
            { required: true, message: "请填写公司名称", trigger: "change" },
          ],
@@ -146,11 +150,15 @@
      }
    },
    disabled() {
      if (this.info.type == 1 && this.info.trueName) {
      if (this.info.userType == 1 && this.info.trueName) {
        return false;
      }
      if (this.info.type == 2 && this.info.companyName && this.info.contact) {
      if (
        this.info.userType == 2 &&
        this.info.companyName &&
        this.info.contact
      ) {
        return false;
      }
@@ -169,6 +177,14 @@
          });
          this.info.provinceId = this.info.address[0];
          this.info.areaId = this.info.address[1];
          for (const key in this.info) {
            if (this.info[key] === "") {
              delete this.info[key];
            }
          }
          if (this.info.userType == 2) {
            this.info.trueName = this.info.companyName;
          }
          entireUserInfo(this.info)
            .then(() => {
              this.loading.close();
@@ -185,11 +201,6 @@
            })
            .catch((err) => {
              this.loading.close();
              //后门
              this.$router.push({
                path: "/register/success",
                query: { info: this.userInfo },
              });
              this.$notify({
                type: "error",
                message: err.msg,
@@ -310,8 +321,8 @@
}
</style>
<style lang="scss">
.industrySelect.el-select-dropdown.el-popper {
<style lang="scss" >
.industrySelect.el-select-dropdown.el-popper ::v-deep {
  margin: 0;
  .el-scrollbar {
@@ -353,10 +364,14 @@
.el-popper.el-cascader__dropdown.selectCascader {
  border: none;
  margin: 0;
  width: auto !important;
  * {
    color: #3d3d3d;
    border-color: rgba(255, 255, 2555, 0.1);
  }
  .el-cascader-panel {
    height: 158px !important;
  }
  .in-active-path {
@@ -403,5 +418,13 @@
    width: 230px;
    height: 175px;
  }
  .el-scrollbar__view {
    overflow: hidden;
  }
  .el-cascader-node__postfix::before {
    display: none !important;
  }
}
</style>