295 lines
6.3 KiB
Vue
Raw Normal View History

2025-04-22 10:22:33 +08:00
<template>
2025-07-09 17:04:25 +08:00
<BasicLayout>
2025-06-14 13:09:26 +08:00
<view class="teaching-resource-page">
<!-- 主要内容区域 -->
<view class="main-content">
<!-- 右侧内容区域 -->
<view class="right-panel">
2025-07-09 17:04:25 +08:00
<view class="resource-section">
<view class="section-title">科目</view>
2025-06-14 13:09:26 +08:00
<view class="type-grid">
2025-07-09 17:04:25 +08:00
<view class="type-item" :class="{ active: curType && curType.key === type.key }" v-for="(type, index) in typeTree" :key="index"
@click="selectType(type)">
<text class="type-text">{{ type.title }}</text>
2025-04-22 10:22:33 +08:00
</view>
</view>
</view>
2025-07-09 17:04:25 +08:00
<view class="resource-section" v-if="curType && curType.children && curType.children.length > 0">
2025-06-14 13:09:26 +08:00
<view class="section-title">年级</view>
2025-07-09 17:04:25 +08:00
<view class="type-grid">
<view class="type-item" :class="{ active: curNj && curNj.key === type.key }" v-for="(type, index) in curType.children" :key="index"
@click="selectNj(type)">
<text class="type-text">{{ type.title }}</text>
2025-06-14 13:09:26 +08:00
</view>
</view>
</view>
2025-07-09 17:04:25 +08:00
<view class="resource-section" v-if="curNj && curNj.children && curNj.children.length > 0">
<view class="section-title">上下册</view>
<view class="type-grid">
<view class="type-item" :class="{ active: curCe && curCe.key === type.key }" v-for="(type, index) in curNj.children" :key="index"
@click="selectCe(type)">
<text class="type-text">{{ type.title }}</text>
</view>
</view>
</view>
<!-- 资源类型 -->
<view class="resource-section">
<view class="section-title">资源类型</view>
<view class="type-grid">
<view class="type-item" :class="{ active: curCategory && curCategory.key === type.key }" v-for="(type, index) in categoryList" :key="index"
@click="selectCategory(type)">
<text class="type-text">{{ type.label }}</text>
</view>
</view>
2025-06-14 13:09:26 +08:00
</view>
</view>
</view>
</view>
2025-07-09 17:04:25 +08:00
<template #bottom>
<view class="white-bg-color py-5">
<view class="flex-row items-center pb-10 pt-5">
<u-button text="查询" class="mx-15" type="primary" @click="goTo"/>
</view>
</view>
</template>
</BasicLayout>
2025-04-22 10:22:33 +08:00
</template>
<script lang="ts" setup>
2025-07-09 17:04:25 +08:00
import { typesFindTreeApi } from "@/api/base/server";
import { useDataStore } from "@/store/modules/data";
const { setData } = useDataStore();
2025-04-22 10:22:33 +08:00
2025-07-09 17:04:25 +08:00
const typeTree = ref<any>([]);
const categoryList = ref([
{ key: '', label: '不限' },
{ key: '1', label: '课件' },
{ key: '2', label: '教案' },
{ key: '3', label: '学案' },
{ key: '4', label: '作业' },
{ key: '5', label: '试卷' },
{ key: '6', label: '教材' },
{ key: '7', label: '示范课' },
{ key: '8', label: '音视频合集' }
2025-06-14 13:09:26 +08:00
]);
2025-04-22 10:22:33 +08:00
2025-07-09 17:04:25 +08:00
const curType = ref<any>();
const curNj = ref<any>();
const curCe = ref<any>();
const curCategory = ref<any>();
2025-04-22 10:22:33 +08:00
2025-07-09 17:04:25 +08:00
const selectType = (type: any) => {
curType.value = type;
curNj.value = curType.value.children[0];
curCe.value = curNj.value.children[0];
}
const selectNj = (type: any) => {
curNj.value = type;
curCe.value = curNj.value.children[0];
}
const selectCe = (type: any) => {
curCe.value = type;
}
2025-04-22 10:22:33 +08:00
2025-07-09 17:04:25 +08:00
const selectCategory = (type: any) => {
curCategory.value = type;
}
2025-04-22 10:22:33 +08:00
2025-07-09 17:04:25 +08:00
const goTo = function () {
setData({
resourceType: curCe.value.key,
category: curCategory.value.key,
});
2025-04-22 10:22:33 +08:00
uni.navigateTo({
2025-07-09 17:04:25 +08:00
url: `/pages/view/routine/JiaoXueZiYuan/indexList`
2025-04-22 10:22:33 +08:00
});
2025-07-09 17:04:25 +08:00
}
2025-04-22 10:22:33 +08:00
2025-07-09 17:04:25 +08:00
// 页面加载完成后的初始化操作
onMounted(async () => {
const res = await typesFindTreeApi();
typeTree.value = res.result || [];
console.log('教学资源页面加载完成', res);
2025-06-14 13:09:26 +08:00
});
2025-04-22 10:22:33 +08:00
</script>
<style scoped lang="scss">
2025-06-14 13:09:26 +08:00
.teaching-resource-page {
min-height: 100vh;
background: #f5f5f5;
2025-04-22 10:22:33 +08:00
display: flex;
2025-06-14 13:09:26 +08:00
flex-direction: column;
}
2025-04-22 10:22:33 +08:00
2025-06-14 13:09:26 +08:00
// 主要内容区域
.main-content {
flex: 1;
display: flex;
height: 100vh;
}
2025-04-22 10:22:33 +08:00
2025-06-14 13:09:26 +08:00
// 左侧面板
.left-panel {
width: 280rpx;
background: #ffffff;
border-right: 1px solid #e5e5e5;
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
.subject-list {
height: 100%;
}
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
.subject-item {
padding: 30rpx 20rpx;
border-bottom: 1px solid #f0f0f0;
cursor: pointer;
transition: all 0.3s ease;
text-align: center;
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
.subject-name {
font-size: 28rpx;
color: #666666;
display: block;
2025-04-22 10:22:33 +08:00
}
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
&.active {
background: #fff3e0;
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
.subject-name {
color: #ff9800;
font-weight: 600;
}
}
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
&:hover:not(.active) {
background: #f8f9fa;
2025-04-22 10:22:33 +08:00
}
}
}
2025-06-14 13:09:26 +08:00
// 右侧面板
.right-panel {
flex: 1;
background: #ffffff;
padding: 40rpx;
overflow: hidden;
display: flex;
flex-direction: column;
2025-04-22 10:22:33 +08:00
}
2025-06-14 13:09:26 +08:00
// 资源类型和年级区域
.resource-section,
.grade-section {
margin-bottom: 40rpx;
flex-shrink: 0;
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
.section-title {
font-size: 32rpx;
font-weight: 600;
color: #333333;
margin-bottom: 30rpx;
}
}
// 资源类型网格
.type-grid {
2025-04-22 10:22:33 +08:00
display: flex;
2025-06-14 13:09:26 +08:00
flex-wrap: wrap;
gap: 20rpx;
2025-04-22 10:22:33 +08:00
margin-bottom: 20rpx;
2025-06-14 13:09:26 +08:00
}
2025-04-22 10:22:33 +08:00
2025-06-14 13:09:26 +08:00
.type-item {
padding: 20rpx 30rpx;
background: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 8rpx;
cursor: pointer;
transition: all 0.3s ease;
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
.type-text {
font-size: 28rpx;
color: #666666;
2025-04-22 10:22:33 +08:00
}
2025-07-09 17:04:25 +08:00
&.active {
2025-06-14 13:09:26 +08:00
border-color: #ff9800;
background: #fff3e0;
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
.type-text {
color: #ff9800;
2025-04-22 10:22:33 +08:00
}
2025-06-14 13:09:26 +08:00
}
}
2025-04-22 10:22:33 +08:00
2025-06-14 13:09:26 +08:00
// 年级网格
.grade-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20rpx;
}
2025-04-22 10:22:33 +08:00
2025-06-14 13:09:26 +08:00
.grade-item {
padding: 25rpx 20rpx;
background: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 8rpx;
cursor: pointer;
transition: all 0.3s ease;
text-align: center;
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
.grade-text {
font-size: 28rpx;
color: #666666;
}
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
&:hover {
border-color: #ff9800;
background: #fff3e0;
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
.grade-text {
color: #ff9800;
2025-04-22 10:22:33 +08:00
}
}
}
2025-06-14 13:09:26 +08:00
// 空状态
.empty-state {
flex: 1;
2025-04-22 10:22:33 +08:00
display: flex;
align-items: center;
2025-06-14 13:09:26 +08:00
justify-content: center;
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
.empty-text {
font-size: 28rpx;
color: #999999;
}
2025-04-22 10:22:33 +08:00
}
2025-06-14 13:09:26 +08:00
// 响应式适配
@media (max-width: 768px) {
.left-panel {
width: 150rpx;
2025-04-22 10:22:33 +08:00
}
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
.subject-item {
padding: 20rpx 10rpx;
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
.subject-name {
font-size: 12px;
}
2025-04-22 10:22:33 +08:00
}
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
.right-panel {
padding: 20rpx;
}
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
.tag-item {
padding: 10rpx 18rpx;
2025-07-09 17:04:25 +08:00
2025-06-14 13:09:26 +08:00
.tag-text {
font-size: 12px;
}
2025-04-22 10:22:33 +08:00
}
}
2025-07-09 17:04:25 +08:00
</style>