From aa388aa870a58eb927ada4203be70f5aac99cd6d Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 16 Oct 2019 13:43:19 +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 | 39 +++-- .../src/main/resources/templates/index.html | 35 ++++- .../src/main/resources/templates/skin.html | 146 ++++++++++++++++++ 4 files changed, 214 insertions(+), 13 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 3c736270..8c0a0eed 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 20b10e00..acd10e6b 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,15 @@ * 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,17 +234,33 @@ 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(); } }; @@ -253,7 +278,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 cdc24195..ee75bd2a 100644 --- a/ruoyi-admin/src/main/resources/templates/index.html +++ b/ruoyi-admin/src/main/resources/templates/index.html @@ -17,7 +17,7 @@ - +
@@ -187,9 +187,13 @@ 个人中心
  • - + 修改密码
  • +
  • + + 切换主题 +
  • @@ -236,15 +240,38 @@ + - 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 00000000..ddc4707f --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/skin.html @@ -0,0 +1,146 @@ + + + + + + + 主题选择 + + + + + + + + + + + + +