feat: 功能优化

This commit is contained in:
2026-01-17 19:33:59 +08:00
parent fecd47e25d
commit 091e3d2d05
22 changed files with 1871 additions and 1229 deletions

View File

@@ -23,7 +23,6 @@ const promptStore = usePromptStore()
const {
data,
selectedRowKeys,
expandedRowKeys,
saveTableDataToSession,
loadTableDataFromSession,
processApiResponse,
@@ -36,10 +35,9 @@ const {
batchAnalyzeLoading,
globalLoading,
globalLoadingText,
analyzeVideo,
batchAnalyze,
getVoiceText,
} = useBenchmarkAnalysis(data, expandedRowKeys, saveTableDataToSession)
} = useBenchmarkAnalysis(data, saveTableDataToSession)
// ==================== 表单状态 ====================
const form = ref({
@@ -110,8 +108,8 @@ async function handleExportToExcel() {
return
}
if (selectedRowKeys.value.length > 10) {
message.warning('最多只能导出10条数据请重新选择')
if (selectedRowKeys.value.length > 20) {
message.warning('最多只能导出20条数据请重新选择')
return
}
@@ -189,26 +187,13 @@ async function handleResetForm() {
await clearData()
}
// ==================== 提示词操作函数 ====================
function handleCopyPrompt(row) {
if (!row.prompt) {
message.warning('没有提示词可复制')
return
}
navigator.clipboard.writeText(row.prompt).then(() => {
message.success('提示词已复制到剪贴板')
}).catch(() => {
message.error('复制失败')
})
}
// ==================== 批量提示词操作函数 ====================
function handleCopyBatchPrompt(prompt) {
if (!prompt || !prompt.trim()) {
message.warning('没有提示词可复制')
return
}
navigator.clipboard.writeText(prompt).then(() => {
message.success('提示词已复制到剪贴板')
}).catch(() => {
@@ -216,40 +201,25 @@ function handleCopyBatchPrompt(prompt) {
})
}
// ==================== 创作相关函数 ====================
function handleCreateContent(row) {
promptStore.setPrompt(row.prompt, row)
router.push('/content-style/copywriting')
}
function handleUseBatchPrompt(prompt) {
if (!prompt || !prompt.trim()) {
message.warning('暂无批量生成的提示词')
return
}
promptStore.setPrompt(prompt, { batch: true })
router.push('/content-style/copywriting')
}
// ==================== 保存提示词到服务器 ====================
function handleOpenSavePromptModal(row, batchPrompt = null) {
if (row) {
// 单个视频的提示词
if (!row.prompt || !row.prompt.trim()) {
message.warning('没有提示词可保存')
return
}
savePromptContent.value = row.prompt
} else {
// 批量提示词:使用传入的 batchPromptAI 生成的内容),而不是原始的 mergedText
const promptToSave = batchPrompt || batchPromptMergedText.value
if (!promptToSave || !promptToSave.trim()) {
message.warning('没有提示词可保存')
return
}
savePromptContent.value = promptToSave
function handleOpenSavePromptModal(batchPrompt = null) {
// 批量提示词:使用传入的 batchPromptAI 生成的内容),而不是原始的 mergedText
const promptToSave = batchPrompt || batchPromptMergedText.value
if (!promptToSave || !promptToSave.trim()) {
message.warning('没有提示词可保存')
return
}
savePromptContent.value = promptToSave
savePromptModalVisible.value = true
}
@@ -277,14 +247,9 @@ defineOptions({ name: 'ContentStyleBenchmark' })
<BenchmarkTable
:data="data"
v-model:selectedRowKeys="selectedRowKeys"
v-model:expandedRowKeys="expandedRowKeys"
:loading="loading"
@analyze="analyzeVideo"
@export="handleExportToExcel"
@batch-analyze="handleBatchAnalyze"
@copy="handleCopyPrompt"
@save-to-server="handleOpenSavePromptModal"
@create-content="handleCreateContent"
/>
<!-- 空态显示 -->
@@ -312,7 +277,7 @@ defineOptions({ name: 'ContentStyleBenchmark' })
:merged-text="batchPromptMergedText"
:text-count="batchPromptTextCount"
@copy="handleCopyBatchPrompt"
@save="(prompt) => handleOpenSavePromptModal(null, prompt)"
@save="(prompt) => handleOpenSavePromptModal(prompt)"
@use="handleUseBatchPrompt"
/>