Browse Source

修改管理端tokenKey ws连接

develop
lau572 6 months ago
parent
commit
15a7706e1e
  1. 2
      ruoyi-ui/src/utils/auth.js
  2. 4
      ruoyi-ui/src/views/index.vue
  3. 3
      ruoyi-ui/src/views/websocket.vue

2
ruoyi-ui/src/utils/auth.js

@ -1,6 +1,6 @@
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
const TokenKey = 'DC-Token' const TokenKey = 'DC-Pro-Token'
export function getToken() { export function getToken() {
return Cookies.get(TokenKey) return Cookies.get(TokenKey)

4
ruoyi-ui/src/views/index.vue

@ -701,7 +701,7 @@ export default {
/************************************ 设备消息 **************************************/ /************************************ 设备消息 **************************************/
/** 时间按钮选项 */ /** 时间按钮选项 */
timeDimensionChange() { timeDimensionChange() {
if (this.messageMonitorTimeDimension === 'day') { /*if (this.messageMonitorTimeDimension === 'day') {
this.messageMonitorTimePick = this.getTodayTime() this.messageMonitorTimePick = this.getTodayTime()
const params = { const params = {
time: '1h', time: '1h',
@ -763,7 +763,7 @@ export default {
this.getMessageMonitorData(params, 'received_message') this.getMessageMonitorData(params, 'received_message')
this.getMessageMonitorData(params, 'sent_message') this.getMessageMonitorData(params, 'sent_message')
} }*/
}, },
/** 设备消息char初始化 */ /** 设备消息char初始化 */

3
ruoyi-ui/src/views/websocket.vue

@ -19,7 +19,8 @@ export default {
websocket({ password, path, port, interval}) { websocket({ password, path, port, interval}) {
// websocket // websocket
this.socket.initialize({ this.socket.initialize({
url: 'ws://' + location.hostname + ':' + port + path, // url: 'ws://' + location.hostname + ':' + port + path,
url: 'wss://' + location.hostname + ':' + window.location.port + '/ws' || 80 + '/ws',
password: password, password: password,
tokenSN: this.token, tokenSN: this.token,
heartRate: interval heartRate: interval

Loading…
Cancel
Save