From 76c1ce3c2eb001560bfb785f7b2f62d4ec64dcb6 Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期五, 10 十二月 2021 09:49:50 +0800
Subject: [PATCH] update 使用 currentRole 判斷目前是否為顧問/客戶登入狀態

---
 PAMapp/components/Consultant/ConsultantList.vue |   51 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/PAMapp/components/Consultant/ConsultantList.vue b/PAMapp/components/Consultant/ConsultantList.vue
index efc3914..1a1b3fb 100644
--- a/PAMapp/components/Consultant/ConsultantList.vue
+++ b/PAMapp/components/Consultant/ConsultantList.vue
@@ -1,46 +1,55 @@
 <template>
     <div>
-        <template v-if="agents.length > 0">
+
+        <template v-if="agentList.length > 0">
             <ConsultantCard
-                v-for="(agent, index) in agents"
+                v-for="(agent, index) in agentList"
                 :key="index"
                 :agentInfo="agent"
-                @removeAgent="removeAgent"
             ></ConsultantCard>
         </template>
-        <template v-else-if="noLogin">
-            <div class="emptyRowStyle">
-                <div class="mdTxt login" @click="$router.push('/login')">��</div>
-                <div class="smTxt txt">���憭歇�憿批��</div>
-            </div>
-        </template>
-        <template v-else>
+        <template v-if="isLogin && agentList.length === 0">
             <div class="emptyRowStyle">
                 <div class="smTxt txt">����撌脤憿批��</div>
+            </div>
+        </template>
+        <template v-if="!isLogin">
+            <div class="emptyRowStyle">
+                <div class="mdTxt login fix-chrome-click--issue" @click="$router.push('/login')">�� | 閮餃��</div>
+                <div class="smTxt txt ">���憭�</div>
             </div>
         </template>
     </div>
 </template>
 
 <script lang="ts">
-import { Vue, Component, Prop, Emit } from 'nuxt-property-decorator';
-import { Agents } from '~/plugins/api/home';
+import { Vue, Component, Prop, namespace } from 'nuxt-property-decorator';
+import { Consultant } from '~/assets/ts/models/consultant.model';
+import { Role } from '~/assets/ts/models/enum/Role';
+
+const roleStorage = namespace('localStorage');
 
 @Component
 export default class ConsultantList extends Vue {
-    @Prop() agents!: Agents[];
+    @Prop() agents!: Consultant[];
+    @roleStorage.Getter currentRole!:string;
 
-    noLogin = false;
-
-    @Emit('removeAgent') removeAgent(agentId: number) {
-        return agentId;
+    get isLogin() {
+        return this.currentRole === Role.USER;
     }
+    get agentList(){
+        return this.agents.map((agentDto)=>
+            ({...agentDto,customerScore:0,})
+        )
+    }
+
 }
 </script>
 
 <style lang="scss" scoped>
+
     .emptyRowStyle {
-        background-color: #FFFFFF;
+        background-color: $PRIMARY_WHITE;
         width: 100%;
         height: 100px;
         display: flex;
@@ -48,14 +57,14 @@
         align-items: center;
 
         .login {
-            color: #ED1B2E;
+            color: $PRIMARY_RED;
             cursor: pointer;
         }
 
         .txt {
-            color: #68737A;
+            color: $PRUDENTIAL_GREY;
             margin-left: 17px;
         }
     }
 
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.8.0