【fix ESLint】src/components/tools

This commit is contained in:
zhaoxiao
2023-03-06 10:05:21 +08:00
parent e60ab2b2e1
commit 516af1cb77
6 changed files with 22 additions and 23 deletions
+15 -15
View File
@@ -32,7 +32,7 @@
<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>
<p style="color: rgba(0,0,0,.45);margin-bottom: 0">{{ record.createTime }} 发布</p>
</div>
<div style="text-align: right">
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'L'" color="blue">一般消息</a-tag>
@@ -50,7 +50,7 @@
<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>
<p style="color: rgba(0,0,0,.45);margin-bottom: 0">{{ record.createTime }} 发布</p>
</div>
<div style="text-align: right">
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'L'" color="blue">一般消息</a-tag>
@@ -130,7 +130,7 @@ export default {
this.stopTimer = false
const myTimer = setInterval(() => {
// 停止定时器
if (this.stopTimer == true) {
if (this.stopTimer === true) {
clearInterval(myTimer)
return
}
@@ -197,8 +197,8 @@ export default {
initWebSocket: function () {
// WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
var userId = store.getters.userInfo.id
var url = window._CONFIG.domianWebSocketURL.replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/' + userId
const userId = store.getters.userInfo.id
const 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
@@ -211,17 +211,17 @@ export default {
// 心跳检测重置
// this.heartCheck.reset().start();
},
websocketOnerror: function (e) {
websocketOnerror: function () {
console.log('WebSocket连接发生错误')
this.reconnect()
},
websocketOnmessage: function (e) {
console.log('-----接收消息-------', e.data)
var data = eval('(' + e.data + ')') // 解析对象
if (data.cmd == 'topic') {
const data = eval('(' + e.data + ')') // 解析对象
if (data.cmd + '' === 'topic') {
// 系统通知
this.loadData()
} else if (data.cmd == 'user') {
} else if (data.cmd + '' === 'user') {
// 用户消息
this.loadData()
}
@@ -244,7 +244,7 @@ export default {
},
openNotification (data) {
var text = data.msgTxt
const text = data.msgTxt
const key = `open${Date.now()}`
this.$notification.open({
message: '消息提醒',
@@ -266,7 +266,7 @@ export default {
},
reconnect () {
var that = this
const that = this
if (that.lockReconnect) return
that.lockReconnect = true
// 没连接上会一直重连,设置延迟避免请求过多
@@ -277,7 +277,7 @@ export default {
}, 5000)
},
heartCheckFun () {
var that = this
const that = this
// 心跳检测,每20s心跳一次
that.heartCheck = {
timeout: 20000,
@@ -289,7 +289,7 @@ export default {
return this
},
start: function () {
var self = this
// const self = this
this.timeoutObj = setTimeout(function () {
// 这里发送一个心跳,后端收到后,返回一个心跳消息,
// onmessage拿到返回的心跳就说明连接正常
@@ -305,10 +305,10 @@ export default {
showDetail (key, data) {
this.$notification.close(key)
var id = data.msgId
const id = data.msgId
getAction(this.url.queryById, { id: id }).then((res) => {
if (res.success) {
var record = res.result
const record = res.result
this.showAnnouncement(record)
}
})