From f7daa75b1e42a107d3befc0c6e798568ceac1dda Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期日, 14 八月 2022 22:45:49 +0800
Subject: [PATCH] fix: requirement 確認有值再執行 split(), 畫面上無值則顯示 '--'

---
 PAMapp/components/Consultant/ConsultantCard.vue |    2 +-
 PAMapp/pages/questionnaire/_agentNo.vue         |    4 +++-
 PAMapp/pages/index.vue                          |    6 ++++--
 PAMapp/components/Client/ClientCard.vue         |    4 ++--
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/PAMapp/components/Client/ClientCard.vue b/PAMapp/components/Client/ClientCard.vue
index 9f11d09..3ab3c19 100644
--- a/PAMapp/components/Client/ClientCard.vue
+++ b/PAMapp/components/Client/ClientCard.vue
@@ -118,7 +118,7 @@
                 <p>�批嚗�<span>{{gender}}</span></p>
                 <p>撟湧翩嚗�<span>{{client.age | toAgeLabel }}</span></p>
                 <p>�璆哨��<span>{{client.job}}</span></p>
-                <p>��瘙��<span>{{client.requirement.split(',').join('��')}}</span></p>
+                <p>��瘙��<span>{{ client.requirement ? client.requirement.split(',').join('��') : '--' }}</span></p>
                 <p v-for="(item, index) in hopeContactTime"
                     :key="index"
                 >��蝯⊥�挾{{index + 1 | formatNumber}}嚗�<span>{{ item | formatHopeContactTime}}</span></p>
@@ -382,7 +382,7 @@
     }
 
     get requirements() {
-        return this.client.requirement.split(',');
+        return this.client.requirement ? this.client.requirement.split(',') : [];
     }
 
     get gender() {
diff --git a/PAMapp/components/Consultant/ConsultantCard.vue b/PAMapp/components/Consultant/ConsultantCard.vue
index 6c9bcd2..464c572 100644
--- a/PAMapp/components/Consultant/ConsultantCard.vue
+++ b/PAMapp/components/Consultant/ConsultantCard.vue
@@ -76,7 +76,7 @@
                     <p>�批嚗{gender}}</p>
                     <p>撟湧翩嚗{appointmentDetail.age | toAgeLabel }}</p>
                     <p>�璆哨�{appointmentDetail.job}}</p>
-                    <p>��瘙�{appointmentDetail.requirement.split(',').join('��')}}</p>
+                    <p>��瘙�{appointmentDetail.requirement ? appointmentDetail.requirement.split(',').join('��') : '--'}}</p>
                     <p
                         v-for="(item, index) in hopeContactTime"
                         :key="index"
diff --git a/PAMapp/pages/index.vue b/PAMapp/pages/index.vue
index 33eb384..30aa5ed 100644
--- a/PAMapp/pages/index.vue
+++ b/PAMapp/pages/index.vue
@@ -59,7 +59,7 @@
                   <p>�批嚗{gender}}</p>
                   <p>撟湧翩嚗{appointmentDetail.age | toAgeLabel }}</p>
                   <p>�璆哨�{appointmentDetail.job}}</p>
-                  <p>��瘙�{appointmentDetail.requirement.split(',').join('��')}}</p>
+                  <p>��瘙�{ appointmentDetail.requirement ? appointmentDetail.requirement.split(',').join('��') : '--'}}</p>
                   <p
                       v-for="(item, index) in hopeContactTime"
                       :key="index"
@@ -362,7 +362,9 @@
 
     reAppointment(): void {
       appointmentService.cancelAppointment(this.appointmentDetail.id).then(() => {
-        const requirements = this.appointmentDetail.requirement.split(',');
+        const requirements = this.appointmentDetail && this.appointmentDetail.requirement
+                            ? this.appointmentDetail.requirement.split(',')
+                            : [];
         this.storeConsultantList();
         this.storageStrickQueryItem({ requirements: requirements });
         this.storageClearNotContactAppointmentIdFromMsg();
diff --git a/PAMapp/pages/questionnaire/_agentNo.vue b/PAMapp/pages/questionnaire/_agentNo.vue
index 4e55158..553ccee 100644
--- a/PAMapp/pages/questionnaire/_agentNo.vue
+++ b/PAMapp/pages/questionnaire/_agentNo.vue
@@ -416,7 +416,9 @@
         return {
             ...appointmentInfo,
             hopeContactTime: hopeContactTime,
-            requirement: appointmentInfo.requirement.split(',')
+            requirement: appointmentInfo.requirement 
+                        ? appointmentInfo.requirement.split(',')
+                        : []
           }
       } else {
         return null;

--
Gitblit v1.8.0