From f3e662798b3b83a83c2d60dc7b4e6cf1ee4f1331 Mon Sep 17 00:00:00 2001 From: Tomas <tomasysh@gmail.com> Date: 星期六, 05 八月 2023 16:35:00 +0800 Subject: [PATCH] Fixed: [弱掃] p8.2 Bad use of null-like value --- PAMapp/components/Consultant/ConsultantList.vue | 47 ++++++++++++++++++++++++++++++----------------- 1 files changed, 30 insertions(+), 17 deletions(-) diff --git a/PAMapp/components/Consultant/ConsultantList.vue b/PAMapp/components/Consultant/ConsultantList.vue index 1a1b3fb..06ccd84 100644 --- a/PAMapp/components/Consultant/ConsultantList.vue +++ b/PAMapp/components/Consultant/ConsultantList.vue @@ -1,6 +1,5 @@ <template> <div> - <template v-if="agentList.length > 0"> <ConsultantCard v-for="(agent, index) in agentList" @@ -8,12 +7,12 @@ :agentInfo="agent" ></ConsultantCard> </template> - <template v-if="isLogin && agentList.length === 0"> + <template v-if="isUserLogin && agentList.length === 0"> <div class="emptyRowStyle"> - <div class="smTxt txt">����撌脤憿批��</div> + <div class="smTxt txt">{{ noDataPlaceholder }}</div> </div> </template> - <template v-if="!isLogin"> + <template v-if="!isUserLogin"> <div class="emptyRowStyle"> <div class="mdTxt login fix-chrome-click--issue" @click="$router.push('/login')">�� | 閮餃��</div> <div class="smTxt txt ">���憭�</div> @@ -23,24 +22,38 @@ </template> <script lang="ts"> -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'); +import { Consultant } from '~/shared/models/consultant.model'; +import { Vue, Component, Prop } from 'nuxt-property-decorator'; +import authService from '~/shared/services/auth.service'; @Component export default class ConsultantList extends Vue { - @Prop() agents!: Consultant[]; - @roleStorage.Getter currentRole!:string; + @Prop() + agents!: Consultant[]; - get isLogin() { - return this.currentRole === Role.USER; - } + @Prop() + title! : string; + + isUserLogin = false; + + ////////////////////////////////////////////////////////////////////// + get agentList(){ - return this.agents.map((agentDto)=> - ({...agentDto,customerScore:0,}) - ) + return this.agents.map((agentDto)=> + ({...agentDto,customerScore:0,}) + ) + } + + get noDataPlaceholder(): string { + return this.title === 'contactedList' + ? '����撌脰蝯⊿“���' + : '����撌脤憿批��'; + } + + ////////////////////////////////////////////////////////////////////// + + mounted() { + this.isUserLogin = authService.isUserLogin(); } } -- Gitblit v1.8.0