feat(miniprogram): 通用组件 + 页面接入 — Chunk 7
- 创建 EmptyState/ErrorState/Loading 三个通用组件 - 8个列表页面接入通用组件替换内联空状态/loading - app.config.ts 添加 login 页面路由
This commit is contained in:
@@ -3,6 +3,8 @@ import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useDidShow, useReachBottom, usePullDownRefresh } from '@tarojs/taro';
|
||||
import { listAppointments, cancelAppointment } from '../../services/appointment';
|
||||
import type { Appointment } from '../../services/appointment';
|
||||
import EmptyState from '../../components/EmptyState';
|
||||
import Loading from '../../components/Loading';
|
||||
import './index.scss';
|
||||
|
||||
const STATUS_MAP: Record<string, { label: string; className: string }> = {
|
||||
@@ -82,11 +84,7 @@ export default function AppointmentList() {
|
||||
|
||||
{/* 预约列表 */}
|
||||
{appointments.length === 0 && !loading ? (
|
||||
<View className='empty-state'>
|
||||
<Text className='empty-icon'>📋</Text>
|
||||
<Text className='empty-text'>暂无预约记录</Text>
|
||||
<Text className='empty-hint'>点击下方按钮新建预约</Text>
|
||||
</View>
|
||||
<EmptyState icon='📋' text='暂无预约记录' hint='点击下方按钮新建预约' />
|
||||
) : (
|
||||
<View className='appointment-list'>
|
||||
{appointments.map((item) => {
|
||||
@@ -120,14 +118,10 @@ export default function AppointmentList() {
|
||||
);
|
||||
})}
|
||||
{loading && (
|
||||
<View className='loading-tip'>
|
||||
<Text className='loading-text'>加载中...</Text>
|
||||
</View>
|
||||
<Loading />
|
||||
)}
|
||||
{!loading && appointments.length >= total && total > 0 && (
|
||||
<View className='loading-tip'>
|
||||
<Text className='loading-text'>没有更多了</Text>
|
||||
</View>
|
||||
<Loading text='没有更多了' />
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user