zhouwx
2024-07-23 bfa061edf56598f05b5817565bf181c64b149f99
src/views/onlineEducation/courseManage/courseChapters/index.vue
@@ -1,7 +1,7 @@
<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>
    <!-- 表格数据 -->
@@ -16,9 +16,9 @@
      <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>
@@ -36,6 +36,7 @@
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();
@@ -53,11 +54,16 @@
});
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();
});
@@ -147,7 +153,13 @@
      })
}
const back = () => {
  router.push("/courseManage/course");
  const obj = {
    pageNum: backValue.value.pageNum,
    pageSize: backValue.value.pageSize,
  }
  const v = JSON.stringify(obj)
  router.push({ path: "/courseManage/course", query: { val: v } });
}