| | |
| | | <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 |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <PopUpFrame :isOpen.sync="showDrawer" :drawerSize=" '95%' "> |
| | | <PopUpFrame :isOpen.sync="showDrawer"> |
| | | <div class="qaTextTitle mdTxt"> |
| | | <strong>想要詢問的問題</strong> |
| | | </div> |
| | |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { Vue, Component, State, Action, Watch } from 'nuxt-property-decorator'; |
| | | import { Vue, Component, State, Action, Watch, namespace } from 'nuxt-property-decorator'; |
| | | import { addFavoriteConsultant, appointmentDemand, AppointmentParams, AppointmentRequests ,editAppointment,RegisterInfo } from '~/assets/ts/api/consultant'; |
| | | import { getRequestQuestionFromStorage, getRequestsFromStorage, removeRequestQuestionFromStorage, setRequestsToStorage } from '~/assets/ts/storageRequests'; |
| | | import _ from 'lodash'; |
| | | import { isLogin } from '~/assets/ts/auth'; |
| | | import { Consultant } from '~/assets/ts/models/consultant.model'; |
| | | import { ContactType } from '~/assets/ts/models/enum/ContactType'; |
| | | import { Gender } from '~/assets/ts/models/enum/Gender'; |
| | | import { Role } from '~/assets/ts/models/enum/Role'; |
| | | |
| | | const roleStorage = namespace('localStorage'); |
| | | @Component |
| | | export default class Questionnaire extends Vue { |
| | | @State('myConsultantList') myConsultantList!: Consultant[]; |
| | | @Action storeConsultantList!: () => Promise<number>; |
| | | @roleStorage.Getter isUserLogin!:boolean; |
| | | |
| | | genderOptions=[ |
| | | { |
| | |
| | | { |
| | | title:'41-50 歲', |
| | | label:'41-50' |
| | | }, |
| | | { |
| | | title:'46-55 歲', |
| | | label:'46-55', |
| | | }, |
| | | { |
| | | title:'51-60 歲', |
| | |
| | | |
| | | beforeRouteEnter(to: any, from: any, next: any) { |
| | | next(vm => { |
| | | if (from.name === 'login' && !isLogin()) { |
| | | const isUserLogin = vm.$store.getters['localStorage/isUserLogin']; |
| | | if (from.name === 'login' && !isUserLogin) { |
| | | vm.$router.go(-1); |
| | | return; |
| | | } |
| | | |
| | | if (!isLogin()) { |
| | | if (!isUserLogin) { |
| | | vm.$router.push('/login'); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | async fetch() { |
| | | if (isLogin()) { |
| | | if (this.isUserLogin) { |
| | | await this.storeConsultantList(); |
| | | }; |
| | | } |
| | |
| | | return _.includes(this.myRequest.contactType,ContactType.PHONE) |
| | | ? !this.isHopeContactTimeDone() |
| | | : !this.phoneValid; |
| | | } |
| | | |
| | | get isLogin() { |
| | | return isLogin(); |
| | | } |
| | | |
| | | private isHopeContactTimeDone():boolean{ |
| | |
| | | |
| | | const appointmentInfo = agentInfo.length > 0 && agentInfo[0].appointments |
| | | ? agentInfo[0].appointments! |
| | | .filter((appointment) => appointment.communicateStatus !== 'contacted') |
| | | .sort((preAppointment, nextAppointment) => { |
| | | return +nextAppointment.appointmentDate - +preAppointment.appointmentDate |
| | | })[0] |
| | | .filter((appointment) => appointment.communicateStatus !== 'contacted') |
| | | .map((reversedAppointment) => { |
| | | return { |
| | | ...reversedAppointment, |
| | | sortDate: new Date(reversedAppointment.appointmentDate) |
| | | } |
| | | }) |
| | | .sort((preAppointment, nextAppointment) => +nextAppointment.sortDate - +preAppointment.sortDate)[0] |
| | | : null; |
| | | |
| | | return this.getReservedData(appointmentInfo); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @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) { |
| | |
| | | //詳細問題drawer中間內容空間大小設置 |
| | | .qa-dialog{ |
| | | overflow-y:auto; |
| | | height: 500px; |
| | | height: 60vh; |
| | | margin-top: 20px; |
| | | } |
| | | |