我的书评
$.ajax({ type: "get", url: "/user/listCommentByPage", - data: {'curr':curr,'limit':limit}, + data: {'curr': curr, 'limit': limit}, dataType: "json", success: function (data) { if (data.code == 200) { var commentList = data.data.list; if (commentList.length > 0) { - $("#bookCommentTotal").html("("+data.data.total+"条)"); + $("#bookCommentTotal").html("(" + data.data.total + "条)"); var commentListHtml = ""; for (var i = 0; i < commentList.length; i++) { var comment = commentList[i]; commentListHtml += ("我的书评
} else if (data.code == 1001) { //未登录 - location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href); + location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href); - }else { + } else { layer.alert(data.msg); } diff --git a/templates/green/html/user/favorites.html b/templates/green/html/user/favorites.html index 2f82588b..985bec02 100644 --- a/templates/green/html/user/favorites.html +++ b/templates/green/html/user/favorites.html @@ -1,11 +1,13 @@ - +
@@ -56,7 +60,6 @@
我的书架
-
@@ -82,31 +85,31 @@ \n" +
+ bookShelfListHtml += (" \n" +
" \n" +
- " ["+book.catName+"]\n" +
+ " [" + book.catName + "]\n" +
" \n" +
" \n" +
- " \n" +
- " "+book.bookName+"\n" +
+ " \n" +
+ " " + book.bookName + "\n" +
" \n" +
" \n" +
- ""+book.lastIndexName+""+
+ "" + book.lastIndexName + "" +
" \n" +
" \n" +
- " "+book.lastIndexUpdateTime+"\n" +
+ " " + book.lastIndexUpdateTime + "\n" +
" \n" +
" \n" +
- "继续阅读"+
+ "继续阅读" +
" \n" +
" ");
}
@@ -144,9 +147,9 @@
@@ -34,8 +33,6 @@
-
-
我的书架
0) { var bookShelfListHtml = ""; - for(var i=0;i我的书架
} else if (data.code == 1001) { //未登录 - location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href); + location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href); } else { layer.alert(data.msg); diff --git a/templates/green/html/user/feedback_list.html b/templates/green/html/user/feedback_list.html index d61710db..193564d4 100644 --- a/templates/green/html/user/feedback_list.html +++ b/templates/green/html/user/feedback_list.html @@ -1,6 +1,5 @@ - - - +我的反馈
@@ -61,7 +58,7 @@ ");
}
$("#feedbackList").html(feedbackListHtml);
@@ -109,9 +106,9 @@
@@ -13,7 +14,9 @@
@@ -69,31 +72,31 @@
我的反馈
$.ajax({ type: "get", url: "/user/listUserFeedBackByPage", - data: {'curr':curr,'limit':limit}, + data: {'curr': curr, 'limit': limit}, dataType: "json", success: function (data) { if (data.code == 200) { @@ -71,8 +68,8 @@我的反馈
for (var i = 0; i < feedbackList.length; i++) { var feedback = feedbackList[i]; feedbackListHtml += ("- \n" +
- "
- "+feedback.createTime+" \n" + - "
- "+feedback.content+" \n" + + "
- " + feedback.createTime + " \n" + + "
- " + feedback.content + " \n" + "
我的反馈
} else if (data.code == 1001) { //未登录 - location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href); + location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href); - }else { + } else { layer.alert(data.msg); } diff --git a/templates/green/html/user/read_history.html b/templates/green/html/user/read_history.html index ba91b3ef..a0b063af 100644 --- a/templates/green/html/user/read_history.html +++ b/templates/green/html/user/read_history.html @@ -1,4 +1,5 @@ - +\n" + - " ["+book.catName+"]\n" + + " [" + book.catName + "]\n" + " | \n" + "\n" + - " \n" + - " "+book.bookName+"\n" + + " \n" + + " " + book.bookName + "\n" + " | \n" + "\n" + - ""+book.lastIndexName+""+ + "" + book.lastIndexName + "" + " | \n" + "\n" + - " "+book.lastIndexUpdateTime+"\n" + + " " + book.lastIndexUpdateTime + "\n" + " | \n" + "\n" + - "继续阅读"+ + "继续阅读" + " | \n" + "
\n" + - " [" + book.catName + "]\n" + + " [" + book.catName + "]\n" + " | \n" + "\n" + " \n" + diff --git a/templates/green/static/javascript/bookdetail.js b/templates/green/static/javascript/bookdetail.js index 8d5f66b1..7e78c687 100644 --- a/templates/green/static/javascript/bookdetail.js +++ b/templates/green/static/javascript/bookdetail.js @@ -27,15 +27,14 @@ if (layerStatus == 1) { $("#cFavs").html("已收藏"); jQuery.cookie("u-faorites", "1"); - } - else { + } else { $("#cFavs").html("已在书架"); } } else if (data.code == 1001) { //未登录 - location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href); + location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href); } else { layer.alert(data.msg); @@ -91,7 +90,7 @@ } }, SaveComment: function (cmtBId, cmtCId, cmtDetail) { - if(!isLogin){ + if (!isLogin) { layer.alert('请先登陆'); return; } @@ -121,7 +120,7 @@ } else if (data.code == 1001) { //未登录 - location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href); + location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href); } else { layer.alert(data.msg); @@ -187,7 +186,7 @@ localStorage.setItem("fonts", fonts); $(".readBox").css("font-size", fonts + "px"); $("#cFonts").html(fonts); - $("#ChapterBody").attr("class","article-content font"+fonts); + $("#ChapterBody").attr("class", "article-content font" + fonts); BookDetail.reShowCover(); }, SetBackUpColor: function (colorNum) { diff --git a/templates/green/static/javascript/common.js b/templates/green/static/javascript/common.js index e3fa1c88..f7f2c0a4 100644 --- a/templates/green/static/javascript/common.js +++ b/templates/green/static/javascript/common.js @@ -1,10 +1,11 @@ -var needLoginPath = ['/user/favorites.html','/user/comment.html','/user/feedback.html', - '/user/feedback_list.html','/user/read_history.html','/user/set_name.html', - '/user/set_password.html','/user/set_sex.html','/user/setup.html','/user/userinfo.html', +var needLoginPath = ['/user/favorites.html', '/user/comment.html', '/user/feedback.html', + '/user/feedback_list.html', '/user/read_history.html', '/user/set_name.html', + '/user/set_password.html', '/user/set_sex.html', '/user/setup.html', '/user/userinfo.html', "/pay/index.html," + - "/author/register.html","/author/index.html"]; + "/author/register.html", "/author/index.html"]; var isLogin = false; var url = window.location.search; + //key(需要检索的键) function getSearchString(key) { var str = url; @@ -14,26 +15,28 @@ function getSearchString(key) { for (var i = 0; i < arr.length; i++) { var tmp_arr = arr[i].split("="); - if(tmp_arr[0] == key){ + if (tmp_arr[0] == key) { return decodeURIComponent(tmp_arr[1]); } } return undefined; } + var keyword = getSearchString("k"); -if(keyword != undefined) { +if (keyword != undefined) { $("#searchKey").val(keyword); $("#workDirection").remove(); $("#idGirl").remove(); } -function searchByK(k){ - if(!k){ - window.location.href='/book/bookclass.html?k='+encodeURIComponent(document.getElementById("searchKey").value) - }else{ - window.location.href='/book/bookclass.html?k='+encodeURIComponent(k) +function searchByK(k) { + if (!k) { + window.location.href = '/book/bookclass.html?k=' + encodeURIComponent(document.getElementById("searchKey").value) + } else { + window.location.href = '/book/bookclass.html?k=' + encodeURIComponent(k) } } + $("#searchKey").keypress(function (even) { if (even.which == 13) { even.stopPropagation(); @@ -50,37 +53,37 @@ Array.prototype.indexOf = function (val) { var token = $.cookie('Authorization'); -if(!token){ - if(needLoginPath.indexOf(window.location.pathname) != -1){ - location.href = '/user/login.html?originUrl='+decodeURIComponent(location.href); +if (!token) { + if (needLoginPath.indexOf(window.location.pathname) != -1) { + location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href); } $(".user_link").html("|登录注册"); -}else{ +} else { $.ajax({ type: "POST", url: "/user/refreshToken", data: {}, dataType: "json", - success: function(data){ - if(data.code == 200){ + success: function (data) { + if (data.code == 200) { $(".user_link").html("|" + - ""+data.data.nickName+"" + + "" + data.data.nickName + "" + "退出"); ; - if("/user/login.html" == window.location.pathname){ + if ("/user/login.html" == window.location.pathname) { var orginUrl = getSearchString("originUrl"); window.location.href = orginUrl == undefined || orginUrl.isBlank() ? "/" : orginUrl; return; } isLogin = true; - if(localStorage.getItem("autoLogin") == 1){ - $.cookie('Authorization', data.data.token, { expires: 7 ,path: '/' }); - }else { - $.cookie('Authorization', data.data.token,{ path: '/' }); + if (localStorage.getItem("autoLogin") == 1) { + $.cookie('Authorization', data.data.token, {expires: 7, path: '/'}); + } else { + $.cookie('Authorization', data.data.token, {path: '/'}); } - }else{ - if(needLoginPath.indexOf(window.location.pathname) != -1){ + } else { + if (needLoginPath.indexOf(window.location.pathname) != -1) { location.href = '/user/login.html'; } $(".user_link").html("|登录注册"); @@ -94,7 +97,6 @@ if(!token){ } - String.prototype.isPhone = function () { var strTemp = /^1[3|4|5|6|7|8|9][0-9]{9}$/; if (strTemp.test(this)) { @@ -104,7 +106,7 @@ String.prototype.isPhone = function () { }; String.prototype.isBlank = function () { - if(this == null || $.trim(this) == ""){ + if (this == null || $.trim(this) == "") { return true; } return false; @@ -118,11 +120,8 @@ String.prototype.isNickName = function () { }; - - - function logout() { - $.cookie('Authorization', null,{ path: '/' }); + $.cookie('Authorization', null, {path: '/'}); location.reload(); } @@ -133,9 +132,9 @@ function isImg(str) { //校验图片上传 -function checkPicUpload(file){ +function checkPicUpload(file) { - if(!isImg(file.value.substr(file.value.lastIndexOf(".")))){ + if (!isImg(file.value.substr(file.value.lastIndexOf(".")))) { layer.alert('只能上传图片格式的文件!'); return false; } @@ -144,13 +143,13 @@ function checkPicUpload(file){ if (isIE && !file.files) { var filePath = file.value; var fileSystem = new ActiveXObject("Scripting.FileSystemfileect"); - var file = fileSystem.GetFile (filePath); + var file = fileSystem.GetFile(filePath); fileSize = file.Size; - }else { + } else { fileSize = file.files[0].size; } - fileSize=Math.round(fileSize/1024*100)/100; //单位为KB - if(fileSize>=1024){ + fileSize = Math.round(fileSize / 1024 * 100) / 100; //单位为KB + if (fileSize >= 1024) { layer.alert('上传的图片大小不能超过1M!'); return false; } diff --git a/templates/green/static/mobile/js/common.js b/templates/green/static/mobile/js/common.js index 760a8de0..fc19f68e 100644 --- a/templates/green/static/mobile/js/common.js +++ b/templates/green/static/mobile/js/common.js @@ -106,7 +106,7 @@ Array.prototype.remove = function (val) { var token = $.cookie('Authorization'); if (!token) { if (needLoginPath.indexOf(window.location.pathname) != -1) { - location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href); + location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href); } // $(".user_link").html("登录|注册"); |
\t\t\t- "+(comment.createUserName.substr(0, 4) + "****" + comment.createUserName.substr(comment.createUserName.length - 3, 3))+"
- " +
- comment.commentContent+
+ "
\t\t\t- " + (comment.createUserName.substr(0, 4) + "****" + comment.createUserName.substr(comment.createUserName.length - 3, 3)) + "
- " +
+ comment.commentContent +
"
- " +
- ""+comment.createTime+"" +
+ "" + comment.createTime + "" +
"赞(0)" +
"
\t\t
\t