2025-11-10 16:41:31 +08:00

116 lines
2.2 KiB
Vue

<template>
<view class="dm-container">
<!-- 顶部Tab -->
<view class="tab-container">
<view
class="tab-item"
:class="{ active: activeTab === 'pending' }"
@click="switchTab('pending')"
>
待点名
</view>
<view
class="tab-item"
:class="{ active: activeTab === 'completed' }"
@click="switchTab('completed')"
>
已点名
</view>
</view>
<!-- 待点名内容 -->
<PendingListComponent v-if="activeTab === 'pending'" />
<!-- 已点名记录内容 -->
<CompletedListComponent v-if="activeTab === 'completed'" />
<!-- 加载提示 -->
<view v-if="loading" class="loading-overlay">
<view class="loading-content">
<text>加载中...</text>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import PendingListComponent from './components/pendingList.vue'
import CompletedListComponent from './components/completedList.vue'
// 响应式数据
const activeTab = ref('pending')
const loading = ref(false)
// 方法
const switchTab = (tab: string) => {
activeTab.value = tab
}
</script>
<style lang="scss" scoped>
.dm-container {
min-height: 100vh;
background-color: #f5f5f5;
display: flex;
flex-direction: column;
}
.tab-container {
display: flex;
background-color: #fff;
border-bottom: 1px solid #e5e5e5;
position: sticky;
top: 0;
z-index: 100;
}
.tab-item {
flex: 1;
text-align: center;
padding: 20rpx 0;
font-size: 28rpx;
color: #666;
position: relative;
&.active {
color: #007aff;
font-weight: bold;
&::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 60rpx;
height: 4rpx;
background-color: #007aff;
border-radius: 2rpx;
}
}
}
.loading-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
}
.loading-content {
background-color: #fff;
padding: 40rpx;
border-radius: 16rpx;
color: #333;
font-size: 28rpx;
}
</style>