ソースを参照

Merge branch 'hotfix/zhouweilu' into develop

soleil 7 年 前
コミット
a288988089

+ 30 - 22
src/components/AssignmentCRUD/CreateAssignment/index.vue

@@ -232,7 +232,6 @@ export default {
       errorMassage: null,
       isServerError: false,
       submitting: false,
-
       // 转圈圈
       loadingSearchQuestions: false,
       loadingCreateAssignment: false
@@ -318,30 +317,39 @@ export default {
           // 代码作业
           this.myPromise = postCodeAssignment(param, this.courseId);
         }
-        this.myPromise.then(res => {
-          //创建成功
-          this.isCreateModalActive = false;
-          if (res.code === 0) {
-            if (this.assignType === 1) {
-              this.$router.push({
-                path: `${this.prefix}/review?documentHwId=${res.data.id}`
+        this.myPromise
+          .then(res => {
+            //创建成功
+            this.isCreateModalActive = false;
+            this.submitting = false;
+            if (res.code === 0) {
+              if (this.assignType === 1) {
+                this.$router.push({
+                  path: `${this.prefix}/review?documentHwId=${res.data.id}`
+                });
+              }
+              this.$emit("sendCreatedAssignment", res.data);
+              this.loadingCreateAssignment = false;
+            } else {
+              //创建失败
+              this.isCreateModalActive = false;
+              this.loadingCreateAssignment = false;
+
+              this.$dialog.alert({
+                title: "创建失败",
+                message: res.message,
+                type: "is-danger",
+                hasIcon: true
               });
             }
-            this.$emit("sendCreatedAssignment", res.data);
-            this.loadingCreateAssignment = false;
-          } else {
-            //创建失败
-            this.isCreateModalActive = false;
-            this.loadingCreateAssignment = false;
-            this.$dialog.alert({
-              title: "创建失败",
-              message: res.message,
-              type: "is-danger",
-              hasIcon: true
+          })
+          .catch(e => {
+            this.submitting = false;
+            this.$toast.open({
+              message: e.message || "服务器未知错误",
+              type: "is-danger"
             });
-          }
-        });
-        this.submitting = false;
+          });
       }
     },
     getDifficultyType(level) {

+ 2 - 2
src/views/login/Register.vue

@@ -5,13 +5,13 @@
       {{ errorMassage }}
     </b-notification>
     <b-field
-      label="昵称"
+      label="学号"
       :type="$v.nickname.$error ? 'is-danger' : ''"
       :message="$v.nickname.$error ? '昵称须由长度为4至16的字母或数字组成' : ''"
     >
       <b-input
         v-model="$v.nickname.$model"
-        placeholder="在此输入昵称"
+        placeholder="在此输入学号"
       ></b-input>
     </b-field>
     <b-field

+ 8 - 13
src/views/student/Code/ProjectDetail/DeployDetail.vue

@@ -37,7 +37,7 @@
         </div>
       </div>
       <button
-        :class="['button', 'block', 'is-link', { 'is-loading': isRunning }]"
+        :class="['button', 'block', 'is-link', { 'is-loading': isRunning || deployButtonDisabled }]"
         @click="startDeploy"
         style="margin-top: 20px;"
       >
@@ -116,7 +116,8 @@ export default {
       latestMirrorIdList: [],
       radio: -1,
       isfetchLog: false,
-      latestDeployId: 0
+      latestDeployId: 0,
+      deployButtonDisabled: false
     };
   },
   props: {
@@ -131,13 +132,6 @@ export default {
   },
   watch: {
     projectDetail: function() {
-      // console.log(newVal);
-      //获取最新一次部署详细信息
-      // if (newVal.latestDeploy && newVal.latestDeploy.id) {
-      //   // this.haveDeployRecord = true;
-      //
-      //   // this.getDeployLogInfo(this.projectDetail.latestDeploy.id);
-      // }
       this.getLatestDeployInfo();
       this.getLatestBuildInfo(this.projectDetail && this.projectDetail.id, 5);
       this.getLastNDeployInfoList(
@@ -199,11 +193,13 @@ export default {
     },
     //开始部署
     startDeploy() {
+      this.deployButtonDisabled = true;
       if (this.radio == -1) {
         this.$toast.open({
           message: "请先选择镜像",
           type: "is-danger"
         });
+        this.deployButtonDisabled = false;
         return;
       } else {
         let mirrorId = this.getSelectedMirrorId();
@@ -214,6 +210,7 @@ export default {
           replicas: 1
         })
           .then(res => {
+            this.deployButtonDisabled = false;
             if (res.data.status == "SUCCESS") {
               this.$toast.open({
                 message: "不要重复部署哦~",
@@ -221,18 +218,16 @@ export default {
               });
               return;
             }
-            // console.log(res);
             this.$toast.open({
               message: "开始部署",
               type: "is-success"
             });
             this.isRunning = true;
             this.deployInfo = res.data;
-            // setTimeout(() => {
-            //   this.getLatestDeployInfo(this.projectDetail.latestDeploy.id);
-            // }, 1000);
+            this.latestDeployId = res.data.id;
           })
           .catch(e => {
+            this.deployButtonDisabled = false;
             this.$toast.open({
               message: e.message || "服务器未知错误",
               type: "is-danger"

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

@@ -18,7 +18,8 @@
         页面测试 #{{ testDetail.id }}
       </template>
       <template slot="content">
-        <pass-tag :pass="testDetail.passAll" />
+        <pass-tag v-if="testDetail.status == 1" :pass="testDetail.passAll" />
+        <b-tag v-else type="is-warning">RUNNING</b-tag>
       </template>
       <template slot="extraContent">
         <div class="tag">{{ displayUnixTime(testDetail.time) }}</div>

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

@@ -18,7 +18,8 @@
         单元测试 #{{ testDetail.id }}
       </template>
       <template slot="content">
-        <pass-tag :pass="testDetail.passAll" />
+        <pass-tag v-if="testDetail.status == 1" :pass="testDetail.passAll" />
+        <b-tag v-else type="is-warning">RUNNING</b-tag>
       </template>
       <template slot="extraContent">
         <div class="tag">{{ displayUnixTime(testDetail.time) }}</div>
@@ -69,8 +70,15 @@ import { getUnitTestDetail } from "@/api/codehw";
 import timeMixins from "@/mixins/time";
 import PassTag from "@/views/student/Code/ProjectDetail/components/PassTag";
 import PageSectionLoading from "@/components/PageBody/PageSectionLoading/index";
+import BTag from "buefy/src/components/tag/Tag";
 export default {
-  components: { PageSectionLoading, PassTag, PageBody, PageHeader },
+  components: {
+    BTag,
+    PageSectionLoading,
+    PassTag,
+    PageBody,
+    PageHeader
+  },
   data() {
     return {
       testDetail: { detail: [] },

+ 4 - 0
src/views/student/Code/ProjectDetail/TestDetail.vue

@@ -16,6 +16,7 @@
         >
           <div><strong>UNIT TEST : #</strong> {{ item.id }}</div>
           <pass-tag v-if="item.status == 1" :pass="item.passAll" />
+          <b-tag v-else type="is-warning">RUNNING</b-tag>
           <span style="padding-left: 10px">{{
             displayUnixTime(item.time)
           }}</span>
@@ -53,6 +54,7 @@
         >
           <div><strong>FUNCTIONAL TEST : #</strong> {{ item.id }}</div>
           <pass-tag v-if="item.status == 1" :pass="item.passAll" />
+          <b-tag v-else type="is-warning">RUNNING</b-tag>
           <span style="padding-left: 10px">{{
             displayUnixTime(item.time)
           }}</span>
@@ -67,9 +69,11 @@ import PassTag from "@/views/student/Code/ProjectDetail/components/PassTag";
 import timeMixins from "@/mixins/time";
 import { makeFunctionalTest } from "@/api/codehw";
 import PageSectionLoading from "@/components/PageBody/PageSectionLoading/index";
+import BTag from "buefy/src/components/tag/Tag";
 
 export default {
   components: {
+    BTag,
     PageSectionLoading,
     PassTag
   },