Browse Source

update课程列表

dusenyao 3 years ago
parent
commit
0560a66e77
4 changed files with 48 additions and 1 deletions
  1. 15 0
      src/api/course.js
  2. 5 0
      src/icons/svg/publish.svg
  3. 5 0
      src/icons/svg/undo.svg
  4. 23 1
      src/views/main/curricula_list/teacher.vue

+ 15 - 0
src/api/course.js

@@ -301,3 +301,18 @@ export function CheckMyGoodsBuyStatus(data) {
     data
   });
 }
+
+/**
+ * 发布课程
+ * @param {Object} data
+ */
+export function ReleaseCourse(data) {
+  let params = getRequestParams('teaching-course_manager-ReleaseCourse');
+
+  return request({
+    method: 'post',
+    url: process.env.VUE_APP_LearnWebSI,
+    params,
+    data
+  });
+}

+ 5 - 0
src/icons/svg/publish.svg

@@ -0,0 +1,5 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M24 0H0V24H24V0Z" fill="white" fill-opacity="0.01"/>
+<path d="M21.5 2.5L14.85 21.5L11.05 12.95L2.5 9.15L21.5 2.5Z" stroke="#333333" stroke-width="1.5" stroke-linejoin="round"/>
+<path d="M21.5 2.5L11.05 12.95" stroke="#333333" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>

+ 5 - 0
src/icons/svg/undo.svg

@@ -0,0 +1,5 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M24 0H0V24H24V0Z" fill="white" fill-opacity="0.01"/>
+<path d="M5.63605 18.364C7.2647 19.9927 9.5147 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02945 16.9706 3 12 3C9.5147 3 7.2647 4.00736 5.63605 5.63605C4.80704 6.46505 3 8.5 3 8.5" stroke="#333333" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M3 4.5V8.5H7" stroke="#333333" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>

+ 23 - 1
src/views/main/curricula_list/teacher.vue

@@ -35,11 +35,16 @@
       <div class="curricula-teacher-container-list">
         <el-table :data="courseList">
           <el-table-column prop="name" label="课程名称" width="320" />
-          <el-table-column label="课程周期">
+          <el-table-column label="课程周期" width="210">
             <template slot-scope="{ row }">
               <i class="el-icon-date" /> {{ row.begin_date }} - {{ row.end_date }}
             </template>
           </el-table-column>
+          <el-table-column label="已发布">
+            <template slot-scope="{ row }">
+              {{ row.is_release === 'true' ? '√' : '' }}
+            </template>
+          </el-table-column>
           <el-table-column fixed="right" width="80">
             <template slot-scope="{ row }">
               <el-dropdown trigger="click">
@@ -53,6 +58,15 @@
                   <el-dropdown-item @click.native="view(row.id)">
                     <svg-icon icon-class="view" /> 查看
                   </el-dropdown-item>
+                  <el-dropdown-item
+                    v-if="row.is_release === 'false'"
+                    @click.native="releaseCourse(row.id, true)"
+                  >
+                    <svg-icon icon-class="publish" /> 发布
+                  </el-dropdown-item>
+                  <el-dropdown-item v-else @click.native="releaseCourse(row.id, false)">
+                    <svg-icon icon-class="undo" /> 取消发布
+                  </el-dropdown-item>
                   <el-dropdown-item @click.native="studentList(row.id)">
                     <svg-icon icon-class="students" /> 学生列表
                   </el-dropdown-item>
@@ -82,6 +96,7 @@
 import { updateWordPack } from '@/utils/i18n';
 import { PageQueryMyCourseList } from '@/api/table';
 import { GetFinishStatusList_Course } from '@/api/select';
+import { ReleaseCourse } from '@/api/course';
 
 export default {
   data() {
@@ -143,6 +158,7 @@ export default {
         return '#4F8EEC';
       }
     },
+
     studentList(id) {
       this.$router.push(`/student_list/index/${id}`);
     },
@@ -151,6 +167,12 @@ export default {
     },
     view(id) {
       this.$router.push(`/GoodsDetail?id=${id}&goodsType=201&readonly=true`);
+    },
+    releaseCourse(course_id, is_release) {
+      ReleaseCourse({ course_id, is_release }).then(() => {
+        this.queryMyCourseList();
+        this.$message.success(`${is_release ? '' : '取消'}发布课程成功`);
+      });
     }
   }
 };