diff --git a/dist.zip b/dist.zip index 5ad21c3..7af86e2 100644 Binary files a/dist.zip and b/dist.zip differ diff --git a/src/assets/images/head/hiddenTitle.png b/src/assets/images/head/hiddenTitle.png new file mode 100644 index 0000000..4236044 Binary files /dev/null and b/src/assets/images/head/hiddenTitle.png differ diff --git a/src/assets/images/head/linkedPredictionStruct.png b/src/assets/images/head/linkedPredictionStruct.png new file mode 100644 index 0000000..fcb1562 Binary files /dev/null and b/src/assets/images/head/linkedPredictionStruct.png differ diff --git a/src/components/timeAxis.vue b/src/components/timeAxis.vue index 6c47423..83a09d4 100644 --- a/src/components/timeAxis.vue +++ b/src/components/timeAxis.vue @@ -11,7 +11,7 @@ >
@@ -33,7 +33,7 @@
@@ -53,12 +53,12 @@ const props = defineProps({ }, startTime: { //起始时间 - type: Date, + default: new Date("2024-05-16 16:56:04") }, endTime: { //结束时间 - type: Date, + default: new Date("2024-05-23 10:16:56") }, initPosition: { @@ -81,7 +81,7 @@ const props = defineProps({ const startTime = ref(props.startTime) //开始时间 const endTime = ref(props.endTime) //结束时间 const timeList = ref(props.timeList) //时间列表 -const currentTime = ref(new Date("2024-05-16 16:56:04")) // 当前选中的时间 +const currentTime = ref(props.startTime) // 当前选中的时间 const currentPosition = ref(props.initPosition) // 初始位置 const isPlaying = ref(props.isAutoPlay) // 是否自动播放 const axisRef = ref(null) // 轴的引用 @@ -90,7 +90,7 @@ const axisWidth = nowSize(415) // 轴的长度(px) const startTimeMs = startTime.value.getTime() // 起始时间的毫秒数 const endTimeMs = endTime.value.getTime() // 结束时间的毫秒数 const totalDuration = endTimeMs - startTimeMs // 计算总持续时间 -const step = 4 // 每次移动的像素数(px) +const step = nowSize(4) // 每次移动的像素数(px) let playTimer = null // 自动播放定时器 const emit = defineEmits(["click:pointerDown", "slide:pointerUp"]) @@ -138,7 +138,7 @@ watch( // 让 active-needle 标定在 timeList 最后一个时间点 const showHidden = computed(() => { if (!timeList.value || timeList.value.length === 0) return {} - const left = getTimeSectionLeft.value(timeList.value[timeList.value.length - 1]) + 5 // +5px 保持和 time-section 对齐 + const left = getTimeSectionLeft.value(timeList.value[timeList.value.length - 1]) + nowSize(5) // +5px 保持和 time-section 对齐 return { left: `${left}px` } }) @@ -153,17 +153,41 @@ const pause = () => { } // 自动播放控制 +// 已处理过的时间点索引 +let processedIndices = new Set() + +// 重置已处理时间点 +const resetProcessedIndices = () => { + processedIndices.clear() +} + const play = () => { - if (!isPlaying.value) return + if (!isPlaying.value || timeList.value.length === 0) return + // 重置已处理索引,确保每次播放都从当前位置重新开始处理 playTimer = setInterval(() => { - if (currentPosition.value >= axisWidth) { - pause() - return - } + // 持续移动进度条 currentPosition.value = Math.min(axisWidth, currentPosition.value + step) currentTime.value = getTimeFromPosition(currentPosition.value) - emit("slide:pointerUp", currentTime.value) - }, 300) // 每300ms移动一次 + // 检查当前位置是否到达或超过某个时间切片 + for (let i = 0; i < timeList.value.length; i++) { + if (processedIndices.has(i)) continue + const time = timeList.value[i] + const left = getTimeSectionLeft.value(time) + // 如果当前位置超过了这个时间切片的位置,并且还没有处理过 + if ( + currentPosition.value >= left - nowSize(2) && + currentPosition.value <= left + nowSize(2) + ) { + currentTime.value = time // 使用精确的时间值 + emit("slide:pointerUp", time) // 只在timeList中的时间点发送请求 + processedIndices.add(i) + } + } + // 如果到达终点,停止播放 + if (currentPosition.value >= axisWidth) { + pause() + } + }, 500) // 每500ms移动一小步 } // 根据位置计算时间 @@ -177,6 +201,7 @@ const getTimeFromPosition = (position) => { const handlePointerDown = (e) => { if (e.target.classList.contains("timeLine-point")) return pause() // 拖动或点击时暂停自动播放 + resetProcessedIndices() // 重置已处理时间点 const rect = axisRef.value.getBoundingClientRect() const position = Math.max(0, Math.min(axisWidth, e.clientX - rect.left)) currentPosition.value = position @@ -189,6 +214,7 @@ const handlePointPointerDown = (e) => { e.stopPropagation() e.preventDefault() isDragging.value = true + resetProcessedIndices() // 重置已处理时间点 // 缓存轴的边界矩形,避免重复计算 const rect = axisRef.value.getBoundingClientRect() const axisLeft = rect.left @@ -216,9 +242,10 @@ const handlePointPointerDown = (e) => { document.addEventListener("pointerup", handlePointerUp) } -const timeSectionWidth = 4 // 与样式保持一致 +const timeSectionWidth = nowSize(4) // 与样式保持一致 const handleSectionPointerDown = (time) => { pause() + resetProcessedIndices() // 重置已处理时间点 // 计算该时间点的中心位置 const left = getTimeSectionLeft.value(time) + timeSectionWidth / 2 currentPosition.value = left @@ -232,6 +259,7 @@ const reset = () => { currentTime.value = getTimeFromPosition(props.initPosition) // 清理旧定时器 pause() + resetProcessedIndices() // 重置已处理时间点 // 重新开始播放 if (props.isAutoPlay) { isPlaying.value = true diff --git a/src/store/groupEvolution/index.js b/src/store/groupEvolution/index.js index 0f671a4..12b7ab5 100644 --- a/src/store/groupEvolution/index.js +++ b/src/store/groupEvolution/index.js @@ -186,8 +186,6 @@ export const useGroupDiscoveryStore = defineStore("groupDiscovery", { //获取群体列表数据 async initializeGroupList(time = "") { const res = await getGroupEvolutionGroupList(time) - console.log("群体列表:", res) - if (res.code != 200) return const iconMap = { 节点数: nodePrefix, diff --git a/src/views/GroupEvolution/component/groupGraph.vue b/src/views/GroupEvolution/component/groupGraph.vue deleted file mode 100644 index e69de29..0000000 diff --git a/src/views/GroupEvolution/components/groupGraph.vue b/src/views/GroupEvolution/components/groupGraph.vue index 708a5f8..f2b58e8 100644 --- a/src/views/GroupEvolution/components/groupGraph.vue +++ b/src/views/GroupEvolution/components/groupGraph.vue @@ -30,7 +30,7 @@