保誠-保戶業務員媒合平台
Tomas
2022-01-03 9d0a0b68efa0d25d340ce732188da4708cb2f2ff
refactor: [editConsultant]
修改2個檔案
49 ■■■■■ 已變更過的檔案
PAMapp/components/editConsultantAvatar.vue 36 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/agentInfo/edit/_agentNo.vue 13 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/components/editConsultantAvatar.vue
@@ -6,7 +6,7 @@
      ref="upload"
      action="#"
      :auto-upload="false"
      :on-change="handleAvatarSuccess"
      :on-change="handleAvatarUploaded"
      :show-file-list="false"
      accept="image/png, image/jpeg, image/jpg">
        <el-avatar
@@ -28,11 +28,13 @@
</template>
<script lang="ts">
  import { Vue, Component, Prop, PropSync } from 'nuxt-property-decorator';
  import { MessageBox } from 'element-ui';
  import { MessageBoxData } from 'element-ui/types/message-box';
  import { Vue, Component, Prop, PropSync } from 'nuxt-property-decorator';
  import myConsultantService from '~/shared/services/my-consultant.service';
  import _ from 'lodash';
  import myConsultantService from '~/shared/services/my-consultant.service';
  @Component
  export default class editConsultantAvatar extends Vue {
@@ -52,29 +54,29 @@
      if(this.agentNo) this.initConsultantAvatar()
    }
    initConsultantAvatar(): void {
    private initConsultantAvatar(): void {
      myConsultantService.getConsultantAvatar(this.agentNo)
      .then(base64=>
       this.splitBase64WithCommon(base64)
      )
    }
    handleAvatarSuccess(file:any, fileList:any) {
      const isFollowUploadRule =_.includes(file.raw.type,'image/');
      isFollowUploadRule ? this.getImgSrc(file) : this.showErrorMsg()
    }
    getImgSrc(file:any):void{
      const blob = file.raw;
      this.blobToBase64(blob).then(base64=>{
        this.splitBase64WithCommon(base64 as string);
      });
    }
    //////////////////////////////////////////////////////////////////////
    resetAvatar(): void {
      this.imgSrc = this._imgSrc;
    }
    handleAvatarUploaded(file:any): void {
      const isFollowUploadRule =_.includes(file.raw.type,'image/');
      isFollowUploadRule ? this.getImgSrc(file) : this.showFileUploadErrorMsg()
    }
    private getImgSrc(file:any):void{
      const blob = file.raw;
      this.blobToBase64(blob).then(base64=>{
        this.splitBase64WithCommon(base64 as string);
      });
    }
    private blobToBase64(blob:File):Promise<string | ArrayBuffer | null> {
@@ -98,7 +100,7 @@
      this.imgSrc = base64;
    }
    private showErrorMsg():Promise<MessageBoxData>{
    private showFileUploadErrorMsg():Promise<MessageBoxData>{
       return MessageBox({
          message:`<div class="message-header">上傳格式有誤</div>
                    <div class="message-content">請上傳正確圖檔</div>`,
PAMapp/pages/agentInfo/edit/_agentNo.vue
@@ -3,7 +3,9 @@
      <el-row
        type="flex"
        justify="center">
        <EditConsultantAvatar :agentNo="agentInfo.agentNo" :photoBase64.sync="editInfoValue.photoBase64"/>
        <EditConsultantAvatar
          :agentNo="agentInfo.agentNo"
          :photoBase64.sync="editInfoValue.photoBase64"/>
      </el-row>
      <el-row
        type="flex"
@@ -203,7 +205,7 @@
@Component
export default class AgentInfoComponent extends Vue {
  @Prop({type:Object ,}) aa!:any;
  @localStorageTest.State('current_role')
  currentRole!:string | null;
@@ -233,6 +235,7 @@
  communicationStyleList: string[] = agentCommunicationStyleList;
  role           = Role;
  agentExpertList = [
    {
        title:'健康與保障',
@@ -290,7 +293,6 @@
    this.setAgentInfo(this.agentInfo);
  }
  /////////////////////////////////////////////////////////////////////////////
  private setAgentInfo(agentInfo: AgentInfo): void {
    const [agentYear, _yearUnit , agentMonth, _monthUnit] =  agentInfo.seniority.split(" ");
    this._agentInfoSetting = {
@@ -321,15 +323,15 @@
  }
  //////////////////////////////////////////////////////////////////////
  editAgentInfoSetting(): void {
    const editSettingInfo: any = {
      ...this.editInfoValue,
      communicationStyle: this.editInfoValue.communicationStyle.join('、'),
    }
    accountSettingService.editAgentInfoSetting(editSettingInfo).then((res: AgentInfoSetting) => {
      console.log(editSettingInfo)
    });
    this.isInfoUpdate = true;
    });
  }
  backToInfo() {
@@ -342,6 +344,7 @@
            this.editInfoValue.communicationStyle.shift();
        }
  }
  alertFieldInfo(field: string): void {
    this.isAlertFieldInfo = true;
    switch(field) {