This commit is contained in:
parent
ef54ea4ef4
commit
4365d790cc
File diff suppressed because it is too large
Load Diff
51
src/App.vue
51
src/App.vue
|
@ -5,26 +5,24 @@ import { Push } from '@/common/push'
|
|||
|
||||
|
||||
|
||||
const openPush=()=>{
|
||||
const openPush = (uid = 10) => {
|
||||
var connection = new Push({
|
||||
url: 'wss://chat.lihaink.cn/tts', // websocket地址
|
||||
app_key: 'aaea61749929eb53a4bd75a1474c1d27',
|
||||
});
|
||||
// 假设用户uid为1
|
||||
var uid = 10;
|
||||
// 浏览器监听user-2频道的消息,也就是用户uid为1的用户消息
|
||||
var user_channel = connection.subscribe('user-' + uid);
|
||||
url: 'wss://chat.lihaink.cn/tts', // websocket地址
|
||||
app_key: 'aaea61749929eb53a4bd75a1474c1d27',
|
||||
});
|
||||
// 浏览器监听user-2频道的消息,也就是用户uid为1的用户消息
|
||||
var user_channel = connection.subscribe( uid==10?'user-' + uid:uid+'user-trad');
|
||||
console.log(user_channel,"user_channnel")
|
||||
|
||||
// 当user-2频道有message事件的消息时
|
||||
user_channel.on('message', function (data) {
|
||||
console.log("收到消息",data)
|
||||
// 当user-2频道有message事件的消息时
|
||||
user_channel.on('message', function (data) {
|
||||
globalEventBus.emit(data.content.event, data.content.data)
|
||||
|
||||
});
|
||||
// 断线事件
|
||||
user_channel.on('close', function () {
|
||||
});
|
||||
// 断线事件
|
||||
user_channel.on('close', function () {
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const areaStroe = areaObj()
|
||||
|
@ -57,7 +55,28 @@ if (localStorage.getItem("TRADE_USER")) {
|
|||
areaStroe.changeArea({ areaCode: area_code, streetCode: street_code })
|
||||
}
|
||||
|
||||
if( !JSON.parse(localStorage.getItem("TRADE_TYPE")))openPush();
|
||||
|
||||
|
||||
// 获取 URL 中的查询参数部分
|
||||
var queryString = window.location.hash.split("?")[1];
|
||||
// 解析查询参数字符串
|
||||
const searchParams = new URLSearchParams(queryString);
|
||||
|
||||
// 读取名为 id 的参数
|
||||
const id = searchParams.get('local') || '';
|
||||
console.log(id); // 输出 id 参数的值
|
||||
|
||||
|
||||
|
||||
if (!JSON.parse(localStorage.getItem("TRADE_TYPE"))) {
|
||||
if (id) {
|
||||
openPush(id);
|
||||
|
||||
}
|
||||
else {
|
||||
openPush();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<template>
|
||||
|
|
|
@ -42,15 +42,15 @@ const choseTownFn = (id, name) => {
|
|||
}
|
||||
}
|
||||
|
||||
// x选择区县
|
||||
const choseAreaFn = () => {
|
||||
// 选择区县
|
||||
const choseAreaFn = (name='泸县') => {
|
||||
if(isMainScreen){
|
||||
sendFn('header6', { name: "泸县", code: 0 })
|
||||
}else{
|
||||
areaStore.changeArea({
|
||||
areaCode: areaStore.area.areaCode,
|
||||
streetCode: null,
|
||||
name:'泸县'
|
||||
name,
|
||||
})
|
||||
props.choseArea = false
|
||||
emit('offAreaList',areaStore.area.name)
|
||||
|
@ -77,6 +77,24 @@ globalEventBus.on('header7', data => {
|
|||
})
|
||||
|
||||
|
||||
globalEventBus.on('choserArea', data => {
|
||||
areaStore.changeArea({
|
||||
areaCode: data.code,
|
||||
streetCode: null,
|
||||
name:data.name
|
||||
})
|
||||
})
|
||||
|
||||
globalEventBus.on('choseTown', data => {
|
||||
areaStore.changeArea({
|
||||
areaCode: areaStore.area.areaCode,
|
||||
streetCode: data.code,
|
||||
name:data.name
|
||||
})
|
||||
router.replace('/townDetail?code=' + data.code)
|
||||
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<template>
|
||||
<div class="headers">
|
||||
<div class="logo" >
|
||||
<img style="width: 33px;height:33px;margin-left: 50px;margin-top: 5px;"
|
||||
src="/logo.png" alt="">
|
||||
<!-- <img style="width: 33px;height:33px;margin-left: 50px;margin-top: 5px;"
|
||||
src="/logo.png" alt=""> -->
|
||||
<span style="color: red;">{{ areaStore.area }}</span>
|
||||
</div>
|
||||
<div class="tab" v-if="role != 1">
|
||||
<div class="tab-li">
|
||||
|
|
Loading…
Reference in New Issue