下载模组更新,新增下载组件,下载监听改为全局,全量改为增量监听

This commit is contained in:
2025-08-31 06:41:46 +08:00
parent aa04f9d03f
commit ad5dfc64cb
17 changed files with 1662 additions and 285 deletions
+20
View File
@@ -1,16 +1,33 @@
<script setup lang="ts">
import { RouterLink, RouterView } from 'vue-router'
import { computed, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
import { useDownloadStore } from '@/stores/download'
import SettingsWidget from '@/components/common/SettingsWidget.vue'
import DownloadProgressWidget from '@/components/common/DownloadProgressWidget.vue'
const route = useRoute()
const authStore = useAuthStore()
const downloadStore = useDownloadStore()
const isLoggedIn = computed(() => authStore.isLoggedIn)
const username = computed(() => authStore.username)
// 在下载管理页面隐藏下载进度小组件
const showDownloadWidget = computed(() => {
return isLoggedIn.value && route.path !== '/downloads'
})
onMounted(async () => {
await authStore.fetchLoginStatus()
// 如果已登录,初始化下载store
if (authStore.isLoggedIn) {
await downloadStore.fetchTasks()
// 启动定期刷新
downloadStore.startRefreshInterval()
}
})
</script>
@@ -72,6 +89,9 @@ onMounted(async () => {
<!-- 设置小组件 - 只在登录时显示 -->
<SettingsWidget v-if="isLoggedIn" />
<!-- 下载进度小组件 - 只在登录时显示在下载管理页面隐藏 -->
<DownloadProgressWidget v-if="showDownloadWidget" />
</div>
</template>