Administrator
2021-08-11 92d0cf73df170131eba84490d875bc954eb7a708
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) => {