114 lines
2.1 KiB
Vue
Raw Normal View History

2025-08-11 22:42:29 +08:00
<template>
<view class="dm-container">
<!-- 顶部Tab -->
<view class="tab-container">
<view
class="tab-item"
:class="{ active: activeTab === 'start' }"
@click="switchTab('start')"
>
开始点名
</view>
<view
class="tab-item"
:class="{ active: activeTab === 'record' }"
@click="switchTab('record')"
>
点名记录
</view>
</view>
<!-- 开始点名内容 -->
<DmComponent v-if="activeTab === 'start'" />
<!-- 点名记录内容 -->
<DmListComponent v-if="activeTab === 'record'" />
<!-- 加载提示 -->
<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 DmComponent from './components/dm.vue'
import DmListComponent from './components/dmList.vue'
// 响应式数据
const activeTab = ref('record')
const loading = ref(false)
// 方法
const switchTab = (tab: string) => {
activeTab.value = tab
}
</script>
<style lang="scss" scoped>
.dm-container {
min-height: 100vh;
background-color: #f5f5f5;
}
.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>