feat: 新增深色模式支持;修复已知问题;样式优化
This commit is contained in:
616
web/src/components/common/AIConfigDialog.vue
Normal file
616
web/src/components/common/AIConfigDialog.vue
Normal file
@@ -0,0 +1,616 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="$t('aiConfig.title')"
|
||||
width="900px"
|
||||
:close-on-click-modal="false"
|
||||
destroy-on-close
|
||||
class="ai-config-dialog"
|
||||
>
|
||||
<!-- Dialog Header Actions -->
|
||||
<template #header>
|
||||
<div class="dialog-header">
|
||||
<span class="dialog-title">{{ $t('aiConfig.title') }}</span>
|
||||
<el-button type="primary" size="small" @click="showCreateDialog">
|
||||
<el-icon><Plus /></el-icon>
|
||||
<span>{{ $t('aiConfig.addConfig') }}</span>
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Tabs -->
|
||||
<el-tabs v-model="activeTab" @tab-change="handleTabChange" class="config-tabs">
|
||||
<el-tab-pane :label="$t('aiConfig.tabs.text')" name="text">
|
||||
<ConfigList
|
||||
:configs="configs"
|
||||
:loading="loading"
|
||||
:show-test-button="true"
|
||||
@edit="handleEdit"
|
||||
@delete="handleDelete"
|
||||
@toggle-active="handleToggleActive"
|
||||
@test="handleTest"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane :label="$t('aiConfig.tabs.image')" name="image">
|
||||
<ConfigList
|
||||
:configs="configs"
|
||||
:loading="loading"
|
||||
:show-test-button="false"
|
||||
@edit="handleEdit"
|
||||
@delete="handleDelete"
|
||||
@toggle-active="handleToggleActive"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane :label="$t('aiConfig.tabs.video')" name="video">
|
||||
<ConfigList
|
||||
:configs="configs"
|
||||
:loading="loading"
|
||||
:show-test-button="false"
|
||||
@edit="handleEdit"
|
||||
@delete="handleDelete"
|
||||
@toggle-active="handleToggleActive"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<!-- Edit/Create Sub-Dialog -->
|
||||
<el-dialog
|
||||
v-model="editDialogVisible"
|
||||
:title="isEdit ? $t('aiConfig.editConfig') : $t('aiConfig.addConfig')"
|
||||
width="600px"
|
||||
:close-on-click-modal="false"
|
||||
append-to-body
|
||||
>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item :label="$t('aiConfig.form.name')" prop="name">
|
||||
<el-input v-model="form.name" :placeholder="$t('aiConfig.form.namePlaceholder')" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('aiConfig.form.provider')" prop="provider">
|
||||
<el-select
|
||||
v-model="form.provider"
|
||||
:placeholder="$t('aiConfig.form.providerPlaceholder')"
|
||||
@change="handleProviderChange"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="provider in availableProviders"
|
||||
:key="provider.id"
|
||||
:label="provider.name"
|
||||
:value="provider.id"
|
||||
:disabled="provider.disabled"
|
||||
/>
|
||||
</el-select>
|
||||
<div class="form-tip">{{ $t('aiConfig.form.providerTip') }}</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('aiConfig.form.priority')" prop="priority">
|
||||
<el-input-number
|
||||
v-model="form.priority"
|
||||
:min="0"
|
||||
:max="100"
|
||||
:step="1"
|
||||
style="width: 100%"
|
||||
/>
|
||||
<div class="form-tip">{{ $t('aiConfig.form.priorityTip') }}</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('aiConfig.form.model')" prop="model">
|
||||
<el-select
|
||||
v-model="form.model"
|
||||
:placeholder="$t('aiConfig.form.modelPlaceholder')"
|
||||
multiple
|
||||
filterable
|
||||
allow-create
|
||||
default-first-option
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="model in availableModels"
|
||||
:key="model"
|
||||
:label="model"
|
||||
:value="model"
|
||||
/>
|
||||
</el-select>
|
||||
<div class="form-tip">{{ $t('aiConfig.form.modelTip') }}</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('aiConfig.form.baseUrl')" prop="base_url">
|
||||
<el-input v-model="form.base_url" :placeholder="$t('aiConfig.form.baseUrlPlaceholder')" />
|
||||
<div class="form-tip">
|
||||
{{ $t('aiConfig.form.baseUrlTip') }}
|
||||
<br>
|
||||
{{ $t('aiConfig.form.fullEndpoint') }}: {{ fullEndpointExample }}
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('aiConfig.form.apiKey')" prop="api_key">
|
||||
<el-input
|
||||
v-model="form.api_key"
|
||||
type="password"
|
||||
show-password
|
||||
:placeholder="$t('aiConfig.form.apiKeyPlaceholder')"
|
||||
/>
|
||||
<div class="form-tip">{{ $t('aiConfig.form.apiKeyTip') }}</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="isEdit" :label="$t('aiConfig.form.isActive')">
|
||||
<el-switch v-model="form.is_active" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="editDialogVisible = false">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button v-if="form.service_type === 'text'" @click="testConnection" :loading="testing">{{ $t('aiConfig.actions.test') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit" :loading="submitting">
|
||||
{{ isEdit ? $t('common.save') : $t('common.create') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { aiAPI } from '@/api/ai'
|
||||
import type { AIServiceConfig, AIServiceType, CreateAIConfigRequest, UpdateAIConfigRequest } from '@/types/ai'
|
||||
import ConfigList from '@/views/settings/components/ConfigList.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: boolean]
|
||||
}>()
|
||||
|
||||
const visible = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (val) => emit('update:modelValue', val)
|
||||
})
|
||||
|
||||
const activeTab = ref<AIServiceType>('text')
|
||||
const loading = ref(false)
|
||||
const configs = ref<AIServiceConfig[]>([])
|
||||
const editDialogVisible = ref(false)
|
||||
const isEdit = ref(false)
|
||||
const editingId = ref<number>()
|
||||
const formRef = ref<FormInstance>()
|
||||
const submitting = ref(false)
|
||||
const testing = ref(false)
|
||||
|
||||
const form = reactive<CreateAIConfigRequest & { is_active?: boolean, provider?: string }>({
|
||||
service_type: 'text',
|
||||
provider: '',
|
||||
name: '',
|
||||
base_url: '',
|
||||
api_key: '',
|
||||
model: [],
|
||||
priority: 0,
|
||||
is_active: true
|
||||
})
|
||||
|
||||
// Provider configs
|
||||
interface ProviderConfig {
|
||||
id: string
|
||||
name: string
|
||||
models: string[]
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
const providerConfigs: Record<AIServiceType, ProviderConfig[]> = {
|
||||
text: [
|
||||
{ id: 'openai', name: 'OpenAI', models: ['gpt-5.2', 'gemini-3-pro-preview'] },
|
||||
{
|
||||
id: 'chatfire',
|
||||
name: 'Chatfire',
|
||||
models: [
|
||||
'gpt-4o',
|
||||
'claude-sonnet-4-5-20250929',
|
||||
'doubao-seed-1-8-251228',
|
||||
'kimi-k2-thinking',
|
||||
'gemini-3-pro',
|
||||
'gemini-2.5-pro',
|
||||
'gemini-3-pro-preview'
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'gemini',
|
||||
name: 'Google Gemini',
|
||||
models: ['gemini-2.5-pro', 'gemini-3-pro-preview']
|
||||
}
|
||||
],
|
||||
image: [
|
||||
{
|
||||
id: 'volcengine',
|
||||
name: '火山引擎',
|
||||
models: ['doubao-seedream-4-5-251128', 'doubao-seedream-4-0-250828']
|
||||
},
|
||||
{
|
||||
id: 'chatfire',
|
||||
name: 'Chatfire',
|
||||
models: ['doubao-seedream-4-5-251128', 'nano-banana-pro']
|
||||
},
|
||||
{
|
||||
id: 'gemini',
|
||||
name: 'Google Gemini',
|
||||
models: ['gemini-3-pro-image-preview']
|
||||
},
|
||||
{ id: 'openai', name: 'OpenAI', models: ['dall-e-3', 'dall-e-2'] }
|
||||
],
|
||||
video: [
|
||||
{
|
||||
id: 'volces',
|
||||
name: '火山引擎',
|
||||
models: [
|
||||
'doubao-seedance-1-5-pro-251215',
|
||||
'doubao-seedance-1-0-lite-i2v-250428',
|
||||
'doubao-seedance-1-0-lite-t2v-250428',
|
||||
'doubao-seedance-1-0-pro-250528',
|
||||
'doubao-seedance-1-0-pro-fast-251015'
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'chatfire',
|
||||
name: 'Chatfire',
|
||||
models: [
|
||||
'doubao-seedance-1-5-pro-251215',
|
||||
'doubao-seedance-1-0-lite-i2v-250428',
|
||||
'doubao-seedance-1-0-lite-t2v-250428',
|
||||
'doubao-seedance-1-0-pro-250528',
|
||||
'doubao-seedance-1-0-pro-fast-251015',
|
||||
'sora',
|
||||
'sora-pro'
|
||||
]
|
||||
},
|
||||
{ id: 'openai', name: 'OpenAI', models: ['sora-2', 'sora-2-pro'] }
|
||||
]
|
||||
}
|
||||
|
||||
const availableProviders = computed(() => {
|
||||
return providerConfigs[form.service_type] || []
|
||||
})
|
||||
|
||||
const availableModels = computed(() => {
|
||||
if (!form.provider) return []
|
||||
const provider = availableProviders.value.find(p => p.id === form.provider)
|
||||
return provider?.models || []
|
||||
})
|
||||
|
||||
const fullEndpointExample = computed(() => {
|
||||
const baseUrl = form.base_url || 'https://api.example.com'
|
||||
const provider = form.provider
|
||||
const serviceType = form.service_type
|
||||
|
||||
let endpoint = ''
|
||||
|
||||
if (serviceType === 'text') {
|
||||
if (provider === 'gemini' || provider === 'google') {
|
||||
endpoint = '/v1beta/models/{model}:generateContent'
|
||||
} else {
|
||||
endpoint = '/chat/completions'
|
||||
}
|
||||
} else if (serviceType === 'image') {
|
||||
if (provider === 'gemini' || provider === 'google') {
|
||||
endpoint = '/v1beta/models/{model}:generateContent'
|
||||
} else {
|
||||
endpoint = '/images/generations'
|
||||
}
|
||||
} else if (serviceType === 'video') {
|
||||
if (provider === 'chatfire') {
|
||||
endpoint = '/video/generations'
|
||||
} else if (provider === 'doubao' || provider === 'volcengine' || provider === 'volces') {
|
||||
endpoint = '/contents/generations/tasks'
|
||||
} else if (provider === 'openai') {
|
||||
endpoint = '/videos'
|
||||
} else {
|
||||
endpoint = '/video/generations'
|
||||
}
|
||||
}
|
||||
|
||||
return baseUrl + endpoint
|
||||
})
|
||||
|
||||
const rules: FormRules = {
|
||||
name: [{ required: true, message: '请输入配置名称', trigger: 'blur' }],
|
||||
provider: [{ required: true, message: '请选择厂商', trigger: 'change' }],
|
||||
base_url: [
|
||||
{ required: true, message: '请输入 Base URL', trigger: 'blur' },
|
||||
{ type: 'url', message: '请输入正确的 URL 格式', trigger: 'blur' }
|
||||
],
|
||||
api_key: [{ required: true, message: '请输入 API Key', trigger: 'blur' }],
|
||||
model: [{
|
||||
required: true,
|
||||
message: '请至少选择一个模型',
|
||||
trigger: 'change',
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
if (Array.isArray(value) && value.length > 0) {
|
||||
callback()
|
||||
} else if (typeof value === 'string' && value.length > 0) {
|
||||
callback()
|
||||
} else {
|
||||
callback(new Error('请至少选择一个模型'))
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
const loadConfigs = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
configs.value = await aiAPI.list(activeTab.value)
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error.message || '加载失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const generateConfigName = (provider: string, serviceType: AIServiceType): string => {
|
||||
const providerNames: Record<string, string> = {
|
||||
'chatfire': 'ChatFire',
|
||||
'openai': 'OpenAI',
|
||||
'gemini': 'Gemini',
|
||||
'google': 'Google'
|
||||
}
|
||||
|
||||
const serviceNames: Record<AIServiceType, string> = {
|
||||
'text': '文本',
|
||||
'image': '图片',
|
||||
'video': '视频'
|
||||
}
|
||||
|
||||
const randomNum = Math.floor(Math.random() * 10000).toString().padStart(4, '0')
|
||||
const providerName = providerNames[provider] || provider
|
||||
const serviceName = serviceNames[serviceType] || serviceType
|
||||
|
||||
return `${providerName}-${serviceName}-${randomNum}`
|
||||
}
|
||||
|
||||
const showCreateDialog = () => {
|
||||
isEdit.value = false
|
||||
editingId.value = undefined
|
||||
resetForm()
|
||||
form.service_type = activeTab.value
|
||||
form.provider = 'chatfire'
|
||||
form.base_url = 'https://api.chatfire.site/v1'
|
||||
form.name = generateConfigName('chatfire', activeTab.value)
|
||||
editDialogVisible.value = true
|
||||
}
|
||||
|
||||
const handleEdit = (config: AIServiceConfig) => {
|
||||
isEdit.value = true
|
||||
editingId.value = config.id
|
||||
|
||||
Object.assign(form, {
|
||||
service_type: config.service_type,
|
||||
provider: config.provider || 'chatfire',
|
||||
name: config.name,
|
||||
base_url: config.base_url,
|
||||
api_key: config.api_key,
|
||||
model: Array.isArray(config.model) ? config.model : [config.model],
|
||||
priority: config.priority || 0,
|
||||
is_active: config.is_active
|
||||
})
|
||||
editDialogVisible.value = true
|
||||
}
|
||||
|
||||
const handleDelete = async (config: AIServiceConfig) => {
|
||||
try {
|
||||
await ElMessageBox.confirm('确定要删除该配置吗?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
|
||||
await aiAPI.delete(config.id)
|
||||
ElMessage.success('删除成功')
|
||||
loadConfigs()
|
||||
} catch (error: any) {
|
||||
if (error !== 'cancel') {
|
||||
ElMessage.error(error.message || '删除失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const handleToggleActive = async (config: AIServiceConfig) => {
|
||||
try {
|
||||
const newActiveState = !config.is_active
|
||||
await aiAPI.update(config.id, { is_active: newActiveState })
|
||||
ElMessage.success(newActiveState ? '已启用配置' : '已禁用配置')
|
||||
await loadConfigs()
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error.message || '操作失败')
|
||||
}
|
||||
}
|
||||
|
||||
const testConnection = async () => {
|
||||
if (!formRef.value) return
|
||||
|
||||
const valid = await formRef.value.validate().catch(() => false)
|
||||
if (!valid) return
|
||||
|
||||
testing.value = true
|
||||
try {
|
||||
await aiAPI.testConnection({
|
||||
base_url: form.base_url,
|
||||
api_key: form.api_key,
|
||||
model: form.model,
|
||||
provider: form.provider
|
||||
})
|
||||
ElMessage.success('连接测试成功!')
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error.message || '连接测试失败')
|
||||
} finally {
|
||||
testing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleTest = async (config: AIServiceConfig) => {
|
||||
testing.value = true
|
||||
try {
|
||||
await aiAPI.testConnection({
|
||||
base_url: config.base_url,
|
||||
api_key: config.api_key,
|
||||
model: config.model,
|
||||
provider: config.provider
|
||||
})
|
||||
ElMessage.success('连接测试成功!')
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error.message || '连接测试失败')
|
||||
} finally {
|
||||
testing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if (!formRef.value) return
|
||||
|
||||
await formRef.value.validate(async (valid) => {
|
||||
if (!valid) return
|
||||
|
||||
submitting.value = true
|
||||
try {
|
||||
if (isEdit.value && editingId.value) {
|
||||
const updateData: UpdateAIConfigRequest = {
|
||||
name: form.name,
|
||||
provider: form.provider,
|
||||
base_url: form.base_url,
|
||||
api_key: form.api_key,
|
||||
model: form.model,
|
||||
priority: form.priority,
|
||||
is_active: form.is_active
|
||||
}
|
||||
await aiAPI.update(editingId.value, updateData)
|
||||
ElMessage.success('更新成功')
|
||||
} else {
|
||||
await aiAPI.create(form)
|
||||
ElMessage.success('创建成功')
|
||||
}
|
||||
|
||||
editDialogVisible.value = false
|
||||
loadConfigs()
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error.message || '操作失败')
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handleTabChange = (tabName: string | number) => {
|
||||
activeTab.value = tabName as AIServiceType
|
||||
loadConfigs()
|
||||
}
|
||||
|
||||
const handleProviderChange = () => {
|
||||
form.model = []
|
||||
|
||||
if (form.provider === 'gemini' || form.provider === 'google') {
|
||||
form.base_url = 'https://api.chatfire.site'
|
||||
} else {
|
||||
form.base_url = 'https://api.chatfire.site/v1'
|
||||
}
|
||||
|
||||
if (!isEdit.value) {
|
||||
form.name = generateConfigName(form.provider, form.service_type)
|
||||
}
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
const serviceType = form.service_type || 'text'
|
||||
Object.assign(form, {
|
||||
service_type: serviceType,
|
||||
provider: '',
|
||||
name: '',
|
||||
base_url: '',
|
||||
api_key: '',
|
||||
model: [],
|
||||
priority: 0,
|
||||
is_active: true
|
||||
})
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
// Load configs when dialog opens
|
||||
watch(visible, (val) => {
|
||||
if (val) {
|
||||
loadConfigs()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ai-config-dialog :deep(.el-dialog__header) {
|
||||
padding: 16px 20px;
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.dialog-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
padding-right: 32px;
|
||||
}
|
||||
|
||||
.dialog-title {
|
||||
font-size: 1.125rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.ai-config-dialog :deep(.el-dialog__body) {
|
||||
padding: 20px;
|
||||
max-height: 60vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.config-tabs {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.form-tip {
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-muted);
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
|
||||
/* Dark mode */
|
||||
.dark .ai-config-dialog :deep(.el-dialog) {
|
||||
background: var(--bg-card);
|
||||
}
|
||||
|
||||
.dark .ai-config-dialog :deep(.el-dialog__header) {
|
||||
background: var(--bg-card);
|
||||
}
|
||||
|
||||
.dark :deep(.el-form-item__label) {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.dark :deep(.el-input__wrapper) {
|
||||
background: var(--bg-secondary);
|
||||
box-shadow: 0 0 0 1px var(--border-primary) inset;
|
||||
}
|
||||
|
||||
.dark :deep(.el-input__inner) {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.dark :deep(.el-select .el-input__wrapper) {
|
||||
background: var(--bg-secondary);
|
||||
}
|
||||
</style>
|
||||
103
web/src/components/common/ActionButton.vue
Normal file
103
web/src/components/common/ActionButton.vue
Normal file
@@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<!-- Minimalist action button with icon and optional tooltip -->
|
||||
<!-- 简约操作按钮,带图标和可选提示 -->
|
||||
<el-tooltip
|
||||
v-if="tooltip"
|
||||
:content="tooltip"
|
||||
placement="top"
|
||||
:show-after="500"
|
||||
>
|
||||
<button
|
||||
:class="['action-button', variant, { disabled }]"
|
||||
:disabled="disabled"
|
||||
@click="$emit('click')"
|
||||
>
|
||||
<el-icon :size="size">
|
||||
<component :is="icon" />
|
||||
</el-icon>
|
||||
</button>
|
||||
</el-tooltip>
|
||||
<button
|
||||
v-else
|
||||
:class="['action-button', variant, { disabled }]"
|
||||
:disabled="disabled"
|
||||
@click="$emit('click')"
|
||||
>
|
||||
<el-icon :size="size">
|
||||
<component :is="icon" />
|
||||
</el-icon>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Component } from 'vue'
|
||||
|
||||
/**
|
||||
* ActionButton - Minimalist icon button for actions
|
||||
* 操作按钮 - 简约图标按钮用于各种操作
|
||||
*/
|
||||
withDefaults(defineProps<{
|
||||
icon: Component
|
||||
tooltip?: string
|
||||
variant?: 'default' | 'primary' | 'danger'
|
||||
size?: number
|
||||
disabled?: boolean
|
||||
}>(), {
|
||||
variant: 'default',
|
||||
size: 16,
|
||||
disabled: false
|
||||
})
|
||||
|
||||
defineEmits<{
|
||||
click: []
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.action-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0.5rem;
|
||||
border: none;
|
||||
border-radius: var(--radius-sm);
|
||||
background: transparent;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
transition: all var(--transition-fast);
|
||||
}
|
||||
|
||||
.action-button:hover {
|
||||
background: var(--bg-card-hover);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.action-button:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
|
||||
.action-button.primary:hover {
|
||||
background: var(--accent-light);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.action-button.danger:hover {
|
||||
background: #fef2f2;
|
||||
color: #ef4444;
|
||||
}
|
||||
|
||||
.dark .action-button.danger:hover {
|
||||
background: rgba(239, 68, 68, 0.15);
|
||||
}
|
||||
|
||||
.action-button.disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.action-button.disabled:hover {
|
||||
background: transparent;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
</style>
|
||||
125
web/src/components/common/AppLayout.vue
Normal file
125
web/src/components/common/AppLayout.vue
Normal file
@@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<div class="app-layout">
|
||||
<!-- Global Header -->
|
||||
<header class="app-header">
|
||||
<div class="header-content">
|
||||
<div class="header-left">
|
||||
<router-link to="/" class="logo">
|
||||
<span class="logo-text">🎬 AI Drama</span>
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<LanguageSwitcher />
|
||||
<ThemeToggle />
|
||||
<el-button @click="showAIConfig = true" class="header-btn">
|
||||
<el-icon><Setting /></el-icon>
|
||||
<span class="btn-text">{{ $t('drama.aiConfig') }}</span>
|
||||
</el-button>
|
||||
<!-- <el-button :icon="Setting" circle @click="showAIConfig = true" :title="$t('aiConfig.title')" /> -->
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="app-main">
|
||||
<slot />
|
||||
</main>
|
||||
|
||||
<!-- AI Config Dialog -->
|
||||
<AIConfigDialog v-model="showAIConfig" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { Setting } from '@element-plus/icons-vue'
|
||||
import ThemeToggle from './ThemeToggle.vue'
|
||||
import AIConfigDialog from './AIConfigDialog.vue'
|
||||
import LanguageSwitcher from '@/components/LanguageSwitcher.vue'
|
||||
|
||||
const showAIConfig = ref(false)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.app-layout {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.app-header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
background: var(--bg-card);
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
backdrop-filter: blur(8px);
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 var(--space-4);
|
||||
height: 56px;
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.header-btn {
|
||||
border-radius: var(--radius-lg);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.header-btn.primary {
|
||||
background: linear-gradient(135deg, var(--accent) 0%, #0284c7 100%);
|
||||
border: none;
|
||||
box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
|
||||
}
|
||||
|
||||
.header-btn.primary:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 6px 20px rgba(14, 165, 233, 0.45);
|
||||
}
|
||||
.header-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
text-decoration: none;
|
||||
color: var(--text-primary);
|
||||
font-weight: 700;
|
||||
font-size: 1.125rem;
|
||||
transition: opacity var(--transition-fast);
|
||||
}
|
||||
|
||||
.logo:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.logo-text {
|
||||
background: linear-gradient(135deg, var(--accent) 0%, #06b6d4 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.app-main {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* Dark mode adjustments */
|
||||
.dark .app-header {
|
||||
background: rgba(26, 33, 41, 0.95);
|
||||
}
|
||||
</style>
|
||||
210
web/src/components/common/BaseCard.vue
Normal file
210
web/src/components/common/BaseCard.vue
Normal file
@@ -0,0 +1,210 @@
|
||||
<template>
|
||||
<!-- Base Card Component - Reusable card with modern design -->
|
||||
<!-- 基础卡片组件 - 现代设计的可复用卡片 -->
|
||||
<div
|
||||
:class="[
|
||||
'base-card',
|
||||
`variant-${variant}`,
|
||||
{ 'is-hoverable': hoverable, 'is-clickable': clickable }
|
||||
]"
|
||||
@click="clickable ? $emit('click') : undefined"
|
||||
:tabindex="clickable ? 0 : undefined"
|
||||
@keydown.enter="clickable ? $emit('click') : undefined"
|
||||
>
|
||||
<!-- Card Header / 卡片头部 -->
|
||||
<div v-if="$slots.header || title" class="card-header">
|
||||
<slot name="header">
|
||||
<div class="header-content">
|
||||
<div v-if="icon" class="header-icon">
|
||||
<el-icon :size="iconSize" :color="iconColor">
|
||||
<component :is="icon" />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="header-text">
|
||||
<h3 class="card-title">{{ title }}</h3>
|
||||
<p v-if="subtitle" class="card-subtitle">{{ subtitle }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="$slots.headerActions" class="header-actions">
|
||||
<slot name="headerActions"></slot>
|
||||
</div>
|
||||
</slot>
|
||||
</div>
|
||||
|
||||
<!-- Card Body / 卡片内容 -->
|
||||
<div :class="['card-body', { 'no-padding': noPadding }]">
|
||||
<slot></slot>
|
||||
</div>
|
||||
|
||||
<!-- Card Footer / 卡片底部 -->
|
||||
<div v-if="$slots.footer" class="card-footer">
|
||||
<slot name="footer"></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Component } from 'vue'
|
||||
|
||||
/**
|
||||
* BaseCard - Reusable card component with modern design
|
||||
* 基础卡片组件 - 现代设计的可复用卡片
|
||||
*/
|
||||
withDefaults(defineProps<{
|
||||
title?: string
|
||||
subtitle?: string
|
||||
icon?: Component
|
||||
iconSize?: number
|
||||
iconColor?: string
|
||||
variant?: 'default' | 'elevated' | 'outlined' | 'ghost'
|
||||
hoverable?: boolean
|
||||
clickable?: boolean
|
||||
noPadding?: boolean
|
||||
}>(), {
|
||||
variant: 'default',
|
||||
iconSize: 20,
|
||||
hoverable: false,
|
||||
clickable: false,
|
||||
noPadding: false
|
||||
})
|
||||
|
||||
defineEmits<{
|
||||
click: []
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* Card Container / 卡片容器 */
|
||||
.base-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--bg-card);
|
||||
border-radius: var(--radius-xl);
|
||||
transition: all var(--transition-normal);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Variants / 变体样式 */
|
||||
.variant-default {
|
||||
border: 1px solid var(--border-primary);
|
||||
box-shadow: var(--shadow-card);
|
||||
}
|
||||
|
||||
.variant-elevated {
|
||||
border: none;
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
.variant-outlined {
|
||||
border: 1px solid var(--border-primary);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.variant-ghost {
|
||||
background: transparent;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* Hover & Clickable States / 悬停和可点击状态 */
|
||||
.is-hoverable:hover {
|
||||
box-shadow: var(--shadow-card-hover);
|
||||
border-color: var(--border-secondary);
|
||||
}
|
||||
|
||||
.is-clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.is-clickable:hover {
|
||||
border-color: var(--accent);
|
||||
box-shadow: var(--shadow-glow);
|
||||
}
|
||||
|
||||
.is-clickable:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.is-clickable:active {
|
||||
transform: scale(0.995);
|
||||
}
|
||||
|
||||
/* Card Header / 卡片头部 */
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: var(--space-4) var(--space-5);
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-3);
|
||||
}
|
||||
|
||||
.header-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
background: var(--accent-light);
|
||||
border-radius: var(--radius-lg);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.header-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.125rem;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
margin: 0;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
.card-subtitle {
|
||||
margin: 0;
|
||||
font-size: 0.8125rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
/* Card Body / 卡片内容 */
|
||||
.card-body {
|
||||
padding: var(--space-5);
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.card-body.no-padding {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Card Footer / 卡片底部 */
|
||||
.card-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: var(--space-3);
|
||||
padding: var(--space-4) var(--space-5);
|
||||
border-top: 1px solid var(--border-primary);
|
||||
background: var(--bg-secondary);
|
||||
}
|
||||
|
||||
/* Dark mode adjustments / 深色模式调整 */
|
||||
.dark .card-footer {
|
||||
background: var(--bg-secondary);
|
||||
}
|
||||
</style>
|
||||
235
web/src/components/common/CreateDramaDialog.vue
Normal file
235
web/src/components/common/CreateDramaDialog.vue
Normal file
@@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<!-- Create Drama Dialog / 创建短剧弹窗 -->
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="$t('drama.createNew')"
|
||||
width="520px"
|
||||
:close-on-click-modal="false"
|
||||
class="create-dialog"
|
||||
@closed="handleClosed"
|
||||
>
|
||||
<div class="dialog-desc">{{ $t('drama.createDesc') }}</div>
|
||||
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="top"
|
||||
class="create-form"
|
||||
@submit.prevent="handleSubmit"
|
||||
>
|
||||
<el-form-item :label="$t('drama.projectName')" prop="title" required>
|
||||
<el-input
|
||||
v-model="form.title"
|
||||
:placeholder="$t('drama.projectNamePlaceholder')"
|
||||
size="large"
|
||||
maxlength="100"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('drama.projectDesc')" prop="description">
|
||||
<el-input
|
||||
v-model="form.description"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
:placeholder="$t('drama.projectDescPlaceholder')"
|
||||
maxlength="500"
|
||||
show-word-limit
|
||||
resize="none"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button size="large" @click="handleClose">
|
||||
{{ $t('common.cancel') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="large"
|
||||
:loading="loading"
|
||||
@click="handleSubmit"
|
||||
>
|
||||
<el-icon v-if="!loading"><Plus /></el-icon>
|
||||
{{ $t('drama.createNew') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { dramaAPI } from '@/api/drama'
|
||||
import type { CreateDramaRequest } from '@/types/drama'
|
||||
|
||||
/**
|
||||
* CreateDramaDialog - Reusable dialog for creating new drama projects
|
||||
* 创建短剧弹窗 - 可复用的创建短剧项目弹窗
|
||||
*/
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: boolean]
|
||||
'created': [id: string]
|
||||
}>()
|
||||
|
||||
const router = useRouter()
|
||||
const formRef = ref<FormInstance>()
|
||||
const loading = ref(false)
|
||||
|
||||
// v-model binding / 双向绑定
|
||||
const visible = ref(props.modelValue)
|
||||
watch(() => props.modelValue, (val) => {
|
||||
visible.value = val
|
||||
})
|
||||
watch(visible, (val) => {
|
||||
emit('update:modelValue', val)
|
||||
})
|
||||
|
||||
// Form data / 表单数据
|
||||
const form = reactive<CreateDramaRequest>({
|
||||
title: '',
|
||||
description: ''
|
||||
})
|
||||
|
||||
// Validation rules / 验证规则
|
||||
const rules: FormRules = {
|
||||
title: [
|
||||
{ required: true, message: '请输入项目标题', trigger: 'blur' },
|
||||
{ min: 1, max: 100, message: '标题长度在 1 到 100 个字符', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
|
||||
// Reset form when dialog closes / 关闭时重置表单
|
||||
const handleClosed = () => {
|
||||
form.title = ''
|
||||
form.description = ''
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
// Close dialog / 关闭弹窗
|
||||
const handleClose = () => {
|
||||
visible.value = false
|
||||
}
|
||||
|
||||
// Submit form / 提交表单
|
||||
const handleSubmit = async () => {
|
||||
if (!formRef.value) return
|
||||
|
||||
await formRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
loading.value = true
|
||||
try {
|
||||
const drama = await dramaAPI.create(form)
|
||||
ElMessage.success('创建成功')
|
||||
visible.value = false
|
||||
emit('created', drama.id)
|
||||
// Navigate to drama detail page / 跳转到短剧详情页
|
||||
router.push(`/dramas/${drama.id}`)
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error.message || '创建失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* ========================================
|
||||
Dialog Styles / 弹窗样式
|
||||
======================================== */
|
||||
.create-dialog :deep(.el-dialog) {
|
||||
border-radius: var(--radius-xl);
|
||||
}
|
||||
|
||||
.create-dialog :deep(.el-dialog__header) {
|
||||
padding: 1.25rem 1.5rem;
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.create-dialog :deep(.el-dialog__title) {
|
||||
font-size: 1.125rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.create-dialog :deep(.el-dialog__body) {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.dialog-desc {
|
||||
margin-bottom: 1.5rem;
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
Form Styles / 表单样式
|
||||
======================================== */
|
||||
.create-form :deep(.el-form-item) {
|
||||
margin-bottom: 1.25rem;
|
||||
}
|
||||
|
||||
.create-form :deep(.el-form-item__label) {
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.create-form :deep(.el-input__wrapper),
|
||||
.create-form :deep(.el-textarea__inner) {
|
||||
background: var(--bg-secondary);
|
||||
border-radius: var(--radius-md);
|
||||
box-shadow: 0 0 0 1px var(--border-primary) inset;
|
||||
transition: all var(--transition-fast);
|
||||
}
|
||||
|
||||
.create-form :deep(.el-input__wrapper:hover),
|
||||
.create-form :deep(.el-textarea__inner:hover) {
|
||||
box-shadow: 0 0 0 1px var(--border-secondary) inset;
|
||||
}
|
||||
|
||||
.create-form :deep(.el-input__wrapper.is-focus),
|
||||
.create-form :deep(.el-textarea__inner:focus) {
|
||||
box-shadow: 0 0 0 2px var(--accent) inset;
|
||||
}
|
||||
|
||||
.create-form :deep(.el-input__inner),
|
||||
.create-form :deep(.el-textarea__inner) {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.create-form :deep(.el-input__inner::placeholder),
|
||||
.create-form :deep(.el-textarea__inner::placeholder) {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.create-form :deep(.el-input__count) {
|
||||
color: var(--text-muted);
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
Footer Styles / 底部样式
|
||||
======================================== */
|
||||
.dialog-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.dialog-footer .el-button {
|
||||
min-width: 100px;
|
||||
}
|
||||
</style>
|
||||
130
web/src/components/common/EmptyState.vue
Normal file
130
web/src/components/common/EmptyState.vue
Normal file
@@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<!-- Empty State Component - Display when no data available -->
|
||||
<!-- 空状态组件 - 无数据时的展示 -->
|
||||
<div :class="['empty-state', `size-${size}`]">
|
||||
<div class="empty-icon" :class="{ 'has-animation': animated }">
|
||||
<el-icon :size="iconSize">
|
||||
<component :is="icon" />
|
||||
</el-icon>
|
||||
</div>
|
||||
<h3 class="empty-title">{{ title }}</h3>
|
||||
<p v-if="description" class="empty-description">{{ description }}</p>
|
||||
<div v-if="$slots.default" class="empty-actions">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, type Component } from 'vue'
|
||||
import { FolderOpened } from '@element-plus/icons-vue'
|
||||
|
||||
/**
|
||||
* EmptyState - Display when no data is available
|
||||
* 空状态组件 - 无数据时的占位展示
|
||||
*/
|
||||
const props = withDefaults(defineProps<{
|
||||
title: string
|
||||
description?: string
|
||||
icon?: Component
|
||||
size?: 'small' | 'medium' | 'large'
|
||||
animated?: boolean
|
||||
}>(), {
|
||||
icon: FolderOpened,
|
||||
size: 'medium',
|
||||
animated: true
|
||||
})
|
||||
|
||||
// Icon size based on component size / 根据组件尺寸设置图标大小
|
||||
const iconSize = computed(() => {
|
||||
const sizes = {
|
||||
small: 32,
|
||||
medium: 48,
|
||||
large: 64
|
||||
}
|
||||
return sizes[props.size]
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
padding: var(--space-8) var(--space-4);
|
||||
}
|
||||
|
||||
/* Size variants / 尺寸变体 */
|
||||
.size-small {
|
||||
padding: var(--space-6) var(--space-4);
|
||||
}
|
||||
|
||||
.size-small .empty-title {
|
||||
font-size: 0.9375rem;
|
||||
}
|
||||
|
||||
.size-small .empty-description {
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.size-large {
|
||||
padding: var(--space-12) var(--space-6);
|
||||
}
|
||||
|
||||
.size-large .empty-title {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
/* Icon / 图标 */
|
||||
.empty-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 5rem;
|
||||
height: 5rem;
|
||||
margin-bottom: var(--space-4);
|
||||
background: linear-gradient(135deg, var(--accent) 0%, #06b6d4 100%);
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.empty-icon.has-animation {
|
||||
animation: pulse-glow 3s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse-glow {
|
||||
0%, 100% {
|
||||
box-shadow: 0 0 20px rgba(14, 165, 233, 0.3);
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0 0 40px rgba(14, 165, 233, 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
/* Title / 标题 */
|
||||
.empty-title {
|
||||
margin: 0 0 var(--space-2) 0;
|
||||
font-size: 1.0625rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
/* Description / 描述 */
|
||||
.empty-description {
|
||||
margin: 0;
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-muted);
|
||||
max-width: 320px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* Actions / 操作区 */
|
||||
.empty-actions {
|
||||
margin-top: var(--space-5);
|
||||
display: flex;
|
||||
gap: var(--space-3);
|
||||
}
|
||||
</style>
|
||||
223
web/src/components/common/PageHeader.vue
Normal file
223
web/src/components/common/PageHeader.vue
Normal file
@@ -0,0 +1,223 @@
|
||||
<template>
|
||||
<!-- Page header component with title, subtitle and action buttons -->
|
||||
<!-- 页面头部组件,包含标题、副标题和操作按钮 -->
|
||||
<header :class="['page-header', { 'with-back': showBack, 'with-border': showBorder }]">
|
||||
<div class="header-content">
|
||||
<!-- Back button section / 返回按钮区域 -->
|
||||
<div v-if="showBack" class="header-nav">
|
||||
<button class="back-btn" @click="handleBack">
|
||||
<el-icon><ArrowLeft /></el-icon>
|
||||
<span>{{ backText }}</span>
|
||||
</button>
|
||||
<div class="nav-divider"></div>
|
||||
</div>
|
||||
|
||||
<!-- Title section / 标题区域 -->
|
||||
<div class="header-text">
|
||||
<div class="title-row">
|
||||
<div v-if="$slots.icon" class="title-icon">
|
||||
<slot name="icon"></slot>
|
||||
</div>
|
||||
<h1 class="header-title">{{ title }}
|
||||
|
||||
<p v-if="subtitle" class="header-subtitle">{{ subtitle }}</p>
|
||||
</h1>
|
||||
<slot name="badge"></slot>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Actions section / 操作区域 -->
|
||||
<div class="header-actions">
|
||||
<slot name="actions"></slot>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Extra content / 额外内容 -->
|
||||
<div v-if="$slots.extra" class="header-extra">
|
||||
<slot name="extra"></slot>
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ArrowLeft } from '@element-plus/icons-vue'
|
||||
|
||||
/**
|
||||
* PageHeader - Reusable page header component
|
||||
* 页面头部组件 - 可复用的页面头部
|
||||
*/
|
||||
const props = withDefaults(defineProps<{
|
||||
title: string
|
||||
subtitle?: string
|
||||
showBack?: boolean
|
||||
backText?: string
|
||||
showBorder?: boolean
|
||||
}>(), {
|
||||
showBack: false,
|
||||
backText: '返回',
|
||||
showBorder: true
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
back: []
|
||||
}>()
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
// Handle back navigation / 处理返回导航
|
||||
const handleBack = () => {
|
||||
emit('back')
|
||||
router.back()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-header {
|
||||
margin-bottom: var(--space-3);
|
||||
}
|
||||
|
||||
.page-header.with-border {
|
||||
padding-bottom: var(--space-3);
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.header-content {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.page-header.with-back .header-content {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
/* Navigation / 导航 */
|
||||
.header-nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-4);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.back-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.375rem;
|
||||
padding: 0.5rem 0.875rem;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-lg);
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all var(--transition-fast);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.back-btn:hover {
|
||||
background: var(--bg-card-hover);
|
||||
color: var(--text-primary);
|
||||
border-color: var(--border-secondary);
|
||||
}
|
||||
|
||||
.back-btn:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.nav-divider {
|
||||
width: 1px;
|
||||
height: 2rem;
|
||||
background: var(--border-primary);
|
||||
}
|
||||
|
||||
/* Title / 标题 */
|
||||
.header-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.title-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-3);
|
||||
}
|
||||
|
||||
.title-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
background: linear-gradient(135deg, var(--accent) 0%, #06b6d4 100%);
|
||||
border-radius: var(--radius-lg);
|
||||
color: white;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
letter-spacing: -0.025em;
|
||||
line-height: 1.2;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.header-title {
|
||||
font-size: 1.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
.header-subtitle {
|
||||
margin: 0;
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-muted);
|
||||
font-weight: 500;
|
||||
max-width: 480px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Actions / 操作 */
|
||||
.header-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.header-actions {
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* Extra / 额外内容 */
|
||||
.header-extra {
|
||||
margin-top: var(--space-4);
|
||||
padding-top: var(--space-4);
|
||||
border-top: 1px solid var(--border-primary);
|
||||
}
|
||||
</style>
|
||||
224
web/src/components/common/ProjectCard.vue
Normal file
224
web/src/components/common/ProjectCard.vue
Normal file
@@ -0,0 +1,224 @@
|
||||
<template>
|
||||
<!-- Project card component - Compact & refined design -->
|
||||
<!-- 项目卡片组件 - 紧凑精致设计 -->
|
||||
<article
|
||||
class="project-card"
|
||||
@click="$emit('click')"
|
||||
tabindex="0"
|
||||
@keydown.enter="$emit('click')"
|
||||
>
|
||||
<!-- Cover image section / 封面图片区域 -->
|
||||
<div class="card-cover">
|
||||
<img
|
||||
v-if="coverImage"
|
||||
:src="coverImage"
|
||||
:alt="title"
|
||||
class="cover-image"
|
||||
loading="lazy"
|
||||
/>
|
||||
<div v-else class="cover-placeholder">
|
||||
<el-icon :size="20" class="placeholder-icon">
|
||||
<Film />
|
||||
</el-icon>
|
||||
</div>
|
||||
<!-- Floating tag / 悬浮标签 -->
|
||||
<span v-if="tag" class="floating-tag">{{ tag }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Card content / 卡片内容 -->
|
||||
<div class="card-body">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">{{ title }}</h3>
|
||||
<span class="meta-time">{{ formattedDate }}</span>
|
||||
</div>
|
||||
<p class="card-description">{{ description || '无描述' }}</p>
|
||||
|
||||
<!-- Actions / 操作区 -->
|
||||
<div class="card-actions" @click.stop>
|
||||
<slot name="actions"></slot>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { Film } from '@element-plus/icons-vue'
|
||||
|
||||
/**
|
||||
* ProjectCard - Reusable project/drama card component
|
||||
* 项目卡片组件 - 可复用的项目展示卡片
|
||||
*/
|
||||
const props = defineProps<{
|
||||
title: string
|
||||
description?: string
|
||||
coverImage?: string
|
||||
tag?: string
|
||||
updatedAt: string
|
||||
}>()
|
||||
|
||||
defineEmits<{
|
||||
click: []
|
||||
}>()
|
||||
|
||||
// Format date to relative time / 格式化日期为相对时间
|
||||
const formattedDate = computed(() => {
|
||||
const date = new Date(props.updatedAt)
|
||||
const now = new Date()
|
||||
const diff = now.getTime() - date.getTime()
|
||||
const days = Math.floor(diff / (1000 * 60 * 60 * 24))
|
||||
|
||||
if (days === 0) return '今天'
|
||||
if (days === 1) return '昨天'
|
||||
if (days < 7) return `${days}天前`
|
||||
return date.toLocaleDateString('zh-CN')
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* Card Container / 卡片容器 */
|
||||
.project-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: all var(--transition-normal);
|
||||
box-shadow: var(--shadow-card);
|
||||
}
|
||||
|
||||
.project-card:hover {
|
||||
border-color: var(--accent);
|
||||
box-shadow: var(--shadow-card-hover), 0 0 0 1px var(--accent);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.project-card:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* Cover Section / 封面区域 */
|
||||
.card-cover {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
aspect-ratio: 16 / 9;
|
||||
overflow: hidden;
|
||||
background: linear-gradient(135deg, var(--accent) 0%, #06b6d4 100%);
|
||||
}
|
||||
|
||||
.cover-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
transition: transform var(--transition-slow);
|
||||
}
|
||||
|
||||
.project-card:hover .cover-image {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.cover-placeholder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.placeholder-icon {
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
/* Floating tag / 悬浮标签 */
|
||||
.floating-tag {
|
||||
position: absolute;
|
||||
top: var(--space-2);
|
||||
left: var(--space-2);
|
||||
padding: 0.2rem 0.5rem;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
color: white;
|
||||
font-size: 0.625rem;
|
||||
font-weight: 600;
|
||||
border-radius: var(--radius-sm);
|
||||
backdrop-filter: blur(8px);
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
/* Body Section / 内容区域 */
|
||||
.card-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: var(--space-3);
|
||||
gap: var(--space-1);
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.card-title {
|
||||
margin: 0;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex: 1;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
.meta-time {
|
||||
font-size: 0.625rem;
|
||||
color: var(--text-muted);
|
||||
white-space: nowrap;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.card-description {
|
||||
margin: 0;
|
||||
font-size: 0.6875rem;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.4;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Actions / 操作区 */
|
||||
.card-actions {
|
||||
display: flex;
|
||||
gap: var(--space-1);
|
||||
align-items: center;
|
||||
margin-top: var(--space-1);
|
||||
padding-top: var(--space-2);
|
||||
border-top: 1px solid var(--border-primary);
|
||||
}
|
||||
|
||||
:deep(.action-button) {
|
||||
padding: 0.25rem !important;
|
||||
min-width: 1.5rem !important;
|
||||
height: 1.5rem !important;
|
||||
}
|
||||
|
||||
:deep(.action-button .el-icon) {
|
||||
font-size: 0.75rem !important;
|
||||
}
|
||||
|
||||
:deep(.action-button.primary:hover) {
|
||||
color: var(--accent);
|
||||
background: var(--accent-light);
|
||||
}
|
||||
|
||||
:deep(.action-button.danger:hover) {
|
||||
color: var(--error);
|
||||
background: var(--error-light);
|
||||
}
|
||||
</style>
|
||||
180
web/src/components/common/StatCard.vue
Normal file
180
web/src/components/common/StatCard.vue
Normal file
@@ -0,0 +1,180 @@
|
||||
<template>
|
||||
<!-- Stat Card Component - Display statistics with modern design -->
|
||||
<!-- 统计卡片组件 - 现代设计的统计数据展示 -->
|
||||
<div :class="['stat-card', `variant-${variant}`]">
|
||||
<div class="stat-icon" :style="{ background: iconBg }">
|
||||
<el-icon :size="24" :color="iconColor">
|
||||
<component :is="icon" />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<span class="stat-label">{{ label }}</span>
|
||||
<div class="stat-value-row">
|
||||
<span class="stat-value" :style="{ color: valueColor }">{{ formattedValue }}</span>
|
||||
<span v-if="suffix" class="stat-suffix">{{ suffix }}</span>
|
||||
</div>
|
||||
<span v-if="description" class="stat-description">{{ description }}</span>
|
||||
</div>
|
||||
<div v-if="trend !== undefined" :class="['stat-trend', trendDirection]">
|
||||
<el-icon :size="14">
|
||||
<component :is="trendIcon" />
|
||||
</el-icon>
|
||||
<span>{{ Math.abs(trend) }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, type Component } from 'vue'
|
||||
import { TrendCharts, ArrowUp, ArrowDown } from '@element-plus/icons-vue'
|
||||
|
||||
/**
|
||||
* StatCard - Display statistics with trend indicator
|
||||
* 统计卡片 - 带趋势指示器的统计数据展示
|
||||
*/
|
||||
const props = withDefaults(defineProps<{
|
||||
label: string
|
||||
value: number | string
|
||||
icon: Component
|
||||
iconColor?: string
|
||||
iconBg?: string
|
||||
valueColor?: string
|
||||
suffix?: string
|
||||
description?: string
|
||||
trend?: number
|
||||
variant?: 'default' | 'compact'
|
||||
}>(), {
|
||||
iconColor: 'var(--accent)',
|
||||
iconBg: 'var(--accent-light)',
|
||||
valueColor: 'var(--accent)',
|
||||
variant: 'default'
|
||||
})
|
||||
|
||||
// Format large numbers / 格式化大数字
|
||||
const formattedValue = computed(() => {
|
||||
if (typeof props.value === 'string') return props.value
|
||||
if (props.value >= 1000000) {
|
||||
return (props.value / 1000000).toFixed(1) + 'M'
|
||||
}
|
||||
if (props.value >= 1000) {
|
||||
return (props.value / 1000).toFixed(1) + 'K'
|
||||
}
|
||||
return props.value.toString()
|
||||
})
|
||||
|
||||
// Trend direction / 趋势方向
|
||||
const trendDirection = computed(() => {
|
||||
if (props.trend === undefined) return ''
|
||||
return props.trend >= 0 ? 'up' : 'down'
|
||||
})
|
||||
|
||||
// Trend icon / 趋势图标
|
||||
const trendIcon = computed(() => {
|
||||
if (props.trend === undefined) return TrendCharts
|
||||
return props.trend >= 0 ? ArrowUp : ArrowDown
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.stat-card {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--space-3);
|
||||
padding: var(--space-3);
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-lg);
|
||||
transition: all var(--transition-normal);
|
||||
}
|
||||
|
||||
.stat-card:hover {
|
||||
border-color: var(--border-secondary);
|
||||
box-shadow: var(--shadow-card-hover);
|
||||
}
|
||||
|
||||
/* Compact variant / 紧凑变体 */
|
||||
.variant-compact {
|
||||
padding: var(--space-2);
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.variant-compact .stat-icon {
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
}
|
||||
|
||||
.variant-compact .stat-value {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
/* Icon / 图标 */
|
||||
.stat-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
border-radius: var(--radius-lg);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* Content / 内容 */
|
||||
.stat-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.125rem;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 500;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.stat-value-row {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 1.75rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.stat-suffix {
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.stat-description {
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-muted);
|
||||
margin-top: var(--space-1);
|
||||
}
|
||||
|
||||
/* Trend / 趋势 */
|
||||
.stat-trend {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.stat-trend.up {
|
||||
background: var(--success-light);
|
||||
color: var(--success);
|
||||
}
|
||||
|
||||
.stat-trend.down {
|
||||
background: var(--error-light);
|
||||
color: var(--error);
|
||||
}
|
||||
</style>
|
||||
100
web/src/components/common/ThemeToggle.vue
Normal file
100
web/src/components/common/ThemeToggle.vue
Normal file
@@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<!-- Theme toggle button for switching between light/dark mode -->
|
||||
<!-- 主题切换按钮,用于切换浅色/深色模式 -->
|
||||
<button
|
||||
class="theme-toggle"
|
||||
:aria-label="isDark ? '切换到浅色模式' : '切换到深色模式'"
|
||||
@click="toggleTheme"
|
||||
>
|
||||
<transition name="icon-fade" mode="out-in">
|
||||
<el-icon v-if="isDark" key="moon" :size="18">
|
||||
<Moon />
|
||||
</el-icon>
|
||||
<el-icon v-else key="sun" :size="18">
|
||||
<Sunny />
|
||||
</el-icon>
|
||||
</transition>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { Moon, Sunny } from '@element-plus/icons-vue'
|
||||
|
||||
/**
|
||||
* ThemeToggle - Dark/Light mode toggle button
|
||||
* 主题切换按钮 - 深色/浅色模式切换
|
||||
*/
|
||||
const isDark = ref(false)
|
||||
|
||||
// Initialize theme from localStorage or system preference
|
||||
// 从 localStorage 或系统偏好初始化主题
|
||||
onMounted(() => {
|
||||
const savedTheme = localStorage.getItem('theme')
|
||||
if (savedTheme) {
|
||||
isDark.value = savedTheme === 'dark'
|
||||
} else {
|
||||
isDark.value = window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
}
|
||||
applyTheme()
|
||||
})
|
||||
|
||||
// Toggle between dark and light mode / 切换深色和浅色模式
|
||||
const toggleTheme = () => {
|
||||
isDark.value = !isDark.value
|
||||
applyTheme()
|
||||
localStorage.setItem('theme', isDark.value ? 'dark' : 'light')
|
||||
}
|
||||
|
||||
// Apply theme to document / 应用主题到文档
|
||||
const applyTheme = () => {
|
||||
if (isDark.value) {
|
||||
document.documentElement.classList.add('dark')
|
||||
} else {
|
||||
document.documentElement.classList.remove('dark')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.theme-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 2.25rem;
|
||||
height: 2.25rem;
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--bg-card);
|
||||
color: var(--text-secondary);
|
||||
cursor: pointer;
|
||||
transition: all var(--transition-fast);
|
||||
}
|
||||
|
||||
.theme-toggle:hover {
|
||||
background: var(--bg-card-hover);
|
||||
color: var(--text-primary);
|
||||
border-color: var(--border-secondary);
|
||||
}
|
||||
|
||||
.theme-toggle:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* Icon transition / 图标过渡动画 */
|
||||
.icon-fade-enter-active,
|
||||
.icon-fade-leave-active {
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.icon-fade-enter-from {
|
||||
opacity: 0;
|
||||
transform: rotate(-90deg) scale(0.8);
|
||||
}
|
||||
|
||||
.icon-fade-leave-to {
|
||||
opacity: 0;
|
||||
transform: rotate(90deg) scale(0.8);
|
||||
}
|
||||
</style>
|
||||
22
web/src/components/common/index.ts
Normal file
22
web/src/components/common/index.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Common UI Components barrel export
|
||||
* 通用 UI 组件统一导出
|
||||
*/
|
||||
|
||||
// Layout Components / 布局组件
|
||||
export { default as PageHeader } from './PageHeader.vue'
|
||||
export { default as BaseCard } from './BaseCard.vue'
|
||||
export { default as StatCard } from './StatCard.vue'
|
||||
export { default as EmptyState } from './EmptyState.vue'
|
||||
|
||||
// Interactive Components / 交互组件
|
||||
export { default as ProjectCard } from './ProjectCard.vue'
|
||||
export { default as ThemeToggle } from './ThemeToggle.vue'
|
||||
export { default as ActionButton } from './ActionButton.vue'
|
||||
|
||||
// Dialog Components / 弹窗组件
|
||||
export { default as CreateDramaDialog } from './CreateDramaDialog.vue'
|
||||
export { default as AIConfigDialog } from './AIConfigDialog.vue'
|
||||
|
||||
// Layout Components / 布局组件
|
||||
export { default as AppLayout } from './AppLayout.vue'
|
||||
@@ -332,8 +332,11 @@
|
||||
<div class="param-section" v-if="currentShot">
|
||||
<div class="param-group">
|
||||
<label>视频预览</label>
|
||||
<div class="video-preview" v-if="currentShot.video_url">
|
||||
<video :src="currentShot.video_url" controls style="width: 100%;" />
|
||||
<div class="video-preview" v-if="currentShot.video_url" @click="toggleVideoPlay">
|
||||
<video ref="videoPlayerRef" :src="currentShot.video_url" style="width: 100%;" @ended="videoPlaying = false" />
|
||||
<div class="video-play-overlay" :class="{ hidden: videoPlaying }">
|
||||
<el-icon :size="48"><VideoPlay /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="video-placeholder">
|
||||
<el-icon><VideoCamera /></el-icon>
|
||||
@@ -443,6 +446,19 @@ const selectedCharacters = ref<string[]>([])
|
||||
const availableCharacters = ref<any[]>([])
|
||||
const backgroundPrompt = ref('')
|
||||
const backgroundsCache = ref<Background[]>([])
|
||||
const videoPlayerRef = ref<HTMLVideoElement | null>(null)
|
||||
const videoPlaying = ref(false)
|
||||
|
||||
const toggleVideoPlay = () => {
|
||||
if (!videoPlayerRef.value) return
|
||||
if (videoPlaying.value) {
|
||||
videoPlayerRef.value.pause()
|
||||
videoPlaying.value = false
|
||||
} else {
|
||||
videoPlayerRef.value.play()
|
||||
videoPlaying.value = true
|
||||
}
|
||||
}
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
@@ -752,22 +768,22 @@ watch(() => currentShot.value, () => {
|
||||
.storyboard-editor {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
background: #f5f7fa;
|
||||
color: #303133;
|
||||
background: var(--bg-primary);
|
||||
color: var(--text-primary);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.left-panel {
|
||||
width: 280px;
|
||||
flex-shrink: 0;
|
||||
background: #ffffff;
|
||||
background: var(--bg-card);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-right: 1px solid #e4e7ed;
|
||||
border-right: 1px solid var(--border-primary);
|
||||
|
||||
.panel-header {
|
||||
padding: 16px;
|
||||
border-bottom: 1px solid #e4e7ed;
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
@@ -782,7 +798,7 @@ watch(() => currentShot.value, () => {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -796,35 +812,35 @@ watch(() => currentShot.value, () => {
|
||||
gap: 12px;
|
||||
padding: 12px;
|
||||
margin-bottom: 8px;
|
||||
background: #f5f7fa;
|
||||
background: var(--bg-secondary);
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
border: 1px solid #e4e7ed;
|
||||
border: 1px solid var(--border-primary);
|
||||
|
||||
&:hover {
|
||||
background: #ecf5ff;
|
||||
border-color: #c6e2ff;
|
||||
background: var(--accent-light);
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: #ecf5ff;
|
||||
border-color: #409eff;
|
||||
box-shadow: 0 2px 8px rgba(64, 158, 255, 0.15);
|
||||
background: var(--accent-light);
|
||||
border-color: var(--accent);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
.scene-number {
|
||||
flex-shrink: 0;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background: #409eff;
|
||||
background: var(--accent);
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 600;
|
||||
font-size: 12px;
|
||||
color: #ffffff;
|
||||
color: var(--text-inverse);
|
||||
}
|
||||
|
||||
.scene-content {
|
||||
@@ -839,7 +855,7 @@ watch(() => currentShot.value, () => {
|
||||
|
||||
.time-location {
|
||||
font-size: 11px;
|
||||
color: #909399;
|
||||
color: var(--text-muted);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@@ -848,7 +864,7 @@ watch(() => currentShot.value, () => {
|
||||
|
||||
.scene-desc {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.4;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@@ -864,8 +880,8 @@ watch(() => currentShot.value, () => {
|
||||
height: 40px;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
background: #f0f2f5;
|
||||
border: 1px solid #dcdfe6;
|
||||
background: var(--bg-card-hover);
|
||||
border: 1px solid var(--border-primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -876,12 +892,12 @@ watch(() => currentShot.value, () => {
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #f5f7fa;
|
||||
background: var(--bg-primary);
|
||||
|
||||
.preview-header {
|
||||
padding: 12px 20px;
|
||||
background: #ffffff;
|
||||
border-bottom: 1px solid #e4e7ed;
|
||||
background: var(--bg-card);
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
@@ -893,7 +909,7 @@ watch(() => currentShot.value, () => {
|
||||
|
||||
.shot-type {
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -912,11 +928,11 @@ watch(() => currentShot.value, () => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #ffffff;
|
||||
background: var(--bg-card);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
border: 1px solid #e4e7ed;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
|
||||
border: 1px solid var(--border-primary);
|
||||
box-shadow: var(--shadow-md);
|
||||
|
||||
.preview-image {
|
||||
width: 100%;
|
||||
@@ -933,7 +949,7 @@ watch(() => currentShot.value, () => {
|
||||
|
||||
.preview-placeholder {
|
||||
text-align: center;
|
||||
color: #909399;
|
||||
color: var(--text-muted);
|
||||
|
||||
p {
|
||||
margin-top: 12px;
|
||||
@@ -942,7 +958,7 @@ watch(() => currentShot.value, () => {
|
||||
|
||||
.hint {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
color: var(--text-muted);
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
@@ -959,15 +975,15 @@ watch(() => currentShot.value, () => {
|
||||
|
||||
.timeline-panel {
|
||||
height: 140px;
|
||||
background: #ffffff;
|
||||
border-top: 1px solid #e4e7ed;
|
||||
background: var(--bg-card);
|
||||
border-top: 1px solid var(--border-primary);
|
||||
|
||||
.timeline-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 8px 16px;
|
||||
border-bottom: 1px solid #e4e7ed;
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
|
||||
.timeline-tools {
|
||||
display: flex;
|
||||
@@ -976,7 +992,7 @@ watch(() => currentShot.value, () => {
|
||||
|
||||
.timecode {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
color: var(--text-muted);
|
||||
font-family: monospace;
|
||||
}
|
||||
}
|
||||
@@ -1000,22 +1016,22 @@ watch(() => currentShot.value, () => {
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
background: #f5f7fa;
|
||||
background: var(--bg-secondary);
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: #c0c4cc;
|
||||
background: var(--border-secondary);
|
||||
border-radius: 4px;
|
||||
|
||||
&:hover {
|
||||
background: #909399;
|
||||
background: var(--border-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.timeline-ruler {
|
||||
position: relative;
|
||||
height: 20px;
|
||||
border-bottom: 1px solid #dcdfe6;
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
min-width: max-content;
|
||||
|
||||
.ruler-mark {
|
||||
@@ -1027,13 +1043,13 @@ watch(() => currentShot.value, () => {
|
||||
display: block;
|
||||
width: 1px;
|
||||
height: 8px;
|
||||
background: #dcdfe6;
|
||||
background: var(--border-primary);
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 10px;
|
||||
color: #606266;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1050,21 +1066,21 @@ watch(() => currentShot.value, () => {
|
||||
flex-shrink: 0;
|
||||
width: 60px;
|
||||
height: 100%;
|
||||
background: #c6e2ff;
|
||||
background: var(--accent-light);
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
border: 1px solid #a0cfff;
|
||||
border: 1px solid var(--accent);
|
||||
|
||||
&:hover {
|
||||
background: #a0cfff;
|
||||
border-color: #79bbff;
|
||||
background: var(--accent);
|
||||
border-color: var(--accent-hover);
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: #409eff;
|
||||
border-color: #409eff;
|
||||
box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
|
||||
background: var(--accent);
|
||||
border-color: var(--accent);
|
||||
box-shadow: var(--shadow-glow);
|
||||
}
|
||||
|
||||
.clip-content {
|
||||
@@ -1077,12 +1093,12 @@ watch(() => currentShot.value, () => {
|
||||
.clip-number {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
}
|
||||
|
||||
&.active .clip-content .clip-number {
|
||||
color: #ffffff;
|
||||
color: var(--text-inverse);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1093,8 +1109,8 @@ watch(() => currentShot.value, () => {
|
||||
.right-panel {
|
||||
width: 420px;
|
||||
flex-shrink: 0;
|
||||
background: #ffffff;
|
||||
border-left: 1px solid #e4e7ed;
|
||||
background: var(--bg-card);
|
||||
border-left: 1px solid var(--border-primary);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -1106,8 +1122,8 @@ watch(() => currentShot.value, () => {
|
||||
|
||||
:deep(.el-tabs__header) {
|
||||
margin: 0;
|
||||
background: #ffffff;
|
||||
border-bottom: 1px solid #e4e7ed;
|
||||
background: var(--bg-card);
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
flex-shrink: 0;
|
||||
padding: 0 8px;
|
||||
}
|
||||
@@ -1120,24 +1136,24 @@ watch(() => currentShot.value, () => {
|
||||
}
|
||||
|
||||
:deep(.el-tabs__item) {
|
||||
color: #606266;
|
||||
color: var(--text-secondary);
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
padding: 0 20px;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
color: #409eff;
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
color: #409eff;
|
||||
background: #ecf5ff;
|
||||
color: var(--accent);
|
||||
background: var(--accent-light);
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-tabs__active-bar) {
|
||||
background: linear-gradient(90deg, #409eff 0%, #66b1ff 100%);
|
||||
background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hover) 100%);
|
||||
height: 3px;
|
||||
}
|
||||
|
||||
@@ -1150,32 +1166,32 @@ watch(() => currentShot.value, () => {
|
||||
.section-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #409eff;
|
||||
color: var(--accent);
|
||||
margin: 12px 0 10px;
|
||||
padding: 6px 10px;
|
||||
background: #ecf5ff;
|
||||
background: var(--accent-light);
|
||||
border-radius: 6px;
|
||||
border-left: 3px solid #409eff;
|
||||
border-left: 3px solid var(--accent);
|
||||
}
|
||||
|
||||
.param-group {
|
||||
margin-bottom: 10px;
|
||||
padding: 10px;
|
||||
background: #f5f7fa;
|
||||
background: var(--bg-secondary);
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e4e7ed;
|
||||
border: 1px solid var(--border-primary);
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
background: #ecf5ff;
|
||||
border-color: #c6e2ff;
|
||||
box-shadow: 0 2px 8px rgba(64, 158, 255, 0.08);
|
||||
background: var(--accent-light);
|
||||
border-color: var(--accent);
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: 6px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.3px;
|
||||
@@ -1208,29 +1224,29 @@ watch(() => currentShot.value, () => {
|
||||
.background-preview-small {
|
||||
width: 80px;
|
||||
height: 60px;
|
||||
background: #f0f2f5;
|
||||
background: var(--bg-secondary);
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
border: 1px solid #dcdfe6;
|
||||
border: 1px solid var(--border-primary);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.background-placeholder-small {
|
||||
width: 80px;
|
||||
height: 60px;
|
||||
background: #fafafa;
|
||||
background: var(--bg-primary);
|
||||
border-radius: 6px;
|
||||
border: 2px dashed #c0c4cc;
|
||||
border: 2px dashed var(--border-secondary);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
color: var(--text-muted);
|
||||
flex-shrink: 0;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: #409eff;
|
||||
background: #ecf5ff;
|
||||
border-color: var(--accent);
|
||||
background: var(--accent-light);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1248,32 +1264,60 @@ watch(() => currentShot.value, () => {
|
||||
.video-preview {
|
||||
width: 100%;
|
||||
aspect-ratio: 2/1;
|
||||
background: #f0f2f5;
|
||||
background: var(--bg-secondary);
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 8px;
|
||||
border: 1px solid #dcdfe6;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
||||
border: 1px solid var(--border-primary);
|
||||
box-shadow: var(--shadow-sm);
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.video-play-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
transition: opacity 0.3s ease;
|
||||
|
||||
.el-icon {
|
||||
color: white;
|
||||
filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
|
||||
}
|
||||
|
||||
&.hidden {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
.background-placeholder,
|
||||
.video-placeholder {
|
||||
width: 100%;
|
||||
aspect-ratio: 2/1;
|
||||
background: #fafafa;
|
||||
background: var(--bg-primary);
|
||||
border-radius: 6px;
|
||||
border: 2px dashed #c0c4cc;
|
||||
border: 2px dashed var(--border-secondary);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 8px;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: #409eff;
|
||||
background: #ecf5ff;
|
||||
border-color: var(--accent);
|
||||
background: var(--accent-light);
|
||||
}
|
||||
|
||||
.el-icon {
|
||||
@@ -1322,12 +1366,12 @@ watch(() => currentShot.value, () => {
|
||||
.help-text {
|
||||
margin-top: 6px;
|
||||
font-size: 11px;
|
||||
color: #909399;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.5;
|
||||
padding: 4px 8px;
|
||||
background: #ecf5ff;
|
||||
background: var(--accent-light);
|
||||
border-radius: 4px;
|
||||
border-left: 2px solid #409eff;
|
||||
border-left: 2px solid var(--accent);
|
||||
}
|
||||
|
||||
.character-list {
|
||||
@@ -1347,8 +1391,8 @@ watch(() => currentShot.value, () => {
|
||||
transform: translateY(-2px);
|
||||
|
||||
.avatar-wrapper {
|
||||
border-color: #409eff;
|
||||
box-shadow: 0 2px 8px rgba(64, 158, 255, 0.2);
|
||||
border-color: var(--accent);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1357,19 +1401,19 @@ watch(() => currentShot.value, () => {
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
background: #f0f2f5;
|
||||
background: var(--bg-secondary);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
border: 2px solid #c0c4cc;
|
||||
color: var(--text-muted);
|
||||
border: 2px solid var(--border-secondary);
|
||||
transition: all 0.3s ease;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.avatar-name {
|
||||
font-size: 11px;
|
||||
color: #606266;
|
||||
color: var(--text-secondary);
|
||||
text-align: center;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
@@ -1384,16 +1428,16 @@ watch(() => currentShot.value, () => {
|
||||
.composition-placeholder {
|
||||
width: 100%;
|
||||
aspect-ratio: 2/1;
|
||||
background: #fafafa;
|
||||
background: var(--bg-primary);
|
||||
border-radius: 6px;
|
||||
border: 2px dashed #c0c4cc;
|
||||
border: 2px dashed var(--border-secondary);
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 8px;
|
||||
color: #909399;
|
||||
color: var(--text-muted);
|
||||
|
||||
.el-icon {
|
||||
font-size: 32px;
|
||||
@@ -1406,7 +1450,7 @@ watch(() => currentShot.value, () => {
|
||||
|
||||
.hint {
|
||||
font-size: 10px;
|
||||
color: #909399;
|
||||
color: var(--text-muted);
|
||||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
@@ -1417,25 +1461,25 @@ watch(() => currentShot.value, () => {
|
||||
:deep(.el-input__wrapper),
|
||||
:deep(.el-textarea__inner),
|
||||
:deep(.el-select) {
|
||||
background-color: #ffffff;
|
||||
background-color: var(--bg-card);
|
||||
border-radius: 6px;
|
||||
border: 1px solid #dcdfe6;
|
||||
border: 1px solid var(--border-primary);
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: #c0c4cc;
|
||||
border-color: var(--border-secondary);
|
||||
}
|
||||
|
||||
&:focus,
|
||||
&.is-focus {
|
||||
border-color: #409eff;
|
||||
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1);
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-input__inner),
|
||||
:deep(.el-textarea__inner) {
|
||||
color: #606266;
|
||||
color: var(--text-primary);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@@ -1444,7 +1488,7 @@ watch(() => currentShot.value, () => {
|
||||
}
|
||||
|
||||
:deep(.el-divider) {
|
||||
border-color: #e4e7ed;
|
||||
border-color: var(--border-primary);
|
||||
margin: 12px 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<div class="editor-workspace">
|
||||
<!-- 预览区域 -->
|
||||
<div class="preview-panel">
|
||||
<div class="video-preview">
|
||||
<div class="video-preview" @click="togglePlay">
|
||||
<video
|
||||
ref="previewPlayer"
|
||||
:src="currentPreviewUrl"
|
||||
@@ -41,6 +41,10 @@
|
||||
:class="[`transition-${transitionState.type}`, { 'transition-in': transitionState.phase === 'in', 'transition-out': transitionState.phase === 'out' }]"
|
||||
:style="{ animationDuration: transitionState.duration + 's' }"
|
||||
></div>
|
||||
<!-- 播放/暂停图标覆盖层 -->
|
||||
<div class="video-play-overlay" :class="{ hidden: isPlaying }" v-if="currentPreviewUrl">
|
||||
<el-icon :size="64"><VideoPlay /></el-icon>
|
||||
</div>
|
||||
<div class="preview-overlay" v-if="!currentPreviewUrl">
|
||||
<el-empty :description="$t('video.dragToTimeline')" />
|
||||
</div>
|
||||
@@ -154,7 +158,18 @@
|
||||
@dragover.prevent
|
||||
@click="clickTimeline($event)"
|
||||
>
|
||||
<div class="track-label">{{ $t('video.videoTrack') }}</div>
|
||||
<div class="track-label">
|
||||
<span>{{ $t('video.videoTrack') }}</span>
|
||||
<el-button
|
||||
type="text"
|
||||
size="small"
|
||||
@click.stop="clearAllClips"
|
||||
:disabled="timelineClips.length === 0"
|
||||
:title="$t('video.clearTrack')"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="track-clips">
|
||||
<!-- 视频片段 -->
|
||||
<div
|
||||
@@ -926,6 +941,17 @@ const removeClip = (clip: TimelineClip) => {
|
||||
}
|
||||
}
|
||||
|
||||
const clearAllClips = () => {
|
||||
if (timelineClips.value.length === 0) return
|
||||
|
||||
timelineClips.value = []
|
||||
audioClips.value = []
|
||||
selectedClipId.value = null
|
||||
selectedAudioClipId.value = null
|
||||
currentTime.value = 0
|
||||
ElMessage.success('已清空轨道')
|
||||
}
|
||||
|
||||
const updateClipOrders = () => {
|
||||
timelineClips.value.forEach((clip, index) => {
|
||||
clip.order = index
|
||||
@@ -1356,6 +1382,14 @@ const pauseTimeline = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const togglePlay = () => {
|
||||
if (isPlaying.value) {
|
||||
pauseTimeline()
|
||||
} else {
|
||||
playTimeline()
|
||||
}
|
||||
}
|
||||
|
||||
// 键盘快捷键
|
||||
const handleKeyPress = (event: KeyboardEvent) => {
|
||||
// 如果在输入框中,不处理快捷键
|
||||
@@ -1665,16 +1699,16 @@ defineExpose({
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #fafafa;
|
||||
color: #333;
|
||||
background: var(--bg-primary);
|
||||
color: var(--text-primary);
|
||||
|
||||
.editor-toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px 16px;
|
||||
background: #f5f5f5;
|
||||
border: 1px solid #e0e0e0;
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
|
||||
.toolbar-left {
|
||||
display: flex;
|
||||
@@ -1684,7 +1718,7 @@ defineExpose({
|
||||
.time-display {
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
color: var(--text-secondary);
|
||||
min-width: 160px;
|
||||
}
|
||||
}
|
||||
@@ -1699,8 +1733,8 @@ defineExpose({
|
||||
flex: 0 0 500px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
border: 1px solid #e0e0e0;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border-primary);
|
||||
|
||||
.video-preview {
|
||||
flex: 1;
|
||||
@@ -1725,7 +1759,35 @@ defineExpose({
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(245, 245, 245, 0.95);
|
||||
background: var(--bg-secondary);
|
||||
}
|
||||
|
||||
.video-play-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
cursor: pointer;
|
||||
transition: opacity 0.3s ease;
|
||||
z-index: 5;
|
||||
|
||||
.el-icon {
|
||||
color: white;
|
||||
filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
|
||||
}
|
||||
|
||||
&.hidden {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
}
|
||||
|
||||
.transition-overlay {
|
||||
@@ -1861,8 +1923,8 @@ defineExpose({
|
||||
|
||||
.preview-controls {
|
||||
padding: 12px 16px;
|
||||
background: #f5f5f5;
|
||||
border: 1px solid #e0e0e0;
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1870,7 +1932,7 @@ defineExpose({
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
background: var(--bg-card);
|
||||
overflow: hidden;
|
||||
|
||||
.library-header {
|
||||
@@ -1878,8 +1940,8 @@ defineExpose({
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 12px 16px;
|
||||
background: #f5f5f5;
|
||||
border: 1px solid #e0e0e0;
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
|
||||
.header-left {
|
||||
display: flex;
|
||||
@@ -1890,12 +1952,12 @@ defineExpose({
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1915,26 +1977,26 @@ defineExpose({
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
background: #f0f0f0;
|
||||
background: var(--bg-secondary);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: #d0d0d0;
|
||||
background: var(--border-secondary);
|
||||
border-radius: 4px;
|
||||
|
||||
&:hover {
|
||||
background: #c0c0c0;
|
||||
background: var(--border-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.media-item {
|
||||
position: relative;
|
||||
background: #f5f5f5;
|
||||
background: var(--bg-secondary);
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
cursor: move;
|
||||
border: 1px solid var(--el-border-color);
|
||||
border: 1px solid var(--border-primary);
|
||||
transition: all 0.3s;
|
||||
|
||||
&:hover {
|
||||
@@ -1960,7 +2022,7 @@ defineExpose({
|
||||
position: relative;
|
||||
width: 100%;
|
||||
aspect-ratio: 16/9;
|
||||
background: #f0f0f0;
|
||||
background: var(--bg-card-hover);
|
||||
cursor: pointer;
|
||||
|
||||
video {
|
||||
@@ -2017,13 +2079,13 @@ defineExpose({
|
||||
.media-title {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.media-desc {
|
||||
font-size: 11px;
|
||||
color: #999;
|
||||
color: var(--text-muted);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@@ -2038,16 +2100,16 @@ defineExpose({
|
||||
flex: 0 0 280px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
border: 1px solid #e0e0e0;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border-primary);
|
||||
|
||||
.timeline-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 8px 12px;
|
||||
background: #f5f5f5;
|
||||
border: 1px solid #e0e0e0;
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
|
||||
.zoom-controls {
|
||||
display: flex;
|
||||
@@ -2056,7 +2118,7 @@ defineExpose({
|
||||
|
||||
.zoom-level {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
color: var(--text-muted);
|
||||
min-width: 50px;
|
||||
text-align: right;
|
||||
}
|
||||
@@ -2068,12 +2130,12 @@ defineExpose({
|
||||
position: relative;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
background: #fafafa;
|
||||
background: var(--bg-primary);
|
||||
|
||||
.timeline-ruler {
|
||||
height: 30px;
|
||||
background: #fff;
|
||||
border: 1px solid #e0e0e0;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border-primary);
|
||||
position: relative;
|
||||
|
||||
.ruler-tick {
|
||||
@@ -2083,11 +2145,11 @@ defineExpose({
|
||||
|
||||
.tick-mark {
|
||||
width: 1px;
|
||||
background: #d0d0d0;
|
||||
background: var(--border-secondary);
|
||||
|
||||
&.major {
|
||||
height: 20px;
|
||||
background: #b0b0b0;
|
||||
background: var(--border-primary);
|
||||
}
|
||||
|
||||
&.minor {
|
||||
@@ -2101,7 +2163,7 @@ defineExpose({
|
||||
top: 2px;
|
||||
left: 4px;
|
||||
font-size: 10px;
|
||||
color: #999;
|
||||
color: var(--text-muted);
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
}
|
||||
@@ -2117,8 +2179,8 @@ defineExpose({
|
||||
.playhead-line {
|
||||
width: 2px;
|
||||
height: 100%;
|
||||
background: #3498db;
|
||||
box-shadow: 0 0 8px rgba(52, 152, 219, 0.6);
|
||||
background: var(--accent);
|
||||
box-shadow: 0 0 8px rgba(14, 165, 233, 0.6);
|
||||
}
|
||||
|
||||
.playhead-handle {
|
||||
@@ -2127,17 +2189,17 @@ defineExpose({
|
||||
left: -6px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
background: #3498db;
|
||||
background: var(--accent);
|
||||
border-radius: 50%;
|
||||
border: 2px solid #fff;
|
||||
border: 2px solid var(--bg-card);
|
||||
}
|
||||
}
|
||||
|
||||
.timeline-track {
|
||||
position: relative;
|
||||
height: 80px;
|
||||
background: #f5f5f5;
|
||||
border: 1px solid #e0e0e0;
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
|
||||
.track-label {
|
||||
position: absolute;
|
||||
@@ -2149,9 +2211,9 @@ defineExpose({
|
||||
align-items: center;
|
||||
padding-left: 12px;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
background: #fff;
|
||||
border: 1px solid #e0e0e0;
|
||||
color: var(--text-secondary);
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border-primary);
|
||||
z-index: 50;
|
||||
}
|
||||
|
||||
@@ -2164,7 +2226,7 @@ defineExpose({
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
bottom: 8px;
|
||||
background: #3a5f7d;
|
||||
background: var(--accent);
|
||||
border-radius: 4px;
|
||||
border: 2px solid transparent;
|
||||
cursor: move;
|
||||
@@ -2172,13 +2234,13 @@ defineExpose({
|
||||
overflow: hidden;
|
||||
|
||||
&:hover {
|
||||
border-color: #5a9fd4;
|
||||
box-shadow: 0 2px 8px rgba(90, 159, 212, 0.3);
|
||||
border-color: var(--accent-hover);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
&.selected {
|
||||
border-color: #3498db;
|
||||
box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
|
||||
border-color: var(--accent);
|
||||
box-shadow: var(--shadow-glow);
|
||||
}
|
||||
|
||||
.clip-content {
|
||||
@@ -2191,7 +2253,7 @@ defineExpose({
|
||||
.clip-thumbnail {
|
||||
width: 60px;
|
||||
height: 100%;
|
||||
background: #f0f0f0;
|
||||
background: var(--bg-card-hover);
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
@@ -2211,7 +2273,7 @@ defineExpose({
|
||||
.clip-title {
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
color: var(--text-inverse);
|
||||
margin-bottom: 2px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
@@ -2220,7 +2282,8 @@ defineExpose({
|
||||
|
||||
.clip-duration {
|
||||
font-size: 10px;
|
||||
color: #666;
|
||||
color: var(--text-inverse);
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2263,7 +2326,7 @@ defineExpose({
|
||||
transition: opacity 0.2s;
|
||||
|
||||
&:hover {
|
||||
background: #e74c3c;
|
||||
background: var(--error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2305,7 +2368,7 @@ defineExpose({
|
||||
top: 100%;
|
||||
margin-top: 4px;
|
||||
font-size: 10px;
|
||||
color: #666;
|
||||
color: var(--text-secondary);
|
||||
white-space: nowrap;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
padding: 2px 6px;
|
||||
@@ -2331,31 +2394,31 @@ defineExpose({
|
||||
padding-right: 8px;
|
||||
|
||||
.el-button {
|
||||
color: #999;
|
||||
color: var(--text-muted);
|
||||
|
||||
&:hover {
|
||||
color: #409eff;
|
||||
color: var(--accent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.audio-clip {
|
||||
background: #5d4a7a;
|
||||
background: #7c3aed;
|
||||
|
||||
&:hover {
|
||||
border-color: #8b6fb3;
|
||||
box-shadow: 0 2px 8px rgba(139, 111, 179, 0.3);
|
||||
border-color: #a78bfa;
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
&.selected {
|
||||
border-color: #9b59b6;
|
||||
box-shadow: 0 0 0 2px rgba(155, 89, 182, 0.3);
|
||||
border-color: #8b5cf6;
|
||||
box-shadow: var(--shadow-glow);
|
||||
}
|
||||
|
||||
.audio-waveform {
|
||||
width: 60px;
|
||||
height: 100%;
|
||||
background: linear-gradient(135deg, #8e44ad 0%, #3498db 100%);
|
||||
background: linear-gradient(135deg, #8b5cf6 0%, var(--accent) 100%);
|
||||
border-radius: 3px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -2384,7 +2447,7 @@ defineExpose({
|
||||
|
||||
.progress-message {
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
color: var(--text-secondary);
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
@@ -2392,7 +2455,7 @@ defineExpose({
|
||||
.progress-tips {
|
||||
margin-top: 20px;
|
||||
padding: 12px;
|
||||
background: #f5f7fa;
|
||||
background: var(--bg-secondary);
|
||||
border-radius: 6px;
|
||||
|
||||
p {
|
||||
@@ -2401,7 +2464,7 @@ defineExpose({
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
color: var(--text-secondary);
|
||||
|
||||
.el-icon {
|
||||
font-size: 16px;
|
||||
|
||||
Reference in New Issue
Block a user