From 2e0a26fd43c1f20ed54c2b43e28ef96b6d0af379 Mon Sep 17 00:00:00 2001 From: zyh Date: Wed, 29 Nov 2023 15:15:06 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E6=B6=88=E6=81=AF=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/assets/css/common.scss | 5 ++++- nezha-fronted/src/libs/bus.js | 27 ++++++++++++++++++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/nezha-fronted/src/assets/css/common.scss b/nezha-fronted/src/assets/css/common.scss index 0f8fd751d..9bd6471e8 100644 --- a/nezha-fronted/src/assets/css/common.scss +++ b/nezha-fronted/src/assets/css/common.scss @@ -533,8 +533,11 @@ textarea { .newAlert-notification{ width: auto; padding: 15px 55px 15px 18px; - border-radius: 4px; align-items: center; + background: $--background-color-2; + border: 1px solid $--border-color-base; + border-radius: 4px; + z-index: 9999999999 !important; .el-notification__icon{ font-size: 20px; color: #EC7F66; diff --git a/nezha-fronted/src/libs/bus.js b/nezha-fronted/src/libs/bus.js index cb0427887..c13260d37 100644 --- a/nezha-fronted/src/libs/bus.js +++ b/nezha-fronted/src/libs/bus.js @@ -390,6 +390,7 @@ export default new Vue({ response.data.list.forEach((item, index) => { setTimeout(() => { this.$notify({ + offset: 90, duration: 5000, iconClass: 'nz-icon nz-icon-Notification', dangerouslyUseHTMLString: true, @@ -397,6 +398,9 @@ export default new Vue({ h('p', { class: 'notification-summary', + attrs: { + title: item.summary + }, on: { click: self.toAlertPage } @@ -405,7 +409,10 @@ export default new Vue({ ), h('p', { - class: 'notification-description' + class: 'notification-description', + attrs: { + title: item.description + } }, item.description || '-' ) @@ -414,15 +421,27 @@ export default new Vue({ }) }, 10 * index) }) - this.audio.play() + let playCount = 0 + const audioLoop = store.state.nzDefaultConfig.audioLoop || 3 + const maxPlayCount = parseInt(audioLoop) // 设置希望播放的次数 + if (maxPlayCount) { + this.audio.play() + } + this.audio.addEventListener('ended', () => { + playCount++ + if (playCount < maxPlayCount) { + this.audio.play() + } + }) } } }, ms) }, toAlertPage () { - if (router.currentRoute.path !== '/alertMessage') { - router.push({ path: '/alertMessage' }) + if (router.currentRoute.path === '/alertMessage') { + store.commit('setIsRouteLive') } + router.push({ path: '/alertMessage' }) this.$notify.closeAll() }, closeNotification () {