Jelajahi Sumber

Merge remote-tracking branch 'origin/seec' into seec

yhd12345 4 tahun lalu
induk
melakukan
8cb7bd3814

+ 28 - 27
src/components/Analysis/AnalysisGroupCard.vue

@@ -211,10 +211,10 @@ export default {
       userId: this.num,
 
       commitContribution: [
-        { name: "zqq", times: 0, proportion: 0 },
-        { name: "ty", times: 2, proportion: 0.4 },
-        { name: "kcy", times: 1, proportion: 0.2 },
-        { name: "pyy", times: 2, proportion: 0.4 },
+        // { name: "zqq", times: 0, proportion: 0 },
+        // { name: "ty", times: 2, proportion: 0.4 },
+        // { name: "kcy", times: 1, proportion: 0.2 },
+        // { name: "pyy", times: 2, proportion: 0.4 },
       ],
       interfaceContribution: [
         // { name: "zqq", times: 4, proportion: 0.8 },
@@ -249,36 +249,36 @@ export default {
         // fail: 20,
       },
       commitMessage: {
-        commit_times: 5,
-        valid_commit_times: 3,
-        buglist_commit: 4,
-        feature_commit: 3,
-        commit_msg_overview: [
-          "- fix: 修改错误",
-          "- feat: 增加评论区功能",
-          "- feat: 增加头像上传",
-          "- fix: 修复登录页面的错误",
-        ],
+        // commit_times: 5,
+        // valid_commit_times: 3,
+        // buglist_commit: 4,
+        // feature_commit: 3,
+        // commit_msg_overview: [
+        //   "- fix: 修改错误",
+        //   "- feat: 增加评论区功能",
+        //   "- feat: 增加头像上传",
+        //   "- fix: 修复登录页面的错误",
+        // ],
       },
       bugList: {
-        bug_times: 10,
-        high_times: 5,
-        finished_times: 9,
+        // bug_times: 10,
+        // high_times: 5,
+        // finished_times: 9,
       },
       treeNode: {
-        treeNode_times: 10,
-        high_treeNode_times: 5,
-        finished_treeNode_times: 9,
+        // treeNode_times: 10,
+        // high_treeNode_times: 5,
+        // finished_treeNode_times: 9,
       },
 
       userList: [
-        { userId: 11, name: "测试", email: "2222" },
-        { userId: 12, name: "测试2", email: "2222" },
-        { userId: 13, name: "测试3", email: "2222" },
+        // { userId: 11, name: "测试", email: "2222" },
+        // { userId: 12, name: "测试2", email: "2222" },
+        // { userId: 13, name: "测试3", email: "2222" },
       ],
       productList: [
-        { projectId: 1, projectName: "fun_frontEnd" },
-        { projectId: 2, projectName: "fun_backEnd" },
+        // { projectId: 1, projectName: "fun_frontEnd" },
+        // { projectId: 2, projectName: "fun_backEnd" },
       ],
 
       totalScore: 0.0,
@@ -330,7 +330,8 @@ export default {
         // console.log("done");
         // console.log(this.commitContribution);
       } catch(e) {
-        this.$message.error(e.message);
+        // this.$message.error("暂未查找到相关数据");
+        alert("暂未查找到相关数据");
       }
       try{
         let res1 = await getGroupScore({
@@ -350,7 +351,7 @@ export default {
           this.bonus = res1.content.bonus;
         }
       } catch (e) {
-        this.$message.error(e.message);
+        // this.$message.error(e.message);
       }
     },
 

+ 3 - 2
src/components/Analysis/AnalysisStudentCard.vue

@@ -295,7 +295,8 @@ export default {
           this.treeNode = res.content.treeNode;
         }
       } catch (e) {
-        this.$message.error(e.message);
+        // this.$message.error(e.message);
+        alert("暂未查找到相关数据");
       }
       try{
         let res1 = await getStudentScore({
@@ -315,7 +316,7 @@ export default {
           this.bonus = res1.content.bonus;
         }
       } catch (e) {
-        this.$message.error(e.message);
+        // this.$message.error(e.message);
       }
     },
     getAnaylysis() {

+ 55 - 70
src/components/TestCard.vue

@@ -47,7 +47,7 @@
 </template>
 
 <script>
-import {ElMessage, ElMessageBox} from "element-plus";
+import {ElMessage} from "element-plus";
 import store from "@/store";
 import timeUtil from "@/utils/time";
 
@@ -181,8 +181,9 @@ export default {
     }
   },
   methods: {
-    // TODO 分情况处理跳转
     async toTestInfo() {
+      const _this = this;
+      // 未登录
       if (!this.isLogin) {
         ElMessage({
           showClose: true,
@@ -193,86 +194,70 @@ export default {
         await this.$router.push({name: "Auth", params: {login_to: "/portal"}});
         return;
       }
-
+      // 已登录
+      // 教师(拥有者)
       if (this.isCreator) {
         if (this.type === "eval") {
-          this.$router.push(`/evalExam/${this.testVO.examId}/teacher/details`);
+          this.toEvalExamPage(this.testVO.examId);
         } else {
-          this.$router.push(`/exam/${this.testVO.id}`); //跳转到考试详情页
+          this.toCoderExamPage(this.testVO.coderId);
         }
-      } else if (this.isTeacher) {
+      }
+      // 其他教师
+      else if (this.isTeacher) {
         this.$message.error("无权访问其他教师创建的课程");
-      } else {
-        let messageBoxContent = "";
-        let messageBoxTitle = "";
-        let confirmButtonText = "";
-        let cancelButtonText = "让我想想";
-        let nextURL = "";
-        if (this.type === "eval") {
-          messageBoxTitle = "Eval";
-          if (this.testVO.isJoined) {
-            nextURL = "https://eval.seec.seecoder.cn/exam/" + this.testVO.id + "/before-exam/?id_token=" + this.$store.state.user.token;
-            window.open(nextURL);
-            return;
-          } else {
-            const courseId = (await this.$apis.getCourseByEvalId(this.testVO.course.id)).data.data;
-            if (courseId) {
-              const isCourseSelected = (await this.$apis.checkCourseSelection(courseId, this.$store.state.user.id)).data.data;
-              if (isCourseSelected) {
-                messageBoxContent = "是否立即查看测试详情";
-                confirmButtonText = "立即查看";
-                nextURL = "https://eval.seec.seecoder.cn/student/home/?id_token=" + this.$store.state.user.token;
-              } else {
-                messageBoxContent = "尚未参加课程,是否立即参加?";
-                confirmButtonText = "立即选课";
-                nextURL = "/course/" + courseId;
-              }
-            } else {
-              messageBoxContent = "是否立即查看测试详情";
-              confirmButtonText = "立即查看";
-              nextURL = "https://eval.seec.seecoder.cn/student/home/?id_token=" + this.$store.state.user.token;
-            }
+      }
+      // 学生
+      else {
+        if (this.testVO.isJoined || this.testVO.joined) {
+          switch (_this.type) {
+            case "coder":
+              _this.toCoderExamPage(_this.testVO.id);
+              break;
+            case "eval":
+              _this.toEvalExamPage(_this.testVO.examId, "student");
+              break;
+            default:
+              break;
           }
         } else {
-          messageBoxTitle = "Coder";
-          if (this.testVO.joined) {
-            nextURL = "https://coder.seec.seecoder.cn/exam/" + this.testVO.id + "?id_token=" + this.$store.state.user.token;
-            window.open(nextURL);
-            return;
-          } else {
-            const courseId = (await this.$apis.getCourseByCoderId(this.testVO.courseId)).data.data;
-            if (courseId) {
-              const isCourseSelected = (await this.$apis.checkCourseSelection(courseId, this.$store.state.user.id)).data.data;
-              if (isCourseSelected) {
-                messageBoxContent = "是否立即查看测试详情";
-                confirmButtonText = "立即查看";
-                this.$router.push("/exam/" + this.testVO.id);
-                // nextURL = "https://coder.seec.seecoder.cn/exam?id_token=" + this.$store.state.user.token;
-              } else {
-                messageBoxContent = "尚未选择课程,是否立即参加?";
-                confirmButtonText = "立即选课";
-                nextURL = "/course/" + courseId;
-              }
-            } else {
-              messageBoxContent = "是否立即查看测试详情";
-              confirmButtonText = "立即查看";
-              nextURL = "https://coder.seec.seecoder.cn/exam?id_token=" + this.$store.state.user.token;
-            }
+          let courseId;
+          switch (this.type) {
+            case "coder":
+              courseId = (await this.$apis.getCourseByCoderId(this.testVO.courseId)).data.data.id;
+              break;
+            case "eval":
+              courseId = (await this.$apis.getCourseByEvalId(this.testVO.course.id)).data.data.id;
+              break;
+            default:
+              break;
           }
-        }
-        ElMessageBox.confirm(messageBoxContent, messageBoxTitle, {
-          distinguishCancelAndClose: true,
-          confirmButtonText,
-          cancelButtonText,
-        }).then(() => {
-          if (nextURL.startsWith("http")) {
-            window.open(nextURL);
+          const isSelected = (await this.$apis.checkCourseSelection(courseId, this.$store.state.user.id));
+          if (isSelected) {
+            switch (_this.type) {
+              case "coder":
+                _this.toCoderExamPage(_this.testVO.id);
+                break;
+              case "eval":
+                _this.toEvalExamPage(_this.testVO.examId, "student");
+                break;
+              default:
+                break;
+            }
           } else {
-            this.$router.push(nextURL);
+            this.$router.push(`/course/${courseId}`);
           }
-        });
+        }
       }
     },
+
+    toEvalExamPage(examId, role="teacher") {
+      this.$router.push(`/evalExam/${examId}/${role}/details`);
+    },
+
+    toCoderExamPage(examId) {
+      this.$router.push(`/exam/${examId}`);
+    }
   }
 };
 </script>

+ 9 - 42
src/views/PortalPage/components/MyTestCard.vue

@@ -41,8 +41,6 @@
 </template>
 
 <script>
-import { ElMessageBox } from "element-plus";
-
 export default {
   name: "MyTestCard",
   props: {
@@ -134,47 +132,16 @@ export default {
       return Y + M + D + h + m;
     },
     toTestInfo() {
-      let messageBoxContent = "";
-      let messageBoxTitle = "";
-      let confirmButtonText = "";
-      let cancelButtonText = "让我想想";
-      let nextURL = "";
-
-      if (this.type === "eval") {
-        messageBoxTitle = "Eval";
-        if (this.testVO.isJoined) {
-          nextURL = "https://eval.seec.seecoder.cn/exam/" + this.testVO.examId + "/before-exam/?id_token=" + this.$store.state.user.token;
-          window.open(nextURL);
-          return;
-        } else {
-          messageBoxContent = "尚未参加该测试,是否立即参加?";
-          confirmButtonText = "立即参加";
-          nextURL = "https://eval.seec.seecoder.cn/student/home/?id_token=" + this.$store.state.user.token;
-        }
-      } else {
-        messageBoxTitle = "Coder";
-        if (this.testVO.joined) {
-          nextURL = "https://coder.seec.seecoder.cn/exam/" + this.testVO.id + "?id_token=" + this.$store.state.user.token;
-          window.open(nextURL);
-          return;
-        } else {
-          messageBoxContent = "尚未参加该测试,是否立即参加?";
-          confirmButtonText = "立即参加";
-          nextURL = "https://coder.seec.seecoder.cn/exam?id_token=" + this.$store.state.user.token;
-        }
+      switch (this.type) {
+        case "coder":
+          this.$router.push(`/exam/${this.testVO.id}`);
+          break;
+        case "eval":
+          this.$router.push(`/evalExam/${this.testVO.examId}/student/details`);
+          break;
+        default:
+          break;
       }
-
-      ElMessageBox.confirm(messageBoxContent, messageBoxTitle, {
-        distinguishCancelAndClose: true,
-        confirmButtonText,
-        cancelButtonText,
-      }).then(() => {
-        if (nextURL.startsWith("http")) {
-          window.open(nextURL);
-        } else {
-          this.$router.push(nextURL);
-        }
-      });
     },
   }
 };

+ 3 - 3
src/views/ProjectPage/ProjectPage.vue

@@ -113,11 +113,11 @@
           </div>
 
         <div v-if="this.activeIndex === '3' && isStudent">
-            <AnalysisStudentCard :num="userId"/>
+            <AnalysisStudentCard :num="$store.state.user.id"/>
         </div>
 
         <div v-if="this.activeIndex === '4' && isStudent">
-          <AnalysisGroupCard :num="userId"/>
+          <AnalysisGroupCard :num="$store.state.user.id"/>
         </div>
 
       </el-card>
@@ -142,7 +142,7 @@ export default {
       myCourseProjects: null,
       activeProjectPaneName: "courseProject",
       activeProjectPaneName_my: "courseProject_my",
-      userId:1575,//传递给分析系统
+      userId:this.$store.state.user.id,//传递给分析系统
     };
   },
   computed: {