feat(crawl): 账号退出

This commit is contained in:
xiongxiaoyang 2023-10-15 19:13:07 +08:00
parent a55f456b3d
commit 0332802fe5
9 changed files with 78 additions and 86 deletions

View File

@ -55,6 +55,9 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
.antMatchers("/css/**").permitAll()
.antMatchers("/**").hasRole("ADMIN")
.and().formLogin().loginPage("/login.html").loginProcessingUrl("/login").permitAll()
.and().logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/")
.and().httpBasic();
}

View File

@ -12,15 +12,7 @@
</head>
<body class="">
<div class="header">
<div class="mainNav" id="mainNav">
<div class="box_center cf"
style="text-align: center;height: 44px;line-height: 48px;color: #fff;font-size: 16px;">
小说精品屋爬虫管理
</div>
</div>
<div th:replace="crawl/header :: header">
</div>
<div class="main box_center cf">
@ -30,7 +22,7 @@
<ul class="log_list">
<li><a class="link_1" href="/">爬虫源管理</a></li>
<li><a class="link_1 on" href="/crawl/crawlSingleTask_list.html">单本采集管理</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank" >规则测试</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank">规则测试</a></li>
<!--<li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
</ul>
@ -47,7 +39,7 @@
<h3>采集信息填写示例均为笔趣阁http://www.mcmssc.com</h3>
<ul class="log_list">
<li><span id="LabErr"></span></li>
<input type="hidden" id="sourceName" class="s_input icon_name" >
<input type="hidden" id="sourceName" class="s_input icon_name">
<b>采集源:</b>
<li><select id="sourceId" class="s_input icon_key">
</select></li>
@ -99,16 +91,16 @@
$.ajax({
type: "get",
url: "/crawl/listCrawlByPage",
data: {'curr':1,'limit':100},
data: {'curr': 1, 'limit': 100},
dataType: "json",
success: function (data) {
if (data.code == 200) {
var crawlSourceList = data.data.list;
if (crawlSourceList.length > 0) {
var crawlSourceListHtml = "";
for(var i=0;i<crawlSourceList.length;i++){
for (var i = 0; i < crawlSourceList.length; i++) {
var crawlSource = crawlSourceList[i];
crawlSourceListHtml+=("<option value=\""+crawlSource.id+"\">"+crawlSource.sourceName+"</option>");
crawlSourceListHtml += ("<option value=\"" + crawlSource.id + "\">" + crawlSource.sourceName + "</option>");
}
$("#sourceId").html(crawlSourceListHtml);
@ -120,7 +112,7 @@
//未登录
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
}else {
} else {
layer.alert(data.msg);
}
@ -143,21 +135,21 @@
var sourceBookId = $("#sourceBookId").val();
if (!sourceBookId){
if (!sourceBookId) {
layer.alert("采集的源站小说ID不能为空");
return;
}
var bookName = $("#bookName").val();
if (!bookName){
if (!bookName) {
layer.alert("采集的小说名不能为空");
return;
}
var authorName = $("#authorName").val();
if (!authorName){
if (!authorName) {
layer.alert("采集的小说作者名不能为空");
return;
}
@ -165,7 +157,14 @@
$.ajax({
type: "POST",
url: "/crawl/addCrawlSingleTask",
data: {'sourceId': sourceId, 'sourceName': sourceName,'catId':catId,'sourceBookId' : sourceBookId,'bookName':bookName,'authorName':authorName},
data: {
'sourceId': sourceId,
'sourceName': sourceName,
'catId': catId,
'sourceBookId': sourceBookId,
'bookName': bookName,
'authorName': authorName
},
dataType: "json",
success: function (data) {
if (data.code == 200) {

View File

@ -12,15 +12,7 @@
</head>
<body class="">
<div class="header">
<div class="mainNav" id="mainNav">
<div class="box_center cf"
style="text-align: center;height: 44px;line-height: 48px;color: #fff;font-size: 16px;">
小说精品屋爬虫管理
</div>
</div>
<div th:replace="crawl/header :: header">
</div>
<div class="main box_center cf">
@ -30,7 +22,7 @@
<ul class="log_list">
<li><a class="link_1" href="/">爬虫源管理</a></li>
<li><a class="link_1 on" href="/crawl/crawlSingleTask_list.html">单本采集管理</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank" >规则测试</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank">规则测试</a></li>
<!-- <li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
</ul>
@ -151,7 +143,7 @@
" " + crawlSource.excCount + "\n" +
" </td>\n" +
" <td class=\"goread\">\n" +
" " + (crawlSource.taskStatus == 0 ? '采集失败' : (crawlSource.taskStatus == 1 ? '采集成功' : (crawlSource.excCount>0?'采集中':'排队中'))) + "\n" +
" " + (crawlSource.taskStatus == 0 ? '采集失败' : (crawlSource.taskStatus == 1 ? '采集成功' : (crawlSource.excCount > 0 ? '采集中' : '排队中'))) + "\n" +
" </td>\n" +
" <td class=\"name\" valsc=\"291|2037554|1\">"
+ crawlSource.createTime + "</td>\n" +
@ -190,7 +182,7 @@
}
} else {
} else {
layer.alert(data.msg);
}
@ -207,7 +199,7 @@
$.ajax({
type: "delete",
url: "/crawl/delCrawlSingleTask/"+id,
url: "/crawl/delCrawlSingleTask/" + id,
data: {},
dataType: "json",
success: function (data) {

View File

@ -12,15 +12,7 @@
</head>
<body class="">
<div class="header">
<div class="mainNav" id="mainNav">
<div class="box_center cf"
style="text-align: center;height: 44px;line-height: 48px;color: #fff;font-size: 16px;">
小说精品屋爬虫管理
</div>
</div>
<div th:replace="crawl/header :: header">
</div>
<div class="main box_center cf">
@ -30,7 +22,7 @@
<ul class="log_list">
<li><a class="link_1 on" href="/">爬虫源管理</a></li>
<li><a class="link_1" href="/crawl/crawlSingleTask_list.html">单本采集管理</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank" >规则测试</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank">规则测试</a></li>
<!--<li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
</ul>

View File

@ -12,15 +12,7 @@
</head>
<body class="">
<div class="header">
<div class="mainNav" id="mainNav">
<div class="box_center cf"
style="text-align: center;height: 44px;line-height: 48px;color: #fff;font-size: 16px;">
小说精品屋爬虫管理
</div>
</div>
<div th:replace="crawl/header :: header">
</div>
<div class="main box_center cf">

View File

@ -12,15 +12,7 @@
</head>
<body class="">
<div class="header">
<div class="mainNav" id="mainNav">
<div class="box_center cf"
style="text-align: center;height: 44px;line-height: 48px;color: #fff;font-size: 16px;">
小说精品屋爬虫管理
</div>
</div>
<div th:replace="crawl/header :: header">
</div>
<div class="main box_center cf">

View File

@ -12,15 +12,7 @@
</head>
<body class="">
<div class="header">
<div class="mainNav" id="mainNav">
<div class="box_center cf"
style="text-align: center;height: 44px;line-height: 48px;color: #fff;font-size: 16px;">
小说精品屋爬虫管理
</div>
</div>
<div th:replace="crawl/header :: header">
</div>
<div class="main box_center cf">
@ -30,7 +22,7 @@
<ul class="log_list">
<li><a class="link_1 on" href="/">爬虫源管理</a></li>
<li><a class="link_1" href="/crawl/crawlSingleTask_list.html">单本采集管理</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank" >规则测试</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank">规则测试</a></li>
<!--<li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
</ul>
@ -204,12 +196,12 @@
<script src="/javascript/user.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
function load(){
function load() {
var crawlSourceId = localStorage.getItem("crawlSourceId")
if(crawlSourceId!=null){
if (crawlSourceId != null) {
$.ajax({
type: "GET",
url: "/crawl/getCrawlSource/"+crawlSourceId,
url: "/crawl/getCrawlSource/" + crawlSourceId,
dataType: "json",
success: function (data) {
if (data.code == 200) {
@ -218,7 +210,7 @@
//未登录
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
}else {
} else {
layer.alert(data.msg);
}
@ -229,20 +221,21 @@
})
}
}
function loadPage(data){
function loadPage(data) {
$("#sourceId").val(data.id);
$("#sourceName").val(data.sourceName);
if(data.crawlRule){
if (data.crawlRule) {
var crawlRule= JSON.parse(data.crawlRule);
var crawlRule = JSON.parse(data.crawlRule);
$("#bookListUrl").val(crawlRule.bookListUrl);
var catIdRule = crawlRule.catIdRule;
try{
try {
for (var i = 1; i <= 7; i++) {
$("#catId" + i).val(catIdRule["catId" + i]);
}
}catch(e){
} catch (e) {
}
$("#bookIdPatten").val(crawlRule.bookIdPatten);
$("#pagePatten").val(crawlRule.pagePatten);
@ -253,14 +246,14 @@
$("#picUrlPatten").val(crawlRule.picUrlPatten);
$("#picUrlPrefix").val(crawlRule.picUrlPrefix);
$("#statusPatten").val(crawlRule.statusPatten);
try{
try {
var bookStatusRule = crawlRule.bookStatusRule;
var i=0;
for(var key in bookStatusRule){
var i = 0;
for (var key in bookStatusRule) {
$("#bookStatus" + i).val(key);
i++;
}
}catch (e) {
} catch (e) {
}
$("#scorePatten").val(crawlRule.scorePatten);
@ -279,12 +272,13 @@
}
}
load();
function updateCrawlSource() {
var crawlRule = {};
var sourceId =$("#sourceId").val();
var sourceId = $("#sourceId").val();
var sourceName = $("#sourceName").val();
if (sourceName.length == 0) {
@ -498,7 +492,7 @@
$.ajax({
type: "POST",
url: "/crawl/updateCrawlSource",
data: {'id':sourceId,'sourceName': sourceName, 'crawlRule': JSON.stringify(crawlRule)},
data: {'id': sourceId, 'sourceName': sourceName, 'crawlRule': JSON.stringify(crawlRule)},
dataType: "json",
success: function (data) {
if (data.code == 200) {

View File

@ -0,0 +1,28 @@
<div th:fragment="header" class="header">
<div class="mainNav" id="mainNav">
<div class="box_center cf"
style="text-align: center;height: 44px;line-height: 48px;color: #fff;font-size: 16px;width: 100%">
小说精品屋爬虫管理
<div style="text-align: center;height: 44px;line-height: 48px;font-size: 14px;float: right;padding-right: 20px">
<a style="color: #fff;"
href="/logout">
退出
</a>
</div>
<div style="float: right;margin-right:5px;margin-top: 15px">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img"
class="mr-3 iconify iconify--gitee icon-user-arrow-right" width="16" height="16"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<path d="M0 0h16v16H0z"></path>
<path fill="currentColor" fill-rule="nonzero"
d="M8 1.5a3.5 3.5 0 01.192 6.995L8 8.5a5.75 5.75 0 00-5.75 5.75.5.5 0 11-1 0 6.753 6.753 0 014.681-6.427A3.5 3.5 0 018 1.5zm6.996 10.767.003.041v.002l.001.011a.51.51 0 010 .006v.006l-.002.03a.502.502 0 01-.004.037l-.002.011a.39.39 0 01-.016.063.491.491 0 01-.053.114l-.028.039-.031.035.027-.03-.009.011-.017.02-.011.012-2.122 2.121a.5.5 0 01-.707-.707l1.268-1.268H9.5a.5.5 0 110-1h3.794l-1.269-1.267a.5.5 0 11.707-.708l2.122 2.122a.491.491 0 01.135.248l.005.037v-.006zM8 2.5a2.5 2.5 0 100 5 2.5 2.5 0 000-5z"></path>
</g>
</svg>
</div>
</div>
</div>
</div>

View File

@ -44,7 +44,7 @@
<body>
<div class="container">
<form class="form-signin" method="post" action="/login">
<h4 class="form-signin-heading">爬虫管理系统登录</h4>
<h4 style="text-align: center" class="form-signin-heading">爬虫管理系统登录</h4>
<p>
<label for="username" class="sr-only">用户名</label>
<input type="text" id="username" name="username" class="form-control" placeholder="用户名" required