mjh 4 years ago
parent
commit
6929cff4a9
1 changed files with 6 additions and 5 deletions
  1. 6 5
      src/views/CoursePage/tabs/ProjectTab.vue

+ 6 - 5
src/views/CoursePage/tabs/ProjectTab.vue

@@ -59,7 +59,7 @@
 
 <script>
 import ProjectLongCard from "@/components/project/ProjectLongCard";
-import {ElMessage, ElMessageBox} from "element-plus";
+import {ElMessage} from "element-plus";
 
 export default {
   name: "ProjectTab",
@@ -127,7 +127,7 @@ export default {
       const res = (await _this.$apis.forkProject(id, null)).data;
       if (!res.code) {
         _this.projects.private.push(res.data);
-        _this.projectTabName = "private";
+        _this.tabName = "private";
         ElMessage.success("Fork完成");
       } else {
         ElMessage.error(res.message);
@@ -136,13 +136,14 @@ export default {
 
     async handleSwitchProject(id) {
       const _this = this;
-      // todo: 修改项目在gitlab中的 公开/私有 状态
       const res = (await _this.$apis.updateCourseProjectState(id)).data;
       if (!res.code) {
         if (res.data) {
           removeProject(_this.projects.private, _this.projects.public);
+          _this.tabName="public";
         } else {
           removeProject(_this.projects.public, _this.projects.private);
+          _this.tabName="private";
         }
       }
 
@@ -174,10 +175,10 @@ export default {
       } else {
         if (_this.projectForm.isPublic) {
           _this.projects.public.push(res.data);
-          _this.projectTabName = "public";
+          _this.tabName = "public";
         } else {
           _this.projects.private.push(res.data);
-          _this.projectTabName = "private";
+          _this.tabName = "private";
         }
         _this.projectDialog = false;
         _this.$refs.projectFormRef.resetFields();