2026-01-14 00:56:30 +08:00
|
|
|
|
<script lang="ts" setup>
|
2026-01-14 01:06:15 +08:00
|
|
|
|
import { ref, onMounted, onUnmounted } from 'vue'
|
2026-01-14 00:56:30 +08:00
|
|
|
|
import PinnedBids from './components/PinnedBids.vue'
|
2026-01-14 01:06:15 +08:00
|
|
|
|
import AiRecommendations from './components/AiRecommendations.vue'
|
2026-01-14 09:26:04 +08:00
|
|
|
|
import WidgetCrawlInfo from './components/WidgetCrawlInfo.vue'
|
2026-01-14 00:56:30 +08:00
|
|
|
|
|
|
|
|
|
|
const activeTab = ref('pinned')
|
2026-01-14 01:06:15 +08:00
|
|
|
|
const pinnedBidsRef = ref<InstanceType<typeof PinnedBids>>()
|
|
|
|
|
|
const aiRecommendationsRef = ref<InstanceType<typeof AiRecommendations>>()
|
2026-01-14 09:26:04 +08:00
|
|
|
|
const widgetCrawlInfoRef = ref<InstanceType<typeof WidgetCrawlInfo>>()
|
2026-01-14 01:06:15 +08:00
|
|
|
|
let refreshTimer: number | null = null
|
2026-01-14 09:26:04 +08:00
|
|
|
|
const showToast = ref(false)
|
|
|
|
|
|
const toastMessage = ref('')
|
2026-01-14 00:56:30 +08:00
|
|
|
|
|
|
|
|
|
|
const tabs = [
|
|
|
|
|
|
{ id: 'pinned', label: '置顶项目' },
|
2026-01-14 09:26:04 +08:00
|
|
|
|
{ id: 'ai', label: 'AI 推荐' },
|
|
|
|
|
|
{ id: 'status', label: '状态' }
|
2026-01-14 00:56:30 +08:00
|
|
|
|
]
|
2026-01-14 01:06:15 +08:00
|
|
|
|
|
|
|
|
|
|
const handleRefresh = () => {
|
|
|
|
|
|
if (activeTab.value === 'pinned' && pinnedBidsRef.value) {
|
|
|
|
|
|
pinnedBidsRef.value.loadPinnedBids()
|
2026-01-14 09:26:04 +08:00
|
|
|
|
showToastMessage('置顶项目已刷新')
|
2026-01-14 01:06:15 +08:00
|
|
|
|
} else if (activeTab.value === 'ai' && aiRecommendationsRef.value) {
|
|
|
|
|
|
aiRecommendationsRef.value.loadRecommendations()
|
2026-01-14 09:26:04 +08:00
|
|
|
|
showToastMessage('AI 推荐已刷新')
|
|
|
|
|
|
} else if (activeTab.value === 'status' && widgetCrawlInfoRef.value) {
|
|
|
|
|
|
widgetCrawlInfoRef.value.loadCrawlStats()
|
|
|
|
|
|
showToastMessage('状态已刷新')
|
2026-01-14 01:06:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-14 09:26:04 +08:00
|
|
|
|
const showToastMessage = (message: string) => {
|
|
|
|
|
|
toastMessage.value = message
|
|
|
|
|
|
showToast.value = true
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
showToast.value = false
|
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-14 01:06:15 +08:00
|
|
|
|
const startAutoRefresh = () => {
|
|
|
|
|
|
// 每5分钟(300000毫秒)自动刷新
|
|
|
|
|
|
refreshTimer = window.setInterval(() => {
|
|
|
|
|
|
handleRefresh()
|
|
|
|
|
|
}, 300000)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const stopAutoRefresh = () => {
|
|
|
|
|
|
if (refreshTimer !== null) {
|
|
|
|
|
|
clearInterval(refreshTimer)
|
|
|
|
|
|
refreshTimer = null
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
startAutoRefresh()
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
|
stopAutoRefresh()
|
|
|
|
|
|
})
|
2026-01-14 00:56:30 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
|
<div class="tabs">
|
|
|
|
|
|
<button
|
|
|
|
|
|
v-for="tab in tabs"
|
|
|
|
|
|
:key="tab.id"
|
|
|
|
|
|
:class="['tab-button', { active: activeTab === tab.id }]"
|
|
|
|
|
|
@click="activeTab = tab.id"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ tab.label }}
|
|
|
|
|
|
</button>
|
2026-01-14 01:06:15 +08:00
|
|
|
|
<button class="refresh-button" @click="handleRefresh">
|
|
|
|
|
|
🔄 刷新
|
|
|
|
|
|
</button>
|
2026-01-14 00:56:30 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="tab-content">
|
2026-01-14 01:06:15 +08:00
|
|
|
|
<PinnedBids v-if="activeTab === 'pinned'" ref="pinnedBidsRef"/>
|
|
|
|
|
|
<AiRecommendations v-else-if="activeTab === 'ai'" ref="aiRecommendationsRef"/>
|
2026-01-14 09:26:04 +08:00
|
|
|
|
<WidgetCrawlInfo v-else-if="activeTab === 'status'" ref="widgetCrawlInfoRef"/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div v-if="showToast" class="toast">
|
|
|
|
|
|
{{ toastMessage }}
|
2026-01-14 00:56:30 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
* {
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
body {
|
|
|
|
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
|
|
|
|
background: #f5f5f5;
|
2026-01-14 01:10:48 +08:00
|
|
|
|
font-size: 12px;
|
2026-01-14 00:56:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.app-container {
|
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
|
background: #f5f5f5;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.tabs {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
border-bottom: 1px solid #e0e0e0;
|
2026-01-14 01:10:48 +08:00
|
|
|
|
padding: 0 8px;
|
2026-01-14 00:56:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.tab-button {
|
2026-01-14 01:10:48 +08:00
|
|
|
|
padding: 8px 12px;
|
2026-01-14 00:56:30 +08:00
|
|
|
|
background: none;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
border-bottom: 2px solid transparent;
|
2026-01-14 01:10:48 +08:00
|
|
|
|
font-size: 12px;
|
2026-01-14 00:56:30 +08:00
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
transition: all 0.2s ease;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.tab-button:hover {
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
background: #f9f9f9;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.tab-button.active {
|
|
|
|
|
|
color: #3498db;
|
|
|
|
|
|
border-bottom-color: #3498db;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.tab-content {
|
2026-01-14 01:10:48 +08:00
|
|
|
|
padding: 8px;
|
2026-01-14 00:56:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-14 01:06:15 +08:00
|
|
|
|
.refresh-button {
|
|
|
|
|
|
margin-left: auto;
|
2026-01-14 01:10:48 +08:00
|
|
|
|
padding: 4px 10px;
|
2026-01-14 01:06:15 +08:00
|
|
|
|
background: #3498db;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
border: none;
|
2026-01-14 01:10:48 +08:00
|
|
|
|
border-radius: 3px;
|
|
|
|
|
|
font-size: 11px;
|
2026-01-14 01:06:15 +08:00
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
transition: all 0.2s ease;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.refresh-button:hover {
|
|
|
|
|
|
background: #2980b9;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.refresh-button:active {
|
|
|
|
|
|
transform: scale(0.98);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-14 00:56:30 +08:00
|
|
|
|
.placeholder {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
2026-01-14 01:10:48 +08:00
|
|
|
|
min-height: 200px;
|
2026-01-14 00:56:30 +08:00
|
|
|
|
color: #999;
|
2026-01-14 01:10:48 +08:00
|
|
|
|
font-size: 12px;
|
2026-01-14 00:56:30 +08:00
|
|
|
|
}
|
2026-01-14 09:26:04 +08:00
|
|
|
|
|
|
|
|
|
|
.toast {
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
top: 50%;
|
|
|
|
|
|
left: 50%;
|
|
|
|
|
|
transform: translate(-50%, -50%);
|
|
|
|
|
|
background: rgba(0, 0, 0, 0.8);
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
padding: 12px 24px;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
z-index: 1000;
|
|
|
|
|
|
animation: fadeIn 0.3s ease;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@keyframes fadeIn {
|
|
|
|
|
|
from {
|
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
to {
|
|
|
|
|
|
opacity: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-01-14 00:56:30 +08:00
|
|
|
|
</style>
|