www_fpvone_cn/application/index/view/players - 副本/joinclub.html

132 lines
5.0 KiB
HTML
Raw Permalink 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}">
<style>
.fly-right{
background: #F0F0F0;
}
</style>
<div class="fly-right">
<div class="fr-wrap">
<div class="searchbox">
<p class="my-event">加入俱乐部 | Join The Club</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="clublist">
<div class="head">
<div>
<p>俱乐部名称</p>
<p>Club Name</p>
</div>
<div>
<p>所属地区</p>
<p>Address</p>
</div>
<div>
<p>操作</p>
<p>Operation</p>
</div>
</div>
<div class="list"></div>
<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){
$('.clublist .list').empty()
let itemhtml=''
res.forEach((item)=>{
itemhtml+=`
<div class="item">
<p>${item.name}</p>
<p>${item.province}${item.city}${item.district}</p>
<button class="joinbtn" id="${item.id}">加入俱乐部<span>丨Join The Club</span></button>
</div>
`
})
$('.clublist .list').append(itemhtml)
// 加入俱乐部
$('.joinbtn').click(function(){
const joinbtn=$(this);
$.post('{:url("index/club/supply_join")}',{
club_id:joinbtn.attr('id')
},function(res){
if(res.code){
layer.msg('提交成功',{icon:1});
setTimeout(function () {
location.href = '/index/players/myclub.html';
}, 2000);
}else{
layer.msg(res.msg,{icon:2})
}
})
})
}
// 获取随机五条俱乐部
$.get('{:url("index/club/club_rand")}',function(res){
if(res.length>0){
getlist(res)
}
})
// 搜索俱乐部
let page=1;
$('.searchbox .search button').click(function(){
let val=$('.searchbox .search input').val();
if(val.replace(/(^\s*)|(\s*$)/g, "") != ""){
$.post('{:url("index/club/search")}',{
name:val,
page
},function(res){
if(res.total>0){
getlist(res.$data)
// 分页
laypage.render({
elem: 'page',
limit: 5,
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")}',{
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>