保誠-保戶業務員媒合平台
Tomas
2021-12-27 a74fd90950e4d37c35b947db979d3a26698a85db
page refactor: my-appointment-list
修改1個檔案
77 ■■■■ 已變更過的檔案
PAMapp/pages/myAppointmentList.vue 77 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/myAppointmentList.vue
@@ -56,33 +56,17 @@
    @State('myAppointmentList')
    myAppointmentList!: ClientInfo[];
    @Watch('myAppointmentList')
    onMyAppointmentListChange() {
        this.contactedList = this.myAppointmentList
            .filter(item => item.communicateStatus === 'contacted');
        this.appointmentList = this.myAppointmentList
            .filter(item => item.communicateStatus !== 'contacted');
    }
    @State('myNewAppointmentSum')
    newAppointmentSum!: number;
    @Watch('newAppointmentSum')
    newAppointmentSumChange(): void {
      this.showNewAppointmentHint = this.newAppointmentSum > 0;
    }
    @Action
    storeMyAppointmentList!: () => Promise<number>;
    activeTabName = 'appointmentList';
    activeTabName         : string       = 'appointmentList';
    appointmentList: ClientInfo[] = [];
    contactedList: ClientInfo[] = [];
    clients: ClientInfo[] = [];
    showNewAppointmentHint = false;
    get bannerClassName() {
        const routeName = this.$route.name || '';
        return this.routeFormatBannerClass(routeName);
    };
    contactedList         : ClientInfo[] = [];
    showNewAppointmentHint: boolean      = false;
    //////////////////////////////////////////////////////////////////////
@@ -91,24 +75,6 @@
      this.storeMyAppointmentList();
    }
    //////////////////////////////////////////////////////////////////////
    @Action
    storeMyAppointmentList!: () => Promise<number>;
    clickTab(path: string): void {
      this.activeTabName = path;
      this.$router.push(`/myAppointmentList/${this.activeTabName}`);
    }
    //////////////////////////////////////////////////////////////////////
    // format to {page}-banner or pam-no-banner tag
    private routeFormatBannerClass(route: string): string {
        const needBannerTags = ['myAppointmentList-appointmentList', 'myAppointmentList-contactedList'];
        return _.includes(needBannerTags, route) ? route + '-banner' : 'pam-no-banner';
    };
    private setActivatedTab(): void {
      const routeFullName = this.$route.name;
      if (routeFullName) {
@@ -116,6 +82,39 @@
      }
    }
    //////////////////////////////////////////////////////////////////////
    @Watch('myAppointmentList')
    onMyAppointmentListChange(): void {
        this.contactedList = this.myAppointmentList
            .filter(item => item.communicateStatus === 'contacted');
        this.appointmentList = this.myAppointmentList
            .filter(item => item.communicateStatus !== 'contacted');
    }
    @Watch('newAppointmentSum')
    newAppointmentSumChange(): void {
      this.showNewAppointmentHint = this.newAppointmentSum > 0;
    }
    //////////////////////////////////////////////////////////////////////
    clickTab(path: string): void {
      this.activeTabName = path;
      this.$router.push(`/myAppointmentList/${this.activeTabName}`);
    }
    get bannerClassName() {
      const routeName = this.$route.name || '';
      return this.routeFormatBannerClass(routeName);
    };
    // format to {page}-banner or pam-no-banner tag
    private routeFormatBannerClass(route: string): string {
        const needBannerTags = ['myAppointmentList-appointmentList', 'myAppointmentList-contactedList'];
        return _.includes(needBannerTags, route) ? route + '-banner' : 'pam-no-banner';
    };
}
</script>