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.

121 lines
3.9 KiB

6 months ago
{% extends 'admin/base.html' %}
{% block content %}
<table class="table table-bordered" style="margin-top:40px;text-align:center;">
<thead>
<tr>
<th class="text-center">业务种类</th>
<th class="text-center">数据来源</th>
<th class="text-center">管理状态</th>
</tr>
</thead>
<tbody>
<tr class="active">
<td>新闻类</td>
<td>
<select name="newsSource" id="newsSource">
<option value="0">工大新闻</option>
<option value="1">北大新闻</option>
<option value="2">腾讯新闻</option>
</select>
</td>
<td>
<button class="btn btn-info" onclick="startNews()" id="newbtn">启动</button>
<button class="btn btn-danger">定时</button>
</td>
</tr>
<tr class="warning">
<td>疫情类</td>
<td>
<select name="yqSource" id="yqSource">
<option value="0">腾讯疫情</option>
<option value="1">新浪疫情</option>
<option value="2">丁香园疫情</option>
</select>
</td>
<td>
<button class="btn btn-info" onclick="startYq()" id="yqbtn">启动</button>
<button class="btn btn-danger">定时</button>
</td>
</tr>
<tr class="danger">
<td>热榜类</td>
<td>
<select name="rbSource" id="rbSource">
<option value="0">知乎热榜</option>
<option value="1">头条热榜</option>
<option value="2">电商热榜</option>
</select>
</td>
<td>
<button class="btn btn-info" onclick="startRb()" id="rbbtn">启动</button>
<button class="btn btn-danger">定时</button>
</td>
</tr>
<tr class="success">
<td>美图类</td>
<td>
<select name="mtSource" id="mtSource">
<option value="0">美图秀秀</option>
<option value="1">宠物类图</option>
<option value="2">新闻类图</option>
</select>
</td>
<td>
<button class="btn btn-info" onclick="startMt()" id="mtbtn">启动</button>
<button class="btn btn-danger">定时</button>
</td>
</tr>
</tbody>
</table>
<script>
function startNews(){
swal({
title: '开始爬取了',
text: '正在努力爬取中。。。!',
type: 'info',
confirmButtonText: '确定',
}).then(function(){
var sourceID=$('#newsSource').val();
$('newbtn').attr("disabled",true);
$.get('/admin/newsCollect?source='+sourceID,function(res){
if(res.code==200){
swal({
title: '恭喜',
text: '爬取完毕!',
type: 'success',
confirmButtonText: '确定',
}).then(function() {
$('newbtn').attr("disabled",false);
location.href="/admin/result_news";
})
}
})
})
}
function startYq(){
swal({
title: '开始爬取了',
text: '新浪疫情。。。!',
type: 'info',
confirmButtonText: '确定',
}).then(function(){
var sourceID=$('#yqSource').val();
$('yqbtn').attr("disabled",true);
$.get('/admin/yqCollect?source='+sourceID,function(res){
if(res.code==200){
swal({
title: '恭喜',
text: '爬取完毕!',
type: 'success',
confirmButtonText: '确定',
}).then(function() {
$('yqbtn').attr("disabled",false);
location.href="/admin/result_yq";
})
}
})
})
}
</script>
{% endblock %}