2025-07-17 10:28:56 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="right-panel">
|
2025-08-13 16:40:18 +08:00
|
|
|
|
<img src="@/assets/images/head/bayi.png" alt="" class="head" />
|
2025-07-17 10:28:56 +08:00
|
|
|
|
<div class="key-node-recognition">
|
|
|
|
|
|
<div class="content-wrapper">
|
|
|
|
|
|
<div class="chart-container">
|
2025-08-13 16:40:18 +08:00
|
|
|
|
<BridgeCommunityGraph
|
|
|
|
|
|
ref="bridgeGraphRef"
|
|
|
|
|
|
v-if="currentComponent == 'BridgeCommunityNode'"
|
2025-07-17 10:28:56 +08:00
|
|
|
|
:timestamp="store.activeTimePoint"
|
2025-08-13 16:40:18 +08:00
|
|
|
|
@click:navigateToCommunityDetail="handleClickCommunity"
|
2025-07-17 10:28:56 +08:00
|
|
|
|
/>
|
2025-08-13 16:40:18 +08:00
|
|
|
|
<DetailCommunityGraph
|
|
|
|
|
|
v-else
|
|
|
|
|
|
ref="detailCommunityGraphRef"
|
2025-07-25 15:26:19 +08:00
|
|
|
|
:communityId="currentSelectedCommunityId"
|
|
|
|
|
|
@click:goback="handleClickGoBack"
|
|
|
|
|
|
/>
|
2025-07-17 10:28:56 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="timeline-container">
|
|
|
|
|
|
<span class="time-label">2023.10.07 00:00:00</span>
|
2025-07-18 14:29:29 +08:00
|
|
|
|
<div class="timeline-track" :style="trackStyle">
|
2025-07-17 10:28:56 +08:00
|
|
|
|
<div
|
|
|
|
|
|
v-for="point in store.timePoints"
|
|
|
|
|
|
:key="point.id"
|
|
|
|
|
|
class="timeline-point-wrapper"
|
2025-07-18 14:29:29 +08:00
|
|
|
|
:style="{ left: `${pointPositions[point.id]}%` }"
|
2025-07-17 10:28:56 +08:00
|
|
|
|
@click="store.setActiveTimePoint(point.id)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-tooltip
|
|
|
|
|
|
class="timePoint-box-item"
|
|
|
|
|
|
effect="light"
|
|
|
|
|
|
:content="point.timestamp"
|
|
|
|
|
|
placement="bottom"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="timeline-point" :class="{ active: store.activeTimePoint === point.id }">
|
|
|
|
|
|
<el-popover
|
|
|
|
|
|
v-if="store.activeTimePoint === point.id"
|
|
|
|
|
|
effect="dark"
|
|
|
|
|
|
placement="top"
|
|
|
|
|
|
:title="point.leaderId"
|
|
|
|
|
|
:width="50"
|
|
|
|
|
|
trigger="click"
|
|
|
|
|
|
content="发布贴文"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #reference>
|
|
|
|
|
|
<div class="active-pin"></div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<span class="time-label">2023.10.15 00:00:00</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2025-08-13 16:40:18 +08:00
|
|
|
|
import { ref, defineExpose, watch, computed } from "vue"
|
|
|
|
|
|
import { useKeyNodeStore2 } from "@/store/keyNodeStore2"
|
2025-07-17 10:28:56 +08:00
|
|
|
|
|
2025-08-13 16:40:18 +08:00
|
|
|
|
import BridgeCommunityGraph from "./graph/bridgeCommunityGraph.vue"
|
|
|
|
|
|
import DetailCommunityGraph from "./graph/detailCommunityGraph.vue"
|
2025-07-17 10:28:56 +08:00
|
|
|
|
|
2025-08-13 16:40:18 +08:00
|
|
|
|
const store = useKeyNodeStore2()
|
|
|
|
|
|
const leaderGraphRef = ref(null)
|
2025-07-24 17:02:04 +08:00
|
|
|
|
// 添加对BridgeCommunityGraph的引用
|
2025-08-13 16:40:18 +08:00
|
|
|
|
const bridgeGraphRef = ref(null)
|
2025-07-25 15:26:19 +08:00
|
|
|
|
// 设置当前激活的组件--默认是BridgeCommunityGraph
|
2025-08-13 16:40:18 +08:00
|
|
|
|
const currentComponent = ref("BridgeCommunityNode")
|
|
|
|
|
|
const currentSelectedCommunityId = ref(null)
|
2025-07-17 10:28:56 +08:00
|
|
|
|
|
|
|
|
|
|
const handleGraphNodeClick = (leaderData) => {
|
2025-08-13 16:40:18 +08:00
|
|
|
|
store.openLeaderDetail(leaderData)
|
|
|
|
|
|
}
|
2025-07-17 10:28:56 +08:00
|
|
|
|
|
2025-07-25 15:26:19 +08:00
|
|
|
|
const handleClickCommunity = (communityId) => {
|
2025-08-13 16:40:18 +08:00
|
|
|
|
if (communityId) {
|
|
|
|
|
|
currentComponent.value = "DetailCommunityNode"
|
|
|
|
|
|
currentSelectedCommunityId.value = communityId
|
2025-07-25 15:26:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleClickGoBack = (currentComponentName) => {
|
2025-08-13 16:40:18 +08:00
|
|
|
|
currentComponent.value = currentComponentName
|
|
|
|
|
|
}
|
2025-07-25 15:26:19 +08:00
|
|
|
|
|
2025-07-17 10:28:56 +08:00
|
|
|
|
const highlightNode = (leaderId) => {
|
|
|
|
|
|
if (leaderGraphRef.value) {
|
2025-08-13 16:40:18 +08:00
|
|
|
|
leaderGraphRef.value.highlightNode(leaderId)
|
2025-07-17 10:28:56 +08:00
|
|
|
|
}
|
2025-07-24 17:02:04 +08:00
|
|
|
|
// 调用BridgeCommunityGraph的highlightNode方法
|
|
|
|
|
|
if (bridgeGraphRef.value) {
|
2025-08-13 16:40:18 +08:00
|
|
|
|
bridgeGraphRef.value.highlightNode(leaderId)
|
2025-07-24 17:02:04 +08:00
|
|
|
|
}
|
2025-08-13 16:40:18 +08:00
|
|
|
|
}
|
2025-07-18 14:29:29 +08:00
|
|
|
|
|
|
|
|
|
|
// 计算时间点在时间轴上的位置百分比
|
|
|
|
|
|
const calculatePositions = (timestamp) => {
|
2025-08-13 16:40:18 +08:00
|
|
|
|
// 时间范围: 2023-10-07T00:00:00 到 2023-10-15T00:00:00
|
|
|
|
|
|
const startTime = new Date("2023-10-07T00:00:00").getTime()
|
|
|
|
|
|
const endTime = new Date("2023-10-15T00:00:00").getTime()
|
|
|
|
|
|
const timeRange = endTime - startTime
|
2025-07-18 14:29:29 +08:00
|
|
|
|
// 复制并排序时间点数据
|
|
|
|
|
|
const sortedPoints = [...store.timePoints].sort((a, b) => {
|
2025-08-13 16:40:18 +08:00
|
|
|
|
return new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()
|
|
|
|
|
|
})
|
2025-07-18 14:29:29 +08:00
|
|
|
|
// 计算每个点的原始位置
|
2025-08-13 16:40:18 +08:00
|
|
|
|
const pointPositions = {}
|
|
|
|
|
|
sortedPoints.forEach((point) => {
|
|
|
|
|
|
const pointTime = new Date(point.timestamp).getTime()
|
|
|
|
|
|
const position = ((pointTime - startTime) / timeRange) * 100
|
|
|
|
|
|
pointPositions[point.id] = Math.max(0, Math.min(100, position))
|
|
|
|
|
|
})
|
2025-07-18 14:29:29 +08:00
|
|
|
|
// 处理重叠 (假设每个点宽度约为20px,时间轴总宽度为可用宽度)
|
2025-08-13 16:40:18 +08:00
|
|
|
|
const pointWidthPercentage = 5 // 估算的点宽度百分比
|
|
|
|
|
|
const minSpacing = pointWidthPercentage // 最小间距百分比
|
2025-07-18 14:29:29 +08:00
|
|
|
|
|
|
|
|
|
|
// 调整重叠的点
|
|
|
|
|
|
for (let i = 1; i < sortedPoints.length; i++) {
|
2025-08-13 16:40:18 +08:00
|
|
|
|
const prevPoint = sortedPoints[i - 1]
|
|
|
|
|
|
const currPoint = sortedPoints[i]
|
2025-07-18 14:29:29 +08:00
|
|
|
|
|
2025-08-13 16:40:18 +08:00
|
|
|
|
const prevPosition = pointPositions[prevPoint.id]
|
|
|
|
|
|
const currPosition = pointPositions[currPoint.id]
|
2025-07-18 14:29:29 +08:00
|
|
|
|
|
|
|
|
|
|
// 检查是否重叠
|
|
|
|
|
|
if (currPosition - prevPosition < minSpacing) {
|
|
|
|
|
|
// 调整当前点位置
|
2025-08-13 16:40:18 +08:00
|
|
|
|
pointPositions[currPoint.id] = prevPosition + minSpacing
|
2025-07-18 14:29:29 +08:00
|
|
|
|
|
|
|
|
|
|
// 确保不超出范围
|
|
|
|
|
|
if (pointPositions[currPoint.id] > 100) {
|
2025-08-13 16:40:18 +08:00
|
|
|
|
pointPositions[currPoint.id] = 100
|
2025-07-18 14:29:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-13 16:40:18 +08:00
|
|
|
|
return pointPositions
|
2025-07-18 14:29:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 响应式引用存储位置信息
|
2025-08-13 16:40:18 +08:00
|
|
|
|
const pointPositions = ref({})
|
2025-07-18 14:29:29 +08:00
|
|
|
|
|
|
|
|
|
|
// 监听时间点变化,重新计算位置
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => store.timePoints,
|
|
|
|
|
|
() => {
|
2025-08-13 16:40:18 +08:00
|
|
|
|
pointPositions.value = calculatePositions()
|
2025-07-18 14:29:29 +08:00
|
|
|
|
},
|
|
|
|
|
|
{ immediate: true, deep: true }
|
2025-08-13 16:40:18 +08:00
|
|
|
|
)
|
2025-07-18 14:29:29 +08:00
|
|
|
|
|
|
|
|
|
|
// 计算时间轴轨道样式
|
|
|
|
|
|
const trackStyle = computed(() => {
|
2025-08-13 16:40:18 +08:00
|
|
|
|
if (!store.activeTimePoint) return {}
|
|
|
|
|
|
const activePosition = pointPositions.value[store.activeTimePoint] || 0
|
2025-07-18 14:29:29 +08:00
|
|
|
|
return {
|
|
|
|
|
|
background: `linear-gradient(90deg, #3B7699 0%, #00F3FF ${activePosition}%, #3B7699 ${activePosition}%, #3B7699 100%)`
|
2025-08-13 16:40:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2025-07-18 14:29:29 +08:00
|
|
|
|
|
2025-08-13 16:40:18 +08:00
|
|
|
|
defineExpose({ highlightNode })
|
2025-07-17 10:28:56 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
2025-08-13 16:43:36 +08:00
|
|
|
|
<style scoped lang="less">
|
|
|
|
|
|
|
2025-07-17 10:28:56 +08:00
|
|
|
|
.right-panel {
|
2025-08-13 16:40:18 +08:00
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
2025-07-17 10:28:56 +08:00
|
|
|
|
position: relative;
|
|
|
|
|
|
}
|
2025-08-13 16:40:18 +08:00
|
|
|
|
.head {
|
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
|
}
|
2025-07-17 10:28:56 +08:00
|
|
|
|
.key-node-recognition {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
.background-svg-wrapper {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
z-index: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
.content-wrapper {
|
2025-08-13 16:40:18 +08:00
|
|
|
|
width: 100%;
|
2025-07-17 10:28:56 +08:00
|
|
|
|
position: relative;
|
|
|
|
|
|
z-index: 2;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
height: 100%;
|
2025-08-13 16:40:18 +08:00
|
|
|
|
|
2025-07-17 10:28:56 +08:00
|
|
|
|
box-sizing: border-box;
|
2025-08-13 16:43:36 +08:00
|
|
|
|
.graph-img-title {
|
|
|
|
|
|
display: absolute;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-17 10:28:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
.chart-container {
|
|
|
|
|
|
width: 100%;
|
2025-08-13 16:40:18 +08:00
|
|
|
|
height: 100%;
|
|
|
|
|
|
margin-top: 35px;
|
2025-07-17 10:28:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
.timeline-container {
|
2025-08-13 16:40:18 +08:00
|
|
|
|
width: 95%;
|
|
|
|
|
|
height: 40px;
|
2025-07-17 10:28:56 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
2025-08-13 16:43:36 +08:00
|
|
|
|
padding: 0px 10px;
|
2025-07-17 10:28:56 +08:00
|
|
|
|
box-sizing: border-box;
|
2025-08-13 16:40:18 +08:00
|
|
|
|
position: absolute;
|
2025-07-17 10:28:56 +08:00
|
|
|
|
z-index: 1;
|
2025-08-13 16:40:18 +08:00
|
|
|
|
bottom: 15px;
|
|
|
|
|
|
left: 20px;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
border: 1px solid #3aa1f8;
|
|
|
|
|
|
background: linear-gradient(270deg, rgba(0, 82, 125, 0.48) 0%, rgba(0, 200, 255, 0.23) 100%);
|
|
|
|
|
|
backdrop-filter: blur(3px);
|
2025-07-17 10:28:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
.time-label {
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: #a9c2e0;
|
|
|
|
|
|
}
|
|
|
|
|
|
.timeline-track {
|
|
|
|
|
|
flex-grow: 1;
|
|
|
|
|
|
height: 4px;
|
|
|
|
|
|
margin: 0 15px;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
.timeline-point-wrapper {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
height: 20px;
|
|
|
|
|
|
cursor: pointer;
|
2025-07-18 14:29:29 +08:00
|
|
|
|
position: absolute;
|
|
|
|
|
|
transform: translateX(-50%);
|
2025-07-17 10:28:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
.timeline-point {
|
2025-07-18 14:29:29 +08:00
|
|
|
|
width: 18px;
|
|
|
|
|
|
height: 18px;
|
|
|
|
|
|
background-color: transparent;
|
2025-07-17 10:28:56 +08:00
|
|
|
|
border-radius: 50%;
|
2025-08-13 16:40:18 +08:00
|
|
|
|
border: 1.6px solid #ffe5a4;
|
2025-07-17 10:28:56 +08:00
|
|
|
|
transition: transform 0.3s ease;
|
|
|
|
|
|
position: relative;
|
2025-07-18 14:29:29 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
2025-07-17 10:28:56 +08:00
|
|
|
|
}
|
2025-07-18 14:29:29 +08:00
|
|
|
|
|
|
|
|
|
|
.timeline-point::after {
|
2025-08-13 16:40:18 +08:00
|
|
|
|
content: "";
|
2025-07-18 14:29:29 +08:00
|
|
|
|
width: 10px;
|
|
|
|
|
|
height: 10px;
|
2025-08-13 16:40:18 +08:00
|
|
|
|
background-color: #f9bd25;
|
2025-07-18 14:29:29 +08:00
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-17 10:28:56 +08:00
|
|
|
|
.timeline-point-wrapper:hover .timeline-point {
|
|
|
|
|
|
transform: scale(1.5);
|
|
|
|
|
|
}
|
|
|
|
|
|
.timeline-point.active {
|
2025-07-18 14:29:29 +08:00
|
|
|
|
background-color: transparent;
|
2025-08-13 16:40:18 +08:00
|
|
|
|
border-color: #ffe5a4;
|
2025-07-17 10:28:56 +08:00
|
|
|
|
transform: scale(1.3);
|
|
|
|
|
|
}
|
|
|
|
|
|
.active-pin {
|
|
|
|
|
|
width: 30px;
|
|
|
|
|
|
height: 34px;
|
|
|
|
|
|
background-image: url("@/assets/images/point.png");
|
|
|
|
|
|
background-size: cover;
|
2025-08-13 16:40:18 +08:00
|
|
|
|
bottom: 6px;
|
2025-07-17 10:28:56 +08:00
|
|
|
|
position: absolute;
|
|
|
|
|
|
}
|
2025-08-13 16:40:18 +08:00
|
|
|
|
</style>
|