update
This commit is contained in:
parent
b1ded445bf
commit
a05953ec75
15
src/main/java/com/yutou/tools/utils/Tools.java
Normal file
15
src/main/java/com/yutou/tools/utils/Tools.java
Normal file
@ -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;
|
||||
}
|
||||
}
|
23
src/main/java/com/yutou/tools/web/userController.java
Normal file
23
src/main/java/com/yutou/tools/web/userController.java
Normal file
@ -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 "";
|
||||
}
|
||||
}
|
@ -1,13 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>NAS</title>
|
||||
<link rel="stylesheet" href="/layui/css/layui.css">
|
||||
</head>
|
||||
<body class="layui-layout-body">
|
||||
|
||||
<body class5="layui-layout-body">
|
||||
11
|
||||
<script src="/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.use(['layer', 'form', 'element'], function () {
|
||||
@ -18,4 +20,5 @@
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@ -17,10 +17,24 @@
|
||||
<li class="layui-nav-item"><a href="javascript:;">NAS管理</a>
|
||||
<dl class="layui-nav-child">
|
||||
<dd><a href="#">查看NAS IP</a></dd>
|
||||
<dd><a href="#">切换NAS页面</a></dd>
|
||||
<dd><a href="#">B站直播管理</a></dd>
|
||||
</dl>
|
||||
</li>
|
||||
</div>
|
||||
<li class="layui-nav-item">
|
||||
<a href="javascript:;">工具集</a>
|
||||
<dl class="layui-nav-child">
|
||||
<dd><a href="javascript:;" target="_blank">密码管理器</a></dd>
|
||||
</dl>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<a href="javascript:;">页面集</a>
|
||||
<dl class="layui-nav-child">
|
||||
<dd><a href="http://nas.yutou233.cn/" target="_blank">管理后台</a></dd>
|
||||
<dd><a href="http://bt.yutou233.cn" target="_blank">BT下载</a></dd>
|
||||
</dl>
|
||||
</li>
|
||||
<li class="layui-nav-item" id='icon'>
|
||||
<a href=""><img src="//t.cn/RCzsdCq" class="layui-nav-img">登录</a>
|
||||
<dl class="layui-nav-child">
|
||||
@ -59,6 +73,7 @@
|
||||
#icon {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.body {
|
||||
bottom: 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user