From d99fa8a6d13bb0f4d7a7d9e3ee48912e273b7d88 Mon Sep 17 00:00:00 2001 From: sxile <3440626@qq.com> Date: Tue, 12 Nov 2019 13:49:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=9C=A8=E7=BA=BF=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E4=B8=BB=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/SysIndexController.java | 7 + .../main/resources/static/ruoyi/js/common.js | 40 ++- .../src/main/resources/templates/index.html | 335 ++++++++++-------- .../src/main/resources/templates/skin.html | 146 ++++++++ 4 files changed, 364 insertions(+), 164 deletions(-) create mode 100644 ruoyi-admin/src/main/resources/templates/skin.html diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java index f9c0c9f..3f78e74 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java @@ -38,6 +38,13 @@ public class SysIndexController extends BaseController return "index"; } + // 切换主题 + @GetMapping("/system/switchSkin") + public String switchSkin(ModelMap mmap) + { + return "skin"; + } + // 系统介绍 @GetMapping("/system/main") public String main(ModelMap mmap) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js index a2ecca7..65f2d86 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js @@ -3,6 +3,14 @@ * Copyright (c) 2019 ruoyi */ $(function() { + + // layer扩展皮肤 + if (window.layer !== undefined) { + layer.config({ + extend: 'moon/style.css', + skin: 'layer-ext-moon' + }); + } // select2复选框事件绑定 if ($.fn.select2 !== undefined) { $.fn.select2.defaults.set( "theme", "bootstrap" ); @@ -225,18 +233,34 @@ function createMenuItem(dataUrl, menuName) { //日志打印封装处理 var log = { - log: function (msg) { - console.log(msg); + log: function(msg) { + console.log(msg); }, info: function(msg) { - console.info(msg); + console.info(msg); }, warn: function(msg) { - console.warn(msg); + console.warn(msg); }, error: function(msg) { - console.error(msg); - } + console.error(msg); + } +}; + +//本地缓存处理 +var storage = { + set: function(key, value) { + window.localStorage.setItem(key, value); + }, + get: function(key) { + return window.localStorage.getItem(key); + }, + remove: function(key) { + window.localStorage.removeItem(key); + }, + clear: function() { + window.localStorage.clear(); + } }; /** 设置全局ajax处理 */ @@ -253,7 +277,3 @@ $.ajaxSetup({ } } }); -layer.config({ - extend: 'moon/style.css', - skin: 'layer-ext-moon' -}); diff --git a/ruoyi-admin/src/main/resources/templates/index.html b/ruoyi-admin/src/main/resources/templates/index.html index f9d2778..5a75977 100644 --- a/ruoyi-admin/src/main/resources/templates/index.html +++ b/ruoyi-admin/src/main/resources/templates/index.html @@ -1,63 +1,63 @@ - - - - 若依系统首页 - - - - - - - - - + + + + 若依系统首页 + + + + + + + + + - +
- - + + + +
+ -
- - - - 刷新 -
- - - -
- -
- -
- + + +
+
+ + + + 刷新 +
+ + + +
+ +
+ + + @@ -236,15 +240,38 @@ + - - + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/skin.html b/ruoyi-admin/src/main/resources/templates/skin.html new file mode 100644 index 0000000..4f3d1fd --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/skin.html @@ -0,0 +1,146 @@ + + + + + + + 主题选择 + + + + + + + + + + + + +