diff --git a/static/html/chat_main.html b/static/html/chat_main.html index 8016caf..00afcd7 100644 --- a/static/html/chat_main.html +++ b/static/html/chat_main.html @@ -102,11 +102,11 @@ }, methods: { //跳转 - openUrl(url){ - window.location.href=url; + openUrl(url) { + window.location.href = url; }, - getOnlineUsers(){ - let _this=this; + getOnlineUsers() { + let _this = this; // $.get('/chat_users',function (rs) { // _this.users=rs.result // _this.fullscreenLoading=false; @@ -115,105 +115,95 @@ // }); }, //初始化websocket - initConn(){ - let socket=new ReconnectingWebSocket(this.server);//创建Socket实例 + initConn() { + let socket = new ReconnectingWebSocket(this.server);//创建Socket实例 this.socket = socket this.socket.onmessage = this.OnMessage; this.socket.onopen = this.OnOpen; }, - OnOpen(){ - let data={}; - let mes={} - mes.type="kfOnline"; - data.kf_id="kf_1"; - data.kf_name="客服丽丽"; - data.avatar="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=4217138672,2588039002&fm=26&gp=0.jpg"; - data.group="1"; - mes.data=data; + OnOpen() { + let data = {}; + let mes = {} + mes.type = "kfOnline"; + data.kf_id = "kf_1"; + data.kf_name = "客服丽丽"; + data.avatar = "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=4217138672,2588039002&fm=26&gp=0.jpg"; + data.group = "1"; + mes.data = data; this.socket.send(JSON.stringify(mes)); }, - OnMessage(e){ + OnMessage(e) { const redata = JSON.parse(e.data); - if (redata.type=="notice"){ + if (redata.type == "notice") { this.$notify({ title: "通知", message: "新客户访问", type: 'success', duration: 0, }); - this.users=redata.data; - this.currentGuest=redata.data[0].uid; + this.users = redata.data; + this.currentGuest = redata.data[0].uid; + for(i=0;i