Files
smartDriveEEUniApp/pages/speaking_training_edu/speaking_training_edu.vue
2026-01-11 12:11:01 +08:00

128 lines
2.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="page">
<!-- 顶部导航栏 -->
<uni-nav-bar
:fixed="true"
:statusBar="true"
title="教务"
leftIcon=""
color="#333"
backgroundColor="#FFFFFF"
/>
<view class="content">
<!-- 顶部 Tab -->
<view class="tabs">
<view
class="tab-item"
:class="{ active: activeTab === 'device' }"
@click="switchTab('device')"
>
<text>设备管理</text>
</view>
<view
class="tab-item"
:class="{ active: activeTab === 'homework' }"
@click="switchTab('homework')"
>
<text>作业管理</text>
</view>
</view>
<!-- 设备管理 -->
<DeviceTab v-if="activeTab === 'device'" ref="deviceTab" />
<!-- 作业管理 -->
<HomeworkTab v-else />
</view>
</view>
</template>
<script>
import DeviceTab from './components/DeviceTab.vue';
import HomeworkTab from './components/HomeworkTab.vue';
export default {
components: {
DeviceTab,
HomeworkTab,
},
onShow() {
// 所有登录人都可以访问,已移除权限限制
},
data() {
return {
activeTab: 'device', // device | homework
};
},
onReachBottom() {
// 页面触底时,如果当前在设备管理 Tab则触发子组件加载更多
if (this.activeTab === 'device' && this.$refs.deviceTab && this.$refs.deviceTab.loadMore) {
this.$refs.deviceTab.loadMore();
}
},
methods: {
switchTab(tab) {
this.activeTab = tab;
},
},
};
</script>
<style>
.page {
min-height: 100vh;
background-color: #f5f5f5;
}
.content {
padding-top: 88rpx;
}
.tabs {
position: fixed;
top: 88rpx;
left: 0;
right: 0;
display: flex;
background-color: #ffffff;
border-bottom: 1px solid #e0e0e0;
z-index: 10;
}
.tab-item {
flex: 1;
padding: 24rpx 0;
text-align: center;
position: relative;
}
.tab-item text {
font-size: 30rpx;
color: #666;
}
.tab-item.active text {
color: #333;
font-weight: 500;
}
.tab-item.active::after {
content: '';
position: absolute;
bottom: 0;
left: 25%;
right: 25%;
height: 4rpx;
border-radius: 2rpx;
background-color: #007aff;
}
.tab-content {
padding: 148rpx 32rpx 32rpx;
box-sizing: border-box;
}
</style>