From dce8a21c0d26966ff5c0032e6b003cf70200c2a3 Mon Sep 17 00:00:00 2001 From: xiongxiaoyang <1179705413@qq.com> Date: Sat, 13 May 2023 13:11:10 +0800 Subject: [PATCH 1/7] =?UTF-8?q?feat:=20=E9=A6=96=E9=A1=B5=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E7=99=BB=E5=BD=95=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/static/mobile/js/common.js | 96 +++++++++++++++++-- .../resources/templates/mobile/common/js.html | 2 +- .../resources/templates/mobile/index.html | 19 +++- 3 files changed, 109 insertions(+), 8 deletions(-) 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 a62d25c..feea8a3 100644 --- a/novel-front/src/main/resources/static/mobile/js/common.js +++ b/novel-front/src/main/resources/static/mobile/js/common.js @@ -1,3 +1,48 @@ +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"]; +var isLogin = false; + +jQuery.cookie = function (name, value, options) { + if (typeof value != 'undefined') { + options = options || {}; + if (value === null) { + value = ''; + options.expires = -1; + } + var expires = ''; + if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { + var date; + if (typeof options.expires == 'number') { + date = new Date(); + date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); + } else { + date = options.expires; + } + expires = '; expires=' + date.toUTCString(); + } + var path = options.path ? '; path=' + options.path : ''; + var domain = options.domain ? '; domain=' + options.domain : ''; + var secure = options.secure ? '; secure' : ''; + document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); + } else { + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = jQuery.trim(cookies[i]); + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } +}; + Array.prototype.indexOf = function (val) { for (var i = 0; i < this.length; i++) { if (this[i] == val) return i; @@ -12,15 +57,54 @@ Array.prototype.remove = function (val) { } }; -var token = localStorage.getItem("token"); -if (token) { - $.get("/user/isLogin", {"token": token}, function (data) { - if (data.code != 1) {//未登录 - localStorage.removeItem("token"); +var token = $.cookie('Authorization'); +if(!token){ + if(needLoginPath.indexOf(window.location.pathname) != -1){ + location.href = '/user/login.html?originUrl='+decodeURIComponent(location.href); + } + + $(".user_link").html("登录注册"); +}else{ + $.ajax({ + type: "POST", + url: "/user/refreshToken", + data: {}, + dataType: "json", + success: function(data){ + if(data.code == 200){ + $(".user_link").html(""+(data.data.nickName.substring(0,3))+"...  退出"); + ; + 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: '/' }); + } + }else{ + if(needLoginPath.indexOf(window.location.pathname) != -1){ + location.href = '/user/login.html'; + } + $(".user_link").html("登录注册"); + } + }, + error: function () { + layer.alert('网络异常'); } - }) + + }); } +function logout() { + $.cookie('Authorization', null,{ path: '/' }); + location.reload(); +} + + function readHistory() { diff --git a/novel-front/src/main/resources/templates/mobile/common/js.html b/novel-front/src/main/resources/templates/mobile/common/js.html index f53f536..e022d12 100644 --- a/novel-front/src/main/resources/templates/mobile/common/js.html +++ b/novel-front/src/main/resources/templates/mobile/common/js.html @@ -1,3 +1,3 @@ - + diff --git a/novel-front/src/main/resources/templates/mobile/index.html b/novel-front/src/main/resources/templates/mobile/index.html index ec2ab3b..251ed03 100644 --- a/novel-front/src/main/resources/templates/mobile/index.html +++ b/novel-front/src/main/resources/templates/mobile/index.html @@ -40,6 +40,20 @@ -webkit-transition: all .3s; } + .user_link{ + position: relative; + display: inline-block; + vertical-align: middle; + line-height: 50px; + padding: 0 20px; + color: #fff; + float: right; + } + .user_link a{ + + color: #fff; + } + @@ -85,7 +99,7 @@
女频小说
-
  • 书架
  • + +
    From dabfb9d1e83db9723d9f5b72a3b3bcac6996134b Mon Sep 17 00:00:00 2001 From: xiongxiaoyang <1179705413@qq.com> Date: Sat, 13 May 2023 15:15:42 +0800 Subject: [PATCH 2/7] =?UTF-8?q?feat:=20=E6=89=8B=E6=9C=BA=E7=AB=AF?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=A1=B5=E9=9D=A2=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../novel/controller/PageController.java | 8 + .../main/resources/static/mobile/js/common.js | 64 ++++++++ .../static/mobile/layui/css/layui.css | 6 +- .../templates/mobile/user/login.html | 148 +++++++++--------- 4 files changed, 153 insertions(+), 73 deletions(-) diff --git a/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java b/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java index f32f6d6..a50f89e 100644 --- a/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java +++ b/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java @@ -91,6 +91,14 @@ public class PageController extends BaseController { return ThreadLocalUtil.getTemplateDir() + "index"; } + /** + * 登录页 + */ + @RequestMapping("user/login.html") + public String login() { + return ThreadLocalUtil.getTemplateDir() + "user/login"; + } + /** * 作品页 */ 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 feea8a3..214592f 100644 --- a/novel-front/src/main/resources/static/mobile/js/common.js +++ b/novel-front/src/main/resources/static/mobile/js/common.js @@ -4,6 +4,49 @@ var needLoginPath = ['/user/favorites.html','/user/comment.html','/user/feedback "/pay/index.html," + "/author/register.html","/author/index.html"]; var isLogin = false; +var url = window.location.search; +//key(需要检索的键) +function getSearchString(key) { + var str = url; + str = str.substring(1, str.length); // 获取URL中?之后的字符(去掉第一位的问号) + // 以&分隔字符串,获得类似name=xiaoli这样的元素数组 + var arr = str.split("&"); + + for (var i = 0; i < arr.length; i++) { + var tmp_arr = arr[i].split("="); + if(tmp_arr[0] == key){ + return decodeURIComponent(tmp_arr[1]); + } + } + return undefined; +} +var keyword = getSearchString("k"); +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) + } +} +$("#searchKey").keypress(function (even) { + if (even.which == 13) { + even.stopPropagation(); + //enter键按下 + searchByK(); + } +}); +Array.prototype.indexOf = function (val) { + for (var i = 0; i < this.length; i++) { + if (this[i] == val) return i; + } + return -1; +}; jQuery.cookie = function (name, value, options) { if (typeof value != 'undefined') { @@ -129,5 +172,26 @@ function getQueryVariable(variable) { return (false); } +String.prototype.isPhone = function () { + var strTemp = /^1[3|4|5|6|7|8|9][0-9]{9}$/; + if (strTemp.test(this)) { + return true; + } + return false; +}; + +String.prototype.isBlank = function () { + if(this == null || $.trim(this) == ""){ + return true; + } + return false; +}; +String.prototype.isNickName = function () { + var strTemp = /^[\u4E00-\u9FA5A-Za-z0-9_]+$/; + if (strTemp.test(this)) { + return true; + } + return false; +}; diff --git a/novel-front/src/main/resources/static/mobile/layui/css/layui.css b/novel-front/src/main/resources/static/mobile/layui/css/layui.css index a7258a3..a42ab15 100644 --- a/novel-front/src/main/resources/static/mobile/layui/css/layui.css +++ b/novel-front/src/main/resources/static/mobile/layui/css/layui.css @@ -1847,7 +1847,7 @@ a cite { } .layui-btn-primary:hover { - border-color: #009688; + border-color: #f80; color: #333 } @@ -2230,11 +2230,11 @@ a cite { } .layui-form-checked span, .layui-form-checked:hover span { - background-color: #5FB878 + background-color: #f80 } .layui-form-checked i, .layui-form-checked:hover i { - color: #5FB878 + color: #f80 } .layui-form-item .layui-form-checkbox { diff --git a/novel-front/src/main/resources/templates/mobile/user/login.html b/novel-front/src/main/resources/templates/mobile/user/login.html index c2048ac..0a7b195 100644 --- a/novel-front/src/main/resources/templates/mobile/user/login.html +++ b/novel-front/src/main/resources/templates/mobile/user/login.html @@ -5,109 +5,117 @@ - 登录|注册 - -
    + 登录 +
    - - -
    +
    -
    +
    - +
    - 登录|注册 -
    - + 登录 +
    +
    - -
    + +
    +

    +
    - -
    - + +
    +
    - +
    -
    如果登录名不存在,则直接注册!
    +
    - + +
    +
    +
    +
    +
    -
    +
    - - -
    - - - - - + \ No newline at end of file From 4fb0d478f3a46433d0bb396c7876dc142ea1d08d Mon Sep 17 00:00:00 2001 From: xiongxiaoyang <1179705413@qq.com> Date: Sat, 13 May 2023 19:57:19 +0800 Subject: [PATCH 3/7] =?UTF-8?q?feat:=20=E6=89=8B=E6=9C=BA=E7=AB=AF?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=A1=B5=E9=9D=A2=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../novel/controller/PageController.java | 8 ++ .../static/mobile/layui/css/layui.css | 6 +- .../templates/mobile/user/login.html | 9 +- .../templates/mobile/user/register.html | 122 ++++++++++++++++++ 4 files changed, 136 insertions(+), 9 deletions(-) create mode 100644 novel-front/src/main/resources/templates/mobile/user/register.html diff --git a/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java b/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java index a50f89e..0de69aa 100644 --- a/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java +++ b/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java @@ -99,6 +99,14 @@ public class PageController extends BaseController { return ThreadLocalUtil.getTemplateDir() + "user/login"; } + /** + * 注册页 + */ + @RequestMapping("user/register.html") + public String register() { + return ThreadLocalUtil.getTemplateDir() + "user/register"; + } + /** * 作品页 */ diff --git a/novel-front/src/main/resources/static/mobile/layui/css/layui.css b/novel-front/src/main/resources/static/mobile/layui/css/layui.css index a42ab15..7025606 100644 --- a/novel-front/src/main/resources/static/mobile/layui/css/layui.css +++ b/novel-front/src/main/resources/static/mobile/layui/css/layui.css @@ -2276,13 +2276,13 @@ a cite { } .layui-form-checkbox[lay-skin=primary]:hover i { - border-color: #5FB878; + border-color: #f80; color: #fff } .layui-form-checked[lay-skin=primary] i { - border-color: #5FB878; - background-color: #5FB878; + border-color: #f80; + background-color: #f80; color: #fff } diff --git a/novel-front/src/main/resources/templates/mobile/user/login.html b/novel-front/src/main/resources/templates/mobile/user/login.html index 0a7b195..075356f 100644 --- a/novel-front/src/main/resources/templates/mobile/user/login.html +++ b/novel-front/src/main/resources/templates/mobile/user/login.html @@ -25,11 +25,8 @@
    -
    + -
    -

    -
    @@ -47,7 +44,7 @@
    - +
    @@ -65,7 +62,7 @@
    + + + + \ No newline at end of file From c63b4d617ee23f34ff9c19abfcfcd815ff9a137d Mon Sep 17 00:00:00 2001 From: xiongxiaoyang <1179705413@qq.com> Date: Sat, 13 May 2023 23:02:53 +0800 Subject: [PATCH 4/7] =?UTF-8?q?feat:=20=E6=89=8B=E6=9C=BA=E7=AB=AF?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=AD=E5=BF=83=E9=A1=B5=E9=9D=A2=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../novel/controller/PageController.java | 8 + .../templates/mobile/user/userinfo.html | 221 ++++++++++++++++++ 2 files changed, 229 insertions(+) create mode 100644 novel-front/src/main/resources/templates/mobile/user/userinfo.html diff --git a/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java b/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java index 0de69aa..43905cc 100644 --- a/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java +++ b/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java @@ -107,6 +107,14 @@ public class PageController extends BaseController { return ThreadLocalUtil.getTemplateDir() + "user/register"; } + /** + * 用户中心页 + */ + @RequestMapping("user/userinfo.html") + public String userinfo() { + return ThreadLocalUtil.getTemplateDir() + "user/userinfo"; + } + /** * 作品页 */ diff --git a/novel-front/src/main/resources/templates/mobile/user/userinfo.html b/novel-front/src/main/resources/templates/mobile/user/userinfo.html new file mode 100644 index 0000000..9740b8f --- /dev/null +++ b/novel-front/src/main/resources/templates/mobile/user/userinfo.html @@ -0,0 +1,221 @@ + + + + + + + + + + + + + + +
    + + + + + + +
    + + +
    + +
    + + +
    + 用户中心 + +
    + +
    + +
    + +
    梦入神机
    +
    账户余额:3000 屋币
    + +
    +
    + + + +
    + + +
    + + 充值 +
    +
    +
    +
    + + + +
    +  + + 我的书架 +
    +
    +
    +
    + + + +
    +  + + 我的书评 +
    +
    +
    +
    + + + + +
    +  + + 账户设置 +
    +
    +
    +
    + +
    + +
    +
    + +
    +
    + + + + + + + + \ No newline at end of file From 18f5fbf5089a42fce665a357cec329c0b2cba539 Mon Sep 17 00:00:00 2001 From: xiongxiaoyang <1179705413@qq.com> Date: Sat, 13 May 2023 23:40:54 +0800 Subject: [PATCH 5/7] =?UTF-8?q?feat:=20=E6=89=8B=E6=9C=BA=E7=AB=AF?= =?UTF-8?q?=E6=88=91=E7=9A=84=E4=B9=A6=E6=9E=B6=E9=A1=B5=E9=9D=A2=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../novel/controller/PageController.java | 8 + .../com/java2nb/novel/vo/BookShelfVO.java | 13 +- .../mybatis/mapping/UserBookshelfMapper.xml | 3 +- .../templates/mobile/user/favorites.html | 268 ++++++++++++++++++ .../templates/mobile/user/login.html | 2 +- .../templates/mobile/user/register.html | 2 +- .../templates/mobile/user/userinfo.html | 2 +- 7 files changed, 293 insertions(+), 5 deletions(-) create mode 100644 novel-front/src/main/resources/templates/mobile/user/favorites.html diff --git a/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java b/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java index 43905cc..48c0587 100644 --- a/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java +++ b/novel-front/src/main/java/com/java2nb/novel/controller/PageController.java @@ -115,6 +115,14 @@ public class PageController extends BaseController { return ThreadLocalUtil.getTemplateDir() + "user/userinfo"; } + /** + * 我的书架页 + */ + @RequestMapping("user/favorites.html") + public String favorites() { + return ThreadLocalUtil.getTemplateDir() + "user/favorites"; + } + /** * 作品页 */ diff --git a/novel-front/src/main/java/com/java2nb/novel/vo/BookShelfVO.java b/novel-front/src/main/java/com/java2nb/novel/vo/BookShelfVO.java index 7573c0c..66faf6c 100644 --- a/novel-front/src/main/java/com/java2nb/novel/vo/BookShelfVO.java +++ b/novel-front/src/main/java/com/java2nb/novel/vo/BookShelfVO.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.java2nb.novel.entity.UserBookshelf; import lombok.Data; +import javax.annotation.Generated; import java.util.Date; /** @@ -19,9 +20,19 @@ public class BookShelfVO extends UserBookshelf { private String lastIndexName; private String bookName; - @JsonFormat(timezone = "GMT+8", pattern = "MM/dd HH:mm:ss") + + private String picUrl; + + private Long authorId; + + private String authorName; + + private String bookDesc; + private Date lastIndexUpdateTime; + private Byte bookStatus; + @Override public String toString() { diff --git a/novel-front/src/main/resources/mybatis/mapping/UserBookshelfMapper.xml b/novel-front/src/main/resources/mybatis/mapping/UserBookshelfMapper.xml index 7870905..ad80d7d 100644 --- a/novel-front/src/main/resources/mybatis/mapping/UserBookshelfMapper.xml +++ b/novel-front/src/main/resources/mybatis/mapping/UserBookshelfMapper.xml @@ -4,7 +4,8 @@ + + + + + + + + + + +
    + +
    + + +
    + 我的书架 + +
    +
    +
    + + +
    + + +
    + +
    +
    +
    + + + + +
    + + + + + + \ No newline at end of file diff --git a/novel-front/src/main/resources/templates/mobile/user/login.html b/novel-front/src/main/resources/templates/mobile/user/login.html index 075356f..5622acb 100644 --- a/novel-front/src/main/resources/templates/mobile/user/login.html +++ b/novel-front/src/main/resources/templates/mobile/user/login.html @@ -62,7 +62,7 @@
    + + + + \ No newline at end of file From e1c800d78f84b9e7086129e05ab59f64c72ab7b5 Mon Sep 17 00:00:00 2001 From: xiongxiaoyang <1179705413@qq.com> Date: Sun, 14 May 2023 07:05:36 +0800 Subject: [PATCH 7/7] =?UTF-8?q?feat:=20=E6=89=8B=E6=9C=BA=E7=AB=AF?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=AD=E5=BF=83=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/templates/mobile/user/userinfo.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/novel-front/src/main/resources/templates/mobile/user/userinfo.html b/novel-front/src/main/resources/templates/mobile/user/userinfo.html index 8b60977..b0d198e 100644 --- a/novel-front/src/main/resources/templates/mobile/user/userinfo.html +++ b/novel-front/src/main/resources/templates/mobile/user/userinfo.html @@ -96,7 +96,7 @@ -
    +
    充值 @@ -109,7 +109,7 @@ -
    +
    @@ -123,7 +123,7 @@ -
    +
    @@ -138,7 +138,7 @@ -
    +