Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export default [
// Web Workers
Worker: 'readonly',
SharedWorker: 'readonly',
// Fetch API
AbortController: 'readonly',
},
},
}
Expand Down
20 changes: 16 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,26 @@
<v-app :style="vAppStyle">
<!-- 自定义背景层 -->
<template v-if="bgEnabled">
<div class="app-background-image" :style="bgImageStyle" />
<div class="app-background-overlay" :style="bgOverlayStyle" />
<div
class="app-background-image"
:style="bgImageStyle"
/>
<div
class="app-background-overlay"
:style="bgOverlayStyle"
/>
</template>

<!-- 正常路由 -->
<router-view v-slot="{ Component, route }">
<transition mode="out-in" name="md3">
<component :is="Component" :key="route.path" />
<transition
mode="out-in"
name="md3"
>
<component
:is="Component"
:key="route.path"
/>
</transition>
</router-view>
<global-message />
Expand Down
4 changes: 2 additions & 2 deletions src/components/AppHeader.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<v-app-bar :elevation="2">
<template v-slot:prepend>
<v-app-bar-nav-icon></v-app-bar-nav-icon>
<template #prepend>
<v-app-bar-nav-icon />
</template>

<v-app-bar-title>作业</v-app-bar-title>
Expand Down
69 changes: 56 additions & 13 deletions src/components/CacheManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,85 @@
<v-card>
<v-card-title class="d-flex align-center">
<span>缓存管理</span>
<v-spacer></v-spacer>
<v-btn :loading="loading" color="error" @click="clearAllCaches">
<v-spacer />
<v-btn
:loading="loading"
color="error"
@click="clearAllCaches"
>
清除所有缓存
</v-btn>
<v-btn class="ml-2" icon @click="refreshCaches">
<v-btn
class="ml-2"
icon
@click="refreshCaches"
>
<v-icon>mdi-refresh</v-icon>
</v-btn>
</v-card-title>

<v-card-text>
<v-alert v-if="!serviceWorkerActive" class="mb-4" type="warning">
<v-alert
v-if="!serviceWorkerActive"
class="mb-4"
type="warning"
>
Service Worker 未激活,缓存管理功能不可用。
</v-alert>

<v-alert v-if="message" :type="messageType" class="mb-4">
<v-alert
v-if="message"
:type="messageType"
class="mb-4"
>
{{ message }}
</v-alert>

<v-expansion-panels v-if="caches.length > 0">
<v-expansion-panel v-for="cache in caches" :key="cache.name">
<v-expansion-panel
v-for="cache in caches"
:key="cache.name"
>
<v-expansion-panel-title>
<div class="d-flex align-center">
<span>{{ formatCacheName(cache.name) }}</span>
<v-chip class="ml-2" size="small">{{ cache.urls.length }} 个文件</v-chip>
<v-chip
class="ml-2"
size="small"
>
{{ cache.urls.length }} 个文件
</v-chip>
</div>
</v-expansion-panel-title>
<v-expansion-panel-text>
<div class="d-flex justify-end mb-2">
<v-btn :loading="loading" color="error" size="small" @click="clearCache(cache.name)">
<v-btn
:loading="loading"
color="error"
size="small"
@click="clearCache(cache.name)"
>
清除此缓存
</v-btn>
</div>
<v-list lines="two">
<v-list-item v-for="(url, index) in cache.urls" :key="index">
<v-list-item
v-for="(url, index) in cache.urls"
:key="index"
>
<v-list-item-title class="text-truncate">
{{ getFileName(url) }}
</v-list-item-title>
<v-list-item-subtitle class="text-truncate">
{{ url }}
</v-list-item-subtitle>
<template v-slot:append>
<v-btn color="error" icon size="small" @click="clearUrl(cache.name, url)">
<template #append>
<v-btn
color="error"
icon
size="small"
@click="clearUrl(cache.name, url)"
>
<v-icon>mdi-delete</v-icon>
</v-btn>
</template>
Expand All @@ -53,9 +90,15 @@
</v-expansion-panel>
</v-expansion-panels>

<v-skeleton-loader v-else-if="loading" type="article"/>
<v-skeleton-loader
v-else-if="loading"
type="article"
/>

<v-alert v-else type="info">
<v-alert
v-else
type="info"
>
没有找到缓存数据。
</v-alert>
</v-card-text>
Expand Down
Loading
Loading