mirror of
https://github.com/201206030/novel-plus.git
synced 2025-07-15 13:46:39 +00:00
模版更新
This commit is contained in:
@ -51,8 +51,7 @@
|
||||
</div>
|
||||
<div class="my_r">
|
||||
<div id="noContentDiv">
|
||||
<div class="tc" style="margin-top: 200px"><a href="/author/book_add.html" class="btn_red">创建作品</a>
|
||||
</div>
|
||||
<div class="tc" style="margin-top: 200px"><a href="/author/book_add.html" class="btn_red">创建作品</a></div>
|
||||
|
||||
</div>
|
||||
<div class="my_bookshelf" id="hasContentDiv" style="display: none">
|
||||
@ -143,13 +142,12 @@
|
||||
<script src="/javascript/common.js" type="text/javascript"></script>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
var searchCount = 0;
|
||||
var timeout;
|
||||
var coverUpdateInterval;
|
||||
|
||||
search(1, 5);
|
||||
|
||||
function search(curr, limit) {
|
||||
searchCount++;
|
||||
clearTimeout(timeout);
|
||||
clearInterval(coverUpdateInterval);
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/author/listBookByPage",
|
||||
@ -159,7 +157,25 @@
|
||||
if (data.code == 200) {
|
||||
var bookList = data.data.list;
|
||||
if (bookList.length > 0) {
|
||||
var aiPicGenerating = bookList[0].picUrl == '/images/default.gif'
|
||||
if(curr == 1 && bookList[0].picUrl == '/images/default.gif'){
|
||||
coverUpdateInterval = setInterval(function(){
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/author/queryAiGenPic",
|
||||
data: {'bookId': bookList[0].id},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if(data.code == 200 && data.data){
|
||||
$("#cover"+bookList[0].id).attr("src", data.data);
|
||||
clearInterval(coverUpdateInterval);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
setTimeout(() => {
|
||||
clearInterval(coverUpdateInterval);
|
||||
}, 10000);
|
||||
}
|
||||
$("#hasContentDiv").css("display", "block");
|
||||
$("#noContentDiv").css("display", "none");
|
||||
var bookListHtml = "";
|
||||
@ -171,15 +187,12 @@
|
||||
" </td>\n" +*/
|
||||
|
||||
" <td style=\"position: relative\" class=\"goread\">\n" +
|
||||
"<input class=\"opacity\" onchange=\"picChange('" + book.id + "'," + i + ")\"\n" +
|
||||
" type=\"file\" id=\"file" + i + "\" name=\"file\"\n" +
|
||||
"<input class=\"opacity\" onchange=\"picChange('" + book.id + "')\"\n" +
|
||||
" type=\"file\" id=\"file" + book.id + "\" name=\"file\"\n" +
|
||||
" title=\"点击上传图片\"\n" +
|
||||
" style=\"z-index: 100;cursor: pointer;left: 30px; top: 0px; width: 60px; height: 80px; opacity: 0; position: absolute; \"\n" +
|
||||
" />" +
|
||||
"<img width='50' height='70' src='" + book.picUrl + "'/><br/>" +
|
||||
" " + book.bookName + "</td>\n" +
|
||||
|
||||
|
||||
"<img id=\"cover" + book.id + "\" width='50' height='70' src='" + book.picUrl + "'/><br/>" + " " + book.bookName + "</td>\n" +
|
||||
" <td class=\"goread\" >"
|
||||
+ book.catName + "</td>\n" +
|
||||
|
||||
@ -231,12 +244,6 @@
|
||||
});
|
||||
});
|
||||
|
||||
if (curr === 1 && aiPicGenerating && searchCount < 10) {
|
||||
timeout = setTimeout(function () {
|
||||
search(curr, limit);
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -288,19 +295,20 @@
|
||||
}
|
||||
|
||||
|
||||
function picChange(bookId, i) {
|
||||
var file = $("#file" + i).val(); //文件名称
|
||||
function picChange(bookId) {
|
||||
var file = $("#file" + bookId).val(); //文件名称
|
||||
if (file != "") {
|
||||
if (checkPicUpload($("#file" + i)[0])) {
|
||||
if (checkPicUpload($("#file" + bookId)[0])) {
|
||||
|
||||
$.ajaxFileUpload({
|
||||
url: "/file/picUpload", //用于文件上传的服务器端请求地址
|
||||
secureuri: false, //是否需要安全协议,一般设置为false
|
||||
fileElementId: "file" + i, //文件上传域的ID
|
||||
fileElementId: "file" + bookId, //文件上传域的ID
|
||||
dataType: "json", //返回值类型 一般设置为json
|
||||
type: "post",
|
||||
success: function (data) { //服务器成功响应处理函数
|
||||
if (data.code == 200) {
|
||||
let picUrl = data.data;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/author/updateBookPic",
|
||||
@ -308,17 +316,13 @@
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.code == 200) {
|
||||
|
||||
location.reload();
|
||||
|
||||
$("#cover"+bookId).attr("src", picUrl);
|
||||
} else {
|
||||
lock = false;
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
|
||||
},
|
||||
error: function () {
|
||||
lock = false;
|
||||
layer.alert('网络异常');
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user