修改中英文切换
This commit is contained in:
@@ -13,39 +13,17 @@
|
||||
<a-tab-pane :tab="msg1Title" key="1">
|
||||
<a-list>
|
||||
<a-list-item :key="index" v-for="(record, index) in announcement1">
|
||||
<div style="margin-left: 5%;width: 80%">
|
||||
<p><a @click="showAnnouncement(record)">{{ record.titile }}</a></p>
|
||||
<p style="color: rgba(0,0,0,.45);margin-bottom: 0px">{{ record.createTime }} 发布</p>
|
||||
<div style="margin-left: 5%;width: 80%;">
|
||||
<p style="overflow: hidden; text-overflow: ellipsis;white-space: nowrap;color:#00B3BE">
|
||||
<a :title="record.msgContent" @click="showAnnouncement(record)">{{ record.msgContent }}</a>
|
||||
</p>
|
||||
</div>
|
||||
<!-- <div style="text-align: right">-->
|
||||
<!-- <a-tag @click="showAnnouncement(record)" v-if="record.priority === 'L'" color="blue">一般消息</a-tag>-->
|
||||
<!-- <a-tag @click="showAnnouncement(record)" v-if="record.priority === 'M'" color="orange">重要消息</a-tag>-->
|
||||
<!-- <a-tag @click="showAnnouncement(record)" v-if="record.priority === 'H'" color="red">紧急消息</a-tag>-->
|
||||
<!-- </div>-->
|
||||
</a-list-item>
|
||||
<div style="margin-top: 5px;text-align: center">
|
||||
<a-button @click="toMyAnnouncement()" type="dashed" block>查看更多</a-button>
|
||||
<a-button @click="toMyAnnouncement()" type="dashed" block>{{this.$t('SeeMore')}}</a-button>
|
||||
</div>
|
||||
</a-list>
|
||||
</a-tab-pane>
|
||||
<!-- <a-tab-pane :tab="msg2Title" key="2">-->
|
||||
<!-- <a-list>-->
|
||||
<!-- <a-list-item :key="index" v-for="(record, index) in announcement2">-->
|
||||
<!-- <div style="margin-left: 5%;width: 80%">-->
|
||||
<!-- <p><a @click="showAnnouncement(record)">{{ record.titile }}</a></p>-->
|
||||
<!-- <p style="color: rgba(0,0,0,.45);margin-bottom: 0px">{{ record.createTime }} 发布</p>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div style="text-align: right">-->
|
||||
<!-- <a-tag @click="showAnnouncement(record)" v-if="record.priority === 'L'" color="blue">一般消息</a-tag>-->
|
||||
<!-- <a-tag @click="showAnnouncement(record)" v-if="record.priority === 'M'" color="orange">重要消息</a-tag>-->
|
||||
<!-- <a-tag @click="showAnnouncement(record)" v-if="record.priority === 'H'" color="red">紧急消息</a-tag>-->
|
||||
<!-- </div>-->
|
||||
<!-- </a-list-item>-->
|
||||
<!-- <div style="margin-top: 5px;text-align: center">-->
|
||||
<!-- <a-button @click="toMyAnnouncement()" type="dashed" block>查看更多</a-button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </a-list>-->
|
||||
<!-- </a-tab-pane>-->
|
||||
</a-tabs>
|
||||
</a-spin>
|
||||
</template>
|
||||
@@ -54,14 +32,12 @@
|
||||
<a-icon style="font-size: 16px; padding: 4px" type="bell"/>
|
||||
</a-badge>
|
||||
</span>
|
||||
<show-announcement ref="ShowAnnouncement" @ok="modalFormOk"></show-announcement>
|
||||
<dynamic-notice ref="showDynamNotice" :path="openPath" :formData="formData"/>
|
||||
</a-popover>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getAction, putAction } from '@/api/manage'
|
||||
import ShowAnnouncement from './ShowAnnouncement'
|
||||
import store from '@/store/'
|
||||
import DynamicNotice from './DynamicNotice'
|
||||
|
||||
@@ -70,7 +46,6 @@
|
||||
name: 'HeaderNotice',
|
||||
components: {
|
||||
DynamicNotice,
|
||||
ShowAnnouncement
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -78,14 +53,15 @@
|
||||
url: {
|
||||
listCementByUser: '/sys/sysAnnouncementSend/getMessageUnreadList',
|
||||
editCementSend: '/sys/sysAnnouncementSend/editByAnntIdAndUserId',
|
||||
queryById: '/sys/annountCement/queryById'
|
||||
queryById: '/sys/annountCement/queryById',
|
||||
readAllMsg:'sys/sysAnnouncementSend/read',
|
||||
},
|
||||
hovered: false,
|
||||
announcement1: [],
|
||||
announcement2: [],
|
||||
msg1Count: '0',
|
||||
msg2Count: '0',
|
||||
msg1Title: '消息通知(0)',
|
||||
msg1Title: this.$t('MessageNotification')+'(0)',
|
||||
msg2Title: '',
|
||||
stopTimer: false,
|
||||
websock: null,
|
||||
@@ -102,9 +78,9 @@
|
||||
},
|
||||
mounted() {
|
||||
this.loadData()
|
||||
//this.timerFun();
|
||||
// this.timerFun();
|
||||
this.initWebSocket()
|
||||
// this.heartCheckFun();
|
||||
this.heartCheckFun()
|
||||
},
|
||||
destroyed: function() { // 离开页面生命周期函数
|
||||
this.websocketOnclose()
|
||||
@@ -126,12 +102,9 @@
|
||||
// 获取系统消息
|
||||
getAction(this.url.listCementByUser).then((res) => {
|
||||
if (res.success) {
|
||||
this.announcement1 = res.result.anntMsgList
|
||||
this.msg1Count = res.result.anntMsgTotal
|
||||
this.msg1Title = '消息通知(' + res.result.anntMsgTotal + ')'
|
||||
this.announcement2 = res.result.sysMsgList
|
||||
this.msg2Count = res.result.sysMsgTotal
|
||||
this.msg2Title = '系统消息(' + res.result.sysMsgTotal + ')'
|
||||
this.announcement1 = res.result
|
||||
this.msg1Count = res.result.length
|
||||
this.msg1Title = this.$t('MessageNotification')+'(' + res.result.length + ')'
|
||||
}
|
||||
}).catch(error => {
|
||||
this.stopTimer = true
|
||||
@@ -148,31 +121,21 @@
|
||||
this.loadding = true
|
||||
setTimeout(() => {
|
||||
this.loadding = false
|
||||
this.loadData()
|
||||
}, 200)
|
||||
},
|
||||
showAnnouncement(record) {
|
||||
putAction(this.url.editCementSend, { anntId: record.id }).then((res) => {
|
||||
if (res.success) {
|
||||
this.loadData()
|
||||
}
|
||||
getAction(this.url.readAllMsg, { ids: record.id }).then((res) => {
|
||||
})
|
||||
this.$router.push({
|
||||
path: '/system/MessageDetails',
|
||||
query: record
|
||||
})
|
||||
this.hovered = false
|
||||
if (record.openType === 'component') {
|
||||
this.openPath = record.openPage
|
||||
this.formData = { id: record.busId }
|
||||
this.$refs.showDynamNotice.detail(record.openPage)
|
||||
} else {
|
||||
this.$refs.ShowAnnouncement.detail(record)
|
||||
}
|
||||
},
|
||||
toMyAnnouncement() {
|
||||
this.$router.push({
|
||||
path: '/isps/userAnnouncement'
|
||||
})
|
||||
},
|
||||
modalFormOk() {
|
||||
},
|
||||
handleHoverChange(visible) {
|
||||
this.hovered = visible
|
||||
},
|
||||
@@ -181,7 +144,6 @@
|
||||
// WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
|
||||
var userId = store.getters.userInfo.id
|
||||
var url = window._CONFIG['domianWebSocketURL'].replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/' + userId
|
||||
//console.log(url);
|
||||
this.websock = new WebSocket(url)
|
||||
this.websock.onopen = this.websocketOnopen
|
||||
this.websock.onerror = this.websocketOnerror
|
||||
@@ -190,8 +152,6 @@
|
||||
},
|
||||
websocketOnopen: function() {
|
||||
console.log('WebSocket连接成功')
|
||||
//心跳检测重置
|
||||
//this.heartCheck.reset().start();
|
||||
},
|
||||
websocketOnerror: function(e) {
|
||||
console.log('WebSocket连接发生错误')
|
||||
@@ -207,8 +167,6 @@
|
||||
//用户消息
|
||||
this.loadData()
|
||||
}
|
||||
//心跳检测重置
|
||||
//this.heartCheck.reset().start();
|
||||
},
|
||||
websocketOnclose: function(e) {
|
||||
console.log('connection closed (' + e + ')')
|
||||
@@ -225,28 +183,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
openNotification(data) {
|
||||
var text = data.msgTxt
|
||||
const key = `open${Date.now()}`
|
||||
this.$notification.open({
|
||||
message: '消息提醒',
|
||||
placement: 'bottomRight',
|
||||
description: text,
|
||||
key,
|
||||
btn: (h) => {
|
||||
return h('a-button', {
|
||||
props: {
|
||||
type: 'primary',
|
||||
size: 'small'
|
||||
},
|
||||
on: {
|
||||
click: () => this.showDetail(key, data)
|
||||
}
|
||||
}, '查看详情')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
reconnect() {
|
||||
var that = this
|
||||
if (that.lockReconnect) return
|
||||
@@ -283,18 +219,6 @@
|
||||
}, this.timeout)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
showDetail(key, data) {
|
||||
this.$notification.close(key)
|
||||
var id = data.msgId
|
||||
getAction(this.url.queryById, { id: id }).then((res) => {
|
||||
if (res.success) {
|
||||
var record = res.result
|
||||
this.showAnnouncement(record)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user