76 lines
2.2 KiB
PHTML
76 lines
2.2 KiB
PHTML
<ul class="list-unstyled">
|
|
<?php
|
|
if(isset($this->authors))
|
|
{
|
|
foreach($this->authors as $v)
|
|
{
|
|
?>
|
|
<li id="author_<?php echo $v['id'] ;?>">
|
|
<p><?php echo $v['realname']; ?> [ <?php echo $v['username']; ?> ]</p>
|
|
<p><span id="status_<?php echo $v['id'] ;?>"><?php if($v['status']==1) {echo "已认证";} if($v['status']==0) {echo "已申请";} if($v['status']==-1) {echo "已拒绝";} ?></span> |
|
|
<a href="javascript:;" onclick="remove(<?php echo $v['id'] ;?>)">移除该作者</a>
|
|
<span id="statusChange_<?php echo $v['id'] ;?>"><?php if($v['status']<1) {?> <a href="javascript:;" onclick="update(<?php echo $v['id'] ;?>)">认证该用户</a> <?php }?></span>
|
|
</p>
|
|
</li>
|
|
<?php } } ?>
|
|
</ul>
|
|
<!-- //页面内容 -->
|
|
<script type="text/javascript">
|
|
function update(id){
|
|
$.ajax({
|
|
'type':"POST",
|
|
'url':'/admin/data/author/',
|
|
'data':'ac=update&id='+id,
|
|
'success':function(data){
|
|
if (data!=null)
|
|
{
|
|
if(typeof(data.error)!='undefined')
|
|
{alert(data.error);return false;}
|
|
if(data.msg!=null)
|
|
{alert(data.msg);}
|
|
if(typeof(data.updated)!='undefined')
|
|
{$('#status_'+data.updated).html('已认证');$('#statusChange_'+data.updated).html('');}
|
|
}else{
|
|
alert('处理中出现错误');
|
|
}
|
|
},
|
|
'timeout': 30000
|
|
});
|
|
}
|
|
function remove(id){
|
|
if(confirm('确实要删除吗?')==false)
|
|
{return false;}
|
|
$.ajax({
|
|
type:"POST",
|
|
url:'/admin/data/author',
|
|
data:'ac=del&id='+id,
|
|
success:function(data){
|
|
if (data!=null)
|
|
{
|
|
if(typeof(data.error)!='undefined')
|
|
{alert(data.error);return false;}
|
|
if(typeof(data.deleted)!='undefined')
|
|
{$('#author_'+data.deleted).fadeOut("slow",function(){$(this).remove();});}
|
|
}else{
|
|
alert('处理中出现错误');
|
|
}
|
|
},
|
|
'timeout': 30000
|
|
});
|
|
}
|
|
|
|
$('#loading').css("opacity","0.2");
|
|
$('#loading').ajaxComplete(function() {
|
|
$(this).css('display','none');
|
|
});
|
|
$('#loading').ajaxSend(function() {
|
|
$(this).css('display','block');
|
|
});
|
|
$("#loading").ajaxError(function() {
|
|
$(this).css('display','none');
|
|
alert('请求超时或服务器开小差了,请刷新页面后重试');
|
|
});
|
|
|
|
</script>
|
|
|