PAMapp/components/BackActionBar.vue | ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程 | |
PAMapp/components/Consultant/ConsultantList.vue | ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程 | |
PAMapp/middleware/errorRouteMiddleware.ts | ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程 | |
PAMapp/middleware/myAppointmentMiddleware.ts | ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程 | |
PAMapp/pages/questionnaire/_agentNo.vue | ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程 | |
PAMapp/store/index.ts | ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程 | |
PAMapp/store/localStorage.ts | ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程 |
PAMapp/components/BackActionBar.vue
@@ -1,6 +1,6 @@ <template> <nav class="pam-back-action-bar fix-chrome-click--issue"> <a @click="pushRouterByLoginRole" v-if="questionnaireState"> <a @click="pushRouterByLoginRole"> <i class="icon-left "></i>{{ label }} </a> </nav> @@ -16,7 +16,6 @@ @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]; @@ -67,9 +66,6 @@ pathName?.includes('myConsultantList') ? this.$router.push('/') : this.$router.go(-1); } set label(value) { this.questionnaireState = value === '進行預約' ? this.currentRole === Role.USER : true; } } </script> PAMapp/components/Consultant/ConsultantList.vue
@@ -8,12 +8,12 @@ :agentInfo="agent" ></ConsultantCard> </template> <template v-if="isLogin && agentList.length === 0"> <template v-if="isUserLogin && agentList.length === 0"> <div class="emptyRowStyle"> <div class="smTxt txt">您目前無已選顧問</div> </div> </template> <template v-if="!isLogin"> <template v-if="!isUserLogin"> <div class="emptyRowStyle"> <div class="mdTxt login fix-chrome-click--issue" @click="$router.push('/login')">登入 | 註冊</div> <div class="smTxt txt ">查看更多</div> @@ -32,11 +32,8 @@ @Component export default class ConsultantList extends Vue { @Prop() agents!: Consultant[]; @roleStorage.Getter currentRole!:string; @roleStorage.Getter isUserLogin!:boolean; get isLogin() { return this.currentRole === Role.USER; } get agentList(){ return this.agents.map((agentDto)=> ({...agentDto,customerScore:0,}) PAMapp/middleware/errorRouteMiddleware.ts
@@ -1,9 +1,9 @@ import { Middleware } from '@nuxt/types'; import { Role } from '~/assets/ts/models/enum/Role'; const errorRouteMiddleware: Middleware = (context) => { if (!context.route.name) { if (context.store.getters['localStorage/currentRole'] === Role.ADMIN) { const isAdminLogin = context.store.getters['localStorage/isAdminLogin']; if (isAdminLogin) { context.redirect('/myAppointmentList/appointmentList'); return; } PAMapp/middleware/myAppointmentMiddleware.ts
@@ -1,8 +1,8 @@ import { Middleware } from '@nuxt/types'; import { Role } from '~/assets/ts/models/enum/Role'; const myAppointmentMiddleware: Middleware = (context) => { if (context.store.getters['localStorage/currentRole'] === Role.ADMIN) { const isAdminLogin = context.store.getters['localStorage/isAdminLogin']; if (isAdminLogin) { if (context.route.name === 'myAppointmentList') { context.redirect('/myAppointmentList/appointmentList') } PAMapp/pages/questionnaire/_agentNo.vue
@@ -1,5 +1,5 @@ <template> <div class="ques-page--reset" v-if="isLogin"> <div class="ques-page--reset" v-if="isUserLogin"> <div class="ques-header"> <div class="ques-header__mob-banner"></div> <div @@ -150,7 +150,7 @@ export default class Questionnaire extends Vue { @State('myConsultantList') myConsultantList!: Consultant[]; @Action storeConsultantList!: () => Promise<number>; @roleStorage.Getter currentRole!:string; @roleStorage.Getter isUserLogin!:boolean; genderOptions=[ { @@ -272,19 +272,20 @@ beforeRouteEnter(to: any, from: any, next: any) { next(vm => { if (from.name === 'login' && !vm.isLogin) { const isUserLogin = vm.$store.getters['localStorage/isUserLogin']; if (from.name === 'login' && !isUserLogin) { vm.$router.go(-1); return; } if (!vm.isLogin) { if (!isUserLogin) { vm.$router.push('/login'); } }) } async fetch() { if (this.isLogin) { if (this.isUserLogin) { await this.storeConsultantList(); }; } @@ -334,10 +335,6 @@ return _.includes(this.myRequest.contactType,ContactType.PHONE) ? !this.isHopeContactTimeDone() : !this.phoneValid; } get isLogin() { return this.currentRole === Role.USER; } private isHopeContactTimeDone():boolean{ @@ -450,7 +447,7 @@ } @Watch('myConsultantList') onMyConsultantListChange() { if (this.isLogin && this.myConsultantList.length > 0) { if (this.isUserLogin && this.myConsultantList.length > 0) { const editAppointment = this.getLatestReserved(this.$route.params.agentNo); if (editAppointment.agentNo) { PAMapp/store/index.ts
@@ -16,6 +16,10 @@ myAppointmentReviewLogList: AppointmentLog[] = []; get isUserLogin() { return this.context.getters['localStorage/isUserLogin']; } @Mutation updateRecommend(data: Consultant[]) { this.recommendList = data; } @@ -45,7 +49,8 @@ @Action async storeConsultantList() { const localData = getFavoriteFromStorage(); if (this.context.getters['localStorage/currentRole'] !== Role.USER) { if (!this.isUserLogin) { this.context.commit('updateConsultantList', localData) return; }; @@ -70,7 +75,7 @@ // no agent was removed if (left.length === this.myConsultantList.length) return false; if (this.context.getters['localStorage/currentRole'] !== Role.USER) { if (!this.isUserLogin) { setFavoriteToStorage(left); } else { await deleteConsultant(agentNo) @@ -87,8 +92,7 @@ const found = this.myConsultantList.find(item => item.agentNo === consultantToAdd.agentNo); if (!found) { const newData = [consultantToAdd].concat(this.myConsultantList); if (this.context.getters['localStorage/currentRole'] === Role.USER) { if (this.isUserLogin) { await addFavoriteConsultant([consultantToAdd.agentNo]) } else { setFavoriteToStorage(newData); PAMapp/store/localStorage.ts
@@ -1,5 +1,6 @@ import { Selected } from '~/components/QuickFilter/QuickFilterSelector.vue'; import { Module, Mutation, VuexModule ,Action } from 'vuex-module-decorators'; import { Role } from '~/assets/ts/models/enum/Role'; @Module export default class LocalStorage extends VuexModule { id_token = localStorage.getItem('id_token'); @@ -24,6 +25,14 @@ return JSON.parse(this.quickFilterSelectedItem || '[]') as Selected[]; } get isAdminLogin(): boolean { return this.currentRole === Role.ADMIN; } get isUserLogin(): boolean { return this.currentRole === Role.USER; } @Mutation storageIdToken(token: string): void {