优化多个组件的样式和功能:调整 FileBrowser 和 TransferHistoryView 的高度计算,更新 TorrentCard 和 TorrentItem 的 VChip 颜色,修改 FileList、FileNavigator 和 FileToolbar 中 axios 的类型定义,更新主题中的 secondary 颜色,添加动态按钮到 UserListView,移除冗余的用户添加卡片样式。

This commit is contained in:
jxxghp
2025-04-21 20:01:39 +08:00
parent 06f6ab355e
commit 77ec8c7a81
10 changed files with 43 additions and 57 deletions
+2 -2
View File
@@ -181,8 +181,8 @@ function fileListUpdated(items: FileItem[]) {
// 外层DIV大小控制 // 外层DIV大小控制
const scrollStyle = computed(() => { const scrollStyle = computed(() => {
return appMode return appMode
? 'height: calc(100vh - 10rem - env(safe-area-inset-bottom) - 7rem)' ? 'height: calc(100vh - 10.5rem - env(safe-area-inset-bottom) - 6.5rem)'
: 'height: calc(100vh - 10rem - env(safe-area-inset-bottom)' : 'height: calc(100vh - 10.5rem - env(safe-area-inset-bottom)'
}) })
// 文件列表大小限制 // 文件列表大小限制
+5 -5
View File
@@ -252,7 +252,7 @@ onMounted(() => {
<!-- 体积和详情按钮并排 --> <!-- 体积和详情按钮并排 -->
<div class="d-flex align-center"> <div class="d-flex align-center">
<VChip v-if="torrent?.size" color="secondary" size="x-small" variant="elevated" class="rounded-sm mr-2"> <VChip v-if="torrent?.size" color="primary" size="x-small" variant="elevated" class="rounded-sm mr-2">
{{ formatFileSize(torrent.size) }} {{ formatFileSize(torrent.size) }}
</VChip> </VChip>
<VBtn icon size="small" variant="text" color="primary" @click.stop="openTorrentDetail"> <VBtn icon size="small" variant="text" color="primary" @click.stop="openTorrentDetail">
@@ -263,9 +263,9 @@ onMounted(() => {
</VCard> </VCard>
<!-- 更多来源对话框 --> <!-- 更多来源对话框 -->
<VDialog v-model="showMoreTorrents" max-width="380px" location="center"> <VDialog v-model="showMoreTorrents" max-width="25rem" location="center">
<VCard> <VCard>
<VCardTitle class="py-2 d-flex align-center"> <VCardTitle class="py-3 d-flex align-center">
<span>其他来源</span> <span>其他来源</span>
<VSpacer /> <VSpacer />
<VBtn variant="text" size="small" icon="mdi-close" @click.stop="showMoreTorrents = false"></VBtn> <VBtn variant="text" size="small" icon="mdi-close" @click.stop="showMoreTorrents = false"></VBtn>
@@ -273,7 +273,7 @@ onMounted(() => {
<VDivider /> <VDivider />
<VCardText class="more-sources-content"> <VCardText class="more-sources-content pa-0">
<VList lines="one" density="compact"> <VList lines="one" density="compact">
<VListItem <VListItem
v-for="(item, index) in props.more" v-for="(item, index) in props.more"
@@ -333,7 +333,7 @@ onMounted(() => {
</span> </span>
<span> <span>
<VIcon <VIcon
@click.stop="openTorrentDetail(item)" @click.stop="openTorrentDetail"
size="small" size="small"
color="secondary" color="secondary"
icon="mdi-arrow-top-right" icon="mdi-arrow-top-right"
+1 -1
View File
@@ -203,7 +203,7 @@ onMounted(() => {
</div> </div>
<div class="d-flex align-center"> <div class="d-flex align-center">
<VChip v-if="torrent?.size" color="secondary" size="x-small" variant="elevated" class="rounded-sm mr-2"> <VChip v-if="torrent?.size" color="primary" size="x-small" variant="elevated" class="rounded-sm mr-2">
{{ formatFileSize(torrent.size) }} {{ formatFileSize(torrent.size) }}
</VChip> </VChip>
+2 -2
View File
@@ -20,7 +20,7 @@ const inProps = defineProps({
storage: String, storage: String,
endpoints: Object as PropType<EndPoints>, endpoints: Object as PropType<EndPoints>,
axios: { axios: {
type: Function, type: Object as PropType<any>,
required: true, required: true,
}, },
refreshpending: Boolean, refreshpending: Boolean,
@@ -562,7 +562,7 @@ onMounted(() => {
variant="plain" variant="plain"
placeholder="搜索 ..." placeholder="搜索 ..."
prepend-inner-icon="mdi-filter-outline" prepend-inner-icon="mdi-filter-outline"
class="me-2" class="mx-2"
rounded rounded
/> />
<VSpacer v-if="isFile" /> <VSpacer v-if="isFile" />
+1 -1
View File
@@ -23,7 +23,7 @@ const props = defineProps({
}, },
endpoints: Object, endpoints: Object,
axios: { axios: {
type: Function, type: Object as PropType<any>,
required: true, required: true,
}, },
}) })
+1 -1
View File
@@ -20,7 +20,7 @@ const inProps = defineProps({
}, },
endpoints: Object as PropType<EndPoints>, endpoints: Object as PropType<EndPoints>,
axios: { axios: {
type: Function, type: Object as PropType<any>,
required: true, required: true,
}, },
}) })
+1 -1
View File
@@ -159,7 +159,7 @@ const theme: VuetifyOptions['theme'] = {
dark: true, dark: true,
colors: { colors: {
'primary': '#A370F7', 'primary': '#A370F7',
'secondary': '#B794FF', 'secondary': '#8A8D93',
'on-secondary': '#FFFFFF', 'on-secondary': '#FFFFFF',
'success': '#66BB6A', 'success': '#66BB6A',
'info': '#42A5F5', 'info': '#42A5F5',
+2 -2
View File
@@ -189,8 +189,8 @@ const TransferDict: { [key: string]: string } = {
const tableStyle = computed(() => { const tableStyle = computed(() => {
return appMode return appMode
? 'height: calc(100vh - 14rem - env(safe-area-inset-bottom) - 7.5rem)' ? 'height: calc(100vh - 15rem - env(safe-area-inset-bottom) - 6.5rem)'
: 'height: calc(100vh - 14rem - env(safe-area-inset-bottom)' : 'height: calc(100vh - 15rem - env(safe-area-inset-bottom)'
}) })
// 分页提示 // 分页提示
+2 -2
View File
@@ -88,7 +88,7 @@ onActivated(() => {
// 使用动态按钮钩子 // 使用动态按钮钩子
useDynamicButton({ useDynamicButton({
icon: 'mdi-plus', icon: 'mdi-web-plus',
onClick: () => { onClick: () => {
siteAddDialog.value = true siteAddDialog.value = true
}, },
@@ -123,7 +123,7 @@ useDynamicButton({
<!-- 新增站点按钮 --> <!-- 新增站点按钮 -->
<VFab <VFab
v-if="isRefreshed && !appMode" v-if="isRefreshed && !appMode"
icon="mdi-plus" icon="mdi-web-plus"
location="bottom" location="bottom"
size="x-large" size="x-large"
fixed fixed
+26 -40
View File
@@ -4,6 +4,11 @@ import type { User } from '@/api/types'
import NoDataFound from '@/components/NoDataFound.vue' import NoDataFound from '@/components/NoDataFound.vue'
import UserCard from '@/components/cards/UserCard.vue' import UserCard from '@/components/cards/UserCard.vue'
import UserAddEditDialog from '@/components/dialog/UserAddEditDialog.vue' import UserAddEditDialog from '@/components/dialog/UserAddEditDialog.vue'
import { useDisplay } from 'vuetify'
import { useDynamicButton } from '@/composables/useDynamicButton'
// APP
const display = useDisplay()
const appMode = inject('pwaMode') && display.mdAndDown.value
// 是否刷新过 // 是否刷新过
const isRefreshed = ref(false) const isRefreshed = ref(false)
@@ -51,6 +56,14 @@ onActivated(() => {
loadAllUsers() loadAllUsers()
} }
}) })
// 使用动态按钮钩子
useDynamicButton({
icon: 'mdi-account-plus',
onClick: () => {
openAddUserDialog()
},
})
</script> </script>
<template> <template>
@@ -70,14 +83,6 @@ onActivated(() => {
@remove="loadAllUsers" @remove="loadAllUsers"
@save="loadAllUsers" @save="loadAllUsers"
/> />
<!-- 添加用户卡片 -->
<VCard class="add-user-card" @click="openAddUserDialog">
<div class="add-user-content">
<VIcon icon="mdi-account-plus" size="large" color="primary" />
<span class="add-user-text">添加用户</span>
</div>
</VCard>
</div> </div>
<!-- 无数据提示 --> <!-- 无数据提示 -->
@@ -85,6 +90,19 @@ onActivated(() => {
<NoDataFound error-code="404" error-title="没有用户" error-description="点击添加用户卡片添加用户" /> <NoDataFound error-code="404" error-title="没有用户" error-description="点击添加用户卡片添加用户" />
</div> </div>
<!-- 新增用户按钮 -->
<VFab
v-if="isRefreshed && !appMode"
icon="mdi-account-plus"
location="bottom"
size="x-large"
fixed
app
appear
@click="openAddUserDialog"
:class="{ 'mb-12': appMode }"
/>
<!-- 用户添加弹窗 --> <!-- 用户添加弹窗 -->
<UserAddEditDialog <UserAddEditDialog
v-if="addUserDialog" v-if="addUserDialog"
@@ -97,35 +115,3 @@ onActivated(() => {
/> />
</div> </div>
</template> </template>
<style scoped>
.add-user-card {
display: flex;
align-items: center;
justify-content: center;
border: 1.5px dashed rgba(var(--v-theme-primary), 0.4);
background-color: rgba(var(--v-theme-surface), 1);
block-size: 100%;
cursor: pointer;
min-block-size: 160px;
transition: all 0.3s ease;
}
.add-user-card:hover {
background-color: rgba(var(--v-theme-primary), 0.05);
transform: translateY(-4px);
}
.add-user-content {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.75rem;
}
.add-user-text {
color: rgba(var(--v-theme-primary), 0.8);
font-size: 1.05rem;
font-weight: 500;
}
</style>