This commit is contained in:
jeremygan2021
2026-02-11 01:31:21 +08:00
parent 61afc52ac2
commit 2d090cd0f4
97 changed files with 3661 additions and 4 deletions

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '服务详情'
})

View File

@@ -0,0 +1,245 @@
.page-container {
padding: 20px;
background-color: #000;
min-height: 100vh;
box-sizing: border-box;
padding-bottom: 120px; // Space for bottom bar
}
.detail-header {
margin-bottom: 30px;
.title {
color: #fff;
font-size: 48px;
font-weight: bold;
display: block;
margin-bottom: 15px;
}
.desc {
color: #888;
font-size: 28px;
line-height: 1.5;
}
}
.info-card {
background: rgba(255,255,255,0.03);
padding: 30px;
border-radius: 16px;
border: 1px solid rgba(255,255,255,0.08);
margin-bottom: 40px;
.card-title {
color: #fff;
font-size: 32px;
margin-bottom: 20px;
display: flex;
align-items: center;
.bar {
width: 6px;
height: 24px;
border-radius: 3px;
margin-right: 15px;
}
}
.info-item {
margin-bottom: 15px;
display: flex;
flex-direction: column;
.label {
color: #888;
font-size: 24px;
margin-bottom: 5px;
}
.value {
color: #fff;
font-size: 28px;
font-weight: 500;
}
}
}
.detail-image-box {
width: 100%;
background: #111;
border-radius: 12px;
overflow: hidden;
margin-bottom: 40px;
.detail-img {
width: 100%;
display: block;
}
}
.price-card {
background: #1f1f1f;
padding: 30px;
border-radius: 16px;
margin-bottom: 40px;
.price-title {
color: #fff;
font-size: 32px;
margin-bottom: 15px;
display: block;
}
.price-row {
display: flex;
align-items: baseline;
margin-bottom: 20px;
.price-val {
font-size: 48px;
font-weight: bold;
}
.price-unit {
color: #888;
font-size: 24px;
margin-left: 10px;
}
}
.tags {
display: flex;
flex-wrap: wrap;
gap: 15px;
margin-bottom: 20px;
.tag {
padding: 8px 16px;
border-radius: 8px;
font-size: 24px;
backdrop-filter: blur(4px);
}
}
}
.bottom-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #1f1f1f;
padding: 20px 30px;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
border-top: 1px solid rgba(255,255,255,0.1);
display: flex;
justify-content: space-between;
align-items: center;
z-index: 100;
.btn-buy {
width: 100%;
height: 90px;
line-height: 90px;
font-weight: bold;
font-size: 32px;
border-radius: 45px;
color: #000;
}
}
// Modal Styles
.modal-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.6);
z-index: 900;
}
.modal-content {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #2c2c2c;
border-top-left-radius: 24px;
border-top-right-radius: 24px;
padding: 40px;
padding-bottom: calc(40px + constant(safe-area-inset-bottom));
padding-bottom: calc(40px + env(safe-area-inset-bottom));
z-index: 1000;
transform: translateY(100%);
transition: transform 0.3s ease-out;
&.visible {
transform: translateY(0);
}
.modal-title {
color: #fff;
font-size: 36px;
font-weight: bold;
margin-bottom: 10px;
display: block;
}
.modal-desc {
color: #999;
font-size: 26px;
margin-bottom: 30px;
display: block;
}
.form-item {
margin-bottom: 25px;
.label {
color: #ccc;
font-size: 28px;
margin-bottom: 10px;
display: block;
}
.input {
background: #1f1f1f;
border: 1px solid #444;
border-radius: 12px;
height: 80px;
padding: 0 20px;
color: #fff;
font-size: 28px;
}
.textarea {
background: #1f1f1f;
border: 1px solid #444;
border-radius: 12px;
padding: 20px;
color: #fff;
font-size: 28px;
height: 160px;
width: 100%;
box-sizing: border-box;
}
}
.modal-actions {
display: flex;
gap: 20px;
margin-top: 40px;
.btn-cancel {
flex: 1;
background: #444;
color: #fff;
}
.btn-submit {
flex: 2;
background: #00b96b;
color: #fff;
}
}
}

View File

@@ -0,0 +1,155 @@
import { View, Text, Image, Button, Input, Textarea } from '@tarojs/components'
import Taro, { useLoad } from '@tarojs/taro'
import { useState } from 'react'
import { getServiceDetail, createServiceOrder } from '../../api'
import './detail.scss'
export default function ServiceDetail() {
const [service, setService] = useState<any>(null)
const [loading, setLoading] = useState(true)
const [modalVisible, setModalVisible] = useState(false)
const [formData, setFormData] = useState({
customer_name: '',
company_name: '',
phone_number: '',
email: '',
requirements: ''
})
useLoad((options) => {
if (options.id) {
fetchDetail(options.id)
}
})
const fetchDetail = async (id: string) => {
try {
const res: any = await getServiceDetail(Number(id))
setService(res)
} catch (err) {
console.error(err)
Taro.showToast({ title: '加载失败', icon: 'none' })
} finally {
setLoading(false)
}
}
const handleInput = (key: string, value: string) => {
setFormData(prev => ({ ...prev, [key]: value }))
}
const handleSubmit = async () => {
if (!formData.customer_name || !formData.phone_number) {
Taro.showToast({ title: '请填写姓名和电话', icon: 'none' })
return
}
try {
Taro.showLoading({ title: '提交中...' })
await createServiceOrder({
service: service.id,
...formData,
ref_code: Taro.getStorageSync('ref_code') || ''
})
Taro.hideLoading()
setModalVisible(false)
Taro.showModal({
title: '提交成功',
content: '需求已提交,我们的销售顾问将尽快与您联系!',
showCancel: false
})
} catch (err) {
Taro.hideLoading()
Taro.showToast({ title: '提交失败', icon: 'none' })
}
}
if (loading) return <View className='page-container'><Text style={{color:'#fff'}}>Loading...</Text></View>
if (!service) return <View className='page-container'><Text style={{color:'#fff'}}>Service not found</Text></View>
return (
<View className='page-container'>
<View className='detail-header'>
<Text className='title'>{service.title}</Text>
<Text className='desc'>{service.description}</Text>
</View>
<View className='info-card'>
<View className='card-title'>
<View className='bar' style={{ background: service.color }} />
<Text></Text>
</View>
<View className='info-item'>
<Text className='label'></Text>
<Text className='value'>{service.delivery_time || '待沟通'}</Text>
</View>
<View className='info-item'>
<Text className='label'></Text>
<Text className='value'>{service.delivery_content || '根据需求定制'}</Text>
</View>
</View>
{service.detail_image_url && (
<View className='detail-image-box' style={{ boxShadow: `0 10px 40px ${service.color}22` }}>
<Image src={service.detail_image_url} className='detail-img' mode='widthFix' />
</View>
)}
<View className='price-card'>
<Text className='price-title'></Text>
<View className='price-row'>
<Text className='price-val' style={{ color: service.color }}>¥{service.price}</Text>
<Text className='price-unit'>/ {service.unit} </Text>
</View>
<View className='tags'>
{service.features && service.features.split('\n').map((feat: string, i: number) => (
<View key={i} className='tag' style={{
background: `${service.color}11`,
color: service.color,
border: `1px solid ${service.color}66`
}}>
<Text>{feat}</Text>
</View>
))}
</View>
</View>
<View className='bottom-bar'>
<Button
className='btn-buy'
style={{ background: service.color }}
onClick={() => setModalVisible(true)}
>
/
</Button>
</View>
{/* Modal Layer */}
{modalVisible && (
<View className='modal-mask' onClick={() => setModalVisible(false)} />
)}
<View className={`modal-content ${modalVisible ? 'visible' : ''}`}>
<Text className='modal-title'>/</Text>
<Text className='modal-desc'></Text>
<View className='form-item'>
<Text className='label'> *</Text>
<Input className='input' placeholder='请输入姓名' value={formData.customer_name} onInput={(e) => handleInput('customer_name', e.detail.value)} />
</View>
<View className='form-item'>
<Text className='label'> *</Text>
<Input className='input' type='number' placeholder='请输入电话' value={formData.phone_number} onInput={(e) => handleInput('phone_number', e.detail.value)} />
</View>
<View className='form-item'>
<Text className='label'></Text>
<Textarea className='textarea' placeholder='请简单描述您的需求...' value={formData.requirements} onInput={(e) => handleInput('requirements', e.detail.value)} />
</View>
<View className='modal-actions'>
<Button className='btn-cancel' onClick={() => setModalVisible(false)}></Button>
<Button className='btn-submit' onClick={handleSubmit}></Button>
</View>
</View>
</View>
)
}

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: 'AI 全栈解决方案'
})

View File

@@ -0,0 +1,186 @@
.page-container {
padding: 20px;
background-color: #000;
min-height: 100vh;
box-sizing: border-box;
}
.header {
text-align: center;
margin-bottom: 40px;
.title {
color: #fff;
font-size: 48px;
font-weight: bold;
margin-bottom: 10px;
display: block;
.highlight {
color: #00f0ff;
text-shadow: 0 0 10px rgba(0,240,255,0.5);
}
}
.subtitle {
color: #888;
font-size: 28px;
line-height: 1.5;
}
}
.service-grid {
display: flex;
flex-direction: column;
gap: 30px;
}
.service-card {
background: rgba(255, 255, 255, 0.05);
border-radius: 16px;
padding: 30px;
position: relative;
overflow: hidden;
backdrop-filter: blur(10px);
.hud-corner {
position: absolute;
width: 20px;
height: 20px;
&.tl { top: 0; left: 0; border-top: 2px solid; border-left: 2px solid; }
&.br { bottom: 0; right: 0; border-bottom: 2px solid; border-right: 2px solid; }
}
.card-header {
display: flex;
align-items: center;
margin-bottom: 20px;
.icon-box {
width: 60px;
height: 60px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 15px;
.icon-img {
width: 36px;
height: 36px;
}
.icon-placeholder {
width: 30px;
height: 30px;
border-radius: 50%;
}
}
.title {
color: #fff;
font-size: 32px;
font-weight: bold;
}
}
.description {
color: #ccc;
font-size: 26px;
line-height: 1.6;
margin-bottom: 20px;
display: block;
}
.features {
margin-bottom: 20px;
.feature-item {
display: flex;
align-items: center;
margin-bottom: 8px;
font-size: 24px;
.dot {
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 10px;
}
}
}
.btn-more {
color: #fff;
font-size: 26px;
padding: 0;
background: transparent;
border: none;
text-align: left;
&:after {
border: none;
}
}
}
.process-section {
margin-top: 60px;
padding: 40px 20px;
background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,185,107,0.05) 100%);
border-radius: 30px;
border: 1px solid rgba(255,255,255,0.05);
.section-title {
color: #fff;
text-align: center;
font-size: 36px;
font-weight: bold;
margin-bottom: 40px;
display: block;
text-shadow: 0 0 10px rgba(0, 185, 107, 0.5);
}
.process-steps {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 20px;
}
.step-item {
width: 48%; // 2 columns
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 30px;
.step-icon {
width: 80px;
height: 80px;
border-radius: 24px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(0, 185, 107, 0.3);
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 15px;
color: #00b96b;
font-size: 32px;
font-weight: bold;
}
.step-title {
color: #fff;
font-size: 28px;
font-weight: bold;
margin-bottom: 5px;
}
.step-desc {
color: #666;
font-size: 24px;
}
}
}

View File

@@ -0,0 +1,102 @@
import { View, Text, Image, Button } from '@tarojs/components'
import Taro, { useLoad } 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)
}
}
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>
<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>
<Text className='step-title'>{step.title}</Text>
<Text className='step-desc'>{step.desc}</Text>
</View>
))}
</View>
</View>
</View>
)
}