待看url可修改,增加快捷键
This commit is contained in:
+1
-1
@@ -151,7 +151,7 @@ backend/
|
|||||||
- `POST /api/watchlist` - 添加待看项目
|
- `POST /api/watchlist` - 添加待看项目
|
||||||
- 参数: `url` (必填), `title` (可选,不提供则自动生成)
|
- 参数: `url` (必填), `title` (可选,不提供则自动生成)
|
||||||
- `PUT /api/watchlist/:id` - 更新待看项目
|
- `PUT /api/watchlist/:id` - 更新待看项目
|
||||||
- 参数: `title` (项目标题)
|
- 参数: `title` (项目标题), `url` (项目URL)
|
||||||
- `DELETE /api/watchlist/:id` - 删除待看项目
|
- `DELETE /api/watchlist/:id` - 删除待看项目
|
||||||
|
|
||||||
## 🔧 配置说明
|
## 🔧 配置说明
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
<!-- 作品导航 -->
|
<!-- 作品导航 -->
|
||||||
<div v-if="showNavigation" class="artwork-navigation">
|
<div v-if="showNavigation" class="artwork-navigation">
|
||||||
<button @click="$emit('goBack')" class="nav-btn nav-back" title="返回作者页面">
|
<button @click="$emit('goBack')" class="nav-btn nav-back" title="返回作者页面(快捷键: Esc / ↑ )">
|
||||||
<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>
|
||||||
|
|||||||
@@ -111,12 +111,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>URL</label>
|
<label>URL</label>
|
||||||
<input :value="editingItem.url" type="text" class="form-input" readonly disabled>
|
<input v-model="editUrl" type="text" class="form-input" placeholder="请输入URL" @keyup.enter="saveEdit">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-actions">
|
<div class="modal-actions">
|
||||||
<button @click="cancelEdit" class="btn btn-secondary">取消</button>
|
<button @click="cancelEdit" class="btn btn-secondary">取消</button>
|
||||||
<button @click="saveEdit" class="btn btn-primary" :disabled="!editTitle.trim()">保存</button>
|
<button @click="saveEdit" class="btn btn-primary" :disabled="!editTitle.trim() || !editUrl.trim()">保存</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -232,6 +232,7 @@ const isOpen = ref(false);
|
|||||||
const addLoading = ref(false);
|
const addLoading = ref(false);
|
||||||
const editingItem = ref<WatchlistItem | null>(null);
|
const editingItem = ref<WatchlistItem | null>(null);
|
||||||
const editTitle = ref('');
|
const editTitle = ref('');
|
||||||
|
const editUrl = ref('');
|
||||||
const showingAddModal = ref(false);
|
const showingAddModal = ref(false);
|
||||||
const addTitle = ref('');
|
const addTitle = ref('');
|
||||||
const addUrl = ref('');
|
const addUrl = ref('');
|
||||||
@@ -400,18 +401,21 @@ const navigateToItem = (item: WatchlistItem) => {
|
|||||||
const editItem = (item: WatchlistItem) => {
|
const editItem = (item: WatchlistItem) => {
|
||||||
editingItem.value = item;
|
editingItem.value = item;
|
||||||
editTitle.value = item.title;
|
editTitle.value = item.title;
|
||||||
|
editUrl.value = item.url;
|
||||||
};
|
};
|
||||||
|
|
||||||
const cancelEdit = () => {
|
const cancelEdit = () => {
|
||||||
editingItem.value = null;
|
editingItem.value = null;
|
||||||
editTitle.value = '';
|
editTitle.value = '';
|
||||||
|
editUrl.value = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveEdit = async () => {
|
const saveEdit = async () => {
|
||||||
if (!editingItem.value || !editTitle.value.trim()) return;
|
if (!editingItem.value || !editTitle.value.trim() || !editUrl.value.trim()) return;
|
||||||
|
|
||||||
const success = await watchlistStore.updateItem(editingItem.value.id, {
|
const success = await watchlistStore.updateItem(editingItem.value.id, {
|
||||||
title: editTitle.value.trim()
|
title: editTitle.value.trim(),
|
||||||
|
url: editUrl.value.trim()
|
||||||
});
|
});
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export interface AddWatchlistItemParams {
|
|||||||
// 更新项目的参数接口
|
// 更新项目的参数接口
|
||||||
export interface UpdateWatchlistItemParams {
|
export interface UpdateWatchlistItemParams {
|
||||||
title?: string;
|
title?: string;
|
||||||
|
url?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
class WatchlistService {
|
class WatchlistService {
|
||||||
|
|||||||
@@ -711,7 +711,7 @@ const handleKeydown = (event: KeyboardEvent) => {
|
|||||||
} else if (event.key === 'ArrowRight' && canNavigateToNext.value) {
|
} else if (event.key === 'ArrowRight' && canNavigateToNext.value) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
navigateToNext();
|
navigateToNext();
|
||||||
} else if (event.key === 'Escape') {
|
} else if (event.key === 'Escape' || event.key === 'ArrowUp') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
goBackToArtist();
|
goBackToArtist();
|
||||||
} else if (event.key === 'ArrowDown') {
|
} else if (event.key === 'ArrowDown') {
|
||||||
|
|||||||
Reference in New Issue
Block a user