diff --git a/index.html b/index.html index d51b311..0930f34 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - Vite + Vue + 数据之眼可视化大屏
diff --git a/package-lock.json b/package-lock.json index 4c4b362..433a0ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 83aad56..35f7ac1 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/App.vue b/src/App.vue index 51db922..2fcb123 100644 --- a/src/App.vue +++ b/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)) diff --git a/src/api.js b/src/api.js index 4b00184..2811ef4 100644 --- a/src/api.js +++ b/src/api.js @@ -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, }); diff --git a/src/components/areaList.vue b/src/components/areaList.vue index 472bfd2..e23cae0 100644 --- a/src/components/areaList.vue +++ b/src/components/areaList.vue @@ -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) +}) + + +