Bläddra i källkod

注册开关配置

wangxy 1 vecka sedan
förälder
incheckning
e00d467829

+ 7 - 0
src/api/course/userCoursePeriod.js

@@ -216,3 +216,10 @@ export function changeRedPacketState(data) {
     data: data
   })
 }
+export function changeRegistrationState(data) {
+  return request({
+    url: '/course/period/changeRegistrationSwitchState',
+    method: 'post',
+    data: data
+  })
+}

+ 50 - 3
src/views/course/userCoursePeriod/index.vue

@@ -376,6 +376,26 @@
             />
           </el-select>
         </el-form-item>
+        <el-form-item label="无需注册小节" prop="noRegisterVideoIds">
+          <el-select
+            filterable
+            v-model="course.form.noRegisterVideoIds"
+            placeholder="请选择无需注册的小节"
+            multiple
+            clearable
+            size="small"
+            style="width: 100%"
+            :value-key="'dictValue'"
+            :disabled="!course.form.videoIds || course.form.videoIds.length === 0">
+            <el-option
+              v-for="dict in filteredVideoList"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="parseInt(dict.dictValue)"
+            />
+          </el-select>
+          <p v-if="!course.form.videoIds || course.form.videoIds.length === 0" style="color: #909399; font-size: 12px; margin: 5px 0 0;">请先选择小节</p>
+        </el-form-item>
         <el-form-item label="看课时间" prop="timeRange">
           <el-time-picker
             is-range
@@ -529,6 +549,7 @@
             <el-table-column label="课程" align="center" prop="courseName" width="180" />
             <el-table-column label="小节" align="center" prop="videoName" />
             <el-table-column label="开课状态" align="center" prop="status" width="100" :formatter="courseStatusFormatter" />
+            <el-table-column label="是否开启注册链接" align="center" prop="registrationSwitch" width="180" :formatter="registrationSwitchFormatter" />
             <el-table-column label="营期时间" align="center" prop="dayDate" width="100"/>
             <el-table-column label="开始时间" align="center" prop="startDateTime" width="100">
 <!--              <template slot-scope="scope">-->
@@ -690,7 +711,10 @@ export default {
         loading: true,
         total: 0,
         addOpen: false,
-        form: {},
+        form: {
+          videoIds: [],
+          noRegisterVideoIds: []
+        },
       },
       //修改营期时间参数
       updatePeriodDate: {
@@ -844,6 +868,18 @@ export default {
       batchRedPacketVisible: false,
     };
   },
+  computed: {
+    filteredVideoList() {
+      if (!this.course.form.videoIds || this.course.form.videoIds.length === 0) {
+        return [];
+      }
+
+      // 只显示已选择的 videoIds 中的选项
+      return this.videoList.filter(video =>
+        this.course.form.videoIds.includes(parseInt(video.dictValue))
+      );
+    }
+  },
   created() {
 
     courseList().then(response => {
@@ -1431,7 +1467,8 @@ export default {
         courseId: null,
         timeRange: ['00:00:00', '23:59:59'],
         joinTime: '23:59:59',
-        videoIds: []
+        videoIds: [],
+        noRegisterVideoIds: []
       };
       // 重置表单
       this.$nextTick(() => {
@@ -1472,7 +1509,8 @@ export default {
         courseId: null,
         timeRange: null,
         joinTime: null,
-        videoIds: []
+        videoIds: [],
+        noRegisterVideoIds: []
       };
       // 重置表单
       if (this.$refs.courseAddForm) {
@@ -1508,6 +1546,7 @@ export default {
     },
     courseChange(row){
       this.course.form.videoIds = [];
+      this.course.form.noRegisterVideoIds = [];
       videoList(row).then(response => {
         this.videoList=response.list
       });
@@ -1698,6 +1737,14 @@ export default {
       };
       return statusMap[row.periodStatus] || '未知状态';
     },
+    /** 注册开关状态格式化 */
+    registrationSwitchFormatter(row) {
+      const switchMap = {
+        0: '未开启',
+        1: '已开启'
+      };
+      return switchMap[row.registrationSwitch] || '未知状态';
+    },
     /** 开课状态格式化 */
     courseStatusFormatter(row) {
       const statusMap = {

+ 39 - 1
src/views/course/userCoursePeriod/redPacket.vue

@@ -40,6 +40,20 @@
             v-if="scope.row.openRedPacket === 1"
             v-hasPermi="['course:period:changeRedPacketState']"
           >关闭红包</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleOpenRegistration(scope.row)"
+            v-if="scope.row.openRegistrationSwitch === 0"
+            v-hasPermi="['course:period:changeRegistrationSwitchState']"
+          >打开注册链接</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleCloseRegistration(scope.row)"
+            v-if="scope.row.openRegistrationSwitch === 1"
+            v-hasPermi="['course:period:changeRegistrationSwitchState']"
+          >关闭注册链接</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -110,7 +124,7 @@ import {
   getPeriodCompanyList,
   batchSaveRedPacket,
   getPeriodRedPacketList,
-  batchSaveRedPacketByCompany, changeRedPacketState
+  batchSaveRedPacketByCompany, changeRedPacketState, changeRegistrationState
 } from '@/api/course/userCoursePeriod'
 import redPacket from "@/views/course/userCoursePeriod/redPacket.vue";
 
@@ -214,6 +228,30 @@ export default {
         this.getCompanyList()
       })
     },
+    //打开注册链接
+    handleOpenRegistration(row){
+      const params = {
+        periodId: this.periodId,
+        companyId: row.companyId,
+        state: 1
+      }
+      changeRegistrationState( params).then(response => {
+        this.msgSuccess(response.msg)
+        this.getCompanyList()
+      })
+    },
+    //关闭注册链接
+    handleCloseRegistration(row){
+      const params = {
+        periodId: this.periodId,
+        companyId: row.companyId,
+        state: 0
+      }
+      changeRegistrationState( params).then(response => {
+        this.msgSuccess(response.msg)
+        this.getCompanyList()
+      })
+    },
     // 获取课程列表
     getCourseList() {
       getPeriodRedPacketList({

+ 2 - 2
src/views/his/coupon/index.vue

@@ -120,7 +120,7 @@
                type="text"
                @click="handledetails(scope.row)"
            >详情
-           
+
           </el-button>
           <el-button
             size="mini"
@@ -209,7 +209,7 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="可用分类" prop="cateIds" v-show="form.couponType==5||form.couponType==6">
+        <el-form-item label="可用分类" prop="cateIds" v-show="form.couponType==6">
           <el-select v-model="form.cateIds" multiple placeholder="请选择可用分类">
             <el-option
               v-for="dict in cateIdsOptions"