From 09edc0fb05d672bb0d546045340236541c087eeb Mon Sep 17 00:00:00 2001 From: a0049873 <79py69t9wb@privaterelay.appleid.com> Date: Thu, 29 Dec 2022 11:03:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A5=BF=E6=B5=B7=E5=B2=B8-=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E6=89=93=E5=BC=80=E5=90=8E=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E6=8F=90=E4=B8=80=E4=B8=AA=E6=B5=81=E7=A8=8B=E3=80=81=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E4=B8=80=E4=B8=AA=E6=B5=81=E7=A8=8B=EF=BC=8C=E5=9B=9E?= =?UTF-8?q?=E5=88=B0=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=95=B0=E5=AD=97=E6=9C=89=E8=AF=AF=EF=BC=8C=E7=BC=BA=E5=B0=91?= =?UTF-8?q?=E5=88=B7=E6=96=B0=EF=BC=8C=E5=88=87=E6=8D=A2=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E4=B9=9F=E4=B8=8D=E8=83=BD=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/public/index.html | 7 ++- back/src/views/main-navbar.vue | 60 +++++++++++-------- .../modules/activiti/RoomExamineAdmin.vue | 8 +++ 3 files changed, 47 insertions(+), 28 deletions(-) diff --git a/back/public/index.html b/back/public/index.html index 6dfeafc1..8d7d520c 100644 --- a/back/public/index.html +++ b/back/public/index.html @@ -1,8 +1,8 @@ @@ -39,7 +39,8 @@ window.SITE_CONFIG['previewUrl'] = _global.config.previewUrl; window.SITE_CONFIG['apiURL'] = _global.config.apiURL; // WebSocket地址 - window.SITE_CONFIG['socketURL'] =_global.config.socketURL; + // window.SITE_CONFIG['socketURL'] =_global.config.socketURL; + window.SITE_CONFIG['websocketURL'] = _global.config.websocketURL
diff --git a/back/src/views/main-navbar.vue b/back/src/views/main-navbar.vue index 0df84d2c..bd089054 100644 --- a/back/src/views/main-navbar.vue +++ b/back/src/views/main-navbar.vue @@ -105,8 +105,9 @@ import { messages } from '@/i18n' import screenfull from 'screenfull' import UpdatePassword from './main-navbar-update-password' import { clearLoginInfo } from '@/utils' -// import Cookies from 'js-cookie' -// var socket = null +import Cookies from 'js-cookie' +import bus from '@/views/bus.js' +var socket = null export default { inject: ['refresh'], data () { @@ -120,29 +121,38 @@ export default { UpdatePassword }, created () { - // var vue = this - // socket = new WebSocket(`${window.SITE_CONFIG['socketURL']}?token=${Cookies.get('token')}`) - // socket.onopen = function () {} - // socket.onerror = function () { - // vue.$notify.error({ - // title: vue.$t('notice.disconnect'), - // message: vue.$t('notice.disconnectMessage') - // }) - // } - // socket.onmessage = function (evt) { - // const result = JSON.parse(evt.data) - - // // 如果是有新文本通知,则提示有新通知 - // if (result.type === 0) { - // vue.messageTip = true - // vue.$notify({ - // title: vue.$t('notice.new'), - // message: result.msg, - // type: 'info', - // duration: 5000 - // }) - // } - // } + const that = this + socket = new WebSocket(`${window.SITE_CONFIG.websocketURL}?token=${Cookies.get('ucsToken')}`) + socket.onopen = function () {} + socket.onerror = function () {} + socket.onmessage = function (res) { + switch (that.$route.name) { + case 'myAgent-CompetencyApplication': + console.log('websocket,11') + bus.$emit('competencyApplicationInit') + break + case 'myAgent-AbilityResourceShelf': + console.log('websocket,22') + bus.$emit('abilityResourceShelfInit') + break + case 'myAgent-ApplicationforCompetencyRequirements': + console.log('websocket,33') + bus.$emit('applicationforRequirementsInit') + break + case 'myAgent-AbilityResourcesRemoved': + console.log('websocket,44') + bus.$emit('AbilityResourcesRemovedInit') + break + case 'myAgent-CommentModeration': + console.log('websocket,55') + bus.$emit('commentInit') + break + case 'activiti-RoomExamineAdmin': + console.log('websocket,66') + bus.$emit('roomExamineAdminInit') + break + } + } // 未读通知数 this.getUnReadCount() diff --git a/back/src/views/modules/activiti/RoomExamineAdmin.vue b/back/src/views/modules/activiti/RoomExamineAdmin.vue index 214018a1..78fdadb9 100644 --- a/back/src/views/modules/activiti/RoomExamineAdmin.vue +++ b/back/src/views/modules/activiti/RoomExamineAdmin.vue @@ -215,6 +215,7 @@