From 391d7db141245798c64aa8acb0f143ab4152aa79 Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期三, 10 十一月 2021 10:47:46 +0800
Subject: [PATCH] TODO#130015/130016 [推薦保險顧問/我的顧問清單] api 串接

---
 PAMapp/pages/myConsultantList.vue |   48 +++++++++++++-----------------------------------
 1 files changed, 13 insertions(+), 35 deletions(-)

diff --git a/PAMapp/pages/myConsultantList.vue b/PAMapp/pages/myConsultantList.vue
index b8e1ba4..fc6c428 100644
--- a/PAMapp/pages/myConsultantList.vue
+++ b/PAMapp/pages/myConsultantList.vue
@@ -1,6 +1,6 @@
 <template>
     <div>
-        <div class="flex mb-30">
+        <div class="pam-cus-tabs mb-30">
             <div
                 class="cus-tab-item"
                 :class="{'is-active': activeTabName === 'consultantList'}"
@@ -29,14 +29,15 @@
 import { Context } from '@nuxt/types';
 import { Vue, Component, Watch } from 'vue-property-decorator';
 import { Route } from 'vue-router/types/router.d'
-import { Agents } from '~/plugins/api/home';
+import { Consultants, getFavoriteConsultant } from '~/assets/ts/api/consultant';
+import { isLogin } from '~/assets/ts/auth';
 
 @Component
 export default class myConsultantList extends Vue {
     activeTabName = 'consultantList';
-    agents: Agents[] = [];
-    contactedList: Agents[] = [];
-    consultantList: Agents[] = [];
+    agents: Consultants[] = [];
+    contactedList: Consultants[] = [];
+    consultantList: Consultants[] = [];
 
     tabClick(path: string) {
         this.activeTabName = path;
@@ -44,13 +45,13 @@
     }
 
     async asyncData(context: Context) {
-        let agents: Agents[] = [];
-        let contactedList: Agents[] = [];
-        let consultantList: Agents[] = [];
+        let agents: Consultants[] = [];
+        let contactedList: Consultants[] = [];
+        let consultantList: Consultants[] = [];
 
-        await context.$service.home.recommendConsultantList().then((result: Agents[]) => {
-            agents = result;
-        })
+        if (isLogin()) {
+            await getFavoriteConsultant().then((response) => agents = response.data);
+        }
 
         contactedList = agents.filter(item => item.contactStatus === 'contacted');
         consultantList = agents.filter(item => item.contactStatus !== 'contacted');
@@ -73,27 +74,4 @@
     }
 
 }
-</script>
-
-<style lang="scss" scoped>
-    .flex {
-        display: flex;
-        width: 100%;
-        height: 45px;
-
-        .cus-tab-item {
-            width: 50%;
-            text-align: center;
-            font-size: 24px;
-            border-bottom: solid 3px $LIGHT_GREY;
-            cursor: pointer;
-        }
-
-        .is-active {
-            font-weight: bold;
-            border-bottom: solid 3px $PRIMARY_BLACK;
-
-        }
-    }
-
-</style>
\ No newline at end of file
+</script>
\ No newline at end of file

--
Gitblit v1.8.0