2024-06-12 07:47:55 +00:00
|
|
|
|
<template>
|
|
|
|
|
<div class="container">
|
|
|
|
|
<div class="bread-container">
|
|
|
|
|
<el-breadcrumb separator=">">
|
|
|
|
|
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
|
|
|
|
<el-breadcrumb-item>同步教材</el-breadcrumb-item>
|
|
|
|
|
</el-breadcrumb>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<el-card class="card-filter">
|
|
|
|
|
<el-form label-width="auto">
|
2024-06-20 09:08:05 +00:00
|
|
|
|
<el-form-item v-if="textbook2List && textbook2List.length" label="学段">
|
|
|
|
|
<el-radio-group v-model="radio2" @change="handle2Change">
|
|
|
|
|
<el-radio-button v-for="item in textbook2List" :label="item.catalogName" :value="item.catalogId"
|
|
|
|
|
:key="item.catalogId" />
|
|
|
|
|
</el-radio-group>
|
2024-06-12 07:47:55 +00:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
2024-06-20 09:08:05 +00:00
|
|
|
|
<el-form-item v-if="textbook3List && textbook3List.length" label="年级">
|
|
|
|
|
<el-radio-group v-model="radio3" @change="handle3Change">
|
|
|
|
|
<el-radio-button v-for="item in textbook3List" :label="item.catalogName" :value="item.catalogId"
|
|
|
|
|
:key="item.catalogId" />
|
|
|
|
|
</el-radio-group>
|
2024-06-12 07:47:55 +00:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
2024-06-20 09:08:05 +00:00
|
|
|
|
<el-form-item v-if="textbook4List && textbook4List.length" label="学科">
|
|
|
|
|
<el-radio-group v-model="radio4" @change="handle4Change">
|
|
|
|
|
<el-radio-button v-for="item in textbook4List" :label="item.catalogName" :value="item.catalogId"
|
|
|
|
|
:key="item.catalogId" />
|
|
|
|
|
</el-radio-group>
|
2024-06-12 07:47:55 +00:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
2024-06-20 09:08:05 +00:00
|
|
|
|
<el-form-item v-if="textbook5List && textbook5List.length" label="版本">
|
|
|
|
|
<el-radio-group v-model="radio5" @change="handle5Change">
|
|
|
|
|
<el-radio-button v-for="item in textbook5List" :label="item.catalogName" :value="item.catalogId"
|
|
|
|
|
:key="item.catalogId" />
|
|
|
|
|
</el-radio-group>
|
2024-06-12 07:47:55 +00:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
2024-06-20 09:08:05 +00:00
|
|
|
|
<el-form-item v-if="textbook6List && textbook6List.length" label="教材">
|
|
|
|
|
<el-radio-group v-model="radio6" @change="handle6Change">
|
|
|
|
|
<el-radio-button v-for="item in textbook6List" :label="item.catalogName" :value="item.catalogId"
|
|
|
|
|
:key="item.catalogId" />
|
|
|
|
|
</el-radio-group>
|
2024-06-12 07:47:55 +00:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="类型">
|
2024-06-24 07:20:12 +00:00
|
|
|
|
<el-radio-group v-model="queryParams.type">
|
2024-07-02 01:32:49 +00:00
|
|
|
|
<el-radio-button label="全部" value=""></el-radio-button>
|
|
|
|
|
<el-radio-button label="课件" value="1"></el-radio-button>
|
|
|
|
|
<el-radio-button label="精品课堂" value="2"></el-radio-button>
|
|
|
|
|
<el-radio-button label="作业" value="3"></el-radio-button>
|
|
|
|
|
<el-radio-button label="试卷" value="4"></el-radio-button>
|
2024-06-20 09:08:05 +00:00
|
|
|
|
</el-radio-group>
|
2024-06-12 07:47:55 +00:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="格式">
|
2024-07-02 01:32:49 +00:00
|
|
|
|
<el-radio-group v-model="queryParams.formatSuffix">
|
|
|
|
|
<el-radio-button label="全部" value=""></el-radio-button>
|
|
|
|
|
<el-radio-button label="PPT" value="1"></el-radio-button>
|
|
|
|
|
<el-radio-button label="WORD" value="2"></el-radio-button>
|
|
|
|
|
<el-radio-button label="PDF" value="3"></el-radio-button>
|
|
|
|
|
<el-radio-button label="图片" value="4"></el-radio-button>
|
|
|
|
|
<el-radio-button label="音频" value="5"></el-radio-button>
|
|
|
|
|
<el-radio-button label="视频" value="6"></el-radio-button>
|
|
|
|
|
<el-radio-button label="其它" value="7"></el-radio-button>
|
2024-06-20 09:08:05 +00:00
|
|
|
|
</el-radio-group>
|
2024-06-12 07:47:55 +00:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</el-card>
|
|
|
|
|
|
2024-06-18 00:44:06 +00:00
|
|
|
|
<el-row :gutter="10" style="margin-top: 10px">
|
2024-06-12 07:47:55 +00:00
|
|
|
|
<el-col :span="6">
|
|
|
|
|
<el-card>
|
|
|
|
|
<template #header>
|
|
|
|
|
<div class="card--left-header">
|
|
|
|
|
<span class="title">目录</span>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
2024-06-20 09:08:05 +00:00
|
|
|
|
<el-table @row-click="handleRowClick" :data="textbook7List" row-key="id" border default-expand-all
|
|
|
|
|
:show-header="false">
|
|
|
|
|
<el-table-column prop="label" label="label" />
|
2024-06-12 07:47:55 +00:00
|
|
|
|
</el-table>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
<el-col :span="18">
|
|
|
|
|
<el-card>
|
|
|
|
|
<div class="card-right-header">
|
2024-06-18 00:44:06 +00:00
|
|
|
|
<!-- 排序组件 -->
|
|
|
|
|
<JzSort v-model="sortResult" :sortData="sortData" />
|
2024-07-02 01:32:49 +00:00
|
|
|
|
<div class="header-search">
|
|
|
|
|
<el-input v-model="queryParams.fileName" style="width: 300px" placeholder="请输入关键词" clearable
|
|
|
|
|
@clear="handleClear" />
|
|
|
|
|
<el-button type="primary" :icon="Search" @click="handleQuery" />
|
|
|
|
|
</div>
|
2024-06-12 07:47:55 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="book-grid">
|
2024-06-24 07:20:12 +00:00
|
|
|
|
<el-card v-for="item in tableData" :key="item" @click="goto(item)">
|
2024-06-12 07:47:55 +00:00
|
|
|
|
<div class="book-content">
|
2024-07-02 01:32:49 +00:00
|
|
|
|
<img v-if="item.fileSuffix.includes('doc')" src="@/assets/images/word.png" alt="" />
|
|
|
|
|
<img v-else-if="item.fileSuffix.includes('xls')" src="@/assets/images/excel.png" alt="" />
|
|
|
|
|
<img v-else-if="item.fileSuffix.includes('pdf')" src="@/assets/images/pdf.png" alt="" />
|
|
|
|
|
<img v-else-if="item.fileSuffix.includes('txt')" src="@/assets/images/txt.png" alt="" />
|
|
|
|
|
<img v-else src="@/assets/images/book.png" alt="" />
|
2024-06-12 07:47:55 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<template #footer>
|
2024-06-20 09:08:05 +00:00
|
|
|
|
<div class="book-title">{{ item.fileName }}</div>
|
2024-06-12 07:47:55 +00:00
|
|
|
|
<div class="book-des">
|
2024-06-20 09:08:05 +00:00
|
|
|
|
<div class="book-teacher"><span>{{ item.createBy }}</span> | <span>{{ item.createDept
|
|
|
|
|
}}</span></div>
|
2024-06-12 07:47:55 +00:00
|
|
|
|
<div class="book-view">
|
2024-06-24 07:20:12 +00:00
|
|
|
|
<span style="margin-right: 5px;">
|
2024-06-12 07:47:55 +00:00
|
|
|
|
<el-icon>
|
|
|
|
|
<View />
|
|
|
|
|
</el-icon>
|
|
|
|
|
</span>
|
2024-06-20 09:08:05 +00:00
|
|
|
|
<span>{{ item.downloadNum }}</span>
|
2024-06-12 07:47:55 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-card>
|
|
|
|
|
</div>
|
2024-06-20 09:08:05 +00:00
|
|
|
|
<el-pagination class="book-page" background layout="prev, pager, next, sizes,jumper" :total="total"
|
|
|
|
|
@current-change="handleCurrentChange" @size-change="handleSizeChange" />
|
2024-06-12 07:47:55 +00:00
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-06-20 09:08:05 +00:00
|
|
|
|
import { ref, onMounted, watchEffect, watch } from 'vue';
|
2024-06-24 07:20:12 +00:00
|
|
|
|
import { useRouter } from 'vue-router'
|
2024-07-02 01:32:49 +00:00
|
|
|
|
import { View, Search } from '@element-plus/icons-vue'
|
2024-06-20 09:08:05 +00:00
|
|
|
|
import { getTextbookAPI, getTextbookTreeAPI, getTextbookList } from '@/apis/textbook'
|
|
|
|
|
import JzSort from '@/components/JzSort/index.vue'
|
|
|
|
|
|
2024-07-02 01:32:49 +00:00
|
|
|
|
const imgSuffix = ['.jpg', '.png', '.jpeg', '.gif', '.bmp']
|
|
|
|
|
|
2024-06-24 07:20:12 +00:00
|
|
|
|
const router = useRouter()
|
2024-06-20 09:08:05 +00:00
|
|
|
|
const queryParams = ref({
|
|
|
|
|
catalogId: undefined,
|
2024-07-02 01:32:49 +00:00
|
|
|
|
fileName: '',
|
2024-06-24 07:20:12 +00:00
|
|
|
|
type: undefined,
|
2024-07-02 01:32:49 +00:00
|
|
|
|
formatSuffix: undefined,
|
2024-06-20 09:08:05 +00:00
|
|
|
|
pageNum: 1,
|
2024-06-24 07:20:12 +00:00
|
|
|
|
pageSize: 6,
|
|
|
|
|
orderByColumn: '',
|
|
|
|
|
isAsc: ''
|
2024-06-20 09:08:05 +00:00
|
|
|
|
})
|
|
|
|
|
const tableData = ref([])
|
|
|
|
|
const total = ref(0)
|
|
|
|
|
|
|
|
|
|
const radio2 = ref()
|
|
|
|
|
const radio3 = ref()
|
|
|
|
|
const radio4 = ref()
|
|
|
|
|
const radio5 = ref()
|
|
|
|
|
const radio6 = ref()
|
|
|
|
|
|
|
|
|
|
// 1主目录,2学段,3年级,4学科,5版本,6教材,7目录
|
|
|
|
|
const textbookList = ref([])
|
|
|
|
|
const textbook2List = ref([])
|
|
|
|
|
const textbook3List = ref([])
|
|
|
|
|
const textbook4List = ref([])
|
|
|
|
|
const textbook5List = ref([])
|
|
|
|
|
const textbook6List = ref([])
|
|
|
|
|
const textbook7List = ref([])
|
|
|
|
|
|
|
|
|
|
const getTextbookData = async () => {
|
|
|
|
|
const res = await getTextbookAPI()
|
|
|
|
|
textbookList.value = res.data
|
|
|
|
|
|
|
|
|
|
textbook2List.value = filterListByType(2)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handle2Change = (val) => {
|
|
|
|
|
textbook3List.value = filterListByParentId(val)
|
|
|
|
|
textbook4List.value = []
|
|
|
|
|
textbook5List.value = []
|
|
|
|
|
textbook6List.value = []
|
|
|
|
|
textbook7List.value = []
|
|
|
|
|
console.log(val);
|
|
|
|
|
queryParams.value.catalogId = val
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handle3Change = (val) => {
|
|
|
|
|
textbook4List.value = filterListByParentId(val)
|
|
|
|
|
textbook5List.value = []
|
|
|
|
|
textbook6List.value = []
|
|
|
|
|
textbook7List.value = []
|
|
|
|
|
queryParams.value.catalogId = val
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handle4Change = (val) => {
|
|
|
|
|
textbook5List.value = filterListByParentId(val)
|
|
|
|
|
textbook6List.value = []
|
|
|
|
|
textbook7List.value = []
|
|
|
|
|
queryParams.value.catalogId = val
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handle5Change = (val) => {
|
|
|
|
|
textbook6List.value = filterListByParentId(val)
|
|
|
|
|
textbook7List.value = []
|
|
|
|
|
queryParams.value.catalogId = val
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handle6Change = async (val) => {
|
|
|
|
|
const res = await getTextbookTreeAPI({ parentId: val })
|
|
|
|
|
textbook7List.value = res.data
|
|
|
|
|
queryParams.value.catalogId = val
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const filterListByType = (type) => {
|
|
|
|
|
return textbookList.value.filter(item => item.type == type)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const filterListByParentId = (parentId) => {
|
|
|
|
|
return textbookList.value.filter(item => item.parentId == parentId)
|
|
|
|
|
}
|
2024-06-18 00:44:06 +00:00
|
|
|
|
|
|
|
|
|
// 排序初始化数据
|
|
|
|
|
const sortData = [
|
2024-06-24 07:20:12 +00:00
|
|
|
|
{ label: '上传时间', key: 'createTime' },
|
|
|
|
|
{ label: '浏览量', key: 'previewNum' },
|
|
|
|
|
{ label: '下载量', key: 'downloadNum' }
|
2024-06-18 00:44:06 +00:00
|
|
|
|
];
|
|
|
|
|
const sortResult = ref({}); // 排序结果
|
|
|
|
|
|
2024-06-20 09:08:05 +00:00
|
|
|
|
const getTextbookListData = async () => {
|
|
|
|
|
const res = await getTextbookList(queryParams.value)
|
|
|
|
|
tableData.value = res.rows
|
|
|
|
|
total.value = res.total
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleCurrentChange = (val) => {
|
2024-06-24 07:20:12 +00:00
|
|
|
|
queryParams.value.pageNum = val
|
|
|
|
|
getTextbookListData()
|
2024-06-20 09:08:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleSizeChange = (val) => {
|
2024-06-24 07:20:12 +00:00
|
|
|
|
queryParams.value.pageSize = val
|
|
|
|
|
getTextbookListData()
|
2024-06-20 09:08:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleRowClick = (val) => {
|
|
|
|
|
queryParams.value.catalogId = val.id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
watch(() => queryParams.value.catalogId, (oldVal, newVal) => {
|
|
|
|
|
getTextbookListData()
|
|
|
|
|
})
|
|
|
|
|
|
2024-06-24 07:20:12 +00:00
|
|
|
|
// 监听排序结果
|
|
|
|
|
watchEffect(() => {
|
|
|
|
|
queryParams.value.orderByColumn = sortResult.value.key
|
|
|
|
|
queryParams.value.isAsc = sortResult.value.order
|
|
|
|
|
|
|
|
|
|
getTextbookListData()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const goto = (item) => {
|
|
|
|
|
router.push({ path: 'textBookDetail', query: { id: item.id } })
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-02 01:32:49 +00:00
|
|
|
|
|
|
|
|
|
const handleQuery = () => {
|
|
|
|
|
if (!queryParams.value.fileName) {
|
|
|
|
|
ElMessage.error('请输入查询关键字!')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
getShowData()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleClear = () => {
|
|
|
|
|
queryParams.value.fileName = ''
|
|
|
|
|
getShowData()
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-20 09:08:05 +00:00
|
|
|
|
onMounted(() => {
|
|
|
|
|
getTextbookData()
|
|
|
|
|
getTextbookListData()
|
|
|
|
|
})
|
2024-06-12 07:47:55 +00:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.container {
|
|
|
|
|
.bread-container {
|
|
|
|
|
padding: 25px 0;
|
|
|
|
|
|
|
|
|
|
:deep(.el-breadcrumb__inner) {
|
|
|
|
|
color: #fff;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-breadcrumb__separator) {
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.card-filter {
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.card--left-header {
|
|
|
|
|
.title {
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.card-right-header {
|
2024-07-02 01:32:49 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
padding-bottom: 10px;
|
|
|
|
|
border-bottom: 1px solid #919DA3;
|
2024-06-12 07:47:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.book-grid {
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: repeat(3, 1fr);
|
|
|
|
|
grid-template-rows: repeat(2, 1fr);
|
2024-07-02 01:32:49 +00:00
|
|
|
|
gap: 10px;
|
2024-06-12 07:47:55 +00:00
|
|
|
|
|
|
|
|
|
.book-content {
|
|
|
|
|
|
2024-07-02 01:32:49 +00:00
|
|
|
|
img {
|
2024-06-24 07:20:12 +00:00
|
|
|
|
border-radius: 10px;
|
|
|
|
|
width: 100%;
|
2024-07-02 01:32:49 +00:00
|
|
|
|
height: 240px;
|
2024-06-20 09:08:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-06-12 07:47:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.book-title {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-18 02:37:00 +00:00
|
|
|
|
.book-des {
|
2024-06-12 07:47:55 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
2024-06-18 02:37:00 +00:00
|
|
|
|
color: #919DA3;
|
2024-06-12 07:47:55 +00:00
|
|
|
|
padding: 5px 0;
|
|
|
|
|
}
|
2024-06-18 02:37:00 +00:00
|
|
|
|
}
|
2024-06-12 07:47:55 +00:00
|
|
|
|
|
2024-06-18 02:37:00 +00:00
|
|
|
|
.book-page {
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: end
|
2024-06-12 07:47:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-06-18 00:44:06 +00:00
|
|
|
|
</style>
|