diff --git a/README.md b/README.md
index 52d3d5d..5c4f7f8 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
ZRAdmin.NET后台管理系统
-基于.NET5 + vue前后端分离的.net快速开发框架
+基于.NET5/.NET6 + vue2.x/vue3.x前后端分离的.net快速开发框架
@@ -11,7 +11,7 @@
* 本项目适合有一定NetCore和 vue基础的开发人员
* 基于.NET5/.NET6实现的通用权限管理平台(RBAC模式)。整合最新技术高效快速开发,前后端分离模式,开箱即用。
* 代码量少、学习简单、通俗易懂、功能强大、易扩展、轻量级,让web开发更快速、简单高效(从此告别996),解决70%的重复工作,专注您的业务,轻松开发从现在开始!
-* 前端采用Vue2.0/vue3、Element UI/Element-UI plus、vite。
+* 前端采用vue2.x/vue3.x、Element UI/Element-UI plus、vite。
* 后端采用Net5/Net6、Sqlsugar、MySQL等,可以自动分库分表。
* 权限认证使用Jwt,支持多终端认证系统。
* 支持加载动态权限菜单,多方式轻松权限控制
@@ -26,15 +26,22 @@
## 🍿在线体验
- 官方文档:http://www.izhaorui.cn/doc
-- 体验地址:http://www.izhaorui.cn/admin
-- 管理员:admin
-- 密 码:123456
+- vue3.x版本体验:http://www.izhaorui.cn/vue3
+- vue2.x版本体验:http://www.izhaorui.cn/admin
+- 账号密码:admin/123456
+
```
由于是个人项目,资金有限,体验服是低配,请大家爱惜,轻戳,不胜感激!!!
```
+## 💒代码仓库
+- [【Gitee】 vue2+后端代码](https://gitee.com/izory/ZrAdminNetCore/)
+- [【Github】vue2+后端代码](https://github.com/izhaorui/ZrAdmin.NET/)
+- [【NET6版本】](https://gitee.com/izory/ZrAdminNetCore/tree/net6.0/)
+- [【Gitee】vue3地址](https://gitee.com/izory/ZRAdmin-vue)
+
## 🍁前端技术
-Vue版前端技术栈 :基于vue、vuex、vue-router 、vue-cli 、axios 和 element-ui,前端采用vscode工具开发
+Vue版前端技术栈 :基于vue2.x/vue3.x、vuex、vue-router 、vue-cli 、axios 和 element-ui/element-ui-plus,前端采用vscode工具开发
## 🍀后端技术
核心框架:.Net5.0/.Net6 + Web API + sqlsugar + swagger + signalR + IpRateLimit
@@ -147,8 +154,3 @@ Vue版前端技术栈 :基于vue、vuex、vue-router 、vue-cli 、axios 和 e
如果部署iis访问不了情况可以有以下两种办法:
1. 直接打开ZR.Admin.WebApi.exe文件然后看控制台的错误日志
2. web.config里面有个false 改为 true,iis重启项目后运行网站后,跟目录下面 有个文件夹 log 里面有错误日志文件
-
-## 源码地址
-- [Gitee](https://gitee.com/izory/ZrAdminNetCore/)
-- [Github](https://github.com/izhaorui/ZrAdmin.NET/)
-- [NET6版本](https://gitee.com/izory/ZrAdminNetCore/tree/net6.0/)
\ No newline at end of file
diff --git a/ZR.Admin.WebApi/Controllers/System/ArticleController.cs b/ZR.Admin.WebApi/Controllers/System/ArticleController.cs
index 9274ccf..3b1e340 100644
--- a/ZR.Admin.WebApi/Controllers/System/ArticleController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/ArticleController.cs
@@ -141,7 +141,7 @@ namespace ZR.Admin.WebApi.Controllers
{
//从 Dto 映射到 实体
var addModel = parm.Adapt().ToCreate(context: HttpContext);
- addModel.AuthorName = User.Identity.Name;
+ addModel.AuthorName = HttpContext.GetName();
var response = _ArticleService.Update(it => it.Cid == addModel.Cid,
f => new Article
@@ -149,7 +149,7 @@ namespace ZR.Admin.WebApi.Controllers
Title = addModel.Title,
Content = addModel.Content,
Tags = addModel.Tags,
- Category_id = addModel.Category_id,
+ Category_Id = addModel.Category_Id,
UpdateTime = addModel.UpdateTime,
Status = addModel.Status
}).ToCreate();
diff --git a/ZR.Admin.WebApi/Controllers/System/SysMenuController.cs b/ZR.Admin.WebApi/Controllers/System/SysMenuController.cs
index 10e2f16..3c432fe 100644
--- a/ZR.Admin.WebApi/Controllers/System/SysMenuController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/SysMenuController.cs
@@ -9,6 +9,7 @@ using ZR.Model.System.Dto;
using ZR.Model.System;
using ZR.Service.System.IService;
using ZR.Model;
+using Mapster;
namespace ZR.Admin.WebApi.Controllers.System
{
@@ -87,28 +88,34 @@ namespace ZR.Admin.WebApi.Controllers.System
///
/// 修改菜单 √
///
- ///
+ ///
///
[HttpPost("edit")]
[Log(Title = "菜单管理", BusinessType = BusinessType.UPDATE)]
[ActionPermissionFilter(Permission = "system:menu:edit")]
- public IActionResult MenuEdit([FromBody] SysMenu MenuDto)
+ public IActionResult MenuEdit([FromBody] MenuDto menuDto)
{
- if (MenuDto == null) { return ToResponse(ApiResult.Error(101, "请求参数错误")); }
+ if (menuDto == null) { return ToResponse(ApiResult.Error(101, "请求参数错误")); }
//if (UserConstants.NOT_UNIQUE.Equals(sysMenuService.CheckMenuNameUnique(MenuDto)))
//{
// return ToResponse(ApiResult.Error($"修改菜单'{MenuDto.menuName}'失败,菜单名称已存在"));
//}
- if (UserConstants.YES_FRAME.Equals(MenuDto.isFrame) && !MenuDto.path.StartsWith("http"))
+ var config = new TypeAdapterConfig();
+ //映射规则
+ config.ForType()
+ .NameMatchingStrategy(NameMatchingStrategy.IgnoreCase);//忽略字段名称的大小写;//忽略除以上配置的所有字段
+
+ var modal = menuDto.Adapt(config).ToUpdate(HttpContext);
+ if (UserConstants.YES_FRAME.Equals(modal.isFrame) && !modal.path.StartsWith("http"))
{
- return ToResponse(ApiResult.Error($"修改菜单'{MenuDto.menuName}'失败,地址必须以http(s)://开头"));
+ return ToResponse(ApiResult.Error($"修改菜单'{modal.MenuName}'失败,地址必须以http(s)://开头"));
}
- if (MenuDto.menuId.Equals(MenuDto.parentId))
+ if (modal.MenuId.Equals(modal.parentId))
{
- return ToResponse(ApiResult.Error($"修改菜单'{MenuDto.menuName}'失败,上级菜单不能选择自己"));
+ return ToResponse(ApiResult.Error($"修改菜单'{modal.MenuName}'失败,上级菜单不能选择自己"));
}
- MenuDto.Update_by = User.Identity.Name;
- int result = sysMenuService.EditMenu(MenuDto);
+ modal.Update_by = HttpContext.GetName();
+ int result = sysMenuService.EditMenu(modal);
return ToResponse(result);
}
@@ -126,11 +133,11 @@ namespace ZR.Admin.WebApi.Controllers.System
if (MenuDto == null) { return ToResponse(ApiResult.Error(101, "请求参数错误")); }
if (UserConstants.NOT_UNIQUE.Equals(sysMenuService.CheckMenuNameUnique(MenuDto)))
{
- return ToResponse(ApiResult.Error($"新增菜单'{MenuDto.menuName}'失败,菜单名称已存在"));
+ return ToResponse(ApiResult.Error($"新增菜单'{MenuDto.MenuName}'失败,菜单名称已存在"));
}
if (UserConstants.YES_FRAME.Equals(MenuDto.isFrame) && !MenuDto.path.StartsWith("http"))
{
- return ToResponse(ApiResult.Error($"新增菜单'{MenuDto.menuName}'失败,地址必须以http(s)://开头"));
+ return ToResponse(ApiResult.Error($"新增菜单'{MenuDto.MenuName}'失败,地址必须以http(s)://开头"));
}
MenuDto.Create_by = User.Identity.Name;
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/Vue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/Vue.txt
index 09785f1..4fceb9d 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/Vue.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/v3/Vue.txt
@@ -38,30 +38,30 @@ $end
$end
- 搜索
- 重置
+ 搜索
+ 重置
$if(replaceDto.ShowBtnAdd)
- 新增
+ 新增
$end
$if(replaceDto.ShowBtnEdit)
- 修改
+ 修改
$end
$if(replaceDto.ShowBtnDelete)
- 删除
+ 删除
$end
$if(replaceDto.ShowBtnExport)
- 导出
+ 导出
$end
@@ -88,16 +88,15 @@ $if(column.IsList == true)
$if(column.HtmlType == "customInput" && column.IsPk == false)
- {{scope.row.${columnName}}}
-
+ {{scope.row.${columnName}}}
+
$elseif(column.HtmlType == "imageUpload")
-
+
@@ -185,13 +184,13 @@ $elseif(column.HtmlType == "datetime")
$elseif(column.HtmlType == "imageUpload")
-
+
$elseif(column.HtmlType == "fileUpload")
-
+
$elseif(column.HtmlType == "radio")
@@ -253,299 +252,272 @@ $end
-
\ No newline at end of file
diff --git a/ZR.CodeGenerator/CodeGeneratorTool.cs b/ZR.CodeGenerator/CodeGeneratorTool.cs
index 915aac3..59d460f 100644
--- a/ZR.CodeGenerator/CodeGeneratorTool.cs
+++ b/ZR.CodeGenerator/CodeGeneratorTool.cs
@@ -211,7 +211,7 @@ namespace ZR.CodeGenerator
var tpl = FileHelper.ReadJtTemplate(fileName);
var result = tpl.Render();
- var fullPath = generateDto.IsPreview ? string.Empty : Path.Combine(generateDto.GenCodePath, "ZR.Vue3", "src", "views", generateDto.GenTable.ModuleName.FirstLowerCase(), $"{generateDto.GenTable.BusinessName.FirstUpperCase()}.vue");
+ var fullPath = generateDto.IsPreview ? string.Empty : Path.Combine(generateDto.GenCodePath, "ZRAdmin-vue", "src", "views", generateDto.GenTable.ModuleName.FirstLowerCase(), $"{generateDto.GenTable.BusinessName.FirstUpperCase()}.vue");
//Console.WriteLine(result);
generateDto.GenCodes.Add(new GenCode(16, "vue3.vue", fullPath, result));
}
@@ -226,8 +226,11 @@ namespace ZR.CodeGenerator
var tpl = FileHelper.ReadJtTemplate("TplVueApi.txt");
var result = tpl.Render();
- string fullPath = generateDto.IsPreview ? string.Empty : Path.Combine(generateDto.GenCodePath, "ZR.Vue", "src", "api", generateDto.GenTable.ModuleName.FirstLowerCase(), generateDto.GenTable.BusinessName.FirstLowerCase() + ".js");
+ string fullPath = generateDto.IsPreview ? string.Empty : Path.Combine(generateDto.GenCodePath, "ZR.Vue", "src", "api", generateDto.GenTable.ModuleName.FirstLowerCase(), generateDto.GenTable.BusinessName.FirstUpperCase() + ".js");
generateDto.GenCodes.Add(new GenCode(7, "api.js", fullPath, result));
+
+ string fullPathV3 = generateDto.IsPreview ? string.Empty : Path.Combine(generateDto.GenCodePath, "ZRAdmin-vue", "src", "api", generateDto.GenTable.ModuleName.FirstLowerCase(), generateDto.GenTable.BusinessName.ToLower() + ".js");
+ generateDto.GenCodes.Add(new GenCode(7, "api.js", fullPathV3, result));
}
///
@@ -286,7 +289,7 @@ namespace ZR.CodeGenerator
{
var tpl = FileHelper.ReadJtTemplate("CurdForm.txt");
var result = tpl.Render();
- Console.WriteLine(result);
+ //Console.WriteLine(result);
return result;
}
#endregion
diff --git a/ZR.CodeGenerator/ZR.CodeGenerator.csproj b/ZR.CodeGenerator/ZR.CodeGenerator.csproj
index ce59e61..6e8dfda 100644
--- a/ZR.CodeGenerator/ZR.CodeGenerator.csproj
+++ b/ZR.CodeGenerator/ZR.CodeGenerator.csproj
@@ -12,6 +12,6 @@
-
+
diff --git a/ZR.Model/System/Article.cs b/ZR.Model/System/Article.cs
index f82f626..2216f53 100644
--- a/ZR.Model/System/Article.cs
+++ b/ZR.Model/System/Article.cs
@@ -8,15 +8,15 @@ namespace ZR.Model.System
///
/// 文章表
///
- [SqlSugar.SugarTable("article")]
+ [SugarTable("article")]
[Tenant("0")]
public class Article
{
- [SqlSugar.SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
+ [SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int Cid { get; set; }
public string Title { get; set; }
public DateTime? CreateTime { get; set; }
- [SqlSugar.SugarColumn(IsOnlyIgnoreInsert = true)]
+ [SugarColumn(IsOnlyIgnoreInsert = true)]
public DateTime UpdateTime { get; set; }
///
/// 文章内容
@@ -44,6 +44,6 @@ namespace ZR.Model.System
///
public string Tags { get; set; }
public int Hits { get; set; }
- public int Category_id { get; set; }
+ public int Category_Id { get; set; }
}
}
diff --git a/ZR.Model/System/Dto/GenTableDto.cs b/ZR.Model/System/Dto/GenTableDto.cs
index c4137ae..24fb31a 100644
--- a/ZR.Model/System/Dto/GenTableDto.cs
+++ b/ZR.Model/System/Dto/GenTableDto.cs
@@ -22,6 +22,7 @@ namespace ZR.Model.System.Dto
public string GenType { get; set; }
public string GenPath { get; set; }
public string PermissionPrefix { get; set; }
+ public string Remark { get; set; }
///
/// 额外参数
///
diff --git a/ZR.Model/System/Dto/MenuDto.cs b/ZR.Model/System/Dto/MenuDto.cs
index 0fa5671..76714b8 100644
--- a/ZR.Model/System/Dto/MenuDto.cs
+++ b/ZR.Model/System/Dto/MenuDto.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Text;
namespace ZR.Model.System.Dto
@@ -7,18 +8,65 @@ namespace ZR.Model.System.Dto
public class MenuDto
{
//{"parentId":0,"menuName":"aaa","icon":"documentation","menuType":"M","orderNum":999,"visible":0,"status":0,"path":"aaa"}
- public int parentId { get; set; }
- public string menuName { get; set; }
- public string icon { get; set; } = "";
- public string menuType { get; set; }
- public int orderNum { get; set; }
- public int visible { get; set; }
- public int status { get; set; }
- public string path { get; set; } = "#";
+ [Required(ErrorMessage = "菜单id不能为空")]
public int MenuId { get; set; }
+ public string MenuName { get; set; }
+ ///
+ /// 父菜单ID
+ ///
+ public long parentId { get; set; }
+
+ ///
+ /// 显示顺序
+ ///
+ public int orderNum { get; set; }
+
+ ///
+ /// 路由地址
+ ///
+ public string path { get; set; } = "#";
+
+ ///
+ /// 组件路径
+ ///
public string component { get; set; }
- public int isCache { get; set; }
- public int isFrame { get; set; }
- public string perms { get; set; } = "";
+
+ ///
+ /// 是否缓存(1缓存 0不缓存)
+ ///
+ [Required(ErrorMessage = "是否缓存不能为空")]
+ public string isCache { get; set; }
+ ///
+ /// 是否外链 1、是 0、否
+ ///
+ public string isFrame { get; set; }
+
+ ///
+ /// 类型(M目录 C菜单 F按钮 L链接)
+ ///
+ [Required(ErrorMessage = "菜单类型不能为空")]
+ public string menuType { get; set; }
+
+ ///
+ /// 显示状态(0显示 1隐藏)
+ ///
+ [Required(ErrorMessage = "显示状态不能为空")]
+ public string visible { get; set; }
+
+ ///
+ /// 菜单状态(0正常 1停用)
+ ///
+ [Required(ErrorMessage = "菜单状态不能为空")]
+ public string status { get; set; }
+
+ ///
+ /// 权限字符串
+ ///
+ public string perms { get; set; }
+
+ ///
+ /// 菜单图标
+ ///
+ public string icon { get; set; } = string.Empty;
}
}
diff --git a/ZR.Model/System/SysMenu.cs b/ZR.Model/System/SysMenu.cs
index d82e380..b44da88 100644
--- a/ZR.Model/System/SysMenu.cs
+++ b/ZR.Model/System/SysMenu.cs
@@ -14,12 +14,12 @@ namespace ZR.Model.System
/// 菜单ID
///
//[Key]//非自动增长主键时使用ExplicitKey
- [SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
- public long menuId { get; set; }
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public long MenuId { get; set; }
///
/// 菜单名称
///
- public string menuName { get; set; }
+ public string MenuName { get; set; }
///
/// 父菜单名称
diff --git a/ZR.Model/System/Vo/TreeSelectVo.cs b/ZR.Model/System/Vo/TreeSelectVo.cs
index cced4bc..eba965f 100644
--- a/ZR.Model/System/Vo/TreeSelectVo.cs
+++ b/ZR.Model/System/Vo/TreeSelectVo.cs
@@ -24,8 +24,8 @@ namespace ZR.Model.System.Vo
public TreeSelectVo(SysMenu menu)
{
- Id = menu.menuId;
- Label = menu.menuName;
+ Id = menu.MenuId;
+ Label = menu.MenuName;
//menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); java写法
List child = new List();
diff --git a/ZR.Model/ZR.Model.csproj b/ZR.Model/ZR.Model.csproj
index 9678f32..ff46a0c 100644
--- a/ZR.Model/ZR.Model.csproj
+++ b/ZR.Model/ZR.Model.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/ZR.Repository/System/SysMenuRepository.cs b/ZR.Repository/System/SysMenuRepository.cs
index 6becc3b..b66b914 100644
--- a/ZR.Repository/System/SysMenuRepository.cs
+++ b/ZR.Repository/System/SysMenuRepository.cs
@@ -21,7 +21,7 @@ namespace ZR.Repository.System
public List SelectTreeMenuList(SysMenu menu)
{
return Context.Queryable()
- .WhereIF(!string.IsNullOrEmpty(menu.menuName), it => it.menuName.Contains(menu.menuName))
+ .WhereIF(!string.IsNullOrEmpty(menu.MenuName), it => it.MenuName.Contains(menu.MenuName))
.WhereIF(!string.IsNullOrEmpty(menu.visible), it => it.visible == menu.visible)
.WhereIF(!string.IsNullOrEmpty(menu.status), it => it.status == menu.status)
.OrderBy(it => new { it.parentId, it.orderNum })
@@ -40,8 +40,8 @@ namespace ZR.Repository.System
.Where(r => roles.Contains(r.Role_id));
return Context.Queryable()
- .InnerJoin(roleMenus, (c, j) => c.menuId == j.Menu_id)
- .WhereIF(!string.IsNullOrEmpty(sysMenu.menuName), (c, j) => c.menuName.Contains(sysMenu.menuName))
+ .InnerJoin(roleMenus, (c, j) => c.MenuId == j.Menu_id)
+ .WhereIF(!string.IsNullOrEmpty(sysMenu.MenuName), (c, j) => c.MenuName.Contains(sysMenu.MenuName))
.WhereIF(!string.IsNullOrEmpty(sysMenu.visible), (c, j) => c.visible == sysMenu.visible)
.WhereIF(!string.IsNullOrEmpty(sysMenu.status), (c, j) => c.status == sysMenu.status)
.OrderBy((c, j) => new { c.parentId, c.orderNum })
@@ -56,7 +56,7 @@ namespace ZR.Repository.System
public List SelectMenuList(SysMenu menu)
{
return Context.Queryable()
- .WhereIF(!string.IsNullOrEmpty(menu.menuName), it => it.menuName.Contains(menu.menuName))
+ .WhereIF(!string.IsNullOrEmpty(menu.MenuName), it => it.MenuName.Contains(menu.MenuName))
.WhereIF(!string.IsNullOrEmpty(menu.visible), it => it.visible == menu.visible)
.WhereIF(!string.IsNullOrEmpty(menu.status), it => it.status == menu.status)
.OrderBy(it => new { it.parentId, it.orderNum })
@@ -75,9 +75,9 @@ namespace ZR.Repository.System
.Where(r => roles.Contains(r.Role_id));
return Context.Queryable()
- .InnerJoin(roleMenus, (c, j) => c.menuId == j.Menu_id)
+ .InnerJoin(roleMenus, (c, j) => c.MenuId == j.Menu_id)
.Where((c, j) => c.status == "0")
- .WhereIF(!string.IsNullOrEmpty(sysMenu.menuName), (c, j) => c.menuName.Contains(sysMenu.menuName))
+ .WhereIF(!string.IsNullOrEmpty(sysMenu.MenuName), (c, j) => c.MenuName.Contains(sysMenu.MenuName))
.WhereIF(!string.IsNullOrEmpty(sysMenu.visible), (c, j) => c.visible == sysMenu.visible)
.OrderBy((c, j) => new { c.parentId, c.orderNum })
.Select(c => c)
@@ -111,7 +111,7 @@ namespace ZR.Repository.System
.Where((menu) =>
menuTypes.Contains(menu.menuType)
&& menu.status == "0"
- && SqlFunc.Subqueryable().Where( s => roleIds.Contains(s.Role_id) && s.Menu_id == menu.menuId).Any())
+ && SqlFunc.Subqueryable().Where( s => roleIds.Contains(s.Role_id) && s.Menu_id == menu.MenuId).Any())
.OrderBy((menu) => new { menu.parentId, menu.orderNum })
.Select((menu) => menu).ToList();
}
@@ -125,7 +125,7 @@ namespace ZR.Repository.System
///
public SysMenu SelectMenuById(int menuId)
{
- return Context.Queryable().Where(it => it.menuId == menuId).Single();
+ return Context.Queryable().Where(it => it.MenuId == menuId).Single();
}
///
@@ -137,7 +137,7 @@ namespace ZR.Repository.System
{
var Db = Context;
menu.Create_time = Db.GetDate();
- menu.menuId = Db.Insertable(menu).ExecuteReturnIdentity();
+ menu.MenuId = Db.Insertable(menu).ExecuteReturnIdentity();
return 1;
}
@@ -158,7 +158,7 @@ namespace ZR.Repository.System
///
public int DeleteMenuById(int menuId)
{
- return Context.Deleteable().Where(it => it.menuId == menuId).ExecuteCommand();
+ return Context.Deleteable().Where(it => it.MenuId == menuId).ExecuteCommand();
}
///
@@ -168,7 +168,7 @@ namespace ZR.Repository.System
///
public int ChangeSortMenu(MenuDto menuDto)
{
- var result = Context.Updateable(new SysMenu() { menuId = menuDto.MenuId, orderNum = menuDto.orderNum })
+ var result = Context.Updateable(new SysMenu() { MenuId = menuDto.MenuId, orderNum = menuDto.orderNum })
.UpdateColumns(it => new { it.orderNum }).ExecuteCommand();
return result;
}
@@ -181,7 +181,7 @@ namespace ZR.Repository.System
public List SelectMenuPermsByUserId(long userId)
{
return Context.Queryable((m, rm, ur, r) => new JoinQueryInfos(
- JoinType.Left, m.menuId == rm.Menu_id,
+ JoinType.Left, m.MenuId == rm.Menu_id,
JoinType.Left, rm.Role_id == ur.RoleId,
JoinType.Left, ur.RoleId == r.RoleId
))
@@ -198,7 +198,7 @@ namespace ZR.Repository.System
public SysMenu CheckMenuNameUnique(SysMenu menu)
{
return Context.Queryable()
- .Where(it => it.menuName == menu.menuName && it.parentId == menu.parentId).Single();
+ .Where(it => it.MenuName == menu.MenuName && it.parentId == menu.parentId).Single();
}
///
diff --git a/ZR.Repository/ZR.Repository.csproj b/ZR.Repository/ZR.Repository.csproj
index 05ba31b..0c5e632 100644
--- a/ZR.Repository/ZR.Repository.csproj
+++ b/ZR.Repository/ZR.Repository.csproj
@@ -13,7 +13,7 @@
-
+
diff --git a/ZR.Service/System/SysMenuService.cs b/ZR.Service/System/SysMenuService.cs
index 7c0c120..5e1dc2c 100644
--- a/ZR.Service/System/SysMenuService.cs
+++ b/ZR.Service/System/SysMenuService.cs
@@ -113,14 +113,14 @@ namespace ZR.Service
///
public string CheckMenuNameUnique(SysMenu menu)
{
- long menuId = menu.menuId == 0 ? -1 : menu.menuId;
+ long menuId = menu.MenuId == 0 ? -1 : menu.MenuId;
SysMenu info = MenuRepository.CheckMenuNameUnique(menu);
//if (info != null && menuId != info.menuId && menu.menuName.Equals(info.menuName))
//{
// return UserConstants.NOT_UNIQUE;
//}
- if (info != null && info.menuId != menu.menuId)
+ if (info != null && info.MenuId != menu.MenuId)
{
return UserConstants.NOT_UNIQUE;
}
@@ -252,7 +252,7 @@ namespace ZR.Service
///
private List GetChildList(List list, SysMenu sysMenu)
{
- return list.Where(p => p.parentId == sysMenu.menuId).ToList();
+ return list.Where(p => p.parentId == sysMenu.MenuId).ToList();
}
///
@@ -272,7 +272,7 @@ namespace ZR.Service
Name = GetRouteName(menu),
Path = GetRoutePath(menu),
Component = GetComponent(menu),
- Meta = new Meta(menu.menuName, menu.icon, "1".Equals(menu.isCache))
+ Meta = new Meta(menu.MenuName, menu.icon, "1".Equals(menu.isCache))
};
List cMenus = menu.children;
@@ -291,7 +291,7 @@ namespace ZR.Service
Path = menu.path,
Component = menu.component,
Name = string.IsNullOrEmpty(menu.path) ? "" : menu.path.ToLower(),
- Meta = new Meta(menu.menuName, menu.icon, "1".Equals(menu.isCache))
+ Meta = new Meta(menu.MenuName, menu.icon, "1".Equals(menu.isCache))
};
childrenList.Add(children);
router.Children = childrenList;
@@ -310,7 +310,7 @@ namespace ZR.Service
public List BuildMenuTree(List menus)
{
List returnList = new List();
- List tempList = menus.Select(f => f.menuId).ToList();
+ List tempList = menus.Select(f => f.MenuId).ToList();
foreach (var menu in menus)
{
diff --git a/ZR.Vue/src/utils/request.js b/ZR.Vue/src/utils/request.js
index a4feaee..58a0262 100644
--- a/ZR.Vue/src/utils/request.js
+++ b/ZR.Vue/src/utils/request.js
@@ -57,12 +57,12 @@ service.interceptors.response.use(res => {
})
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
- } else if (code == 0 || code == 1 || code == 110 || code == 101 || code == 103 || code == 403 || code == 500 || code == 429) {
+ } else if (code == 0 || code == 1 || code == 110 || code == 101 || code == 403 || code == 500 || code == 429) {
Message({
message: msg,
type: 'error'
})
- return Promise.reject(msg)
+ return Promise.reject(res.data)
} else {
//返回标准 code/msg/data字段
return res.data;
diff --git a/ZR.Vue/src/views/login.vue b/ZR.Vue/src/views/login.vue
index f716be7..0003354 100644
--- a/ZR.Vue/src/views/login.vue
+++ b/ZR.Vue/src/views/login.vue
@@ -134,7 +134,8 @@ export default {
this.msgSuccess('登录成功')
this.$router.push({ path: this.redirect || '/' })
})
- .catch(() => {
+ .catch((error) => {
+ this.msgError(error.msg);
this.loading = false
this.getCode()
this.$refs.codeTxt.focus()
diff --git a/document/admin-mysql.sql b/document/admin-mysql.sql
index b8f754b..b905ca7 100644
--- a/document/admin-mysql.sql
+++ b/document/admin-mysql.sql
@@ -681,7 +681,7 @@ insert into sys_config values(3, '主框架页-侧边栏主题', 'sys.
insert into sys_config values(4, '账号自助-验证码开关', 'sys.account.captchaOnOff', 'true', 'Y', 'admin', sysdate(), '', null, '是否开启验证码功能(off、关闭,1、动态验证码 2、动态gif泡泡 3、泡泡 4、静态验证码)');
INSERT INTO `sys_config`(`configId`, `configName`, `configKey`, `configValue`, `configType`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (5, '本地文件上传访问域名', 'sys.file.uploadurl', 'http://localhost:8888', 'Y', '', sysdate(), '', NULL, NULL);
INSERT INTO `sys_config`(`configId`, `configName`, `configKey`, `configValue`, `configType`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (6, '开启注册功能', 'sys.account.register', 'true', 'Y', 'admin', sysdate(), 'admin', NULL, NULL);
-INSERT INTO `sys_config`(`configId`, `configName`, `configKey`, `configValue`, `configType`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (7, '文章预览地址', 'sys.article.preview.url', 'http://www.izhaorui.cn/article/details/', 'Y', 'admin', sysdate(), '', NULL, NULL);
+INSERT INTO `sys_config`(`configId`, `configName`, `configKey`, `configValue`, `configType`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (7, '文章预览地址', 'sys.article.preview.url', 'http://www.izhaorui.cn/article/details/', 'Y', 'admin', sysdate(), '', NULL, '格式:http://www.izhaorui.cn/article/details/{aid},其中{aid}为文章的id');
-- ----------------------------
-- 18、代码生成业务表
@@ -772,7 +772,7 @@ DROP TABLE IF EXISTS `sys_file`;
CREATE TABLE `sys_file` (
`id` BIGINT(11) NOT NULL,
`realName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件真实名',
- `fileName` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件名',
+ `fileName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件名',
`fileUrl` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件存储地址',
`storePath` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '仓库位置',
`accessUrl` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '访问路径',
diff --git a/document/admin-sqlserver.sql b/document/admin-sqlserver.sql
index 374ee07..a52fb1b 100644
--- a/document/admin-sqlserver.sql
+++ b/document/admin-sqlserver.sql
@@ -699,7 +699,7 @@ insert into sys_config values('主框架页-侧边栏主题', 'sys.ind
insert into sys_config values('账号自助-验证码开关', 'sys.account.captchaOnOff', '1', 'Y', 'admin', GETDATE(), '', null, '开启验证码功能(off、关闭,1、动态验证码 2、动态gif泡泡 3、泡泡 4、静态验证码)');
INSERT INTO sys_config VALUES('本地文件上传访问域名', 'sys.file.uploadurl', 'http://localhost:8888', 'Y', 'admin', GETDATE(), '', NULL, NULL);
INSERT INTO sys_config VALUES('开启注册功能', 'sys.account.register', 'true', 'Y', 'admin', GETDATE(), '', NULL, NULL);
-INSERT INTO sys_config VALUES('文章预览地址', 'sys.article.preview.url', 'http://www.izhaorui.cn/article/details/', 'Y', 'admin', GETDATE(), '', NULL, NULL);
+INSERT INTO sys_config VALUES('文章预览地址', 'sys.article.preview.url', 'http://www.izhaorui.cn/article/details/', 'Y', 'admin', GETDATE(), '', NULL, '格式:http://www.izhaorui.cn/article/details/{aid},其中{aid}为文章的id');
GO
@@ -739,7 +739,7 @@ GO
CREATE TABLE [dbo].[sys_file](
[id] [BIGINT] NOT NULL PRIMARY KEY,
[realName] VARCHAR(50) NULL,
- [fileName] [VARCHAR](20) NULL,
+ [fileName] [VARCHAR](50) NULL,
[fileUrl] [VARCHAR](500) NULL,
[storePath] [VARCHAR](50) NULL,
[accessUrl] [VARCHAR](300) NULL,