From 531a3d4eef82100dd50e4eb28776dd165f8f40d6 Mon Sep 17 00:00:00 2001 From: dhy1725534722 <1725534722@qq.com> Date: Tue, 22 Aug 2023 10:17:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sentiment/components/componentLeft.vue | 50 +++++++++++++------ 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/src/views/privateOrder/sentiment/components/componentLeft.vue b/src/views/privateOrder/sentiment/components/componentLeft.vue index 26f7583..4b5e36b 100644 --- a/src/views/privateOrder/sentiment/components/componentLeft.vue +++ b/src/views/privateOrder/sentiment/components/componentLeft.vue @@ -350,6 +350,7 @@ export default { //将敏感和非敏感区分开来 positiveOpinion: [], negativeOpinion: [], + allDate: [], date: [], }; }, @@ -363,8 +364,6 @@ export default { }, }, created() { - //舆情走势图 - this.getyqData(); // 获取舆情信息量统计 this.getyqMsgStats(); }, @@ -442,6 +441,7 @@ export default { // }) this.changeBtn(); this.getFilterData(); + //舆情走势图 this.getyqData(); }, beforeDestroy() { @@ -495,20 +495,42 @@ export default { // 获取舆情走势图的数据 getyqData() { yuqingChart().then((res) => { - console.log(res); + this.allDate = res.data; + //已经排序过的数组 + this.allDate.sort(function (a, b) { + return new Date(a.publishTime) - new Date(b.publishTime); + }); + let arr = []; res.data.forEach((value) => { - if (value.type == 2) { - this.positiveOpinion.push(value.count); - } else if (value.type == 1) { - this.negativeOpinion.push(value.count); - } //把日期存储起来 + arr.push(value.publishTime); + }); + //日期已经处理好了 + this.date = arr.filter(function (item, index) { + //当前元素,在原始数组中的第一个索引==当前索引值,否则返回当前元素 + return arr.indexOf(item) === index; + }); + this.date.forEach((value) => { + let arr2 = res.data.filter((m) => { + return m.publishTime == value; + }); + console.log(arr2); + arr2.forEach((e) => { + if (e.type == 1 && arr2.length < 2) { + this.negativeOpinion.push(e.count); + this.positiveOpinion.push(0); + } else if (e.type == 2 && arr2.length < 2) { + this.positiveOpinion.push(e.count); + this.negativeOpinion.push(0); + } else if (e.type == 1 && arr2.length == 2) { + this.negativeOpinion.push(e.count); + } else if (e.type == 2 && arr2.length == 2) { + this.positiveOpinion.push(e.count); + } + }); }); - // const res = new Map(); - // let arr = res.data.filter( - // (item) => !res.has(item[uniId]) && res.set(item[uniId], 1) - // ); this.lineBox(); + console.log(this.date); console.log(this.negativeOpinion); console.log(this.positiveOpinion); }); @@ -541,7 +563,7 @@ export default { left: "17%", right: "1%", }, - legend: { + length: { data: ["非敏感", "敏感"], top: "3%", right: "2%", @@ -568,7 +590,7 @@ export default { }, xAxis: { // data: this.opinionTime, - data: ["7.23", "7.24", "7.25", "7.26", "7.27", "7.28", "7.29"], + data: this.date, axisLine: { show: true, // 隐藏X轴轴线 lineStyle: { From 53602495698be5ace9360a11aaff2ff3816e8990 Mon Sep 17 00:00:00 2001 From: dhy1725534722 <1725534722@qq.com> Date: Tue, 22 Aug 2023 14:30:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=BD=91=E7=BB=9C=E8=B5=B0=E5=8A=BF?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/wlSafe/index.js | 23 + .../security/components/Earth.vue | 84 +- .../security/components/componentLeft.vue | 720 ++++++++++-------- .../security/components/componentRight.vue | 336 ++++---- .../sentiment/components/WordCloud.vue | 21 +- .../sentiment/components/componentLeft.vue | 127 +-- 6 files changed, 720 insertions(+), 591 deletions(-) create mode 100644 src/api/wlSafe/index.js diff --git a/src/api/wlSafe/index.js b/src/api/wlSafe/index.js new file mode 100644 index 0000000..c28f97c --- /dev/null +++ b/src/api/wlSafe/index.js @@ -0,0 +1,23 @@ +import request from '@/utils/request.js' +//数据来源 +export function dataLY() { + return request({ + url: '/zongzhi/saftyscreen/source', + method: 'get', + }) +} +//地球受攻击 +export function mapAttack(data) { + return request({ + url: '/zongzhi/attack/list', + method: 'get', + params:data + }) +} +//安全隐患 +export function safeRisks() { + return request({ + url: '/zongzhi/saftyscreen/safetyhazard', + method: 'get', + }) +} \ No newline at end of file diff --git a/src/views/privateOrder/security/components/Earth.vue b/src/views/privateOrder/security/components/Earth.vue index 84d42f5..60b386f 100644 --- a/src/views/privateOrder/security/components/Earth.vue +++ b/src/views/privateOrder/security/components/Earth.vue @@ -91,7 +91,7 @@ gl_PointSize = clamp(fract(percent*number + l - u_time*number*speed)-l ,0.0,1.) * size * (1./length); opacity = gl_PointSize/size; gl_Position = projectionMatrix * mvPosition; - }` + }`;