From fe6f468d38f3b9e2d86b2ce4afede72ea8cc6c81 Mon Sep 17 00:00:00 2001 From: whb <17803890193@163.com> Date: Sun, 27 Aug 2023 13:40:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=9C=80=E5=90=8E=E9=9C=80?= =?UTF-8?q?=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 46 +++--- .../course/config/MyWebMvcConfig.java | 30 ++-- .../zhiyun03/filter/LoginCheckFilter.java | 156 +++++++++--------- .../zhiyun03/filter/LoginIntercetor.java | 47 ++++++ .../user/controller/UserController.java | 36 ++-- .../zhiyun03/user/service/UserService.java | 1 + .../user/service/impl/UserServiceImpl.java | 17 +- .../utils/annotation/NoLoginCheck.java | 24 +++ .../zhiyun03/utils/interceptor/JwtUtils.java | 55 ++++++ .../utils/interceptor/LoginInterceptor.java | 52 ++++++ src/main/resources/application.yml | 7 + .../layui-v2.6.8/academicList.html | 12 +- .../layui-v2.6.8/applicationList.html | 18 +- .../layui-v2.6.8/courseList.html | 23 +-- .../layui-v2.6.8/downloadList.html | 0 .../layui-v2.6.8/gameList.html | 12 +- .../layui-v2.6.8/images/01.png | Bin .../layui-v2.6.8/images/02.png | Bin .../layui-v2.6.8/images/03.png | Bin .../layui-v2.6.8/images/04.png | Bin .../layui-v2.6.8/images/05.png | Bin .../layui-v2.6.8/images/06.png | Bin .../layui-v2.6.8/images/07.png | Bin .../layui-v2.6.8/images/08.png | Bin .../layui-v2.6.8/images/09.png | Bin .../layui-v2.6.8/images/10.png | Bin .../layui-v2.6.8/images/100.png | Bin .../layui-v2.6.8/images/101.png | Bin .../layui-v2.6.8/images/102.png | Bin .../layui-v2.6.8/images/103.png | Bin .../layui-v2.6.8/images/104.png | Bin .../layui-v2.6.8/images/105.png | Bin .../layui-v2.6.8/images/106.png | Bin .../layui-v2.6.8/images/107.png | Bin .../layui-v2.6.8/images/108.png | Bin .../layui-v2.6.8/images/109.png | Bin .../layui-v2.6.8/images/11.png | Bin .../layui-v2.6.8/images/110.png | Bin .../layui-v2.6.8/images/111.png | Bin .../layui-v2.6.8/images/112.png | Bin .../layui-v2.6.8/images/113.png | Bin .../layui-v2.6.8/images/114.png | Bin .../layui-v2.6.8/images/115.png | Bin .../layui-v2.6.8/images/116.png | Bin .../layui-v2.6.8/images/117.png | Bin .../layui-v2.6.8/images/118.png | Bin .../layui-v2.6.8/images/119.png | Bin .../layui-v2.6.8/images/12.png | Bin .../layui-v2.6.8/images/120.png | Bin .../layui-v2.6.8/images/121.png | Bin .../layui-v2.6.8/images/122.png | Bin .../layui-v2.6.8/images/123.png | Bin .../layui-v2.6.8/images/124.png | Bin .../layui-v2.6.8/images/125.png | Bin .../layui-v2.6.8/images/126.png | Bin .../layui-v2.6.8/images/127.png | Bin .../layui-v2.6.8/images/128.png | Bin .../layui-v2.6.8/images/129.png | Bin .../layui-v2.6.8/images/13.png | Bin .../layui-v2.6.8/images/130.png | Bin .../layui-v2.6.8/images/131.png | Bin .../layui-v2.6.8/images/132.png | Bin .../layui-v2.6.8/images/133.png | Bin .../layui-v2.6.8/images/134.png | Bin .../layui-v2.6.8/images/135.png | Bin .../layui-v2.6.8/images/136.png | Bin .../layui-v2.6.8/images/137.png | Bin .../layui-v2.6.8/images/138.png | Bin .../layui-v2.6.8/images/139.png | Bin .../layui-v2.6.8/images/14.png | Bin .../layui-v2.6.8/images/140.png | Bin .../layui-v2.6.8/images/141.png | Bin .../layui-v2.6.8/images/142.png | Bin .../layui-v2.6.8/images/143.png | Bin .../layui-v2.6.8/images/144.png | Bin .../layui-v2.6.8/images/145.png | Bin .../layui-v2.6.8/images/146.png | Bin .../layui-v2.6.8/images/147.png | Bin .../layui-v2.6.8/images/148.png | Bin .../layui-v2.6.8/images/149.png | Bin .../layui-v2.6.8/images/15.png | Bin .../layui-v2.6.8/images/150.png | Bin .../layui-v2.6.8/images/151.png | Bin .../layui-v2.6.8/images/152.png | Bin .../layui-v2.6.8/images/153.png | Bin .../layui-v2.6.8/images/154.png | Bin .../layui-v2.6.8/images/155.png | Bin .../layui-v2.6.8/images/156.png | Bin .../layui-v2.6.8/images/157.png | Bin .../layui-v2.6.8/images/158.png | Bin .../layui-v2.6.8/images/159.png | Bin .../layui-v2.6.8/images/16.png | Bin .../layui-v2.6.8/images/160.png | Bin .../layui-v2.6.8/images/161.png | Bin .../layui-v2.6.8/images/162.png | Bin .../layui-v2.6.8/images/163.png | Bin .../layui-v2.6.8/images/164.png | Bin .../layui-v2.6.8/images/165.png | Bin .../layui-v2.6.8/images/166.png | Bin .../layui-v2.6.8/images/167.png | Bin .../layui-v2.6.8/images/168.png | Bin .../layui-v2.6.8/images/169.png | Bin .../layui-v2.6.8/images/17.png | Bin .../layui-v2.6.8/images/170.png | Bin .../layui-v2.6.8/images/171.png | Bin .../layui-v2.6.8/images/172.png | Bin .../layui-v2.6.8/images/173.png | Bin .../layui-v2.6.8/images/174.png | Bin .../layui-v2.6.8/images/175.png | Bin .../layui-v2.6.8/images/176.png | Bin .../layui-v2.6.8/images/177.png | Bin .../layui-v2.6.8/images/178.png | Bin .../layui-v2.6.8/images/179.png | Bin .../layui-v2.6.8/images/18.png | Bin .../layui-v2.6.8/images/180.png | Bin .../layui-v2.6.8/images/181.png | Bin .../layui-v2.6.8/images/182.png | Bin .../layui-v2.6.8/images/19.png | Bin .../layui-v2.6.8/images/20.png | Bin .../layui-v2.6.8/images/21.png | Bin .../layui-v2.6.8/images/22.png | Bin .../layui-v2.6.8/images/23.png | Bin .../layui-v2.6.8/images/24.png | Bin .../layui-v2.6.8/images/25.png | Bin .../layui-v2.6.8/images/26.png | Bin .../layui-v2.6.8/images/27.png | Bin .../layui-v2.6.8/images/28.png | Bin .../layui-v2.6.8/images/29.png | Bin .../layui-v2.6.8/images/30.png | Bin .../layui-v2.6.8/images/31.png | Bin .../layui-v2.6.8/images/32.png | Bin .../layui-v2.6.8/images/33.png | Bin .../layui-v2.6.8/images/34.png | Bin .../layui-v2.6.8/images/35.png | Bin .../layui-v2.6.8/images/36.png | Bin .../layui-v2.6.8/images/37.png | Bin .../layui-v2.6.8/images/38.png | Bin .../layui-v2.6.8/images/39.png | Bin .../layui-v2.6.8/images/40.png | Bin .../layui-v2.6.8/images/41.png | Bin .../layui-v2.6.8/images/42.png | Bin .../layui-v2.6.8/images/43.png | Bin .../layui-v2.6.8/images/44.png | Bin .../layui-v2.6.8/images/45.png | Bin .../layui-v2.6.8/images/46.png | Bin .../layui-v2.6.8/images/47.png | Bin .../layui-v2.6.8/images/48.png | Bin .../layui-v2.6.8/images/49.png | Bin .../layui-v2.6.8/images/50.png | Bin .../layui-v2.6.8/images/51.png | Bin .../layui-v2.6.8/images/52.png | Bin .../layui-v2.6.8/images/53.png | Bin .../layui-v2.6.8/images/54.png | Bin .../layui-v2.6.8/images/55.png | Bin .../layui-v2.6.8/images/56.png | Bin .../layui-v2.6.8/images/57.png | Bin .../layui-v2.6.8/images/58.png | Bin .../layui-v2.6.8/images/59.png | Bin .../layui-v2.6.8/images/60.png | Bin .../layui-v2.6.8/images/61.png | Bin .../layui-v2.6.8/images/62.png | Bin .../layui-v2.6.8/images/63.png | Bin .../layui-v2.6.8/images/64.png | Bin .../layui-v2.6.8/images/65.png | Bin .../layui-v2.6.8/images/66.png | Bin .../layui-v2.6.8/images/67.png | Bin .../layui-v2.6.8/images/68.png | Bin .../layui-v2.6.8/images/69.png | Bin .../layui-v2.6.8/images/70.png | Bin .../layui-v2.6.8/images/71.png | Bin .../layui-v2.6.8/images/72.png | Bin .../layui-v2.6.8/images/73.png | Bin .../layui-v2.6.8/images/74.png | Bin .../layui-v2.6.8/images/75.png | Bin .../layui-v2.6.8/images/76.png | Bin .../layui-v2.6.8/images/77.png | Bin .../layui-v2.6.8/images/78.png | Bin .../layui-v2.6.8/images/79.png | Bin .../layui-v2.6.8/images/80.png | Bin .../layui-v2.6.8/images/81.png | Bin .../layui-v2.6.8/images/82.png | Bin .../layui-v2.6.8/images/83.png | Bin .../layui-v2.6.8/images/84.png | Bin .../layui-v2.6.8/images/85.png | Bin .../layui-v2.6.8/images/86.png | Bin .../layui-v2.6.8/images/87.png | Bin .../layui-v2.6.8/images/88.png | Bin .../layui-v2.6.8/images/89.png | Bin .../layui-v2.6.8/images/90.png | Bin .../layui-v2.6.8/images/91.png | Bin .../layui-v2.6.8/images/92.png | Bin .../layui-v2.6.8/images/93.png | Bin .../layui-v2.6.8/images/94.png | Bin .../layui-v2.6.8/images/95.png | Bin .../layui-v2.6.8/images/96.png | Bin .../layui-v2.6.8/images/97.png | Bin .../layui-v2.6.8/images/98.png | Bin .../layui-v2.6.8/images/99.png | Bin .../layui-v2.6.8/index.html | 56 +++---- .../layui-v2.6.8/inviteList.html | 0 .../layui-v2.6.8/knowledgeList.html | 10 +- .../layui-v2.6.8/layui/css/admin.css | 0 .../layui-v2.6.8/layui/css/layui.css | 2 +- .../layui-v2.6.8/layui/css/log.css | 0 .../layui-v2.6.8/layui/css/modules/code.css | 0 .../css/modules/laydate/default/laydate.css | 0 .../css/modules/layer/default/icon-ext.png | Bin .../layui/css/modules/layer/default/icon.png | Bin .../layui/css/modules/layer/default/layer.css | 0 .../css/modules/layer/default/loading-0.gif | Bin .../css/modules/layer/default/loading-1.gif | Bin .../css/modules/layer/default/loading-2.gif | Bin .../layui-v2.6.8/layui/font/iconfont.eot | Bin .../layui-v2.6.8/layui/font/iconfont.svg | 0 .../layui-v2.6.8/layui/font/iconfont.ttf | Bin .../layui-v2.6.8/layui/font/iconfont.woff | Bin .../layui-v2.6.8/layui/font/iconfont.woff2 | Bin .../layui-v2.6.8/layui/layui.js | 0 .../layui-v2.6.8/login.html | 20 +-- .../layui-v2.6.8/serveList.html | 0 .../layui-v2.6.8/textualList.html | 8 + 221 files changed, 414 insertions(+), 218 deletions(-) create mode 100644 src/main/java/com/zhiyun/zhiyun03/filter/LoginIntercetor.java create mode 100644 src/main/java/com/zhiyun/zhiyun03/utils/annotation/NoLoginCheck.java create mode 100644 src/main/java/com/zhiyun/zhiyun03/utils/interceptor/JwtUtils.java create mode 100644 src/main/java/com/zhiyun/zhiyun03/utils/interceptor/LoginInterceptor.java rename src/main/resources/{templates => static}/layui-v2.6.8/academicList.html (99%) rename src/main/resources/{templates => static}/layui-v2.6.8/applicationList.html (98%) rename src/main/resources/{templates => static}/layui-v2.6.8/courseList.html (99%) rename src/main/resources/{templates => static}/layui-v2.6.8/downloadList.html (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/gameList.html (98%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/01.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/02.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/03.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/04.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/05.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/06.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/07.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/08.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/09.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/10.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/100.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/101.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/102.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/103.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/104.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/105.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/106.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/107.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/108.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/109.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/11.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/110.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/111.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/112.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/113.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/114.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/115.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/116.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/117.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/118.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/119.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/12.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/120.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/121.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/122.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/123.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/124.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/125.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/126.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/127.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/128.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/129.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/13.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/130.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/131.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/132.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/133.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/134.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/135.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/136.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/137.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/138.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/139.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/14.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/140.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/141.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/142.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/143.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/144.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/145.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/146.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/147.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/148.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/149.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/15.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/150.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/151.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/152.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/153.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/154.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/155.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/156.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/157.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/158.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/159.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/16.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/160.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/161.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/162.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/163.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/164.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/165.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/166.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/167.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/168.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/169.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/17.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/170.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/171.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/172.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/173.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/174.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/175.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/176.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/177.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/178.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/179.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/18.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/180.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/181.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/182.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/19.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/20.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/21.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/22.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/23.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/24.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/25.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/26.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/27.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/28.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/29.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/30.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/31.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/32.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/33.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/34.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/35.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/36.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/37.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/38.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/39.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/40.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/41.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/42.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/43.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/44.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/45.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/46.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/47.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/48.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/49.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/50.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/51.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/52.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/53.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/54.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/55.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/56.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/57.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/58.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/59.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/60.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/61.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/62.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/63.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/64.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/65.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/66.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/67.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/68.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/69.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/70.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/71.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/72.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/73.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/74.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/75.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/76.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/77.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/78.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/79.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/80.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/81.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/82.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/83.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/84.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/85.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/86.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/87.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/88.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/89.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/90.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/91.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/92.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/93.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/94.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/95.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/96.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/97.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/98.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/images/99.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/index.html (75%) rename src/main/resources/{templates => static}/layui-v2.6.8/inviteList.html (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/knowledgeList.html (98%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/css/admin.css (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/css/layui.css (78%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/css/log.css (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/css/modules/code.css (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/css/modules/laydate/default/laydate.css (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/css/modules/layer/default/icon-ext.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/css/modules/layer/default/icon.png (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/css/modules/layer/default/layer.css (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/css/modules/layer/default/loading-0.gif (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/css/modules/layer/default/loading-1.gif (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/css/modules/layer/default/loading-2.gif (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/font/iconfont.eot (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/font/iconfont.svg (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/font/iconfont.ttf (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/font/iconfont.woff (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/font/iconfont.woff2 (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/layui/layui.js (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/login.html (70%) rename src/main/resources/{templates => static}/layui-v2.6.8/serveList.html (100%) rename src/main/resources/{templates => static}/layui-v2.6.8/textualList.html (99%) diff --git a/pom.xml b/pom.xml index 1bfb37a..b2100c2 100644 --- a/pom.xml +++ b/pom.xml @@ -103,47 +103,43 @@ commons-fileupload 1.4 - - - - - - - - com.auth0 - java-jwt - 3.19.2 + io.jsonwebtoken + jjwt + 0.9.1 - - - - src/main/resources + true + + static/**/*.woff + static/**/*.woff2 + static/**/*.ttf + + + + src/main/resources + false - **/*.* + static/**/*.woff + static/**/*.woff2 + static/**/*.ttf - true - + + org.apache.maven.plugins + maven-resources-plugin + 3.1.0 + org.springframework.boot spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - diff --git a/src/main/java/com/zhiyun/zhiyun03/course/config/MyWebMvcConfig.java b/src/main/java/com/zhiyun/zhiyun03/course/config/MyWebMvcConfig.java index 40ec2db..db96362 100644 --- a/src/main/java/com/zhiyun/zhiyun03/course/config/MyWebMvcConfig.java +++ b/src/main/java/com/zhiyun/zhiyun03/course/config/MyWebMvcConfig.java @@ -1,4 +1,6 @@ package com.zhiyun.zhiyun03.course.config; + +import com.zhiyun.zhiyun03.filter.LoginIntercetor; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; @@ -9,21 +11,29 @@ public class MyWebMvcConfig extends WebMvcConfigurationSupport { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("/**").addResourceLocations( - "classpath:/static/"); + registry.addResourceHandler("/**").addResourceLocations("classpath:/static/"); // swagger静态资源相关 - registry.addResourceHandler("swagger-ui.html", "doc.html").addResourceLocations( - "classpath:/META-INF/resources/"); - registry.addResourceHandler("/webjars/**").addResourceLocations( - "classpath:/META-INF/resources/webjars/"); + registry.addResourceHandler("swagger-ui.html", "doc.html").addResourceLocations("classpath:/META-INF/resources/"); + registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); // 针对swagger自带的静态资源 - registry.addResourceHandler("/swagger-ui/**").addResourceLocations( - "classpath:/META-INF/resources/webjars/springfox-swagger-ui/"); + registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/"); + registry.addResourceHandler("/**").addResourceLocations("classpath:/static/layui-v2.6.8/"); super.addResourceHandlers(registry); } - - +// 注解拦截器 + @Override + protected void addInterceptors(InterceptorRegistry registry) { + // 配置需要拦截的所有访问请求 + String[] addPathPatterns = {"/**"}; + // 配置要排除的路径 + String[] excludePathPatterns = {"/login.html", "/images/","/layui/**/","/user/login","/favicon.ico","/iconfont.*", + "/confont.*" + }; + // 注册拦截器 + registry.addInterceptor(new LoginIntercetor()).addPathPatterns(addPathPatterns).excludePathPatterns(excludePathPatterns); + super.addInterceptors(registry); + } } diff --git a/src/main/java/com/zhiyun/zhiyun03/filter/LoginCheckFilter.java b/src/main/java/com/zhiyun/zhiyun03/filter/LoginCheckFilter.java index 79e60ec..0012ae1 100644 --- a/src/main/java/com/zhiyun/zhiyun03/filter/LoginCheckFilter.java +++ b/src/main/java/com/zhiyun/zhiyun03/filter/LoginCheckFilter.java @@ -1,79 +1,79 @@ -package com.zhiyun.zhiyun03.filter; - -import com.alibaba.fastjson2.JSON; -import com.zhiyun.zhiyun03.utils.common.JsonResult; -import com.zhiyun.zhiyun03.utils.common.ResultCode; -import lombok.extern.slf4j.Slf4j; -import org.springframework.util.AntPathMatcher; - -import javax.servlet.*; -import javax.servlet.annotation.WebFilter; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * @description: 检查用户是否已经完成登录 - * @author: Jie - * @date: 2022/8/10 9:48 - **/ +//package com.zhiyun.zhiyun03.filter; +// +//import com.alibaba.fastjson2.JSON; +//import com.zhiyun.zhiyun03.utils.common.JsonResult; +//import com.zhiyun.zhiyun03.utils.common.ResultCode; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.util.AntPathMatcher; +// +//import javax.servlet.*; +//import javax.servlet.annotation.WebFilter; +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +//import java.io.IOException; +// +///** +// * @description: 检查用户是否已经完成登录 +// * @author: Jie +// * @date: 2022/8/10 9:48 +// **/ //@WebFilter(filterName = "LoginCheckFilter", urlPatterns = "/*") -@Slf4j -public class LoginCheckFilter implements Filter { - - /** - * 路径匹配器,支持通配符 - */ - public static final AntPathMatcher PATH_MATCHER = new AntPathMatcher(); - - @Override - public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { - HttpServletRequest request = (HttpServletRequest) servletRequest; - HttpServletResponse response = (HttpServletResponse) servletResponse; - String requestURI = request.getRequestURI(); - log.info("拦截到请求,{}", requestURI); - - //2、判断本次请求是否需要处理 - //定义不需要处理的请求路径 - String[] urls = new String[]{ - "/user/login", - "/user/logout", - "/layui/**", - "/front/**" - }; - boolean check = check(urls, requestURI); - - //3、如果不需要处理,则直接放行 - if (check) { - log.info("本次请求{}不需要处理", requestURI); - filterChain.doFilter(request, response); - return; - } - - //取出token - String token = request.getHeader("token"); - //第一次登录没有token,给null会报错,所以我们判断一下token是否为空,为空给一个空串 - //三元运算 - token = token==null?"":token; - //4、判断登录状态,如果已登录,则直接放行 - if (token!= null && token!="") { -// log.info("用户已登录,用户id为:{}", request.getSession().getAttribute("USER")); - filterChain.doFilter(request, response); - return; - } - log.info("用户未登录"); - //5、如果未登录则返回未登录结果,通过输出流方式向客户端页面响应数据 - response.getWriter().write(JSON.toJSONString(JsonResult.error(ResultCode.ERROR,"用户未登录"))); - return; - } - - public boolean check(String[] urls, String requestURI) { - for (String url : urls) { - boolean match = PATH_MATCHER.match(url, requestURI); - if (match) { - return true; - } - } - return false; - } -} \ No newline at end of file +//@Slf4j +//public class LoginCheckFilter implements Filter { +// +// /** +// * 路径匹配器,支持通配符 +// */ +// public static final AntPathMatcher PATH_MATCHER = new AntPathMatcher(); +// +// @Override +// public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { +// HttpServletRequest request = (HttpServletRequest) servletRequest; +// HttpServletResponse response = (HttpServletResponse) servletResponse; +// String requestURI = request.getRequestURI(); +// log.info("拦截到请求,{}", requestURI); +// +// //2、判断本次请求是否需要处理 +// //定义不需要处理的请求路径 +// String[] urls = new String[]{ +// "/login.html", "/images/", +// "/layui/**", +// "/front/**", +// "/user/login" +// }; +// boolean check = check(urls, requestURI); +// +// //3、如果不需要处理,则直接放行 +// if (check) { +// log.info("本次请求{}不需要处理", requestURI); +// filterChain.doFilter(request, response); +// return; +// } +// +// //取出token +// String token = request.getHeader("token"); +// //第一次登录没有token,给null会报错,所以我们判断一下token是否为空,为空给一个空串 +// //三元运算 +// token = token==null?"":token; +// //4、判断登录状态,如果已登录,则直接放行 +// if (token!= null && token!="") { +//// log.info("用户已登录,用户id为:{}", request.getSession().getAttribute("USER")); +// filterChain.doFilter(request, response); +// return; +// } +// log.info("用户未登录"); +// //5、如果未登录则返回未登录结果,通过输出流方式向客户端页面响应数据 +// response.getWriter().write(JSON.toJSONString(JsonResult.error(ResultCode.ERROR,"用户未登录"))); +// return; +// } +// +// public boolean check(String[] urls, String requestURI) { +// for (String url : urls) { +// boolean match = PATH_MATCHER.match(url, requestURI); +// if (match) { +// return true; +// } +// } +// return false; +// } +//} \ No newline at end of file diff --git a/src/main/java/com/zhiyun/zhiyun03/filter/LoginIntercetor.java b/src/main/java/com/zhiyun/zhiyun03/filter/LoginIntercetor.java new file mode 100644 index 0000000..2a308d0 --- /dev/null +++ b/src/main/java/com/zhiyun/zhiyun03/filter/LoginIntercetor.java @@ -0,0 +1,47 @@ +package com.zhiyun.zhiyun03.filter; + +import com.zhiyun.zhiyun03.utils.annotation.NoLoginCheck; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.HandlerInterceptor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.lang.reflect.Method; +import java.util.HashSet; +import java.util.Set; + +/** + * @author yangl + * @version 1.0 + * @date 2023/5/24 11:37 + */ + +public class LoginIntercetor implements HandlerInterceptor { + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + + if (handler instanceof HandlerMethod){ + HandlerMethod handlerMethod = (HandlerMethod) handler; + Method method = handlerMethod.getMethod(); + if (method.isAnnotationPresent(NoLoginCheck.class)) { + return true; + } + } + + //代码走到这,都是要拦截的资源路径 + //如果用户登录过了,也要放行 + HttpSession session = request.getSession(); + //判断 + if(session.getAttribute("user") != null){ + //肯定登录过了 + return true; + }else{ + //未登录去登录页面 + response.sendRedirect(request.getContextPath() + "/login.html"); + return false; + } + + } +} diff --git a/src/main/java/com/zhiyun/zhiyun03/user/controller/UserController.java b/src/main/java/com/zhiyun/zhiyun03/user/controller/UserController.java index 145fc70..ca53c77 100644 --- a/src/main/java/com/zhiyun/zhiyun03/user/controller/UserController.java +++ b/src/main/java/com/zhiyun/zhiyun03/user/controller/UserController.java @@ -2,12 +2,17 @@ package com.zhiyun.zhiyun03.user.controller; import com.zhiyun.zhiyun03.user.entity.User; import com.zhiyun.zhiyun03.user.service.UserService; +import com.zhiyun.zhiyun03.utils.annotation.NoLoginCheck; import com.zhiyun.zhiyun03.utils.common.JsonResult; import com.zhiyun.zhiyun03.utils.common.ResultCode; import io.swagger.annotations.Api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; + import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.IOException; @Api("用户") @RestController @@ -16,31 +21,30 @@ public class UserController { @Autowired UserService userService; + @NoLoginCheck @RequestMapping(path = "/login") - public JsonResult login(HttpServletRequest request, @RequestParam(name = "userCode") String username, @RequestParam(name = "password") String password) { + public JsonResult login(HttpSession session, @RequestParam(name = "userName") String username, @RequestParam(name = "password") String password) { if (username.isEmpty() || password.isEmpty()) { return JsonResult.error(ResultCode.NO_NULL_ERROR, "账号或密码不能为空"); } - User login = userService.login(username, password); - if (login != null) { + User user = userService.login(username, password); + if (user != null) { // String token = UUID.randomUUID()+""; - request.getSession().setAttribute("USER", login.getUserName()); + session.setAttribute("user", user); - return JsonResult.success(login); + return JsonResult.success(user); } return JsonResult.error(ResultCode.USER_ACCOUNT_ERROR, "账号或密码错误"); } - @GetMapping("/getUsername") - public JsonResult getUsername(HttpServletRequest request){ - Object user = request.getSession().getAttribute("USER"); - return JsonResult.success(user); - } - - @PostMapping("/logout") - public JsonResult loginOut(HttpServletRequest request){ - // 去除session - request.getSession().removeAttribute("USER"); - return JsonResult.success("退出成功"); + //退出 + @RequestMapping("/logout") + public void logout(HttpServletRequest request, HttpServletResponse response) throws IOException { + //退出:销毁session或者从session中清除登录信息 -> 跳转页面 + HttpSession session = request.getSession(false); + session.removeAttribute("user");//从session中清除登录信息 + session.invalidate();//销毁session + //跳转页面 + response.sendRedirect(request.getContextPath() + "/login.html"); } } diff --git a/src/main/java/com/zhiyun/zhiyun03/user/service/UserService.java b/src/main/java/com/zhiyun/zhiyun03/user/service/UserService.java index 10c56f4..458ead8 100644 --- a/src/main/java/com/zhiyun/zhiyun03/user/service/UserService.java +++ b/src/main/java/com/zhiyun/zhiyun03/user/service/UserService.java @@ -5,6 +5,7 @@ import com.zhiyun.zhiyun03.user.entity.User; import org.springframework.http.HttpRequest; public interface UserService extends IService { +// String login(String userName, String password); User login(String userName, String password); } diff --git a/src/main/java/com/zhiyun/zhiyun03/user/service/impl/UserServiceImpl.java b/src/main/java/com/zhiyun/zhiyun03/user/service/impl/UserServiceImpl.java index eed754f..75cd050 100644 --- a/src/main/java/com/zhiyun/zhiyun03/user/service/impl/UserServiceImpl.java +++ b/src/main/java/com/zhiyun/zhiyun03/user/service/impl/UserServiceImpl.java @@ -1,20 +1,35 @@ package com.zhiyun.zhiyun03.user.service.impl; -import com.auth0.jwt.JWT; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zhiyun.zhiyun03.user.entity.User; import com.zhiyun.zhiyun03.user.mapper.UserMapper; import com.zhiyun.zhiyun03.user.service.UserService; +import com.zhiyun.zhiyun03.utils.interceptor.JwtUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.HashMap; @Service public class UserServiceImpl extends ServiceImpl implements UserService { @Resource UserMapper userMapper; +// @Override +// public String login(String userName, String password) { +// QueryWrapper qwu=new QueryWrapper<>(); +// qwu.lambda().eq(User::getUserName,userName).eq(User::getPassword,password); +// User login = userMapper.selectOne(qwu); +// HashMap map = new HashMap<>(); +// map.put("uid",login.getId()); +// map.put("username",login.getUserName()); +// String token = JwtUtils.createJwt(map); +// System.out.println(token); +// +// return token; +// } + @Override public User login(String userName, String password) { QueryWrapper qwu=new QueryWrapper<>(); diff --git a/src/main/java/com/zhiyun/zhiyun03/utils/annotation/NoLoginCheck.java b/src/main/java/com/zhiyun/zhiyun03/utils/annotation/NoLoginCheck.java new file mode 100644 index 0000000..a9c16d9 --- /dev/null +++ b/src/main/java/com/zhiyun/zhiyun03/utils/annotation/NoLoginCheck.java @@ -0,0 +1,24 @@ +package com.zhiyun.zhiyun03.utils.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 自定义的注解 + * 如果使用该注解修饰控制器方法,那么该方法可以直接访问,不需要进行登录验证 + * + * @Target 设置自定义注解可以作用于哪些目标 + * ElementType.METHOD 作用于方法 + * ElementType.TYPE 作用于类、接口、枚举等 + * ElementType.FIELD 作用于属性 + * @Retention 注解生效策略 + * RetentionPolicy.SOURCE 源码中生效,编译后的class文件没有对应的注解 + * RetentionPolicy.RUNTIME class文件中有注解,通过发射进行处理 + * RetentionPolicy.CLASS 编译后的class文件中有注解 + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface NoLoginCheck { +} diff --git a/src/main/java/com/zhiyun/zhiyun03/utils/interceptor/JwtUtils.java b/src/main/java/com/zhiyun/zhiyun03/utils/interceptor/JwtUtils.java new file mode 100644 index 0000000..d6a27fe --- /dev/null +++ b/src/main/java/com/zhiyun/zhiyun03/utils/interceptor/JwtUtils.java @@ -0,0 +1,55 @@ +package com.zhiyun.zhiyun03.utils.interceptor; + +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.JwtBuilder; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; + +import java.util.Date; +import java.util.Map; + +/** + * jwt工具类 + */ +public class JwtUtils { + // 密钥 + private final static String secret = "123456789qwertyui"; + + /** + * 生成jwt + * + * @param claims + * @return + */ + public static String createJwt(Map claims) { + + // 签名算法,表示sha256 + SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256; + + //构造jwt + JwtBuilder builder = Jwts.builder()//.setHeaderParam("type","jwt") // 设置头 + .setClaims(claims) // 设置载荷 + .setExpiration(new Date(System.currentTimeMillis() + 1800000)) // 设置过期时间 + .signWith(signatureAlgorithm, secret); // 使用指定算法设置签名 + //生成jwt + return builder.compact(); + } + + /** + * 解析,如果不符合,报异常 + * + * @param jsonWebToken + * @return + */ + public static Claims parseJWT(String jsonWebToken) { + try { + Claims claims = Jwts.parser() + .setSigningKey(secret) + .parseClaimsJws(jsonWebToken).getBody(); + return claims; + } catch (Exception ex) { + throw new RuntimeException(ex.getMessage()); + } + } +} + diff --git a/src/main/java/com/zhiyun/zhiyun03/utils/interceptor/LoginInterceptor.java b/src/main/java/com/zhiyun/zhiyun03/utils/interceptor/LoginInterceptor.java new file mode 100644 index 0000000..c73f2e8 --- /dev/null +++ b/src/main/java/com/zhiyun/zhiyun03/utils/interceptor/LoginInterceptor.java @@ -0,0 +1,52 @@ +//package com.zhiyun.zhiyun03.utils.interceptor; +// +//import com.zhiyun.zhiyun03.utils.annotation.NoLoginCheck; +//import com.zhiyun.zhiyun03.utils.exception.ServiceException; +//import io.jsonwebtoken.Claims; +//import org.springframework.util.StringUtils; +//import org.springframework.web.method.HandlerMethod; +//import org.springframework.web.servlet.HandlerInterceptor; +// +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +//import java.lang.reflect.Method; +// +//public class LoginInterceptor implements HandlerInterceptor { +// +// @Override +// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { +// +// // spring中,将访问的控制器方法封装到HandlerMethod对象中 +// // 拦截器中,handler参数,表示控制器方法的对象 +// HandlerMethod handlerMethod = (HandlerMethod) handler; +// +// Method method = handlerMethod.getMethod(); +// // 判断控制器方法是否使用了@NoLoginCheck注解 +// // 如果使用了该注解,直接放行,不需要通过token进行登录验证 +// if (method.isAnnotationPresent(NoLoginCheck.class)) { +// return true; +// } +// +// String requestURI = request.getRequestURI(); +// +//// 获取token,token值一般放在请求头中,一般会将token值放在Authorization的请求头中 +// String token = request.getHeader("Authorization"); +// if (!StringUtils.hasLength(token) && token == null) { +//// request.getRequestDispatcher("/login.html.bak1.bak").forward(request,response); +// response.sendRedirect(request.getContextPath() + "/login.html"); +// throw new ServiceException("403", "请先进行登录操作"); +// } +// Claims claims = JwtUtils.parseJWT(token); +// Integer uid = (Integer) claims.get("uid"); +// if (uid == null) { +// response.sendRedirect(request.getContextPath() + "/login.html"); +//// request.getRequestDispatcher("/login.html.bak1.bak").forward(request,response); +// throw new ServiceException("403", "请先进行登录操作"); +// } +// return true; +// } +// +//} +// +// +// diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 8f27ab5..8dcefb3 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -30,6 +30,13 @@ spring: multipart: max-file-size: 50MB max-request-size: 50MB + web: + resources: + static-locations: classpath:/static/ + mvc: + static-path-pattern: /** + + # mybatis plus的配置和mybatis类似,之前在mybatis的配置,使用mybtis-plus替换 diff --git a/src/main/resources/templates/layui-v2.6.8/academicList.html b/src/main/resources/static/layui-v2.6.8/academicList.html similarity index 99% rename from src/main/resources/templates/layui-v2.6.8/academicList.html rename to src/main/resources/static/layui-v2.6.8/academicList.html index b4be222..c697606 100644 --- a/src/main/resources/templates/layui-v2.6.8/academicList.html +++ b/src/main/resources/static/layui-v2.6.8/academicList.html @@ -6,7 +6,7 @@ - + @@ -67,11 +67,11 @@ } ,cols: [[ {type: 'checkbox', fixed: 'left'} - ,{field:'id', title:'编号', width:250, sort: true, } - ,{field:'academicName', title:'学术名称', width:250} - ,{field:'academicBrief', title:'学术简介', width:250} - ,{field:'academicUrl', title:'超链接', width:250} - ,{field:'dirName', title:'归属目录', width:250} + ,{field:'id', title:'编号', width:300, sort: true, } + ,{field:'academicName', title:'学术名称', width:300} + ,{field:'academicBrief', title:'学术简介', width:300} + ,{field:'academicUrl', title:'超链接', width:300} + ,{field:'dirName', title:'归属目录', width:300} ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150} ]] ,page: true diff --git a/src/main/resources/templates/layui-v2.6.8/applicationList.html b/src/main/resources/static/layui-v2.6.8/applicationList.html similarity index 98% rename from src/main/resources/templates/layui-v2.6.8/applicationList.html rename to src/main/resources/static/layui-v2.6.8/applicationList.html index baf70e5..6780040 100644 --- a/src/main/resources/templates/layui-v2.6.8/applicationList.html +++ b/src/main/resources/static/layui-v2.6.8/applicationList.html @@ -68,11 +68,11 @@ } , cols: [[ { type: 'checkbox', fixed: 'left' } - ,{field:'id', title:'编号', width:250, sort: true, } - ,{field:'appName', title:'应用名称', width:250} - ,{field:'appBrief', title:'应用简介', width:250} - ,{field:'appUrl', title:'超链接', width:250} - ,{field:'dirName', title:'归属目录', width:250} + ,{field:'id', title:'编号', width:300, sort: true, } + ,{field:'appName', title:'应用名称', width:300} + ,{field:'appBrief', title:'应用简介', width:300} + ,{field:'appUrl', title:'超链接', width:300} + ,{field:'dirName', title:'归属目录', width:300} , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 150 } ]] , page: true @@ -204,6 +204,14 @@ }, }) + $.each($(".icon-swiper .swiper-slide>img"), function (){ + var src = $(this).attr('src') + if(data.appIcon === src) { + const parentEl = $(this).parent('.swiper-slide') + parentEl.addClass('active') + } + }) + $(".icon-swiper").on('click', '.swiper-slide>img', function (event) { const parentEl = $(this).parent('.swiper-slide') const siblingsEl = $(parentEl).siblings('.swiper-slide') diff --git a/src/main/resources/templates/layui-v2.6.8/courseList.html b/src/main/resources/static/layui-v2.6.8/courseList.html similarity index 99% rename from src/main/resources/templates/layui-v2.6.8/courseList.html rename to src/main/resources/static/layui-v2.6.8/courseList.html index 1c9714d..a8270b4 100644 --- a/src/main/resources/templates/layui-v2.6.8/courseList.html +++ b/src/main/resources/static/layui-v2.6.8/courseList.html @@ -31,34 +31,29 @@ 删除 - + + +
@@ -49,16 +58,12 @@
-
- - + - \ No newline at end of file diff --git a/src/main/resources/templates/layui-v2.6.8/inviteList.html b/src/main/resources/static/layui-v2.6.8/inviteList.html similarity index 100% rename from src/main/resources/templates/layui-v2.6.8/inviteList.html rename to src/main/resources/static/layui-v2.6.8/inviteList.html diff --git a/src/main/resources/templates/layui-v2.6.8/knowledgeList.html b/src/main/resources/static/layui-v2.6.8/knowledgeList.html similarity index 98% rename from src/main/resources/templates/layui-v2.6.8/knowledgeList.html rename to src/main/resources/static/layui-v2.6.8/knowledgeList.html index cd34b60..2afc3aa 100644 --- a/src/main/resources/templates/layui-v2.6.8/knowledgeList.html +++ b/src/main/resources/static/layui-v2.6.8/knowledgeList.html @@ -6,7 +6,7 @@ - +