Files
sionrui/frontend/app/web-gold/src/views/content-style/components/ExpandedRowContent.vue

196 lines
5.0 KiB
Vue
Raw Normal View History

2025-11-13 01:06:28 +08:00
<script setup>
import { CopyOutlined, SaveOutlined } from '@ant-design/icons-vue'
import ChatMessageRenderer from '@/components/ChatMessageRenderer.vue'
const props = defineProps({
record: {
type: Object,
required: true,
},
})
const emit = defineEmits(['analyze', 'copy', 'saveToServer', 'createContent'])
function handleCopy() {
emit('copy', props.record)
}
function handleSaveToServer() {
emit('saveToServer', props.record)
}
function handleCreateContent() {
emit('createContent', props.record)
}
</script>
<template>
<div class="expanded-content">
<!-- 未分析的行显示提示 -->
<div v-if="!record.transcriptions && !record.prompt" class="no-analysis-tip">
<a-empty description="该视频尚未分析">
<template #image>
<svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="20" y="30" width="80" height="60" rx="4" stroke="currentColor" stroke-width="2" fill="none" opacity="0.3"/>
<circle cx="40" cy="50" r="8" fill="currentColor" opacity="0.4"/>
<rect x="54" y="47" width="40" height="6" rx="3" fill="currentColor" opacity="0.4"/>
<rect x="54" y="60" width="32" height="6" rx="3" fill="currentColor" opacity="0.4"/>
</svg>
</template>
<a-button type="primary" @click="$emit('analyze', record)" :loading="record._analyzing">
{{ record._analyzing ? '分析中…' : '开始分析' }}
</a-button>
</a-empty>
</div>
<!-- 已分析的行显示内容 -->
<div v-else class="two-col">
<!-- 左侧原配音内容 -->
<section class="col left-col">
<div class="sub-title">原配音</div>
<div class="transcript-box" v-if="record.transcriptions">
<div class="transcript-content">{{ record.transcriptions }}</div>
</div>
<div v-else class="no-transcript">暂无转写文本请先点击"分析"获取</div>
</section>
<!-- 右侧提示词 -->
<section class="col right-col">
<div class="sub-title">提示词</div>
<div class="prompt-display-wrapper">
<ChatMessageRenderer
:content="record.prompt || ''"
:is-streaming="record._analyzing || false"
/>
<div v-if="!record.prompt" class="no-prompt">暂无提示词</div>
</div>
<div class="right-actions">
<a-space>
<a-button
size="small"
type="text"
class="copy-btn"
:title="'复制'"
@click="handleCopy">
<template #icon>
<CopyOutlined />
</template>
</a-button>
<a-button
v-if="record.prompt"
size="small"
type="text"
class="save-server-btn"
:title="'保存'"
@click="handleSaveToServer">
<template #icon>
<SaveOutlined />
</template>
保存
</a-button>
<a-button
type="dashed"
:disabled="!record.prompt || record._analyzing"
@click="handleCreateContent">基于提示词去创作</a-button>
</a-space>
</div>
</section>
</div>
</div>
</template>
<style scoped>
.expanded-content {
2025-12-28 13:49:45 +08:00
padding: var(--space-4);
background: var(--color-slate-50);
border-radius: var(--radius-card);
margin: var(--space-2) 0;
2025-11-13 01:06:28 +08:00
}
.two-col {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
}
.col {
background: var(--color-surface);
border: 1px solid var(--color-border);
border-radius: 6px;
padding: 12px;
}
.left-col .transcript-content {
white-space: pre-wrap;
line-height: 1.6;
color: var(--color-text-secondary);
2025-12-28 13:49:45 +08:00
background: var(--color-surface);
2025-11-13 01:06:28 +08:00
border: 1px dashed var(--color-border);
2025-12-28 13:49:45 +08:00
border-radius: var(--radius-card);
padding: var(--space-2);
2025-11-13 01:06:28 +08:00
}
.sub-title {
2025-12-28 13:49:45 +08:00
font-size: 16px;
2025-11-13 01:06:28 +08:00
font-weight: 600;
color: var(--color-text);
2025-12-28 13:49:45 +08:00
margin-bottom: var(--space-2);
2025-11-13 01:06:28 +08:00
}
.no-transcript {
2025-12-28 13:49:45 +08:00
font-size: 14px;
2025-11-13 01:06:28 +08:00
color: var(--color-text-secondary);
}
.prompt-display-wrapper {
min-height: 200px;
max-height: 500px;
overflow-y: auto;
2025-12-28 13:49:45 +08:00
background: var(--color-surface);
2025-11-13 01:06:28 +08:00
border: 1px dashed var(--color-border);
2025-12-28 13:49:45 +08:00
border-radius: var(--radius-card);
padding: var(--space-3);
margin-bottom: var(--space-2);
2025-11-13 01:06:28 +08:00
}
.no-prompt {
2025-12-28 13:49:45 +08:00
padding: var(--space-4);
2025-11-13 01:06:28 +08:00
text-align: center;
color: var(--color-text-secondary);
}
.right-actions {
2025-12-28 13:49:45 +08:00
margin-top: var(--space-2);
2025-11-13 01:06:28 +08:00
}
.copy-btn {
display: inline-flex;
align-items: center;
2025-12-28 13:49:45 +08:00
gap: var(--space-1);
2025-11-13 01:06:28 +08:00
color: var(--color-primary);
cursor: pointer;
}
.copy-btn:hover {
opacity: 0.8;
}
.no-analysis-tip {
2025-12-28 13:49:45 +08:00
padding: var(--space-8) var(--space-5);
2025-11-13 01:06:28 +08:00
text-align: center;
}
.no-analysis-tip :deep(.ant-empty) {
margin: 0;
}
.no-analysis-tip :deep(.ant-empty-description) {
color: var(--color-text-secondary);
2025-12-28 13:49:45 +08:00
margin-bottom: var(--space-4);
2025-11-13 01:06:28 +08:00
}
</style>