保誠-保戶業務員媒合平台
Mila
2021-12-10 76c1ce3c2eb001560bfb785f7b2f62d4ec64dcb6
update 使用 currentRole 判斷目前是否為顧問/客戶登入狀態
刪除1個檔案
修改6個檔案
55 ■■■■ 已變更過的檔案
PAMapp/assets/ts/auth.ts 3 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/components/BackActionBar.vue 5 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/components/Consultant/ConsultantCard.vue 10 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/components/Consultant/ConsultantList.vue 9 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/myConsultantList/consultantList.vue 3 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/questionnaire/_agentNo.vue 14 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/store/index.ts 11 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/auth.ts
Àɮפw§R°£
PAMapp/components/BackActionBar.vue
@@ -7,11 +7,10 @@
</template>
<script lang="ts">
import { namespace, Watch } from 'nuxt-property-decorator';
import { namespace } from 'nuxt-property-decorator';
import { Vue, Component,} from 'vue-property-decorator';
import { Role } from '~/assets/ts/models/enum/Role';
import * as _ from 'lodash';
import { isLogin } from '~/assets/ts/auth';
const roleStorage = namespace('localStorage');
@Component
@@ -69,7 +68,7 @@
  }
  set label(value) {
    this.questionnaireState = value === '進行預約' ? isLogin() : true;
    this.questionnaireState = value === '進行預約' ? this.currentRole === Role.USER : true;
  }
}
</script>
PAMapp/components/Consultant/ConsultantCard.vue
@@ -122,13 +122,13 @@
</template>
<script lang="ts">
import { Vue, Component, Prop, Action } from 'nuxt-property-decorator';
import { Vue, Component, Prop, Action, namespace } from 'nuxt-property-decorator';
import { getAppointmentDetail, UserReviewsConsultantsParams, userReviewsConsultants, cancelAppointment } from '~/assets/ts/api/consultant';
import { Consultant, Appointment } from '~/assets/ts/models/consultant.model';
import { isLogin } from '~/assets/ts/auth';
import { isMobileDevice } from '~/assets/ts/device';
import { Role } from '~/assets/ts/models/enum/Role';
const roleStorage = namespace('localStorage');
@Component({
    filters: {
        formatNumber(index: number) {
@@ -152,6 +152,8 @@
    @Action removeFromMyConsultantList!: (agentNo: string) => Promise<boolean>;
    @Action storeConsultantList!: any;
    @Prop() agentInfo!: Consultant;
    @roleStorage.Getter currentRole!:string;
    isVisibleDialog = false;
    reviewsBtn = false;
    status = false;
@@ -246,7 +248,7 @@
    reserveCommunication() {
        const contactStatus = this.agentInfo.contactStatus;
        if (!contactStatus || contactStatus === 'picked') {
            isLogin()
            this.currentRole === Role.USER
                ? this.$router.push(`/questionnaire/${this.agentInfo.agentNo}`)
                : this.$router.push('/login');
        } else {
PAMapp/components/Consultant/ConsultantList.vue
@@ -23,16 +23,19 @@
</template>
<script lang="ts">
import { Vue, Component, Prop } from 'nuxt-property-decorator';
import { Vue, Component, Prop, namespace } from 'nuxt-property-decorator';
import { Consultant } from '~/assets/ts/models/consultant.model';
import { isLogin } from '~/assets/ts/auth';
import { Role } from '~/assets/ts/models/enum/Role';
const roleStorage = namespace('localStorage');
@Component
export default class ConsultantList extends Vue {
    @Prop() agents!: Consultant[];
    @roleStorage.Getter currentRole!:string;
    get isLogin() {
        return isLogin();
        return this.currentRole === Role.USER;
    }
    get agentList(){
        return this.agents.map((agentDto)=>
PAMapp/pages/myConsultantList/consultantList.vue
@@ -12,14 +12,13 @@
</template>
<script lang="ts">
import { Vue, Component, Prop, Getter } from 'nuxt-property-decorator';
import { Vue, Component, Prop } from 'nuxt-property-decorator';
import { Consultant } from '~/assets/ts/models/consultant.model';
@Component
export default class ConsultantPage extends Vue {
    @Prop() consultantList!: Consultant[];
    @Getter isLogin!: boolean;
    pageList: Consultant[] = [];
    changePage(pageList: Consultant[]) {
PAMapp/pages/questionnaire/_agentNo.vue
@@ -136,19 +136,21 @@
</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 currentRole!:string;
    genderOptions=[
      {
@@ -270,19 +272,19 @@
    beforeRouteEnter(to: any, from: any, next: any) {
      next(vm => {
        if (from.name === 'login' && !isLogin()) {
        if (from.name === 'login' && !vm.isLogin) {
          vm.$router.go(-1);
          return;
        }
        if (!isLogin()) {
        if (!vm.isLogin) {
          vm.$router.push('/login');
        }
      })
    }
    async fetch() {
      if (isLogin()) {
      if (this.isLogin) {
        await this.storeConsultantList();
      };
    }
@@ -335,7 +337,7 @@
    }
    get isLogin() {
      return isLogin();
      return this.currentRole === Role.USER;
    }
    private isHopeContactTimeDone():boolean{
PAMapp/store/index.ts
@@ -1,11 +1,10 @@
import { Module, VuexModule, Mutation, Action } from 'vuex-module-decorators'
import { ClientInfo, getMyAppointmentList, getMyReviewLog, allAppointmentsView } from '~/assets/ts/api/appointment';
// import * as consultant from '~/assets/ts/api/consultant';
import { ClientInfo, getMyAppointmentList, getMyReviewLog } from '~/assets/ts/api/appointment';
import { recommend, AgentOfStrictQuery, getFavoriteConsultant, addFavoriteConsultant, deleteConsultant, strictQuery } from '~/assets/ts/api/consultant';
import { Consultant } from '~/assets/ts/models/consultant.model';
import { isLogin } from '~/assets/ts/auth';
import { AppointmentLog } from '~/assets/ts/models/appointment.model';
import { getFavoriteFromStorage, setFavoriteToStorage } from '~/assets/ts/storageConsultant';
import { Role } from '~/assets/ts/models/enum/Role';
@Module
export default class Store extends VuexModule {
@@ -46,7 +45,7 @@
    @Action
    async storeConsultantList() {
        const localData = getFavoriteFromStorage();
        if (!isLogin()) {
        if (this.context.getters['localStorage/currentRole'] !== Role.USER) {
            this.context.commit('updateConsultantList', localData)
            return;
        };
@@ -71,7 +70,7 @@
        // no agent was removed
        if (left.length === this.myConsultantList.length) return false;
        if (!isLogin()) {
        if (this.context.getters['localStorage/currentRole'] !== Role.USER) {
            setFavoriteToStorage(left);
        } else {
            await deleteConsultant(agentNo)
@@ -89,7 +88,7 @@
            if (!found) {
                const newData = [consultantToAdd].concat(this.myConsultantList);
                if (isLogin()) {
                if (this.context.getters['localStorage/currentRole'] === Role.USER) {
                    await addFavoriteConsultant([consultantToAdd.agentNo])
                } else {
                    setFavoriteToStorage(newData);