1073 lines
27 KiB
Vue
1073 lines
27 KiB
Vue
<!-- Author: fruit.com.cn -->
|
||
|
||
<script setup>
|
||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||
import { useRouter } from 'vue-router'
|
||
import { ElMessage } from 'element-plus'
|
||
import PageHeading from '@/views/components/PageHeading.vue'
|
||
import CreatorCenterPage from './components/CreatorCenterPage.vue'
|
||
import { useCreatorAccess } from './composables/useCreatorAccess'
|
||
import { publishDramaApi } from '@/api/admin/creatorCenter'
|
||
import { listDramaCategoryOptionsApi } from '@/api/admin/drama'
|
||
import { captureVideoCover } from '@/utils/videoCover'
|
||
import { probeVideoDuration, uploadFile } from '@/utils/uploader'
|
||
|
||
const router = useRouter()
|
||
const { impersonating } = useCreatorAccess()
|
||
|
||
/* ---------- 分类字典 ---------- */
|
||
const categoryLoading = ref(false)
|
||
const categoryOptions = ref([])
|
||
async function loadCategories() {
|
||
categoryLoading.value = true
|
||
try {
|
||
const res = await listDramaCategoryOptionsApi()
|
||
// 接口返回的是 { code, message, data } 信封,真正的列表在 data 里
|
||
const list = res?.data || []
|
||
categoryOptions.value = Array.isArray(list)
|
||
? list
|
||
.filter((c) => c.status == null || Number(c.status) === 1)
|
||
.sort((a, b) => (a.sort || 0) - (b.sort || 0))
|
||
: []
|
||
} catch {
|
||
// 下拉失败不让发布流程中断;只是用户没法选分类
|
||
} finally {
|
||
categoryLoading.value = false
|
||
}
|
||
}
|
||
onMounted(loadCategories)
|
||
|
||
/* ---------- 视频列表 ---------- */
|
||
let seq = 0
|
||
const items = ref([])
|
||
const submitting = ref(false)
|
||
const submittingMode = ref('')
|
||
|
||
/* ---------- 步骤:1 作品信息 → 2 上传视频 ---------- */
|
||
const step = ref(1)
|
||
const canNext = computed(() => !submitting.value && !!form.value.title.trim())
|
||
function nextStep() {
|
||
if (!canNext.value) {
|
||
ElMessage.warning('请先填写作品名称')
|
||
return
|
||
}
|
||
step.value = 2
|
||
}
|
||
function prevStep() {
|
||
if (submitting.value) return
|
||
step.value = 1
|
||
}
|
||
|
||
/* ---------- 作品信息 ---------- */
|
||
const form = ref({
|
||
title: '',
|
||
categoryId: null,
|
||
genre: '',
|
||
description: ''
|
||
})
|
||
|
||
/* ---------- 作品封面 ---------- */
|
||
const cover = ref({
|
||
file: null,
|
||
preview: '',
|
||
url: ''
|
||
})
|
||
const coverDirty = computed(() => {
|
||
if (cover.value.file) return true
|
||
return !!cover.value.preview && !cover.value.url
|
||
})
|
||
const coverMenuVisible = ref(false)
|
||
function toggleCoverMenu() {
|
||
if (submitting.value) return
|
||
coverMenuVisible.value = !coverMenuVisible.value
|
||
}
|
||
function closeCoverMenu() {
|
||
coverMenuVisible.value = false
|
||
}
|
||
|
||
/* ---------- 隐藏的 input ---------- */
|
||
const coverPickFileRef = ref(null)
|
||
const coverCaptureRef = ref(null)
|
||
const videoUploadRef = ref(null)
|
||
const videoCaptureRef = ref(null)
|
||
|
||
const hasFiles = computed(() => items.value.length > 0)
|
||
const videoCount = computed(() => items.value.length)
|
||
const overallPercent = computed(() => {
|
||
if (!items.value.length) return 0
|
||
return Math.round(items.value.reduce((sum, item) => sum + item.percent, 0) / items.value.length)
|
||
})
|
||
const canPublish = computed(
|
||
() => !submitting.value && !impersonating.value && hasFiles.value && form.value.title.trim()
|
||
)
|
||
|
||
/* ---------- 工具 ---------- */
|
||
function formatSize(bytes) {
|
||
if (!bytes) return '0 MB'
|
||
return `${(bytes / 1024 / 1024).toFixed(1)} MB`
|
||
}
|
||
function formatDuration(seconds) {
|
||
if (!seconds) return '—'
|
||
const total = Math.round(seconds)
|
||
return `${Math.floor(total / 60)}:${String(total % 60).padStart(2, '0')}`
|
||
}
|
||
function defaultTitle(index) {
|
||
return `第 ${index + 1} 集`
|
||
}
|
||
|
||
function syncCoverFromFirstItem() {
|
||
const first = items.value[0]
|
||
if (!first) {
|
||
if (!cover.value.file) {
|
||
if (cover.value.preview) URL.revokeObjectURL(cover.value.preview)
|
||
cover.value.preview = ''
|
||
cover.value.url = ''
|
||
}
|
||
return
|
||
}
|
||
if (cover.value.file || cover.value.url) return
|
||
if (first.coverPreview) {
|
||
if (cover.value.preview !== first.coverPreview) {
|
||
if (cover.value.preview) URL.revokeObjectURL(cover.value.preview)
|
||
cover.value.preview = first.coverPreview
|
||
}
|
||
} else {
|
||
if (cover.value.preview) URL.revokeObjectURL(cover.value.preview)
|
||
cover.value.preview = ''
|
||
}
|
||
}
|
||
|
||
/* ---------- 封面处理 ---------- */
|
||
function onPickCover(event) {
|
||
const file = event.target.files?.[0]
|
||
event.target.value = ''
|
||
if (!file) return
|
||
if (!file.type.startsWith('image/')) {
|
||
ElMessage.warning('请上传图片作为封面')
|
||
return
|
||
}
|
||
if (file.size > 5 * 1024 * 1024) {
|
||
ElMessage.warning('封面图片不超过 5MB')
|
||
return
|
||
}
|
||
if (cover.value.preview) URL.revokeObjectURL(cover.value.preview)
|
||
cover.value.file = file
|
||
cover.value.url = ''
|
||
cover.value.preview = URL.createObjectURL(file)
|
||
}
|
||
function clearCover() {
|
||
if (cover.value.preview) URL.revokeObjectURL(cover.value.preview)
|
||
cover.value.file = null
|
||
cover.value.url = ''
|
||
cover.value.preview = ''
|
||
syncCoverFromFirstItem()
|
||
}
|
||
|
||
/* ---------- 视频处理 ---------- */
|
||
async function onPickFiles(event) {
|
||
const files = Array.from(event.target.files || []).filter(
|
||
(file) => file.type.startsWith('video/') || /\.(mp4|mov|m4v|webm|mkv|avi)$/i.test(file.name)
|
||
)
|
||
event.target.value = ''
|
||
if (!files.length) {
|
||
ElMessage.warning('请选择视频文件')
|
||
return
|
||
}
|
||
const startIndex = items.value.length
|
||
for (const file of files) {
|
||
seq += 1
|
||
const item = {
|
||
id: `pv-${seq}`,
|
||
file,
|
||
fileName: file.name,
|
||
fileSize: file.size,
|
||
title: defaultTitle(items.value.length),
|
||
durationSec: 0,
|
||
coverFile: null,
|
||
coverPreview: '',
|
||
coverUrl: '',
|
||
assetId: 0,
|
||
percent: 0,
|
||
status: 'ready',
|
||
error: ''
|
||
}
|
||
items.value.push(item)
|
||
void hydrate(item)
|
||
}
|
||
if (!form.value.title.trim()) {
|
||
form.value.title = files[0].name.replace(/\.[^.]+$/, '')
|
||
}
|
||
if (startIndex > 0) renumber()
|
||
}
|
||
async function hydrate(item) {
|
||
try {
|
||
item.durationSec = await probeVideoDuration(item.file)
|
||
} catch {
|
||
item.durationSec = 0
|
||
}
|
||
try {
|
||
const cv = await captureVideoCover(item.file)
|
||
if (!items.value.includes(item)) return
|
||
item.coverFile = cv.file
|
||
item.coverPreview = cv.previewUrl
|
||
if (items.value[0] === item && !cover.value.file && !cover.value.url) {
|
||
if (cover.value.preview && cover.value.preview !== item.coverPreview) {
|
||
URL.revokeObjectURL(cover.value.preview)
|
||
}
|
||
cover.value.preview = item.coverPreview
|
||
}
|
||
} catch {
|
||
// 截帧失败不阻断发布
|
||
}
|
||
}
|
||
function renumber() {
|
||
items.value.forEach((item, index) => {
|
||
if (item.title === defaultTitle(index) || /^第\s*\d+\s*集$/.test(item.title)) {
|
||
item.title = defaultTitle(index)
|
||
}
|
||
})
|
||
}
|
||
function removeItem(item) {
|
||
if (submitting.value) return
|
||
const index = items.value.indexOf(item)
|
||
if (index < 0) return
|
||
items.value.splice(index, 1)
|
||
renumber()
|
||
syncCoverFromFirstItem()
|
||
}
|
||
function moveItem(item, delta) {
|
||
if (submitting.value) return
|
||
const index = items.value.indexOf(item)
|
||
const target = index + delta
|
||
if (index < 0 || target < 0 || target >= items.value.length) return
|
||
const [moved] = items.value.splice(index, 1)
|
||
items.value.splice(target, 0, moved)
|
||
renumber()
|
||
syncCoverFromFirstItem()
|
||
}
|
||
|
||
/* ---------- 上传 ---------- */
|
||
async function uploadItem(item) {
|
||
item.error = ''
|
||
item.status = 'uploading'
|
||
try {
|
||
if (item.coverFile && !item.coverUrl) {
|
||
const coverAsset = await uploadFile(item.coverFile, { bizType: 'DRAMA_COVER' })
|
||
item.coverUrl = coverAsset.url
|
||
}
|
||
if (!item.assetId) {
|
||
const asset = await uploadFile(item.file, {
|
||
bizType: 'EPISODE',
|
||
durationSec: item.durationSec || undefined,
|
||
onProgress: (percent) => {
|
||
item.percent = percent
|
||
}
|
||
})
|
||
item.assetId = asset.id
|
||
if (asset.durationSec != null && !item.durationSec) item.durationSec = asset.durationSec
|
||
}
|
||
item.percent = 100
|
||
item.status = 'done'
|
||
} catch (error) {
|
||
item.status = 'failed'
|
||
item.error = (error && error.message) || '上传失败,请重试'
|
||
throw error
|
||
}
|
||
}
|
||
async function ensureCoverUploaded() {
|
||
if (!coverDirty.value) return cover.value.url || undefined
|
||
if (cover.value.file) {
|
||
const asset = await uploadFile(cover.value.file, { bizType: 'DRAMA_COVER' })
|
||
cover.value.url = asset.url
|
||
return asset.url
|
||
}
|
||
const first = items.value[0]
|
||
if (first?.coverUrl) {
|
||
cover.value.url = first.coverUrl
|
||
return first.coverUrl
|
||
}
|
||
return undefined
|
||
}
|
||
|
||
/* ---------- 发布 ---------- */
|
||
async function publish(submit = true) {
|
||
if (impersonating.value) return
|
||
if (!hasFiles.value) {
|
||
ElMessage.warning('请先选择或拍摄视频')
|
||
return
|
||
}
|
||
if (!form.value.title.trim()) {
|
||
ElMessage.warning('请填写作品名称')
|
||
return
|
||
}
|
||
submitting.value = true
|
||
submittingMode.value = submit ? 'publish' : 'draft'
|
||
try {
|
||
const coverUrl = await ensureCoverUploaded()
|
||
for (const item of items.value) {
|
||
await uploadItem(item)
|
||
}
|
||
const payload = {
|
||
title: form.value.title.trim(),
|
||
categoryId: form.value.categoryId || undefined,
|
||
genre: form.value.genre?.trim() || undefined,
|
||
description: form.value.description?.trim() || undefined,
|
||
cover: coverUrl,
|
||
language: 'zh-CN',
|
||
submit,
|
||
episodes: items.value.map((item, index) => ({
|
||
assetId: item.assetId,
|
||
title: item.title || defaultTitle(index),
|
||
durationSec: Math.round(item.durationSec) || undefined,
|
||
cover: item.coverUrl || undefined
|
||
}))
|
||
}
|
||
const result = await publishDramaApi(payload)
|
||
ElMessage.success(submit ? '发布成功,已提交审核' : '已保存为草稿')
|
||
router.push(`/creator-center/dramas/${result.dramaId}`)
|
||
} catch (error) {
|
||
const message = (error && error.message) || '发布失败'
|
||
ElMessage.error(message)
|
||
} finally {
|
||
submitting.value = false
|
||
submittingMode.value = ''
|
||
}
|
||
}
|
||
|
||
function goBack() {
|
||
if (submitting.value) {
|
||
ElMessage.warning('正在上传,请等待完成')
|
||
return
|
||
}
|
||
router.push('/creator-center/workspace')
|
||
}
|
||
|
||
onBeforeUnmount(() => {
|
||
items.value.forEach((item) => {
|
||
if (item.coverPreview) URL.revokeObjectURL(item.coverPreview)
|
||
})
|
||
if (cover.value.preview) URL.revokeObjectURL(cover.value.preview)
|
||
})
|
||
</script>
|
||
|
||
<template>
|
||
<CreatorCenterPage>
|
||
<PageHeading
|
||
eyebrow="创作者中心"
|
||
title="发布作品"
|
||
description="拍视频、传封面、填标题,和抖音一样一步发布。"
|
||
>
|
||
<el-button :disabled="submitting" @click="goBack">返回我的作品</el-button>
|
||
</PageHeading>
|
||
|
||
<el-alert
|
||
v-if="impersonating"
|
||
type="warning"
|
||
:closable="false"
|
||
show-icon
|
||
title="代看模式下不能发布作品"
|
||
class="publish-alert"
|
||
/>
|
||
|
||
<div class="publish-stage">
|
||
<!-- 第一步:左封面 + 右作品信息 -->
|
||
<section v-show="step === 1" class="panel publish-block">
|
||
<div class="publish-block-head">
|
||
<span><em class="publish-step-no">1</em>作品信息</span>
|
||
<span class="console-count">下一步上传视频</span>
|
||
</div>
|
||
|
||
<div class="publish-info-row">
|
||
<!-- 左:封面 -->
|
||
<div class="cover-wrap">
|
||
<!-- 遮罩:点菜单外关闭 -->
|
||
<div v-if="coverMenuVisible" class="cover-menu-shim" @click="closeCoverMenu"></div>
|
||
|
||
<button
|
||
type="button"
|
||
class="cover-main"
|
||
:class="{ 'has-cover': cover.preview }"
|
||
:disabled="submitting"
|
||
@click="toggleCoverMenu"
|
||
>
|
||
<img v-if="cover.preview" :src="cover.preview" alt="作品封面" />
|
||
<div v-else class="cover-placeholder">
|
||
<span class="cover-plus">+</span>
|
||
<span class="cover-text">点击上传封面</span>
|
||
<span class="cover-hint">3:4 竖版 · 720×960</span>
|
||
</div>
|
||
<div class="cover-mask"><span>更换封面</span></div>
|
||
</button>
|
||
|
||
<ul v-if="coverMenuVisible" class="cover-menu">
|
||
<li
|
||
:class="{ disabled: submitting }"
|
||
@click="!submitting && (closeCoverMenu(), coverPickFileRef?.click())"
|
||
>
|
||
📁 从相册选图片
|
||
</li>
|
||
<li
|
||
:class="{ disabled: submitting }"
|
||
@click="!submitting && (closeCoverMenu(), coverCaptureRef?.click())"
|
||
>
|
||
📷 拍照作为封面
|
||
</li>
|
||
<li
|
||
v-if="cover.preview"
|
||
:class="{ disabled: submitting, divider: true }"
|
||
@click="!submitting && (closeCoverMenu(), clearCover())"
|
||
>
|
||
移除封面(使用视频首帧)
|
||
</li>
|
||
</ul>
|
||
|
||
<!-- 隐藏的两个 input -->
|
||
<input
|
||
ref="coverPickFileRef"
|
||
type="file"
|
||
accept="image/*"
|
||
hidden
|
||
:disabled="submitting"
|
||
@change="onPickCover"
|
||
/>
|
||
<input
|
||
ref="coverCaptureRef"
|
||
type="file"
|
||
accept="image/*"
|
||
capture="environment"
|
||
hidden
|
||
:disabled="submitting"
|
||
@change="onPickCover"
|
||
/>
|
||
</div>
|
||
|
||
<!-- 右:表单 -->
|
||
<div class="publish-form-col">
|
||
<el-form label-position="top" class="publish-form">
|
||
<el-form-item label="作品名称" required>
|
||
<el-input
|
||
v-model="form.title"
|
||
maxlength="64"
|
||
placeholder="例如:闪婚后,傅先生每天都在撒糖"
|
||
:disabled="submitting"
|
||
/>
|
||
</el-form-item>
|
||
<div class="publish-form-grid">
|
||
<el-form-item label="分类">
|
||
<el-select
|
||
v-model="form.categoryId"
|
||
:loading="categoryLoading"
|
||
:disabled="submitting"
|
||
placeholder="请选择分类"
|
||
clearable
|
||
style="width: 100%"
|
||
>
|
||
<el-option
|
||
v-for="opt in categoryOptions"
|
||
:key="opt.id"
|
||
:label="opt.name"
|
||
:value="opt.id"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="题材标签">
|
||
<el-input
|
||
v-model="form.genre"
|
||
maxlength="32"
|
||
placeholder="例如:闪婚、霸总"
|
||
:disabled="submitting"
|
||
/>
|
||
</el-form-item>
|
||
</div>
|
||
<el-form-item label="简介">
|
||
<el-input
|
||
v-model="form.description"
|
||
type="textarea"
|
||
:rows="3"
|
||
maxlength="200"
|
||
show-word-limit
|
||
:disabled="submitting"
|
||
placeholder="一句话简介这部剧的核心情节(选填)"
|
||
/>
|
||
</el-form-item>
|
||
</el-form>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- 第二步:视频上传 -->
|
||
<section v-show="step === 2" class="panel publish-block">
|
||
<div class="publish-block-head">
|
||
<span><em class="publish-step-no">2</em>上传视频</span>
|
||
<span class="console-count">已选 {{ videoCount }} 集</span>
|
||
</div>
|
||
|
||
<div class="video-entry-row">
|
||
<button
|
||
type="button"
|
||
class="video-entry"
|
||
:disabled="submitting"
|
||
@click="videoUploadRef?.click()"
|
||
>
|
||
<div class="video-entry-icon">📁</div>
|
||
<div class="video-entry-body">
|
||
<div class="video-entry-title">上传视频</div>
|
||
<div class="video-entry-hint">支持多选,按顺序自动连集;也可以重复点击继续追加</div>
|
||
</div>
|
||
</button>
|
||
<button
|
||
type="button"
|
||
class="video-entry"
|
||
:disabled="submitting"
|
||
@click="videoCaptureRef?.click()"
|
||
>
|
||
<div class="video-entry-icon">🎥</div>
|
||
<div class="video-entry-body">
|
||
<div class="video-entry-title">拍摄视频</div>
|
||
<div class="video-entry-hint">直接用相机拍摄一集,拍完继续拍下一集</div>
|
||
</div>
|
||
</button>
|
||
</div>
|
||
|
||
<!-- 隐藏的两个 input -->
|
||
<input
|
||
ref="videoUploadRef"
|
||
type="file"
|
||
accept="video/*"
|
||
multiple
|
||
hidden
|
||
:disabled="submitting"
|
||
@change="onPickFiles"
|
||
/>
|
||
<input
|
||
ref="videoCaptureRef"
|
||
type="file"
|
||
accept="video/*"
|
||
capture="environment"
|
||
hidden
|
||
:disabled="submitting"
|
||
@change="onPickFiles"
|
||
/>
|
||
|
||
<!-- 已选列表 -->
|
||
<div v-if="hasFiles" class="publish-list">
|
||
<div v-for="(item, index) in items" :key="item.id" class="publish-item">
|
||
<div class="publish-item-cover">
|
||
<img v-if="item.coverPreview" :src="item.coverPreview" :alt="item.title" />
|
||
<span v-else>{{ index + 1 }}</span>
|
||
<em class="publish-item-index">{{ index + 1 }}</em>
|
||
</div>
|
||
<div class="publish-item-body">
|
||
<el-input
|
||
v-model="item.title"
|
||
maxlength="40"
|
||
:disabled="submitting"
|
||
class="publish-item-title"
|
||
/>
|
||
<div class="publish-item-meta">
|
||
<span>{{ formatDuration(item.durationSec) }}</span>
|
||
<span>{{ formatSize(item.fileSize) }}</span>
|
||
<span v-if="item.status === 'uploading'" class="publish-item-status">
|
||
上传中 {{ item.percent }}%
|
||
</span>
|
||
<span v-else-if="item.status === 'done'" class="publish-item-status is-done"
|
||
>已上传</span
|
||
>
|
||
<span v-else-if="item.status === 'failed'" class="publish-item-status is-fail"
|
||
>上传失败</span
|
||
>
|
||
</div>
|
||
<el-progress
|
||
v-if="item.status === 'uploading'"
|
||
:percentage="item.percent"
|
||
:stroke-width="4"
|
||
:show-text="false"
|
||
/>
|
||
<span v-if="item.error" class="publish-item-error">{{ item.error }}</span>
|
||
</div>
|
||
<div class="publish-item-actions">
|
||
<el-button text :disabled="submitting || index === 0" @click="moveItem(item, -1)"
|
||
>上移</el-button
|
||
>
|
||
<el-button
|
||
text
|
||
:disabled="submitting || index === items.length - 1"
|
||
@click="moveItem(item, 1)"
|
||
>下移</el-button
|
||
>
|
||
<el-button text type="danger" :disabled="submitting" @click="removeItem(item)"
|
||
>删除</el-button
|
||
>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
|
||
<!-- sticky footer -->
|
||
<div class="publish-footer">
|
||
<span v-if="submitting" class="console-muted">总进度 {{ overallPercent }}%</span>
|
||
<template v-if="step === 1">
|
||
<el-button :disabled="submitting" @click="goBack">取消</el-button>
|
||
<el-button type="primary" :disabled="!canNext" @click="nextStep">
|
||
下一步:上传视频
|
||
</el-button>
|
||
</template>
|
||
<template v-else>
|
||
<el-button :disabled="submitting" @click="prevStep">上一步</el-button>
|
||
<el-button
|
||
:disabled="!canPublish"
|
||
:loading="submittingMode === 'draft'"
|
||
@click="publish(false)"
|
||
>存草稿</el-button
|
||
>
|
||
<el-button
|
||
type="primary"
|
||
:disabled="!canPublish"
|
||
:loading="submittingMode === 'publish'"
|
||
@click="publish(true)"
|
||
>发布并提交审核</el-button
|
||
>
|
||
</template>
|
||
</div>
|
||
<div class="publish-footer-space" aria-hidden="true"></div>
|
||
</CreatorCenterPage>
|
||
</template>
|
||
|
||
<style scoped>
|
||
.publish-alert {
|
||
margin-bottom: 16px;
|
||
}
|
||
|
||
/* ---------- 舞台 ---------- */
|
||
|
||
.publish-stage {
|
||
max-width: 960px;
|
||
margin: 0 auto;
|
||
}
|
||
|
||
.publish-block {
|
||
padding: 24px;
|
||
margin-bottom: 16px;
|
||
}
|
||
|
||
.publish-block-head {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-bottom: 18px;
|
||
font-size: 15px;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.publish-step-no {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 20px;
|
||
height: 20px;
|
||
margin-right: 8px;
|
||
border-radius: 50%;
|
||
background: var(--el-color-primary);
|
||
color: #fff;
|
||
font-size: 12px;
|
||
font-style: normal;
|
||
font-weight: 600;
|
||
vertical-align: middle;
|
||
}
|
||
|
||
/* ---------- 左封面 + 右表单 ---------- */
|
||
|
||
.publish-info-row {
|
||
display: grid;
|
||
grid-template-columns: 240px 1fr;
|
||
gap: 28px;
|
||
align-items: start;
|
||
}
|
||
|
||
/* ---------- 封面 ---------- */
|
||
|
||
.cover-wrap {
|
||
position: relative;
|
||
display: flex;
|
||
justify-content: center;
|
||
}
|
||
|
||
.cover-menu-shim {
|
||
position: fixed;
|
||
inset: 0;
|
||
z-index: 9;
|
||
}
|
||
|
||
.cover-main {
|
||
position: relative;
|
||
display: block;
|
||
width: 100%;
|
||
aspect-ratio: 3 / 4;
|
||
padding: 0;
|
||
margin: 0;
|
||
overflow: hidden;
|
||
cursor: pointer;
|
||
background: #f5f6f8;
|
||
border: 1.5px dashed var(--console-border, #d9d9d9);
|
||
border-radius: 14px;
|
||
transition:
|
||
border-color 0.2s ease,
|
||
box-shadow 0.2s ease;
|
||
font-family: inherit;
|
||
color: inherit;
|
||
}
|
||
|
||
.cover-main:hover:not(:disabled) {
|
||
border-color: var(--el-color-primary);
|
||
box-shadow: 0 0 0 3px rgb(64 158 255 / 15%);
|
||
}
|
||
|
||
.cover-main:disabled {
|
||
cursor: not-allowed;
|
||
opacity: 0.6;
|
||
}
|
||
|
||
.cover-main.has-cover {
|
||
border-style: solid;
|
||
border-color: transparent;
|
||
}
|
||
|
||
.cover-main img {
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
}
|
||
|
||
.cover-placeholder {
|
||
position: absolute;
|
||
inset: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
gap: 6px;
|
||
color: var(--console-muted, #909399);
|
||
}
|
||
|
||
.cover-plus {
|
||
font-size: 40px;
|
||
line-height: 1;
|
||
color: var(--el-color-primary);
|
||
}
|
||
|
||
.cover-text {
|
||
font-size: 14px;
|
||
font-weight: 500;
|
||
color: var(--el-text-color-primary);
|
||
}
|
||
|
||
.cover-hint {
|
||
font-size: 11px;
|
||
}
|
||
|
||
.cover-mask {
|
||
position: absolute;
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
padding: 8px;
|
||
font-size: 12px;
|
||
font-weight: 500;
|
||
text-align: center;
|
||
color: #fff;
|
||
background: linear-gradient(to top, rgb(0 0 0 / 60%), transparent);
|
||
opacity: 0;
|
||
transform: translateY(6px);
|
||
transition:
|
||
opacity 0.2s ease,
|
||
transform 0.2s ease;
|
||
}
|
||
|
||
.cover-main.has-cover:hover .cover-mask {
|
||
opacity: 1;
|
||
transform: translateY(0);
|
||
}
|
||
|
||
.cover-menu {
|
||
position: absolute;
|
||
top: 100%;
|
||
left: 50%;
|
||
z-index: 10;
|
||
min-width: 200px;
|
||
margin: 10px 0 0 -100px;
|
||
padding: 6px 0;
|
||
list-style: none;
|
||
background: #fff;
|
||
border-radius: 10px;
|
||
box-shadow: 0 6px 20px rgb(0 0 0 / 12%);
|
||
}
|
||
|
||
.cover-menu li {
|
||
padding: 9px 18px;
|
||
font-size: 14px;
|
||
cursor: pointer;
|
||
color: var(--el-text-color-regular);
|
||
transition: background 0.15s ease;
|
||
}
|
||
|
||
.cover-menu li:hover:not(.disabled) {
|
||
background: var(--el-fill-color-light);
|
||
color: var(--el-color-primary);
|
||
}
|
||
|
||
.cover-menu li.disabled {
|
||
color: var(--el-text-color-placeholder);
|
||
cursor: not-allowed;
|
||
}
|
||
|
||
.cover-menu li.divider {
|
||
margin-top: 6px;
|
||
border-top: 1px solid var(--el-border-color-lighter);
|
||
}
|
||
|
||
/* ---------- 表单 ---------- */
|
||
|
||
.publish-form-col {
|
||
min-width: 0;
|
||
}
|
||
|
||
.publish-form {
|
||
max-width: none;
|
||
}
|
||
|
||
.publish-form-grid {
|
||
display: grid;
|
||
grid-template-columns: 1fr 1fr;
|
||
gap: 16px;
|
||
}
|
||
|
||
/* ---------- 视频主入口 ---------- */
|
||
|
||
.video-entry-row {
|
||
display: grid;
|
||
grid-template-columns: 1fr 1fr;
|
||
gap: 12px;
|
||
}
|
||
|
||
.video-entry {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 14px;
|
||
padding: 22px 20px;
|
||
cursor: pointer;
|
||
border: 1.5px dashed var(--console-border, #d9d9d9);
|
||
border-radius: 14px;
|
||
background: transparent;
|
||
transition:
|
||
border-color 0.2s ease,
|
||
box-shadow 0.2s ease;
|
||
font-family: inherit;
|
||
color: inherit;
|
||
text-align: left;
|
||
}
|
||
|
||
.video-entry:hover:not(:disabled) {
|
||
border-color: var(--el-color-primary);
|
||
box-shadow: 0 0 0 3px rgb(64 158 255 / 15%);
|
||
}
|
||
|
||
.video-entry:disabled {
|
||
cursor: not-allowed;
|
||
opacity: 0.6;
|
||
}
|
||
|
||
.video-entry-icon {
|
||
flex-shrink: 0;
|
||
font-size: 32px;
|
||
line-height: 1;
|
||
}
|
||
|
||
.video-entry-title {
|
||
font-size: 15px;
|
||
font-weight: 600;
|
||
margin-bottom: 4px;
|
||
}
|
||
|
||
.video-entry-hint {
|
||
font-size: 12px;
|
||
color: var(--console-muted, #909399);
|
||
line-height: 1.4;
|
||
}
|
||
|
||
/* ---------- 已选列表 ---------- */
|
||
|
||
.publish-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 12px;
|
||
margin-top: 18px;
|
||
}
|
||
|
||
.publish-item {
|
||
display: flex;
|
||
gap: 12px;
|
||
align-items: flex-start;
|
||
padding: 12px;
|
||
border: 1px solid var(--console-border, #ebeef5);
|
||
border-radius: 12px;
|
||
}
|
||
|
||
.publish-item-cover {
|
||
position: relative;
|
||
display: flex;
|
||
flex-shrink: 0;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 60px;
|
||
height: 80px;
|
||
overflow: hidden;
|
||
font-size: 18px;
|
||
font-weight: 600;
|
||
color: #fff;
|
||
background: #303133;
|
||
border-radius: 8px;
|
||
}
|
||
|
||
.publish-item-cover img {
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
}
|
||
|
||
.publish-item-index {
|
||
position: absolute;
|
||
top: 4px;
|
||
left: 4px;
|
||
min-width: 18px;
|
||
height: 18px;
|
||
font-size: 11px;
|
||
font-style: normal;
|
||
line-height: 18px;
|
||
text-align: center;
|
||
background: rgb(0 0 0 / 60%);
|
||
border-radius: 9px;
|
||
}
|
||
|
||
.publish-item-body {
|
||
display: flex;
|
||
flex: 1;
|
||
flex-direction: column;
|
||
gap: 6px;
|
||
min-width: 0;
|
||
}
|
||
|
||
.publish-item-title :deep(.el-input__inner) {
|
||
font-weight: 600;
|
||
}
|
||
|
||
.publish-item-meta {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 10px;
|
||
font-size: 12px;
|
||
color: var(--console-muted, #909399);
|
||
}
|
||
|
||
.publish-item-status.is-done {
|
||
color: var(--el-color-success);
|
||
}
|
||
|
||
.publish-item-status.is-fail,
|
||
.publish-item-error {
|
||
color: var(--el-color-danger);
|
||
}
|
||
|
||
.publish-item-error {
|
||
font-size: 12px;
|
||
}
|
||
|
||
.publish-item-actions {
|
||
display: flex;
|
||
flex-shrink: 0;
|
||
flex-direction: column;
|
||
gap: 2px;
|
||
}
|
||
|
||
/* ---------- footer ---------- */
|
||
|
||
.publish-footer {
|
||
position: sticky;
|
||
bottom: 0;
|
||
display: flex;
|
||
gap: 12px;
|
||
align-items: center;
|
||
justify-content: flex-end;
|
||
padding: 12px 24px;
|
||
margin-top: 8px;
|
||
background: var(--console-panel, #fff);
|
||
border-top: 1px solid var(--console-border, #ebeef5);
|
||
}
|
||
|
||
.publish-footer .console-muted {
|
||
margin-right: auto;
|
||
font-size: 12px;
|
||
}
|
||
|
||
.publish-footer-space {
|
||
display: none;
|
||
}
|
||
|
||
/* ---------- 断点 ---------- */
|
||
|
||
@media (width <= 768px) {
|
||
.publish-block {
|
||
padding: 18px 16px;
|
||
}
|
||
|
||
.publish-info-row {
|
||
grid-template-columns: 1fr;
|
||
}
|
||
|
||
.cover-main {
|
||
max-width: 160px;
|
||
margin: 0 auto;
|
||
}
|
||
|
||
.publish-form-grid {
|
||
grid-template-columns: 1fr;
|
||
}
|
||
|
||
.video-entry-row {
|
||
grid-template-columns: 1fr;
|
||
}
|
||
|
||
.video-entry {
|
||
padding: 18px 16px;
|
||
}
|
||
|
||
.publish-item {
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.publish-item-actions {
|
||
flex-direction: row;
|
||
width: 100%;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.publish-footer {
|
||
position: fixed;
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
z-index: 10;
|
||
padding-bottom: calc(12px + env(safe-area-inset-bottom));
|
||
}
|
||
|
||
.publish-footer .el-button {
|
||
flex: 1;
|
||
}
|
||
|
||
.publish-footer-space {
|
||
display: block;
|
||
height: 84px;
|
||
}
|
||
}
|
||
</style>
|