From 2d541ba5ba91118a81f93aa2d6f2f089d24cf385 Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Fri, 2 Feb 2024 15:44:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=8C=E5=B1=8F=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 55 +------- src/api.js | 37 ++--- src/components/areaList.vue | 67 ++++----- src/components/header.vue | 179 ++++++------------------- src/components/index/topRight.vue | 14 +- src/components/townDetail/topRight.vue | 4 - src/router/index.js | 10 +- src/store/index.js | 13 +- src/view/Businesses.vue | 45 ++----- src/view/index.vue | 18 ++- src/view/storeLogin.vue | 37 ++--- 11 files changed, 132 insertions(+), 347 deletions(-) diff --git a/src/App.vue b/src/App.vue index 272c98e..d78b872 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,54 +5,27 @@ import { Push } from '@/common/push' -// var ws = new WebSocket("ws://192.168.106.167:8080"); - -// //当WebSocket创建成功时,触发onopen事件 -// ws.onopen = function () { -// console.log("open"); -// } -// //当客户端收到服务端发来的消息时,触发onmessage事件,参数e.data包含server传递过来的数据 -// ws.onmessage = function (e) { - -// let data =JSON.parse(e.data) - -// globalEventBus.emit(data.event, data.data ||'') - - - -// } - - - - - - - - -var connection = new Push({ - url: 'ws://192.168.1.24:3131', // websocket地址 +const openPush=()=>{ + var connection = new Push({ + url: 'wss://chat.lihaink.cn/tts', // websocket地址 app_key: 'aaea61749929eb53a4bd75a1474c1d27', }); // 假设用户uid为1 -var uid = 2; +var uid = 10; // 浏览器监听user-2频道的消息,也就是用户uid为1的用户消息 var user_channel = connection.subscribe('user-' + uid); // 当user-2频道有message事件的消息时 user_channel.on('message', function (data) { + console.log("收到消息",data) globalEventBus.emit(data.content.event, data.content.data) - - console.log("收到消息",data) - }); // 断线事件 user_channel.on('close', function () { }); - - - +} const areaStroe = areaObj() let res = { @@ -77,28 +50,14 @@ localStorage.setItem("TRADE_USER", JSON.stringify(res.data)) let { area_code, street_code } = res.data.user areaStroe.changeArea({ areaCode: area_code, streetCode: street_code }) - if (localStorage.getItem("TRADE_USER")) { let userInfo = JSON.parse(localStorage.getItem('TRADE_USER')) areaStroe.changeUserInfo(userInfo) let { area_code, street_code } = userInfo.user areaStroe.changeArea({ areaCode: area_code, streetCode: street_code }) - } - - - - - - - - - - - - - +if(! JSON.parse(localStorage.getItem("TRADE_TYPE")) )openPush();