|
|
@@ -1,7 +1,12 @@
|
|
|
<script setup lang="ts">
|
|
|
import NotificationMessageCard from '@/components/NotificationMessageCard/src/NotificationMessageCard.vue'
|
|
|
+import { useRouter } from 'vue-router'
|
|
|
+
|
|
|
+const router = useRouter()
|
|
|
+const loading = ref(false)
|
|
|
|
|
|
const drawerModel = defineModel('drawerModel', { type: Boolean, default: false })
|
|
|
+
|
|
|
const notificationType = ref('all')
|
|
|
const notificationTypeList = ref([
|
|
|
{
|
|
|
@@ -30,72 +35,116 @@ const notificationTypeList = ref([
|
|
|
}
|
|
|
])
|
|
|
|
|
|
-const notificationList = [
|
|
|
- {
|
|
|
- notificationType: 'feature',
|
|
|
- info: {
|
|
|
- isRead: true,
|
|
|
- title: 'Feature Update',
|
|
|
- header: 'New feature online: Quick search has been released!',
|
|
|
- content:
|
|
|
- 'We are pleased to announce that the quick search function is now officially online! You can now quickly find what you need by entering keywords, greatly improving your work efficiency. Go and experience it!'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- notificationType: 'event',
|
|
|
- info: {
|
|
|
- type: 'milestone',
|
|
|
- isMultiple: true,
|
|
|
- numericRecords: 3,
|
|
|
- isRead: true,
|
|
|
- title: 'Milestone Update',
|
|
|
- mode: 'Ocean Freight',
|
|
|
- no: 'HBOL: SHJN2301234',
|
|
|
- tag: 'Booking Confirmed',
|
|
|
- location: 'Hong Kong',
|
|
|
- time: 'Jan 10, 2025 14:30 UTC+8',
|
|
|
- info: {
|
|
|
- route: ['Hong Kong', 'Shanghai', 'Ningbo']
|
|
|
+const notificationList = ref<any[]>([])
|
|
|
+// const notificationList = [
|
|
|
+// {
|
|
|
+// notificationType: 'feature',
|
|
|
+// info: {
|
|
|
+// isRead: true,
|
|
|
+// title: 'Feature Update',
|
|
|
+// header: 'New feature online: Quick search has been released!',
|
|
|
+// content:
|
|
|
+// 'We are pleased to announce that the quick search function is now officially online! You can now quickly find what you need by entering keywords, greatly improving your work efficiency. Go and experience it!'
|
|
|
+// }
|
|
|
+// },
|
|
|
+// {
|
|
|
+// notificationType: 'event',
|
|
|
+// info: {
|
|
|
+// type: 'milestone',
|
|
|
+// isMultiple: true,
|
|
|
+// numericRecords: 3,
|
|
|
+// isRead: true,
|
|
|
+// title: 'Milestone Update',
|
|
|
+// mode: 'Ocean Freight',
|
|
|
+// no: 'HBOL: SHJN2301234',
|
|
|
+// tag: 'Booking Confirmed',
|
|
|
+// location: 'Hong Kong',
|
|
|
+// time: 'Jan 10, 2025 14:30 UTC+8',
|
|
|
+// info: {
|
|
|
+// route: ['Hong Kong', 'Shanghai', 'Ningbo']
|
|
|
+// }
|
|
|
+// }
|
|
|
+// },
|
|
|
+// {
|
|
|
+// notificationType: 'password',
|
|
|
+// info: {
|
|
|
+// title: 'Password Notifications',
|
|
|
+// isExpiration: true,
|
|
|
+// tips: 'Password Expiration in 311 Days',
|
|
|
+// content:
|
|
|
+// 'Your password will expire in 7 days. To ensure the security of your account, please change your password as soon as possible.'
|
|
|
+// }
|
|
|
+// },
|
|
|
+// {
|
|
|
+// notificationType: 'password',
|
|
|
+// info: {
|
|
|
+// isRead: false,
|
|
|
+// title: 'Password Notifications',
|
|
|
+// isExpiration: false,
|
|
|
+// tips: 'Password Expiration in 3 Days',
|
|
|
+// content:
|
|
|
+// 'Your password will expire in 7 days. To ensure the security of your account, please change your password as soon as possible.'
|
|
|
+// }
|
|
|
+// },
|
|
|
+// {
|
|
|
+// notificationType: 'password',
|
|
|
+// info: {
|
|
|
+// isRead: true,
|
|
|
+// title: 'Password Notifications',
|
|
|
+// isExpiration: true,
|
|
|
+// tips: 'Password Expiration in 31111 Days',
|
|
|
+// content:
|
|
|
+// 'Your password will expire in 7 days. To ensure the security of your account, please change your password as soon as possible.'
|
|
|
+// }
|
|
|
+// }
|
|
|
+// ]
|
|
|
+
|
|
|
+const getNotificationList = () => {
|
|
|
+ loading.value = true
|
|
|
+ $api
|
|
|
+ .getNotificationList({
|
|
|
+ rules_type: 'Milestone_Update'
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ notificationList.value = res.data
|
|
|
+ console.log(res, 'test')
|
|
|
}
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- notificationType: 'password',
|
|
|
- info: {
|
|
|
- title: 'Password Notifications',
|
|
|
- isExpiration: true,
|
|
|
- tips: 'Password Expiration in 311 Days',
|
|
|
- content:
|
|
|
- 'Your password will expire in 7 days. To ensure the security of your account, please change your password as soon as possible.'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- notificationType: 'password',
|
|
|
- info: {
|
|
|
- isRead: false,
|
|
|
- title: 'Password Notifications',
|
|
|
- isExpiration: false,
|
|
|
- tips: 'Password Expiration in 3 Days',
|
|
|
- content:
|
|
|
- 'Your password will expire in 7 days. To ensure the security of your account, please change your password as soon as possible.'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- notificationType: 'password',
|
|
|
- info: {
|
|
|
- isRead: true,
|
|
|
- title: 'Password Notifications',
|
|
|
- isExpiration: true,
|
|
|
- tips: 'Password Expiration in 31111 Days',
|
|
|
- content:
|
|
|
- 'Your password will expire in 7 days. To ensure the security of your account, please change your password as soon as possible.'
|
|
|
- }
|
|
|
- }
|
|
|
-]
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ loading.value = false
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const handleMarkAllRead = () => {
|
|
|
+ // 标记所有为已读
|
|
|
+ // notificationList.value.forEach((item) => {
|
|
|
+ // item.isRead = true
|
|
|
+ // })
|
|
|
+}
|
|
|
+
|
|
|
+const handleViewAll = () => {
|
|
|
+ router.push('/system-message')
|
|
|
+}
|
|
|
+
|
|
|
+const handleSettingMessage = () => {
|
|
|
+ // 跳转消息设置页面
|
|
|
+ // router.push('/')
|
|
|
+}
|
|
|
+
|
|
|
+const clearData = () => {
|
|
|
+ notificationList.value = []
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <el-drawer class="notice-drawer" v-model="drawerModel" size="432px">
|
|
|
+ <el-drawer
|
|
|
+ @open="getNotificationList"
|
|
|
+ @closed="clearData"
|
|
|
+ class="notice-drawer"
|
|
|
+ v-model="drawerModel"
|
|
|
+ size="432px"
|
|
|
+ >
|
|
|
<template #header>
|
|
|
<el-select size="large" v-model="notificationType" class="notification-type">
|
|
|
<el-option
|
|
|
@@ -107,20 +156,34 @@ const notificationList = [
|
|
|
</el-select>
|
|
|
</template>
|
|
|
<template #default>
|
|
|
- <div class="notification-header">
|
|
|
- <div class="mark-all-read">
|
|
|
- <span class="font_family icon-icon_confirm_b show-icon"></span>
|
|
|
- <span>Mark all read</span>
|
|
|
+ <div v-vloading="loading" style="height: 100%">
|
|
|
+ <div class="notification-header">
|
|
|
+ <el-button @click="handleMarkAllRead" class="mark-all-read el-button--text" size="small">
|
|
|
+ <span class="font_family icon-icon_confirm_b show-icon"></span>
|
|
|
+ <span>Mark all read</span>
|
|
|
+ </el-button>
|
|
|
+ <div class="view-all">
|
|
|
+ <el-button
|
|
|
+ style="height: 24px; width: 86px"
|
|
|
+ class="el-button--text"
|
|
|
+ @click="handleViewAll"
|
|
|
+ >
|
|
|
+ <span class="font_family icon-icon_confirm_b show-icon"></span>
|
|
|
+ <span>View all</span>
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ class="el-button--text"
|
|
|
+ style="height: 24px; width: 24px; padding: 0"
|
|
|
+ @click="handleSettingMessage"
|
|
|
+ >
|
|
|
+ <span class="font_family icon-icon_administration_b"></span>
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div class="view-all">
|
|
|
- <span class="font_family icon-icon_confirm_b show-icon"></span>
|
|
|
- <span>View all</span>
|
|
|
- <span class="font_family icon-icon_administration_b setting"></span>
|
|
|
+ <div class="notification-content">
|
|
|
+ <NotificationMessageCard :data="notificationList" />
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="notification-content">
|
|
|
- <NotificationMessageCard :data="notificationList" />
|
|
|
- </div>
|
|
|
</template>
|
|
|
</el-drawer>
|
|
|
</template>
|
|
|
@@ -235,6 +298,7 @@ div.layout-toolbar {
|
|
|
.notification-header {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
position: sticky;
|
|
|
top: 0;
|
|
|
height: 40px;
|
|
|
@@ -245,9 +309,11 @@ div.layout-toolbar {
|
|
|
.mark-all-read {
|
|
|
span {
|
|
|
color: var(--color-theme);
|
|
|
+ font-size: 14px;
|
|
|
vertical-align: middle;
|
|
|
}
|
|
|
.show-icon {
|
|
|
+ font-size: 16px;
|
|
|
margin-right: 2px;
|
|
|
}
|
|
|
}
|