From e77288ce022cc929c0a64764b9d9ed40fa533879 Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期三, 23 二月 2022 17:12:32 +0800
Subject: [PATCH] Update#135928 [顧問編輯個人帳戶資訊] 新增 email 欄位

---
 PAMapp/pages/agentInfo/_agentNo.vue      |    9 +++++++++
 PAMapp/pages/agentInfo/edit/_agentNo.vue |   40 ++++++++++++++++++++++++++++++++++++----
 PAMapp/shared/models/account.model.ts    |    5 +++--
 3 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/PAMapp/pages/agentInfo/_agentNo.vue b/PAMapp/pages/agentInfo/_agentNo.vue
index 392ce7d..05d4d62 100644
--- a/PAMapp/pages/agentInfo/_agentNo.vue
+++ b/PAMapp/pages/agentInfo/_agentNo.vue
@@ -36,6 +36,15 @@
       </el-row>
 
       <el-row
+        v-if="currentRole === role.ADMIN"
+        type="flex"
+        class="pam-paragraph">
+        <UiField :span="12" icon="comment" label="靽∠拳">
+          {{ agentInfo.email }}
+        </UiField>
+      </el-row>
+
+      <el-row
         type="flex"
         class="pam-paragraph">
         <UiField :span="12" icon="agent" label="����">
diff --git a/PAMapp/pages/agentInfo/edit/_agentNo.vue b/PAMapp/pages/agentInfo/edit/_agentNo.vue
index ae47457..eb95946 100644
--- a/PAMapp/pages/agentInfo/edit/_agentNo.vue
+++ b/PAMapp/pages/agentInfo/edit/_agentNo.vue
@@ -68,6 +68,27 @@
         </el-col>
       </el-row>
 
+      <el-row
+        type="flex"
+        class="pam-paragraph">
+        <el-col :span="24" class="pam-field">
+          <div class="pam-field__label pam-progress__label">
+            <div>
+              <div class="pam-field__title mb-10">
+                <i class="pam-icon icon-comment"
+                  ></i>靽∠拳
+                  <span class="hint text--bold" v-show="!emailValid">靽∠拳�撘�炊</span>
+                  <span class="hint text--bold" v-show="editInfoValue.email.length === 0">靽∠拳�敹‵</span>
+              </div>
+            </div>
+            <el-input
+            v-model="editInfoValue.email"
+            :class="{'is-invalid': !emailValid}"
+            ></el-input>
+          </div>
+        </el-col>
+      </el-row>
+
 
       <el-row
         type="flex"
@@ -294,7 +315,8 @@
     awards            : '',
     communicationStyle: [] as string[],
     photoBase64       : '',
-    phoneNumber       : ''
+    phoneNumber       : '',
+    email             : '',
   };
 
   communicationStyleList: string[] = agentCommunicationStyleList;
@@ -375,7 +397,8 @@
       experiences       : agentInfo.experiences  || '',
       awards            : agentInfo.awards || '',
       communicationStyle: agentInfo.communicationStyle || '',
-      photoBase64       : ''
+      photoBase64       : '',
+      email             : agentInfo.email || ''
     };
 
     this.editInfoValue = {
@@ -386,14 +409,17 @@
     }
   }
 
+
   //////////////////////////////////////////////////////////////////////
 
   editAgentInfoSetting(): void {
+    console.log('???', this.editInfoValue)
     const editSettingInfo: any = {
       ...this.editInfoValue,
       communicationStyle: this.editInfoValue.communicationStyle.join('��'),
       serveArea: this.editInfoValue.serveArea.join('��'),
-    }
+    };
+    console.log('!!!', editSettingInfo);
     accountSettingService.editAgentInfoSetting(editSettingInfo).then((res: AgentInfoSetting) => {
       this.isInfoUpdate = true;
       this.updateConsultantDetail(editSettingInfo.agentNo);
@@ -437,6 +463,11 @@
             : true;
         }
 
+  get emailValid() {
+      const rule = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
+      return this.editInfoValue.email ? rule.test(this.editInfoValue.email) : true;
+    }
+
   get isSubmitBtnDisabled(): boolean {
       const isFormValid =  this.editInfoValue.name
                         && this.editInfoValue.title
@@ -447,7 +478,8 @@
                         && this.editInfoValue.phoneNumber.length
                         && this.editInfoValue.seniorityYear
                         && this.editInfoValue.expertise.length
-                        && this.editInfoValue.communicationStyle.length;
+                        && this.editInfoValue.communicationStyle.length
+                        && this.editInfoValue.email.length;
       return !isFormValid
   }
 }
diff --git a/PAMapp/shared/models/account.model.ts b/PAMapp/shared/models/account.model.ts
index f2e0e03..f433c6c 100644
--- a/PAMapp/shared/models/account.model.ts
+++ b/PAMapp/shared/models/account.model.ts
@@ -17,8 +17,9 @@
     seniorityYear     : number;
     seniorityMonth    : number;
     concept           : string;
-    experiences        : string;
-    awards           : string;
+    experiences       : string;
+    awards            : string;
     communicationStyle: string;
     photoBase64       : string;
+    email             : string;
 }

--
Gitblit v1.8.0