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

164 lines
3.5 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'
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">
2025-11-13 01:06:28 +08:00
<a-form :model="form" layout="vertical">
<a-form-item label="平台">
<a-radio-group v-model:value="form.platform" button-style="solid">
<a-radio-button value="抖音">抖音</a-radio-button>
</a-radio-group>
</a-form-item>
2026-01-27 00:39:12 +08:00
2025-11-13 01:06:28 +08:00
<a-form-item label="主页/视频链接">
<a-input
v-model:value="form.url"
2026-01-27 00:39:12 +08:00
placeholder="粘贴抖音主页或视频链接"
2025-11-13 01:06:28 +08:00
allow-clear
size="large"
/>
</a-form-item>
2026-01-27 00:39:12 +08:00
<a-form-item 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>
2025-11-13 01:06:28 +08:00
</a-form-item>
2026-01-27 00:39:12 +08:00
2025-11-13 01:06:28 +08:00
<a-space>
2025-11-14 02:15:14 +08:00
<GradientButton
text="开始分析"
:loading="loading"
loading-text="分析中…"
size="middle"
@click="handleAnalyze"
/>
2026-01-27 00:39:12 +08:00
<a-button @click="handleReset">重置</a-button>
2025-11-13 01:06:28 +08:00
</a-space>
2026-02-25 21:30:24 +08:00
<p class="points-hint">每次分析将消耗积分消耗量与分析数量相关</p>
2025-11-13 01:06:28 +08:00
</a-form>
</section>
</template>
<style scoped>
2026-01-27 00:39:12 +08:00
.form-container {
2025-11-13 01:06:28 +08:00
background: var(--color-surface);
border-radius: 8px;
padding: 16px;
border: 1px solid var(--color-border);
}
.slider-row {
display: flex;
align-items: center;
2026-02-25 21:57:05 +08:00
gap: 12px;
}
.slider-num {
min-width: 32px;
font-size: 14px;
font-weight: 600;
color: var(--color-primary);
text-align: center;
}
.level-slider {
flex: 1;
height: 4px;
-webkit-appearance: none;
appearance: none;
background: var(--color-slate-200);
border-radius: 2px;
outline: none;
&::-webkit-slider-thumb {
-webkit-appearance: none;
width: 16px;
height: 16px;
background: var(--color-primary);
border-radius: 50%;
cursor: pointer;
transition: transform 0.15s, box-shadow 0.15s;
&:hover {
transform: scale(1.15);
box-shadow: 0 0 0 4px rgba(0, 176, 48, 0.15);
}
}
&::-moz-range-thumb {
width: 16px;
height: 16px;
background: var(--color-primary);
border-radius: 50%;
cursor: pointer;
border: none;
transition: transform 0.15s, box-shadow 0.15s;
&:hover {
transform: scale(1.15);
box-shadow: 0 0 0 4px rgba(0, 176, 48, 0.15);
}
}
2025-11-13 01:06:28 +08:00
}
.form-hint {
2025-12-28 13:49:45 +08:00
margin-top: var(--space-1);
font-size: 14px;
2025-11-13 01:06:28 +08:00
color: var(--color-text-secondary);
}
2026-02-25 21:30:24 +08:00
.points-hint {
margin-top: 12px;
font-size: 12px;
color: var(--color-text-secondary);
text-align: center;
}
2025-11-13 01:06:28 +08:00
</style>