修改websocet

master
wuzuowei 5 months ago
parent 8a45485a93
commit fe3ca7bfbb

@ -15,6 +15,7 @@ import { SystemData } from '@/microhost/models/system'
import { string } from 'prop-types'; import { string } from 'prop-types';
import { FrameMessage as message1 } from '@/library/union'; import { FrameMessage as message1 } from '@/library/union';
import { WebSocketOption as SocketOption, WebSocketLoader as Socket } from "./ws" import { WebSocketOption as SocketOption, WebSocketLoader as Socket } from "./ws"
import { getLoginId } from '@/utils';
/** /**
@ -63,8 +64,14 @@ const RightInfo = () => {
} }
option.onMessage = (msgdata: any) => { option.onMessage = (msgdata: any) => {
if (getLoginId() == JSON.parse(msgdata).UserNo) {
setsocketData(JSON.parse(msgdata)) setsocketData(JSON.parse(msgdata))
console.log("on message", msgdata) } else {
setsocketData({})
}
// console.log("on message", msgdata, getLoginId())
} }
ws.current = new Socket(option) ws.current = new Socket(option)

@ -7,7 +7,13 @@ import timeUtil from './timeUtil';
const DataUtil = new dataUtil(); const DataUtil = new dataUtil();
const DateUtil = new timeUtil(); const DateUtil = new timeUtil();
const LocalStorageUtil = new localStorageUtil(); const LocalStorageUtil = new localStorageUtil();
export { LocalStorageUtil, request, DataUtil, DateUtil }; const getLoginId = () => {
let userInfo: any = LocalStorageUtil.get("user_info")
return userInfo && userInfo.loginId ? userInfo.loginId : null
}
export { LocalStorageUtil, request, DataUtil, DateUtil, getLoginId };
export const qiankunJump = (url: string, name = '页面名称', params = null) => { export const qiankunJump = (url: string, name = '页面名称', params = null) => {
window.__POWERED_BY_QIANKUN__ ? history.pushState(params, name, url) : umiHistory.push(url) window.__POWERED_BY_QIANKUN__ ? history.pushState(params, name, url) : umiHistory.push(url)

Loading…
Cancel
Save