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/pages/myConsultantList.vue |   40 ++++++++++++++++++++++------------------
 1 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/PAMapp/pages/myConsultantList.vue b/PAMapp/pages/myConsultantList.vue
index ad2efeb..e1e993d 100644
--- a/PAMapp/pages/myConsultantList.vue
+++ b/PAMapp/pages/myConsultantList.vue
@@ -27,6 +27,8 @@
 
 <script lang='ts'>
 import { Vue, Component, Watch, State, Action } from 'nuxt-property-decorator';
+
+import authService from '~/shared/services/auth.service';
 import { Consultant, ConsultantWithAppointmentId } from '~/shared/models/consultant.model';
 
 @Component
@@ -78,25 +80,27 @@
         .map((item) => ({ ...item, formatDate: new Date(item.updateTime || item.createTime)}))
         .sort((preItem, nextItem) => +nextItem.formatDate - +preItem.formatDate );
 
-    // format contacted list
-      this.myConsultantList.filter((consultant) => consultant.appointments!.length)
-        .forEach((consultant) => {
-          consultant.appointments!.forEach((appointment) => {
-            const consultantWithAppointmentId: ConsultantWithAppointmentId = {
-              ...consultant,
-              appointmentId: appointment.id,
-              appointmentDate: appointment.appointmentDate,
-              appointmentScore: appointment.satisfactionScore,
-              appointmentStatus: appointment.communicateStatus,
-            };
-            this.contactedList.push(consultantWithAppointmentId);
-          })
-        });
+      if (authService.isUserLogin()) {
+        this.myConsultantList.filter((consultant) => consultant.appointments!.length)
+          .forEach((consultant) => {
+            consultant.appointments!.forEach((appointment) => {
+              const consultantWithAppointmentId: ConsultantWithAppointmentId = {
+                ...consultant,
+                appointmentId: appointment.id,
+                appointmentDate: appointment.appointmentDate,
+                appointmentScore: appointment.satisfactionScore,
+                appointmentStatus: appointment.communicateStatus,
+              };
+              this.contactedList.push(consultantWithAppointmentId);
+            })
+          });
 
-      this.contactedList = this.contactedList
-        .filter((appointment) => appointment['appointmentStatus'] === 'contacted')
-        .map((appointment) => ({ ...appointment, sortTime: new Date(appointment.appointmentDate)}))
-        .sort((preAppointment, nextAppointment) => +nextAppointment.sortTime - +preAppointment.sortTime);
+        this.contactedList = this.contactedList
+          .filter((appointment) => appointment['appointmentStatus'] !== 'reserved')
+          .map((appointment) => ({ ...appointment, sortTime: new Date(appointment.appointmentDate)}))
+          .sort((preAppointment, nextAppointment) => +nextAppointment.sortTime - +preAppointment.sortTime);
+      }
+
     }
 
     //////////////////////////////////////////////////////////////////////

--
Gitblit v1.8.0