Merge branch 'master' of http://192.168.1.22:3000/frontend/pqs-9100_client
This commit is contained in:
@@ -25,17 +25,18 @@ export default class SocketService {
|
||||
reconnectDelay= 5000; // 重新连接延迟,单位毫秒
|
||||
|
||||
// 定义连接服务器的方法
|
||||
connect(url) {
|
||||
connect() {
|
||||
|
||||
// 连接服务器
|
||||
if (!window.WebSocket) {
|
||||
return console.log('您的浏览器不支持WebSocket');
|
||||
}
|
||||
console.log(url)
|
||||
|
||||
// let token = $.cookie('123');
|
||||
// let token = '4E6EF539AAF119D82AC4C2BC84FBA21F';
|
||||
|
||||
|
||||
const url = 'ws://192.168.1.133:7777/hello?name=cdf'
|
||||
this.ws = new WebSocket(url);
|
||||
// 连接成功的事件
|
||||
this.ws.onopen = () => {
|
||||
@@ -60,6 +61,13 @@ export default class SocketService {
|
||||
|
||||
|
||||
};
|
||||
|
||||
this.ws.onerror = () => {
|
||||
ElMessage.error("webSocket连接异常!");
|
||||
|
||||
|
||||
};
|
||||
|
||||
// 得到服务端发送过来的数据
|
||||
this.ws.onmessage = (event) => {
|
||||
let message: { [key: string]: any };
|
||||
|
||||
@@ -989,8 +989,8 @@ const handleTest = async (val: string) => {
|
||||
// }
|
||||
|
||||
|
||||
const url = 'ws://localhost:7777/hello?name=cdf';
|
||||
socketClient.Instance.connect(url);
|
||||
|
||||
socketClient.Instance.connect();
|
||||
dataSocket.socketServe = socketClient.Instance;
|
||||
dataSocket.socketServe.registerCallBack('aaa', (res: { code: number; }) => {
|
||||
// 处理来自服务器的消息
|
||||
|
||||
@@ -216,8 +216,7 @@ const open = (selection: Device.ResPqDev[], title: string, time: boolean) => {
|
||||
preTestStatus.value = 'waiting';//预检测执行状态
|
||||
//开始创建webSocket客户端
|
||||
|
||||
const url = 'ws://localhost:7777/hello?name=cdf';
|
||||
socketClient.Instance.connect(url);
|
||||
socketClient.Instance.connect();
|
||||
dataSocket.socketServe = socketClient.Instance;
|
||||
dataSocket.socketServe.registerCallBack('aaa', (res) => {
|
||||
// 处理来自服务器的消息
|
||||
@@ -249,16 +248,16 @@ const handleSubmit = () => {
|
||||
let deviceIds = checkStore.devices.map((item) => item.deviceId)
|
||||
let planId = checkStore.planId
|
||||
|
||||
|
||||
if(!dataSocket.socketServe.connected){
|
||||
ElMessage.error('webSocket连接中断!')
|
||||
return
|
||||
}
|
||||
|
||||
switch (stepsActiveIndex.value) {
|
||||
case 0:
|
||||
// preTestStatus.value = 'start'
|
||||
|
||||
|
||||
/* loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '',
|
||||
background: 'rgb(255, 255, 255, 0)',
|
||||
})*/
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds: deviceIds,
|
||||
|
||||
Reference in New Issue
Block a user