增加下载快捷键和快捷键说明
This commit is contained in:
@@ -4,12 +4,14 @@
|
|||||||
<h1 class="artwork-title">{{ artwork.title }}</h1>
|
<h1 class="artwork-title">{{ artwork.title }}</h1>
|
||||||
<!-- 下载按钮 -->
|
<!-- 下载按钮 -->
|
||||||
<div class="artwork-actions">
|
<div class="artwork-actions">
|
||||||
<button @click="$emit('download')" :disabled="downloading || !artwork" class="btn btn-primary">
|
<button @click="$emit('download')" :disabled="downloading || !artwork" class="btn btn-primary"
|
||||||
|
:title="downloading ? '正在下载中...' : (isDownloaded ? '重新下载作品 (快捷键: ↓)' : '下载作品到本地 (快捷键: ↓)')">
|
||||||
<span v-if="downloading">下载中...</span>
|
<span v-if="downloading">下载中...</span>
|
||||||
<span v-else-if="isDownloaded">重新下载</span>
|
<span v-else-if="isDownloaded">重新下载</span>
|
||||||
<span v-else>下载</span>
|
<span v-else>下载</span>
|
||||||
</button>
|
</button>
|
||||||
<button @click="$emit('bookmark')" class="btn btn-secondary">
|
<button @click="$emit('bookmark')" class="btn btn-secondary"
|
||||||
|
:title="artwork.is_bookmarked ? '取消收藏此作品' : '收藏此作品'">
|
||||||
{{ artwork.is_bookmarked ? '取消收藏' : '收藏' }}
|
{{ artwork.is_bookmarked ? '取消收藏' : '收藏' }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -51,17 +53,18 @@
|
|||||||
<svg viewBox="0 0 24 24" fill="currentColor">
|
<svg viewBox="0 0 24 24" fill="currentColor">
|
||||||
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" />
|
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" />
|
||||||
</svg>
|
</svg>
|
||||||
<span>返回</span>
|
<span>返回 <span class="keyboard-hint">(Esc)</span></span>
|
||||||
</button>
|
</button>
|
||||||
<button @click="$emit('navigatePrevious')" class="nav-btn nav-prev" :disabled="!canNavigatePrevious || loading"
|
<button @click="$emit('navigatePrevious')" class="nav-btn nav-prev"
|
||||||
:title="canNavigatePrevious ? (previousArtwork ? `上一个: ${previousArtwork.title}` : '加载上一页') : '没有上一个作品'">
|
:disabled="!canNavigatePrevious || loading"
|
||||||
|
:title="canNavigatePrevious ? (previousArtwork ? `上一个(快捷键: ←): ${previousArtwork.title}` : '加载上一页') : '没有上一个作品'">
|
||||||
<svg viewBox="0 0 24 24" fill="currentColor">
|
<svg viewBox="0 0 24 24" fill="currentColor">
|
||||||
<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />
|
<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />
|
||||||
</svg>
|
</svg>
|
||||||
<span>{{ loading ? '切换中...' : '上一个' }} </span>
|
<span>{{ loading ? '切换中...' : '上一个' }} </span>
|
||||||
</button>
|
</button>
|
||||||
<button @click="$emit('navigateNext')" class="nav-btn nav-next" :disabled="!canNavigateNext || loading"
|
<button @click="$emit('navigateNext')" class="nav-btn nav-next" :disabled="!canNavigateNext || loading"
|
||||||
:title="canNavigateNext ? (nextArtwork ? `下一个: ${nextArtwork.title}` : '加载下一页') : '没有下一个作品'">
|
:title="canNavigateNext ? (nextArtwork ? `下一个(快捷键: →): ${nextArtwork.title}` : '加载下一页') : '没有下一个作品'">
|
||||||
<span>{{ loading ? '切换中...' : '下一个' }} </span>
|
<span>{{ loading ? '切换中...' : '下一个' }} </span>
|
||||||
<svg viewBox="0 0 24 24" fill="currentColor">
|
<svg viewBox="0 0 24 24" fill="currentColor">
|
||||||
<path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />
|
<path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />
|
||||||
@@ -633,6 +636,14 @@ input:checked + .slider:before {
|
|||||||
transform: translateX(14px);
|
transform: translateX(14px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.keyboard-hint {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: #9ca3af;
|
||||||
|
font-weight: 400;
|
||||||
|
margin-left: 0.25rem;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.artwork-actions {
|
.artwork-actions {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -136,24 +136,24 @@ const nextArtwork = computed(() => {
|
|||||||
// 新增计算属性:是否可以导航到上一个作品
|
// 新增计算属性:是否可以导航到上一个作品
|
||||||
const canNavigateToPrevious = computed(() => {
|
const canNavigateToPrevious = computed(() => {
|
||||||
const result = previousArtwork.value !== null || hasPreviousPages.value;
|
const result = previousArtwork.value !== null || hasPreviousPages.value;
|
||||||
console.log('canNavigateToPrevious:', {
|
// console.log('canNavigateToPrevious:', {
|
||||||
previousArtwork: previousArtwork.value,
|
// previousArtwork: previousArtwork.value,
|
||||||
hasPreviousPages: hasPreviousPages.value,
|
// hasPreviousPages: hasPreviousPages.value,
|
||||||
currentArtworkIndex: currentArtworkIndex.value,
|
// currentArtworkIndex: currentArtworkIndex.value,
|
||||||
result
|
// result
|
||||||
});
|
// });
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 新增计算属性:是否可以导航到下一个作品
|
// 新增计算属性:是否可以导航到下一个作品
|
||||||
const canNavigateToNext = computed(() => {
|
const canNavigateToNext = computed(() => {
|
||||||
const result = nextArtwork.value !== null || hasMorePages.value;
|
const result = nextArtwork.value !== null || hasMorePages.value;
|
||||||
console.log('canNavigateToNext:', {
|
// console.log('canNavigateToNext:', {
|
||||||
nextArtwork: nextArtwork.value,
|
// nextArtwork: nextArtwork.value,
|
||||||
hasMorePages: hasMorePages.value,
|
// hasMorePages: hasMorePages.value,
|
||||||
currentArtworkIndex: currentArtworkIndex.value,
|
// currentArtworkIndex: currentArtworkIndex.value,
|
||||||
result
|
// result
|
||||||
});
|
// });
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -402,21 +402,21 @@ const fetchArtistArtworks = async (page = 1, append = false, prepend = false) =>
|
|||||||
const currentId = parseInt(route.params.id as string);
|
const currentId = parseInt(route.params.id as string);
|
||||||
currentArtworkIndex.value = artistArtworks.value.findIndex(art => art.id === currentId);
|
currentArtworkIndex.value = artistArtworks.value.findIndex(art => art.id === currentId);
|
||||||
|
|
||||||
console.log('fetchArtistArtworks 完成:', {
|
// console.log('fetchArtistArtworks 完成:', {
|
||||||
page,
|
// page,
|
||||||
append,
|
// append,
|
||||||
prepend,
|
// prepend,
|
||||||
artworksCount: response.data.artworks.length,
|
// artworksCount: response.data.artworks.length,
|
||||||
hasMorePages: hasMorePages.value,
|
// hasMorePages: hasMorePages.value,
|
||||||
hasPreviousPages: hasPreviousPages.value,
|
// hasPreviousPages: hasPreviousPages.value,
|
||||||
navigationCurrentPage: navigationCurrentPage.value,
|
// navigationCurrentPage: navigationCurrentPage.value,
|
||||||
currentArtworkIndex: currentArtworkIndex.value,
|
// currentArtworkIndex: currentArtworkIndex.value,
|
||||||
currentId,
|
// currentId,
|
||||||
currentArtworkId: artwork.value?.id,
|
// currentArtworkId: artwork.value?.id,
|
||||||
firstArtworkId: artistArtworks.value[0]?.id,
|
// firstArtworkId: artistArtworks.value[0]?.id,
|
||||||
lastArtworkId: artistArtworks.value[artistArtworks.value.length - 1]?.id,
|
// lastArtworkId: artistArtworks.value[artistArtworks.value.length - 1]?.id,
|
||||||
allArtworkIds: artistArtworks.value.map(art => art.id)
|
// allArtworkIds: artistArtworks.value.map(art => art.id)
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('获取作者作品列表失败:', err);
|
console.error('获取作者作品列表失败:', err);
|
||||||
@@ -714,6 +714,9 @@ const handleKeydown = (event: KeyboardEvent) => {
|
|||||||
} else if (event.key === 'Escape') {
|
} else if (event.key === 'Escape') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
goBackToArtist();
|
goBackToArtist();
|
||||||
|
} else if (event.key === 'ArrowDown') {
|
||||||
|
event.preventDefault();
|
||||||
|
handleDownload();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -768,7 +771,7 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
.artwork-content {
|
.artwork-content {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 460px;
|
grid-template-columns: 1fr 480px;
|
||||||
gap: 3rem;
|
gap: 3rem;
|
||||||
align-items: start;
|
align-items: start;
|
||||||
transition: opacity 0.3s ease;
|
transition: opacity 0.3s ease;
|
||||||
|
|||||||
Reference in New Issue
Block a user