Administrator
2021-08-11 92d0cf73df170131eba84490d875bc954eb7a708
报名考试修改
3 files modified
49 ■■■■ changed files
src/api/examapi/applyexam.js 11 ●●●●● patch | view | raw | blame | history
src/views/applyexam/index.vue 3 ●●●● patch | view | raw | blame | history
src/views/securityApply/index.vue 35 ●●●● patch | view | raw | blame | history
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
        }
    })
}
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"
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) => {