Showing
1 changed file
with
25 additions
and
1 deletions
| @@ -434,6 +434,16 @@ | @@ -434,6 +434,16 @@ | ||
| 434 | </svg> | 434 | </svg> |
| 435 | </button> | 435 | </button> |
| 436 | 436 | ||
| 437 | + <button class="btn" id="manualRefreshBtn" title="手动刷新图谱"> | ||
| 438 | + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | ||
| 439 | + <polyline points="23 4 23 10 17 10"/> | ||
| 440 | + <polyline points="1 20 1 14 7 14"/> | ||
| 441 | + <path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10"/> | ||
| 442 | + <path d="M20.49 15a9 9 0 0 1-14.85 3.36L1 14"/> | ||
| 443 | + </svg> | ||
| 444 | + 刷新 | ||
| 445 | + </button> | ||
| 446 | + | ||
| 437 | <div class="search-box"> | 447 | <div class="search-box"> |
| 438 | <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | 448 | <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> |
| 439 | <circle cx="11" cy="11" r="8"/> | 449 | <circle cx="11" cy="11" r="8"/> |
| @@ -591,7 +601,7 @@ | @@ -591,7 +601,7 @@ | ||
| 591 | 601 | ||
| 592 | // 加载图谱数据 | 602 | // 加载图谱数据 |
| 593 | async function loadGraphData(options = {}) { | 603 | async function loadGraphData(options = {}) { |
| 594 | - const { fromPoll = false } = options; | 604 | + const { fromPoll = false, fromManual = false } = options; |
| 595 | // 仅在首次或未加载成功时展示大遮罩 | 605 | // 仅在首次或未加载成功时展示大遮罩 |
| 596 | if (!graphReady || !fromPoll) { | 606 | if (!graphReady || !fromPoll) { |
| 597 | showLoading(true); | 607 | showLoading(true); |
| @@ -615,11 +625,17 @@ | @@ -615,11 +625,17 @@ | ||
| 615 | showEmpty(false); | 625 | showEmpty(false); |
| 616 | graphReady = true; | 626 | graphReady = true; |
| 617 | stopGraphPolling(); | 627 | stopGraphPolling(); |
| 628 | + if (fromManual) { | ||
| 629 | + showToast('已刷新最新图谱'); | ||
| 630 | + } | ||
| 618 | } else { | 631 | } else { |
| 619 | if (!graphReady) { | 632 | if (!graphReady) { |
| 620 | showEmpty(true); | 633 | showEmpty(true); |
| 621 | } | 634 | } |
| 622 | showLoading(false); | 635 | showLoading(false); |
| 636 | + if (fromManual) { | ||
| 637 | + showToast('未找到图谱数据'); | ||
| 638 | + } | ||
| 623 | } | 639 | } |
| 624 | } catch (error) { | 640 | } catch (error) { |
| 625 | console.error('加载图谱失败:', error); | 641 | console.error('加载图谱失败:', error); |
| @@ -854,6 +870,14 @@ | @@ -854,6 +870,14 @@ | ||
| 854 | } | 870 | } |
| 855 | }); | 871 | }); |
| 856 | 872 | ||
| 873 | + // 手动刷新 | ||
| 874 | + const manualRefreshBtn = document.getElementById('manualRefreshBtn'); | ||
| 875 | + if (manualRefreshBtn) { | ||
| 876 | + manualRefreshBtn.addEventListener('click', () => { | ||
| 877 | + loadGraphData({ fromManual: true }); | ||
| 878 | + }); | ||
| 879 | + } | ||
| 880 | + | ||
| 857 | // 全屏 | 881 | // 全屏 |
| 858 | document.getElementById('fullscreenBtn').addEventListener('click', () => { | 882 | document.getElementById('fullscreenBtn').addEventListener('click', () => { |
| 859 | if (!document.fullscreenElement) { | 883 | if (!document.fullscreenElement) { |
-
Please register or login to post a comment