From 6fa4bba623713c396432ba8b863846883d6a1906 Mon Sep 17 00:00:00 2001
From: wayne <wayne8692wayne8692@gmail.com>
Date: 星期三, 26 一月 2022 10:52:23 +0800
Subject: [PATCH] Merge branch 'pollex-dev' into sit

---
 PAMapp/store/index.ts |   62 +++++++++++++-----------------
 1 files changed, 27 insertions(+), 35 deletions(-)

diff --git a/PAMapp/store/index.ts b/PAMapp/store/index.ts
index 25d55a2..3fe527f 100644
--- a/PAMapp/store/index.ts
+++ b/PAMapp/store/index.ts
@@ -1,27 +1,23 @@
-import { StrictQueryParams } from '~/shared/models/strict-query.model';
 import { Module, VuexModule, Mutation, Action } from 'vuex-module-decorators'
-
-import { getFavoriteFromStorage, setFavoriteToStorage } from '~/shared/storageConsultant';
 
 import myConsultantService from '~/shared/services/my-consultant.service';
 import queryConsultantService from '~/shared/services/query-consultant.service';
-import appointmentService from '~/shared/services/appointment.service';
 import reviewsService from '~/shared/services/reviews.service';
-
 import { Consultant } from '~/shared/models/consultant.model';
+import { getFavoriteFromStorage, setFavoriteToStorage } from '~/shared/storageConsultant';
 import { AppointmentLog } from '~/shared/models/appointment.model';
-import { ClientInfo } from '~/shared/models/client.model';
-import { AgentOfStrictQuery } from '~/shared/models/strict-query.model';
+import { AgentOfStrictQuery, StrictQueryParams } from '~/shared/models/strict-query.model';
+import { NotificationList } from '~/shared/models/reviews.model';
+
 @Module
 export default class Store extends VuexModule {
     recommendList: Consultant[] = [];
     strictQueryList: AgentOfStrictQuery[] = [];
     myConsultantList: Consultant[] = [];
 
-    myAppointmentList: ClientInfo[] = [];
-    myNewAppointmentSum: number = 0;
-
-    myAppointmentReviewLogList: AppointmentLog[] = [];
+    reviewLogList: AppointmentLog[] = [];
+    unReviewLogList: AppointmentLog[] = [];
+    notificationList: NotificationList[] = [];
 
     get isUserLogin() {
         return this.context.getters['localStorage/isUserLogin'];
@@ -29,7 +25,7 @@
 
     @Mutation
     updateRecommend(data: Consultant[]) {
-        this.recommendList = data;
+      this.recommendList = data;
     }
 
     @Mutation
@@ -43,18 +39,18 @@
     }
 
     @Mutation
-    updateMyAppointmentList(data: ClientInfo[]) {
-        this.myAppointmentList = data;
+    updateReviewLog(data: AppointmentLog[]) {
+        this.reviewLogList = data;
     }
 
     @Mutation
-    updateMyNewAppointmentSum(newAppointmentSum: number) {
-      this.myNewAppointmentSum = newAppointmentSum;
+    updateUnReviewLog(data: AppointmentLog[]) {
+        this.unReviewLogList = data;
     }
 
     @Mutation
-    updateMyAppointmentReviewLog(data: AppointmentLog[]) {
-        this.myAppointmentReviewLogList = data;
+    updateNotification(data: NotificationList[]) {
+        this.notificationList = data;
     }
 
     @Action
@@ -126,15 +122,6 @@
     }
 
     @Action
-    storeMyAppointmentList(): void {
-      appointmentService.getMyAppointmentList().then((data) => {
-            const newAppointmentSum = data.filter(item => !item.consultantViewTime || item.consultantViewTime === null).length;
-            this.context.commit('updateMyAppointmentList', data);
-            this.context.commit('updateMyNewAppointmentSum', newAppointmentSum);
-        });
-    }
-
-    @Action
     storeMyAppointmentReviewLog() {
         reviewsService.getMyReviewLog().then((data) => {
             const dataWithLatestDate = data.map((item) => {
@@ -144,15 +131,11 @@
                 }
             });
             const sortedData = dataWithLatestDate.sort((a, b) => +b.compareDate - +a.compareDate);
-            this.context.commit('updateMyAppointmentReviewLog', sortedData);
+            const reviewLog = sortedData.filter(item => item.score);
+            const unReviewLog = sortedData.filter(item => !item.score);
+            this.context.commit('updateReviewLog', reviewLog);
+            this.context.commit('updateUnReviewLog', unReviewLog);
         });
-    }
-
-    @Action
-    updateMyAppointment(myAppointment: ClientInfo) {
-        const data = this.myAppointmentList.filter(item => item.id !== myAppointment.id);
-        data.unshift(myAppointment);
-        this.context.commit('updateMyAppointmentList', data)
     }
 
     @Action
@@ -164,4 +147,13 @@
         });
     }
 
+    @Action
+    storeMyPersonalNotification() {
+        reviewsService.getMyPersonalNotification().then(data => {
+            const sortData = data
+                .sort((preItem, nextItem) => +new Date(nextItem.createdDate) - +new Date(preItem.createdDate))
+            this.context.commit('updateNotification', sortData);
+        })
+    }
+
 }

--
Gitblit v1.8.0