mirror of
https://github.com/201206030/novel-plus.git
synced 2026-01-18 22:41:23 +08:00
perf(novel-crawl): 优化采集监控页异常提示体验
在爬虫采集监控页面,针对网络或服务异常情况,避免频繁弹窗提示,提升用户体验。
This commit is contained in:
@@ -118,9 +118,10 @@
|
||||
<script language="javascript" type="text/javascript">
|
||||
let curr = 1;
|
||||
let limit = 10;
|
||||
let isUpdate = false;
|
||||
|
||||
search();
|
||||
setInterval(function(){
|
||||
setInterval(function () {
|
||||
search();
|
||||
}, 10000);
|
||||
|
||||
@@ -185,6 +186,7 @@
|
||||
if (!first) {
|
||||
curr = obj.curr;
|
||||
limit = obj.limit;
|
||||
isUpdate = false;
|
||||
search();
|
||||
} else {
|
||||
|
||||
@@ -196,13 +198,21 @@
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
} else if (data.code == 1001) {
|
||||
//未登录
|
||||
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||
|
||||
} else if (!isUpdate) {
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
isUpdate = true;
|
||||
|
||||
},
|
||||
error: function () {
|
||||
layer.alert('网络异常');
|
||||
if (!isUpdate) {
|
||||
layer.alert('网络异常');
|
||||
}
|
||||
isUpdate = true;
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -116,14 +116,13 @@
|
||||
<script language="javascript" type="text/javascript">
|
||||
let curr = 1;
|
||||
let limit = 10;
|
||||
let isUpdate = false;
|
||||
|
||||
search();
|
||||
setInterval(function(){
|
||||
setInterval(function () {
|
||||
search();
|
||||
}, 10000);
|
||||
|
||||
var pageCrawlSourceList = null;
|
||||
|
||||
function search() {
|
||||
|
||||
$.ajax({
|
||||
@@ -134,7 +133,6 @@
|
||||
success: function (data) {
|
||||
if (data.code == 200) {
|
||||
var crawlSourceList = data.data.list;
|
||||
pageCrawlSourceList = data.data.list;
|
||||
if (crawlSourceList.length > 0) {
|
||||
var crawlSourceListHtml = "";
|
||||
for (var i = 0; i < crawlSourceList.length; i++) {
|
||||
@@ -182,6 +180,7 @@
|
||||
if (!first) {
|
||||
curr = obj.curr;
|
||||
limit = obj.limit;
|
||||
isUpdate = false;
|
||||
search();
|
||||
} else {
|
||||
|
||||
@@ -197,13 +196,17 @@
|
||||
//未登录
|
||||
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||
|
||||
} else {
|
||||
} else if (!isUpdate) {
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
isUpdate = true;
|
||||
|
||||
},
|
||||
error: function () {
|
||||
layer.alert('网络异常');
|
||||
if (!isUpdate) {
|
||||
layer.alert('网络异常');
|
||||
}
|
||||
isUpdate = true;
|
||||
}
|
||||
})
|
||||
|
||||
@@ -229,11 +232,11 @@
|
||||
if (status == 0) {
|
||||
//开启
|
||||
$("#sourceStatus" + sourceId).html("正在运行");
|
||||
$("#opt" + sourceId).html("<a href='javascript:openOrStopCrawl(" + sourceId + "," + 1 + ")'>关闭 </a>"+"<a href='javascript:updateCrawlSource(" + sourceId + ")'>修改 </a>");
|
||||
$("#opt" + sourceId).html("<a href='javascript:openOrStopCrawl(" + sourceId + "," + 1 + ")'>关闭 </a>" + "<a href='javascript:updateCrawlSource(" + sourceId + ")'>修改 </a>");
|
||||
} else {
|
||||
//关闭
|
||||
$("#sourceStatus" + sourceId).html("停止运行");
|
||||
$("#opt" + sourceId).html("<a href='javascript:openOrStopCrawl(" + sourceId + "," + 0 + ")'>开启 </a>"+"<a href='javascript:updateCrawlSource(" + sourceId + ")'>修改 </a>");
|
||||
$("#opt" + sourceId).html("<a href='javascript:openOrStopCrawl(" + sourceId + "," + 0 + ")'>开启 </a>" + "<a href='javascript:updateCrawlSource(" + sourceId + ")'>修改 </a>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user