Compare commits
6 Commits
2942fdabfe
...
be30f31990
| Author | SHA1 | Date | |
|---|---|---|---|
| be30f31990 | |||
| ac4d7d8176 | |||
| 54997d4e3d | |||
| 7bbb1be2a2 | |||
| 19312e7a6f | |||
| 727dd254f0 |
32
src/main/java/com/corewing/app/common/base/BaseEntity.java
Normal file
32
src/main/java/com/corewing/app/common/base/BaseEntity.java
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
package com.corewing.app.common.base;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -33,8 +33,10 @@ public class SaTokenConfig implements WebMvcConfigurer {
|
|||||||
.excludePathPatterns("/agreement", "/agreement/**")
|
.excludePathPatterns("/agreement", "/agreement/**")
|
||||||
// 排除固件查询接口(不需要登录)
|
// 排除固件查询接口(不需要登录)
|
||||||
.excludePathPatterns("/firmware/**")
|
.excludePathPatterns("/firmware/**")
|
||||||
|
// 排除系统登录页(不需要登录)
|
||||||
|
.excludePathPatterns("/loading.html", "/admin/login.html")
|
||||||
// 排除静态资源
|
// 排除静态资源
|
||||||
.excludePathPatterns("/", "/loading.html", "/admin/login.html", "/*.css", "/*.js", "/*.ico", "/static/**")
|
.excludePathPatterns("/", "/*.css", "/*.js", "/*.ico", "/static/**", "/assets/**")
|
||||||
// 排除后台管理静态资源
|
// 排除后台管理静态资源
|
||||||
.excludePathPatterns("/admin/**")
|
.excludePathPatterns("/admin/**")
|
||||||
// 排除 Druid 监控
|
// 排除 Druid 监控
|
||||||
|
|||||||
52
src/main/java/com/corewing/app/entity/SysMenu.java
Normal file
52
src/main/java/com/corewing/app/entity/SysMenu.java
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
package com.corewing.app.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.corewing.app.common.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@TableName("sys_menu")
|
||||||
|
public class SysMenu extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单名称
|
||||||
|
*/
|
||||||
|
private String menuName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单地址
|
||||||
|
*/
|
||||||
|
private String menuUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单图标
|
||||||
|
*/
|
||||||
|
private String menuIcon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单分类
|
||||||
|
*/
|
||||||
|
private String menuCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否隐藏
|
||||||
|
*/
|
||||||
|
private boolean visible;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
9
src/main/java/com/corewing/app/mapper/SysMenuMapper.java
Normal file
9
src/main/java/com/corewing/app/mapper/SysMenuMapper.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package com.corewing.app.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.corewing.app.entity.SysMenu;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||||
|
}
|
||||||
@@ -30,7 +30,7 @@ public class SysMainController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/admin/index.html")
|
@GetMapping("/admin/index.html")
|
||||||
public String adminIndex() {
|
public String adminIndex() {
|
||||||
return "admin/index";
|
return "admin/main";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.corewing.app.modules.admin;
|
||||||
|
|
||||||
|
import com.corewing.app.common.Result;
|
||||||
|
import com.corewing.app.entity.SysMenu;
|
||||||
|
import com.corewing.app.service.SysMenuService;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/sys/menu")
|
||||||
|
public class SysMenuController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysMenuService sysMenuService;
|
||||||
|
|
||||||
|
@GetMapping("/initSysMenu")
|
||||||
|
@ResponseBody
|
||||||
|
public Result<List<SysMenu>> initSysMenu() {
|
||||||
|
List<SysMenu> sysMenus = sysMenuService.initSysMenu();
|
||||||
|
return Result.success(sysMenus);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
10
src/main/java/com/corewing/app/service/SysMenuService.java
Normal file
10
src/main/java/com/corewing/app/service/SysMenuService.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package com.corewing.app.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.corewing.app.entity.SysMenu;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface SysMenuService extends IService<SysMenu> {
|
||||||
|
List<SysMenu> initSysMenu();
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.corewing.app.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.corewing.app.entity.SysMenu;
|
||||||
|
import com.corewing.app.mapper.SysMenuMapper;
|
||||||
|
import com.corewing.app.service.SysMenuService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements SysMenuService {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysMenu> initSysMenu() {
|
||||||
|
LambdaQueryWrapper<SysMenu> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(SysMenu::isVisible, Boolean.TRUE);
|
||||||
|
return list(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
283
src/main/resources/static/assets/css/main.css
Normal file
283
src/main/resources/static/assets/css/main.css
Normal file
@@ -0,0 +1,283 @@
|
|||||||
|
:root {
|
||||||
|
--primary-color: #5B5FDE;
|
||||||
|
--secondary-color: #0EA5E9;
|
||||||
|
--accent-color: #FF6B6B;
|
||||||
|
--error-color: #F43F5E;
|
||||||
|
--success-color: #10B981;
|
||||||
|
--warning-color: #F59E0B;
|
||||||
|
--info-color: #3B82F6;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #F3F4F6;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 侧边栏样式 */
|
||||||
|
.sidebar {
|
||||||
|
min-height: 100vh;
|
||||||
|
background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
|
||||||
|
color: white;
|
||||||
|
padding: 0;
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 180px;
|
||||||
|
box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-header {
|
||||||
|
padding: 18px 12px;
|
||||||
|
text-align: center;
|
||||||
|
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-header h4 {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-header i {
|
||||||
|
margin-right: 5px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-menu {
|
||||||
|
padding: 12px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .nav-link {
|
||||||
|
color: rgba(255, 255, 255, 0.85);
|
||||||
|
padding: 9px 10px;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin: 3px 0;
|
||||||
|
transition: all 0.3s;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 13px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .nav-link i {
|
||||||
|
width: 18px;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .nav-link:hover {
|
||||||
|
background-color: rgba(255, 255, 255, 0.15);
|
||||||
|
color: white;
|
||||||
|
transform: translateX(5px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .nav-link.active {
|
||||||
|
background-color: rgba(255, 255, 255, 0.25);
|
||||||
|
color: white;
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-footer {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
padding: 12px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-logout {
|
||||||
|
width: 100%;
|
||||||
|
padding: 9px;
|
||||||
|
background: rgba(255, 255, 255, 0.15);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||||
|
color: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 13px;
|
||||||
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-logout:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.25);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 顶部导航栏 */
|
||||||
|
.navbar {
|
||||||
|
background-color: white;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
||||||
|
padding: 12px 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1F2937;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
color: #4B5563;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-info i {
|
||||||
|
font-size: 20px;
|
||||||
|
color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 主内容区 */
|
||||||
|
.main-content {
|
||||||
|
margin-left: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 内容区域 */
|
||||||
|
.content-wrapper {
|
||||||
|
padding: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 欢迎卡片 */
|
||||||
|
.welcome-card {
|
||||||
|
background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
|
||||||
|
color: white;
|
||||||
|
border-radius: 16px;
|
||||||
|
padding: 35px;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
box-shadow: 0 10px 30px rgba(91, 95, 222, 0.2);
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome-card::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
width: 250px;
|
||||||
|
height: 250px;
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
border-radius: 50%;
|
||||||
|
top: -80px;
|
||||||
|
right: -80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome-card h2 {
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome-card p {
|
||||||
|
font-size: 15px;
|
||||||
|
opacity: 0.95;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 统计卡片 */
|
||||||
|
.stat-card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 25px;
|
||||||
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
|
||||||
|
transition: all 0.3s;
|
||||||
|
border: 1px solid #E5E7EB;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card i {
|
||||||
|
font-size: 40px;
|
||||||
|
opacity: 0.9;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card h3 {
|
||||||
|
font-size: 30px;
|
||||||
|
font-weight: 700;
|
||||||
|
margin: 12px 0 6px;
|
||||||
|
color: #1F2937;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card p {
|
||||||
|
color: #6B7280;
|
||||||
|
font-size: 13px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card.primary i {
|
||||||
|
color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card.success i {
|
||||||
|
color: var(--success-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card.warning i {
|
||||||
|
color: var(--warning-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card.info i {
|
||||||
|
color: var(--info-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 页面标题 */
|
||||||
|
.page-title {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1F2937;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 卡片容器 */
|
||||||
|
.card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
border: 1px solid #E5E7EB;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-body {
|
||||||
|
padding: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 响应式 */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.sidebar {
|
||||||
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
|
min-height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-footer {
|
||||||
|
position: static;
|
||||||
|
margin-top: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome-card {
|
||||||
|
padding: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome-card h2 {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-wrapper {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
83
src/main/resources/static/assets/js/axiosRequest.js
Normal file
83
src/main/resources/static/assets/js/axiosRequest.js
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
// 引入 axios@1.4.0(确保已引入 axios.min.js)
|
||||||
|
if (!window.axios) throw new Error("请先引入 axios@1.4.0 脚本!");
|
||||||
|
|
||||||
|
|
||||||
|
const service = axios.create({
|
||||||
|
baseURL: "",
|
||||||
|
timeout: 5000,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json;charset=utf-8"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// -------------------------- 请求拦截器:自动携带 Token --------------------------
|
||||||
|
service.interceptors.request.use(
|
||||||
|
(config) => {
|
||||||
|
const token = localStorage.getItem("token");
|
||||||
|
|
||||||
|
if (token) {
|
||||||
|
config.headers["Authorization"] = token;
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
return Promise.reject(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// -------------------------- 响应拦截器:统一处理结果 --------------------------
|
||||||
|
service.interceptors.response.use(
|
||||||
|
(response) => {
|
||||||
|
return response.data;
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
let errorMsg = "请求失败,请稍后重试";
|
||||||
|
|
||||||
|
if (error.response) {
|
||||||
|
switch (error.response.status) {
|
||||||
|
case 401:
|
||||||
|
errorMsg = "Token 已过期,请重新登录";
|
||||||
|
localStorage.removeItem("token");
|
||||||
|
window.location.href = "/admin/login.html";
|
||||||
|
break;
|
||||||
|
case 403:
|
||||||
|
errorMsg = "暂无权限访问该接口";
|
||||||
|
break;
|
||||||
|
case 500:
|
||||||
|
errorMsg = "服务器内部错误";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
errorMsg = error.response.data?.msg || errorMsg;
|
||||||
|
}
|
||||||
|
} else if (error.request) {
|
||||||
|
errorMsg = "网络异常,请检查网络连接";
|
||||||
|
}
|
||||||
|
console.error("接口请求错误:", errorMsg);
|
||||||
|
return Promise.reject(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// -------------------------- 封装常用请求方法(get/post/put/delete) --------------------------
|
||||||
|
const request = {
|
||||||
|
// GET
|
||||||
|
get(url, params = {}) {
|
||||||
|
return service.get(url, { params });
|
||||||
|
},
|
||||||
|
|
||||||
|
// POST
|
||||||
|
post(url, data = {}) {
|
||||||
|
return service.post(url, data);
|
||||||
|
},
|
||||||
|
|
||||||
|
// PUT
|
||||||
|
put(url, data = {}) {
|
||||||
|
return service.put(url, data);
|
||||||
|
},
|
||||||
|
|
||||||
|
// DELETE
|
||||||
|
delete(url, params = {}) {
|
||||||
|
return service.delete(url, { params });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.request = request;
|
||||||
@@ -11,280 +11,7 @@
|
|||||||
<!-- Bootstrap Icons -->
|
<!-- Bootstrap Icons -->
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<link rel="stylesheet" href="/assets/css/main.css">
|
||||||
:root {
|
|
||||||
--primary-color: #5B5FDE;
|
|
||||||
--secondary-color: #0EA5E9;
|
|
||||||
--accent-color: #FF6B6B;
|
|
||||||
--error-color: #F43F5E;
|
|
||||||
--success-color: #10B981;
|
|
||||||
--warning-color: #F59E0B;
|
|
||||||
--info-color: #3B82F6;
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
background-color: #F3F4F6;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 侧边栏样式 */
|
|
||||||
.sidebar {
|
|
||||||
min-height: 100vh;
|
|
||||||
background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
|
|
||||||
color: white;
|
|
||||||
padding: 0;
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
width: 180px;
|
|
||||||
box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-header {
|
|
||||||
padding: 18px 12px;
|
|
||||||
text-align: center;
|
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-header h4 {
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-header i {
|
|
||||||
margin-right: 5px;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-menu {
|
|
||||||
padding: 12px 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar .nav-link {
|
|
||||||
color: rgba(255, 255, 255, 0.85);
|
|
||||||
padding: 9px 10px;
|
|
||||||
border-radius: 8px;
|
|
||||||
margin: 3px 0;
|
|
||||||
transition: all 0.3s;
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 13px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar .nav-link i {
|
|
||||||
width: 18px;
|
|
||||||
font-size: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar .nav-link:hover {
|
|
||||||
background-color: rgba(255, 255, 255, 0.15);
|
|
||||||
color: white;
|
|
||||||
transform: translateX(5px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar .nav-link.active {
|
|
||||||
background-color: rgba(255, 255, 255, 0.25);
|
|
||||||
color: white;
|
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
padding: 12px 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-logout {
|
|
||||||
width: 100%;
|
|
||||||
padding: 9px;
|
|
||||||
background: rgba(255, 255, 255, 0.15);
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
||||||
color: white;
|
|
||||||
border-radius: 8px;
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 13px;
|
|
||||||
transition: all 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-logout:hover {
|
|
||||||
background: rgba(255, 255, 255, 0.25);
|
|
||||||
transform: translateY(-2px);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 顶部导航栏 */
|
|
||||||
.navbar {
|
|
||||||
background-color: white;
|
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
|
||||||
padding: 12px 25px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-brand {
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #1F2937;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-info {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
color: #4B5563;
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-info i {
|
|
||||||
font-size: 20px;
|
|
||||||
color: var(--primary-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 主内容区 */
|
|
||||||
.main-content {
|
|
||||||
margin-left: 180px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 内容区域 */
|
|
||||||
.content-wrapper {
|
|
||||||
padding: 25px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 欢迎卡片 */
|
|
||||||
.welcome-card {
|
|
||||||
background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
|
|
||||||
color: white;
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 35px;
|
|
||||||
margin-bottom: 25px;
|
|
||||||
box-shadow: 0 10px 30px rgba(91, 95, 222, 0.2);
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome-card::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
width: 250px;
|
|
||||||
height: 250px;
|
|
||||||
background: rgba(255, 255, 255, 0.1);
|
|
||||||
border-radius: 50%;
|
|
||||||
top: -80px;
|
|
||||||
right: -80px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome-card h2 {
|
|
||||||
font-size: 26px;
|
|
||||||
font-weight: 700;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome-card p {
|
|
||||||
font-size: 15px;
|
|
||||||
opacity: 0.95;
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 统计卡片 */
|
|
||||||
.stat-card {
|
|
||||||
background: white;
|
|
||||||
border-radius: 12px;
|
|
||||||
padding: 25px;
|
|
||||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
|
|
||||||
transition: all 0.3s;
|
|
||||||
border: 1px solid #E5E7EB;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-card:hover {
|
|
||||||
transform: translateY(-5px);
|
|
||||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-card i {
|
|
||||||
font-size: 40px;
|
|
||||||
opacity: 0.9;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-card h3 {
|
|
||||||
font-size: 30px;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 12px 0 6px;
|
|
||||||
color: #1F2937;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-card p {
|
|
||||||
color: #6B7280;
|
|
||||||
font-size: 13px;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-card.primary i { color: var(--primary-color); }
|
|
||||||
.stat-card.success i { color: var(--success-color); }
|
|
||||||
.stat-card.warning i { color: var(--warning-color); }
|
|
||||||
.stat-card.info i { color: var(--info-color); }
|
|
||||||
|
|
||||||
/* 页面标题 */
|
|
||||||
.page-title {
|
|
||||||
font-size: 24px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #1F2937;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 卡片容器 */
|
|
||||||
.card {
|
|
||||||
background: white;
|
|
||||||
border-radius: 12px;
|
|
||||||
border: 1px solid #E5E7EB;
|
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-body {
|
|
||||||
padding: 25px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 响应式 */
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.sidebar {
|
|
||||||
width: 100%;
|
|
||||||
position: relative;
|
|
||||||
min-height: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-content {
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-footer {
|
|
||||||
position: static;
|
|
||||||
margin-top: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome-card {
|
|
||||||
padding: 25px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome-card h2 {
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-wrapper {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
@@ -416,6 +143,10 @@
|
|||||||
<!-- Bootstrap 5 JS -->
|
<!-- Bootstrap 5 JS -->
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
|
<!-- 引入封装的 axiosRequest.js -->
|
||||||
|
<script src="/assets/js/axiosRequest.js"></script>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const { createApp } = Vue;
|
const { createApp } = Vue;
|
||||||
|
|
||||||
@@ -436,13 +167,9 @@
|
|||||||
this.userInfo.username = localStorage.getItem('username') || '';
|
this.userInfo.username = localStorage.getItem('username') || '';
|
||||||
this.userInfo.realName = localStorage.getItem('realName') || '';
|
this.userInfo.realName = localStorage.getItem('realName') || '';
|
||||||
this.userInfo.userId = localStorage.getItem('userId') || '';
|
this.userInfo.userId = localStorage.getItem('userId') || '';
|
||||||
|
|
||||||
// 也可以从服务器获取最新的用户信息
|
|
||||||
const token = localStorage.getItem('token');
|
|
||||||
if (token) {
|
if (token) {
|
||||||
try {
|
try {
|
||||||
axios.defaults.headers.common['satoken'] = token;
|
const response = await request.get('/sys/user/info');
|
||||||
const response = await axios.get('/sys/user/info');
|
|
||||||
if (response.data.code === 200) {
|
if (response.data.code === 200) {
|
||||||
const user = response.data.data;
|
const user = response.data.data;
|
||||||
this.userInfo.username = user.username;
|
this.userInfo.username = user.username;
|
||||||
@@ -458,11 +185,7 @@
|
|||||||
async handleLogout() {
|
async handleLogout() {
|
||||||
if (confirm('确定要退出登录吗?')) {
|
if (confirm('确定要退出登录吗?')) {
|
||||||
try {
|
try {
|
||||||
const token = localStorage.getItem('token');
|
await request.get('/sys/user/logout');
|
||||||
if (token) {
|
|
||||||
axios.defaults.headers.common['satoken'] = token;
|
|
||||||
await axios.post('/sys/user/logout');
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('退出登录失败:', error);
|
console.error('退出登录失败:', error);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -480,11 +203,20 @@
|
|||||||
// 未登录,跳转到登录页
|
// 未登录,跳转到登录页
|
||||||
window.location.href = '/admin/login.html';
|
window.location.href = '/admin/login.html';
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
async initMenu() {
|
||||||
|
const response = await request.get('/sys/menu/initSysMenu');
|
||||||
|
if(response.data.code === 200) {
|
||||||
|
console.log(response.data.code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// 检查登录状态
|
// 检查登录状态
|
||||||
this.checkLogin();
|
this.checkLogin();
|
||||||
|
// 加载系统菜单
|
||||||
|
this.initMenu();
|
||||||
// 加载用户信息
|
// 加载用户信息
|
||||||
this.loadUserInfo();
|
this.loadUserInfo();
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user