马宇豪
2025-03-07 db905ecd14f63dba9337b4f4715584ef2d7e8c7e
src/views/onlineEducation/courseSupervision/components/courseDialog.vue
@@ -3,7 +3,7 @@
    :visible.sync="dialogVisible"
    :modal-append-to-body="false"
    :close-on-click-modal="false"
    width="600px"
    width="50%"
    :before-close="handleClose"
  >
    <div style="margin:  0 25px">
@@ -26,7 +26,7 @@
<!--      </div>-->
      <div style="display: flex;flex-direction: column">
        <span style="font-size: 20px;font-weight: 550">课程章节资源</span>
        <span style="font-size: 20px;font-weight: 550">课程内容</span>
        <el-table
          border
          :data="courseTable"
@@ -43,6 +43,13 @@
          <el-table-column
            prop="chapterName"
            label="小节名称" align="center">
          </el-table-column>
          <el-table-column
            prop="teacher"
            label="讲师" align="center">
            <template #default="scope">
              <span>{{scope.row.teacher ? scope.row.teacher : '--'}}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="资源类别"
@@ -63,14 +70,19 @@
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
    <span slot="footer" class="dialog-footer" v-if="showBtn">
    <el-button type="primary" @click="examine('pass')">审核通过</el-button>
    <el-button type="warning" @click="examine('reject')">审核驳回</el-button>
    </span>
  </el-dialog>
</template>
<script >
import { checkCourse, listCourse } from '@/api/onlineEducation/course'
export default {
  name: 'addUser',
  components: {
@@ -82,25 +94,32 @@
      dialogStatus: '',
      dataForm: {},
      courseTable: [],
      courseList: []
      courseList: [],
      showBtn:false
    }
  },
  created() {
  },
  methods: {
    openDialog (data,type) {
    openDialog (data,type,courseType) {
      this.dialogVisible = true;
      this.dataForm = data;
      console.log('dataForm ',this.dataForm )
      if(type === 'course'){
        this.courseList = data.outline
        this.courseTable = this.recursion(data.outline,type)
        if(courseType == 'check'){
          this.showBtn = true
          console.log('this.showBtn ',this.showBtn )
        }
      }else {
        console.log('courseT2222222222able',data.chapterList)
        this.courseList = data.chapterList
        this.courseTable = this.recursion(data.chapterList,type)
      }
      console.log('courseT2222222222able',this.courseTable)
      console.log('coursee',this.courseTable)
    },
    recursion (data,type) {
      let tmp = []
@@ -121,7 +140,8 @@
                  resourceType: child.haveResource == 0 ? '视频' : '音频' ,
                  lessonNum: child.lessonNum,
                  url: child.url,
                  children: this.recursion(child.children)
                  children: this.recursion(child.children),
                  teacher: child.teacher
                })
              })
            }else {
@@ -134,7 +154,8 @@
                  resourceType: child.haveResource == 0 ? '视频' : '音频' ,
                  lessonNum: child.lessonNum,
                  url: child.url,
                  children: this.recursion(child.children)
                  children: this.recursion(child.children),
                  teacher: child.teacher
                })
              })
            }
@@ -151,12 +172,47 @@
      this.isClose = !this.isClose
    },
    handleClose() {
      this.showBtn = false
      this.dialogVisible = false;
      this.$emit("getList");
    },
    onSubmit() {
              this.$emit("getList");
              this.dialogVisible = false;
        this.$emit("getList");
        this.dialogVisible = false;
    },
    examine(type){
      let msg = '';
      const param = {
        id: this.dataForm.id,
        status: null
      }
      if(type === 'pass'){
        param.status = 2
        msg = '审核通过'
      }else {
        param.status = 3
        msg = '审核驳回'
      }
      this.$confirm(`确定${msg}该条数据?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        checkCourse(param).then((res) => {
          if (res.code == 200) {
            this.$message({
              message: '成功',
              type: 'success'
            })
            this.handleClose()
          }else {
            this.$message({
              message: res.msg,
              type: 'warning'
            })
          }
        })
      })
    },
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      if(columnIndex === 0) {
@@ -203,4 +259,9 @@
.open{
  height: 15px;
}
.dialog-footer{
  display: flex;
  align-items: center;
  justify-content: space-around;
}
</style>