保誠-保戶業務員媒合平台
53eed97a753c8fe36fd021168e106eccb86713be..f316bd2d97efb54ef48fde17b4e38fba2fc7b1aa
2024-01-11 Tomas
project: remove lodash library
f316bd 差異 | 目錄
2024-01-11 Tomas
update: 改寫 lodash 方法為純 js
756f8a 差異 | 目錄
修改7個檔案
26793 ■■■■■ 已變更過的檔案
PAMapp/components/phoneContactTimePicker.vue 23 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/package-lock.json 26742 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/package.json 2 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/agentInfo/edit/_agentNo.vue 13 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/shared/services/message-box.service.ts 3 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/shared/services/my-consultant.service.ts 9 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/tsconfig.json 1 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/components/phoneContactTimePicker.vue
@@ -74,18 +74,17 @@
  import { dayTimeFrames } from "~/shared/const/day-time-frames";
  import { OptionBtnDto, OptionDto } from "~/shared/models/optionBtnDto.model";
  import { weekDays } from "~/shared/const/week-days";
  import * as _ from "lodash";
  @Component({
    filters:{
      titleFormatByIndex(index:number):string{
        const chineseNumber = ['一','二','三','四','五','六','七','八','九','十'];
        return '時段'+chineseNumber[index];
      },
      optionsFormat(selectedOptions:string[]|[], compareOptions:OptionDto): string{
        return _.isEqual(selectedOptions.length,compareOptions.options.length)
                ? compareOptions.selectAll
                : _.join(selectedOptions,',');
      },
      optionsFormat(selectedOptions = [], compareOptions) {
        return selectedOptions.length === compareOptions.options.length
          ? compareOptions.selectAll
          : selectedOptions.join(',');
      }
    }
  })
  export default class PhoneContactTimePicker extends Vue {
@@ -110,7 +109,7 @@
    //////////////////////////////////////////////////////////////////////
    get isOpenByDayPopUp(): boolean{
      return _.isEqual(this.popUpMode , TimePickerMode.SELECT_DAY)
      return this.popUpMode === TimePickerMode.SELECT_DAY;
    }
    set isOpenByDayPopUp(value:boolean){
@@ -118,7 +117,7 @@
    }
    get isOpenByTimePopUp(): boolean{
      return _.isEqual(this.popUpMode , TimePickerMode.SELECT_TIME);
      return this.popUpMode === TimePickerMode.SELECT_TIME;
    }
    set isOpenByTimePopUp(value:boolean){
@@ -128,7 +127,7 @@
    //////////////////////////////////////////////////////////////////////
    openPopUp(schedule:scheduleDto,index:number):void{
      this.initPickerControl = _.cloneDeep(schedule);
      this.initPickerControl = JSON.parse(JSON.stringify(schedule));
      this.popUpMode = TimePickerMode.SELECT_DAY;
      this.scheduleIndex = index;
    }
@@ -144,8 +143,8 @@
    }
    private initPickerFormatSort(initPickerControl:scheduleDto):scheduleDto{
      _.keys(initPickerControl).forEach(keyName=>{
        const options = _.isEqual(keyName,'selectWeekOptions') ? weekDays : dayTimeFrames;
      Object.keys(initPickerControl).forEach(keyName=>{
        const options = keyName === 'selectWeekOptions' ? weekDays : dayTimeFrames;
        initPickerControl[keyName] = this.getOptionsBySort(initPickerControl[keyName],options);
      })
      return initPickerControl;
@@ -153,7 +152,7 @@
    // è³‡æ–™é‡æ–°æŽ’序,回復一開始清單順序
    private getOptionsBySort( selectedOptions:string[] , options:OptionBtnDto[]): string[] {
      return options.map( o => _.includes(selectedOptions , o.label) ? o.label as string : '').filter(String);
      return options.map( o => selectedOptions.includes(o.label as string) ? o.label as string : '').filter(String);
    }
    addNewSchedule(): void {
PAMapp/package-lock.json
ÀɮפӤj
PAMapp/package.json
@@ -24,7 +24,6 @@
    "core-js": "^3.18.3",
    "crypto-js": "^4.1.1",
    "element-ui": "^2.15.6",
    "lodash": "^4.17.21",
    "node-cipher": "^6.3.3",
    "node-forge": "^1.3.1",
    "nuxt": "^2.15.8",
@@ -39,7 +38,6 @@
    "@nuxt/types": "^2.15.8",
    "@nuxt/typescript-build": "^2.1.0",
    "@nuxtjs/dotenv": "^1.4.1",
    "@types/lodash": "^4.14.176",
    "@types/node-forge": "^1.3.4",
    "@vue/test-utils": "^1.2.2",
    "babel-core": "7.0.0-bridge.0",
PAMapp/pages/agentInfo/edit/_agentNo.vue
@@ -264,7 +264,6 @@
import { Context } from '@nuxt/types';
import { namespace } from 'nuxt-property-decorator';
import { Vue, Component, Prop } from 'vue-property-decorator';
import * as _ from "lodash";
import myConsultantService from '~/shared/services/my-consultant.service';
import accountSettingService from '~/shared/services/account-setting.service';
@@ -410,7 +409,7 @@
    this.editInfoValue = {
      ...this.defaultAgentInfoSetting,
      expertise: _.cloneDeep(this.defaultAgentInfoSetting.expertise),
      expertise: JSON.parse(JSON.stringify(this.defaultAgentInfoSetting.expertise)),
      communicationStyle: this.defaultAgentInfoSetting.communicationStyle?.split('、') || [],
    };
  }
@@ -467,11 +466,11 @@
  }
  get phoneValid(): boolean {
            const rule = /^09[0-9]{8}$/;
            return this.editInfoValue.phoneNumber
            ? rule.test(this.editInfoValue.phoneNumber) && _.isEqual(this.editInfoValue.phoneNumber.length,10)
            : true;
        }
    const rule = /^09[0-9]{8}$/;
    return this.editInfoValue.phoneNumber
      ? rule.test(this.editInfoValue.phoneNumber) && this.editInfoValue.phoneNumber.length === 10
      : true;
  }
  get emailValid() {
      const rule = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
PAMapp/shared/services/message-box.service.ts
@@ -1,6 +1,5 @@
import { MessageBox } from 'element-ui';
import { MessageBoxData } from "element-ui/types/message-box";
import _ from "lodash";
class MessageBoxService {
@@ -22,7 +21,7 @@
  // æš«æ™‚用逗號去斷行
  private breakTextByComma(errorMsg:string):string{
    return _.split(errorMsg,",").join('<br>');
    return errorMsg.split(",").join('<br>');
  }
}
PAMapp/shared/services/my-consultant.service.ts
@@ -1,9 +1,8 @@
import _ from "lodash";
import { http } from "./httpClient";
import { AgentInfo } from '~/shared/models/agent-info.model';
import { Consultant } from "../models/consultant.model";
import { Appointment } from "../models/appointment.model";
import { Consultant } from "../models/consultant.model";
import { http } from "./httpClient";
class MyConsultantService {
  async getFavoriteConsultantList(): Promise<Consultant[]> {
@@ -56,8 +55,8 @@
    return http.get(`/consultant/avatar/${agentNo}`,{ responseType : 'arraybuffer' })
      .then( response => {
        const toBase64 = window.btoa(
                          _.reduce( new Uint8Array(response.data),(data,byte) =>
                            data + String.fromCharCode(byte),'')
                          Array.from(new Uint8Array(response.data)).reduce((data, byte) =>
                            data + String.fromCharCode(byte), '')
                        );
        const imgSrc = `data:image/png;base64,${toBase64}`;
        return imgSrc;
PAMapp/tsconfig.json
@@ -28,7 +28,6 @@
      "@nuxt/types",
      "@types/node",
      "@nuxtjs/axios",
      "@types/lodash",
    ]
  },
  "exclude": [