diff --git a/admin/.eslintignore b/admin/.eslintignore deleted file mode 100644 index 33959ae..0000000 --- a/admin/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -public -src/assets -node_modules -dist diff --git a/admin/.eslintrc.js b/admin/.eslintrc.js deleted file mode 100644 index 14707ae..0000000 --- a/admin/.eslintrc.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - root: true, - env: { - browser: true, - node: true, - es6: true - }, - parser: 'vue-eslint-parser', - extends: [ - 'plugin:vue/essential', - 'eslint:recommended', - 'plugin:prettier/recommended' - ], - parserOptions: { - ecmaVersion: 2020, - sourceType: 'module' - }, - rules: { - 'no-console': 'off', - 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', - 'vue/multi-word-component-names': 'off' - } -}; diff --git a/pingan/src/assets/audio/message-ding.mp3 b/pingan/src/assets/audio/message-ding.mp3 new file mode 100644 index 0000000..c1af312 Binary files /dev/null and b/pingan/src/assets/audio/message-ding.mp3 differ diff --git a/pingan/src/layout/components/header-notice.vue b/pingan/src/layout/components/header-notice.vue index f45f26c..14417f0 100644 --- a/pingan/src/layout/components/header-notice.vue +++ b/pingan/src/layout/components/header-notice.vue @@ -110,6 +110,9 @@ --> + @@ -145,23 +148,21 @@ window.EventBus.$on('ws:message', (message) => { console.log('收到 WebSocket 消息:', message); if (message.type === 'notice') { + this.notice = [message.data].concat(this.notice); + this.noticeCount++; //弹窗通知有新消息 this.$notify({ - title: '', // 消息标题 - message: '您收到一条新的系统通知,请及时查看', // 消息内容 + title: '消息提醒', // 消息标题 + message: message.data.content ? message.data.content: '您收到一条新的系统通知,请及时查看', // 消息内容 type: 'warning', // 类型:info/success/warning/error duration: 5000, // 5秒后自动关闭,0则不自动关闭 position: 'top-left', // 弹窗位置,可选top-left/bottom-left/bottom-right showClose: true, // 显示关闭按钮 onClick: () => {} }); - //怎么在最开头拼接 - this.notice = [message.data].concat(this.notice); - this.noticeCount++; - // this.notice = message.data; + //提醒声音 + this.playNotificationSound(); } - // 处理具体的业务逻辑 - // this.handleWebSocketMessage(message); }); // 监听 WebSocket 错误 @@ -174,6 +175,14 @@ this.query(); }, methods: { + // 播放提示音 + playNotificationSound() { + const audio = this.$refs.notificationSound; + audio.currentTime = 0; // 重置播放位置(支持连续多次播放) + audio.play().catch((err) => { + console.log("提示音播放失败(浏览器限制):", err); + }); + }, /* 查询数据 */ query() { // getUnreadNotice()