From b4698317fb97d89e389f131e8fd9dcf8d7108c77 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: Mon, 29 Jul 2024 17:17:21 +0800
Subject: [PATCH] 修改
---
src/views/onlineEducation/courseManage/index.vue | 133 +++++++++++++++++++++++++++++++++----------
1 files changed, 101 insertions(+), 32 deletions(-)
diff --git a/src/views/onlineEducation/courseManage/index.vue b/src/views/onlineEducation/courseManage/index.vue
index b87d702..e1c2f91 100644
--- a/src/views/onlineEducation/courseManage/index.vue
+++ b/src/views/onlineEducation/courseManage/index.vue
@@ -1,17 +1,35 @@
<template>
<div class="app-container">
- <div style="margin-bottom: 10px">
- <el-button
- type="primary"
- plain
- icon="Plus"
- @click="openDialog('add',{})"
- >新增</el-button>
+ <div style="display: flex;justify-content: space-between">
+ <el-form :inline="true" style="display: flex;align-items: center;flex-wrap: wrap;" >
+ <el-form-item>
+ <el-button
+ type="primary"
+ plain
+ icon="Plus"
+ @click="openDialog('add',{})"
+ >新增</el-button>
+ </el-form-item>
+ <el-form-item label="课程名称:" >
+ <el-input v-model="data.queryParams.name" placeholder="请输入课程名称"></el-input>
+ </el-form-item>
+ <el-form-item >
+ <el-button
+ type="primary"
+ @click="getList"
+ >查询</el-button>
+ <el-button
+ type="primary"
+ plain
+ @click="reset"
+ >重置</el-button>
+ </el-form-item>
+ </el-form>
</div>
<!-- 表格数据 -->
<el-table v-loading="loading" :data="dataList" :border="true">
<el-table-column label="序号" type="index" align="center" width="80" />
- <el-table-column label="封面" prop="logo" align="center" >
+ <el-table-column label="封面" prop="logo" align="center" width="130">
<template #default="scope">
<div class="demo-image__preview" v-if="scope.row.logo && scope.row.logo.length>0">
<el-image
@@ -30,11 +48,15 @@
</el-table-column>
<el-table-column label="课程名称" prop="name" align="center" />
<el-table-column label="课程分类" prop="categoryName" align="center" />
- <el-table-column label="要求课时" prop="period" align="center" />
+ <el-table-column label="要求课时" prop="period" align="center" >
+ <template #default="scope">
+ <span>{{ scope.row.period?(scope.row.period/60).toFixed(2).replace(/\.00$/, '') + '分钟':'' }}</span>
+ </template>
+ </el-table-column>
<el-table-column label="提交单位" prop="companyName" align="center" />
<el-table-column label="审核状态" prop="state" align="center" >
<template #default="scope">
- <span>{{scope.row.state == 1?'待审核':scope.row.state == 2?'审批通过':'审批不通过'}}</span>
+ <span>{{scope.row.state == 0?'待提交':scope.row.state == 1?'待审核':scope.row.state == 2?'审批通过':'审批不通过'}}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" prop="createTime" align="center" width="180" />
@@ -58,31 +80,53 @@
<span v-else>--</span>
</template>
</el-table-column>
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="240">
<template #default="scope">
- <div v-if="scope.row.state == 2">
- <div v-if="data.isAdmin">
+ <div v-if="data.isAdmin">
+ <div v-if="scope.row.state !== 3">
+ <el-button link type="primary" v-if="scope.row.state == 1" @click="openApprove(scope.row)">审核</el-button>
<el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>
<el-button link type="primary" @click="toChapters(scope.row)">章节</el-button>
<el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
</div>
<div v-else><el-button link type="primary" @click="toChapters(scope.row)">章节</el-button></div>
</div>
- <div v-else-if="scope.row.state == 1" >
- <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>
- <el-button link type="primary" v-if="data.isAdmin" @click="openApprove(scope.row)">审核</el-button>
- <el-button link type="primary" @click="toChapters(scope.row)">章节</el-button>
- <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
- </div>
- <div v-else-if="scope.row.state == 3" >
- <div v-if="data.isAdmin">--</div>
- <div v-else>
- <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>
- <el-button link type="primary" @click="submitApprove(scope.row)">提交审核</el-button>
- <el-button link type="primary" @click="toChapters(scope.row)">章节</el-button>
- <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
+ <div v-else-if="!data.isAdmin">
+ <div v-if="scope.row.state !== 2">
+ <el-button link type="primary" v-if="scope.row.state == 0 || scope.row.state == 3" @click="submitApprove(scope.row)">提交审核</el-button>
+ <el-button link type="primary" v-if="scope.row.state == 1" @click="submitApprove(scope.row)">取消审核</el-button>
+ <el-button link type="primary" v-if="scope.row.state !== 1" @click="openDialog('edit',scope.row)" >编辑</el-button>
+ <el-button link type="primary" @click="toChapters(scope.row)">章节</el-button>
+ <el-button link type="danger" v-if="scope.row.state !== 1" @click="handleDelete(scope.row)">删除</el-button>
</div>
+ <div v-else>
+ <el-button link type="primary" @click="toChapters(scope.row)">章节</el-button>
+ </div>
+
</div>
+<!-- <div v-if="scope.row.state == 2">-->
+<!-- <div v-if="data.isAdmin">-->
+<!-- <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>-->
+<!-- <el-button link type="primary" @click="toChapters(scope.row)">章节</el-button>-->
+<!-- <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>-->
+<!-- </div>-->
+<!-- <div v-else><el-button link type="primary" @click="toChapters(scope.row)">章节</el-button></div>-->
+<!-- </div>-->
+<!-- <div v-else-if="scope.row.state == 1" >-->
+<!-- <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>-->
+<!-- <el-button link type="primary" v-if="data.isAdmin" @click="openApprove(scope.row)">审核</el-button>-->
+<!-- <el-button link type="primary" @click="toChapters(scope.row)">章节</el-button>-->
+<!-- <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>-->
+<!-- </div>-->
+<!-- <div v-else-if="scope.row.state == 3" >-->
+<!-- <div v-if="data.isAdmin">--</div>-->
+<!-- <div v-else>-->
+<!-- <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>-->
+<!-- <el-button link type="primary" @click="submitApprove(scope.row)">提交审核</el-button>-->
+<!-- <el-button link type="primary" @click="toChapters(scope.row)">章节</el-button>-->
+<!-- <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>-->
+<!-- </div>-->
+<!-- </div>-->
</template>
</el-table-column>
</el-table>
@@ -112,21 +156,24 @@
<script setup>
import {getCurrentInstance, onMounted, onUnmounted, reactive, ref, toRefs} from "vue";
+
import {ElMessage, ElMessageBox} from "element-plus";
import {delCompany, getCompany} from "@/api/onlineEducation/company";
import courseManageDialog from './components/courseManageDialog.vue'
import {delBanner, getBanner} from "@/api/onlineEducation/banner";
-import {useRouter} from 'vue-router'
+import {useRoute, useRouter} from 'vue-router'
import Cookies from "js-cookie";
import {changeCourseStatus, delCourse, doCourse, getCourse} from "@/api/onlineEducation/courseManage";
const { proxy } = getCurrentInstance();
const router = useRouter()
const loading = ref(false);
const dialogRef = ref();
+const route = useRoute()
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
+ name: ''
},
total: 0,
dataList: [],
@@ -141,6 +188,13 @@
const { queryParams, total, dataList } = toRefs(data);
onMounted(async ()=>{
+ if(route.query.val){
+ const val = JSON.parse(route.query.val)
+ if(val){
+ data.queryParams.pageNum = val.pageNum;
+ data.queryParams.pageSize = val.pageSize;
+ }
+ }
const userInfo = JSON.parse(Cookies.get('userInfo'))
console.log("userInfo",userInfo)
if(userInfo.userType === 0){
@@ -179,7 +233,12 @@
/** 重置新增的表单以及其他数据 */
function reset() {
- proxy.resetForm("roleRef");
+ data.queryParams = {
+ pageNum: 1,
+ pageSize: 10,
+ name: ''
+ }
+ getList()
}
const handleDelete = (val) => {
ElMessageBox.confirm(
@@ -244,20 +303,30 @@
}
}
const submitApprove = async (val) => {
- const param = {
+ let param = {
+ companyId: val.companyId,
id: val.id,
- state: 1
+ state: null
+ }
+ //取消审批
+ if(val.state == 1){
+ param.state = 0
+ }else {
+ param.state = 1
}
const res = await doCourse(param)
if(res.code == 200){
- ElMessage.success('提交成功')
+ ElMessage.success('操作成功')
await getList()
}else{
ElMessage.warning(res.message)
}
}
const toChapters = (val) => {
- router.push({ path: "/chapters", query: { courseId: val.id } });
+ val.pageNum = data.queryParams.pageNum;
+ val.pageSize = data.queryParams.pageSize
+ const v = JSON.stringify(val)
+ router.push({ path: "/chapters", query: { val: v } });
}
</script>
--
Gitblit v1.9.2