notes: 加重命名 — title 旁边 ✏️ 按钮 prompt 改名 (PATCH /api/recordings/:id)
deploy notes / build-and-deploy (push) Successful in 1m53s

This commit is contained in:
Fam Zheng
2026-05-17 23:28:57 +01:00
parent 674011ddf3
commit 34fa47f95f
3 changed files with 48 additions and 2 deletions
+19 -1
View File
@@ -71,7 +71,10 @@
<p v-if="!selected" class="empty"> 从左边挑一条</p>
<template v-else>
<header class="cont-head">
<h2>{{ selected.title }}</h2>
<h2>
{{ selected.title }}
<button class="rename-btn" title="重命名" @click="rename"></button>
</h2>
<div class="head-meta">
<span>{{ statusLabel(selected.status) }}</span>
<span>· {{ fmtSize(selected.size_bytes) }}</span>
@@ -132,6 +135,7 @@ import {
uploadRecording,
deleteRecording,
retryRecording,
renameRecording,
convertFeishu,
audioUrl as audioUrlFn,
getPass,
@@ -332,6 +336,20 @@ async function remove() {
} catch (e) { alert(e.message) }
}
async function rename() {
const cur = selected.value?.title || ''
const t = prompt('改个名字', cur)
if (t == null) return
const trimmed = t.trim()
if (!trimmed || trimmed === cur) return
try {
await renameRecording(selectedId.value, trimmed)
if (selected.value) selected.value.title = trimmed
const inList = list.value.find(r => r.id === selectedId.value)
if (inList) inList.title = trimmed
} catch (e) { alert(e.message) }
}
async function retry() {
try {
await retryRecording(selectedId.value)
+3
View File
@@ -34,6 +34,9 @@ async function jreq(path, opts = {}) {
export function listRecordings() { return jreq('/api/recordings') }
export function getRecording(id) { return jreq('/api/recordings/' + id) }
export function deleteRecording(id) { return jreq('/api/recordings/' + id, { method: 'DELETE' }) }
export function renameRecording(id, title) {
return jreq('/api/recordings/' + id, { method: 'PATCH', body: JSON.stringify({ title }) })
}
export function retryRecording(id) { return jreq('/api/recordings/' + id + '/retry', { method: 'POST' }) }
export function convertFeishu(id) {
return jreq('/api/recordings/' + id + '/feishu', { method: 'POST' })