| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div style="margin-bottom: 10px"> |
| | | <el-button type="success" plain @click="openDialog('addFirst',{courseId: data.courseId})">章添加</el-button> |
| | | |
| | | <div style="margin-bottom: 10px;display:flex;justify-content: space-between;align-items: center"> |
| | | <el-button type="success" plain @click="openDialog('addFirst',{courseId: data.courseId})" :disabled="disabled">章添加</el-button> |
| | | <el-button type="primary" plain @click="back">返回</el-button> |
| | | </div> |
| | | <!-- 表格数据 --> |
| | | <el-table v-loading="loading" :data="dataList" :border="true" row-key="id" :tree-props="{ children: 'chapterPeriods' }"> |
| | |
| | | <el-table-column label="章节名称" > |
| | | <template #default="scope"> |
| | | <span>{{scope.row.name}}</span> |
| | | <span v-if="scope.row.chapterId" style="font-size: 14px;margin-left: 5px">【{{scope.row.resource.resourceType === 1 ? '视频:':scope.row.resource.resourceType === 2 ? '音频:':'文档:'}}{{scope.row.resource.name}}】| {{scope.row.timeFormat}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="排序" prop="sort" align="center" width="80" /> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="250" > |
| | | <template #default="scope"> |
| | | <el-button type="success" plain @click="openDialog('add',scope.row)" v-if="!scope.row.chapterId">节添加</el-button> |
| | | <el-button type="primary" plain @click="openDialog('edit',scope.row)">编辑</el-button> |
| | | <el-button type="danger" plain @click="handleDelete(scope.row)">删除</el-button> |
| | | <el-button type="success" plain @click="openDialog('add',scope.row)" v-if="!scope.row.chapterId" :disabled="disabled">节添加</el-button> |
| | | <el-button type="primary" plain @click="openDialog('edit',scope.row)" :disabled="disabled">编辑</el-button> |
| | | <el-button type="danger" plain @click="handleDelete(scope.row)" :disabled="disabled">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | import {delArea, getArea} from "@/api/backManage/area"; |
| | | import {getDictList} from "@/api/backManage/evaluate"; |
| | | import {delMonitor} from "@/api/sysUsers"; |
| | | import {useRoute} from 'vue-router' |
| | | import {useRoute,useRouter} from 'vue-router' |
| | | import {delClassification, getClassification} from "@/api/onlineEducation/courseClass"; |
| | | import {delChapter, delPeriod, getChapters} from "@/api/onlineEducation/chapters"; |
| | | import Cookies from "js-cookie"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const route = useRoute() |
| | | const router = useRouter(); |
| | | const loading = ref(false); |
| | | const areaRef = ref(); |
| | | const cityList = ref([]) |
| | |
| | | }); |
| | | |
| | | const { queryParams, total, dataList } = toRefs(data); |
| | | |
| | | const backValue = ref() |
| | | const disabled = ref(false) |
| | | //页面加载 |
| | | onMounted(() => { |
| | | |
| | | data.courseId = route.query.courseId |
| | | backValue.value = JSON.parse(route.query.val) |
| | | const userInfo = JSON.parse(Cookies.get('userInfo')) |
| | | if((backValue.value.state === 2 || backValue.value.state === 1 ) && userInfo.userType == 1){ |
| | | disabled.value = true; |
| | | } |
| | | data.courseId = backValue.value.id |
| | | console.log("rou",data.courseId) |
| | | getList(); |
| | | }); |
| | |
| | | } |
| | | const res = await getChapters(param); |
| | | if(res.code === 200){ |
| | | dataList.value = res.data |
| | | dataList.value = res.data.map(item => { |
| | | return { |
| | | ...item, |
| | | chapterPeriods: item.chapterPeriods.map(r => { |
| | | return { |
| | | ...r, |
| | | timeFormat: r.resource.resourceType === 1 || r.resource.resourceType === 2 ? secondsToTime(r.resource.resourceLength) : r.resource.docPage + '页' |
| | | } |
| | | }) |
| | | |
| | | } |
| | | }) |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | | loading.value = false; |
| | | console.log('dataList.value',dataList.value) |
| | | } |
| | | const secondsToTime = (seconds) => { |
| | | const hours = Math.floor(seconds / 3600); |
| | | const minutes = Math.floor((seconds % 3600) / 60); |
| | | const secs = seconds % 60; |
| | | |
| | | return [ |
| | | hours, |
| | | hours > 0 ? pad(minutes) : minutes, |
| | | pad(secs) |
| | | ].join(':'); |
| | | } |
| | | const pad = (number) => { |
| | | return (number < 10 ? '0' : '') + number; |
| | | } |
| | | |
| | | const openDialog = (type, value) => { |
| | |
| | | |
| | | }) |
| | | } |
| | | const back = () => { |
| | | |
| | | const obj = { |
| | | pageNum: backValue.value.pageNum, |
| | | pageSize: backValue.value.pageSize, |
| | | } |
| | | const v = JSON.stringify(obj) |
| | | router.push({ path: "/courseManage/course", query: { val: v } }); |
| | | } |
| | | |
| | | |
| | | </script> |