style: 视频工具页改横排两栏布局 — 左侧三组卡片单行横排+右侧固定处理面板, 一屏无滚动条(加入宽屏白名单)
This commit is contained in:
1 parent
ae2448aefb
commit
255ba33e11
2 files changed
+203
-192
No files matched your search
@@ -40,7 +40,7 @@ useHead(head);
|
||||
const { t } = useI18n();
|
||||
|
||||
// 宽屏工具:不受 600px 限宽,占满可用宽度(画布/多栏类工具)
|
||||
const WIDE_TOOLS = new Set(['/label-designer', '/json-prettify', '/pdf-tools', '/image-tools', '/doc-convert']);
|
||||
const WIDE_TOOLS = new Set(['/label-designer', '/json-prettify', '/pdf-tools', '/image-tools', '/doc-convert', '/video-tools']);
|
||||
const isWide = computed(() => WIDE_TOOLS.has(route.path));
|
||||
|
||||
const i18nKey = computed<string>(() => route.path.trim().replace('/', ''));
|
||||
|
||||
@@ -254,270 +254,282 @@ function download() {
|
||||
const isImageResult = computed(() => /\.(png|jpg|jpeg)$/i.test(resultName.value));
|
||||
</script>
|
||||
|
||||
|
||||
<template>
|
||||
<div class="vt-root">
|
||||
<div class="vt-hero">
|
||||
<div class="vt-hero-title">VideoKit · 视频工具箱</div>
|
||||
<div class="vt-hero-sub">
|
||||
视频格式转换、压缩、裁剪、变速、提取音频等 {{ allTools.length }} 个常用视频处理工具,服务端 ffmpeg 高速处理
|
||||
</div>
|
||||
<span class="vt-hero-title">VideoKit · 视频工具箱</span>
|
||||
<span class="vt-hero-sub">{{ allTools.length }} 个常用视频处理工具 · 服务端 ffmpeg 高速处理 · 最大 2GB</span>
|
||||
</div>
|
||||
|
||||
<div v-for="g in GROUPS" :key="g.title" class="vt-group">
|
||||
<div class="vt-group-head">
|
||||
<h3 class="vt-group-title">{{ g.title }} <span class="vt-count">{{ g.tools.length }}</span></h3>
|
||||
<span class="vt-group-sub">{{ g.subtitle }}</span>
|
||||
</div>
|
||||
<div class="vt-grid">
|
||||
<div
|
||||
v-for="t in g.tools"
|
||||
:key="t.op"
|
||||
class="vt-card"
|
||||
:class="{ active: t.op === currentOp }"
|
||||
@click="selectTool(t)"
|
||||
>
|
||||
<div class="vt-card-icon" :style="{ background: t.color + '22', color: t.color }">
|
||||
{{ t.icon }}
|
||||
<div class="vt-cols">
|
||||
<!-- left: tool cards -->
|
||||
<div class="vt-left">
|
||||
<div v-for="g in GROUPS" :key="g.title" class="vt-group">
|
||||
<div class="vt-group-head">
|
||||
<span class="vt-group-title">{{ g.title }}</span>
|
||||
<span class="vt-group-sub">{{ g.subtitle }}</span>
|
||||
</div>
|
||||
<div class="vt-card-name">
|
||||
{{ t.name }}
|
||||
</div>
|
||||
<div class="vt-card-desc">
|
||||
{{ t.desc }}
|
||||
</div>
|
||||
<div class="vt-card-tags">
|
||||
<span v-for="tag in t.tags" :key="tag" class="vt-tag">{{ tag }}</span>
|
||||
<div class="vt-grid">
|
||||
<div
|
||||
v-for="t in g.tools"
|
||||
:key="t.op"
|
||||
class="vt-card"
|
||||
:class="{ active: t.op === currentOp }"
|
||||
@click="selectTool(t)"
|
||||
>
|
||||
<div class="vt-card-icon" :style="{ background: t.color + '22', color: t.color }">
|
||||
{{ t.icon }}
|
||||
</div>
|
||||
<div class="vt-card-body">
|
||||
<div class="vt-card-name">
|
||||
{{ t.name }}
|
||||
</div>
|
||||
<div class="vt-card-desc">
|
||||
{{ t.desc }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- right: processing panel (sticky) -->
|
||||
<div class="vt-right">
|
||||
<div id="video-panel" class="vt-panel">
|
||||
<div class="vt-panel-title">
|
||||
{{ current.icon }} {{ current.name }}
|
||||
</div>
|
||||
|
||||
<div class="vt-drop" @click="pickFile" @dragover.prevent @drop.prevent="onDrop">
|
||||
<input ref="fileInput" type="file" hidden accept="video/*,.mkv,.avi,.flv,.wmv,.ts,.gif,audio/*" @change="onFileInput">
|
||||
<template v-if="!file">
|
||||
<div class="vt-drop-hint">
|
||||
📁 点击或拖拽文件到这里
|
||||
</div>
|
||||
<div class="vt-drop-sub">
|
||||
MP4/WebM/MKV/MOV/AVI/GIF,最大 2GB
|
||||
</div>
|
||||
</template>
|
||||
<div v-else class="vt-file">
|
||||
🎞️ {{ file.name }} <span class="vt-file-size">({{ (file.size / 1024 / 1024).toFixed(1) }} MB)</span>
|
||||
<a href="javascript:;" class="vt-clear" @click.stop="setFile(null)">✕</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="current.params?.length" class="vt-params">
|
||||
<div v-for="p in current.params" :key="p.key" class="vt-param">
|
||||
<label class="vt-param-label">{{ p.label }}</label>
|
||||
<select v-if="p.type === 'select'" v-model="paramVals[p.key]" class="vt-select">
|
||||
<option v-for="o in p.options" :key="o.value" :value="o.value">{{ o.label }}</option>
|
||||
</select>
|
||||
<div v-else-if="p.type === 'slider'" class="vt-slider-row">
|
||||
<input v-model.number="paramVals[p.key]" type="range" :min="p.min" :max="p.max" :step="p.step" class="vt-slider">
|
||||
<span class="vt-slider-val">{{ paramVals[p.key] }}{{ p.unit ? ' ' + p.unit : '' }}</span>
|
||||
</div>
|
||||
<input v-else v-model="paramVals[p.key]" class="vt-input" type="number" min="0" step="0.1">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="vt-actions">
|
||||
<button class="vt-btn" :disabled="busy || !file" @click="process">
|
||||
{{ busy ? '⏳ 处理中,请稍候…' : '🚀 开始处理' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="error" class="vt-error">
|
||||
{{ error }}
|
||||
</div>
|
||||
|
||||
<div v-if="resultUrl" class="vt-result">
|
||||
<video v-if="!isImageResult" :src="resultUrl" controls class="vt-preview" />
|
||||
<img v-else :src="resultUrl" class="vt-preview-img" alt="result">
|
||||
<div class="vt-result-bar">
|
||||
<span class="vt-result-name">{{ resultName }}({{ (resultBlob?.size ?? 0) / 1024 / 1024 > 1 ? ((resultBlob!.size) / 1024 / 1024).toFixed(1) + ' MB' : ((resultBlob!.size) / 1024).toFixed(0) + ' KB' }} · {{ spent }}s)</span>
|
||||
<button class="vt-btn vt-btn-sm" @click="download">
|
||||
⬇ 下载
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<GenHistory tool="video-tools" label="视频处理记录" class="mt-10px" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- processing panel -->
|
||||
<div id="video-panel" class="vt-panel">
|
||||
<div class="vt-panel-title">
|
||||
{{ current.icon }} {{ current.name }}
|
||||
</div>
|
||||
|
||||
<div class="vt-drop" @click="pickFile" @dragover.prevent @drop.prevent="onDrop">
|
||||
<input ref="fileInput" type="file" hidden accept="video/*,.mkv,.avi,.flv,.wmv,.ts,.gif,audio/*" @change="onFileInput">
|
||||
<template v-if="!file">
|
||||
<div class="vt-drop-hint">
|
||||
📁 点击选择或拖拽文件到这里
|
||||
</div>
|
||||
<div class="vt-drop-sub">
|
||||
支持 MP4/WebM/MKV/MOV/AVI/GIF 及常见音视频格式,最大 2GB
|
||||
</div>
|
||||
</template>
|
||||
<div v-else class="vt-file">
|
||||
🎞️ {{ file.name }} <span class="vt-file-size">({{ (file.size / 1024 / 1024).toFixed(1) }} MB)</span>
|
||||
<a href="javascript:;" class="vt-clear" @click.stop="setFile(null)">✕ 换一个</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="current.params?.length" class="vt-params">
|
||||
<div v-for="p in current.params" :key="p.key" class="vt-param">
|
||||
<label class="vt-param-label">{{ p.label }}</label>
|
||||
<select
|
||||
v-if="p.type === 'select'"
|
||||
v-model="paramVals[p.key]"
|
||||
class="vt-select"
|
||||
>
|
||||
<option v-for="o in p.options" :key="o.value" :value="o.value">{{ o.label }}</option>
|
||||
</select>
|
||||
<div v-else-if="p.type === 'slider'" class="vt-slider-row">
|
||||
<input v-model.number="paramVals[p.key]" type="range" :min="p.min" :max="p.max" :step="p.step" class="vt-slider">
|
||||
<span class="vt-slider-val">{{ paramVals[p.key] }}{{ p.unit ? ' ' + p.unit : '' }}</span>
|
||||
</div>
|
||||
<input v-else v-model="paramVals[p.key]" class="vt-input" type="number" min="0" step="0.1">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="vt-actions">
|
||||
<button class="vt-btn" :disabled="busy || !file" @click="process">
|
||||
{{ busy ? '⏳ 处理中,请稍候…' : '🚀 开始处理' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="error" class="vt-error">
|
||||
{{ error }}
|
||||
</div>
|
||||
|
||||
<div v-if="resultUrl" class="vt-result">
|
||||
<video v-if="!isImageResult" :src="resultUrl" controls class="vt-preview" />
|
||||
<img v-else :src="resultUrl" class="vt-preview-img" alt="result">
|
||||
<div class="vt-result-bar">
|
||||
<span class="vt-result-name">{{ resultName }}({{ (resultBlob?.size ?? 0) / 1024 / 1024 > 1 ? ((resultBlob!.size) / 1024 / 1024).toFixed(1) + ' MB' : ((resultBlob!.size) / 1024).toFixed(0) + ' KB' }} · 用时 {{ spent }}s)</span>
|
||||
<button class="vt-btn vt-btn-sm" @click="download">
|
||||
⬇ 下载结果
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<GenHistory tool="video-tools" label="视频处理记录" class="mt-20px" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.vt-root {
|
||||
max-width: 1000px;
|
||||
margin: 0 auto;
|
||||
padding-bottom: 60px;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
|
||||
.vt-hero {
|
||||
text-align: center;
|
||||
margin: 10px 0 26px;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 12px;
|
||||
margin: 0 0 12px;
|
||||
|
||||
.vt-hero-title {
|
||||
font-size: 24px;
|
||||
font-size: 19px;
|
||||
font-weight: 800;
|
||||
background: linear-gradient(48deg, #25636c 0%, #3b956f 55%, #14a058 100%);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.vt-hero-sub {
|
||||
margin-top: 8px;
|
||||
font-size: 13px;
|
||||
opacity: 0.6;
|
||||
font-size: 12px;
|
||||
opacity: 0.55;
|
||||
}
|
||||
}
|
||||
|
||||
.vt-cols {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.vt-left {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.vt-right {
|
||||
width: 400px;
|
||||
flex-shrink: 0;
|
||||
position: sticky;
|
||||
top: 62px;
|
||||
}
|
||||
|
||||
// ---- groups & cards ----
|
||||
.vt-group {
|
||||
margin-bottom: 22px;
|
||||
margin-bottom: 12px;
|
||||
|
||||
.vt-group-head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
gap: 8px;
|
||||
margin-bottom: 6px;
|
||||
|
||||
.vt-group-title {
|
||||
font-size: 16px;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
margin: 0;
|
||||
|
||||
.vt-count {
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
opacity: 0.45;
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.vt-group-sub {
|
||||
font-size: 12px;
|
||||
opacity: 0.5;
|
||||
font-size: 11px;
|
||||
opacity: 0.45;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.vt-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
||||
gap: 10px;
|
||||
grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.vt-card {
|
||||
border: 1px solid rgba(128, 128, 128, 0.22);
|
||||
border-radius: 12px;
|
||||
padding: 13px 14px;
|
||||
border-radius: 10px;
|
||||
padding: 8px 10px;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
|
||||
transition: border-color 0.15s, box-shadow 0.12s;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
|
||||
&:hover {
|
||||
border-color: rgba(24, 160, 88, 0.55);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: #18a058;
|
||||
box-shadow: 0 0 0 1px #18a058;
|
||||
background: rgba(24, 160, 88, 0.04);
|
||||
}
|
||||
|
||||
.vt-card-icon {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 10px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 19px;
|
||||
margin-bottom: 8px;
|
||||
font-size: 15px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.vt-card-name {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.vt-card-body {
|
||||
min-width: 0;
|
||||
|
||||
.vt-card-desc {
|
||||
font-size: 12px;
|
||||
opacity: 0.62;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.vt-card-name {
|
||||
font-size: 12.5px;
|
||||
font-weight: 700;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.vt-card-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
|
||||
.vt-tag {
|
||||
.vt-card-desc {
|
||||
font-size: 10.5px;
|
||||
background: rgba(128, 128, 128, 0.1);
|
||||
border-radius: 5px;
|
||||
padding: 2px 7px;
|
||||
opacity: 0.75;
|
||||
opacity: 0.55;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
margin-top: 1px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// panel
|
||||
// ---- panel ----
|
||||
.vt-panel {
|
||||
border: 1.5px solid rgba(24, 160, 88, 0.4);
|
||||
border-radius: 14px;
|
||||
padding: 18px 20px;
|
||||
border-radius: 12px;
|
||||
padding: 12px 14px;
|
||||
background: rgba(24, 160, 88, 0.03);
|
||||
margin-top: 8px;
|
||||
|
||||
.vt-panel-title {
|
||||
font-size: 16px;
|
||||
font-size: 14.5px;
|
||||
font-weight: 800;
|
||||
margin-bottom: 12px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.vt-drop {
|
||||
border: 1.5px dashed rgba(128, 128, 128, 0.4);
|
||||
border-radius: 10px;
|
||||
border-radius: 9px;
|
||||
text-align: center;
|
||||
padding: 18px;
|
||||
padding: 12px;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s;
|
||||
margin-bottom: 12px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
&:hover {
|
||||
border-color: #18a058;
|
||||
}
|
||||
|
||||
.vt-drop-hint {
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.vt-drop-sub {
|
||||
font-size: 11.5px;
|
||||
font-size: 10.5px;
|
||||
opacity: 0.5;
|
||||
margin-top: 4px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.vt-file {
|
||||
font-size: 13.5px;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
.vt-file-size {
|
||||
font-weight: 400;
|
||||
@@ -526,9 +538,8 @@ const isImageResult = computed(() => /\.(png|jpg|jpeg)$/i.test(resultName.value)
|
||||
|
||||
.vt-clear {
|
||||
color: #d03050;
|
||||
margin-left: 12px;
|
||||
margin-left: 8px;
|
||||
text-decoration: none;
|
||||
font-weight: 400;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
@@ -539,18 +550,16 @@ const isImageResult = computed(() => /\.(png|jpg|jpeg)$/i.test(resultName.value)
|
||||
|
||||
.vt-params {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 14px 24px;
|
||||
margin-bottom: 12px;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.vt-param {
|
||||
min-width: 200px;
|
||||
|
||||
.vt-param-label {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
opacity: 0.65;
|
||||
margin-bottom: 4px;
|
||||
font-size: 11px;
|
||||
opacity: 0.6;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.vt-select,
|
||||
@@ -559,8 +568,8 @@ const isImageResult = computed(() => /\.(png|jpg|jpeg)$/i.test(resultName.value)
|
||||
box-sizing: border-box;
|
||||
border: 1px solid rgba(128, 128, 128, 0.35);
|
||||
border-radius: 7px;
|
||||
padding: 6px 10px;
|
||||
font-size: 13px;
|
||||
padding: 5px 9px;
|
||||
font-size: 12.5px;
|
||||
background: #fff;
|
||||
outline: none;
|
||||
|
||||
@@ -579,28 +588,27 @@ const isImageResult = computed(() => /\.(png|jpg|jpeg)$/i.test(resultName.value)
|
||||
}
|
||||
|
||||
.vt-slider-val {
|
||||
font-size: 12px;
|
||||
opacity: 0.7;
|
||||
min-width: 90px;
|
||||
font-size: 11px;
|
||||
opacity: 0.65;
|
||||
min-width: 86px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.vt-actions {
|
||||
margin-bottom: 6px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.vt-btn {
|
||||
background: #18a058;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 9px;
|
||||
padding: 9px 26px;
|
||||
font-size: 14.5px;
|
||||
border-radius: 8px;
|
||||
padding: 8px 22px;
|
||||
font-size: 13.5px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.15s;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
opacity: 0.85;
|
||||
@@ -612,45 +620,48 @@ const isImageResult = computed(() => /\.(png|jpg|jpeg)$/i.test(resultName.value)
|
||||
}
|
||||
|
||||
&.vt-btn-sm {
|
||||
padding: 6px 18px;
|
||||
font-size: 13px;
|
||||
padding: 5px 14px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.vt-error {
|
||||
color: #d03050;
|
||||
font-size: 12.5px;
|
||||
margin-top: 8px;
|
||||
font-size: 12px;
|
||||
margin-top: 6px;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.vt-result {
|
||||
margin-top: 14px;
|
||||
margin-top: 10px;
|
||||
|
||||
.vt-preview {
|
||||
width: 100%;
|
||||
max-height: 380px;
|
||||
border-radius: 10px;
|
||||
max-height: 300px;
|
||||
border-radius: 9px;
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.vt-preview-img {
|
||||
max-width: 100%;
|
||||
max-height: 380px;
|
||||
border-radius: 10px;
|
||||
max-height: 300px;
|
||||
border-radius: 9px;
|
||||
}
|
||||
|
||||
.vt-result-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
margin-top: 8px;
|
||||
gap: 8px;
|
||||
margin-top: 6px;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.vt-result-name {
|
||||
font-size: 12.5px;
|
||||
font-size: 11.5px;
|
||||
opacity: 0.7;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user