mitt
This commit is contained in:
parent
56544d7a5e
commit
d7013e1d36
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + Vue</title>
|
||||
<title>数据之眼可视化大屏</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"@jiaminghi/data-view": "^2.10.0",
|
||||
"@vuepic/vue-datepicker": "^7.4.0",
|
||||
"amfe-flexible": "^2.2.1",
|
||||
"axios": "^1.6.2",
|
||||
"axios": "^1.6.5",
|
||||
"echarts": "^5.4.3",
|
||||
"element-plus": "^2.4.4",
|
||||
"mitt": "^3.0.1",
|
||||
|
@ -1731,11 +1731,11 @@
|
|||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.6.2",
|
||||
"resolved": "https://registry.npmmirror.com/axios/-/axios-1.6.2.tgz",
|
||||
"integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==",
|
||||
"version": "1.6.5",
|
||||
"resolved": "https://registry.npmmirror.com/axios/-/axios-1.6.5.tgz",
|
||||
"integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.0",
|
||||
"follow-redirects": "^1.15.4",
|
||||
"form-data": "^4.0.0",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
}
|
||||
|
@ -2175,9 +2175,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.15.3",
|
||||
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.3.tgz",
|
||||
"integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==",
|
||||
"version": "1.15.4",
|
||||
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.4.tgz",
|
||||
"integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
|
@ -4312,11 +4312,11 @@
|
|||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||
},
|
||||
"axios": {
|
||||
"version": "1.6.2",
|
||||
"resolved": "https://registry.npmmirror.com/axios/-/axios-1.6.2.tgz",
|
||||
"integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==",
|
||||
"version": "1.6.5",
|
||||
"resolved": "https://registry.npmmirror.com/axios/-/axios-1.6.5.tgz",
|
||||
"integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.15.0",
|
||||
"follow-redirects": "^1.15.4",
|
||||
"form-data": "^4.0.0",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
}
|
||||
|
@ -4672,9 +4672,9 @@
|
|||
}
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.15.3",
|
||||
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.3.tgz",
|
||||
"integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q=="
|
||||
"version": "1.15.4",
|
||||
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.4.tgz",
|
||||
"integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw=="
|
||||
},
|
||||
"form-data": {
|
||||
"version": "4.0.0",
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"@jiaminghi/data-view": "^2.10.0",
|
||||
"@vuepic/vue-datepicker": "^7.4.0",
|
||||
"amfe-flexible": "^2.2.1",
|
||||
"axios": "^1.6.2",
|
||||
"axios": "^1.6.5",
|
||||
"echarts": "^5.4.3",
|
||||
"element-plus": "^2.4.4",
|
||||
"mitt": "^3.0.1",
|
||||
|
|
95
src/App.vue
95
src/App.vue
|
@ -2,43 +2,74 @@
|
|||
import { areaObj } from "@/store/index.js"
|
||||
import { globalEventBus } from '@/common/eventBus'
|
||||
import { Push } from '@/common/push'
|
||||
var connection = new Push({
|
||||
url: 'ws://192.168.1.22:3131/', // websocket地址
|
||||
app_key: 'aaea61749929eb53a4bd75a1474c1d27',
|
||||
});
|
||||
// 假设用户uid为1
|
||||
var uid = 2;
|
||||
// 浏览器监听user-2频道的消息,也就是用户uid为1的用户消息
|
||||
var user_channel = connection.subscribe('user-' + uid);
|
||||
|
||||
// 当user-2频道有message事件的消息时
|
||||
user_channel.on('message', function(data) {
|
||||
if(data.content.event=='header2'){
|
||||
globalEventBus.emit('newTask', "data")
|
||||
|
||||
|
||||
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 ||'')
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
// 断线事件
|
||||
user_channel.on('close', function() {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// var connection = new Push({
|
||||
// url: 'ws://192.168.1.22:3131/', // websocket地址
|
||||
// app_key: 'aaea61749929eb53a4bd75a1474c1d27',
|
||||
// });
|
||||
// // 假设用户uid为1
|
||||
// var uid = 2;
|
||||
// // 浏览器监听user-2频道的消息,也就是用户uid为1的用户消息
|
||||
// var user_channel = connection.subscribe('user-' + uid);
|
||||
|
||||
// // 当user-2频道有message事件的消息时
|
||||
// user_channel.on('message', function (data) {
|
||||
// if (data.content.event == 'header2') {
|
||||
// globalEventBus.emit('newTask', "data")
|
||||
|
||||
// }
|
||||
// });
|
||||
// // 断线事件
|
||||
// user_channel.on('close', function () {
|
||||
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
const areaStroe = areaObj()
|
||||
let res={
|
||||
"status": 200,
|
||||
"message": "success",
|
||||
"data": {
|
||||
"user": {
|
||||
"id": 1,
|
||||
"account_type": 1,
|
||||
"area_code": "510521",
|
||||
"street_code": null,
|
||||
"account": "泸县",
|
||||
"password": "ec2dff05d20472c43afbd8329c80d59a"
|
||||
},
|
||||
"token": "0f040d372e39938f1a4d2964506a87c5",
|
||||
"expire": 999999999999999999999999999999999,
|
||||
role:2
|
||||
}
|
||||
let res = {
|
||||
"status": 200,
|
||||
"message": "success",
|
||||
"data": {
|
||||
"user": {
|
||||
"id": 1,
|
||||
"account_type": 1,
|
||||
"area_code": "510521",
|
||||
"street_code": null,
|
||||
"account": "泸县",
|
||||
"password": "ec2dff05d20472c43afbd8329c80d59a"
|
||||
},
|
||||
"token": "0f040d372e39938f1a4d2964506a87c5",
|
||||
"expire": 999999999999999999999999999999999,
|
||||
role: 2
|
||||
}
|
||||
}
|
||||
res.data.role = 2
|
||||
localStorage.setItem("TRADE_USER", JSON.stringify(res.data))
|
||||
|
|
|
@ -8,7 +8,7 @@ let expire = localStorage.getItem("TRADE_USER") ? JSON.parse(localStorage.getIte
|
|||
|
||||
// 创建axios 实例
|
||||
const instacne = axios.create({
|
||||
baseURL: "https://shop.lihaink.cn/",
|
||||
baseURL: "https://crmeb-test.shop.lihaink.cn/",
|
||||
timeout: 30000,
|
||||
});
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ import { defineProps, defineEmits, onMounted, reactive, watch } from "vue"
|
|||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { areaObj } from '@/store/index.js'
|
||||
import axios from "axios"
|
||||
const route = useRoute
|
||||
import { globalEventBus } from '@/common/eventBus'
|
||||
|
||||
|
||||
let areaStore = areaObj()
|
||||
|
||||
|
@ -77,6 +78,16 @@ onMounted(() => {
|
|||
|
||||
})
|
||||
|
||||
globalEventBus.on('header6', data => {
|
||||
choseAreaFn()
|
||||
})
|
||||
|
||||
globalEventBus.on('header7', data => {
|
||||
choseTownFn(data.id,data.name)
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -96,11 +96,6 @@ import { globalEventBus } from '@/common/eventBus'
|
|||
|
||||
|
||||
|
||||
globalEventBus.on('newTask1', data => {
|
||||
showFn(1, '/commodity')
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -234,6 +229,30 @@ onMounted(() => {
|
|||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
globalEventBus.on('compheader1', data => {
|
||||
showFn(0, '/')
|
||||
})
|
||||
|
||||
globalEventBus.on('compheader2', data => {
|
||||
showFn(1, '/commodity')
|
||||
})
|
||||
|
||||
globalEventBus.on('compheader3', data => {
|
||||
showFn(2, '/Businesses')
|
||||
})
|
||||
globalEventBus.on('compheader4', data => {
|
||||
showFn(3, '/order')
|
||||
})
|
||||
|
||||
globalEventBus.on('compheader5', data => {
|
||||
showFn(4, '/finance')
|
||||
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
import { ref, reactive, onMounted, defineProps } from "vue"
|
||||
import * as echarts from 'echarts';
|
||||
import { getUserTradeCountApi } from "@/api.js"
|
||||
import { globalEventBus } from '@/common/eventBus'
|
||||
|
||||
const props = defineProps({
|
||||
areaCodes: Object,
|
||||
|
@ -236,7 +237,9 @@ const option = reactive({
|
|||
onMounted(() => {
|
||||
init()
|
||||
})
|
||||
|
||||
globalEventBus.on('indexbottomcenter', data => {
|
||||
hdClick(data.code)
|
||||
})
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.towns {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
import * as echarts from 'echarts';
|
||||
import { ref, reactive, defineProps } from "vue"
|
||||
import { getUserNumApi } from "@/api.js"
|
||||
import { globalEventBus } from '@/common/eventBus'
|
||||
|
||||
|
||||
|
||||
|
@ -322,7 +323,9 @@ const pageFN = (Num) => {
|
|||
|
||||
}
|
||||
|
||||
|
||||
globalEventBus.on('indextopleft', data => {
|
||||
pageFN(data.num)
|
||||
})
|
||||
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
<dv-scroll-board v-show="showGoods" :config="config3" style="height: 17vh;margin-left: 1%;" />
|
||||
<dv-scroll-board v-show="!showGoods" :config="config" style="height: 17vh;margin-left: 1%;" />
|
||||
</div>
|
||||
|
||||
<div class="user" style="width: 98%; height: 25vh;" v-else>
|
||||
|
||||
</div>
|
||||
<div class="storeNum">
|
||||
<div class="tit">
|
||||
</div>
|
||||
|
@ -31,6 +33,7 @@
|
|||
import { ref, reactive, defineProps } from "vue"
|
||||
import { getSalesRankApi } from "@/api.js"
|
||||
import * as echarts from 'echarts';
|
||||
import { globalEventBus } from '@/common/eventBus'
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
|
@ -253,6 +256,22 @@ const pageFN = (Num) => {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
globalEventBus.on('indextopright', data => {
|
||||
pageFN(data.num)
|
||||
})
|
||||
|
||||
globalEventBus.on('indextopright-1', data => {
|
||||
showGoods.value=true
|
||||
})
|
||||
globalEventBus.on('indextopright-2', data => {
|
||||
showGoods.value=false
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.user {
|
||||
|
|
|
@ -29,6 +29,13 @@ import { useRouter } from 'vue-router'
|
|||
import { merchant_listApi, merchantApi } from "@/api.js"
|
||||
import { areaObj } from '@/store/index.js'
|
||||
import router from "../router";
|
||||
import { globalEventBus } from '@/common/eventBus'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const showLogin = ref(false)
|
||||
|
||||
const areaStore = areaObj()
|
||||
|
@ -75,7 +82,6 @@ const hdClick = (e) => {
|
|||
router.push('/storeLogin')
|
||||
|
||||
|
||||
console.log(areaStore.userInfo)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -149,6 +155,31 @@ const configs = reactive({
|
|||
onMounted(() => {
|
||||
changeTable(1)
|
||||
})
|
||||
|
||||
|
||||
|
||||
globalEventBus.on('header3-1' , data => {
|
||||
changeTable(1)
|
||||
})
|
||||
globalEventBus.on('header3-2' , data => {
|
||||
changeTable(0)
|
||||
})
|
||||
|
||||
globalEventBus.on('header3-3' , data => {
|
||||
merchantApi(
|
||||
{
|
||||
mer_id: data.id,
|
||||
...areaStore.area
|
||||
}
|
||||
).then(res => {
|
||||
areaStore.storeLogin(res.data)
|
||||
router.push('/storeLogin')
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -185,7 +216,7 @@ onMounted(() => {
|
|||
.btn {
|
||||
color: white;
|
||||
// border: 1px solid #BF6D5D;
|
||||
background-image: url('static/index/btn.png');
|
||||
background-image: url('/static/index/btn.png');
|
||||
background-size: 100% 100%;
|
||||
padding: 1vh 1vw;
|
||||
border-radius: 20px;
|
||||
|
|
|
@ -34,6 +34,7 @@ import { ref, reactive, onMounted } from "vue"
|
|||
import { getProductCategoryListApi, getProductListApi, product_status_filterApi } from "@/api.js"
|
||||
import { areaObj } from "../store";
|
||||
import scrollTable from "@/components/scrollTable.vue" // 五角星样式,有用
|
||||
import { globalEventBus } from '@/common/eventBus'
|
||||
|
||||
const areaStore = areaObj()
|
||||
|
||||
|
@ -246,6 +247,34 @@ onMounted(() => {
|
|||
initProduct(1)
|
||||
|
||||
})
|
||||
globalEventBus.on('header2-1', data => {
|
||||
ShwostoreType.value = true
|
||||
|
||||
})
|
||||
globalEventBus.on('header2-2', data => {
|
||||
ShwostoreType.value = false
|
||||
|
||||
})
|
||||
globalEventBus.on('header2-2-1', data => {
|
||||
initProduct(data.type)
|
||||
|
||||
})
|
||||
globalEventBus.on('header2-2-2', data => {
|
||||
initProduct(data.type)
|
||||
|
||||
|
||||
})
|
||||
globalEventBus.on('header2-2-3', data => {
|
||||
initProduct(data.type)
|
||||
|
||||
|
||||
})
|
||||
globalEventBus.on('header2-2-4', data => {
|
||||
initProduct(data.type)
|
||||
|
||||
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -284,7 +313,7 @@ onMounted(() => {
|
|||
.btn {
|
||||
color: white;
|
||||
// border: 1px solid #BF6D5D;
|
||||
background-image: url('static/index/btn.png');
|
||||
background-image: url('/static/index/btn.png');
|
||||
background-size: 100% 100%;
|
||||
padding: 1vh 1vw;
|
||||
border-radius: 20px;
|
||||
|
|
|
@ -131,6 +131,10 @@ import { useRouter } from 'vue-router'
|
|||
import Bill from "@/components/Bill.vue"
|
||||
import { financial_record_titleApi, financial_recordApi, financial_record_detailApi, financial_record_detailApi2, bill_listApi, withdraw_listApi } from "@/api.js"
|
||||
import { areaObj } from '@/store/index.js'
|
||||
import { globalEventBus } from '@/common/eventBus'
|
||||
|
||||
|
||||
|
||||
const areaStore = areaObj()
|
||||
|
||||
|
||||
|
@ -525,6 +529,24 @@ onMounted(() => {
|
|||
addDta(res.data.list)
|
||||
})
|
||||
})
|
||||
globalEventBus.on('header5-1', data => {
|
||||
changeTable(0)
|
||||
})
|
||||
globalEventBus.on('header5-2', data => {
|
||||
changeTable(1)
|
||||
})
|
||||
globalEventBus.on('header5-3', data => {
|
||||
changeTable(2)
|
||||
})
|
||||
globalEventBus.on('header5-3-1', data => {
|
||||
changeBill(1)
|
||||
})
|
||||
globalEventBus.on('header5-3-2', data => {
|
||||
changeBill(2)
|
||||
})
|
||||
globalEventBus.on('header5-3-3', data => {
|
||||
hdClick(2)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -8,12 +8,22 @@
|
|||
import Header from "@/components/Header.vue"
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const route =useRoute()
|
||||
const route = useRoute()
|
||||
import { globalEventBus } from '@/common/eventBus'
|
||||
globalEventBus.on('newTask', data => {
|
||||
globalEventBus.emit('newTask1', "data")
|
||||
|
||||
})
|
||||
|
||||
// 标题事件
|
||||
for (let i = 1; i < 6; i++) {
|
||||
globalEventBus.on('header' + i, data => {
|
||||
globalEventBus.emit('compheader' + i, data)
|
||||
console.log(i)
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
console.log("wcnm")
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ import { ref, reactive, onMounted } from "vue"
|
|||
import Bill from "@/components/Bill.vue"
|
||||
import { order_listApi, order_list_count_titleApi, refund_order_listApi, take_order_listApi, take_order_count_titleApi } from "@/api.js"
|
||||
import { areaObj } from "../store";
|
||||
import { globalEventBus } from '@/common/eventBus'
|
||||
|
||||
const areaStore = areaObj()
|
||||
const billList = reactive([
|
||||
{
|
||||
|
@ -131,6 +133,9 @@ const refundStatusFn = (item) => {
|
|||
}
|
||||
const btnFlag = reactive([true, false, false])
|
||||
const hdClick = (i) => {
|
||||
|
||||
|
||||
|
||||
btnFlag.forEach((item, index) => {
|
||||
btnFlag[index] = false
|
||||
})
|
||||
|
@ -208,9 +213,11 @@ const tableHdClick = (e) => {
|
|||
// console.log(e.rowIndex)
|
||||
let tag = document.getElementById(`order${e.rowIndex}`)
|
||||
let tag2 = document.getElementById(`card${e.rowIndex}`)
|
||||
tag.style.display = 'none'
|
||||
tag2.style.display = 'block'
|
||||
|
||||
// tag.style.display = 'none'
|
||||
// tag2.style.display = 'block'
|
||||
console.log(e.rowIndex)
|
||||
console.log(tag)
|
||||
console.log(tag2)
|
||||
|
||||
} else {
|
||||
let tag = document.getElementsByClassName(`order`)
|
||||
|
@ -834,6 +841,23 @@ const configs3 = reactive({
|
|||
onMounted(() => {
|
||||
hdClick(0)
|
||||
})
|
||||
|
||||
globalEventBus.on('header4-1', data => {
|
||||
hdClick(0)
|
||||
})
|
||||
globalEventBus.on('header4-2', data => {
|
||||
hdClick(1)
|
||||
})
|
||||
globalEventBus.on('header4-3', data => {
|
||||
hdClick(2)
|
||||
})
|
||||
globalEventBus.on('header4-1-1', data => {
|
||||
// console.log(e.rowIndex)
|
||||
let tag = document.getElementById(`order${data.index}`)
|
||||
let tag2 = document.getElementById(`card${data.index}`)
|
||||
tag.style.display = 'none'
|
||||
tag2.style.display = 'block'
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ let userInfo = JSON.parse(localStorage.getItem('TRADE_USER'))
|
|||
|
||||
if (areaStore.userInfo.user?.merchant) {
|
||||
let { area_id, mer_id, street_id } = areaStore.userInfo.user?.merchant
|
||||
console.log(area_id, 5645545)
|
||||
|
||||
query = {
|
||||
areaCode: area_id,
|
||||
streetCode: street_id,
|
||||
|
|
Loading…
Reference in New Issue