保誠-保戶業務員媒合平台
wayne
2022-02-17 a3716f72066d25d745f4d5103ff23a553c3e102b
PAMapp/components/careerSelect.vue
@@ -1,6 +1,6 @@
<template>
  <div>
    <div class="mdTxt pt-10 pb-10">職業</div>
    <div class="mdTxt pt-10 pb-10">您的職業</div>
      <div class="ques-career__select" @click="openPopUp">
        <div class="ques-career__select-input">
          <span v-if="!syncCareerSelect">請選擇</span>
@@ -10,9 +10,9 @@
          <i class="icon-down down-icon"></i>
        </div>
      </div>
      <PopUpFrame :isOpen.sync="showJobDrawer">
      <PopUpFrame :isOpen.sync="showJobDrawer" :dialogWidth="'400px'">
        <div class="pam-career">
          <div class="subTitle">職業</div>
          <div class="subTitle">您的職業</div>
          <el-radio-group class="pam-single__select--col" v-model="career" @change="handleChange">
            <el-radio-button v-for="(career,index) in options"
              :key="index"
@@ -20,14 +20,16 @@
              {{career.title}}
            </el-radio-button>
          </el-radio-group>
          <div class="mt-10" v-if="career === '其他'">
            <input class="pam-career__other-input"
          <div class="mt-20 h-50 pam-career__other">
            <input
              v-if="career === '其他'"
              class="pam-career__other-input"
              :class="{'warning':!career_Other}"
              v-model="career_Other" >
          </div>
          <el-button type="primary"
            class="pam-career__confirm"
            :disabled="isCareerVerifyFailed"
            :disabled="!isCareerValid"
            @click="patchCareer">
              確定
          </el-button>
@@ -35,18 +37,22 @@
      </PopUpFrame>
  </div>
</template>
<script lang="ts">
  import { Component , PropSync , Vue} from "vue-property-decorator";
  import * as _ from 'lodash';
  @Component
  export default class CareerSelect extends Vue {
    @PropSync('careerSelect',{ type: String, default :''}) syncCareerSelect! :string;
    @PropSync('careerSelect',{ type: String, default :''})
    syncCareerSelect! :string;
    showJobDrawer = false;
    career='';
    career_Other='';
    options= [
      {
        title:'外勤',
@@ -61,9 +67,9 @@
        label:'其他'
      }
    ];
    get isCareerVerifyFailed():boolean{
      return !this.career || (_.isEqual(this.career,'其他')&&!this.career_Other) ;
    }
    //////////////////////////////////////////////////////////////////////
    handleChange(event:any):void{
      if(event !== '其他'){
        this.career_Other='';
@@ -86,10 +92,17 @@
      }
    }
    patchCareer():boolean {
    patchCareer(): void {
      this.showJobDrawer = false;
      this.syncCareerSelect = this.career === '其他' ? _.cloneDeep(this.career_Other):_.cloneDeep(this.career);
      return true;
      this.syncCareerSelect = this.career === '其他'
                          ? _.cloneDeep(this.career_Other)
                          : _.cloneDeep(this.career);
    }
    get isCareerValid(): boolean {
      return !!(this.career === '其他'
            ? this.career_Other
            : this.career);
    }
  }
</script>
@@ -127,23 +140,30 @@
      }
    }
  }
  .h-50 {
    height: 50px;
  }
  .pam-career__other {
    width: 100%;
  .pam-career__other-input{
    height: 50px;
    width: 100%;
    border: 1px #CCCCCC solid;
    width: 300px;
      width             : 100%;
    padding-left: 15px;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
      border-radius     : 10px;
    &.warning{
      border: 1px $PRIMARY_RED solid;
    }
  }
  }
  .pam-career__confirm{
    width: 120px;
    height: 50px;
    margin-top: 30px;
    margin-top: 20px;
  }
</style>