浏览代码

Merge remote-tracking branch 'origin/develop' into hotfix/bay

Kunduin 7 年之前
父节点
当前提交
0efa5b2382

+ 0 - 5
src/components/PageHeader/index.jsx

@@ -35,11 +35,6 @@ export default {
             <li>
               <router-link to={{ name: "HOME" }}>所有课程</router-link>
             </li>
-            <li>
-              <router-link to={`${prefix}/dashboard`}>
-                {course.name}
-              </router-link>
-            </li>
             {routes.map((route, index) => (
               <li class={index === routes.length - 1 && "is-active"}>
                 <router-link

+ 1 - 1
src/layouts/courseLayouts/LayoutStructure.vue

@@ -87,7 +87,7 @@ $top-section-height: 4.25rem;
 .menu-section {
   //min-width: $menu-width;
   //width: $left-width-calc;
-  width: 280px;
+  min-width: 280px;
   /*background: white;*/
   /*border-right: 3px solid rgb(159, 148, 254);*/
   padding-left: $left-padding-calc;

+ 4 - 0
src/router/routes.js

@@ -217,6 +217,10 @@ export default [
         path: "document/:documentId",
         component: () => import("@/views/student/Document/detail")
       },
+      {
+        path: "document/:documentId/content/:groupWorkId",
+        component: () => import("@/views/teacher/Document/docContent")
+      },
       {
         path: "review",
         component: () => import("@/views/student/Review")

+ 46 - 22
src/views/student/Code/ProjectDetail/DeployDetail.vue

@@ -6,7 +6,11 @@
       </div>
       <div class="select-mirror" v-if="deployStatus != 'RUNNING'">
         <div class="latest-build">
-          <div class="test-item" :key="item.id" v-for="item in latestBuildList">
+          <div
+            class="test-item"
+            :key="`b${item.id}`"
+            v-for="item in latestBuildList"
+          >
             <div>
               <b-radio v-model="radio" :native-value="`b${item.id}`"> </b-radio>
               <strong>构建ID: #</strong> {{ item.id }}
@@ -18,7 +22,7 @@
           </div>
           <div
             class="test-item"
-            :key="item.id"
+            :key="`d${item.id}`"
             v-for="item in latestDeployList"
           >
             <div>
@@ -71,8 +75,13 @@
       <div class="deploy-item">
         <div class="subtitle">部署输出信息</div>
         <a
-          class="button is-small is-info"
-          @click="unfoldDeployLogInfo = !unfoldDeployLogInfo"
+          :class="[
+            'button',
+            'is-small',
+            'is-info',
+            { 'is-loading': isfetchLog }
+          ]"
+          @click="getDeployLogInfo"
         >
           {{ unfoldDeployLogInfo ? "收起部署详细信息" : "查看部署详细信息" }}</a
         >
@@ -105,7 +114,8 @@ export default {
       latestBuildList: [],
       latestDeployList: [],
       latestMirrorIdList: [],
-      radio: -1
+      radio: -1,
+      isfetchLog: false
     };
   },
   props: {
@@ -125,8 +135,7 @@ export default {
       if (newVal.latestDeploy && newVal.latestDeploy.id) {
         this.haveDeployRecord = true;
         this.getLatestDeployInfo(newVal.latestDeploy.id);
-        // this.getLatestDeployInfo(17);
-        this.getDeployLogInfo(this.projectDetail.latestDeploy.id);
+        // this.getDeployLogInfo(this.projectDetail.latestDeploy.id);
       }
       this.getLatestBuildInfo(this.projectDetail && this.projectDetail.id, 5);
       this.getLastNDeployInfoList(
@@ -138,7 +147,7 @@ export default {
   mounted() {
     if (this.projectDetail.latestDeploy) {
       this.getLatestDeployInfo(this.projectDetail.latestDeploy.id);
-      this.getDeployLogInfo(this.projectDetail.latestDeploy.id);
+      // this.getDeployLogInfo(this.projectDetail.latestDeploy.id);
     }
     if (this.projectDetail.id) {
       this.getLatestBuildInfo(this.projectDetail.id, 5);
@@ -146,6 +155,12 @@ export default {
     }
   },
   methods: {
+    //获取部署日志
+    // checkDeployLog(){
+    //     if(this.projectDetail.latestDeploy){
+    //         this.getDeployLogInfo(this.projectDetail.latestDeploy.id);
+    //     }
+    // },
     //获取最新一次部署详细信息
     getLatestDeployInfo(deployId) {
       getDeployDetail(deployId)
@@ -192,11 +207,11 @@ export default {
               type: "is-success"
             });
             this.isRunning = true;
-            setTimeout(() => {
-              this.getLatestDeployInfo(this.projectDetail.latestDeploy.id);
-            }, 1000);
+            // setTimeout(() => {
+            //   this.getLatestDeployInfo(this.projectDetail.latestDeploy.id);
+            // }, 1000);
           })
-          .then(e => {
+          .catch(e => {
             this.$toast.open({
               message: e.message || "服务器未知错误",
               type: "is-danger"
@@ -233,17 +248,26 @@ export default {
         });
     },
     //获取部署日志
-    getDeployLogInfo(deployId) {
-      getDeployLogInfo(deployId)
-        .then(res => {
-          this.deployLog = res.data;
-        })
-        .catch(e => {
-          this.$toast.open({
-            message: e.message || "服务器未知错误",
-            type: "is-danger"
+    getDeployLogInfo() {
+      if (this.unfoldDeployLogInfo) {
+        this.unfoldDeployLogInfo = false;
+      } else {
+        let deployId = this.projectDetail.latestDeploy.id;
+        this.isfetchLog = true;
+        getDeployLogInfo(deployId)
+          .then(res => {
+            this.deployLog = res.data;
+            this.unfoldDeployLogInfo = true;
+            this.isfetchLog = false;
+          })
+          .catch(e => {
+            this.isfetchLog = false;
+            this.$toast.open({
+              message: e.message || "服务器未知错误",
+              type: "is-danger"
+            });
           });
-        });
+      }
     },
     //部署类型
     type(value) {

+ 1 - 1
src/views/student/Code/ProjectDetail/Test/FunctionalTestDetail.vue

@@ -18,7 +18,7 @@
         页面测试 #{{ testDetail.id }}
       </template>
       <template slot="content">
-        <pass-tag :pass="testDetail.isPassAll" />
+        <pass-tag :pass="testDetail.passAll" />
       </template>
       <template slot="extraContent">
         <div class="tag">{{ displayUnixTime(testDetail.time) }}</div>

+ 14 - 3
src/views/student/Code/ProjectDetail/Test/UnitTestDetail.vue

@@ -18,16 +18,26 @@
         单元测试 #{{ testDetail.id }}
       </template>
       <template slot="content">
-        <pass-tag :pass="testDetail.isPassAll" />
+        <pass-tag :pass="testDetail.passAll" />
       </template>
       <template slot="extraContent">
         <div class="tag">{{ displayUnixTime(testDetail.time) }}</div>
       </template>
     </page-header>
-    <div class="console-section">{{ testDetail.consoleOutput }}</div>
+    <!--<div class="console-section">{{ testDetail.consoleOutput }}</div>-->
     <page-body>
       <div v-if="testDetailLoading"><page-section-loading show /></div>
       <div v-else>
+        <div class="gap-section">
+          <div class="page-section">
+            <a class="button is-small is-info" @click="showLog = !showLog">{{
+              showLog ? "收起控制台信息" : "查看控制台输出"
+            }}</a>
+            <div class="console-section" v-if="showLog">
+              {{ testDetail.consoleOutput }}
+            </div>
+          </div>
+        </div>
         <div
           v-for="item in testDetail.detail"
           :key="item.id"
@@ -64,7 +74,8 @@ export default {
   data() {
     return {
       testDetail: { detail: [] },
-      testDetailLoading: false
+      testDetailLoading: false,
+      showLog: false
     };
   },
   mixins: [timeMixins],

+ 10 - 2
src/views/student/Code/ProjectDetail/TestDetail.vue

@@ -15,7 +15,7 @@
           tag="div"
         >
           <div><strong>UNIT TEST : #</strong> {{ item.id }}</div>
-          <pass-tag :pass="item.isPassAll" />
+          <pass-tag :pass="item.passAll" />
           <span style="padding-left: 10px">{{
             displayUnixTime(item.time)
           }}</span>
@@ -52,7 +52,7 @@
           tag="div"
         >
           <div><strong>FUNCTIONAL TEST : #</strong> {{ item.id }}</div>
-          <pass-tag :pass="item.isPassAll" />
+          <pass-tag :pass="item.passAll" />
           <span style="padding-left: 10px">{{
             displayUnixTime(item.time)
           }}</span>
@@ -98,6 +98,14 @@ export default {
   mixins: [timeMixins],
   methods: {
     async makeTest() {
+      if (
+        !(
+          this.projectDetail.latestDeploy &&
+          this.projectDetail.latestDeploy.status == "SUCCESS"
+        )
+      ) {
+        return;
+      }
       this.testing = true;
       const deployId = this.projectDetail.latestDeploy.id;
       const { homeworkId, projectId } = this.$route.params;

+ 3 - 1
src/views/student/Code/index.vue

@@ -22,7 +22,9 @@
           v-for="item in codeHomeworkList"
           class="column is-4-desktop"
         >
-          <router-link :to="`${$route.path}/${item.id}`">
+          <router-link
+            :to="item.status == 'READY' ? '' : `${$route.path}/${item.id}`"
+          >
             <card hoverable>
               {{ item.name }}
               <div><code-state-tag :state="item.status"></code-state-tag></div>

+ 6 - 0
src/views/student/Document/detail.vue

@@ -60,6 +60,12 @@
               <div class="subtitle is-6">{{ docResult.url }}</div>
             </div>
           </div>
+          <div class="columns is-desktop" v-show="isAvailable">
+            <div class="column">
+              <h5 class="title is-5">查看文档内容</h5>
+              <!--<div class="subtitle is-6"><router-link :to="{path: `${$route.path}/content/${detail.id}`}">查看文档内容</router-link></div>-->
+            </div>
+          </div>
           <div class="columns is-desktop" v-show="isAvailable">
             <div class="column">
               <h5 class="title is-5">题目描述</h5>

+ 4 - 1
src/views/student/Document/index.vue

@@ -22,7 +22,10 @@
           v-for="item in docList"
           class="column is-4-desktop"
         >
-          <router-link :to="{ path: `${$route.path}/${item.id}` }">
+          <router-link
+            :to="item.status == 'READY' ? '' : `${$route.path}/${item.id}`"
+          >
+            <!--:to="{ path: item.state == 'DEFAULT' ? `${$route.path}/${item.id}` : ''}"-->
             <card hoverable>
               {{ item.name }}
               <div>

+ 5 - 1
src/views/student/Review/index.vue

@@ -22,7 +22,11 @@
           v-for="item in review"
           class="column is-4-desktop"
         >
-          <router-link :to="`${$route.path}/${item.reviewId}`">
+          <router-link
+            :to="
+              item.state == 'DEFAULT' ? '' : `${$route.path}/${item.reviewId}`
+            "
+          >
             <card hoverable>
               {{ item.name }}
               <div><review-state-tag :state="item.state" /></div>

+ 2 - 2
vue.config.js

@@ -3,8 +3,8 @@ module.exports = {
     proxy: {
       "^/api": {
         // target: "http://localhost:4000/",
-        // target: "http://10.1.1.198:8080/",
-        target: "http://192.168.0.101:8080",
+        target: "http://10.1.1.198:8080/",
+        //target: "http://192.168.0.101:8080",
         // target: "http://10.1.2.3:8080/",
 
         ws: true,