From 92d0cf73df170131eba84490d875bc954eb7a708 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 11 Aug 2021 20:41:58 +0800
Subject: [PATCH] 报名考试修改

---
 src/views/applyexam/index.vue     |    3 ++-
 src/api/examapi/applyexam.js      |   11 +++++++++++
 src/views/securityApply/index.vue |   35 +++++++++++++++++++++++++++++------
 3 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/src/api/examapi/applyexam.js b/src/api/examapi/applyexam.js
index 3c7274f..20143fb 100644
--- a/src/api/examapi/applyexam.js
+++ b/src/api/examapi/applyexam.js
@@ -74,4 +74,15 @@
             id,
         }
     })
+}
+
+export const getSecurityApplyInfo = (id, userId) => {
+    return request({
+        url: '/api/apply/getSecurityApplyDetail',
+        method: 'get',
+        params: {
+            id,
+            userId
+        }
+    })
 }
\ No newline at end of file
diff --git a/src/views/applyexam/index.vue b/src/views/applyexam/index.vue
index f3f1f53..0a1789a 100644
--- a/src/views/applyexam/index.vue
+++ b/src/views/applyexam/index.vue
@@ -65,9 +65,10 @@
                 plain
                 icon="el-icon-folder-checked"
                 @click="handleBatchExam"
-                v-if="examPersission"
+                
                 >生成考试
               </el-button>
+              <!-- v-if="examPersission" -->
               <el-button
                 type="primary"
                 size="small"
diff --git a/src/views/securityApply/index.vue b/src/views/securityApply/index.vue
index cf80cae..5092399 100644
--- a/src/views/securityApply/index.vue
+++ b/src/views/securityApply/index.vue
@@ -8,9 +8,9 @@
                 <button class="security-btn" @click="applySubmit">报 名</button>
                 <button class="security-btn" @click="cancelApply">取 消 报 名</button>
             </div>
-            <!-- <div class = "apply-status">
+            <div class = "apply-status">
                  <span>{{status}}</span>
-            </div> -->
+            </div>
         </div>
     </div>
 </template>
@@ -19,13 +19,16 @@
 import { mapState } from 'vuex';
 import {
   addApply,
-  cancelApply
+  cancelApply,
+  getSecurityApplyInfo
 } from "@/api/examapi/applyexam";
 
 export default {
   data() {
     return {
-        status:"未报名"
+        status:null,
+        id:null,
+        form:{}
     };
   },
   computed: {
@@ -33,8 +36,25 @@
             userInfo: state => state.user.userInfo
         }),
   },
-  mounted() {},
+  mounted() {
+    //查询保安人员报名信息
+    this.getSecurityApplyInfo(null);
+  },
   methods:{
+    getSecurityApplyInfo(id){
+        getSecurityApplyInfo(id,this.userInfo.user_id).then((res) => {
+          this.form = res.data;
+          if(res.data.id!=-1){
+              this.id = res.data.id;
+          }
+          if(res.data.isApply==-1 || res.data.isApply==2){
+            this.status = "尚未报名";
+          }
+          if(res.data.isApply==1){
+            this.status = "已报名";
+          }
+        });
+    },
     applySubmit(){
       addApply({
         userId: this.userInfo.user_id
@@ -55,6 +75,7 @@
               type: "success",
               message: "报名成功",
             });
+            this.getSecurityApplyInfo(null);
           }
         },
         (error) => {
@@ -63,7 +84,8 @@
       );
     },
     cancelApply(){
-        cancelApply({
+      cancelApply({
+        id:this.id,
         userId: this.userInfo.user_id
       }).then(
         (res) => {
@@ -77,6 +99,7 @@
               type: "success",
               message: "取消报名成功",
             });
+            this.getSecurityApplyInfo(null);
           }
         },
         (error) => {

--
Gitblit v1.9.3