diff --git a/nezha-fronted/src/assets/css/common.scss b/nezha-fronted/src/assets/css/common.scss index 9ccb2ffe7..2685b83b1 100644 --- a/nezha-fronted/src/assets/css/common.scss +++ b/nezha-fronted/src/assets/css/common.scss @@ -552,8 +552,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 a3d8d6b64..ef4ea4908 100644 --- a/nezha-fronted/src/libs/bus.js +++ b/nezha-fronted/src/libs/bus.js @@ -402,6 +402,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, @@ -409,6 +410,9 @@ export default new Vue({ h('p', { class: 'notification-summary', + attrs: { + title: item.summary + }, on: { click: self.toAlertPage } @@ -417,7 +421,10 @@ export default new Vue({ ), h('p', { - class: 'notification-description' + class: 'notification-description', + attrs: { + title: item.description + } }, item.description || '-' ) @@ -426,15 +433,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 () {