From 9d4dc409c6e504d3e5484fbe57009c69e77485a7 Mon Sep 17 00:00:00 2001 From: xiongxiaoyang <1179705413@qq.com> Date: Sun, 3 Mar 2024 11:10:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20URI=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/static/javascript/bookdetail.js | 11 ++- .../resources/static/javascript/common.js | 73 +++++++++---------- .../main/resources/static/mobile/js/common.js | 2 +- .../templates/author/author_income.html | 43 ++++++----- .../author/author_income_detail.html | 45 ++++++------ .../resources/templates/author/index.html | 4 +- .../templates/author/index_list.html | 6 +- .../templates/book/book_content.html | 2 +- .../templates/mobile/book/book_content.html | 2 +- .../templates/mobile/book/book_detail.html | 2 +- .../resources/templates/mobile/pay/index.html | 2 +- .../templates/mobile/user/userinfo.html | 2 +- .../main/resources/templates/pay/index.html | 59 ++++++++------- .../resources/templates/user/comment.html | 19 ++--- .../resources/templates/user/favorites.html | 37 +++++----- .../resources/templates/user/feedback.html | 2 +- .../templates/user/feedback_list.html | 17 ++--- .../templates/user/read_history.html | 29 ++++---- .../resources/templates/user/set_name.html | 4 +- .../templates/user/set_password.html | 28 ++++--- .../resources/templates/user/set_sex.html | 33 +++++---- .../main/resources/templates/user/setup.html | 39 +++++----- .../resources/templates/user/userinfo.html | 27 +++---- 23 files changed, 253 insertions(+), 235 deletions(-) diff --git a/novel-front/src/main/resources/static/javascript/bookdetail.js b/novel-front/src/main/resources/static/javascript/bookdetail.js index 8d5f66b..7e78c68 100644 --- a/novel-front/src/main/resources/static/javascript/bookdetail.js +++ b/novel-front/src/main/resources/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/novel-front/src/main/resources/static/javascript/common.js b/novel-front/src/main/resources/static/javascript/common.js index e3fa1c8..f7f2c0a 100644 --- a/novel-front/src/main/resources/static/javascript/common.js +++ b/novel-front/src/main/resources/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/novel-front/src/main/resources/static/mobile/js/common.js b/novel-front/src/main/resources/static/mobile/js/common.js index 760a8de..fc19f68 100644 --- a/novel-front/src/main/resources/static/mobile/js/common.js +++ b/novel-front/src/main/resources/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("登录注册"); diff --git a/novel-front/src/main/resources/templates/author/author_income.html b/novel-front/src/main/resources/templates/author/author_income.html index 3e9cc3a..8f4f25f 100644 --- a/novel-front/src/main/resources/templates/author/author_income.html +++ b/novel-front/src/main/resources/templates/author/author_income.html @@ -1,5 +1,5 @@ - - + @@ -7,14 +7,15 @@ 作家管理系统-小说精品屋 - +