Browse Source

Leone基本完成审查任务和部分细节的修改

Leonezhurui 5 years ago
parent
commit
9e377fbf67

+ 2 - 2
src/api/axios.config.js

@@ -63,11 +63,11 @@ export default function axiosConfig() {
 
 axiosConfig()
 
-const portal = 'http://p.seecoder.cn'
+const portal = 'http://p.seec.seecoder.cn'
 
 export const getLoginUrl = () => {
     const location = window.location
-    return `${portal}/api/interaction?client_id=seec-mooc&redirect_uri=${encodeURIComponent(
+    return `${portal}/interaction?client_id=seec-mooc&redirect_uri=${encodeURIComponent(
         location.origin + '/'
     )}&scope=openid`
 }

+ 10 - 3
src/api/index.js

@@ -4,14 +4,18 @@ import {
     deleteQuestionById,
     getTargetQuestionList,
     getStateQuestion,
-    updateQuestion, approveQuestion
+    updateQuestion,
+    requestQuestion,
 } from "./question";
 
 import {getUserById,
 
-
 } from "./user";
 
+import {createRecord,
+    getRecordByQid,
+} from "./operation_record";
+
 
 const api = {
     createQuestion: createQuestion,
@@ -19,9 +23,12 @@ const api = {
     getTargetQuestionList: getTargetQuestionList,
     getStateQuestion: getStateQuestion,
     updateQuestion: updateQuestion,
-    approveQuestion: approveQuestion,
+    requestQuestion: requestQuestion,
 
     getUserById: getUserById,
+
+    createRecord: createRecord,
+    getRecordByQid: getRecordByQid,
 }
 
 export {api}

+ 20 - 0
src/api/operation_record.js

@@ -0,0 +1,20 @@
+import axios from "axios";
+
+/**
+ * 创建一条操作记录
+ * @param ope_record
+ * @returns {Promise<AxiosResponse<any>>}
+ */
+export function createRecord(ope_record) {
+    return axios.post("/api/api/ope_record", ope_record);
+}
+
+
+export function getRecordByQid(qid) {
+    return axios.get("/api/api/ope_record/"+qid,{
+        params:{
+            offset: 0,
+            pageSize: 1000,
+        }
+    })
+}

+ 22 - 8
src/api/question.js

@@ -24,6 +24,25 @@ export function getTargetQuestionList(offset, pageSize) {
         }});
 }
 
+/**
+ * 搜索题目,返回的是1000条数据,目前来说是返回全部数据
+ * @param stem
+ * @param items
+ * @returns {Promise<AxiosResponse<any>>}
+ */
+export function requestQuestion(stem, ...items) {
+    return axios.get("/api/api/searchQuestion", {
+        params: {
+            stem: stem,
+            tags: items[0],
+            type: items[1],
+            weights: items[2],
+            knowledgeId: items[3],
+            offset: 0,
+            pageSize: 1000,
+        }});
+}
+
 
 /**
  * 根据题目id删除题目
@@ -60,18 +79,13 @@ export function updateQuestion(questionvo) {
  * @param states
  * @returns {Promise<AxiosResponse<any>>}
  */
-export function getStateQuestion(states) {
+export function getStateQuestion(states, offset, pageSize) {
     return axios.get("/api/api/state", {
         params:{
             state: states,
-            offset: 0,
-            pageSize: 1000,
+            offset: offset,
+            pageSize: pageSize,
         }});
 }
 
-export function approveQuestion(id, states) {
-    return axios.put("/api/api/check/"+id, {
-        state: states
-    });
-}
 

+ 80 - 86
src/components/AbstractQuestionCard.vue

@@ -34,8 +34,6 @@
                 </el-col>
                 <el-col :span="1">
                   <el-button type="primary" icon="el-icon-edit" circle @click="updateQuestion"></el-button>
-                  <el-button type="primary" icon="el-icon-check" circle @click="checkQuestionSuccess"></el-button>
-                  <el-button type="warning" icon="el-icon-close" circle @click="checkDialogVisible=true"></el-button>
                 </el-col>
                 <el-col :span="1">
                     <el-button v-if="isDelete === false" type="danger" icon="el-icon-delete" circle @click="deleteQuestion"></el-button>
@@ -134,7 +132,7 @@
         <el-divider v-show="isAll"></el-divider>
 
         <div class="bQuestion-card-footer" v-show="isAll">
-            <div>
+            <div class="footer">
                 <el-row>
                     <el-col :span="3">
                         <div><strong>状态: </strong>{{questionvo.state}}</div>
@@ -142,18 +140,20 @@
                     <el-col :span="5">
                         <div><strong>审核人: </strong>{{checkedUserName}}</div>
                     </el-col>
-
-                    <el-col :span="10"></el-col>
-
-                    <el-col :span="6" v-if="!questionvo.lastModifiedTime">
-                        <div><strong>CreateTime: </strong>{{toMyDate(questionvo.createdTime)}}</div>
-                    </el-col>
-
-                    <el-col :span="6" v-else>
-                        <div><strong>lastModifiedTime: </strong>{{toMyDate(questionvo.lastModifiedTime)}}</div>
-                    </el-col>
                 </el-row>
             </div>
+            <div class="footer" v-if="recordList.length !== 0">
+                <el-table :data="recordTable" style="width: 100%;background-color: transparent" height="100">
+                    <el-table-column prop="序号" label="序号" width="240" />
+                    <el-table-column prop="操作时间" label="操作时间" width="320" />
+                    <el-table-column prop="操作人" label="操作人" width="240" />
+                    <el-table-column prop="操作类型" label="操作类型" width="240"/>
+                    <el-table-column prop="备注" label="备注" />
+                </el-table>
+            </div>
+            <div class="footer" v-else>
+                <p>No Record!</p>
+            </div>
         </div>
     </el-card>
 
@@ -169,18 +169,6 @@
         <QuestionUpdater :question="questionvo" @closeDialog="closeDialog"/>
     </el-drawer>
 
-  <el-dialog title="审核不通过原因" v-model="checkDialogVisible" width="30%" center
-             :before-close="handleCheckDialogClose">
-    <el-space direction="vertical">
-    <el-space direction="vertical" :fill="true">
-      <el-checkbox-group v-model="failCheckList">
-        <el-checkbox v-for="(item, index) in failCheckOption" :label="item" class="fail-check-option"/>
-      </el-checkbox-group>
-      <el-input v-model="failCheckInput" placeholder="请输入原因"/>
-    </el-space>
-    <el-button type="primary" @click="checkQuestionFail">提交</el-button>
-    </el-space>
-  </el-dialog>
 </template>
 
 <script>
@@ -188,6 +176,7 @@
     import {map} from "../utils/knowledgeMapper";
     import {toMyDate} from "../utils/dateConvertor";
     import QuestionUpdater from "./QuestionUpdater";
+    import store from "../store";
 
     export default {
         name: "AbstractQuestionCard",
@@ -203,18 +192,12 @@
         data(){
             return{
                 isAll: false,
+                isAllRecord: false,
                 isDelete: false,
                 dialog: false,
                 checkedUserName: '',
-              // 审核dialog的可视化
-              checkDialogVisible: false,
-              // 审核失败的原因
-              failCheckOption: [
-                  '题目中存在错误','题目与相关内容无关','题目中存在敏感词','其他'
-              ],
-              // 详细解释
-              failCheckInput: "",
-              failCheckList: []
+                recordList: [],
+                recordNameDict: {},
             }
         },
         methods:{
@@ -246,17 +229,32 @@
                 this.dialog = false;
             },
             deleteQuestion(){
-                this.$confirm('此操作将永久删除该题目, 是否继续?', '提示', {
+                this.$confirm('此操作将删除该题目, 是否继续?', '提示', {
                     confirmButtonText: '确定',
                     cancelButtonText: '取消',
                     type: 'warning'
                 }).then(() => {
-                    this.$api.deleteQuestionById(this.questionvo.id).then(() => {
-                        this.$message({
-                            type: 'success',
-                            message: '删除成功!'
-                        });
-                        this.isDelete = true;
+                    this.questionvo.lastModifiedTime = new Date();
+                    this.questionvo.state = "DELETED";
+                    let record = {
+                        userId: store.state.user.id,
+                        operationType: "Delete",
+                    }
+                    this.$api.updateQuestion(this.questionvo)
+                        .then(res => {
+                            this.$message({
+                                type: 'success',
+                                message: '删除成功!'
+                            });
+                            this.isDelete = true;
+                            record.questionId = res.data.result.id;
+                            record.time = new Date();
+                            this.$api.createRecord(record)
+                                .then(res1 => {
+                                    console.log(res1);
+                                }).catch(err1 => {
+                                console.log(err1);
+                            })
                     }).catch( error => {
                         console.log(error);
                         this.$notify.error({
@@ -275,56 +273,29 @@
                 alert("Delete successfully!");
             },
 
-          // 题目审核通过
-          checkQuestionSuccess(){
-            const _this = this
-            console.log(_this.questionvo)
-            console.log(_this.$store.state.user)
-            console.log("当前时间")
-            // todo 更新题目的状态
-          },
-
-          // 题目审核不通过
-          checkQuestionFail(){
-            const _this = this
-            console.log(_this.questionvo)
-            console.log(_this.$store.state.user)
-            console.log(_this.failCheckList)
-            console.log(_this.failCheckInput)
-            console.log("当前时间")
-            // todo 更新题目的状态
-            _this.failCheckList = []
-            _this.failCheckInput = ""
-            _this.checkDialogVisible = false
-          },
-
-          // 关闭审核dialog前的方法
-          handleCheckDialogClose(done){
-            const _this = this
-            _this.$confirm('此操作将丢失填写信息, 是否继续?', '提示')
-                .then(() => {
-                  _this.failCheckList = []
-                  _this.failCheckInput = ""
-                  done()})
-                .catch(()=>{})
-          },
-
         },
         computed: {
-            // checkedUserName() {
-            //     this.$api.getUserById(this.questionvo.checkedUserId)
-            //         .then(res => {
-            //             console.log(res);
-            //             console.log(res.data.result.name);
-            //             return res.data.result.name;
-            //         }).catch(err => {
-            //         console.log(err);
-            //     })
-            // }
+            reversedRecordList(){
+                return this.recordList.reverse();
+            },
+            recordTable(){
+                let recordTable1 = [];
+                let length = this.recordList.length;
+                for (let i = 0; i < length; i++) {
+                    let recordDict = {};
+                    recordDict["序号"] = i+1;
+                    recordDict["操作时间"] = this.toMyDate(this.recordList[length-i-1].time);
+                    recordDict["操作人"] = this.recordNameDict[this.recordList[length-i-1].userId];
+                    recordDict["操作类型"] = this.recordList[length-i-1].operationType;
+                    recordDict["备注"] = this.recordList[length-i-1].remark;
+                    recordTable1.push(recordDict);
+                }
+                return recordTable1;
+            }
         },
         mounted() {
             if(this.questionvo.checkedUserId){
-                this.$api.getUserById(this.questionvo.checkedUserId)
+                this.$api.getUserById(this.questionvo.checkedUserId) // 异步函数1:根据用户ID获得用户名称
                     .then(res => {
                         if(res.data.result.name){
                             this.checkedUserName =  res.data.result.name;
@@ -334,6 +305,25 @@
                 })
             }
 
+            this.$api.getRecordByQid(this.questionvo.id) // 异步函数2:根据题目id获得ope_record
+                .then(res1 => {
+                    let tempList = res1.data.result.content;
+                    this.recordList = tempList;
+                    for (let record of tempList) { //这里换成this.recordList是没问题的
+                        if(!this.recordNameDict[record.userId]){
+                            this.$api.getUserById(record.userId) //异步函数3:根据记录中的用户ID获得其name
+                                .then(res2 => {
+                                    if(res2.data.result.name){
+                                        this.recordNameDict[record.userId] = res2.data.result.name;
+                                    }
+                                }).catch(err2 => {
+                                console.log(err2);
+                            })
+                        }
+                    }
+                }).catch(err1 => {
+                    console.log(err1);
+                });
         }
     }
 </script>
@@ -387,4 +377,8 @@
       width: 100%;
     }
 
+    .footer{
+        margin-bottom: 10px;
+    }
+
 </style>

+ 20 - 4
src/components/QuestionCreater.vue

@@ -141,11 +141,11 @@
             <el-button type="primary" @click="submitNewQuestion" :loading="loading">{{ loading ? '提交中 ...' : '确 定' }}</el-button>
         </div>
     </div>
+
 </template>
 
 <script>
     import store from "../store"
-    import {createQuestion} from "../api/question"
 
     export default {
         name: "QuestionCreater",
@@ -241,20 +241,36 @@
                 clearTimeout(this.timer);
             },
             submitNewQuestion(){
-                console.log(this.question);
+                // console.log(this.question);
                 this.question.knowledgeId.push(this.myknowledgeId);
                 this.question.createdTime = new Date();
-                this.question.state = "APPROVED";
+                this.question.state = "CHECKING";
                 this.question.checkedUserId = 364; //这里是审核人的ID
                 this.question.savedUserId = store.state.user.id;
-                console.log(this.$api)
+                let record = {
+                    userId: store.state.user.id,
+                    operationType: "Create",
+                }
                 this.$api.createQuestion(this.question)
                     .then(res => {
+                        // console.log(res);
                         this.$notify({
                             title: '成功',
                             message: '创建成功',
                             type: 'success'
                         });
+                        record.questionId = res.data.result.id;
+                        record.time = new Date();
+
+                        // 如果题目创建成功,那么添加操作记录
+                        this.$api.createRecord(record)
+                            .then(res1 => {
+                                console.log(res1);
+                            }).catch(err1 => {
+                            console.log(err1);
+                        })
+
+                        // 关闭侧边抽屉
                         setTimeout(() => {
                             this.$emit('closeDialog');
                         }, 1000);

+ 17 - 0
src/components/QuestionUpdater.vue

@@ -159,6 +159,8 @@
 </template>
 
 <script>
+    import store from "../store";
+
     export default {
         name: "QuestionUpdater",
         props: {
@@ -209,12 +211,27 @@
             },
             updateQuestion(){
                 this.question.lastModifiedTime = new Date();
+                let record = {
+                    userId: store.state.user.id,
+                    operationType: "Update",
+                }
                 this.$api.updateQuestion(this.question).then(res => {
                     this.$notify({
                         title: '成功',
                         message: '更新成功',
                         type: 'success'
                     });
+
+                    record.questionId = res.data.result.id;
+                    record.time = new Date();
+                    // 如果题目更新成功,那么添加操作记录
+                    this.$api.createRecord(record)
+                        .then(res1 => {
+                            console.log(res1);
+                        }).catch(err1 => {
+                        console.log(err1);
+                    })
+
                     setTimeout(() => {
                         this.$emit('closeDialog');
                     }, 1000);

+ 166 - 39
src/components/checkQuestionCard.vue

@@ -3,20 +3,40 @@
         <template #header>
             <el-row>
                 <el-col :span="3">
-                    <div>
-                        <strong>申请人: </strong>{{savedUserName}}
-                    </div>
+                    <span><strong>S/N: </strong>{{curNum+1}} / {{totalNum}}</span>
                 </el-col>
+
                 <el-col :span="5">
-                    <div>
-                        <strong>申请日期: </strong> {{toMyDate(questionvo.createdTime)}}
+                    <span><strong>题目类型: </strong>{{questionvo.type}}</span>
+                </el-col>
+
+                <el-col :span="6">
+                    <div class="bQuestion-card-body-knowledgeID">
+                            <span v-if="questionvo.knowledgeId && questionvo.knowledgeId.length !== 0">
+                                <span><strong>KnowledgeId: </strong></span>
+                                <el-tooltip v-for="item in questionvo.knowledgeId" effect="dark" placement="bottom">
+                                    <template #content>
+                                        {{map(item)}}
+                                    </template>
+                                    <el-tag  effect="dark" style="margin-right: 2px">{{item}}</el-tag>
+                                </el-tooltip>
+                            </span>
+                        <span v-else>
+                                <span><strong>KnowledgeId: </strong>null</span>
+                            </span>
                     </div>
                 </el-col>
-                <el-col :span="14"></el-col>
+                <el-col :span="6"></el-col>
                 <el-col :span="2">
-                    <el-button type="text" circle @click="expand" v-if="!isAll"><strong>查看全部</strong></el-button>
+                    <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-col>
+                <el-col :span="1">
+                    <el-button type="warning" icon="el-icon-close" circle @click="checkDialogVisible=true"></el-button>
+                </el-col>
             </el-row>
         </template>
         <div class="question-body">
@@ -109,32 +129,59 @@
 
             <el-divider v-if="isAll"></el-divider>
 
-            <div class="bQuestion-card-footer" v-if="isAll">
-                <div>
+            <div class="bQuestion-card-footer" v-show="isAll">
+                <div class="footer">
                     <el-row>
-                        <el-col :span="8">
-                            <el-button type="primary" @click="approve">通过</el-button>
+                        <el-col :span="3">
+                            <div><strong>状态: </strong>{{questionvo.state}}</div>
                         </el-col>
-                        <el-col :span="8">
-                            <el-button type="primary" @click="">待定</el-button>
+                        <el-col :span="5">
+                            <div><strong>申请人: </strong>{{savedUserName}}</div>
                         </el-col>
-                        <el-col :span="8">
-                            <el-button type="primary" @click="deny">拒绝</el-button>
+                        <el-col :span="10"></el-col>
+                        <el-col :span="6">
+                            <div>
+                                <strong>申请日期: </strong> {{toMyDate(questionvo.createdTime)}}
+                            </div>
                         </el-col>
-
                     </el-row>
                 </div>
+                <div class="footer" v-if="recordList.length !== 0">
+                    <el-table :data="recordTable" style="width: 100%;background-color: transparent" height="100">
+                        <el-table-column prop="序号" label="序号" width="240" />
+                        <el-table-column prop="操作时间" label="操作时间" width="360" />
+                        <el-table-column prop="操作人" label="操作人" width="240" />
+                        <el-table-column prop="操作类型" label="操作类型" />
+                    </el-table>
+                </div>
+                <div class="footer" v-else>
+                    <p>No Record!</p>
+                </div>
             </div>
 
         </div>
-
     </el-card>
 
+    <el-dialog title="审核不通过原因" v-model="checkDialogVisible" width="30%" center
+               :before-close="handleCheckDialogClose">
+        <el-space direction="vertical">
+            <el-space direction="vertical" :fill="true">
+                <el-checkbox-group v-model="failCheckList">
+                    <el-checkbox v-for="(item, index) in failCheckOption" :label="item" class="fail-check-option"/>
+                </el-checkbox-group>
+                <el-input v-model="failCheckInput" placeholder="请输入原因"/>
+            </el-space>
+            <el-button type="primary" @click="deny">提交</el-button>
+        </el-space>
+    </el-dialog>
+
 </template>
 
 <script>
     import MarkdownText from "./MarkdownText";
     import {toMyDate} from "../utils/dateConvertor";
+    import {map} from "../utils/knowledgeMapper";
+    import store from "../store";
 
     export default {
         name: "checkCard",
@@ -143,37 +190,51 @@
         },
         props: {
             questionvo: Object,
+            curNum: Number,
+            totalNum: Number,
         },
         data(){
             return{
-                questionvo1: {
-                    id: '',
-                    type: '',
-                    state: '',
-                    checkedUserId: 0,
-                    savedUserId: 0,
-                    stem: '',
-                    weight: 0,
-                    analysis: '',
-                    keyPoints: '',
-                    tags: [],
-                    knowledgeId: [],
-                    options: {},
-                    blanks: {},
-                    answer: '',
-                    inputOutputMapping: {},
-                    millisecondLimit: 0,
-                    memoryLimit: 0,
-                    createdTime: Date,
-                    lastModifiedTime: Date,
-                },
                 isAll: false,
                 savedUserName: '',
+                // 审核dialog的可视化
+                checkDialogVisible: false,
+                // 审核失败的原因
+                failCheckOption: [
+                    '题目中存在错误','题目与相关内容无关','题目中存在敏感词','其他'
+                ],
+                // 详细解释
+                failCheckInput: "",
+                failCheckList: [],
+                recordList: [],
+                recordNameDict: {},
             }
         },
         computed: {
+            recordTable(){
+                let recordTable1 = [];
+                let length = this.recordList.length;
+                for (let i = 0; i < length; i++) {
+                    let recordDict = {};
+                    recordDict["序号"] = i+1;
+                    recordDict["操作时间"] = this.toMyDate(this.recordList[length-i-1].time);
+                    recordDict["操作人"] = this.recordNameDict[this.recordList[length-i-1].userId];
+                    recordDict["操作类型"] = this.recordList[length-i-1].operationType;
+                    recordTable1.push(recordDict);
+                }
+                return recordTable1;
+            },
+            denyReason(){
+                let denyReason = "";
+                for (let reason of this.failCheckList) {
+                    denyReason += reason+", ";
+                }
+                denyReason += this.failCheckInput;
+                return denyReason;
+            }
         },
         methods: {
+            map,
             toMyDate,
             expand(){
                 if(!this.isAll){
@@ -187,13 +248,28 @@
             },
             approve(){ // 通过审核
                 this.questionvo.state = "APPROVED";
+                let record = {
+                    userId: store.state.user.id,
+                    operationType: "Approve",
+                }
                 this.$api.updateQuestion(this.questionvo)
                     .then(res => {
                         this.$message({
                             type: 'success',
                             message: '通过成功!'
                         });
+                        console.log("checkQuestionCard-approve");
                         console.log(res);
+                        record.questionId = res.data.result.id;
+                        record.time = new Date();
+                        // 审核通过,添加操作记录
+                        this.$api.createRecord(record)
+                            .then(res1 => {
+                                console.log("checkQuestionCard-approve-createRecord");
+                                console.log(res1);
+                            }).catch(err1 => {
+                            console.log(err1);
+                        })
                     })
                     .catch(err => {
                         this.$notify.error({
@@ -204,14 +280,32 @@
                 })
             },
             deny(){ // 拒绝通过
+                let reason = this.denyReason
                 this.questionvo.state = "REFUSED";
+                let record = {
+                    userId: store.state.user.id,
+                    operationType: "Refuse",
+                }
                 this.$api.updateQuestion(this.questionvo)
                     .then(res => {
                         this.$message({
                             type: 'success',
                             message: '拒绝成功!'
                         });
+                        console.log("checkQuestionCard-deny")
                         console.log(res);
+                        record.questionId = res.data.result.id;
+                        record.time = new Date();
+                        // todo 这里直接调用denyReason就为空?
+                        record.remark = reason;
+                        // 审核通过,添加操作记录
+                        this.$api.createRecord(record)
+                            .then(res1 => {
+                                console.log("checkQuestionCard-deny-createRecord");
+                                console.log(res1);
+                            }).catch(err1 => {
+                            console.log(err1);
+                        })
                     })
                     .catch(err => {
                         this.$notify.error({
@@ -220,7 +314,20 @@
                         });
                         console.log(err);
                     })
-            }
+                this.failCheckList = []
+                this.failCheckInput = ""
+                this.checkDialogVisible = false
+            },
+            // 关闭审核dialog前的方法
+            handleCheckDialogClose(done){
+                const _this = this
+                _this.$confirm('此操作将丢失填写信息, 是否继续?', '提示')
+                    .then(() => {
+                        _this.failCheckList = []
+                        _this.failCheckInput = ""
+                        done()})
+                    .catch(()=>{})
+            },
         },
         mounted() {
             if(this.questionvo.savedUserId){
@@ -233,6 +340,26 @@
                     console.log(err);
                 })
             }
+
+            this.$api.getRecordByQid(this.questionvo.id) // 异步函数2:根据题目id获得ope_record
+                .then(res1 => {
+                    let tempList = res1.data.result.content;
+                    this.recordList = tempList;
+                    for (let record of tempList) { //这里换成this.recordList是没问题的
+                        if(!this.recordNameDict[record.userId]){
+                            this.$api.getUserById(record.userId) //异步函数3:根据记录中的用户ID获得其name
+                                .then(res2 => {
+                                    if(res2.data.result.name){
+                                        this.recordNameDict[record.userId] = res2.data.result.name;
+                                    }
+                                }).catch(err2 => {
+                                console.log(err2);
+                            })
+                        }
+                    }
+                }).catch(err1 => {
+                console.log(err1);
+            });
         }
     }
 </script>

+ 46 - 7
src/views/Bok/Main/Check.vue

@@ -2,9 +2,27 @@
     <div>
         <h1>题目审查</h1>
 
-        <div >
-            <checkQuestionCard v-for="(item, index) in questionvoList"
-                               :questionvo="item"></checkQuestionCard>
+        <div class="el-pagination-body">
+            <el-pagination
+                    @size-change="handleSizeChange"
+                    @current-change="handleCurrentChange"
+                    :current-page="currentPage"
+                    :page-sizes="[5, 10, 15, 20]"
+                    :page-size="pageSize"
+                    layout="total, sizes, prev, pager, next, jumper"
+                    :total=this.totalNum
+                    v-if="this.questionList.length !== 0"
+            >
+            </el-pagination>
+        </div>
+
+        <div>
+            <checkQuestionCard v-for="(item, index) in questionList"
+                               :questionvo="item"
+                               :key="item.id"
+                               :cur-num="index+(currentPage-1)*pageSize"
+                               :total-num="totalNum"
+            ></checkQuestionCard>
         </div>
 
     </div>
@@ -19,19 +37,40 @@
         },
         data(){
             return{
-                questionvoList: [],
-
+                questionList: [],
+                currentPage: 1,
+                pageSize: 20,
+                totalNum: 0,
             }
         },
         methods:{
+            handleSizeChange(val) {
+                console.log(`QuestionRepository/index-handleSizeChange 每页 ${val} 条`);
+                this.pageSize = val;
+            },
+            handleCurrentChange(val) { // 当点击新的页面时才请求新的数据
+                console.log(`Check-handleCurrentChange 当前页: ${val}`);
+                this.currentPage = val;
+                let states = 'CHECKING';
+                this.$api.getStateQuestion(states, val-1, this.pageSize)
+                    .then(res => {
+                        console.log("handleCurrentChange-check");
+                        console.log(res);
+                        this.questionList = res.data.result.content;
+                    }).catch(error => {
+                    console.log(error);
+                })
+            },
 
         },
         mounted() {
             let states = 'CHECKING';
-            this.$api.getStateQuestion(states)
+            this.$api.getStateQuestion(states, 0, this.pageSize)
                 .then(res => {
+                    console.log("getStateQuestion-CHECKING");
                     console.log(res);
-                    this.questionvoList = res.data.result.content;
+                    this.questionList = res.data.result.content;
+                    this.totalNum = res.data.result.totalElements;
                 }).catch(err => {
                     console.log(err);
                 })

+ 0 - 21
src/views/Bok/Main/KnowledgeGraph.vue

@@ -1,43 +1,22 @@
 <template>
     <div><h1>Knowledge Graph</h1></div>
-<!--    <div>{{$store.state.myCount}}</div>-->
-    <div>{{countAlias}}</div>
-    <div>{{countPlusLocalState}}</div>
-    <div>{{$store.getters.showCount}}</div>
-    <el-button type="primary" @click="add">+1</el-button>
 
 </template>
 
 <script>
-    import {mapState, mapGetters} from 'vuex';
     export default {
         name: "KnowledgeGraph",
         components: {
         },
         data(){
             return{
-                localCount: "su"
             }
         },
         computed: {
-            // ...mapState(['myCount'])
-            ...mapState({
-                count: state => state.myCount,
-                countAlias: 'myCount',
-                countPlusLocalState (state) {
-                    return state.myCount + this.localCount
-                }
-            })
         },
         methods: {
-            add(){
-                this.$store.dispatch('addAsync');
-            }
-
         },
         mounted() {
-
-
         }
     }
 </script>

+ 15 - 37
src/views/Bok/Main/QuestionRepository/index.vue

@@ -13,9 +13,9 @@
       <el-pagination
               @size-change="handleSizeChange"
               @current-change="handleCurrentChange"
-              v-model:current-page="currentPage"
+              :current-page="currentPage"
               :page-sizes="[5, 10, 15, 20]"
-              v-model:page-size="pageSize"
+              :page-size="pageSize"
               layout="total, sizes, prev, pager, next, jumper"
               :total=this.totalNum
               v-if="this.questionList.length !== 0"
@@ -56,7 +56,6 @@
           size="35%"
   >
     <QuestionCreater :dialog="dialog" @closeDialog="closeDialog"/>
-
   </el-drawer>
 
   <el-drawer
@@ -69,7 +68,6 @@
           size="35%"
   >
     <QuestionGroupCreater :dialog="dialog1" @closeDialog="closeDialog1"/>
-
   </el-drawer>
 </template>
 
@@ -100,23 +98,19 @@ export default {
     }
   },
   mounted() {
-    axios.get("/api/api/pageQuestion", {
-      params:{
-        offset: 0,
-        pageSize: this.pageSize
-      }})
+    // 挂载时获取第一页题目列表
+    let states = 'APPROVED';
+    this.$api.getStateQuestion(states, 0, this.pageSize)
             .then(res => {
-              // console.log(res);
+              console.log("QuestionRepository/index");
+              console.log(res);
               this.questionList = res.data.result.content;
               this.totalNum = res.data.result.totalElements;
             }).catch(error => {
       console.log(error);
-    }).finally(() => {
-      console.log("mounted completed");
     })
   },
   computed: {
-
   },
   methods: {
     createQuestion(){
@@ -142,11 +136,6 @@ export default {
               })
               .catch(_ => {});
     },
-    cancelForm() {
-      this.loading = false;
-      this.dialog = false;
-      clearTimeout(this.timer);
-    },
     closeDialog(){
       this.dialog = false;
     },
@@ -154,34 +143,23 @@ export default {
       this.dialog1 = false;
     },
     handleSizeChange(val) {
-      console.log(`每页 ${val} 条`);
+      console.log(`QuestionRepository/index-handleSizeChange 每页 ${val} 条`);
       this.pageSize = val;
     },
-    handleCurrentChange(val) {
-      console.log(`当前页: ${val}`);
-      axios.get("/api/api/pageQuestion", {
-        params:{
-          offset: val-1,
-          pageSize: this.pageSize
-        }})
+    handleCurrentChange(val) { // 当点击新的页面时才请求新的数据
+      console.log(`QuestionRepository/index-handleCurrentChange 当前页: ${val}`);
+      this.currentPage = val;
+      let states = 'APPROVED';
+      this.$api.getStateQuestion(states, val-1, this.pageSize)
               .then(res => {
+                console.log("handleCurrentChange-result");
                 console.log(res);
                 this.questionList = res.data.result.content;
               }).catch(error => {
         console.log(error);
-      }).finally(() => {
-        console.log("change page completed");
-      });
-      this.currentPage = val;
+      })
     },
   },
-  watch: {
-    // questionList(newval, val){
-    //   console.log("Watch changes!");
-    //   console.log(newval);
-    //   console.log(val);
-    // }
-  }
 }
 </script>
 

+ 0 - 66
src/views/Bok/Main/Review/index.vue

@@ -1,66 +0,0 @@
-<template>
-  <h1>题目审查</h1>
-  <el-button @click="jumpToLogin">jumpToLogin</el-button>
-  <div>
-    <checkQuestionCard v-for="(item, index) in questionvoList"
-                       :questionvo="item"></checkQuestionCard>
-  </div>
-</template>
-
-<script>
-import checkQuestionCard from "@/components/checkQuestionCard";
-
-export default {
-  name: "Review",
-  components: {
-    checkQuestionCard,
-  },
-  data() {
-    return {
-      questionvoList: [
-        {
-          id: '123456',
-          type: 'choice',
-          state: 'CHECKING',
-          checkedUserId: 0,
-          savedUserId: 364,
-          stem: '',
-          weight: 0,
-          analysis: '',
-          keyPoints: '',
-          tags: [],
-          knowledgeId: [],
-          options: {},
-          blanks: {},
-          answer: '',
-          inputOutputMapping: {},
-          millisecondLimit: 0,
-          memoryLimit: 0,
-          createdTime: Date,
-          lastModifiedTime: Date,
-        },
-        {}
-      ]
-
-    }
-  },
-  methods: {
-    getLoginUrl() {
-      const portal = 'http://p.seecoder.cn'
-
-      const location = window.location
-      return `${portal}/api/interaction?client_id=seec-mooc&redirect_uri=${encodeURIComponent(
-          location.origin + '/'
-      )}&scope=openid`
-    },
-    jumpToLogin() {
-      window.location.href = this.getLoginUrl()
-    },
-
-  }
-}
-</script>
-
-<style scoped>
-
-</style>

+ 4 - 29
src/views/Bok/Main/Search/index.vue

@@ -27,7 +27,8 @@
                        v-model:page-size="pagination.size" :layout="pagination.layout"
                        :total="filteredQuestions.length"/>
 
-        <AbstractQuestionCard v-for="(item, index) in currentQuestions" :questionvo="item"
+        <AbstractQuestionCard v-for="(item, index) in currentQuestions"
+                              :questionvo="item"
                              :total-num="filteredQuestions.length"
                              :cur-num="index+pagination.size*(pagination.current-1)"/>
     </el-space>
@@ -296,19 +297,9 @@ export default {
             })
         },
 
-        // todo 注释 添加到api文件当中
         async requestQuestion(stem, ...items) {
-            await axios.get("/api/api/searchQuestion", {
-                params: {
-                    stem: stem,
-                    tags: items[0],
-                    type: items[1],
-                    weights: items[2],
-                    knowledgeId: items[3],
-                    offset: 0,
-                    pageSize: 1000
-                }
-            }).then(res => {
+            await this.$api.requestQuestion(stem, items[0], items[1], items[2], items[3])
+                .then(res => {
                 this.resultQuestions = res.data.result.content;
                 this.totalNum = res.data.result.totalElements;
                 this.$notify({
@@ -322,8 +313,6 @@ export default {
                     title: '错误',
                     message: '搜索失败'
                 });
-            }).finally(() => {
-                console.log("Search completed!")
             })
         },
 
@@ -333,20 +322,6 @@ export default {
 
         //
         handleCurrentChange(val) {
-            // console.log(`当前页: ${val}`);
-            // axios.get("/api/api/pageQuestion", {
-            //     params:{
-            //         offset: val-1,
-            //         pageSize: this.pagination.size
-            //     }})
-            //     .then(res => {
-            //         this.resultQuestions = res.data.content;
-            //     }).catch(error => {
-            //     console.log(error);
-            // }).finally(() => {
-            //     console.log("change page completed");
-            // });
-            // this.currentPage = val;
         },
 
     }

+ 1 - 44
src/views/Bok/Main/Setting.vue

@@ -1,62 +1,19 @@
 <template>
+    <div><h1>Setting</h1></div>
 
 </template>
 
 <script>
-  import checkQuestionCard from "../../../components/checkQuestionCard";
 export default {
   name: "Setting",
   components:{
-    checkQuestionCard,
   },
   data(){
     return{
-      questionvoList: [
-        {
-          id: '123456',
-          type: 'choice',
-          state: 'CHECKING',
-          checkedUserId: 0,
-          savedUserId: 364,
-          stem: '',
-          weight: 0,
-          analysis: '',
-          keyPoints: '',
-          tags: [],
-          knowledgeId: [],
-          options: {},
-          blanks: {},
-          answer: '',
-          inputOutputMapping: {},
-          millisecondLimit: 0,
-          memoryLimit: 0,
-          createdTime: Date,
-          lastModifiedTime: Date,
-        },
-        {
-
-        }
-      ]
 
     }
   },
   methods:{
-    getLoginUrl(){
-      const portal = 'http://p.seecoder.cn'
-
-      const location = window.location
-      return `${portal}/api/interaction?client_id=seec-mooc&redirect_uri=${encodeURIComponent(
-              location.origin + '/'
-      )}&scope=openid`
-    },
-    jumpToLogin(){
-      window.location.href = this.getLoginUrl()
-    },
-    test(){
-      // this.$api.printName("nimade");
-      alert(this.$api.testFunc("xiaosu"));
-    }
-
 
   }
 }

+ 2 - 8
src/views/Bok/SideBar.vue

@@ -29,7 +29,7 @@
         <i class="el-icon-document"></i>
         <template #title>试卷袋</template>
       </el-menu-item>
-      <el-menu-item index="check">
+      <el-menu-item index="check" v-if="role">
         <i class="el-icon-circle-check"></i>
         <template #title>审核</template>
       </el-menu-item>
@@ -49,16 +49,10 @@ export default {
     active(){
       return this.$route.path.split("/")[1]
     },
-    role(){
-      console.log(this.$store.state.user);
+    role(){ //获得当前登录用户的角色;审查界面只给ADMIN用户显示。
       return this.$store.state.user.role === 'ADMIN';
     }
   },
-  // data(){
-  //   return{
-  //     role: this.$store.state.user.role,
-  //   }
-  // },
   methods: {
     handleOpen(key, keyPath) {
       console.log(key, keyPath);