From ea9c640eca9972317127f62172f5166534e7db86 Mon Sep 17 00:00:00 2001 From: j1ack <1209452658@qq.com> Date: Thu, 4 Aug 2022 14:10:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Brand.vue | 140 ++++++++++++++++++++++++++++++-------------- vue.config.js | 20 +++---- 2 files changed, 106 insertions(+), 54 deletions(-) diff --git a/src/views/Brand.vue b/src/views/Brand.vue index a3cadf4..56fc47e 100644 --- a/src/views/Brand.vue +++ b/src/views/Brand.vue @@ -210,8 +210,44 @@ export default { mounted() { this.nowTimes(); this.getEchart(); + this.ajax2(); }, methods: { + + ajax2() { + //jquery方式 get请求 + $.ajax({ + type:"GET", + url:"http://192.168.31.128:8866/pk/openup/OpenStatisticsController/parkingRanking", + data:{"authCode":"712110694681677824"}, + async:true, + cache:true, + dataType:"text", + success:function (backdata,status,xmlHttpRequest) { + console.log(backdata) + }, + error:function (msg) { + console.log(msg) + } + }); + + //jquery方式 get请求 + $.ajax({ + type:"GET", + url:"http://192.168.31.128:8866/pk/openup/OpenStatisticsController/todayTrafficStatistics", + data:{"authCode":"712110694681677824"}, + async:true, + cache:true, + dataType:"text", + success:function (backdata,status,xmlHttpRequest) { + console.log(backdata) + }, + error:function (msg) { + console.log(msg) + } + }); +}, + nowTimes() { this.clear(); let dayjs = this.dayjs() @@ -376,49 +412,49 @@ export default { ["北京", this.YCData] ].forEach((item, i) => { series.push( - { - name: item[0] + " Top3", - type: "lines", - zlevel: 1, - effect: { - show: true, - period: 6, - trailLength: 0.7, - color: "red", //arrow箭头的颜色 - symbolSize: 3 - }, - // lineStyle: { - // normal: { - // color: color[i], - // width: 0, - // curveness: 0.2 - // } - // }, - data: this.convertData(item[1]) - }, - { - name: item[0] + " Top3", - type: "lines", - zlevel: 2, - symbol: ["none", "arrow"], - symbolSize: 10, - effect: { - show: true, - period: 6, - trailLength: 0, - symbol: planePath, - symbolSize: 15 - }, - lineStyle: { - normal: { - color: color[i], - width: 1, - opacity: 0.6, - curveness: 0.2 - } - }, - data: this.convertData(item[1]) - }, + // { + // name: item[0] + " Top3", + // type: "lines", + // zlevel: 1, + // effect: { + // show: true, + // period: 6, + // trailLength: 0.7, + // color: "red", //arrow箭头的颜色 + // symbolSize: 3 + // }, + // // lineStyle: { + // // normal: { + // // color: color[i], + // // width: 0, + // // curveness: 0.2 + // // } + // // }, + // data: this.convertData(item[1]) + // }, + // { + // name: item[0] + " Top3", + // type: "lines", + // zlevel: 2, + // symbol: ["none", "arrow"], + // symbolSize: 10, + // effect: { + // show: true, + // period: 6, + // trailLength: 0, + // symbol: planePath, + // symbolSize: 15 + // }, + // lineStyle: { + // normal: { + // color: color[i], + // width: 1, + // opacity: 0.6, + // curveness: 0.2 + // } + // }, + // data: this.convertData(item[1]) + // }, { name: item[0] + " Top3", type: "effectScatter", @@ -502,10 +538,26 @@ export default { myChart.setOption(option, true); + var that = this; + var dataList = echarts.getMap("china").geoJson.features; + // console.log("dataList:", dataList); + // 鼠标事件 + myChart.on("click", function (res) { + console.log("click city:", res.name); + dataList.forEach((element) => { + if (element.properties.name == res.name) { + console.log("city code:", element.id); + } + }); + }); + window.addEventListener("resize", () => { myChart.resize(); }); - } + }, + clickGoNext() { + + }, }, beforeDestroy() { this.clear(); diff --git a/vue.config.js b/vue.config.js index d31c7c9..799794e 100644 --- a/vue.config.js +++ b/vue.config.js @@ -6,16 +6,16 @@ module.exports = { devServer: { open: true, port: 8081, - // proxy: { - // "/api": { - // target: "https://api.github.com", - // changeOrigin: true, - // ws: false, - // pathRewrite: { - // "^/api": "" - // } - // } - // } + proxy: { + "/api": { + target: "https://api.github.com", + changeOrigin: true, + ws: false, + pathRewrite: { + "^/api": "" + } + } + } }, configureWebpack: { // 把原本需要写在webpack.config.js中的配置代码 写在这里 会自动合并