3ffc2086e3
🐛 HomeTestimonials: - 移除 blur 滤镜,卡片不再模糊 - 添加触摸支持(touchstart/touchmove/touchend) - 降低拖拽阈值(100px → 50px),更灵敏 - 加快切换动画(0.8s → 0.5s) - 添加 select-none 防止拖拽选中文本 - 鼠标样式:grab / grabbing 🐛 HomeProcess: - 卡片宽度缩小(280/320px → 240/280px) - 编号圆圈缩小(20/24 → 16/20) - 图标容器缩小 - 内边距缩小(p-6/8 → p-5/6) - 防止最后一张卡片被遮挡 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
285 lines
8.4 KiB
Vue
285 lines
8.4 KiB
Vue
<template>
|
|
<section ref="rootRef" class="relative bg-gradient-to-b from-white to-gray-50 min-h-screen flex flex-col items-center justify-center overflow-hidden py-20">
|
|
<div class="w-full max-w-[1400px] mx-auto px-6 md:px-10">
|
|
<!-- 标题 -->
|
|
<div ref="headerRef" class="text-center mb-16 md:mb-20">
|
|
<h2 class="text-5xl md:text-7xl font-bold tracking-tight text-black mb-6">
|
|
{{ t('home.process.title') }}
|
|
</h2>
|
|
<p class="text-lg md:text-xl text-gray-600 max-w-2xl mx-auto">
|
|
{{ t('home.process.subtitle') }}
|
|
</p>
|
|
</div>
|
|
|
|
<!-- 水平滚动容器 -->
|
|
<div ref="scrollContainerRef" class="relative">
|
|
<!-- 连接线 -->
|
|
<svg
|
|
ref="lineRef"
|
|
class="absolute top-1/2 left-0 w-full h-1 -translate-y-1/2 pointer-events-none z-0"
|
|
|
|
>
|
|
<path
|
|
ref="linePathRef"
|
|
d=""
|
|
stroke="url(#lineGradient)"
|
|
stroke-width="3"
|
|
fill="none"
|
|
stroke-dasharray="10 10"
|
|
class="line-path"
|
|
/>
|
|
<defs>
|
|
<linearGradient id="lineGradient" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
<stop offset="0%" style="stop-color:#3B82F6;stop-opacity:1" />
|
|
<stop offset="50%" style="stop-color:#8B5CF6;stop-opacity:1" />
|
|
<stop offset="100%" style="stop-color:#EC4899;stop-opacity:1" />
|
|
</linearGradient>
|
|
</defs>
|
|
</svg>
|
|
|
|
<!-- 步骤卡片 -->
|
|
<div class="flex gap-8 md:gap-12 pb-10 overflow-x-auto scrollbar-hide">
|
|
<div
|
|
v-for="(step, index) in steps"
|
|
:key="step.id"
|
|
:ref="el => setStepRef(el, index)"
|
|
class="process-step flex-shrink-0 w-[240px] md:w-[280px]"
|
|
|
|
>
|
|
<!-- 步骤编号节点 -->
|
|
<div class="relative flex justify-center mb-8">
|
|
<div
|
|
class="w-16 h-16 md:w-20 md:h-20 rounded-full flex items-center justify-center text-white text-xl md:text-2xl font-bold shadow-xl relative z-10"
|
|
:class="step.gradient"
|
|
>
|
|
{{ index + 1 }}
|
|
<!-- 脉冲动画 -->
|
|
<div class="absolute inset-0 rounded-full animate-ping opacity-20" :class="step.bgColor"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 卡片内容 -->
|
|
<div class="bg-white rounded-2xl p-5 md:p-6 shadow-lg hover:shadow-2xl transition-all duration-300 hover:-translate-y-2">
|
|
<div class="w-12 h-12 md:w-14 md:h-14 rounded-xl mb-4 flex items-center justify-center" :class="step.iconBg">
|
|
<Icon :name="step.icon" class="w-7 h-7 md:w-8 md:h-8" :class="step.iconColor" />
|
|
</div>
|
|
|
|
<h3 class="text-xl md:text-2xl font-bold text-black mb-3">
|
|
{{ t(`home.process.steps.${step.id}.title`) }}
|
|
</h3>
|
|
|
|
<p class="text-gray-600 text-sm md:text-base leading-relaxed mb-5">
|
|
{{ t(`home.process.steps.${step.id}.description`) }}
|
|
</p>
|
|
|
|
<!-- 关键点 -->
|
|
<ul class="space-y-2">
|
|
<li
|
|
v-for="(point, i) in step.points"
|
|
:key="i"
|
|
class="flex items-center text-sm text-gray-500"
|
|
>
|
|
<Icon name="ph:check-circle-fill" :class="step.iconColor" class="w-4 h-4 mr-2 flex-shrink-0" />
|
|
<span>{{ t(`home.process.steps.${step.id}.points.${i}`) }}</span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 滚动提示 -->
|
|
<div class="flex justify-center mt-8">
|
|
<div class="flex items-center gap-2 text-gray-400 text-sm animate-bounce">
|
|
<Icon name="ph:arrow-right" class="w-5 h-5" />
|
|
<span>{{ t('home.process.scrollHint') }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, onMounted, onUnmounted, nextTick } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
import gsap from 'gsap'
|
|
import { ScrollTrigger } from 'gsap/ScrollTrigger'
|
|
|
|
gsap.registerPlugin(ScrollTrigger)
|
|
|
|
const { t } = useI18n()
|
|
|
|
const rootRef = ref<HTMLElement | null>(null)
|
|
const headerRef = ref<HTMLElement | null>(null)
|
|
const scrollContainerRef = ref<HTMLElement | null>(null)
|
|
const lineRef = ref<SVGElement | null>(null)
|
|
const linePathRef = ref<SVGPathElement | null>(null)
|
|
const stepElements = ref<(HTMLElement | null)[]>([])
|
|
let ctx: gsap.Context | null = null
|
|
|
|
const setStepRef = (el: any, index: number) => {
|
|
if (el) stepElements.value[index] = el
|
|
}
|
|
|
|
const steps = [
|
|
{
|
|
id: 'discovery',
|
|
icon: 'ph:magnifying-glass-duotone',
|
|
gradient: 'bg-gradient-to-br from-blue-500 to-cyan-500',
|
|
bgColor: 'bg-blue-500',
|
|
iconBg: 'bg-blue-50',
|
|
iconColor: 'text-blue-600',
|
|
points: [0, 1, 2]
|
|
},
|
|
{
|
|
id: 'strategy',
|
|
icon: 'ph:strategy-duotone',
|
|
gradient: 'bg-gradient-to-br from-purple-500 to-pink-500',
|
|
bgColor: 'bg-purple-500',
|
|
iconBg: 'bg-purple-50',
|
|
iconColor: 'text-purple-600',
|
|
points: [0, 1, 2]
|
|
},
|
|
{
|
|
id: 'design',
|
|
icon: 'ph:paint-brush-duotone',
|
|
gradient: 'bg-gradient-to-br from-pink-500 to-rose-500',
|
|
bgColor: 'bg-pink-500',
|
|
iconBg: 'bg-pink-50',
|
|
iconColor: 'text-pink-600',
|
|
points: [0, 1, 2]
|
|
},
|
|
{
|
|
id: 'development',
|
|
icon: 'ph:code-duotone',
|
|
gradient: 'bg-gradient-to-br from-orange-500 to-amber-500',
|
|
bgColor: 'bg-orange-500',
|
|
iconBg: 'bg-orange-50',
|
|
iconColor: 'text-orange-600',
|
|
points: [0, 1, 2]
|
|
},
|
|
{
|
|
id: 'testing',
|
|
icon: 'ph:test-tube-duotone',
|
|
gradient: 'bg-gradient-to-br from-green-500 to-emerald-500',
|
|
bgColor: 'bg-green-500',
|
|
iconBg: 'bg-green-50',
|
|
iconColor: 'text-green-600',
|
|
points: [0, 1, 2]
|
|
},
|
|
{
|
|
id: 'launch',
|
|
icon: 'ph:rocket-launch-duotone',
|
|
gradient: 'bg-gradient-to-br from-indigo-500 to-blue-500',
|
|
bgColor: 'bg-indigo-500',
|
|
iconBg: 'bg-indigo-50',
|
|
iconColor: 'text-indigo-600',
|
|
points: [0, 1, 2]
|
|
}
|
|
]
|
|
|
|
// 绘制连接线
|
|
const drawLine = () => {
|
|
if (!scrollContainerRef.value || !linePathRef.value) return
|
|
|
|
const container = scrollContainerRef.value
|
|
const nodes = stepElements.value.filter(el => el !== null)
|
|
|
|
if (nodes.length < 2) return
|
|
|
|
let pathData = ''
|
|
nodes.forEach((node, index) => {
|
|
if (!node) return
|
|
|
|
const rect = node.getBoundingClientRect()
|
|
const containerRect = container.getBoundingClientRect()
|
|
const x = rect.left - containerRect.left + rect.width / 2
|
|
const y = 60 // 固定高度
|
|
|
|
if (index === 0) {
|
|
pathData = `M ${x} ${y}`
|
|
} else {
|
|
pathData += ` L ${x} ${y}`
|
|
}
|
|
})
|
|
|
|
linePathRef.value.setAttribute('d', pathData)
|
|
}
|
|
|
|
onMounted(async () => {
|
|
await nextTick()
|
|
if (!rootRef.value || !headerRef.value) return
|
|
|
|
// 绘制连接线
|
|
setTimeout(() => {
|
|
drawLine()
|
|
}, 100)
|
|
|
|
ctx = gsap.context(() => {
|
|
// 初始状态
|
|
gsap.set(headerRef.value, { autoAlpha: 0, y: 50 })
|
|
stepElements.value.forEach((step) => {
|
|
if (!step) return
|
|
gsap.set(step, { autoAlpha: 0, y: 60, scale: 0.85 })
|
|
})
|
|
|
|
// 入场动画(无 pin):标题 + 线条 + 步骤
|
|
const tl = gsap.timeline()
|
|
|
|
tl.to(headerRef.value, { autoAlpha: 1, y: 0, duration: 0.8, ease: 'power3.out' }, 0)
|
|
|
|
if (lineRef.value && linePathRef.value) {
|
|
const pathLength = linePathRef.value.getTotalLength()
|
|
gsap.set(linePathRef.value, { strokeDasharray: pathLength, strokeDashoffset: pathLength })
|
|
tl.to(lineRef.value, { autoAlpha: 1, duration: 0.3 }, 0.4)
|
|
tl.to(linePathRef.value, { strokeDashoffset: 0, duration: 1.5, ease: 'power2.inOut' }, 0.4)
|
|
}
|
|
|
|
stepElements.value.forEach((step, index) => {
|
|
if (!step) return
|
|
tl.to(step, {
|
|
autoAlpha: 1, y: 0, scale: 1,
|
|
duration: 0.6, ease: 'back.out(1.5)',
|
|
}, 0.5 + index * 0.1)
|
|
})
|
|
|
|
ScrollTrigger.create({
|
|
trigger: rootRef.value,
|
|
start: 'top 75%',
|
|
toggleActions: 'play none none none',
|
|
animation: tl,
|
|
})
|
|
}, rootRef.value)
|
|
})
|
|
|
|
onUnmounted(() => {
|
|
ctx?.revert()
|
|
})
|
|
</script>
|
|
|
|
<style scoped>
|
|
.scrollbar-hide::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
|
|
.scrollbar-hide {
|
|
-ms-overflow-style: none;
|
|
scrollbar-width: none;
|
|
}
|
|
|
|
.process-step {
|
|
will-change: transform, opacity;
|
|
}
|
|
|
|
.line-path {
|
|
stroke-dasharray: 10 10;
|
|
animation: dash 20s linear infinite;
|
|
}
|
|
|
|
@keyframes dash {
|
|
to {
|
|
stroke-dashoffset: -200;
|
|
}
|
|
}
|
|
</style>
|