浏览代码

修改功能

lex 2 年之前
父节点
当前提交
9e925502c7

+ 18 - 0
src/views/liveClassManager/api.js

@@ -329,3 +329,21 @@ export function leaveSchool(data) {
     data
   });
 }
+
+// 根据 修改直播课
+export function updateLiveGroup(data) {
+  return request({
+    url: "/api-web/vipGroupManage/updateLiveGroup",
+    method: "POST",
+    data
+  });
+}
+
+export function delLiveGroup(data) {
+  return request({
+    url: "/api-web/vipGroupManage/delLiveGroup/" + data.id,
+    method: "get"
+  });
+}
+
+// vipGroupManage/delLiveGroup

+ 30 - 14
src/views/liveClassManager/createLiveClass.vue

@@ -248,7 +248,7 @@ import dayjs from "dayjs";
 import deepClone from "@/helpers/deep-clone";
 import preview from "./modals/preview.vue";
 import addLiveCourse from "./modals/addLiveCourse.vue";
-import { sysTenantConfigAll, findTeacherByTenantId, liveGroupDetail } from "./api";
+import { sysTenantConfigAll, findTeacherByTenantId, liveGroupDetail, updateLiveGroup } from "./api";
 import {
   getSubject,
   getOrganRole
@@ -294,6 +294,7 @@ export default {
         clientType: "TEACHER" // 主讲人身份 默认[老师]
       },
       status: 0, // 直播课状态
+      auditStatus: null, // 审核状态
       courseStartDate: null, // 课程开始时间
       serviceProvider: "tencentCloud", // 直播模式
       subjectList: [], // 声部列表
@@ -422,18 +423,32 @@ export default {
             }
           };
           console.log(obj, "obj");
-          createVip(obj).then(res => {
-            if (res.code == 200) {
-              this.$message.success("恭喜您创建成功");
-              this.$store.dispatch("delVisitedViews", this.$route);
-              this.$router.push({
-                path: "/liveClassManager",
-                query: {
-                  tabrouter: 2
-                }
-              });
-            }
-          });
+          if (this.type === 'update') {
+            obj.vipGroupApplyBaseInfo.id = this.id
+            obj.vipGroupApplyBaseInfo.auditStatus = this.auditStatus
+            await updateLiveGroup(obj)
+            this.$message.success("修改成功");
+            this.$store.dispatch("delVisitedViews", this.$route);
+            this.$router.push({
+              path: "/liveClassManager",
+              query: {
+                tabrouter: 2
+              }
+            });
+          } else {
+            createVip(obj).then(res => {
+              if (res.code == 200) {
+                this.$message.success("创建成功");
+                this.$store.dispatch("delVisitedViews", this.$route);
+                this.$router.push({
+                  path: "/liveClassManager",
+                  query: {
+                    tabrouter: 2
+                  }
+                });
+              }
+            });
+          }
         } catch (e) {
           console.log(e);
         }
@@ -622,7 +637,7 @@ export default {
             //   vipGroupApplyBaseInfo.paymentExpireDate
             // ], // 课程购买时间
             onlineClassesNum: vipGroupApplyBaseInfo.onlineClassesNum,
-            singleClassMinuteId: vipGroupApplyBaseInfo.singleClassMinutes, //时长编号
+            singleClassMinuteId: vipGroupApplyBaseInfo.vipGroupCategoryId, //时长编号
             singleClassMinutes: vipGroupApplyBaseInfo.singleClassMinutes, // 时长
             onlineClassesUnitPrice: vipGroupApplyBaseInfo.onlineClassesUnitPrice, // 售价
             offlineClassesUnitPrice:
@@ -644,6 +659,7 @@ export default {
 
           this.status = data.vipGroupApplyBaseInfo.status
           this.courseStartDate = data.vipGroupApplyBaseInfo.courseStartDate
+          this.auditStatus = data.vipGroupApplyBaseInfo.auditStatus
         }
       } catch (e) {
         //

+ 31 - 12
src/views/liveClassManager/liveClassManager.vue

@@ -1,7 +1,7 @@
 <!--  -->
 <template>
   <div>
-    <auth auths="imLiveBroadcastRoom/add">
+    <auth auths="vipGroupManage/vipGroupApply">
       <el-button @click="newLiveClass" type="primary" style="margin-bottom: 20px">新建直播课</el-button>
     </auth>
     <save-form :inline="true" :model="searchForm" @submit="search" @reset="onReSet" ref="searchForm">
@@ -62,11 +62,10 @@
         <el-table-column align="center" prop="studentId" label="操作">
           <template slot-scope="scope">
             <div>
-              <auth auths="/liveBlackList">
+              <auth auths="vipGroupManage/stopVipGroup">
                 <el-button type="text" @click="onDetail(scope.row)">详情</el-button>
               </auth>
-              <el-popover placement="top" width="160" v-if="scope.row.status < 3 && scope.row.enableDelete != 1"
-                :ref="scope.$index">
+              <el-popover placement="top" width="160" v-if="scope.row.status <= 3" :ref="scope.$index">
                 <p style="margin-bottom: 10px">确定关闭该直播课?</p>
                 <el-input v-model.trim="stopReason" placeholder="请输入关闭原因"></el-input>
                 <div style="text-align: right; margin-top: 20px">
@@ -76,9 +75,13 @@
                 <el-button type="text" slot="reference">关闭</el-button>
               </el-popover>
 
-              <auth auths="vipGroupManage/stopVipGroup" v-if="[0, 1, 2].includes(scope.row.status)">
+              <auth auths="/updateLiveCourse" v-if="[0, 1, 2].includes(scope.row.status)">
                 <el-button type="text" @click="onUpdate(scope.row)">修改</el-button>
               </auth>
+
+              <auth auths="vipGroupManage/delLiveGroup" v-if="scope.row.status == 3">
+                <el-button type="text" @click="onDelete(scope.row)">删除</el-button>
+              </auth>
             </div>
           </template>
         </el-table-column>
@@ -93,6 +96,7 @@
 import pagination from "@/components/Pagination/index";
 import { getVipList, closeVip } from "@/api/vipSeting";
 import { getSubject } from "@/api/buildTeam";
+import { delLiveGroup } from './api'
 export default {
   components: {
     pagination
@@ -116,11 +120,11 @@ export default {
       statusList: [
         { lable: "未开始", value: "0" },
         { lable: "报名中", value: "1" },
-        { lable: "报名结束", value: "5" },
+        // { lable: "报名结束", value: "5" },
         { lable: "进行中", value: "2" },
         { lable: "已结束", value: "4" },
-        { lable: "关闭", value: "3" },
-        { lable: "取消", value: "6" },
+        { lable: "取消", value: "3" },
+        // { lable: "暂停", value: "6" },
       ],
       stopReason: "",
       subjectList: []
@@ -148,6 +152,22 @@ export default {
     this.getList();
   },
   methods: {
+    async onDelete(row) {
+      this.$confirm(`是否确认删除?`, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        dangerouslyUseHTMLString: true,
+        type: "warning"
+      })
+        .then(async () => {
+          try {
+            await delLiveGroup({ id: row.id })
+            this.$message.success('删除成功')
+            this.getList()
+          } catch { }
+        })
+        .catch(() => { });
+    },
     newLiveClass() {
       let params = {
         path: "/business/createLiveCourse"
@@ -229,10 +249,10 @@ export default {
         "未开始",
         "报名中",
         "进行中",
-        "关闭",
+        "取消",
         "已结束",
         "报名结束",
-        "取消"
+        "暂停"
       ];
       return arr[val];
     }
@@ -240,7 +260,7 @@ export default {
 };
 </script>
 <style lang="scss" scoped>
-::v-deep .el-dropdown-link {
+::v-deep .el-dropdown-link::v-deep .el-dropdown-link {
   cursor: pointer;
   color: var(--color-primary);
 }
@@ -248,4 +268,3 @@ export default {
 ::v-deep .el-icon-arrow-down {
   font-size: 12px;
 }
-</style>

+ 6 - 7
src/views/liveClassManager/modals/addLiveCourse.vue

@@ -2,7 +2,7 @@
   <div>
     <el-form :model="maskForm" label-position="right" label-width="80px">
       <el-form-item label="开课时间">
-        <el-date-picker v-model.trim="maskForm.courseStartOnline" type="date" :picker-options="pickOptions"
+        <el-date-picker v-model.trim="maskForm.courseStartOnline" type="date" :picker-options="pickOptions()"
           placeholder="请选择开课时间" style="width: 100% !important" />
       </el-form-item>
       <!-- <el-form-item label="课程类型" prop="type">
@@ -132,11 +132,11 @@ export default {
 
     };
   },
-  watch: {
-    signUpEnd() {
-      this.pickOptions()
-    }
-  },
+  // watch: {
+  //   signUpEnd() {
+  //     this.pickOptions()
+  //   }
+  // },
   methods: {
     pickOptions() {
       const endTime = this.signUpEnd ? dayjs(this.signUpEnd).valueOf() : new Date().getTime()
@@ -144,7 +144,6 @@ export default {
       return {
         firstDayOfWeek: 1,
         disabledDate(time) {
-          // return time.getTime() + 86400000 < endTime;
           return endTime > time.getTime();
         }
       }