保誠-保戶業務員媒合平台
Tomas
2021-12-09 ac235850a9287dae6977c964213176fa7c86b140
PAMapp/components/BackActionBar.vue
@@ -1,21 +1,23 @@
<template>
    <nav class="pam-back-action-bar fix-chrome-click--issue">
        <a @click="pushRouterByLoginRole">
        <a @click="pushRouterByLoginRole" v-if="questionnaireState">
          <i class="icon-left "></i>{{ label }}
        </a>
    </nav>
</template>
<script lang="ts">
import { namespace } from 'nuxt-property-decorator';
import { namespace, Watch } from 'nuxt-property-decorator';
import { Vue, Component,} from 'vue-property-decorator';
import { Role } from '~/assets/ts/models/enum/Role';
import { Role } from '~/assets/ts/models/enum/role.enum';
import * as _ from 'lodash';
import { isLogin } from '~/assets/ts/auth';
const roleStorage = namespace('localStorage');
@Component
export default class UiCarousel extends Vue {
  @roleStorage.Getter currentRole!:string;
  questionnaireState: boolean = true;
  get label(): string {
    if (this.$route.name) {
      const routeName = this.$route.name.split('-')[0];
@@ -34,22 +36,40 @@
          featureLabel = '我的顧問清單';
          break;
        case 'agentInfo':
          featureLabel = '業務員資訊'
          featureLabel = _.isEqual(this.currentRole,Role.ADMIN) ? '查看帳號資訊' : '業務員資訊'
          break;
        default:
          featureLabel = '回首頁';
          break;
        case 'questionnaire':
          featureLabel = '進行預約';
          break;
        case 'notification':
          featureLabel = '通知';
          break;
        case 'record':
          featureLabel = '查看紀錄';
          break;
        case 'accountSetting':
          featureLabel = '個人帳號設定';
          break;
        case 'consultantAccountSetting':
          featureLabel = '查看帳號資訊';
          break;
      }
      return featureLabel;
    } else {
      return '回首頁';
    }
  }
  pushRouterByLoginRole():void{
    const link = _.isEqual(this.currentRole,Role.ADMIN)? '/myAppointmentList/appointmentList':'/';
    this.$router.push(link);
    const pathName = this.$route.name;
    pathName?.includes('myConsultantList') ? this.$router.push('/') : this.$router.go(-1);
  }
  set label(value) {
    this.questionnaireState = value === '進行預約' ? isLogin() : true;
  }
}
</script>