This commit is contained in:
duanhao 2025-07-23 16:12:31 +08:00
commit c36a57ee7c
6 changed files with 91 additions and 198 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -1,5 +1,16 @@
import http from "@/utils/http"; import http from "@/utils/http";
export function getGroupList() { //人物互动隐关系预测的用户组列表
return http.get("/test"); export function getGroupUserListFromInteraction() {
return http.get("/linkPrediction/interaction/group_list");
}
//社交紧密团体识别的用户组列表
export function getGroupUserListFromTriangle() {
return http.get("/linkPrediction/triangle/group_list");
}
//人物社交隐关系预测用户组列表
export function getGroupUserListFromSocial() {
return http.get("/linkPrediction/social/group_list");
} }

View File

@ -1,104 +1,18 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { getGroupList } from "@/service/api/linkPrediction"; import {
import testAvatar from "@/assets/anchorAvatar/aichuidunhaitao-tingenqifu.png"; getGroupUserListFromInteraction,
import test1Avatar from "@/assets/anchorAvatar/fei_die_gg.png"; getGroupUserListFromTriangle,
import test2Avatar from "@/assets/anchorAvatar/qianjuzhangbenren.png"; getGroupUserListFromSocial
} from "@/service/api/linkPrediction";
import defaultAvatar from "@/assets/images/avatar/default.png";
import { ElMessage } from "element-plus";
export const useCharacterInteractionStore = defineStore("characterInteraction", { export const useCharacterInteractionStore = defineStore("characterInteraction", {
state: () => ({ state: () => ({
userList: [ userList: [], //用户组列表
{
id: 1,
title: "",
list: [
{ id: 1, name: "Polo Hun", avatar: testAvatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: testAvatar, fancy: 5556, post: 23 }
]
},
{
id: 2,
title: "",
list: [
{ id: 1, name: "Polo Hun", avatar: testAvatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: testAvatar, fancy: 5556, post: 23 }
]
},
{
id: 3,
title: "",
list: [
{ id: 1, name: "Polo Hun", avatar: testAvatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: testAvatar, fancy: 5556, post: 23 }
]
},
{
id: 4,
title: "",
list: [
{ id: 1, name: "Polo Hun", avatar: testAvatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: testAvatar, fancy: 5556, post: 23 }
]
},
{
id: 5,
title: "",
list: [
{ id: 1, name: "Polo Hun", avatar: testAvatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: testAvatar, fancy: 5556, post: 23 }
]
}
],
userChartList: [ userChartList: [], //组相关性
{
id: 1,
group: [
{ id: 1, name: "Polo Hun", avatar: testAvatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: testAvatar, fancy: 5556, post: 23 }
],
number: "0.60"
},
{
id: 2,
group: [
{
id: 7,
name: "一人一讚 馬總統感恩有您 永遠支...",
avatar: testAvatar,
fancy: 0,
post: 0
},
{
id: 8,
name: "一人一讚 馬總統感恩有您 永遠支...",
avatar: testAvatar,
fancy: 564,
post: 13
}
],
number: 0.45
},
{
id: 3,
group: [
{
id: 9,
name: "一人一讚 馬總統感恩有您 永遠支...",
avatar: testAvatar,
fancy: 0,
post: 0
},
{
id: 10,
name: "一人一讚 馬總統感恩有您 永遠支...",
avatar: testAvatar,
fancy: 564,
post: 13
}
],
number: 0.32
}
],
posts: [ posts: [
{ {
@ -328,9 +242,16 @@ export const useCharacterInteractionStore = defineStore("characterInteraction",
}), }),
actions: { actions: {
async initGroupList() { async initGroupList() {
const result = await getGroupList(); const res = await getGroupUserListFromInteraction();
this.userList = result; if (res.code != 200) {
console.log(this.userList); ElMessage.error(res.message);
return;
}
this.userList = res.data.userList;
},
initGroupCorrelationForChart() {
this.userChartList = this.userList;
} }
}, },
persist: true // 开启持久化 persist: true // 开启持久化
@ -338,42 +259,15 @@ export const useCharacterInteractionStore = defineStore("characterInteraction",
export const useSocialGroupsStore = defineStore("socialGroups", { export const useSocialGroupsStore = defineStore("socialGroups", {
state: () => ({ state: () => ({
userList: [ userList: [],
{
id: 1,
title: "时政兴趣团体",
list: [
{ id: 1, name: "Polo Hun", avatar: test1Avatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: test1Avatar, fancy: 5556, post: 23 },
{ id: 3, name: "邱盆琇", avatar: test1Avatar, fancy: 5556, post: 23 }
]
},
{
id: 2,
title: "社交博主团体",
list: [
{ id: 1, name: "Polo Hun", avatar: test1Avatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: test1Avatar, fancy: 5556, post: 23 },
{ id: 3, name: "邱盆琇", avatar: test1Avatar, fancy: 5556, post: 23 }
]
},
{
id: 3,
title: "时政兴趣团体",
list: [
{ id: 1, name: "Polo Hun", avatar: test1Avatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: test1Avatar, fancy: 5556, post: 23 },
{ id: 3, name: "邱盆琇", avatar: test1Avatar, fancy: 5556, post: 23 }
]
}
],
userChartList: [ userChartList: [
{ {
id: 1, id: 1,
group: [ group: [
{ id: 1, name: "Polo Hun", avatar: test1Avatar, fancy: 634, post: 32 }, { id: 1, name: "Polo Hun", avatar: defaultAvatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: test1Avatar, fancy: 5556, post: 23 }, { id: 2, name: "楊政子", avatar: defaultAvatar, fancy: 5556, post: 23 },
{ id: 3, name: "楊政子", avatar: test1Avatar, fancy: 5556, post: 23 } { id: 3, name: "楊政子", avatar: defaultAvatar, fancy: 5556, post: 23 }
], ],
number: "0.60" number: "0.60"
}, },
@ -383,21 +277,21 @@ export const useSocialGroupsStore = defineStore("socialGroups", {
{ {
id: 7, id: 7,
name: "一人一讚 馬總統感恩有您 永遠支...", name: "一人一讚 馬總統感恩有您 永遠支...",
avatar: test1Avatar, avatar: defaultAvatar,
fancy: 0, fancy: 0,
post: 0 post: 0
}, },
{ {
id: 8, id: 8,
name: "一人一讚 馬總統感恩有您 永遠支...", name: "一人一讚 馬總統感恩有您 永遠支...",
avatar: test1Avatar, avatar: defaultAvatar,
fancy: 564, fancy: 564,
post: 13 post: 13
}, },
{ {
id: 9, id: 9,
name: "一人一讚 馬總統感恩有您 永遠支...", name: "一人一讚 馬總統感恩有您 永遠支...",
avatar: test1Avatar, avatar: defaultAvatar,
fancy: 564, fancy: 564,
post: 13 post: 13
} }
@ -410,21 +304,21 @@ export const useSocialGroupsStore = defineStore("socialGroups", {
{ {
id: 10, id: 10,
name: "一人一讚 馬總統感恩有您 永遠支...", name: "一人一讚 馬總統感恩有您 永遠支...",
avatar: test1Avatar, avatar: defaultAvatar,
fancy: 0, fancy: 0,
post: 0 post: 0
}, },
{ {
id: 11, id: 11,
name: "一人一讚 馬總統感恩有您 永遠支...", name: "一人一讚 馬總統感恩有您 永遠支...",
avatar: test1Avatar, avatar: defaultAvatar,
fancy: 564, fancy: 564,
post: 13 post: 13
}, },
{ {
id: 12, id: 12,
name: "一人一讚 馬總統感恩有您 永遠支...", name: "一人一讚 馬總統感恩有您 永遠支...",
avatar: test1Avatar, avatar: defaultAvatar,
fancy: 564, fancy: 564,
post: 13 post: 13
} }
@ -656,60 +550,30 @@ export const useSocialGroupsStore = defineStore("socialGroups", {
{ text: "原则", top: 77.5, left: 264.5, width: 49, height: 19, fontSize: 12, opacity: 0.7 }, { 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 } { text: "台湾", top: 195.5, left: 287.5, width: 49, height: 19, fontSize: 12, opacity: 0.8 }
] ]
}) }),
actions: {
async initGroupList() {
const res = await getGroupUserListFromTriangle();
if (res.code != 200) {
ElMessage.error(res.message);
return;
}
this.userList = res.data.userList;
}
},
persist: true // 开启持久化
}); });
export const useCharacterHiddenStore = defineStore("characterHidden", { export const useCharacterHiddenStore = defineStore("characterHidden", {
state: () => ({ state: () => ({
userList: [ userList: [],
{
id: 1,
title: "",
list: [
{ id: 1, name: "Polo Hun", avatar: test2Avatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: test2Avatar, fancy: 5556, post: 23 }
]
},
{
id: 2,
title: "",
list: [
{ id: 1, name: "Polo Hun", avatar: test2Avatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: test2Avatar, fancy: 5556, post: 23 }
]
},
{
id: 3,
title: "",
list: [
{ id: 1, name: "Polo Hun", avatar: test2Avatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: test2Avatar, fancy: 5556, post: 23 }
]
},
{
id: 4,
title: "",
list: [
{ id: 1, name: "Polo Hun", avatar: test2Avatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: test2Avatar, fancy: 5556, post: 23 }
]
},
{
id: 5,
title: "",
list: [
{ id: 1, name: "Polo Hun", avatar: test2Avatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: test2Avatar, fancy: 5556, post: 23 }
]
}
],
userChartList: [ userChartList: [
{ {
id: 1, id: 1,
group: [ group: [
{ id: 1, name: "Polo Hun", avatar: test2Avatar, fancy: 634, post: 32 }, { id: 1, name: "Polo Hun", avatar: defaultAvatar, fancy: 634, post: 32 },
{ id: 2, name: "楊政子", avatar: test2Avatar, fancy: 5556, post: 23 } { id: 2, name: "楊政子", avatar: defaultAvatar, fancy: 5556, post: 23 }
], ],
number: "0.36" number: "0.36"
}, },
@ -719,14 +583,14 @@ export const useCharacterHiddenStore = defineStore("characterHidden", {
{ {
id: 7, id: 7,
name: "一人一讚 馬總統感恩有您 永遠支...", name: "一人一讚 馬總統感恩有您 永遠支...",
avatar: test2Avatar, avatar: defaultAvatar,
fancy: 0, fancy: 0,
post: 0 post: 0
}, },
{ {
id: 8, id: 8,
name: "一人一讚 馬總統感恩有您 永遠支...", name: "一人一讚 馬總統感恩有您 永遠支...",
avatar: test2Avatar, avatar: defaultAvatar,
fancy: 564, fancy: 564,
post: 13 post: 13
} }
@ -739,14 +603,14 @@ export const useCharacterHiddenStore = defineStore("characterHidden", {
{ {
id: 9, id: 9,
name: "一人一讚 馬總統感恩有您 永遠支...", name: "一人一讚 馬總統感恩有您 永遠支...",
avatar: test2Avatar, avatar: defaultAvatar,
fancy: 0, fancy: 0,
post: 0 post: 0
}, },
{ {
id: 10, id: 10,
name: "一人一讚 馬總統感恩有您 永遠支...", name: "一人一讚 馬總統感恩有您 永遠支...",
avatar: test2Avatar, avatar: defaultAvatar,
fancy: 564, fancy: 564,
post: 13 post: 13
} }
@ -980,5 +844,16 @@ export const useCharacterHiddenStore = defineStore("characterHidden", {
{ text: "原则", top: 77.5, left: 264.5, width: 49, height: 19, fontSize: 12, opacity: 0.7 }, { 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 } { text: "台湾", top: 195.5, left: 287.5, width: 49, height: 19, fontSize: 12, opacity: 0.8 }
] ]
}) }),
actions: {
async initGroupList() {
const res = await getGroupUserListFromSocial();
if (res.code != 200) {
ElMessage.error(res.message);
return;
}
this.userList = res.data.userList;
}
},
persist: true // 开启持久化
}); });

View File

@ -66,7 +66,7 @@
</template> </template>
<script setup> <script setup>
import { ref } from "vue"; import { onMounted, ref } from "vue";
import UserPanel from "../components/userPanel.vue"; import UserPanel from "../components/userPanel.vue";
import UserChart from "../components/userChart.vue"; import UserChart from "../components/userChart.vue";
import PostList from "../components/postList.vue"; import PostList from "../components/postList.vue";
@ -95,6 +95,10 @@ const handleOpenPostDialog = (post) => {
postDialog.value = true; postDialog.value = true;
currentPostPost.value = post; currentPostPost.value = post;
}; };
onMounted(() => {
characterHiddenStore.initGroupList();
});
</script> </script>
<style scoped lang="less"> <style scoped lang="less">

View File

@ -8,7 +8,7 @@
@click="handleUserItem(index, group)" @click="handleUserItem(index, group)"
:class="{ active: curUserGroupIndex == index }" :class="{ active: curUserGroupIndex == index }"
> >
<div class="group-type" v-if="group.list.length > 2"> <div class="group-type" v-if="group.list.length > 2 && group.title != ' '">
<img <img
src="@/assets/images/linkPrediction/title/group-item-title.png" src="@/assets/images/linkPrediction/title/group-item-title.png"
class="group-type-back" class="group-type-back"
@ -16,17 +16,17 @@
<div class="group-type-content">{{ group.type }}</div> <div class="group-type-content">{{ group.type }}</div>
</div> </div>
<div class="user-list-item" v-for="child in group.list" :key="child.id"> <div class="user-list-item" v-for="child in group.list" :key="child.id">
<img :src="child.avatar" alt="" class="avatar" /> <img :src="defaultAvatar" alt="" class="avatar" />
<div class="user-info"> <div class="user-info">
<div class="username">{{ child.name }}</div> <div class="username">{{ child.userName }}</div>
<div class="userState"> <div class="userState">
<div class="userState-fancy"> <div class="userState-fancy">
粉丝数: 粉丝数:
<p>{{ child.fancy }}</p> <p>{{ child.fans }}</p>
</div> </div>
<div class="userState-monitor-count"> <div class="userState-monitor-count">
发帖数: 发帖数:
<p>{{ child.post }}</p> <p>{{ child.postNum }}</p>
</div> </div>
</div> </div>
</div> </div>
@ -39,8 +39,8 @@
<script setup> <script setup>
import { defineProps, defineEmits, ref } from "vue"; import { defineProps, defineEmits, ref } from "vue";
import defaultAvatar from "@/assets/images/avatar/default.png";
const curUserGroupIndex = ref(0); const curUserGroupIndex = ref(0);
const emit = defineEmits(["click:selectedGroup"]); const emit = defineEmits(["click:selectedGroup"]);
const props = defineProps({ const props = defineProps({
userList: { userList: {

View File

@ -66,7 +66,7 @@
</template> </template>
<script setup> <script setup>
import { ref } from "vue"; import { onMounted, ref } from "vue";
import UserPanel from "../components/userPanel.vue"; import UserPanel from "../components/userPanel.vue";
import UserChart from "../components/userChart.vue"; import UserChart from "../components/userChart.vue";
import PostList from "../components/postList.vue"; import PostList from "../components/postList.vue";
@ -94,8 +94,11 @@ const handleSelectedUserGroup = (group) => {
const handleOpenPostDialog = (post) => { const handleOpenPostDialog = (post) => {
postDialog.value = true; postDialog.value = true;
currentPostPost.value = post; currentPostPost.value = post;
console.log(post);
}; };
onMounted(() => {
socialGroupsStore.initGroupList();
});
</script> </script>
<style scoped lang="less"> <style scoped lang="less">