From 11b24c4c2c2d9042ccff245a70c208c0fdacdeb6 Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期三, 15 十二月 2021 17:47:17 +0800
Subject: [PATCH] Merge branch 'master' of https://dev.pollex.com.tw:8443/r/pcalife/PAM

---
 PAMapp/assets/ts/models/agent-info.model.ts        |   18 +++++++++
 PAMapp/pages/agentInfo/_agentNo.vue                |   44 +++++++--------------
 PAMapp/assets/ts/services/my-consultant.service.ts |    6 +++
 3 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/PAMapp/assets/ts/models/agent-info.model.ts b/PAMapp/assets/ts/models/agent-info.model.ts
new file mode 100644
index 0000000..891ba42
--- /dev/null
+++ b/PAMapp/assets/ts/models/agent-info.model.ts
@@ -0,0 +1,18 @@
+export interface AgentInfo {
+  name            : string;
+  agentNo         : string;
+  role            : string;
+  img             : string;
+  avgScore        : number;
+  title           : string;
+  phoneNumber     : string;
+  serveArea       : string;
+  companyAddress  : string;
+  seniority       : string;
+  suitability     : number;
+  evaluation      : number;
+  expertise       : string[];
+  concept         : string;
+  experiences     : string[];
+  awards          : string;
+}
diff --git a/PAMapp/assets/ts/services/my-consultant.service.ts b/PAMapp/assets/ts/services/my-consultant.service.ts
index 4f4c686..c27a41d 100644
--- a/PAMapp/assets/ts/services/my-consultant.service.ts
+++ b/PAMapp/assets/ts/services/my-consultant.service.ts
@@ -1,5 +1,6 @@
 import { http } from "./httpClient";
 
+import { AgentInfo } from '~/assets/ts/models/agent-info.model';
 import { Consultant } from "../models/consultant.model";
 
 class MyConsultantService {
@@ -18,6 +19,11 @@
     http.post('/consultant/favorite/view');
   }
 
+  //憿批�底蝝啗���
+  async getConsultantDetail(agentNo:string): Promise<AgentInfo> {
+    return http.get('/consultant/detail', {params:{agentNo:agentNo}}).then((res) => res.data);
+  }
+
 }
 
 export default new MyConsultantService();
diff --git a/PAMapp/pages/agentInfo/_agentNo.vue b/PAMapp/pages/agentInfo/_agentNo.vue
index c164fad..0267976 100644
--- a/PAMapp/pages/agentInfo/_agentNo.vue
+++ b/PAMapp/pages/agentInfo/_agentNo.vue
@@ -189,11 +189,14 @@
 import { Context } from '@nuxt/types';
 import { namespace } from 'nuxt-property-decorator';
 import { Vue, Component } from 'vue-property-decorator';
-import { getConsultantDetail } from '~/assets/ts/api/consultant';
-import { Role } from '~/assets/ts//models/enum/Role';
+
+import myConsultantService from '~/assets/ts/services/my-consultant.service';
+import { AgentInfo } from '~/assets/ts/models/agent-info.model';
 import { hideReviews } from '~/assets/ts/const/hide-reviews';
+import { Role } from '~/assets/ts//models/enum/Role';
 
 const roleStorage = namespace('localStorage');
+
 @Component
 export default class AgentInfoComponent extends Vue {
   @roleStorage.Getter currentRole!:string|null;
@@ -204,20 +207,21 @@
   fieldInfoTitle = '';
   fieldInfoDesc = '';
   hideReviews = hideReviews ;
-  async asyncData(context: Context) {
-    const agentNo = context.route.params.agentNo;
-    let agentInfo = {};
-    await getConsultantDetail(agentNo).then((res) => agentInfo = res.data )
-    return {
-      agentInfo
-    }
-  }
+
+  //////////////////////////////////////////////////////////////////////
 
   get agentName(): string {
     return `${this.agentInfo.name}(${this.agentInfo.role})`;
   }
 
-  alertAddSuccess() {
+  async asyncData(context: Context) {
+    const agentNo = context.route.params.agentNo;
+    return {
+      agentInfo: await myConsultantService.getConsultantDetail(agentNo).then((res) => res)
+    }
+  }
+
+  alertAddSuccess(): void {
       this.isAlertAddSuccess = true;
   }
 
@@ -236,24 +240,6 @@
   }
 }
 
-interface AgentInfo {
-  name            : string;
-  agentNo         : string;
-  role            : string;
-  img             : string;
-  avgScore        : number;
-  title           : string;
-  phoneNumber     : string;
-  serveArea       : string;
-  companyAddress  : string;
-  seniority       : string;
-  suitability     : number;
-  evaluation      : number;
-  expertise       : string[];
-  concept         : string;
-  experiences     : string[];
-  awards          : string;
-}
 </script>
 
 <style lang="scss">

--
Gitblit v1.8.0