保誠-保戶業務員媒合平台
Mila
2022-01-22 c047a3336ff1efc7d21edee6f0c8811264eebae7
PAMapp/components/NavBar.vue
@@ -8,7 +8,7 @@
    </div>
    <div class="pam-header__action-bar">
      <i
        v-if="currentRole"
        v-if="isShowNotification"
        class="icon-bell text--dark-blue cursor--pointer fix-chrome-click--issue"
        @click="$router.push('/notification')"
      ></i>
@@ -49,9 +49,11 @@
<script lang="ts">
  import { Vue, Component } from 'vue-property-decorator';
  import { namespace } from 'nuxt-property-decorator';
  import { Action, namespace, State, Watch } from 'nuxt-property-decorator';
  import { Role } from '~/shared/models/enum/Role';
  import * as _ from 'lodash';
  import { NotificationList } from '~/shared/models/reviews.model';
  import { AppointmentLog } from '~/shared/models/appointment.model';
  const roleStorage = namespace('localStorage');
  @Component
@@ -71,6 +73,21 @@
    @roleStorage.Getter
    isAdminLogin!: boolean;
    @roleStorage.Getter
    isUserLogin!: boolean;
    @Action
    storeMyPersonalNotification!: () => void;
    @State
    notificationList!: NotificationList[];
    @Action
    storeMyAppointmentReviewLog!: () => void;
    @State
    unReviewLogList!: AppointmentLog[];
    isOpenDropdown = false;
@@ -123,6 +140,24 @@
    //////////////////////////////////////////////////////////////////////
    @Watch('$route', {immediate: true})
    onRouterChange() {
        this.getNotificationAndReviewLog();
    }
    private getNotificationAndReviewLog() {
      if (this.isUserLogin) {
        this.storeMyPersonalNotification();
        this.storeMyAppointmentReviewLog();
      }
      if (this.isAdminLogin) {
        this.storeMyPersonalNotification();
      }
    }
    //////////////////////////////////////////////////////////////////////
    routerNavigateTo(url: string): void {
      (this.$refs.dropdown as any).hide();
      _.isEqual(url,'')
@@ -144,6 +179,15 @@
      return this.idToken && this.currentRole ? (this.currentRole as Role): Role.NOT_LOGIN;
    }
    get isShowNotification() {
      if (this.isUserLogin) {
        return this.notificationList.length || this.unReviewLogList.length;
      }
      if (this.isAdminLogin) {
        return this.notificationList.length
      }
    }
  }
</script>