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({
|
var connection = new Push({
|
||||||
url: 'wss://chat.lihaink.cn/tts', // websocket地址
|
url: 'wss://chat.lihaink.cn/tts', // websocket地址
|
||||||
app_key: 'aaea61749929eb53a4bd75a1474c1d27',
|
app_key: 'aaea61749929eb53a4bd75a1474c1d27',
|
||||||
});
|
});
|
||||||
// 假设用户uid为1
|
// 浏览器监听user-2频道的消息,也就是用户uid为1的用户消息
|
||||||
var uid = 10;
|
var user_channel = connection.subscribe( uid==10?'user-' + uid:uid+'user-trad');
|
||||||
// 浏览器监听user-2频道的消息,也就是用户uid为1的用户消息
|
console.log(user_channel,"user_channnel")
|
||||||
var user_channel = connection.subscribe('user-' + uid);
|
|
||||||
|
|
||||||
// 当user-2频道有message事件的消息时
|
// 当user-2频道有message事件的消息时
|
||||||
user_channel.on('message', function (data) {
|
user_channel.on('message', function (data) {
|
||||||
console.log("收到消息",data)
|
|
||||||
globalEventBus.emit(data.content.event, data.content.data)
|
globalEventBus.emit(data.content.event, data.content.data)
|
||||||
|
|
||||||
});
|
});
|
||||||
// 断线事件
|
// 断线事件
|
||||||
user_channel.on('close', function () {
|
user_channel.on('close', function () {
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const areaStroe = areaObj()
|
const areaStroe = areaObj()
|
||||||
|
@ -57,7 +55,28 @@ if (localStorage.getItem("TRADE_USER")) {
|
||||||
areaStroe.changeArea({ areaCode: area_code, streetCode: street_code })
|
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>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -42,15 +42,15 @@ const choseTownFn = (id, name) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// x选择区县
|
// 选择区县
|
||||||
const choseAreaFn = () => {
|
const choseAreaFn = (name='泸县') => {
|
||||||
if(isMainScreen){
|
if(isMainScreen){
|
||||||
sendFn('header6', { name: "泸县", code: 0 })
|
sendFn('header6', { name: "泸县", code: 0 })
|
||||||
}else{
|
}else{
|
||||||
areaStore.changeArea({
|
areaStore.changeArea({
|
||||||
areaCode: areaStore.area.areaCode,
|
areaCode: areaStore.area.areaCode,
|
||||||
streetCode: null,
|
streetCode: null,
|
||||||
name:'泸县'
|
name,
|
||||||
})
|
})
|
||||||
props.choseArea = false
|
props.choseArea = false
|
||||||
emit('offAreaList',areaStore.area.name)
|
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>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="headers">
|
<div class="headers">
|
||||||
<div class="logo" >
|
<div class="logo" >
|
||||||
<img style="width: 33px;height:33px;margin-left: 50px;margin-top: 5px;"
|
<!-- <img style="width: 33px;height:33px;margin-left: 50px;margin-top: 5px;"
|
||||||
src="/logo.png" alt="">
|
src="/logo.png" alt=""> -->
|
||||||
|
<span style="color: red;">{{ areaStore.area }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab" v-if="role != 1">
|
<div class="tab" v-if="role != 1">
|
||||||
<div class="tab-li">
|
<div class="tab-li">
|
||||||
|
|
Loading…
Reference in New Issue