From fdab3659ccadc8276f3e423973d18d4fbca092a8 Mon Sep 17 00:00:00 2001 From: Tomas <tomasysh@gmail.com> Date: 星期六, 05 八月 2023 17:15:09 +0800 Subject: [PATCH] Fixed: [弱掃] p11.2 Bad use of null-like value --- PAMapp/pages/notification/index.vue | 83 +++++++++++++++++++++-------------------- 1 files changed, 43 insertions(+), 40 deletions(-) diff --git a/PAMapp/pages/notification/index.vue b/PAMapp/pages/notification/index.vue index d9f0140..f3de575 100644 --- a/PAMapp/pages/notification/index.vue +++ b/PAMapp/pages/notification/index.vue @@ -1,10 +1,10 @@ <template> <div> - <div class="text--right mb-10" @click="showNotificationHint = true"> - <i class="satisfaction-icon icon-edit"></i> - </div> - <div class="satisfaction-banner my-10 cursor--pointer" @click="$router.push('/satisfactionList')"> - <p class="satisfaction-text text--center">隢‵撖急遛��漲隤踵</p> + <div + v-if="isUserLogin && unReviewLogList.length" + class="satisfaction-banner my-10 cursor--pointer" + @click="$router.push('/satisfactionList')" + > </div> <el-row v-for="(item, index) in notificationList" @@ -14,7 +14,7 @@ align="middle" class="notification-card" > - <el-col class="unRead" :span="3"></el-col> + <el-col class="unRead" :span="3" v-if="!item.readDate"></el-col> <el-col :span="18"> <p class="text">{{item.content}}</p> </el-col> @@ -22,54 +22,57 @@ <div> <UiDateFormat class="date" - :date="item.date" + :date="item.createdDate" onlyShowSection="DAY" /> </div> <div> <UiDateFormat class="time" - :date="item.date" + :date="item.createdDate" onlyShowSection="TIME" /> </div> </el-col> </el-row> - - <PopUpFrame - :isOpen.sync="showNotificationHint" - > - <div class="text--center mdTxt"> - <p class="mb-30">�</p> - <div class="mb-20 cursor--pointer">��撌脰�</div> - <div class="cursor--pointer">����</div> - <div class="text--center mt-30"> - <el-button - type="primary" - @click="showNotificationHint = false" - >蝣箏��</el-button> - </div> - </div> - </PopUpFrame> </div> </template> <script lang="ts"> -import { Component, Vue } from "nuxt-property-decorator"; +import { Component, State, Vue } from "nuxt-property-decorator"; +import { AppointmentLog } from "~/shared/models/appointment.model"; +import { NotificationList } from "~/shared/models/reviews.model"; +import authService from "~/shared/services/auth.service"; +import reviewsService from "~/shared/services/reviews.service"; @Component export default class Notification extends Vue { - showNotificationHint = false; - notificationList = [ - { - content: '蝟餌絞�������10/19(鈭�)22:30�10/21(�)20:00�脰�頂蝯望�', - date: '2022-01-05T04:18:05.249Z' - }, - { - content: '蝟餌絞�������10/19(鈭�)22:30�10/21(�)20:00�脰�頂蝯望�', - date: '2022-01-05T04:18:05.249Z' - } - ] + @State + unReviewLogList!: AppointmentLog[]; + + @State + notificationList!: NotificationList[]; + + isUserLogin = false; + + //////////////////////////////////////////////////////////// + + async mounted() { + this.isUserLogin = authService.isUserLogin(); + + try { + const response = await reviewsService.readAllMyNotification(); + if (response !== null) { + } else { + throw new Error('reviewsService.readAllMyNotification returned null-like value.'); + } + } catch (error) { + console.error('An error occurred while reading all notifications:', error); + throw error; + } + } + + } </script> @@ -77,7 +80,7 @@ .satisfaction-banner { width: 100%; height: 60px; - background-image: url('~/assets/images/satisfaction/satisfactionBtn_mob.svg'); + background-image: url('~/assets/images/satisfaction/satisfactionBtn_s_mob.svg'); background-repeat: no-repeat; background-size: cover; background-position: center; @@ -91,7 +94,7 @@ @include desktop { height: 110px; - background-image: url('~/assets/images/satisfaction/satisfactionBtn_web.svg'); + background-image: url('~/assets/images/satisfaction/satisfactionBtn_s_web.svg'); .satisfaction-text { font-size: 24px; @@ -108,7 +111,7 @@ width: 10px; height: 10px; border-radius: 50px; - background-color: $YELLOW; + background-color: $PRIMARY_RED; } .notification-period { @@ -129,4 +132,4 @@ font-size: 24px; @extend .cursor--pointer; } -</style> \ No newline at end of file +</style> -- Gitblit v1.8.0