www_fpvone_cn/application/index/view/club/sociaty.html

329 lines
14 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>
.lastbtn button:last-child{
background: #fff;
border-radius: 5px 5px 5px 5px;
border: 1px solid #666666;
color: #666;
margin: 0 10px;
}
.layui-layer-btn .layui-layer-btn0{
background: #000;
}
@media screen and (max-width: 768px){
.sociatybox tr td:nth-child(3){
display: none;
}
.sociatybox thead td:last-child{
text-align: center;
}
.lastbtn{
width: 50%;
}
.lastbtn button:last-child{
margin: 0 5px;
}
}
</style>
<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>To Live</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;
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="cinvite nicons" id="${item.id}" invate_id="${item.invate_id}">撤回邀请</button><button class="fastimClick" id="${item.member_id}">和TA聊聊</button></td>`
}else{
ophtml=`<td class="lastbtn"><button class="sinvite nicons" id="${item.id}">发送邀请</button><button class="fastimClick" id="${item.member_id}">和TA聊聊</button></td>`
}
itemhtml+=`
<tr>
<td>${item.real_name}</td>
<td>${item.province==null?'无':item.province}</td>
<td>${item.birthday}</td>
${ophtml}
</tr>
`
})
$('.sociatybox table tbody').append(itemhtml);
$('.fastimClick').click(function(){
const user_id=$(this).attr('id')
console.log(user_id)
let data={}
$.ajax({
url:'/api/Fastimadd/find_imuserid',
data:{user_id},
success:function(res){
if(res.code){
data.uid1=res.data
}
},
error:function(err){
console.log('err',err)
}
})
$.ajax({
url:'/api/Fastimadd/find_imuserid',
data:{user_id:user_data},
success: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('连接失败,请重试!')
}
})
}else{
layer.msg('连接失败,请重试!')
}
}, 300);
})
$('.sociatybox table tbody td:not(".lastbtn")').click(function(){
const item=res[$(this).parent().index()];
layer.open({
title:false,
type:1,
content:`
<div class="playerinfo">
<div class="boxs">
<p class="my-event">飞手信息 | Pilot Information</p>
<div class="list">
<div class="item">
<div class="pcitem">
<div>
<p>姓名</p>
<p>Name</p>
</div>
<div>${item.real_name}</div>
</div>
<div class="pcitem">
<div>
<p>性别</p>
<p>Gender</p>
</div>
<div>${item.gender}</div>
</div>
</div>
<div class="item">
<div class="pcitem">
<div>
<p>年龄</p>
<p>Birth</p>
</div>
<div>${item.age}</div>
</div>
<div class="pcitem">
<div>
<p>国籍</p>
<p>Nationality</p>
</div>
<div>${item.country==null?'中国':item.country}</div>
</div>
</div>
<div class="item">
<div class="pcitem">
<div>
<p>居住地</p>
<p>To Live</p>
</div>
<div>${item.province==null?'无':item.province}</div>
</div>
<div class="pcitem">
</div>
</div>
<div class="item">
<div class="pcitem">
<div>
<p>参赛获奖经历</p>
<p>Entries And Awards</p>
</div>
<div>${item.experience}</div>
</div>
</div>
</div>
</div>
</div>
`,
shadeClose: true,
closeBtn:0,
area:['60%','80%']
})
})
$('.lastbtn .nicons').click(function(){
const flags=$(this)
layer.confirm('您确定要邀请该飞手吗?',{
title:'',
closeBtn:0
},function(){
if(flags.hasClass('sinvite')){
$.get('/index/club/invate_player',{
id:flags.attr('id')
},function(res){
layer.msg('发送成功',{icon:1});
flags.html('撤回邀请');
flags.attr({'class':'cinvite','invate_id':res.data});
})
}else{
$.get('/index/club/invate_player_cancel',{
id:flags.attr('id'),
invate_id:flags.attr('invate_id')
},function(res){
layer.msg('撤销成功',{icon:1});
flags.html('发送邀请');
flags.attr({'class':'sinvite','invate_id':''});
// setTimeout(function () {
// location.reload();
// }, 2000);
})
}
layer.closeAll()
})
})
}
let page=1;
$.post('{:url("/index/club/club_sociaty")}',{
page
},function(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/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>