From 3e1c1f02e9f72dbf10a87ef8e0e4f228717f417d Mon Sep 17 00:00:00 2001 From: xiongxiaoyang <1179705413@qq.com> Date: Thu, 12 Oct 2023 09:59:08 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=A8=A1=E7=89=88=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/orange/html/mobile/common/js.html | 2 +- templates/orange/html/mobile/index.html | 33 +- templates/orange/html/mobile/pay/index.html | 212 +++++++++++++ .../orange/html/mobile/user/favorites.html | 268 +++++++++++++++++ templates/orange/html/mobile/user/login.html | 141 ++++----- .../orange/html/mobile/user/read_history.html | 266 +++++++++++++++++ .../orange/html/mobile/user/register.html | 122 ++++++++ .../orange/html/mobile/user/userinfo.html | 282 ++++++++++++++++++ templates/orange/static/mobile/js/common.js | 164 +++++++++- .../orange/static/mobile/layui/css/layui.css | 12 +- 10 files changed, 1416 insertions(+), 86 deletions(-) create mode 100644 templates/orange/html/mobile/pay/index.html create mode 100644 templates/orange/html/mobile/user/favorites.html create mode 100644 templates/orange/html/mobile/user/read_history.html create mode 100644 templates/orange/html/mobile/user/register.html create mode 100644 templates/orange/html/mobile/user/userinfo.html diff --git a/templates/orange/html/mobile/common/js.html b/templates/orange/html/mobile/common/js.html index f53f5366..e022d125 100644 --- a/templates/orange/html/mobile/common/js.html +++ b/templates/orange/html/mobile/common/js.html @@ -1,3 +1,3 @@ - + diff --git a/templates/orange/html/mobile/index.html b/templates/orange/html/mobile/index.html index ec2ab3b7..25e1aa88 100644 --- a/templates/orange/html/mobile/index.html +++ b/templates/orange/html/mobile/index.html @@ -40,6 +40,21 @@ -webkit-transition: all .3s; } + .user_link { + position: relative; + display: inline-block; + vertical-align: middle; + line-height: 50px; + padding: 0 5px; + color: #fff; + float: right; + } + + .user_link a { + + color: #fff; + } + @@ -85,7 +100,7 @@
女频小说
-
  • 书架
  • + +
    @@ -170,7 +188,8 @@
    -
    + diff --git a/templates/orange/html/mobile/pay/index.html b/templates/orange/html/mobile/pay/index.html new file mode 100644 index 00000000..4d35510e --- /dev/null +++ b/templates/orange/html/mobile/pay/index.html @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + +
    + +
    + + +
    + 充值 + +
    +
    +
    +
    + 充值账号:13560421324    余额:10 屋币 +
    +
    +
    +
    选择充值金额
    +
  • +
    +
    10元
    1000屋币
    +
    +
  • +
  • +
    +
    30元
    3000屋币
    +
    +
  • +
  • +
    +
    50元
    5000屋币
    +
    +
  • +
  • +
    +
    100元
    10000屋币
    +
    +
  • +
  • +
    +
    200元
    20000屋币
    +
    +
  • +
  • +
    +
    500元
    50000屋币
    +
    +
  • + +
    + +
    + + +
    + + +
    +
    +
    + + + + +
    + + + + + + \ No newline at end of file diff --git a/templates/orange/html/mobile/user/favorites.html b/templates/orange/html/mobile/user/favorites.html new file mode 100644 index 00000000..aba0bdae --- /dev/null +++ b/templates/orange/html/mobile/user/favorites.html @@ -0,0 +1,268 @@ + + + + + + + + + + + + + + +
    + +
    + + + + + + + + + + + + + + + + + +
    + +
    + + +
    + 我的书架 + +
    +
    +
    + + +
    + + +
    + +
    +
    +
    + + + + +
    + + + + + + \ No newline at end of file diff --git a/templates/orange/html/mobile/user/login.html b/templates/orange/html/mobile/user/login.html index c2048ac7..5622acb7 100644 --- a/templates/orange/html/mobile/user/login.html +++ b/templates/orange/html/mobile/user/login.html @@ -5,109 +5,114 @@ - 登录|注册 - -
    + 登录 +
    - - -
    +
    -
    +
    - +
    - 登录|注册 - - -
    +
    - -
    - + +
    +
    - + +
    + +
    +
    +
    +
    -
    如果登录名不存在,则直接注册!
    - +
    -
    +
    - - -
    - - - - - + \ No newline at end of file diff --git a/templates/orange/html/mobile/user/read_history.html b/templates/orange/html/mobile/user/read_history.html new file mode 100644 index 00000000..c11386e9 --- /dev/null +++ b/templates/orange/html/mobile/user/read_history.html @@ -0,0 +1,266 @@ + + + + + + + + + + + + + + +
    + +
    + + + + + + + + + + + + + + + + + +
    + +
    + + +
    + 阅读历史 + +
    +
    +
    + + +
    + + +
    + +
    +
    +
    + + + + +
    + + + + + + \ No newline at end of file diff --git a/templates/orange/html/mobile/user/register.html b/templates/orange/html/mobile/user/register.html new file mode 100644 index 00000000..343606dd --- /dev/null +++ b/templates/orange/html/mobile/user/register.html @@ -0,0 +1,122 @@ + + + + + + + + 注册 + +
    + + + + + +
    + +
    + + +
    + 注册 + +
    +
    + + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    + +
    + +
    +
    +
    +
    +
    + + +
    +
    +
    + + +
    +
    + +
    +
    + + + + + \ No newline at end of file diff --git a/templates/orange/html/mobile/user/userinfo.html b/templates/orange/html/mobile/user/userinfo.html new file mode 100644 index 00000000..aa665464 --- /dev/null +++ b/templates/orange/html/mobile/user/userinfo.html @@ -0,0 +1,282 @@ + + + + + + + + + + + + + + +
    + + + + + + +
    + + +
    + +
    + + +
    + 用户中心 + +
    + +
    + +
    + +
    梦入神机 + + +
    +
    账户余额:3000 屋币
    + +
    +
    + + +
    + + +
    +
    + + + + + + + +
    +
    充值
    +
    +
    +
    +
    + + + +
    +
    + + + +
    +
    我的书架
    +
    +
    +
    +
    + + + +
    +
    + + + +
    +
    阅读历史
    +
    +
    +
    +
    + + + + + + +
    + + 退出登录 +
    +
    + +
    + +
    +
    + + +
    +
    + + + + + + + \ No newline at end of file diff --git a/templates/orange/static/mobile/js/common.js b/templates/orange/static/mobile/js/common.js index a62d25c8..bc6a3ea6 100644 --- a/templates/orange/static/mobile/js/common.js +++ b/templates/orange/static/mobile/js/common.js @@ -1,3 +1,94 @@ +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; +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') { + 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,13 +103,53 @@ 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("" + + "\n" + + ""); + 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(); } @@ -45,5 +176,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/templates/orange/static/mobile/layui/css/layui.css b/templates/orange/static/mobile/layui/css/layui.css index a7258a39..7025606b 100644 --- a/templates/orange/static/mobile/layui/css/layui.css +++ b/templates/orange/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 { @@ -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 }