修复小说阅读的时候按键盘→会报错的bug

This commit is contained in:
xiongxiaoyang 2020-11-12 12:03:45 +08:00
parent 66093cb065
commit 2c3e346ea7
2 changed files with 12 additions and 9 deletions

View File

@ -238,17 +238,17 @@
if (preId > 0) { if (preId > 0) {
location.href = '/book/' + bid + '/' + preId + '.html'; location.href = '/book/' + bid + '/' + preId + '.html';
} else { } else {
location.href = '/book/chapterlist-' + bid + '.html'; location.href = '/book/indexList-' + bid + '.html';
} }
} else if (e.keyCode == 39) { } else if (e.keyCode == 39) {
if (nextId > 0) { if (nextId > 0) {
location.href = '/book/' + bid + '/' + nextId + '.html'; location.href = '/book/' + bid + '/' + nextId + '.html';
} else { } else {
location.href = '/book/chapterlist-' + bid + '.html'; location.href = '/book/indexList-' + bid + '.html';
} }
} }
}); });
BookDetail.SetReadHistory(bid, cid, crank); //BookDetail.SetReadHistory(bid, cid, crank);
}, },
SetReadHistory: function (bid, cid, crank) { SetReadHistory: function (bid, cid, crank) {
var strHistory = jQuery.cookie("wapviewhistory"); var strHistory = jQuery.cookie("wapviewhistory");

View File

@ -40,6 +40,8 @@
<input type="hidden" id="preIndexName" th:value="${bookIndex.indexName}"/> <input type="hidden" id="preIndexName" th:value="${bookIndex.indexName}"/>
<input type="hidden" id="preContentId" th:value="${bookIndex.id}"/> <input type="hidden" id="preContentId" th:value="${bookIndex.id}"/>
<input type="hidden" id="preIndexId" th:value="${preBookIndexId}"/>
<input type="hidden" id="nextIndexId" th:value="${nextBookIndexId}"/>
<div th:replace="common/top :: top('10')"> <div th:replace="common/top :: top('10')">
</div> </div>
@ -269,11 +271,12 @@
}) })
var currentBId =37, usfltotal = 0, spmymoney = 0; var bookId = $("#bookId").val();
var indexId = $("#preContentId").val();
var preIndexId = $("#preIndexId").val();
var nextIndexId = $("#nextIndexId").val();
$(function () { $(function () {
BookDetail.GetReadSet(37,1959973,0,1959974,1); BookDetail.GetReadSet(bookId,indexId,preIndexId,nextIndexId,1);
BookDetail.ClickChapter(37,1959973,0);
BookDetail.GetFavorites(37);
$(".ico_setup").click(function () { $(".ico_setup").click(function () {
$(".maskBox,.setupBox").show(); $(".maskBox,.setupBox").show();
@ -318,7 +321,7 @@
if(bookIndexId != 0){ if(bookIndexId != 0){
window.location.href = '/book/'+bookId+'/'+bookIndexId+".html"; window.location.href = '/book/'+bookId+'/'+bookIndexId+".html";
}else{ }else{
layer.alert("已经是第一章了!"); window.location.href = '/book/indexList-' + bookId + '.html';
} }
} }
@ -326,7 +329,7 @@
if(bookIndexId != 0){ if(bookIndexId != 0){
window.location.href = '/book/'+bookId+'/'+bookIndexId+".html"; window.location.href = '/book/'+bookId+'/'+bookIndexId+".html";
}else{ }else{
layer.alert("已经是最新章节了!"); window.location.href = '/book/indexList-' + bookId + '.html';
} }
} }