www_fpvone_cn/application/index/view/club/sociaty - 副本.html

167 lines
6.4 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/public.css">
<link rel="stylesheet" type="text/css" href="__CDN__/assets/css/door/layui-v2.9.3/layui/css/layui.css">
<link rel="stylesheet" type="text/css" href="__CDN__/assets/css/door/css/newClub.css?v={$site.version}">
<div class="fly-right">
<div class="fr-wrap">
<div class="searchbox">
<p class="my-event">飞手公会 | Pilot Association</p>
<div class="search">
<input type="text" placeholder="请输入飞手名字" />
<button>
<img src="/assets/addons/cms/img/clubsearch.png" alt="" width="20" />
</button>
</div>
</div>
<div class="sociatybox">
<table border="0">
<thead>
<td>
<p>飞手姓名</p>
<p>Pilot Name</p>
</td>
<td>
<p>性别</p>
<p>Gender</p>
</td>
<td>
<p>出生日期</p>
<p>Birth</p>
</td>
<td>
<p>操作</p>
<p>Operation</p>
</td>
</thead>
<tbody>
</tbody>
</table>
<div id="page"></div>
</div>
</div>
</div>
<script src="__CDN__/assets/css/door/js/jquery.form.min.js"></script>
<script src="__CDN__/assets/css/door/layui/layui.js"></script>
<script>
layui.use(['layer','laypage'],function(){
const laypage=layui.laypage;
const layer=layui.layer;
// 更新列表
function getlist(res){
$('.sociatybox table tbody').empty()
let itemhtml='';
let ophtml='';
res.forEach((item)=>{
if(item.send_status){
ophtml=`<td><button class="cinvite" id="${item.id}" invate_id="${item.invate_id}">撤回邀请</button></td>`
}else{
ophtml=`<td><button class="sinvite" id="${item.id}">发送邀请</button></td>`
}
itemhtml+=`
<tr>
<td>${item.real_name}</td>
<td>${item.gender}</td>
<td>${item.birthday}</td>
${ophtml}
</tr>
`
})
$('.sociatybox table tbody').append(itemhtml);
$('.sinvite').click(function(){
$.get('/index/club/invate_player',{
id:$(this).attr('id')
},function(res){
layer.msg('发送成功',{icon:1});
setTimeout(function () {
location.reload();
}, 2000);
})
})
$('.cinvite').click(function(){
$.get('/index/club/invate_player_cancel',{
id:$(this).attr('id'),
invate_id:$(this).attr('invate_id')
},function(res){
layer.msg('撤销成功',{icon:1});
setTimeout(function () {
location.reload();
}, 2000);
})
})
}
let page=1;
$.post('{:url("/index/club/club_sociaty")}',{
page
},function(res){
if(res.total>0){
getlist(res.data)
// 分页
laypage.render({
elem: 'page',
limit: 10,
count: res.total,
layout: ['count', 'prev', 'page', 'next'],
prev: '<em><</em>',
next: '<em>></em>',
theme: '#C2C2C2',
curr: page,
jump: function(obj){
$.post('{:url("/index/club/club_sociaty")}',{
page:obj.curr
},function(data){
getlist(data.data)
})
}
})
}else{
$('.sociatybox').html('暂无飞手')
}
})
$('.searchbox .search button').click(function(){
let val=$('.searchbox .search input').val();
if(val.replace(/(^\s*)|(\s*$)/g, "") != ""){
$.post('{:url("index/club/search_player")}',{
name:val,
page
},function(res){
if(res.total>0){
getlist(res.data)
// 分页
laypage.render({
elem: 'page',
limit: 10,
count: res.total,
layout: ['count', 'prev', 'page', 'next'],
prev: '<em><</em>',
next: '<em>></em>',
theme: '#C2C2C2',
curr: page,
jump: function(obj){
$.post('{:url("index/club/search_player")}',{
name:val,
page:obj.curr
},function(data){
getlist(data.data)
})
}
})
}else{
layer.msg('未查询到飞手',{icon: 0})
}
})
}else{
layer.msg('请输入飞手名字',{icon: 0});
}
})
// 回车搜索
$('.searchbox .search input').bind('keypress', function (event) {
if (event.keyCode == "13") {
$('.searchbox .search button').click();
}
})
})
</script>