www_fpvone_cn/application/index/view/match/user_match.html

315 lines
14 KiB
HTML
Raw Normal View History

2024-12-20 12:29:51 +08:00
<link rel="stylesheet" type="text/css" href="__CDN__/assets/css/door/css/flyer.css">
<link rel="stylesheet" type="text/css" href="__CDN__/assets/css/door/css/myMarch.css?v={$site.version}">
<div class="fly-right">
<div class="fr-wrap">
<p class="my-event">我的赛事 | My Events</p>
<div class="myMarch-name">
<p>
<span>赛事报名</span>
<span>Apply</span>
</p>
<a href="tel:13136225305">加急审核请致电 / Please call for urgent review0086+13136225305</a>
</div>
<div class="marchList">
{empty name="matchlist"}
<div class="onebox">
<div class="onematch">您还未参与任何赛事 / You have not entered any races</div>
<!--<div class="start">-->
<!-- <a href="/">去参加赛事 Participate In Events</a>-->
<!--</div>-->
</div>
{else /}
<ul>
<div>
<p>赛事</p>
<p>申请时间</p>
<p>参与资格</p>
<p>操作</p>
</div>
{foreach $matchlist as $key=>$vo }
<li href="{:url('match/my_match_show', array('id' => $vo.id))}">
<p class="myname">{$vo.match.title ?? '已过期赛事'}</p>
<p>{$vo.created_at ?? '未知时间'}</p>
<p
class="{if $vo.status == 1} auditing {elseif $vo.status == 2} audited {else /} noaudit {/if}">
{if $vo.status == 1} 审核中 | In Review {elseif $vo.status == 2} 审核通过 | Pass {else /} 审核不通过
| Fail {/if}
</p>
<p class="btnbox"><button class="coursebtn"
onclick="getcourse('{$vo.player_id}','{$vo.match_id}')">生成成绩证书</button>
</p>
</li>
{/foreach}
</ul>
{/empty}
</div>
</div>
</div>
<div class="bounced">
<p class="bounced-img">
<img id="bounced-img" src="__CDN__/assets/css/door/img/door/match.png">
</p>
<div class="bounced-name">
<p id="bounced_title_zh"></p>
<p id="bounced_title_en"></p>
</div>
<ul>
<li>
<p>申请时间</p>
<p id="bounced_create_at"></p>
</li>
<li style="display:none">
<p>支付费用</p>
<p id="bounced_cost"></p>
</li>
<li>
<p>参与资格</p>
<!-- 三种状态 -->
<p id="bounced_check_status"></p>
</li>
<li>
<p>审核说明</p>
<p id="bounced_check_content"></p>
</li>
</ul>
</div>
<div class="coursepop"></div>
<script src="__CDN__/assets/css/door/js/jquery.form.min.js"></script>
<script src="__CDN__/assets/css/door/layui/layui.js"></script>
<script src="/assets/addons/cms/js/html2canvas.min.js"></script>
<script>
layui.use(['layer'], function () {
var check_status = JSON.parse('{"1":"\u5ba1\u6838\u4e2d","2":"\u5ba1\u6838\u901a\u8fc7","-1":"\u5ba1\u6838\u4e0d\u901a\u8fc7"}');
var check_status_en = JSON.parse('{"1":"In Review","2":"Pass","-1":"Fail"}');
$('.marchList>ul li p:not(.btnbox)').click(function () {
$.post(
$(this).parent('li').attr("href"),
{ _token: '{{ csrf_token() }}' },
function (data) {
if (data) {
layer.open({
title: false,
btn: '关闭<br>Close',
yes: function (index, layero) {
layer.close(index);
},
type: 1,
skin: 'bounbox', //样式类名
closeBtn: 0, //不显示关闭按钮
anim: 2,
shadeClose: false, //开启遮罩关闭
content: $('.bounced'),
scrollbar: false
});
var match = data.match;
if (match.logo) {
$("#bounced-img").attr("src", match.logo);
}
$("#bounced_title_zh").html(match.title);
if (match.name_en) {
$("#bounced_title_en").html(match.name_en);
}
$("#bounced_create_at").html(data.created_at);
$("#bounced_check_status").removeAttr("class");
$("#bounced_check_status").html(check_status[data.status] + " | " + check_status_en[data.status]);
if (data.status == 1) {
$("#bounced_check_status").addClass("auditing")
} else if (data.status == 2) {
$("#bounced_check_status").addClass("audited")
} else {
$("#bounced_check_status").addClass("noaudit")
}
$("#bounced_check_content").html(data.mark);
$("#bounced_cost").html("0.00 元");
}
});
});
});
// 生成成绩证书
async function getcourse(player_id, match_id) {
const match_type=await $.get('/index/league/judge_league?match_id='+match_id)
let url=''
if(match_type=='league'){
url='/index/league/get_cert'
}else if(match_type=='saishi'){
url='/index/ranking/getCertificate'
}
$.ajax({
url,
type: 'post',
data: { match_id, player_id },
dataType: 'json',
success: (res) => {
if(res.code){
coursedata(res.data,match_type)
}else{
layer.msg('未查询到成绩!');
}
},
error: (err) => {
layer.msg('未查询到成绩!');
}
})
}
function coursedata(data,match_type) {
let vhtml=''
switch(match_type){
case 'saishi':
let coursearr = [];
let html = '';
if (data.thirty_two) {
coursearr.push(['排位赛', data.thirty_two.times, data.thirty_two.fly_num])
}
if (data.sixteen) {
coursearr.push(['32进16', data.sixteen.times, data.sixteen.fly_num])
}
if (data.eight) {
coursearr.push(['16进8', data.eight.times, data.eight.fly_num])
}
if (data.four) {
coursearr.push(['8进4', data.four.times, data.four.fly_num])
}
coursearr.forEach(item => {
html += `
<div class="item">
<p>${item[0]}</p>
<p>${item[1]} ${item[2] == 'DNF' ? "" : "(" + item[2] + "圈)"}</p>
</div>
`
})
if (data.finals) {
html += `
<div class="item">
<p>决赛</p>
<p>总积分 (${data.finals.sum_integral}分)</p>
</div>
`
}
vhtml=`
<img src="${data.endtime.course_poster}" width="350" height="600" style="position:absolute;z-index:-1;" />
<div class="mingci">
<p>荣获本次赛事第<span class="num">${data.bast.sort}</span></p>
</div>
<div class="infobox">
<div class="text">
<img src="${data.player_info.player_pic}" height="70" />
<p>
<span>姓名:</span>
<span>${data.player_info.name}</span>
</p>
<p>
<span>编号:</span>
<span>${data.player_info.player_id}</span>
</p>
<p>
<span>性别:</span>
<span>${data.player_info.gender}</span>
</p>
<p>
<span>年龄:</span>
<span>${data.player_info.age}</span>
</p>
</div>
<div class="course">
<div class="title">
<p>所属赛程</p>
<p>最优成绩</p>
</div>
<div>
${html}
</div>
</div>
</div>
<div id="qrcode" style="display:inline-block;position:relative;left:44px;">
<img width="60" src="https://www.fpvone.cn/qrcode/build?text=https://www.fpvone.cn/p/zhengshurenzheng?number=${data.certificate_number.certificate_number?data.certificate_number.certificate_number:data.certificate_number}" />
</div>
`
case 'league':
vhtml=`
<img src="${data.endtime.course_poster}" width="350" height="600" style="position:absolute;z-index:-1;" />
<div class="contbox">
<div class="info">
<div class="pic" style="margin-right:10px;"><img src="${data.player.player_pic}" height="70"></div>
<div class="text">
<p>
<span>姓名:</span>
<span>${data.player.real_name}</span>
</p>
<p>
<span>编号:</span>
<span>${data.player.member_number}</span>
</p>
<p>
<span>性别:</span>
<span>${data.player.gender}</span>
</p>
</div>
</div>
<div class="pm">
<p>
<span>所属队伍:</span>
<span>${data.club.name_short}</span>
</p>
<p>
<span>参赛名次:</span>
<span>第${data.player.number}名</span>
</p>
<p>
<span>本站积分:</span>
<span>${data.player.grade}</span>
</p>
</div>
</div>
<div id="qrcode" class="code" style="display:inline-block;position:relative;left:44px;">
<img width="60" src="https://www.fpvone.cn/qrcode/build?text=https://www.fpvone.cn/p/zhengshurenzheng?number=${data.certificate_number.certificate_number}" />
</div>
`
}
let nowtimestamp = parseInt(new Date().getTime() / 1000);
let ezuhe = data.endtime.etime + ' ' + data.endtime.match_end_time;
let etimestamp = parseInt(new Date(ezuhe.replace(/-/g, "/")).getTime() / 1000);
if (data.endtime.is_open_course == 1) {
layui.layer.msg(`成绩证书已关闭!`);
} else {
if (nowtimestamp > etimestamp) {
let loadicon = layui.layer.load(0, { shade: [0.15, '#ccc'] });
$('.coursepop').html(vhtml)
let node = $(".coursepop")[0];
setTimeout(() => {
layer.close(loadicon);
html2canvas(node, {
useCORS: true,
allowTaint: true,
taintTest: false,
width: node.scrollWidth,
height: node.scrollHeight,
scale: window.devicePixelRatio
}).then((canvas) => {
let hcurl = canvas.toDataURL('image/png')
layui.layer.open({
type: 1,
title: false, // 不显示标题栏
closeBtn: 0,
area: ['350px', '600px'],
shadeClose: true, // 点击遮罩关闭层
content: `
<img width="100%" src="${hcurl}" />
`
});
})
.catch((err) => {
console.log('err', err)
})
}, 500);
} else {
layui.layer.msg(`${ezuhe}后可生成成绩证书!`);
}
}
}
</script>