From 77e9d1af08adac5f962407023c76035ef4e77708 Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期二, 30 十一月 2021 19:29:46 +0800
Subject: [PATCH] fixed TODO#131222 嚴選配對: 1. 應記住選擇條件 2. 回上一頁時要回到篩選出嚴選配對頁面且記住選擇條件

---
 PAMapp/pages/recommendConsultant/index.vue |   38 ++++++++++++++++++++++++++++++++------
 1 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/PAMapp/pages/recommendConsultant/index.vue b/PAMapp/pages/recommendConsultant/index.vue
index 30e1745..67b439a 100644
--- a/PAMapp/pages/recommendConsultant/index.vue
+++ b/PAMapp/pages/recommendConsultant/index.vue
@@ -86,22 +86,26 @@
   import {
     Vue,
     Component,
-    Mutation
+    Mutation,
+    namespace
   } from 'nuxt-property-decorator';
-  import {strictQuery} from '~/assets/ts/api/consultant';
   import * as _ from 'lodash';
+import { strictQuery } from '~/assets/ts/api/consultant';
+
+  const localStorage = namespace('localStorage');
+
   @Component
   export default class RecommendConsultant extends Vue {
     isVisiblePopUp = false;
-    strictQueryDto={
+    strictQueryDto: StrictQueryDto ={
       gender:'',
       area:'',
       status:'',
-      requirements:[],
+      requirements: [],
       otherRequirement:'',
       seniority:'',
       avgScore:0,
-      popularTags:[],
+      popularTags: [],
       otherPopularTags:'',
     };
     genderOptions=[
@@ -225,10 +229,18 @@
     showAddress = false;
 
     @Mutation updateStrictQueryList!: (data: any) => void;
+    @localStorage.Mutation storageRecommendConsultant!: (data: any) => void;
+    @localStorage.State recommendConsultantItem!: string;
 
+    mounted() {
+      if (!!this.recommendConsultantItem) {
+        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) {
           this.isVisiblePopUp = true;
@@ -239,7 +251,9 @@
     }
     get notFinishByRequireRules():boolean{
       const area = this.strictQueryDto.area;
-      const requirementLength = this.strictQueryDto.requirements.length;
+      const requirementLength = this.strictQueryDto.requirements
+        ? this.strictQueryDto.requirements.length
+        : 0;
       return !(area && requirementLength >0)
     }
 
@@ -253,6 +267,18 @@
     MALE="male",
     FEMALE="female",
   }
+
+  export interface StrictQueryDto {
+    gender: string,
+    area: string,
+    status: string,
+    requirements: string[],
+    otherRequirement: string,
+    seniority: string,
+    avgScore: number,
+    popularTags: string[],
+    otherPopularTags: string
+  }
 </script>
 
 <style lang="scss" >

--
Gitblit v1.8.0