保誠-保戶業務員媒合平台
Mila
2021-12-01 929c7a3066ee87b424954821f2a93f2853937592
fixed 使用 stroe 存放推薦顧問結果
修改3個檔案
44 ■■■■ 已變更過的檔案
PAMapp/pages/recommendConsultant/index.vue 19 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/recommendConsultant/result.vue 14 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/store/index.ts 11 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/recommendConsultant/index.vue
@@ -87,11 +87,12 @@
    Vue,
    Component,
    Mutation,
    namespace
    namespace,
    Action,
    State
  } from 'nuxt-property-decorator';
  import * as _ from 'lodash';
  import { strictQuery } from '~/assets/ts/api/consultant';
  import { Seniority } from '~/assets/ts/models/enum/Seniority';
import { Seniority } from '~/assets/ts/models/enum/seniority';
  const localStorage = namespace('localStorage');
@@ -226,7 +227,8 @@
    showAddress = false;
    @Mutation updateStrictQueryList!: (data: any) => void;
    @localStorage.Mutation storageRecommendConsultant!: (data: any) => void;
    @Action storeStrictQueryList!: (data: any) => Promise<number>;
    @State strictQueryList!: any;
    @localStorage.State recommendConsultantItem!: string;
    mounted() {
@@ -234,12 +236,9 @@
        this.strictQueryDto = JSON.parse(this.recommendConsultantItem);
      }
    }
    makePair():void{
      strictQuery(this.strictQueryDto).then(res=>{
        console.log('resultData',res.data);
        this.storageRecommendConsultant(JSON.stringify(this.strictQueryDto));
        this.updateStrictQueryList(res.data);
        if (res.data.length === 0) {
    async makePair() {
      await this.storeStrictQueryList(this.strictQueryDto).then(dataLength => {
        if (dataLength === 0) {
          this.isVisiblePopUp = true;
          return;
        }
PAMapp/pages/recommendConsultant/result.vue
@@ -81,16 +81,26 @@
</div>
</template>
<script lang="ts">
import {Vue,Component, State} from 'nuxt-property-decorator';
import {Vue,Component, State, namespace, Action} from 'nuxt-property-decorator';
import { AgentOfStrictQuery } from '~/assets/ts/api/consultant';
const localStorage = namespace('localStorage');
@Component
export default class Reslut extends Vue{
    @State('strictQueryList') strictQueryList!: AgentOfStrictQuery;
    @State('strictQueryList') strictQueryList!: AgentOfStrictQuery[];
    @Action storeStrictQueryList!: (data: any) => Promise<number>;
    @localStorage.State recommendConsultantItem!: string;
    pageList: any[] = [];
    isVisiblePopUp = false;
    popUpTxt = '';
    mounted() {
        if (this.recommendConsultantItem && this.strictQueryList.length === 0) {
            const strictQueryDto = JSON.parse(this.recommendConsultantItem);
            this.storeStrictQueryList(strictQueryDto);
        }
    }
    changePage(pageList: any[]) {
        this.pageList = pageList;
PAMapp/store/index.ts
@@ -1,7 +1,7 @@
import { Module, VuexModule, Mutation, Action } from 'vuex-module-decorators'
import { ClientInfo, getMyAppointmentList } from '~/assets/ts/api/appointment';
// import * as consultant from '~/assets/ts/api/consultant';
import { Consultants,recommend,AgentOfStrictQuery, getFavoriteConsultant, addFavoriteConsultant, deleteConsultant } from '~/assets/ts/api/consultant';
import { Consultants,recommend,AgentOfStrictQuery, getFavoriteConsultant, addFavoriteConsultant, deleteConsultant, strictQuery } from '~/assets/ts/api/consultant';
import { isLogin } from '~/assets/ts/auth';
import { getFavoriteFromStorage, setFavoriteToStorage } from '~/assets/ts/storageConsultant';
@@ -109,4 +109,13 @@
        this.context.commit('updateMyAppointmentList', data)
    }
    @Action
    async storeStrictQueryList(strictQueryDto) {
        return await strictQuery(strictQueryDto).then(res=>{
            this.context.commit('localStorage/storageRecommendConsultant', JSON.stringify(strictQueryDto));
            this.context.commit('updateStrictQueryList', res.data)
            return res.data.length;
        });
    }
}