Files
market_page/miniprogram/src/pages/services/index.tsx
jeremygan2021 321c57bee2
All checks were successful
Deploy to Server / deploy (push) Successful in 24s
小程序转发
2026-02-17 11:07:16 +08:00

136 lines
4.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { View, Text, Image, Button } from '@tarojs/components'
import Taro, { useLoad, useShareAppMessage, useShareTimeline } from '@tarojs/taro'
import { useState } from 'react'
import { getServices } from '../../api'
import './index.scss'
export default function ServicesIndex() {
const [services, setServices] = useState<any[]>([])
const [loading, setLoading] = useState(true)
useLoad(() => {
fetchServices()
})
const fetchServices = async () => {
try {
const res: any = await getServices()
// Adapt API response if needed (res.data vs res)
setServices(res.results || res)
} catch (err) {
console.error(err)
Taro.showToast({ title: '加载失败', icon: 'none' })
} finally {
setLoading(false)
}
}
useShareAppMessage(() => {
return {
title: 'AI 全栈解决方案',
path: '/pages/services/index'
}
})
useShareTimeline(() => {
return {
title: 'AI 全栈解决方案'
}
})
const goDetail = (id: number) => {
Taro.navigateTo({ url: `/pages/services/detail?id=${id}` })
}
if (loading) return <View className='page-container'><Text style={{color:'#fff'}}>Loading...</Text></View>
return (
<View className='page-container'>
<View className='header'>
<Text className='title'>AI <Text className='highlight'></Text></Text>
<Text className='subtitle'> AI </Text>
<View className='vc-promo-container'>
<View className='vc-info-card' onClick={() => Taro.navigateTo({ url: '/pages/courses/index' })}>
<View className='info-icon'>💡</View>
<View className='info-content'>
<Text className='info-title'>AI + VC </Text>
<Text className='info-desc'> AI </Text>
</View>
</View>
<Button
className='nav-btn'
onClick={() => Taro.navigateTo({ url: '/pages/courses/index' })}
>
VC
<Text className='arrow'></Text>
</Button>
</View>
</View>
<View className='service-grid'>
{services.map((item) => (
<View
key={item.id}
className='service-card'
style={{
border: `1px solid ${item.color}33`,
boxShadow: `0 0 20px ${item.color}11`
}}
onClick={() => goDetail(item.id)}
>
<View className='hud-corner tl' style={{ borderColor: item.color }} />
<View className='hud-corner br' style={{ borderColor: item.color }} />
<View className='card-header'>
<View className='icon-box' style={{ background: `${item.color}22` }}>
{item.icon_url ? (
<Image src={item.icon_url} className='icon-img' mode='aspectFit' />
) : (
<View className='icon-placeholder' style={{ background: item.color }} />
)}
</View>
<Text className='title'>{item.title}</Text>
</View>
<Text className='description'>{item.description}</Text>
<View className='features'>
{item.features && item.features.split('\n').map((feat: string, i: number) => (
<View key={i} className='feature-item' style={{ color: item.color }}>
<View className='dot' style={{ background: item.color }} />
<Text>{feat}</Text>
</View>
))}
</View>
<Button className='btn-more'> {'>'}</Button>
</View>
))}
</View>
<View className='process-section'>
<Text className='section-title'></Text>
<View className='process-steps'>
{[
{ title: '需求分析', desc: '深度沟通需求', id: 1 },
{ title: '数据准备', desc: '高效数据处理', id: 2 },
{ title: '模型训练', desc: '高性能算力', id: 3 },
{ title: '测试验证', desc: '多维精度测试', id: 4 },
{ title: '私有化部署', desc: '全栈落地部署', id: 5 }
].map((step) => (
<View key={step.id} className='step-item'>
<View className='step-icon'><Text>{step.id}</Text></View>
<View className='step-content-wrapper'>
<Text className='step-title'>{step.title}</Text>
<Text className='step-desc'>{step.desc}</Text>
</View>
</View>
))}
</View>
</View>
</View>
)
}