diff --git a/src/assets/images/linkPrediction/icon/socialCharacter-legend-icon.png b/src/assets/images/linkPrediction/icon/socialCharacter-legend-icon.png new file mode 100644 index 0000000..e408148 Binary files /dev/null and b/src/assets/images/linkPrediction/icon/socialCharacter-legend-icon.png differ diff --git a/src/service/api/linkPrediction.js b/src/service/api/linkPrediction.js index d950d77..47932d4 100644 --- a/src/service/api/linkPrediction.js +++ b/src/service/api/linkPrediction.js @@ -75,9 +75,27 @@ export function getSocialCommunityDetailNodes(ids, time = "2024-05-16 16:56:04") return http.get(`/linkPrediction/triangle/community_detail?groupIds=${ids}&dateTime=${time}`) } -//人物社交隐关系预测用户组列表 -export function getInteractionHiddenPostList(outoIncrement) { - return http.get(`/linkPrediction/triangle/post_list?page=${outoIncrement}`) +//获取人物社交隐关系预测社团节点 +export function getCharacterSocialCommunityNodes() { + return http.get("/linkPrediction/social/community") } -// +//获取人物社交隐关系预测社团统计 +export function getCharacterSocialCommunityStatistics() { + return http.get(`/linkPrediction/social/community_statistics`) +} + +//获取人物社交隐关系预测社团内部节点 +export function getCharacterSocialCommunityDetailNodes( + ids, + relationId, + time = "2024-05-16 16:56:04" +) { + if (relationId != -1) { + return http.get( + `/linkPrediction/social/community_detail?groupIds=${ids}&dateTime=${time}&relationId=${relationId}` + ) + } else { + return http.get(`/linkPrediction/social/community_detail?groupIds=${ids}&dateTime=${time}`) + } +} diff --git a/src/store/llinkPrediction/index.js b/src/store/llinkPrediction/index.js index 21a2c05..9fdb024 100644 --- a/src/store/llinkPrediction/index.js +++ b/src/store/llinkPrediction/index.js @@ -4,14 +4,16 @@ import { getGroupUserListFromTriangle, getGroupUserListFromSocial, getInteractionPostList, - getInteractionHiddenPostList, getInteractionCommunityNodes, getInteractionCommunityDetailNodes, getInteractionCommunityStatistics, getSocialCommunityList, getSocialCommunityStatistics, getSocialCommunityDetailNodes, - getSocialPostListByRelationId + getSocialPostListByRelationId, + getCharacterSocialCommunityNodes, + getCharacterSocialCommunityStatistics, + getCharacterSocialCommunityDetailNodes } from "@/service/api/linkPrediction" import defaultAvatar from "@/assets/images/avatar/default.png" @@ -28,11 +30,14 @@ export const useCharacterInteractionStore = defineStore("characterInteraction", communityNodeList: [], //所有社团数据 curComponent: "CommunityNode", curSelecedGroupIds: [], + predictionLegendContent: "互动隐关系", communityDetailNodeRelation: [], //点击一级界面后,查询到的节点间关系 communityDetailNodeList: [], //节点用户列表 timeList: [], predictionUserIds: [], //包含从用户组选择的用户id或者是点击某个社团或者连边后,所需要高亮的所有用户的id curRelationId: "", + predictionLineColor: "#f8bf38", + predictionLegendIcon: `image://${new URL("@/assets/images/linkPrediction/icon/hidden-icon.png", import.meta.url)}`, anlysisList: [ { id: 1, @@ -159,7 +164,7 @@ export const useCharacterInteractionStore = defineStore("characterInteraction", if (res.code != 200) { return } - this.userList = res.data.userList + this.userList = res.data.userList.sort((a, b) => a.rank - b.rank) }, initGroupCorrelationForChart() { @@ -181,7 +186,6 @@ export const useCharacterInteractionStore = defineStore("characterInteraction", if (res.code != 200) return const customStatisticsObj = Object.assign({}, res.data.communityStatistics) //计算两个用户是否同属与同一个社团 - if ( customStatisticsObj.groupCount == null && customStatisticsObj.hiddenInteractionCount == null @@ -477,58 +481,23 @@ export const useSocialGroupsStore = defineStore("socialGroups", { export const useCharacterHiddenStore = defineStore("characterHidden", { state: () => ({ userList: [], - userChartList: [ - { - id: 1, - group: [ - { id: 1, name: "Polo Hun", avatar: defaultAvatar, fancy: 634, post: 32 }, - { id: 2, name: "楊政子", avatar: defaultAvatar, fancy: 5556, post: 23 } - ], - number: "0.36" - }, - { - id: 2, - group: [ - { - id: 7, - name: "一人一讚 馬總統感恩有您 永遠支...", - avatar: defaultAvatar, - fancy: 0, - post: 0 - }, - { - id: 8, - name: "一人一讚 馬總統感恩有您 永遠支...", - avatar: defaultAvatar, - fancy: 564, - post: 13 - } - ], - number: 0.28 - }, - { - id: 3, - group: [ - { - id: 9, - name: "一人一讚 馬總統感恩有您 永遠支...", - avatar: defaultAvatar, - fancy: 0, - post: 0 - }, - { - id: 10, - name: "一人一讚 馬總統感恩有您 永遠支...", - avatar: defaultAvatar, - fancy: 564, - post: 13 - } - ], - number: 0.24 - } - ], posts: [], - + communityNodeList: [], + curComponent: "CommunityNode", + timeList: [], + predictionUserIds: [], //包含从用户组选择的用户id或者是点击某个社团或者连边后,所需要高亮的所有用户的id + curRelationId: "", + curSelecedGroupIds: [], + communityDetailNodeRelation: [], //点击一级界面后,查询到的节点间关系 + communityDetailNodeList: [], //节点用户列表 + predictionLineColor: "#FF3F8F", + predictionLegendContent: "社交隐关系", + predictionLegendIcon: `image://${new URL("@/assets/images/linkPrediction/icon/socialCharacter-legend-icon.png", import.meta.url)}`, + statisticsList: [ + { id: 1, icon: nodePrefix, name: "节点数", key: "nodesCount" }, + { id: 2, icon: communityPrefix, name: "社团数", key: "groupCount" }, + { id: 3, icon: hiddenPrefix, name: "隐关系数", key: "hiddenInteractionCount" } + ], anlysisList: [ { id: 1, @@ -636,19 +605,60 @@ export const useCharacterHiddenStore = defineStore("characterHidden", { { text: "领土", top: 57.5, left: 72.5, width: 49, height: 19, fontSize: 12, opacity: 0.6 }, { text: "原则", top: 77.5, left: 264.5, width: 49, height: 19, fontSize: 12, opacity: 0.7 }, { text: "台湾", top: 195.5, left: 287.5, width: 49, height: 19, fontSize: 12, opacity: 0.8 } + ], + statisticsDetailList: [ + { id: 1, icon: nodePrefix, name: "节点数", key: "nodesCount" }, + { id: 2, icon: communityPrefix, name: "社团数", key: "groupCount" }, + { id: 3, icon: hiddenPrefix, name: "隐关系数", key: "hiddenInteractionCount" } ] }), actions: { async initGroupList() { const res = await getGroupUserListFromSocial() if (res.code != 200) return - this.userList = res.data.userList + this.userList = res.data.userList.sort((a, b) => a.rank - b.rank) }, - async initPostList(autoIncrement) { - const res = await getInteractionHiddenPostList(autoIncrement) + + async initCharacterSocialHiddenPostList(relationId) { + const res = await getInteractionPostList(relationId) if (res.code != 200) return - if (this.posts.length != 0) this.posts.push(...res.data) - else this.posts = res.data + this.posts = res.data + }, + + async initGraphCommunityNode() { + const res = await getCharacterSocialCommunityNodes() + if (res.code !== 200) return + this.communityNodeList = res.data + }, + async initGraphStatistics() { + const res = await getCharacterSocialCommunityStatistics() + this.statisticsList = this.statisticsList.map((item) => ({ + ...item, + count: res.data[item.key] + })) + }, + async initGraphCommunityDetailNode(ids, time = "2024-05-16 16:56:04", relationId = -1) { + this.curSelecedGroupIds = ids + const res = await getCharacterSocialCommunityDetailNodes(ids, relationId, time) + if (res.code != 200) return + const customStatisticsObj = Object.assign({}, res.data.communityStatistics) + //计算两个用户是否同属与同一个社团 + if ( + customStatisticsObj.groupCount == null && + customStatisticsObj.hiddenInteractionCount == null + ) { + customStatisticsObj.hiddenInteractionCount = 1 + customStatisticsObj.groupCount = ids[0] === ids[1] ? 1 : 2 + } + + this.statisticsDetailList = this.statisticsDetailList.map((item) => ({ + ...item, + count: customStatisticsObj[item.key] + })) + this.communityDetailNodeRelation = res.data.userRelation + this.communityDetailNodeList = res.data.userList + this.timeList = res.data.timeList + this.predictionUserIds = res.data.predictNodes } }, persist: true // 开启持久化 diff --git a/src/views/LinkPrediction/characterInteraction/index.vue b/src/views/LinkPrediction/characterInteraction/index.vue index 72b946e..62cf12e 100644 --- a/src/views/LinkPrediction/characterInteraction/index.vue +++ b/src/views/LinkPrediction/characterInteraction/index.vue @@ -14,7 +14,7 @@
-