www_fpvone_cn/application/index/view/players/joinclub.html

191 lines
7.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">查找队伍 | Club Search</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>Club Name</p>
</td>
<td>
<p>地区</p>
<p>Address</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;
let user_data='';
// 更新列表
function getlist(res){
$('.sociatybox table tbody').empty()
let itemhtml='';
let ophtml='';
res.forEach((item)=>{
if(item.send_status){
ophtml=`<td class="lastbtn">
<button class="fastimClick" id="${item.user_id}">和TA聊聊</button></td>
</td>`
}else{
ophtml=`<td class="lastbtn">
<button class="fastimClick" id="${item.user_id}">和TA聊聊</button></td>`
}
itemhtml+=`
<tr>
<td>${item.name}</td>
<td>${item.province}</td>
${ophtml}
</tr>
`
})
$('.sociatybox table tbody').append(itemhtml);
$('.fastimClick').click(function(){
const user_id=$(this).attr('id')
let data={}
$.post('/api/Fastimadd/find_imuserid',{
user_id
},function(res){
if(res.code){
data.uid1=res.data
}
})
$.post('/api/Fastimadd/find_imuserid',{
user_id:user_data
},function(res){
if(res.code){
data.uid2=res.data
}
})
if(!localStorage.getItem('userinfo')){
$.post('/api/Fastimadd/get_imtoken',{
user_id:user_data
},function(res){
const resultdata={
"type":"object",
"data":JSON.parse(res).data.userinfo
}
localStorage.setItem('userinfo',JSON.stringify(resultdata));
})
}
const layload = layer.load(2, {shade: false});
setTimeout(function(){
layer.close(layload);
if(Object.keys(data).length){
$.post('/api/Fastimadd/openim',data,function(res){
if(res.code){
window.open("/yixun/#/pages/session-info/session-info?id="+res.data.id,'_blank');
}
})
}else{
layer.msg('连接失败,请重试!')
}
}, 300);
})
}
let page=1;
$.post('{:url("/index/players/all_club")}',{
page
},function(res){
console.log('res',res)
user_data=res.user_data;
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/players/all_club")}',{
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/players/search_club")}',{
keyword: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/players/search_club")}',{
keyword: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>