diff --git a/src/assets/images/groupEvolution/event-list-title.png b/src/assets/images/groupEvolution/event-list-title.png new file mode 100644 index 0000000..b70d718 Binary files /dev/null and b/src/assets/images/groupEvolution/event-list-title.png differ diff --git a/src/service/api/groupEvolution.js b/src/service/api/groupEvolution.js new file mode 100644 index 0000000..865fede --- /dev/null +++ b/src/service/api/groupEvolution.js @@ -0,0 +1,11 @@ +import http from "@/utils/http" + +//群体识别发现页面群体列表 +export function getGroupEvolutionGroupList(time) { + return http.get(`/groupEvolution/identify/group_list?time=${time}`) +} + +//群体识别发现页面群体规模演化图 +export function getGroupEvolutionGroupScaleChart() { + return http.get(`/groupEvolution/identify/group_scale`) +} diff --git a/src/store/groupEvolution/index.js b/src/store/groupEvolution/index.js index 37810c3..9e7bc5d 100644 --- a/src/store/groupEvolution/index.js +++ b/src/store/groupEvolution/index.js @@ -6,72 +6,57 @@ import mergeImg from "@/assets/images/groupMember/mergeImg.png" import shrinkImg from "@/assets/images/groupMember/shrinkImg.png" import expamdImg from "@/assets/images/groupMember/expamdImg.png" import defaultAvatar from "@/assets/images/avatar/default.png" + +import { + getGroupEvolutionGroupList, + getGroupEvolutionGroupScaleChart +} from "@/service/api/groupEvolution" +import { TansTimestamp } from "@/utils/transform" export const useGroupDiscoveryStore = defineStore("groupDiscovery", { state: () => ({ - groupList: [ - { - id: 1, - type: "群体一", - title: "关注话题:#中国海警首次登检菲律宾运补船只#", - statistics: [ - { id: 1, iconImg: nodePrefix, name: "节点数", value: 293 }, - { id: 2, iconImg: edgePrefix, name: "连边数", value: 21389 } - ] - }, - { - id: 2, - type: "群体二", - title: "关注话题:#外交部回应中国海警缴获菲律宾士111111.", - statistics: [ - { id: 1, iconImg: nodePrefix, name: "节点数", value: 293 }, - { id: 2, iconImg: edgePrefix, name: "连边数", value: 21389 } - ] - }, - { - id: 3, - type: "群体三", - title: "关注话题:#美军机在南海盘旋并投放不明物体#", - statistics: [ - { id: 1, iconImg: nodePrefix, name: "节点数", value: 293 }, - { id: 2, iconImg: edgePrefix, name: "连边数", value: 21389 } - ] - } - ], - chartData: { - xAxisData: ["07:57:46", "09:30:14", "09:57:32", "10:04:47", "10:12:57"], - yAxisRange: { min: 0, max: 800, interval: 100 }, - seriesList: [ - { - name: "头部自媒体", - themeColor: "#32b6fb", - data: [200, 300, 330, 400, 380] - }, - { - name: "官方媒体", - themeColor: "#00d6da", - data: [100, 200, 230, 300, 280] - }, - { - name: "普通自媒体", - themeColor: "#fddc33", - data: [300, 400, 430, 500, 480] - } - ] - }, + groupList: [], + chartData: {}, chartsData: { topSelfMedia: { - xAxis: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"], + xAxis: [ + "15:57:46", + "16:57:55", + "17:57:32", + "18:58:03", + "19:58:03", + "20:58:04", + "21:57:47", + "22:58:12" + ], yAxis: [0, 0.5, 1.0, 1.5, 2.0, 2.5], data: [1.0, 0.99, 1.0, 1.0, 1.01, 2.03, 1.2, 0.99] }, officialMedia: { - xAxis: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"], - yAxis: [0, 0.5, 1.0, 1.5, 2.0, 2.5], + xAxis: [ + "15:57:46", + "16:57:55", + "17:57:32", + "18:58:03", + "19:58:03", + "20:58:04", + "21:57:47", + "22:58:12" + ], + yAxis: [0, 0.5, 1.0, 1.5], data: [1.0, 0.99, 1.0, 1.0, 1.01, 1.01, 1.2, 0.99] }, ordinaryMedia: { - xAxis: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"], - yAxis: [0, 1.0, 2.0, 3.0, 4.0, 5.0], + xAxis: [ + "15:57:46", + "16:57:55", + "17:57:32", + "18:58:03", + "19:58:03", + "20:58:04", + "21:57:47", + "22:58:12" + ], + yAxis: [0, 1.0, 2.0, 3.0], data: [1.08, 2.54, 1.47, 1.03, 0.98, 0.99, 1.0, 1.12] } }, @@ -265,8 +250,43 @@ export const useGroupDiscoveryStore = defineStore("groupDiscovery", { } ] }), - actions: {}, - persist: false // 开启持久化 + actions: { + async initializeGroupList(time = "2024-05-16 16:56:04") { + const res = await getGroupEvolutionGroupList(time) + if (res.code != 200) return + const iconMap = { + 节点数: nodePrefix, + 连边数: edgePrefix + } + this.groupList = res.data + this.groupList.forEach((item) => { + item.list = item.list.map((statistic) => ({ + ...statistic, + iconImg: iconMap[statistic.name] + })) + }) + }, + async initializeGroupScaleChart() { + const res = await getGroupEvolutionGroupScaleChart() + if (res.code != 200) return + let resultObj = {} + const themeMap = { + 群体一: "#32b6fb", + 群体二: "#00d6da", + 群体三: "#fddc33" + } + resultObj["xAxisData"] = res.data.timeList.map((item) => TansTimestamp(item, "HH:mm:ss")) + resultObj["yAxisRange"] = res.data.scale + resultObj["seriesList"] = [] + + Object.entries(res.data.data).forEach(([key, list]) => { + resultObj["seriesList"].push({ name: key, themeColor: themeMap[key], data: list }) + }) + + this.chartData = resultObj + } + }, + persist: true // 开启持久化 }) export const useGroupStructureStore = defineStore("groupStructure", { diff --git a/src/views/GroupEvolution/component/groupChart.vue b/src/views/GroupEvolution/component/groupChart.vue index 7fe20e4..b78f11a 100644 --- a/src/views/GroupEvolution/component/groupChart.vue +++ b/src/views/GroupEvolution/component/groupChart.vue @@ -17,7 +17,7 @@