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

234 lines
5.2 KiB
Vue
Raw Normal View History

2025-11-13 01:06:28 +08:00
<script setup>
2026-02-25 21:30:24 +08:00
import { ref, onMounted } from 'vue'
2025-11-14 02:15:14 +08:00
import GradientButton from '@/components/GradientButton.vue'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
import { Label } from '@/components/ui/label'
2026-02-25 21:30:24 +08:00
import { usePointsConfigStore } from '@/stores/pointsConfig'
const pointsConfigStore = usePointsConfigStore()
// 加载积分配置
onMounted(() => {
pointsConfigStore.loadConfig()
})
2025-11-13 01:06:28 +08:00
const props = defineProps({
modelValue: {
type: Object,
required: true,
},
loading: {
type: Boolean,
default: false,
},
})
const emit = defineEmits(['update:modelValue', 'analyze', 'reset'])
const form = ref({ ...props.modelValue })
function handleAnalyze() {
emit('update:modelValue', { ...form.value })
emit('analyze')
}
function handleReset() {
form.value = { platform: '抖音', url: '', count: 20, sort_type: 0 }
emit('update:modelValue', { ...form.value })
emit('reset')
}
</script>
<template>
2026-01-27 00:39:12 +08:00
<section class="form-container">
<div class="form-space-y-6">
<!-- 平台选择 -->
<div class="form-field">
<Label class="form-label">平台</Label>
<RadioGroup v-model="form.platform" class="radio-group">
<div class="radio-item active">
<RadioGroupItem value="抖音" id="douyin" class="hidden" />
<label for="douyin" class="radio-label">抖音</label>
</div>
</RadioGroup>
</div>
<!-- 链接输入 -->
<div class="form-field">
<Label class="form-label">主页/视频链接</Label>
<Input
v-model="form.url"
2026-01-27 00:39:12 +08:00
placeholder="粘贴抖音主页或视频链接"
class="form-input h-11"
2025-11-13 01:06:28 +08:00
/>
</div>
2026-01-27 00:39:12 +08:00
<!-- 分析数量 -->
<div class="form-field">
<Label class="form-label">分析数量</Label>
2025-11-13 01:06:28 +08:00
<div class="slider-row">
2026-02-25 21:57:05 +08:00
<span class="slider-num">{{ form.count }}</span>
<input
type="range"
v-model.number="form.count"
min="1"
max="40"
class="level-slider"
/>
2025-11-13 01:06:28 +08:00
</div>
2026-01-27 00:39:12 +08:00
<div class="form-hint">建议 20-30 个内容</div>
</div>
2026-01-27 00:39:12 +08:00
<!-- 操作按钮 -->
<div class="button-row">
2025-11-14 02:15:14 +08:00
<GradientButton
text="开始分析"
:loading="loading"
loading-text="分析中…"
size="middle"
@click="handleAnalyze"
/>
<Button variant="outline" @click="handleReset">重置</Button>
</div>
2026-02-25 21:30:24 +08:00
<p class="points-hint">每次分析将消耗积分消耗量与分析数量相关</p>
</div>
2025-11-13 01:06:28 +08:00
</section>
</template>
<style scoped>
2026-01-27 00:39:12 +08:00
.form-container {
2026-02-25 23:44:01 +08:00
background: var(--color-bg-card);
border-radius: var(--radius-md);
padding: var(--space-4);
border: 1px solid var(--color-gray-200);
2025-11-13 01:06:28 +08:00
}
.form-space-y-6 {
display: flex;
flex-direction: column;
gap: var(--space-5);
}
.form-field {
display: flex;
flex-direction: column;
gap: var(--space-2);
}
.form-label {
font-size: var(--font-size-sm);
font-weight: 500;
color: var(--color-gray-700);
}
.form-input {
background: var(--color-gray-50);
border-color: var(--color-gray-300);
}
.radio-group {
display: flex;
gap: var(--space-2);
}
.radio-item {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0 var(--space-4);
height: 36px;
font-size: var(--font-size-sm);
font-weight: 500;
color: var(--color-gray-600);
background: var(--color-gray-50);
border: 1px solid var(--color-gray-300);
border-radius: var(--radius-base);
cursor: pointer;
transition: all var(--duration-fast);
}
.radio-item.active {
color: #fff;
background: var(--color-primary-500);
border-color: var(--color-primary-500);
}
.radio-label {
cursor: pointer;
}
2025-11-13 01:06:28 +08:00
.slider-row {
display: flex;
align-items: center;
2026-02-25 23:44:01 +08:00
gap: var(--space-3);
2026-02-25 21:57:05 +08:00
}
.slider-num {
min-width: 32px;
2026-02-25 23:44:01 +08:00
font-size: var(--font-size-sm);
2026-02-25 21:57:05 +08:00
font-weight: 600;
2026-02-25 23:44:01 +08:00
color: var(--color-primary-500);
2026-02-25 21:57:05 +08:00
text-align: center;
}
.level-slider {
flex: 1;
height: 4px;
-webkit-appearance: none;
appearance: none;
2026-02-25 23:44:01 +08:00
background: var(--color-gray-200);
2026-02-25 21:57:05 +08:00
border-radius: 2px;
outline: none;
&::-webkit-slider-thumb {
-webkit-appearance: none;
width: 16px;
height: 16px;
2026-02-25 23:44:01 +08:00
background: var(--color-primary-500);
2026-02-25 21:57:05 +08:00
border-radius: 50%;
cursor: pointer;
2026-02-25 23:44:01 +08:00
transition: transform var(--duration-fast), box-shadow var(--duration-fast);
2026-02-25 21:57:05 +08:00
&:hover {
transform: scale(1.15);
2026-02-25 23:44:01 +08:00
box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
2026-02-25 21:57:05 +08:00
}
}
&::-moz-range-thumb {
width: 16px;
height: 16px;
2026-02-25 23:44:01 +08:00
background: var(--color-primary-500);
2026-02-25 21:57:05 +08:00
border-radius: 50%;
cursor: pointer;
border: none;
2026-02-25 23:44:01 +08:00
transition: transform var(--duration-fast), box-shadow var(--duration-fast);
2026-02-25 21:57:05 +08:00
&:hover {
transform: scale(1.15);
2026-02-25 23:44:01 +08:00
box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
2026-02-25 21:57:05 +08:00
}
}
2025-11-13 01:06:28 +08:00
}
.form-hint {
2025-12-28 13:49:45 +08:00
margin-top: var(--space-1);
2026-02-25 23:44:01 +08:00
font-size: var(--font-size-sm);
color: var(--color-gray-600);
2025-11-13 01:06:28 +08:00
}
.button-row {
display: flex;
gap: var(--space-3);
}
2026-02-25 21:30:24 +08:00
.points-hint {
2026-02-25 23:44:01 +08:00
margin-top: var(--space-3);
font-size: var(--font-size-xs);
color: var(--color-gray-600);
2026-02-25 21:30:24 +08:00
text-align: center;
}
2025-11-13 01:06:28 +08:00
</style>