修复loading未正确关闭,删除菜单
This commit is contained in:
parent
468dc3b5b1
commit
5d111c8642
|
|
@ -1,26 +1,12 @@
|
|||
<template>
|
||||
<div style="padding: 10px; margin-bottom: 50px">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click.prevent="handleMenuSelect('/videoList')"
|
||||
>视频列表</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click.prevent="handleMenuSelect('/device')"
|
||||
>设备管理</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click.prevent="handleMenuSelect('/User')"
|
||||
>用户</el-button
|
||||
>
|
||||
<el-row
|
||||
v-loading="loading"
|
||||
element-loading-text="正在连接....">
|
||||
<el-row v-loading="loading" element-loading-text="正在连接....">
|
||||
<el-col :span="16">
|
||||
<div
|
||||
style="
|
||||
|
|
@ -69,7 +55,7 @@ import router from "@/router/index.js";
|
|||
import * as crypto from "crypto";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { ElLoading } from "element-plus";
|
||||
import Cookies from 'js-cookie';
|
||||
import Cookies from "js-cookie";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -296,9 +282,9 @@ export default {
|
|||
// 连接WebSocket
|
||||
let _this = this;
|
||||
if (typeof WebSocket == "undefined") {
|
||||
console.log("您的浏览器不支持WebSocket");
|
||||
console.log("浏览器不支持WebSocket");
|
||||
} else {
|
||||
console.log("您的浏览器支持WebSocket");
|
||||
console.log("浏览器支持WebSocket");
|
||||
let socketUrl =
|
||||
"wss://gep.ljsea.top/im/ws?to_user_id=" +
|
||||
this.to_user_id +
|
||||
|
|
@ -314,8 +300,8 @@ export default {
|
|||
this.socket = new WebSocket(socketUrl);
|
||||
//打开事件
|
||||
this.socket.onopen = function () {
|
||||
confirm("连接成功");
|
||||
this.loading = false;
|
||||
confirm("连接成功");
|
||||
};
|
||||
this.socket.onerror = (error) => {
|
||||
console.error("WebSocket Error:", error);
|
||||
|
|
@ -329,7 +315,8 @@ export default {
|
|||
this.socket.onmessage = async function (msg) {
|
||||
//console.log("收到数据====" + msg.data);
|
||||
let data = JSON.parse(msg.data); // 对收到的json数据进行解析, 类似这样的:
|
||||
// 如果服务器端发送过来的json数据 不包含 users 这个key,那么发送过来的就是聊天文本json数据
|
||||
// 如果服务器端发送过来的json数据
|
||||
if (data.type == "msg") { // 如果是消息类型,解密消息内容
|
||||
data.data = await _this.decryptAES(
|
||||
data.data,
|
||||
_this.imKey,
|
||||
|
|
@ -339,6 +326,7 @@ export default {
|
|||
//console.log("收到数据====" + msg.data);
|
||||
// 构建消息内容
|
||||
_this.createContent(_this.to_user_name, null, data.data);
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
|
|
@ -350,6 +338,9 @@ export default {
|
|||
this.chatUser = this.to_user_name;
|
||||
//console.log("to_user_id:", this.to_user_id, this.to_user_name);
|
||||
this.startInterval();
|
||||
|
||||
setTimeout(() => this.loading=false, 3000);
|
||||
|
||||
//this.connectWebSocket();
|
||||
},
|
||||
// 生命周期钩子,在组件卸载之前被调用
|
||||
|
|
|
|||
Loading…
Reference in New Issue