Starink 6 лет назад
Родитель
Сommit
104a93a394

+ 16 - 0
assets/css/person.scss

@@ -88,4 +88,20 @@
     }
   }
 
+  &__table{
+    margin: 20px;
+    width: calc(100% - 40px);
+
+    *::-webkit-scrollbar {
+      width: 6px; // 横向滚动条
+      height: 6px; // 纵向滚动条 必写
+    }
+    // 滚动条的滑块
+    *::-webkit-scrollbar-thumb {
+      background-color: #ddd;
+      border-radius: 3px;
+  }
+
+}
+
 }

+ 43 - 3
pages/admin/checkApplications.vue

@@ -6,7 +6,8 @@
     <el-table
       :data="applications"
       stripe
-      height="400"
+      height="500"
+      class="main-card__table"
     >
       <el-table-column
         fixed
@@ -16,6 +17,7 @@
       <el-table-column
         prop="realName"
         label="姓名"
+        fixed
         width="120">
       </el-table-column>
       <el-table-column
@@ -84,10 +86,48 @@
         });
       },
       pass(row){
-
+        this.$api.$post('/admin/passApplication', {id: row.id}).then((res) =>
+          {
+            if(res.code === 0){
+              this.$message({
+                showClose: true,
+                message: "已通过" + row.realName + "的认证",
+                type: 'success'
+              });
+              this.applications.splice(this.applications.indexOf(row), 1);
+            }else{
+              this.$message({
+                showClose: true,
+                message: res.message,
+                type: 'error'
+              });
+            }
+          }
+        ).catch((e)=>{
+          console.log(e);
+        });
       },
       reject(row){
-
+        this.$api.$post('/admin/rejectApplication', {id: row.id}).then((res) =>
+          {
+            if(res.code === 0){
+              this.$message({
+                showClose: true,
+                message: "已否决" + row.realName + "的认证",
+                type: 'success'
+              });
+              this.applications.splice(this.applications.indexOf(row), 1);
+            }else{
+              this.$message({
+                showClose: true,
+                message: res.message,
+                type: 'error'
+              });
+            }
+          }
+        ).catch((e)=>{
+          console.log(e);
+        });
       }
     }
   };

+ 1 - 1
pages/person/identification.vue

@@ -65,7 +65,7 @@
         organization: '',
         pageLoading: true,
         jobNumber: '',
-        loading: true,
+        loading: false,
         disabled: state === 'identifying' || state === 'identified'
       }
     },

+ 30 - 0
server/controller/admin.js

@@ -19,6 +19,36 @@ class AdminController {
     }
 
   }
+
+  static async passApplication(ctx){
+    let theUser = await getTokenUser(ctx);
+    if(theUser.role !== "ADMIN"){
+      ctx.status = 401;
+    }else{
+      let result = await teacherModel.updateState(ctx.request.body.id, 'identified');
+      if(result){
+        ctx.body = Response.success(result);
+      }else{
+        ctx.body = Response.failed("否决失败,请重试");
+      }
+    }
+
+  }
+
+  static async rejectApplication(ctx){
+    let theUser = await getTokenUser(ctx);
+    if(theUser.role !== "ADMIN"){
+      ctx.status = 401;
+    }else{
+      let result = await teacherModel.updateState(ctx.request.body.id, 'rejected');
+      if(result){
+        ctx.body = Response.success(result);
+      }else{
+        ctx.body = Response.failed("通过失败,请重试");
+      }
+    }
+
+  }
 }
 
 

+ 2 - 0
server/routes/index.js

@@ -21,6 +21,8 @@ module.exports = () => {
   router.post('/teacher/reapply', TeacherController.reapply);
 
   router.get('/admin/getApplications', AdminController.getApplications);
+  router.post('/admin/passApplication', AdminController.passApplication);
+  router.post('/admin/rejectApplication', AdminController.rejectApplication);
 
     router.get('/course/getMyCourses',  CourseController.getMyCourses);
     router.get('/course/getHotCourses',  CourseController.getHotCourses);