Просмотр исходного кода

1

Signed-off-by: lcw <1324309909@qq.com>
lcw 3 лет назад
Родитель
Сommit
0fb4f7a199
1 измененных файлов с 25 добавлено и 0 удалено
  1. 25 0
      src/components/pages/course.vue

+ 25 - 0
src/components/pages/course.vue

@@ -55,6 +55,11 @@
               >
                 作业
               </div>
+              <div
+                @click="deleteCourse(item.courseId)"
+              >
+                删除
+              </div>
             </div>
           </div>
           <div class="course_empty" v-if="course.length == 0">暂无数据</div>
@@ -228,6 +233,26 @@ export default {
           console.error(err);
         });
     },
+    deleteCourse(cid){
+      const loading = this.openLoading(
+        document.querySelector(".student_table")
+      );
+      this.isLoading = true;
+      let params = {
+        cid: cid,
+      };
+      this.ajax
+        .get(this.$store.state.api + "deleteCourse", params)
+        .then((res) => {
+          loading.close();
+          this.isLoading = false;
+          this.$message.success("删除成功");
+          this.getCourse();
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
     search() {
       this.page = 1;
       this.getCourse();