<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>报名-特训营-爽客邦</title>
    <meta name="keywords" content="报名-特训营-爽客邦">
    <meta name="description" content="报名-特训营-爽客邦">
    <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta content="telephone=no" name="format-detection">
    <meta content="email=no" name="format-detection">
    <meta name="apple-mobile-web-app-title" content="报名-特训营-爽客邦">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <link rel="stylesheet" href="./static/css/main.css">
  </head>
  <body style="padding:0;">
    <div id="app" v-cloak>
      <van-nav-bar class="training_sign_title" title="我要报名" @click-left="backrank" v-if="toptitleisshow" left-arrow>
        <template #left> <img src="./static/images/left.png" alt=""></template>
      </van-nav-bar>
      <div class="training_camp cm">
        <div class="signcard bgcfff df">
          <div class="title c333 f18">{{campinfo.TeamName}}</div>
          <div class="slogan f12 c999">{{campinfo.WatchWord}}</div>
          <div class="teaminfo f12 c666 firstinfo">队长： {{campinfo.RealName}} {{campinfo.MakerCode}}</div>
          <div class="teaminfo f12 c666">人数： {{campinfo.MinUserNum}}~{{campinfo.MaxUserNum}}人</div>
          <div class="teaminfo f12 c666">地点： {{campinfo.Areas}}</div>
          <div class="teaminfo f12 c666">时间： {{campinfo.EnterStartDate}}~{{campinfo.EnterEndDate}}</div>
          <div class="tips tc f12">报名通过后将无法取消~</div>
          <div class="df agreen">
            <van-checkbox v-model="ischecked">我已阅读并同意</van-checkbox>
            <div class="rules f12" @click="rules">营训规则</div>
          </div>
          <van-button class="sign f14 cfff" :disabled="ischecked ? false : true" @click="sign">立即报名</van-button>
        </div>
      </div>
    </div>
    <script src="./static/js/klm-vv.min.js"></script>
    <script src="./static/js/klm-axios-config.js"></script>
    <script>
      // 在 #app 标签下渲染一个按钮组件
      let app = new Vue({
        el: '#app',
        data() {
          return {
            toptitleisshow:false,
            campinfo:{
            },
            ischecked:false
          };
        },
        created() {
          this.toptitleisshow = toptitleisshow;
          this.campinfo = JSON.parse(PublicLib.getCookieInfo('signupiteminfo'));
        },
        methods: {
          //- 返回我的职级
          backrank(){
            PublicLib.GoBack({Level:1});
          },
          //- 立即报名
          async sign(){
            if(!this.ischecked) {
              return this.$toast.fail('请同意营训规则');
            };
            const UserId = PublicLib.getCookieInfo('userId');
            const res = await postRequest('/api/v1/teamapply/signup',JSON.stringify({UserId,Id:this.campinfo.Id}));
            if(res.status !== '1') return tips('报名失败，请重试！');
            this.$toast.success('报名成功！');
            //- 1s之后返回主页
            setTimeout(()=>{
              this.backrank();
            },1000);
          },
          rules(){
            PublicLib.Goto({Url:'trainingCamp-rules'});
          },
        }
      });
    </script>
  </body>
</html>