Draft
As a 小程序用户, I want 看到与tcb-shop-demo设计一致的现代化首页UI, so that 我能获得更好的视觉体验和更直观的商品浏览体验
mini/src/pages/index/index.tsx 首页组件tcb-shop-demo/pages/home/home.wxml 实现页面结构mini/src/components/goods-card/index.tsx 商品卡片组件tcb-shop-demo/components/goods-card/index.wxml 实现商品卡片布局mini/src/components/goods-list/index.tsx 商品列表组件tcb-shop-demo/components/goods-list/index.wxml 实现列表结构mini/src/components/tdesign-search/index.tsx - Search组件mini/src/components/tdesign-swiper/index.tsx - Swiper组件mini/src/components/tdesign-icon/index.tsx - Icon组件mini/src/components/tdesign-toast/index.tsx - Toast组件mini/src/components/tdesign-tabs/index.tsx - Tabs组件mini/src/pages/index/index.tsxmini/src/components/mini/src/tcb-theme.cssmini/src/layouts/tab-bar-layout.tsxtcb-shop-demo/pages/home/home.wxmltcb-shop-demo/pages/home/home.wxsstcb-shop-demo/pages/home/home.jstcb-shop-demo/components/goods-list/index.wxmltcb-shop-demo/components/goods-card/index.wxmltcb-shop-demo/components/goods-card/index.wxssmini/src/tcb-theme.css 中完整集成linear-gradient(#fff, #f5f5f5)Search组件 (mini/src/components/tdesign-search/index.tsx)
import { useState } from 'react'
import { View, Input } from '@tarojs/components'
import TDesignIcon from '../tdesign-icon'
interface SearchProps {
placeholder?: string
disabled?: boolean
shape?: 'round' | 'square'
value?: string
onChange?: (value: string) => void
onFocus?: () => void
onBlur?: () => void
onSubmit?: (value: string) => void
}
export default function TDesignSearch({
placeholder = '搜索商品',
disabled = false,
shape = 'round',
value = '',
onChange,
onFocus,
onBlur,
onSubmit
}: SearchProps) {
const [focused, setFocused] = useState(false)
const handleInput = (e) => {
onChange?.(e.detail.value)
}
const handleFocus = () => {
setFocused(true)
onFocus?.()
}
const handleBlur = () => {
setFocused(false)
onBlur?.()
}
const handleConfirm = (e) => {
onSubmit?.(e.detail.value)
}
return (
<View className={`tdesign-search tdesign-search--${shape}`}>
<View className={`tdesign-search__input-box ${focused ? 'tdesign-search__input-box--focused' : ''}`}>
<TDesignIcon name="search" size="32rpx" color="#fa550f" />
<Input
type="text"
placeholder={placeholder}
disabled={disabled}
value={value}
onInput={handleInput}
onFocus={handleFocus}
onBlur={handleBlur}
onConfirm={handleConfirm}
className="tdesign-search__input"
/>
</View>
</View>
)
}
Icon组件 (mini/src/components/tdesign-icon/index.tsx)
import { View } from '@tarojs/components'
interface IconProps {
name: string
size?: string
color?: string
}
export default function TDesignIcon({ name, size = '32rpx', color = '#fa550f' }: IconProps) {
return (
<View
className={`tdesign-icon tdesign-icon--${name}`}
style={{ fontSize: size, color }}
>
{/* 使用Unicode或SVG图标 */}
</View>
)
}
Swiper组件 (mini/src/components/tdesign-swiper/index.tsx)
import { useState } from 'react'
import { Swiper, SwiperItem, Image } from '@tarojs/components'
interface SwiperProps {
images: string[]
autoplay?: boolean
interval?: number
indicatorDots?: boolean
}
export default function TDesignSwiper({
images = [],
autoplay = true,
interval = 3000,
indicatorDots = true
}: SwiperProps) {
return (
<Swiper
className="tdesign-swiper"
autoplay={autoplay}
interval={interval}
indicatorDots={indicatorDots}
indicatorColor="#999"
indicatorActiveColor="#fa550f"
>
{images.map((image, index) => (
<SwiperItem key={index}>
<Image src={image} mode="aspectFill" className="tdesign-swiper__image" />
</SwiperItem>
))}
</Swiper>
)
}
__tests__ 文件夹与源码并列| Date | Version | Description | Author |
|---|---|---|---|
| 2025-11-20 | 1.0 | 初始故事创建 | Bob (Scrum Master) |
This section is populated by the development agent during implementation
Record the specific AI agent model and version used for development
Reference any debug logs or traces generated during development
Notes about the completion of tasks and any issues encountered
List all files created, modified, or affected during story implementation
Results from QA Agent QA review of the completed story implementation