drew 5 yıl önce
ebeveyn
işleme
667baf27e5

+ 0 - 3
db.sql

@@ -11,6 +11,3 @@ INSERT INTO `user_authority`(`user_id`, `authority_name`) VALUES (1, 'ROLE_ADMIN
 INSERT INTO `user_authority`(`user_id`, `authority_name`) VALUES (1, 'ROLE_USER');
 
 INSERT INTO `user`(`id`, `created_at`, `created_by`, `modified_at`, `modified_by`, `avatar`, `city`, `country`, `email`, `enabled`, `language`, `nickname`, `open_id`, `password`, `phone`, `province`, `sex`, `username`) VALUES (1, '2020-03-07 18:34:36', 'system', '2020-03-07 18:34:36', 'system', 'https://zhumj.oss-cn-hangzhou.aliyuncs.com/image/user.jpg', NULL, NULL, NULL, b'1', NULL, '管理员', NULL, '$2a$10$F1djCtmdF3T0qsviWw50/utajZSe4EJMMUD.Ey5BhEIpoDhanBMuC', NULL, NULL, NULL, 'root');
-
-INSERT INTO `user_authority`(`user_id`, `authority_name`) VALUES (1, 'ROLE_ADMIN');
-INSERT INTO `user_authority`(`user_id`, `authority_name`) VALUES (1, 'ROLE_USER');

+ 2 - 0
src/main/java/com/izouma/awesomeAdmin/domain/Menu.java

@@ -27,6 +27,8 @@ public class Menu extends BaseEntity implements Serializable {
 
     private Boolean active;
 
+    private String category;
+
     @OneToMany
     @JoinColumn(name = "parent", insertable = false, updatable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
     List<Menu> children;

+ 12 - 2
src/main/java/com/izouma/awesomeAdmin/web/MenuController.java

@@ -2,7 +2,7 @@ package com.izouma.awesomeAdmin.web;
 
 import com.izouma.awesomeAdmin.domain.Menu;
 import com.izouma.awesomeAdmin.repo.MenuRepo;
-import org.springframework.beans.factory.annotation.Autowired;
+import lombok.AllArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -11,11 +11,13 @@ import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Comparator;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("/menu")
+@AllArgsConstructor
 public class MenuController extends BaseController {
-    @Autowired
     private MenuRepo menuRepo;
 
     @GetMapping("/userMenu")
@@ -43,6 +45,14 @@ public class MenuController extends BaseController {
         return menu;
     }
 
+    @PreAuthorize("hasRole('ADMIN')")
+    @GetMapping("/groupByCategory")
+    public Map<String, List<Menu>> groupByCategory() {
+        return menuRepo.findAll().stream()
+                .filter(menu -> menu.getCategory() != null)
+                .collect(Collectors.groupingBy(Menu::getCategory));
+    }
+
     private void sortMenu(Menu menu) {
         if (menu.getChildren() != null) {
             menu.getChildren().sort(Comparator.comparingInt(Menu::getSort));

+ 1 - 1
src/main/resources/application.yaml

@@ -9,7 +9,7 @@ spring:
     profiles:
         active: dev
     datasource:
-        url: jdbc:mysql://rdsave1o67m1ido6gwp6public.mysql.rds.aliyuncs.com/ticket_exchange?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8
+        url: jdbc:mysql://mysql.izouma.com/awesome_admin_v2?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8
         username: microball
         password: 2wsx@WSX#EDC
         hikari:

+ 1 - 1
src/main/vue/public/index.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="en" class="light-blue">
   <head>
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">

+ 17 - 0
src/main/vue/src/assets/bg_body.svg

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 19.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<svg version="1.1" id="Слой_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 viewBox="0 0 1370 240" enable-background="new 0 0 1370 240" xml:space="preserve">
+<g id="XMLID_1459_" opacity="0.56">
+	<path id="XMLID_1462_" opacity="0.08" fill="#FFFFFF" d="M-3.8,10.1c0,0,82.4,129.7,304,144c112,7.2,222.9-15.6,290.5-59.1
+		S771-2,946-2c182.5,0,194.7,91,291.1,94c131.3,4.1,135.9-22.6,135.9-22.6V130c0,0-22.7-28.4-102.4-10.3
+		c-125.4,28.5-103.9,74.5-200.8,58C871,143.8,924.6,145.8,620.2,199c-206.3,36.1-396.7-15.6-475-17.1S-4,242.3-4,242.3L-3.8,10.1z"
+		/>
+	<path id="XMLID_1461_" opacity="0.08" fill="#FFFFFF" d="M-5,233.6V82.7c0,0,45.7,39.7,106.8,31.8S233.1,34.7,438,34.6
+		c139,0,197,41.9,298.8,79.4s134.2,45.5,245.6,45.5S1138.5,100.2,1196,96s179,56.8,179,56.8V223c0,0-99.1-72.1-277-33.1
+		s-338.5,29.7-457.1-10.8s-183.7-8.3-325.9-11.3S155.1,116,101,134.1C57.7,148.6-5,233.6-5,233.6z"/>
+	<path id="XMLID_1460_" opacity="0.08" fill="#FFFFFF" d="M1376,183.4v-90c0,0-45.7,7.9-106.8,0S1137.9,13.7,933,13.6
+		c-139,0-197,41.9-298.8,79.4s-134.2,61-245.6,61S233.8,93,176.3,88.8C118.8,84.6-4,131.8-4,131.8v49.7c0,0,98-89.5,275.9-50.5
+		s339.5,67.6,458.1,27.1s174.7,6.1,316.9,3.1S1204.3,81,1280,116C1321.4,135.2,1376,183.4,1376,183.4z"/>
+</g>
+</svg>

+ 5 - 0
src/main/vue/src/router.js

@@ -62,6 +62,11 @@ const router = new Router({
                     path: '/sysConfigList',
                     name: 'sysConfigList',
                     component: () => import(/* webpackChunkName: "sysConfigList" */ '@/views/SysConfigList.vue'),
+                },
+                {
+                    path: '/roleMenus',
+                    name: 'roleMenus',
+                    component: () => import(/* webpackChunkName: "roleMenus" */ '@/views/RoleMenus.vue'),
                 }
                 /**INSERT_LOCATION**/,
             ],

+ 108 - 6
src/main/vue/src/styles/app.less

@@ -1,8 +1,8 @@
 html {
     width: 100%;
     height: 100%;
-    font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB',
-        'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
+    font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
+        "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
     -webkit-font-smoothing: antialiased;
     -moz-osx-font-smoothing: grayscale;
     margin: 0;
@@ -14,8 +14,8 @@ body {
     width: 100%;
     height: 100%;
     background: white;
-    font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB',
-        'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
+    font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
+        "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
     -webkit-font-smoothing: antialiased;
     -moz-osx-font-smoothing: grayscale;
     margin: 0;
@@ -184,7 +184,7 @@ li {
             position: relative;
 
             &::after {
-                content: '';
+                content: "";
                 width: 100%;
                 height: 6px;
                 position: absolute;
@@ -203,7 +203,7 @@ li {
             position: relative;
 
             &::after {
-                content: '';
+                content: "";
                 width: 100%;
                 height: 6px;
                 position: absolute;
@@ -284,3 +284,105 @@ li {
         }
     }
 }
+
+.light-blue {
+    body {
+        background: url(../assets/bg_body.svg),
+            radial-gradient(
+                farthest-side ellipse at 10% 0,
+                #e1e5e8 10%,
+                #9aacbf
+            ) !important;
+        background-attachment: fixed !important;
+        background-size: cover !important;
+        background-repeat: no-repeat !important;
+    }
+    .el-aside {
+        background: transparent !important;
+        .logo-wrapper {
+            background: transparent !important;
+            font-weight: 200 !important;
+            color: #444 !important;
+        }
+    }
+    .el-menu,
+    .el-submenu,
+    .el-menu-item,
+    .el-submenu__title {
+        background: transparent !important;
+        color: #444 !important;
+    }
+    .el-menu-item.el-menu-item.is-active {
+        background: transparent !important;
+        color: #444 !important;
+        border-left: none;
+        font-weight: bold;
+        position: relative;
+        &::after {
+            position: absolute;
+            content: "";
+            top: 15px;
+            bottom: 15px;
+            right: 0;
+            width: 2px;
+            background: #444;
+            margin: auto;
+        }
+    }
+    .el-main {
+        background: transparent !important;
+    }
+    .el-header {
+        background: transparent !important;
+        border: none !important;
+    }
+    .el-card {
+        background: rgba(255, 255, 255, 0.3) !important;
+        border: none !important;
+        box-shadow: 0 23px 20px -20px rgba(153, 166, 177, 0.1),
+            0 0 15px rgba(153, 166, 177, 0.06);
+    }
+    .edit-view,
+    .list-view {
+        background: rgba(255, 255, 255, 0.3) !important;
+        border: none !important;
+        box-shadow: 0 23px 20px -20px rgba(153, 166, 177, 0.1),
+            0 0 15px rgba(153, 166, 177, 0.06);
+    }
+    .el-tree {
+        background: transparent !important;
+    }
+    .el-table {
+        background: transparent !important;
+        td,
+        th,
+        tr {
+            background: transparent !important;
+        }
+    }
+    .el-table__fixed-right {
+        //background: #b9c6d2;
+        &::before {
+            display: none;
+        }
+    }
+    .el-table::before {
+        display: none;
+    }
+    ::-webkit-scrollbar {
+        height: 8px;
+    }
+    /*滚动区域背景*/
+    ::-webkit-scrollbar-track-piece {
+        background-color: transparent;
+    }
+    /*竖向滚动条*/
+    ::-webkit-scrollbar-thumb {
+        background-color: #999;
+        border-radius: 4px;
+    }
+    ::-webkit-scrollbar-thumb:active,
+    ::-webkit-scrollbar-thumb:hover {
+        background-color: #888;
+    }
+}

+ 34 - 18
src/main/vue/src/views/Admin.vue

@@ -1,43 +1,60 @@
 <template>
     <el-container id="app">
         <el-aside :width="collapse ? '65px' : '200px'" class="aside">
-            <div class="logo-wrapper">Logo</div>
-            <el-menu :collapse="collapse" background-color="#324157"
-                text-color="#BFCBD9" active-text-color="#20A0FF"
-                :unique-opened="true" :router="true"
+            <div class="logo-wrapper">Thoma&nbsp;<b>Admin</b></div>
+            <el-menu
+                :collapse="collapse"
+                background-color="#324157"
+                text-color="#BFCBD9"
+                active-text-color="#20A0FF"
+                :unique-opened="true"
+                :router="true"
                 :default-active="activeMenu"
                 style="border-right: 1px solid #545c64"
-                class="el-menu-vertical-demo">
+                class="el-menu-vertical-demo"
+            >
                 <sys-menu v-for="item in menus" :menu="item" :key="item.id">
                 </sys-menu>
             </el-menu>
         </el-aside>
         <el-container>
             <el-header class="header">
-                <div class="header-btn" @click="collapse=!collapse">
-                    <div :style="{transform: collapse ? 'rotate(90deg)' : ''}">
+                <div class="header-btn" @click="collapse = !collapse">
+                    <div
+                        :style="{ transform: collapse ? 'rotate(90deg)' : '' }"
+                    >
                         <i class="fas fa-bars" style="font-size: 20px;"></i>
                     </div>
                 </div>
                 <div style="flex-grow: 1; margin-left: 20px;">
-                    <router-link :to="{name:'dashboard'}">管理后台
+                    <router-link :to="{ name: 'dashboard' }"
+                        >管理后台
                     </router-link>
                 </div>
 
-                <el-tooltip effect="dark"
-                    :content="isFullscreen ? '退出全屏' : '全屏'" placement="bottom"
-                    :open-delay="1000">
-                    <div class="header-btn" @click="toggleFullScreen"
-                        ref="fullscreen">
+                <el-tooltip
+                    effect="dark"
+                    :content="isFullscreen ? '退出全屏' : '全屏'"
+                    placement="bottom"
+                    :open-delay="1000"
+                >
+                    <div
+                        class="header-btn"
+                        @click="toggleFullScreen"
+                        ref="fullscreen"
+                    >
                         <i class="fas fa-expand" style="font-size: 20px;"></i>
                     </div>
                 </el-tooltip>
 
                 <el-dropdown @command="onCommand" style="margin-left: 20px;">
-                    <img :src="userInfo ? userInfo.avatar || '' : ''"
-                        class="avatar" />
+                    <img
+                        :src="userInfo ? userInfo.avatar || '' : ''"
+                        class="avatar"
+                    />
                     <el-dropdown-menu slot="dropdown">
-                        <el-dropdown-item command="logout">退出登录
+                        <el-dropdown-item command="logout"
+                            >退出登录
                         </el-dropdown-item>
                     </el-dropdown-menu>
                 </el-dropdown>
@@ -46,7 +63,6 @@
                 <router-view></router-view>
             </el-main>
         </el-container>
-
     </el-container>
 </template>
 
@@ -218,13 +234,13 @@ export default {
     transition: all 0.4s ease;
     -ms-overflow-style: none;
     .logo-wrapper {
+        font-weight: 200;
         display: flex;
         align-items: center;
         justify-content: center;
         height: 60px;
         color: white;
         font-size: 20px;
-        font-weight: 700;
         background: fade(black, 20%);
     }
 }

+ 18 - 0
src/main/vue/src/views/RoleMenus.vue

@@ -0,0 +1,18 @@
+<template>
+    <div></div>
+</template>
+<script>
+export default {
+    data() {
+        return {
+            menus: []
+        };
+    },
+    created() {
+        this.$http.get("/menu/groupByCategory").then(res => {
+            this.menus = res;
+        });
+    }
+};
+</script>
+<style lang="less" scoped></style>