فهرست منبع

更新依赖,跳过认证

201250038 2 سال پیش
والد
کامیت
bbeaaf7ef9
4فایلهای تغییر یافته به همراه146 افزوده شده و 60 حذف شده
  1. 3 2
      package.json
  2. 103 18
      src/components/QuestionCard/UpdatingQuestionCard.vue
  3. 39 39
      src/router/index.js
  4. 1 1
      src/views/Bok/Main/Search/index.vue

+ 3 - 2
package.json

@@ -16,7 +16,8 @@
     "mockjs": "^1.1.0",
     "moment": "^2.29.1",
     "moment-locales-webpack-plugin": "^1.2.0",
-    "node-sass": "^4.14.1",
+    "node-sass": "npm:sass",
+    "qs": "^6.11.2",
     "speed-measure-webpack-plugin": "^1.5.0",
     "terser-webpack-plugin": "^4.2.3",
     "tinymce": "^5.10.1",
@@ -36,7 +37,7 @@
     "@vue/compiler-sfc": "^3.0.0",
     "@vue/test-utils": "^2.0.0-0",
     "chai": "^4.1.2",
-    "sass-loader": "^8.0.2"
+    "sass-loader": "^10.0.1"
   },
   "browserslist": [
     "> 1%",

+ 103 - 18
src/components/QuestionCard/UpdatingQuestionCard.vue

@@ -150,6 +150,19 @@
       </div>
     </template>
   </primary-question-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>
@@ -236,10 +249,30 @@ export default {
     // 新旧题目的解析是否相同
     isAnalysisEqual() {
       return this.oldQuestionVO.analysis === this.newQuestionVO.analysis;
-    }
+    },
+
+    denyReason() {
+      let denyReason = "";
+      for (let reason of this.failCheckList) {
+        denyReason += reason + ", ";
+      }
+      denyReason += this.failCheckInput;
+      return denyReason;
+    },
   },
   mounted() {
   },
+  data(){
+    return {
+      checkDialogVisible: false,
+      // 审核失败的原因
+      failCheckOption: [
+        '题目中存在错误', '题目与相关内容无关', '题目中存在敏感词', '其他'
+      ],
+      failCheckInput: "",
+      failCheckList: [],
+    }
+  },
   methods: {
     map,
 
@@ -299,43 +332,95 @@ export default {
 
     // 审核不通过更新的题目
     disapproveQuestion() {
-      const _this = this;
-      _this.oldQuestionVO.state = "APPROVED";
+      this.checkDialogVisible = true;
+      // const _this = this;
+      // _this.oldQuestionVO.state = "APPROVED";
+      // let record = {
+      //   userId: store.state.user.id,
+      //   operationType: "Refuse",
+      // }
+      // _this.$api.updateQuestion(_this.oldQuestionVO)
+      //     .then(res => {
+      //       _this.$message({
+      //         type: 'error',
+      //         message: '修改审核不通过!'
+      //       });
+      //       console.log("UpdatingQuestionCard-refuse");
+      //       console.log(res);
+      //       record.questionId = res.data.result.id;
+      //       record.time = new Date();
+      //       // 审核通过,添加操作记录
+      //       _this.$api.createRecord(record)
+      //           .then(res1 => {
+      //             console.log("Updating-refuse-createRecord");
+      //             console.log(res1);
+      //           }).catch(err1 => {
+      //         console.log(err1);
+      //       })
+      //     })
+      //     .catch(err => {
+      //       _this.$notify.error({
+      //         title: '错误',
+      //         message: '通过失败'
+      //       });
+      //       console.log(err);
+      //     });
+      // _this.$api.deleteQuestionById(_this.newQuestionVO.id).then(res => {
+      //   console.log("中间状态题目删除成功");
+      // }).catch(err => {
+      //   console.log(err);
+      // })
+    },
+    // 关闭审核dialog前的方法
+    handleCheckDialogClose(done) {
+      const _this = this
+      _this.$confirm('此操作将丢失填写信息, 是否继续?', '提示')
+          .then(() => {
+            _this.failCheckList = []
+            _this.failCheckInput = ""
+            done()
+          })
+          .catch(() => {
+          })
+    },
+    // 拒绝通过
+    deny() {
+      let reason = this.denyReason
+      this.questionvo.state = "REFUSED";
       let record = {
         userId: store.state.user.id,
         operationType: "Refuse",
       }
-      _this.$api.updateQuestion(_this.oldQuestionVO)
+      this.$api.updateQuestion(this.oldQuestionVO)
           .then(res => {
-            _this.$message({
-              type: 'error',
+            this.$message({
+              type: 'success',
               message: '修改审核不通过!'
             });
-            console.log("UpdatingQuestionCard-refuse");
+            console.log("checkQuestionCard-deny")
             console.log(res);
             record.questionId = res.data.result.id;
             record.time = new Date();
-            // 审核通过,添加操作记录
-            _this.$api.createRecord(record)
+            record.remark = reason;
+            // 审核拒绝,添加操作记录
+            this.$api.createRecord(record)
                 .then(res1 => {
-                  console.log("Updating-refuse-createRecord");
+                  console.log("checkQuestionCard-deny-createRecord");
                   console.log(res1);
                 }).catch(err1 => {
               console.log(err1);
             })
           })
           .catch(err => {
-            _this.$notify.error({
+            this.$notify.error({
               title: '错误',
-              message: '通过失败'
+              message: '拒绝失败'
             });
             console.log(err);
-          });
-      _this.$api.deleteQuestionById(_this.newQuestionVO.id).then(res => {
-        console.log("中间状态题目删除成功");
-      }).catch(err => {
-        console.log(err);
-      })
+          })
+      this.failCheckList = []
+      this.failCheckInput = ""
+      this.checkDialogVisible = false
     },
 
     mockDisapproveQuestion() {

+ 39 - 39
src/router/index.js

@@ -85,45 +85,45 @@ const router = createRouter({
   routes
 })
 
-router.beforeEach((to, from , next) =>{
-  if(to.path === '/error'){
-    next()
-  }
-  const {id_token} = to.query;
-  if(id_token){
-    store.commit('setToken', id_token);
-    getUserInfo().then(({ data }) => {
-      store.commit('setUser', data.result)
-      if(to.path === '/check' && !store.getters.hasPermission){
-        next('/error')
-      }else{
-        next(to.path)
-      }
-    }).catch(err => {
-      console.log(err)
-      store.commit('setToken', null);
-      ElMessageBox.confirm('无权限','登录失败',{
-          confirmButtonText: '重新登陆',
-          cancelButtonText: '返回门户',
-          type: 'error',
-      }).then(()=>{
-        jumpToLogin();
-      }).catch(()=>{
-        window.location.href = 'https://p.seec.seecoder.cn'
-      })
-    })
-  }else{
-    if(!store.getters.isLogin){
-      jumpToLogin()
-    }else{
-      if(to.path === '/check' && !store.getters.hasPermission){
-        next('/error')
-      }else{
-        next()
-      }
-    }
-  }
-})
+// router.beforeEach((to, from , next) =>{
+//   if(to.path === '/error'){
+//     next()
+//   }
+//   const {id_token} = to.query;
+//   if(id_token){
+//     store.commit('setToken', id_token);
+//     getUserInfo().then(({ data }) => {
+//       store.commit('setUser', data.result)
+//       if(to.path === '/check' && !store.getters.hasPermission){
+//         next('/error')
+//       }else{
+//         next(to.path)
+//       }
+//     }).catch(err => {
+//       console.log(err)
+//       store.commit('setToken', null);
+//       ElMessageBox.confirm('无权限','登录失败',{
+//           confirmButtonText: '重新登陆',
+//           cancelButtonText: '返回门户',
+//           type: 'error',
+//       }).then(()=>{
+//         jumpToLogin();
+//       }).catch(()=>{
+//         window.location.href = 'https://p.seec.seecoder.cn'
+//       })
+//     })
+//   }else{
+//     if(!store.getters.isLogin){
+//       jumpToLogin()
+//     }else{
+//       if(to.path === '/check' && !store.getters.hasPermission){
+//         next('/error')
+//       }else{
+//         next()
+//       }
+//     }
+//   }
+// })
 
 router.afterEach((to, from) => {
   // ...

+ 1 - 1
src/views/Bok/Main/Search/index.vue

@@ -310,7 +310,7 @@ export default {
                 })
                 resolve()
             }).then(() => {
-                // console.log(_this.filteredQuestions)
+                console.log(_this.filteredQuestions)
             })
         },