You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
3.7 KiB
118 lines
3.7 KiB
{% extends 'admin/base.html' %}
|
|
|
|
{% block content %}
|
|
<style>
|
|
.top{height:40px;margin:10px 10px 20px 10px;}
|
|
.top .active{color:#fff;background:#115012;}
|
|
.top span{cursor:pointer;color:#115012;display:inline-block;width:100px;line-height:40px;margin:5px 10px;border:1px solid #eee;text-align:center;border:1px solid #58c25a;}
|
|
.tb{width:100%;}
|
|
th,td{
|
|
width:15%;
|
|
text-align:center;
|
|
}
|
|
a{color:none;}
|
|
.url{width:10% !important}
|
|
</style>
|
|
<div class="top">
|
|
<span class="active"><a href="/admin/result_news">工大新闻</a></span>
|
|
<span><a href="/admin/result_yq">疫情数据</a></span>
|
|
<span><a href="/admin/result_rb">榜单数据</a></span>
|
|
<span><a href="/admin/result_mt">美图</a></span>
|
|
</div>
|
|
<div class="tb">
|
|
<table class="table table-hover table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th>序号</th>
|
|
<th>新闻来源</th>
|
|
<th>新闻时间</th>
|
|
<th>新闻标题</th>
|
|
<th>管理</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for item in data['news'] %}
|
|
<tr>
|
|
<td>{{item[0]}}</td>
|
|
<td>{{item[1]}}</td>
|
|
<td>{{item[2]}}</td>
|
|
<td><a href="{{item[4]}}"></a>{{item[3]}}</td>
|
|
|
|
<td>
|
|
<button onclick="toDel({{item[0]}})" class="btn btn-warning">删除</button>
|
|
<button onclick="toShow({{item[0]}})" class="btn btn-primary">显示</button>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
</table>
|
|
<ul class="pagination">
|
|
<!-- {% for page in range(0,data['totalPage']) %}-->
|
|
<!-- <li class="">-->
|
|
<!-- <a href="/admin/result?page={{page+1}}">{{page+1}}</a>-->
|
|
<!-- </li>-->
|
|
<!-- {% endfor %}-->
|
|
<li class="">
|
|
<a href="/admin/result?page={{data['currentPage']-1}}">前一页</a>
|
|
</li>
|
|
<li class="active"><span>当前页:{{data['currentPage']}},共有{{data['totalPage']}}页</span></li>
|
|
<li class="">
|
|
<a href="/admin/result?page={{data['currentPage']+1}}">后一页</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<script>
|
|
$('.top').on('click','span',function(){
|
|
$(this).addClass('active');
|
|
$(this).siblings().removeClass('active');
|
|
})
|
|
|
|
function toDel(id){
|
|
$.get('/admin/newsDelete?id='+id,function(res){
|
|
if(res.code==200){
|
|
swal({
|
|
title: '确定删除?',
|
|
text: '即将删除',
|
|
type: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonText: '删除!',
|
|
cancelButtonText: '取消',
|
|
}).then(function(isConfirm) {
|
|
if (isConfirm === true) {
|
|
location.href="/admin/result_news";
|
|
|
|
} else if (isConfirm === false) {
|
|
|
|
}
|
|
});
|
|
|
|
}
|
|
})
|
|
}
|
|
|
|
function toShow(id){
|
|
$.get('/admin/newsShow?id='+id,function(res){
|
|
if(res.code==200){
|
|
swal({
|
|
title: '确定显示?',
|
|
text: '即将显示到前端!',
|
|
type: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonText: '显示!',
|
|
cancelButtonText: '取消',
|
|
}).then(function(isConfirm) {
|
|
if (isConfirm === true) {
|
|
location.href="/admin/result_news";
|
|
|
|
} else if (isConfirm === false) {
|
|
|
|
}
|
|
});
|
|
|
|
}
|
|
})
|
|
}
|
|
</script>
|
|
{% endblock %}
|