Kaynağa Gözat

ZhuRui 部分完成题目审核

Leonezhurui 4 yıl önce
ebeveyn
işleme
f4dc3fbbd0

+ 3 - 1
src/components/QuestionCard/CreatingQuestionCard.vue

@@ -71,6 +71,7 @@ export default {
     disapproveQuestion(){},
 
     mockApproveQuestion() {
+      // TODO
       const _this = this
       _this.$message({
         type: "success",
@@ -80,6 +81,7 @@ export default {
     },
 
     mockDisapproveQuestion() {
+      // TODO
       const _this = this
       _this.$message({
         type: "error",
@@ -93,4 +95,4 @@ export default {
 
 <style scoped>
 
-</style>
+</style>

+ 7 - 3
src/components/checkQuestionCard.vue

@@ -31,13 +31,16 @@
                     <el-button type="text" circle @click="expand" v-if="!isAll"><strong>展开</strong></el-button>
                     <el-button type="text" circle @click="withdraw" v-if="isAll"><strong>收起</strong></el-button>
                 </el-col>
+
                 <el-col :span="1">
-                    <el-button type="primary" icon="el-icon-check" circle @click="approve"></el-button>
+                  <el-button type="primary" icon="el-icon-check" circle @click="approve" v-if="questionvo.state !== 'APPROVED'"></el-button>
+                  <div v-else>APPROVED</div>
                 </el-col>
                 <el-col :span="1">
-                    <el-button type="warning" icon="el-icon-close" circle @click="checkDialogVisible=true"></el-button>
+                  <el-button type="warning" icon="el-icon-close" circle @click="checkDialogVisible=true" v-if="questionvo.state !== 'APPROVED'"></el-button>
                 </el-col>
             </el-row>
+
         </template>
         <div class="question-body">
             <div class="primary-question-card-body">
@@ -251,7 +254,7 @@ export default {
         },
 
         approve() { // 通过审核
-            this.questionvo.state = "APPROVED";
+
             let record = {
                 userId: store.state.user.id,
                 operationType: "Approve",
@@ -264,6 +267,7 @@ export default {
                     });
                     console.log("checkQuestionCard-approve");
                     console.log(res);
+                    this.questionvo.state = "APPROVED";
                     record.questionId = res.data.result.id;
                     record.time = new Date();
                     // 审核通过,添加操作记录

+ 56 - 4
src/views/Bok/Main/Check.vue

@@ -2,6 +2,28 @@
   <div>
     <h1>题目审查</h1>
     <el-tabs v-model="activeName" @tab-click="handleClick">
+      <el-tab-pane label="全部审核" name="checkingAll">
+        <el-pagination
+            id="checking_all"
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange_ALL"
+            :current-page="checkQuestionPage"
+            :page-sizes="[5, 10, 15, 20]"
+            :page-size="pageSize"
+            layout="total, sizes, prev, pager, next, jumper"
+            :total=this.checkTotalNum
+            v-if="this.checkQuestionList.length !== 0"
+        />
+        <checkQuestionCard
+            v-for="(item, index) in checkQuestionList"
+            :questionvo="item"
+            :key="item.id"
+            :cur-num="index+(checkQuestionPage-1)*pageSize"
+            :total-num="checkTotalNum"
+            @approve="handleApproved(item, checkQuestionList)"
+        />
+      </el-tab-pane>
+
       <el-tab-pane label="新建审核" name="creating">
         <el-pagination
           @size-change="handleSizeChange"
@@ -114,7 +136,12 @@ export default {
       pageSize: 20,
 
       // 分页所需数据
-      activeName: "creating",
+      activeName: "checkingAll",
+
+      // 所有(线上)题目列表
+      checkQuestionList: [],
+      checkQuestionPage: 1,
+      checkTotalNum: 0,
 
       // 新建审核题目列表
       createQuestionList: [],
@@ -144,10 +171,22 @@ export default {
   },
   methods: {
 
-    handleSizeChange(val) {
+    handleSizeChange(val) { //修改页面大小
       console.log(`QuestionRepository/index-handleSizeChange 每页 ${val} 条`);
       this.pageSize = val;
     },
+    handleCurrentChange_ALL(val){
+      console.log(`当前页: ${val}`);
+      this.checkQuestionPage = val;
+      this.$api.getTargetQuestionList(val - 1, this.pageSize)
+          .then(res => {
+            console.log("handleCurrentChange-checkingAll");
+            console.log(res);
+            this.checkQuestionList = res.data.result.content;
+          }).catch(error => {
+        console.log(error);
+      })
+    },
     handleCurrentChange(val, currentPage, questionList, states) { // 当点击新的页面时才请求新的数据
       console.log(`Check-handleCurrentChange 当前页: ${val}`);
       currentPage = val;
@@ -165,9 +204,22 @@ export default {
     handleClick(tab, event) {
       const _this = this
       switch (tab.props.name) {
+        case "checkingAll":
+          this.$api.getTargetQuestionList(0, this.pageSize)
+              .then(res => {
+                // mjh change
+                console.log("getTargetQuestion-checkingAll");
+                console.log(res);
+                this.checkQuestionList = res.data.result.content;
+                this.checkTotalNum = res.data.result.totalElements;
+              })
+              .catch(err => {
+                console.log(err);
+              })
+              break;
         // 新建审核
         case "creating":
-          // todo: 用真实代码替换mockjs
+          // todo: 用真代码替换mockjs
           // this.$api.getStateQuestion(tab.props.name.toUpperCase(), 0, this.pageSize)
           //   .then(res => {
           //     // mjh change
@@ -235,7 +287,7 @@ export default {
     },
   },
   mounted() {
-    this.handleClick({props: {name: "creating"}}, null);
+    this.handleClick({props: {name: "checkingAll"}}, null);
   }
 }
 </script>

+ 1 - 1
vue.config.js

@@ -41,7 +41,7 @@ module.exports = {
     devServer: {
         proxy: {
             "/api": {
-                target: "https://bok.seec.seecoder.cn",
+                target: "http://127.0.0.1:8080",
                 changeOrigin: true,
                 pathRewrite: {
                     "^/api": ""