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

[新增] 学生完成文档 review

WuXinyu 7 лет назад
Родитель
Сommit
b65aed4ce1

+ 4 - 4
src/api/review.js

@@ -213,15 +213,15 @@ export const postStudentArgueAcceptation = (reviewId, checkListId, accept) => {
  * 学生(评审方)提交argue [标记为已处理完成]
  * 学生(评审方)提交argue [标记为已处理完成]
  * @param {string|number} reviewId
  * @param {string|number} reviewId
  * @param {string|number} checkListId
  * @param {string|number} checkListId
- * @param {CheckListItemSerializerType[]} checkList
+ * @param {CheckListItemSerializerType} checkListItem
  * @return {Promise<{data:CheckListItemSerializerType[]}>}
  * @return {Promise<{data:CheckListItemSerializerType[]}>}
  */
  */
-export const postStudentArgueEnd = (reviewId, checkListId, checkList) => {
+export const postStudentArgueEnd = (reviewId, checkListId, checkListItem) => {
   return request(
   return request(
-    `${REVIEW_MODULE}/student/review/${reviewId}/checklist/${checkListId}/argue/acceptation`,
+    `${REVIEW_MODULE}/student/review/${reviewId}/checklist/${checkListId}/argue/end`,
     {
     {
       method: "POST",
       method: "POST",
-      body: { data: checkList }
+      body: { data: checkListItem }
     }
     }
   );
   );
 };
 };

+ 14 - 4
src/components/CardJudgeItem/index.vue

@@ -3,7 +3,9 @@
     :class="{
     :class="{
       'judge-section': true,
       'judge-section': true,
       'judge-success': success,
       'judge-success': success,
-      'judge-primary': isPrimary
+      'judge-primary': state === 'SOLVING',
+      'judge-warning': state === 'PENDING',
+      'judge-end': state === 'ARGUED'
     }"
     }"
   >
   >
     <slot></slot>
     <slot></slot>
@@ -11,6 +13,8 @@
 </template>
 </template>
 
 
 <script>
 <script>
+import { DEFAULT } from "@/data/checkListItemState";
+
 export default {
 export default {
   name: "CardJudgeItem",
   name: "CardJudgeItem",
   props: {
   props: {
@@ -18,9 +22,9 @@ export default {
       type: Boolean,
       type: Boolean,
       default: false
       default: false
     },
     },
-    isPrimary: {
-      type: Boolean,
-      default: false
+    state: {
+      type: String,
+      default: DEFAULT
     }
     }
   }
   }
 };
 };
@@ -40,4 +44,10 @@ export default {
 .judge-primary {
 .judge-primary {
   border-left: 6px solid $primary;
   border-left: 6px solid $primary;
 }
 }
+.judge-warning {
+  border-left: 6px solid $warning;
+}
+.judge-end {
+  border-left: 6px solid $grey;
+}
 </style>
 </style>

+ 110 - 6
src/components/CheckList/index.vue

@@ -4,25 +4,72 @@
       v-for="item in value"
       v-for="item in value"
       :key="item.id"
       :key="item.id"
       :success="item.level"
       :success="item.level"
-      :is-primary="item.state === 'PENDING'"
+      :state="item.state"
     >
     >
-      <b-tooltip :label="item.explain" position="is-left">
+      <div>
         <b-checkbox
         <b-checkbox
           class="checkbox-section"
           class="checkbox-section"
           v-model="item.level"
           v-model="item.level"
-          :type="item.state === 'PENDING' ? 'is-primary' : 'is-success'"
+          :type="item.state === 'SOLVING' ? 'is-primary' : 'is-success'"
+          :disabled="item.state === 'PENDING' || item.state === 'ARGUED'"
         >
         >
-          {{ item.content }}
+          <b-tooltip :label="item.explain" position="is-top">
+            {{ item.content }}
+          </b-tooltip>
         </b-checkbox>
         </b-checkbox>
-      </b-tooltip>
+        <b-tooltip :label="`申诉备注 : ${item.remark}`" type="is-warning">
+          <b-tag v-if="item.state === 'PENDING'" type="is-warning">
+            学生申诉
+          </b-tag>
+          <b-tag v-if="item.state === 'SOLVING'" type="is-primary">
+            处理申诉
+          </b-tag>
+        </b-tooltip>
+      </div>
+
       <input
       <input
         v-model="item.comment"
         v-model="item.comment"
         class="input-custom"
         class="input-custom"
-        :class="item.level ? 'input-custom--success' : 'input-custom--danger'"
+        :class="{
+          'input-custom--success': item.level,
+          'input-custom--danger': !item.level,
+          'input-custom--primary': item.state === 'SOLVING',
+          'input-custom--warning': item.state === 'PENDING',
+          'input-custom--end': item.state === 'ARGUED'
+        }"
+        :disabled="item.state === 'PENDING' || item.state === 'ARGUED'"
         type="text"
         type="text"
         placeholder="填写备注"
         placeholder="填写备注"
         style="box-shadow:none;border-color:white"
         style="box-shadow:none;border-color:white"
       />
       />
+      <div
+        class="action-section--warning action-section "
+        v-if="item.state === 'PENDING'"
+      >
+        <span
+          @click="acceptArgue(item)"
+          :class="{ 'is-loading': acceptArgueLoading }"
+          class="button is-warning"
+          >接受申诉</span
+        >
+        <span
+          @click="refuseArgue(item)"
+          :class="{ 'is-loading': refuseArgueLoading }"
+          class="button is-danger"
+          >拒绝申诉</span
+        >
+      </div>
+      <div
+        class="action-section--primary action-section "
+        v-if="item.state === 'SOLVING'"
+      >
+        <span
+          @click="submitSolution(item)"
+          :class="{ 'is-loading': submitSolutionLoading }"
+          class="button is-primary"
+          >提交处理好的申诉</span
+        >
+      </div>
     </card-judge-item>
     </card-judge-item>
   </div>
   </div>
 </template>
 </template>
@@ -38,6 +85,13 @@ export default {
       default: () => []
       default: () => []
     }
     }
   },
   },
+  data() {
+    return {
+      acceptArgueLoading: false,
+      refuseArgueLoading: false,
+      submitSolutionLoading: false
+    };
+  },
   watch: {
   watch: {
     value: {
     value: {
       handler(newValue) {
       handler(newValue) {
@@ -47,6 +101,21 @@ export default {
     }
     }
   },
   },
   methods: {
   methods: {
+    async acceptArgue(item) {
+      this.acceptArgueLoading = true;
+      await this.$emit("accept-argue", item);
+      this.acceptArgueLoading = false;
+    },
+    async refuseArgue(item) {
+      this.refuseArgueLoading = true;
+      await this.$emit("refuse-argue", item);
+      this.refuseArgueLoading = false;
+    },
+    async submitSolution(item) {
+      this.submitSolutionLoading = true;
+      await this.$emit("submit-solution", item);
+      this.submitSolutionLoading = false;
+    }
     // getColor(state) {}
     // getColor(state) {}
   }
   }
 };
 };
@@ -58,6 +127,29 @@ export default {
   padding: $default-margin;
   padding: $default-margin;
 }
 }
 
 
+.argue-section {
+  padding: $default-margin;
+  background-color: $warning;
+}
+
+.action-section {
+  .button {
+    border-radius: 0;
+  }
+
+  &--warning {
+    .button {
+      width: 50%;
+    }
+  }
+
+  &--primary {
+    .button {
+      width: 100%;
+    }
+  }
+}
+
 .input-custom {
 .input-custom {
   padding: $default-margin;
   padding: $default-margin;
   width: 100%;
   width: 100%;
@@ -74,6 +166,18 @@ export default {
     background-color: #ebfff2;
     background-color: #ebfff2;
   }
   }
 
 
+  &--primary {
+    background-color: lighten($primary, 30%);
+  }
+
+  &--warning {
+    background-color: lighten($warning, 30%);
+  }
+
+  &--end {
+    background-color: lighten($grey, 50%);
+  }
+
   &::placeholder {
   &::placeholder {
     /*color: hsl(0, 0%, 96%);*/
     /*color: hsl(0, 0%, 96%);*/
   }
   }

+ 36 - 4
src/views/student/Review/ReviewDocDetail/index.vue

@@ -28,13 +28,18 @@
         <div class="column is-4">
         <div class="column is-4">
           <div class="right-part">
           <div class="right-part">
             <div
             <div
-              class="button is-primary action-button"
+              class="button  is-medium is-primary action-button"
               :class="{ 'is-loading': submitLoading }"
               :class="{ 'is-loading': submitLoading }"
               @click="submitCheckList"
               @click="submitCheckList"
             >
             >
               提 交
               提 交
             </div>
             </div>
-            <check-list v-model="detail.checkList" />
+            <check-list
+              v-model="detail.checkList"
+              @submit-solution="submitSolution"
+              @accept-argue="acceptArgue"
+              @refuse-argue="refuseArgue"
+            />
           </div>
           </div>
         </div>
         </div>
       </div>
       </div>
@@ -45,7 +50,12 @@
 import PageHeader from "@/components/PageHeader";
 import PageHeader from "@/components/PageHeader";
 import PageBody from "@/components/PageBody/index";
 import PageBody from "@/components/PageBody/index";
 import VueMarkdown from "vue-markdown";
 import VueMarkdown from "vue-markdown";
-import { getStudentReviewDocDetail, postStudentReviewWork } from "@/api/review";
+import {
+  getStudentReviewDocDetail,
+  postStudentArgueAcceptation,
+  postStudentArgueEnd,
+  postStudentReviewWork
+} from "@/api/review";
 import timeMixins from "@/mixins/time";
 import timeMixins from "@/mixins/time";
 import ReviewStateTag from "@/components/ReviewStateTag/index";
 import ReviewStateTag from "@/components/ReviewStateTag/index";
 import CheckList from "@/components/CheckList/index";
 import CheckList from "@/components/CheckList/index";
@@ -83,6 +93,29 @@ export default {
           this.detail.checkList = resp.data;
           this.detail.checkList = resp.data;
         }
         }
       );
       );
+    },
+    async submitSolution(item) {
+      const { reviewId } = this.$route.params;
+      const { data } = await postStudentArgueEnd(reviewId, item.id, item);
+      this.detail.checkList = data;
+    },
+    async refuseArgue(item) {
+      const { reviewId } = this.$route.params;
+      const { data } = await postStudentArgueAcceptation(
+        reviewId,
+        item.id,
+        false
+      );
+      this.detail.checkList = data;
+    },
+    async acceptArgue(item) {
+      const { reviewId } = this.$route.params;
+      const { data } = await postStudentArgueAcceptation(
+        reviewId,
+        item.id,
+        true
+      );
+      this.detail.checkList = data;
     }
     }
   }
   }
 };
 };
@@ -99,7 +132,6 @@ export default {
   top: 0;
   top: 0;
   max-height: 100vh;
   max-height: 100vh;
   overflow-y: auto;
   overflow-y: auto;
-  overflow-x: hidden;
   box-shadow: $default-shadow;
   box-shadow: $default-shadow;
 }
 }