From a05953ec758924971da06825cc129276da2565e0 Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Thu, 16 Apr 2020 01:53:25 +0800 Subject: [PATCH] update --- .../java/com/yutou/tools/utils/Tools.java | 15 +++++++ .../com/yutou/tools/web/userController.java | 23 +++++++++++ web/html/body/nas.html | 31 ++++++++------- web/index.html | 39 +++++++++++++------ 4 files changed, 82 insertions(+), 26 deletions(-) create mode 100644 src/main/java/com/yutou/tools/utils/Tools.java create mode 100644 src/main/java/com/yutou/tools/web/userController.java diff --git a/src/main/java/com/yutou/tools/utils/Tools.java b/src/main/java/com/yutou/tools/utils/Tools.java new file mode 100644 index 0000000..c9b0100 --- /dev/null +++ b/src/main/java/com/yutou/tools/utils/Tools.java @@ -0,0 +1,15 @@ +package com.yutou.tools.utils; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; + +public class Tools { + public static Cookie getCookie(HttpServletRequest request,String key){ + for (Cookie cookie : request.getCookies()) { + if(cookie.getName().equals(key)){ + return cookie; + } + } + return null; + } +} diff --git a/src/main/java/com/yutou/tools/web/userController.java b/src/main/java/com/yutou/tools/web/userController.java new file mode 100644 index 0000000..f923665 --- /dev/null +++ b/src/main/java/com/yutou/tools/web/userController.java @@ -0,0 +1,23 @@ +package com.yutou.tools.web; + +import com.alibaba.fastjson.JSONObject; +import com.yutou.tools.utils.Tools; +import org.springframework.stereotype.Controller; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; + +@Controller +public class userController { + + public String getLoginState(HttpServletRequest request){ + JSONObject json=new JSONObject(); + Cookie cookie= Tools.getCookie(request,"user"); + if(cookie==null){ + json.put("code",-1); + json.put("msg","未登录"); + return json.toJSONString(); + } + return ""; + } +} diff --git a/web/html/body/nas.html b/web/html/body/nas.html index acd546d..f0ac369 100644 --- a/web/html/body/nas.html +++ b/web/html/body/nas.html @@ -1,21 +1,24 @@ - - - - NAS - - - - - - + - - + + + + \ No newline at end of file diff --git a/web/index.html b/web/index.html index 546ad0b..78b2d34 100644 --- a/web/index.html +++ b/web/index.html @@ -15,12 +15,26 @@
  • 博客
  • NAS管理 -
    -
    查看NAS IP
    -
    B站直播管理
    -
    +
    +
    查看NAS IP
    +
    切换NAS页面
    +
    B站直播管理
    +
  • +
  • + 工具集 +
    +
    密码管理器
    +
    +
  • +
  • + 页面集 +
    +
    管理后台
    +
    BT下载
    +
    +
  • 登录
    @@ -31,18 +45,18 @@
  • - -
    - + +
    +
    -