增加功能:权限细化到按钮 closed #ITIZG

https://gitee.com/LongbowEnterprise/BootstrapAdmin/issues/ITIZG?from=project-issue
comment: 通过Startup将MenuHelper静态方法AuthorizateButtons注入到IButtonAuthorization服务内,通过PermissionTagHelper监控asp-auth属性,通过IButtonAuthorization服务的Authorizate方法获得此按钮是否拥有权限
This commit is contained in:
Argo Zhang 2019-03-22 15:46:32 +08:00
parent 3c3e9ea5a1
commit 4eabb857b3
59 changed files with 2268 additions and 1456 deletions

View File

@ -13,11 +13,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Bootstrap.Security.Mvc" Version="2.2.3" /> <PackageReference Include="Bootstrap.Security.Mvc" Version="2.2.4" />
<PackageReference Include="Longbow.Logging" Version="2.2.5" /> <PackageReference Include="Longbow.Logging" Version="2.2.5" />
<PackageReference Include="Microsoft.AspNetCore.App" /> <PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="3.1.2" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="3.1.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.2" PrivateAssets="All" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" PrivateAssets="All" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
</ItemGroup> </ItemGroup>

Binary file not shown.

View File

@ -1,4 +1,4 @@
using Bootstrap.DataAccess; using Bootstrap.DataAccess;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic; using System.Collections.Generic;
@ -16,16 +16,7 @@ namespace Bootstrap.Admin.Controllers.Api
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("{id}")] [HttpGet("{id}")]
public IEnumerable<App> Post(string id) => AppHelper.RetrievesByRoleId(id); public IEnumerable<App> Get(string id) => AppHelper.RetrievesByRoleId(id);
/// <summary>
/// 保存应用程序授权
/// </summary>
/// <param name="id"></param>
/// <param name="appIds"></param>
/// <returns></returns>
[HttpPut("{id}")]
public bool Put(string id, [FromBody]IEnumerable<string> appIds) => AppHelper.SaveByRoleId(id, appIds);
} }
} }

View File

@ -1,4 +1,4 @@
using Bootstrap.Admin.Query; using Bootstrap.Admin.Query;
using Bootstrap.DataAccess; using Bootstrap.DataAccess;
using Bootstrap.Security; using Bootstrap.Security;
using Longbow.Web.Mvc; using Longbow.Web.Mvc;
@ -30,6 +30,7 @@ namespace Bootstrap.Admin.Controllers.Api
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
[HttpPost] [HttpPost]
[ButtonAuthorize(Url = "~/Admin/Dicts", Auth = "add,edit")]
public bool Post([FromBody]BootstrapDict value) public bool Post([FromBody]BootstrapDict value)
{ {
return DictHelper.Save(value); return DictHelper.Save(value);
@ -40,6 +41,7 @@ namespace Bootstrap.Admin.Controllers.Api
/// <param name="value"></param> /// <param name="value"></param>
[HttpDelete] [HttpDelete]
[Authorize(Roles = "Administrators")] [Authorize(Roles = "Administrators")]
[ButtonAuthorize(Url = "~/Admin/Dicts", Auth = "del")]
public bool Delete([FromBody]IEnumerable<string> value) public bool Delete([FromBody]IEnumerable<string> value)
{ {
return DictHelper.Delete(value); return DictHelper.Delete(value);

View File

@ -1,4 +1,4 @@
using Bootstrap.Admin.Query; using Bootstrap.Admin.Query;
using Longbow.Web.Mvc; using Longbow.Web.Mvc;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System; using System;
@ -28,10 +28,11 @@ namespace Bootstrap.Admin.Controllers.Api
} }
/// <summary> /// <summary>
/// /// 异常程序页面点击服务器日志按钮获取所有物理日志文件列表方法
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[ButtonAuthorize(Url = "~/Admin/Exceptions", Auth = "log")]
public IEnumerable<string> Post() public IEnumerable<string> Post()
{ {
var filePath = Path.Combine(AppContext.BaseDirectory, "Error"); var filePath = Path.Combine(AppContext.BaseDirectory, "Error");
@ -43,10 +44,11 @@ namespace Bootstrap.Admin.Controllers.Api
} }
/// <summary> /// <summary>
/// /// 选中指定文件查看其内容方法
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPut] [HttpPut]
[ButtonAuthorize(Url = "~/Admin/Exceptions", Auth = "log")]
public JsonResult Put([FromBody]ExceptionFileQuery exceptionFile) public JsonResult Put([FromBody]ExceptionFileQuery exceptionFile)
{ {
var filePath = Path.Combine(AppContext.BaseDirectory, "Error"); var filePath = Path.Combine(AppContext.BaseDirectory, "Error");
@ -66,7 +68,7 @@ namespace Bootstrap.Admin.Controllers.Api
else if (line.StartsWith("Exception Type: Longbow.Data.DBAccessException")) sb.AppendFormat("<div class='logDbExcep'>{0}</div>", line); else if (line.StartsWith("Exception Type: Longbow.Data.DBAccessException")) sb.AppendFormat("<div class='logDbExcep'>{0}</div>", line);
else if (line.StartsWith("StackTrace Information")) sb.AppendFormat("<b>{0}</b><br>", line); else if (line.StartsWith("StackTrace Information")) sb.AppendFormat("<b>{0}</b><br>", line);
else sb.AppendFormat("{0}<br>", line); else sb.AppendFormat("{0}<br>", line);
}; }
} }
return new JsonResult(sb.ToString()); return new JsonResult(sb.ToString());
} }

View File

@ -1,4 +1,4 @@
using Bootstrap.Admin.Query; using Bootstrap.Admin.Query;
using Bootstrap.DataAccess; using Bootstrap.DataAccess;
using Longbow.Web.Mvc; using Longbow.Web.Mvc;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@ -41,6 +41,7 @@ namespace Bootstrap.Admin.Controllers.Api
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
[HttpPost] [HttpPost]
[ButtonAuthorize(Url = "~/Admin/Groups", Auth = "add,edit")]
public bool Post([FromBody]Group value) public bool Post([FromBody]Group value)
{ {
return GroupHelper.Save(value); return GroupHelper.Save(value);
@ -51,6 +52,7 @@ namespace Bootstrap.Admin.Controllers.Api
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
[HttpDelete] [HttpDelete]
[ButtonAuthorize(Url = "~/Admin/Groups", Auth = "del")]
public bool Delete([FromBody]IEnumerable<string> value) public bool Delete([FromBody]IEnumerable<string> value)
{ {
return GroupHelper.Delete(value); return GroupHelper.Delete(value);
@ -82,20 +84,21 @@ namespace Bootstrap.Admin.Controllers.Api
/// 保存部门授权 /// 保存部门授权
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id"></param>
/// <param name="groupIds"></param> /// <param name="values"></param>
/// <param name="type"></param> /// <param name="type"></param>
/// <returns></returns> /// <returns></returns>
[HttpPut("{id}")] [HttpPut("{id}")]
public bool Put(string id, [FromBody]IEnumerable<string> groupIds, [FromQuery]string type) [ButtonAuthorize(Url = "~/Admin/Groups", Auth = "assignUser,assignRole")]
public bool Put(string id, [FromBody]IEnumerable<string> values, [FromQuery]string type)
{ {
var ret = false; var ret = false;
switch (type) switch (type)
{ {
case "user": case "user":
ret = GroupHelper.SaveByUserId(id, groupIds); ret = UserHelper.SaveByGroupId(id, values);
break; break;
case "role": case "role":
ret = GroupHelper.SaveByRoleId(id, groupIds); ret = RoleHelper.SaveByGroupId(id, values);
break; break;
} }
return ret; return ret;

View File

@ -1,4 +1,4 @@
using Bootstrap.Admin.Query; using Bootstrap.Admin.Query;
using Bootstrap.DataAccess; using Bootstrap.DataAccess;
using Bootstrap.Security; using Bootstrap.Security;
using Longbow.Web.Mvc; using Longbow.Web.Mvc;
@ -30,6 +30,7 @@ namespace Bootstrap.Admin.Controllers.Api
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
[HttpPost] [HttpPost]
[ButtonAuthorize(Url = "~/Admin/Menus", Auth = "add,edit")]
public bool Post([FromBody]BootstrapMenu value) public bool Post([FromBody]BootstrapMenu value)
{ {
return MenuHelper.Save(value); return MenuHelper.Save(value);
@ -40,6 +41,7 @@ namespace Bootstrap.Admin.Controllers.Api
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
[HttpDelete] [HttpDelete]
[ButtonAuthorize(Url = "~/Admin/Menus", Auth = "del")]
public bool Delete([FromBody]IEnumerable<string> value) public bool Delete([FromBody]IEnumerable<string> value)
{ {
return MenuHelper.Delete(value); return MenuHelper.Delete(value);
@ -70,13 +72,14 @@ namespace Bootstrap.Admin.Controllers.Api
/// <summary> /// <summary>
/// 角色管理菜单授权保存按钮调用 /// 角色管理菜单授权保存按钮调用
/// </summary> /// </summary>
/// <param name="id">角色ID</param> /// <param name="id">菜单ID</param>
/// <param name="value">菜单ID集合</param> /// <param name="roleIds">角色ID集合</param>
/// <returns></returns> /// <returns></returns>
[HttpPut("{id}")] [HttpPut("{id}")]
public bool Put(string id, [FromBody]IEnumerable<string> value) [ButtonAuthorize(Url = "~/Admin/Menus", Auth = "assignRole")]
public bool Put(string id, [FromBody]IEnumerable<string> roleIds)
{ {
return MenuHelper.SaveMenusByRoleId(id, value); return RoleHelper.SavaByMenuId(id, roleIds);
} }
} }
} }

View File

@ -1,12 +1,12 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Threading; using System.Threading;
namespace Bootstrap.Admin.Controllers.Api namespace Bootstrap.Admin.Controllers.Api
{ {
/// <summary> /// <summary>
@ -20,8 +20,8 @@ namespace Bootstrap.Admin.Controllers.Api
/// 获取所有在线用户数据 /// 获取所有在线用户数据
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost()] [HttpGet()]
public IEnumerable<OnlineUser> Post([FromServices]IOnlineUsers onlineUSers) public IEnumerable<OnlineUser> Get([FromServices]IOnlineUsers onlineUSers)
{ {
return onlineUSers.OnlineUsers.OrderByDescending(u => u.LastAccessTime); return onlineUSers.OnlineUsers.OrderByDescending(u => u.LastAccessTime);
} }
@ -39,101 +39,101 @@ namespace Bootstrap.Admin.Controllers.Api
return user?.RequestUrls ?? new KeyValuePair<DateTime, string>[0]; return user?.RequestUrls ?? new KeyValuePair<DateTime, string>[0];
} }
/// <summary> /// <summary>
/// 登录页面检查调用 /// 登录页面检查调用
/// </summary> /// </summary>
/// <returns>返回真时 启用行为验证码</returns> /// <returns>返回真时 启用行为验证码</returns>
[HttpPut] [HttpPut]
[AllowAnonymous] [AllowAnonymous]
public bool Put() public bool Put()
{ {
var ip = (Request.HttpContext.Connection.RemoteIpAddress ?? IPAddress.IPv6Loopback).ToString(); var ip = (Request.HttpContext.Connection.RemoteIpAddress ?? IPAddress.IPv6Loopback).ToString();
if (_loginUsers.TryGetValue(ip, out var user)) if (_loginUsers.TryGetValue(ip, out var user))
{ {
user.Reset(); user.Reset();
user.User.Count++; user.User.Count++;
return user.User.Count > 2; return user.User.Count > 2;
} }
var loginUser = new LoginUser() { Ip = ip }; var loginUser = new LoginUser() { Ip = ip };
_loginUsers.TryAdd(ip, new LoginUserCache(loginUser, () => _loginUsers.TryRemove(ip, out _))); _loginUsers.TryAdd(ip, new LoginUserCache(loginUser, () => _loginUsers.TryRemove(ip, out _)));
return false; return false;
} }
private static ConcurrentDictionary<string, LoginUserCache> _loginUsers = new ConcurrentDictionary<string, LoginUserCache>(); private static ConcurrentDictionary<string, LoginUserCache> _loginUsers = new ConcurrentDictionary<string, LoginUserCache>();
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
private class LoginUser private class LoginUser
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public string Ip { get; set; } public string Ip { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public int Count { get; set; } public int Count { get; set; }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
private class LoginUserCache : IDisposable private class LoginUserCache : IDisposable
{ {
private Timer dispatcher; private Timer dispatcher;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="user"></param> /// <param name="user"></param>
/// <param name="action"></param> /// <param name="action"></param>
public LoginUserCache(LoginUser user, Action action) public LoginUserCache(LoginUser user, Action action)
{ {
User = user; User = user;
dispatcher = new Timer(_ => action(), null, TimeSpan.FromSeconds(30), Timeout.InfiniteTimeSpan); dispatcher = new Timer(_ => action(), null, TimeSpan.FromSeconds(30), Timeout.InfiniteTimeSpan);
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public LoginUser User { get; set; } public LoginUser User { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public void Reset() public void Reset()
{ {
if (dispatcher != null) dispatcher.Change(TimeSpan.FromSeconds(30), Timeout.InfiniteTimeSpan); if (dispatcher != null) dispatcher.Change(TimeSpan.FromSeconds(30), Timeout.InfiniteTimeSpan);
} }
#region Impletement IDispose #region Impletement IDispose
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="disposing"></param> /// <param name="disposing"></param>
protected virtual void Dispose(bool disposing) protected virtual void Dispose(bool disposing)
{ {
if (disposing) if (disposing)
{ {
if (dispatcher != null) if (dispatcher != null)
{ {
dispatcher.Dispose(); dispatcher.Dispose();
dispatcher = null; dispatcher = null;
} }
} }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public void Dispose() public void Dispose()
{ {
Dispose(true); Dispose(true);
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
#endregion #endregion
} }
} }
} }

View File

@ -1,4 +1,4 @@
using Bootstrap.DataAccess; using Bootstrap.DataAccess;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@ -23,6 +23,7 @@ namespace Bootstrap.Admin.Controllers.Api
/// <param name="files">表单数据集合</param> /// <param name="files">表单数据集合</param>
/// <returns></returns> /// <returns></returns>
[HttpPost("{id}")] [HttpPost("{id}")]
[ButtonAuthorize(Url = "~/Admin/Profiles", Auth = "saveIcon")]
public JsonResult Post(string id, [FromServices]IHostingEnvironment env, [FromForm]DeleteFileCollection files) public JsonResult Post(string id, [FromServices]IHostingEnvironment env, [FromForm]DeleteFileCollection files)
{ {
if (!id.Equals("Delete", StringComparison.OrdinalIgnoreCase) || files.Key.Equals("default.jpg", StringComparison.OrdinalIgnoreCase)) return new JsonResult(new object()); if (!id.Equals("Delete", StringComparison.OrdinalIgnoreCase) || files.Key.Equals("default.jpg", StringComparison.OrdinalIgnoreCase)) return new JsonResult(new object());
@ -79,6 +80,7 @@ namespace Bootstrap.Admin.Controllers.Api
/// <param name="files"></param> /// <param name="files"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[ButtonAuthorize(Url = "~/Admin/Profiles", Auth = "saveIcon")]
public async Task<JsonResult> Post([FromServices]IHostingEnvironment env, IFormCollection files) public async Task<JsonResult> Post([FromServices]IHostingEnvironment env, IFormCollection files)
{ {
var previewUrl = string.Empty; var previewUrl = string.Empty;
@ -114,5 +116,30 @@ namespace Bootstrap.Admin.Controllers.Api
append = false append = false
}); });
} }
/// <summary>
///
/// </summary>
/// <returns></returns>
[HttpPut]
[ButtonAuthorize(Url = "~/Admin/Profiles", Auth = "saveDisplayName,savePassword,saveApp,saveTheme")]
public bool Put([FromBody]User value)
{
var ret = false;
if (value.UserStatus == UserStates.ChangeTheme)
{
return UserHelper.SaveUserCssByName(value.UserName, value.Css);
}
if (value.UserName.Equals(User.Identity.Name, StringComparison.OrdinalIgnoreCase))
{
if (value.UserStatus == UserStates.ChangeDisplayName)
ret = UserHelper.SaveDisplayName(value.UserName, value.DisplayName);
else if (value.UserStatus == UserStates.ChangePassword)
ret = UserHelper.ChangePassword(value.UserName, value.Password, value.NewPassword);
else if (value.UserStatus == UserStates.SaveApp)
ret = UserHelper.SaveApp(value.UserName, value.App);
}
return ret;
}
} }
} }

View File

@ -1,4 +1,4 @@
using Bootstrap.Admin.Query; using Bootstrap.Admin.Query;
using Bootstrap.DataAccess; using Bootstrap.DataAccess;
using Longbow.Web.Mvc; using Longbow.Web.Mvc;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@ -52,24 +52,28 @@ namespace Bootstrap.Admin.Controllers.Api
/// <summary> /// <summary>
/// 保存角色 /// 保存角色
/// </summary> /// </summary>
/// <param name="id">用户ID/部门ID/菜单ID</param> /// <param name="id">角色ID</param>
/// <param name="roleIds">选中的角色ID集合</param> /// <param name="values">选中的ID集合</param>
/// <param name="type">type=menu时菜单维护页面对角色授权弹框保存按钮调用</param> /// <param name="type">type=menu时菜单维护页面对角色授权弹框保存按钮调用</param>
/// <returns></returns> /// <returns></returns>
[HttpPut("{id}")] [HttpPut("{id}")]
public bool Put(string id, [FromBody]IEnumerable<string> roleIds, [FromQuery]string type) [ButtonAuthorize(Url = "~/Admin/Roles", Auth = "assignUser,assignGroup,assignMenu,assignApp")]
public bool Put(string id, [FromBody]IEnumerable<string> values, [FromQuery]string type)
{ {
var ret = false; var ret = false;
switch (type) switch (type)
{ {
case "user": case "user":
ret = RoleHelper.SaveByUserId(id, roleIds); ret = UserHelper.SaveByRoleId(id, values);
break; break;
case "group": case "group":
ret = RoleHelper.SaveByGroupId(id, roleIds); ret = GroupHelper.SaveByRoleId(id, values);
break; break;
case "menu": case "menu":
ret = RoleHelper.SavaByMenuId(id, roleIds); ret = MenuHelper.SaveMenusByRoleId(id, values);
break;
case "app":
ret = AppHelper.SaveByRoleId(id, values);
break; break;
} }
return ret; return ret;
@ -79,6 +83,7 @@ namespace Bootstrap.Admin.Controllers.Api
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
[HttpPost] [HttpPost]
[ButtonAuthorize(Url = "~/Admin/Roles", Auth = "add,edit")]
public bool Post([FromBody]Role value) public bool Post([FromBody]Role value)
{ {
return RoleHelper.Save(value); return RoleHelper.Save(value);
@ -88,6 +93,7 @@ namespace Bootstrap.Admin.Controllers.Api
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
[HttpDelete] [HttpDelete]
[ButtonAuthorize(Url = "~/Admin/Roles", Auth = "del")]
public bool Delete([FromBody]IEnumerable<string> value) public bool Delete([FromBody]IEnumerable<string> value)
{ {
return RoleHelper.Delete(value); return RoleHelper.Delete(value);

View File

@ -1,4 +1,4 @@
using Bootstrap.DataAccess; using Bootstrap.DataAccess;
using Bootstrap.Security; using Bootstrap.Security;
using Longbow.Cache; using Longbow.Cache;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@ -19,18 +19,13 @@ namespace Bootstrap.Admin.Controllers.Api
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public bool Post([FromBody]BootstrapDict value) [ButtonAuthorize(Url = "~/Admin/Settings", Auth = "saveTitle,saveFooter,saveTheme")]
{ public bool Post([FromBody]BootstrapDict value) => DictHelper.SaveSettings(value);
//保存个性化设置
return DictHelper.SaveSettings(value);
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[HttpGet] [HttpGet]
public IEnumerable<ICacheCorsItem> Get() public IEnumerable<ICacheCorsItem> Get() => CacheManager.CorsSites;
{
return CacheManager.CorsSites;
}
} }
} }

View File

@ -1,4 +1,4 @@
using Bootstrap.Admin.Query; using Bootstrap.Admin.Query;
using Bootstrap.DataAccess; using Bootstrap.DataAccess;
using Longbow.Web.Mvc; using Longbow.Web.Mvc;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
@ -26,31 +26,7 @@ namespace Bootstrap.Admin.Controllers.Api
{ {
return value.RetrieveData(); return value.RetrieveData();
} }
/// <summary>
///
/// </summary>
/// <returns></returns>
[HttpPut]
public bool Put([FromBody]User value)
{
if (User.IsInRole("Administrators")) return false;
var ret = false;
if (value.UserStatus == UserStates.ChangeTheme)
{
return UserHelper.SaveUserCssByName(value.UserName, value.Css);
}
if (value.UserName.Equals(User.Identity.Name, StringComparison.OrdinalIgnoreCase))
{
if (value.UserStatus == UserStates.ChangeDisplayName)
ret = UserHelper.SaveDisplayName(value.UserName, value.DisplayName);
else if (value.UserStatus == UserStates.ChangePassword)
ret = UserHelper.ChangePassword(value.UserName, value.Password, value.NewPassword);
else if (value.UserStatus == UserStates.SaveApp)
ret = UserHelper.SaveApp(value.UserName, value.App);
}
return ret;
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -81,11 +57,13 @@ namespace Bootstrap.Admin.Controllers.Api
} }
return ret; return ret;
} }
/// <summary> /// <summary>
/// 前台User View调用新建/更新用户 /// 前台User View调用新建/更新用户
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
[HttpPost] [HttpPost]
[ButtonAuthorize(Url = "~/Admin/Users", Auth = "add,edit")]
public bool Post([FromBody]User value) public bool Post([FromBody]User value)
{ {
var ret = false; var ret = false;
@ -102,37 +80,42 @@ namespace Bootstrap.Admin.Controllers.Api
} }
return ret; return ret;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id"></param>
/// <param name="userIds"></param> /// <param name="values"></param>
/// <param name="type"></param> /// <param name="type"></param>
/// <returns></returns> /// <returns></returns>
[HttpPut("{id}")] [HttpPut("{id}")]
public bool Put(string id, [FromBody]IEnumerable<string> userIds, [FromQuery]string type) [ButtonAuthorize(Url = "~/Admin/Users", Auth = "assignRole,assignGroup")]
public bool Put(string id, [FromBody]IEnumerable<string> values, [FromQuery]string type)
{ {
var ret = false; var ret = false;
switch (type) switch (type)
{ {
case "role": case "role":
ret = UserHelper.SaveByRoleId(id, userIds); ret = RoleHelper.SaveByUserId(id, values);
break; break;
case "group": case "group":
ret = UserHelper.SaveByGroupId(id, userIds); ret = GroupHelper.SaveByUserId(id, values);
break; break;
} }
return ret; return ret;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
[HttpDelete] [HttpDelete]
[ButtonAuthorize(Url = "~/Admin/Users", Auth = "del")]
public bool Delete([FromBody]IEnumerable<string> value) public bool Delete([FromBody]IEnumerable<string> value)
{ {
return UserHelper.Delete(value); return UserHelper.Delete(value);
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

View File

@ -1,34 +1,36 @@
using Bootstrap.DataAccess; using Bootstrap.DataAccess;
using Bootstrap.Security; using Bootstrap.Security;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace Bootstrap.Admin.Models namespace Bootstrap.Admin.Models
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public class NavigatorBarModel : HeaderBarModel public class NavigatorBarModel : HeaderBarModel
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="controller"></param> /// <param name="controller"></param>
public NavigatorBarModel(ControllerBase controller) : base(controller.User.Identity) public NavigatorBarModel(ControllerBase controller) : base(controller.User.Identity)
{ {
Navigations = MenuHelper.RetrieveSystemMenus(UserName, $"~{controller.HttpContext.Request.Path}"); Navigations = MenuHelper.RetrieveSystemMenus(UserName, $"~{controller.HttpContext.Request.Path}");
var authApps = AppHelper.RetrievesByUserName(controller.User.Identity.Name); var authApps = AppHelper.RetrievesByUserName(controller.User.Identity.Name);
Applications = DictHelper.RetrieveApps().Where(app => app.Key == "0" || authApps.Any(key => key.Equals(app.Key, StringComparison.OrdinalIgnoreCase))); Applications = DictHelper.RetrieveApps().Where(app => app.Key == "0" || authApps.Any(key => key.Equals(app.Key, StringComparison.OrdinalIgnoreCase)));
} }
/// <summary>
/// /// <summary>
/// </summary> ///
public IEnumerable<BootstrapMenu> Navigations { get; private set; } /// </summary>
/// <summary> public IEnumerable<BootstrapMenu> Navigations { get; private set; }
///
/// </summary> /// <summary>
public IEnumerable<KeyValuePair<string, string>> Applications { get; private set; } ///
} /// </summary>
public IEnumerable<KeyValuePair<string, string>> Applications { get; private set; }
}
} }

View File

@ -1,153 +1,154 @@
using Bootstrap.DataAccess; using Bootstrap.DataAccess;
using Bootstrap.Security.Filter; using Bootstrap.Security.Filter;
using Longbow.Web; using Longbow.Web;
using Longbow.Web.SignalR; using Longbow.Web.SignalR;
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Versioning; using Microsoft.AspNetCore.Mvc.Versioning;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Serialization;
using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.Swagger;
using System; using System;
using System.IO; using System.IO;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using System.Text.Unicode; using System.Text.Unicode;
namespace Bootstrap.Admin namespace Bootstrap.Admin
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public class Startup public class Startup
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="configuration"></param> /// <param name="configuration"></param>
public Startup(IConfiguration configuration) public Startup(IConfiguration configuration)
{ {
Configuration = configuration; Configuration = configuration;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public IConfiguration Configuration { get; } public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="services"></param> /// <param name="services"></param>
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddSingleton(HtmlEncoder.Create(UnicodeRanges.All)); services.AddSingleton(HtmlEncoder.Create(UnicodeRanges.All));
services.Configure<CookiePolicyOptions>(options => services.Configure<CookiePolicyOptions>(options =>
{ {
// This lambda determines whether user consent for non-essential cookies is needed for a given request. // This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true; options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None; options.MinimumSameSitePolicy = SameSiteMode.None;
}); });
services.AddCors(); services.AddCors();
services.AddLogging(builder => builder.AddFileLogger().AddDBLogger(ExceptionsHelper.Log)); services.AddLogging(builder => builder.AddFileLogger().AddDBLogger(ExceptionsHelper.Log));
services.AddConfigurationManager(Configuration); services.AddConfigurationManager(Configuration);
services.AddCacheManager(Configuration); services.AddCacheManager(Configuration);
services.AddDbAdapter(); services.AddDbAdapter();
services.AddOnlineUsers(); services.AddOnlineUsers();
var dataProtectionBuilder = services.AddDataProtection(op => op.ApplicationDiscriminator = Configuration["ApplicationDiscriminator"]) var dataProtectionBuilder = services.AddDataProtection(op => op.ApplicationDiscriminator = Configuration["ApplicationDiscriminator"])
.SetApplicationName(Configuration["ApplicationName"]) .SetApplicationName(Configuration["ApplicationName"])
.PersistKeysToFileSystem(new DirectoryInfo(Configuration["KeyPath"])); .PersistKeysToFileSystem(new DirectoryInfo(Configuration["KeyPath"]));
if (Configuration["DisableAutomaticKeyGeneration"] == "True") dataProtectionBuilder.DisableAutomaticKeyGeneration(); if (Configuration["DisableAutomaticKeyGeneration"] == "True") dataProtectionBuilder.DisableAutomaticKeyGeneration();
services.AddSignalR().AddJsonProtocalDefault(); services.AddSignalR().AddJsonProtocalDefault();
services.AddSignalRExceptionFilterHandler<SignalRHub>(async (client, ex) => await SignalRManager.Send(client, ex)); services.AddSignalRExceptionFilterHandler<SignalRHub>(async (client, ex) => await SignalRManager.Send(client, ex));
services.AddResponseCompression(); services.AddResponseCompression();
services.AddMvc(options => services.AddMvc(options =>
{ {
options.Filters.Add<BootstrapAdminAuthorizeFilter>(); options.Filters.Add<BootstrapAdminAuthorizeFilter>();
options.Filters.Add<ExceptionFilter>(); options.Filters.Add<ExceptionFilter>();
options.Filters.Add<SignalRExceptionFilter<SignalRHub>>(); options.Filters.Add<SignalRExceptionFilter<SignalRHub>>();
}).AddJsonOptions(options => }).AddJsonOptions(options =>
{ {
options.SerializerSettings.ContractResolver = new DefaultContractResolver(); options.SerializerSettings.ContractResolver = new DefaultContractResolver();
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss"; options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
JsonConvert.DefaultSettings = () => options.SerializerSettings; JsonConvert.DefaultSettings = () => options.SerializerSettings;
}).SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }).SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => options.Cookie.Path = "/"); services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => options.Cookie.Path = "/");
services.AddApiVersioning(option => services.AddApiVersioning(option =>
{ {
option.DefaultApiVersion = new ApiVersion(1, 0); option.DefaultApiVersion = new ApiVersion(1, 0);
option.ReportApiVersions = true; option.ReportApiVersions = true;
option.AssumeDefaultVersionWhenUnspecified = true; option.AssumeDefaultVersionWhenUnspecified = true;
option.ApiVersionReader = ApiVersionReader.Combine(new HeaderApiVersionReader("api-version"), new QueryStringApiVersionReader("api-version")); option.ApiVersionReader = ApiVersionReader.Combine(new HeaderApiVersionReader("api-version"), new QueryStringApiVersionReader("api-version"));
}); });
services.AddSwaggerGen(options => services.AddSwaggerGen(options =>
{ {
options.SwaggerDoc("v1", new Info options.SwaggerDoc("v1", new Info
{ {
Version = "v1", Version = "v1",
Title = "BootstrapAdmin API" Title = "BootstrapAdmin API"
}); });
//Set the comments path for the swagger json and ui. //Set the comments path for the swagger json and ui.
var xmlPath = Path.Combine(AppContext.BaseDirectory, "Bootstrap.Admin.xml"); var xmlPath = Path.Combine(AppContext.BaseDirectory, "Bootstrap.Admin.xml");
options.IncludeXmlComments(xmlPath); options.IncludeXmlComments(xmlPath);
options.OperationFilter<HttpHeaderOperation>(); // 添加httpHeader参数 options.OperationFilter<HttpHeaderOperation>(); // 添加httpHeader参数
}); });
} services.AddButtonAuthorization(MenuHelper.AuthorizateButtons);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
/// <summary> // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
/// /// <summary>
/// </summary> ///
/// <param name="app"></param> /// </summary>
/// <param name="env"></param> /// <param name="app"></param>
public void Configure(IApplicationBuilder app, IHostingEnvironment env) /// <param name="env"></param>
{ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
if (env.IsDevelopment()) {
{ if (env.IsDevelopment())
app.UseDeveloperExceptionPage(); {
} app.UseDeveloperExceptionPage();
else }
{ else
app.UseExceptionHandler("/Home/Error"); {
app.UseHsts(); app.UseExceptionHandler("/Home/Error");
} app.UseHsts();
app.UseStatusCodePagesWithReExecute("/Home/Error/{0}"); }
app.UseCors(builder => builder.WithOrigins(Configuration["AllowOrigins"].Split(',', StringSplitOptions.RemoveEmptyEntries)).AllowAnyHeader().AllowAnyMethod().AllowCredentials()); app.UseStatusCodePagesWithReExecute("/Home/Error/{0}");
app.UseHttpsRedirection(); app.UseCors(builder => builder.WithOrigins(Configuration["AllowOrigins"].Split(',', StringSplitOptions.RemoveEmptyEntries)).AllowAnyHeader().AllowAnyMethod().AllowCredentials());
app.UseResponseCompression(); app.UseHttpsRedirection();
app.UseStaticFiles(); app.UseResponseCompression();
app.UseAuthentication(); app.UseStaticFiles();
app.UseBootstrapAdminAuthorization(RoleHelper.RetrieveRolesByUserName, RoleHelper.RetrieveRolesByUrl, AppHelper.RetrievesByUserName); app.UseAuthentication();
app.UseOnlineUsers(); app.UseBootstrapAdminAuthorization(RoleHelper.RetrieveRolesByUserName, RoleHelper.RetrieveRolesByUrl, AppHelper.RetrievesByUserName);
app.UseCacheManagerCorsHandler(); app.UseOnlineUsers();
app.UseSignalR(routes => { routes.MapHub<SignalRHub>("/NotiHub"); }); app.UseCacheManagerCorsHandler();
app.UseMvc(routes => app.UseSignalR(routes => { routes.MapHub<SignalRHub>("/NotiHub"); });
{ app.UseMvc(routes =>
routes.MapRoute( {
name: "default", routes.MapRoute(
template: "{controller=Home}/{action=Index}/{id?}"); name: "default",
}); template: "{controller=Home}/{action=Index}/{id?}");
app.UseWhen(context => context.Request.Path.StartsWithSegments("/swagger"), builder => });
{ app.UseWhen(context => context.Request.Path.StartsWithSegments("/swagger"), builder =>
builder.Use(async (context, next) => {
{ builder.Use(async (context, next) =>
if (!context.User.Identity.IsAuthenticated) await context.ChallengeAsync(); {
else await next(); if (!context.User.Identity.IsAuthenticated) await context.ChallengeAsync();
}); else await next();
}); });
app.UseSwagger(); });
app.UseSwaggerUI(c => app.UseSwagger();
{ app.UseSwaggerUI(c =>
c.SwaggerEndpoint($"{Configuration["SwaggerPathBase"]}/swagger/v1/swagger.json", "BootstrapAdmin API V1"); {
}); c.SwaggerEndpoint($"{Configuration["SwaggerPathBase"]}/swagger/v1/swagger.json", "BootstrapAdmin API V1");
} });
} }
}
} }

View File

@ -1,86 +1,78 @@
@model NavigatorBarModel @model NavigatorBarModel
@{ @{
ViewBag.Title = "字典表维护"; ViewBag.Title = "字典表维护";
Layout = "_Default"; Layout = "_Default";
} }
@section javascript { @section javascript {
<environment include="Development"> <environment include="Development">
<script src="~/lib/bootstrap-3-typeahead/bootstrap3-typeahead.js"></script> <script src="~/lib/bootstrap-3-typeahead/bootstrap3-typeahead.js"></script>
</environment> </environment>
<environment exclude="Development"> <environment exclude="Development">
<script src="~/lib/bootstrap-3-typeahead/bootstrap3-typeahead.min.js"></script> <script src="~/lib/bootstrap-3-typeahead/bootstrap3-typeahead.min.js"></script>
</environment> </environment>
<script src="~/js/dicts.js" asp-append-version="true"></script> <script src="~/js/dicts.js" asp-append-version="true"></script>
} }
@section query { @section query {
<form class="form-inline"> <form class="form-inline">
<div class="row"> <div class="row">
<div class="form-group col-sm-6 col-md-auto"> <div class="form-group col-sm-6 col-md-auto">
<label class="control-label" for="txt_dict_cate">字典标签</label> <label class="control-label" for="txt_dict_cate">字典标签</label>
<input type="text" class="form-control" id="txt_dict_cate" data-provide="typeahead" /> <input type="text" class="form-control" id="txt_dict_cate" data-provide="typeahead" />
</div> </div>
<div class="form-group col-sm-6 col-md-auto"> <div class="form-group col-sm-6 col-md-auto">
<label class="control-label" for="txt_dict_name">字典名称</label> <label class="control-label" for="txt_dict_name">字典名称</label>
<input type="text" class="form-control" id="txt_dict_name" /> <input type="text" class="form-control" id="txt_dict_name" />
</div> </div>
<div class="form-group form-group-dropdown col-sm-6 col-md-auto"> <div class="form-group form-group-dropdown col-sm-6 col-md-auto">
<label class="control-label" for="txt_dict_define">字典类别</label> <label class="control-label" for="txt_dict_define">字典类别</label>
<div class="dropdown"> <div class="dropdown">
<button id="txt_dict_define" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown">全部</button> <button id="txt_dict_define" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown">全部</button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a href="#" data-val="">全部</a> <a href="#" data-val="">全部</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a href="#" data-val="0">系统使用</a> <a href="#" data-val="0">系统使用</a>
<a href="#" data-val="1">自定义</a> <a href="#" data-val="1">自定义</a>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group col-sm-6 col-md-auto flex-md-fill justify-content-md-end"> <div class="form-group col-sm-6 col-md-auto flex-md-fill justify-content-md-end">
<button type="button" id="btn_query" class="btn btn-primary btn-fill"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button> <button type="button" id="btn_query" class="btn btn-primary btn-fill"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button>
</div> </div>
</div> </div>
</form> </form>
} }
@section toolbar { @section modal {
<div class="toolbar btn-group dropdown"> <div class="modal-header">
<button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" type="button"><i class="fa fa-gear"></i></button> <h5 class="modal-title" id="myModalLabel">字典编辑窗口</h5>
<div class="dropdown-menu"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
@await Html.PartialAsync("_ButtonBarGroup") </div>
</div> <div class="modal-body">
</div> <form class="form-inline">
} <div class="row">
@section modal { <input type="hidden" id="dictID" />
<div class="modal-header"> <div class="form-group col-12">
<h5 class="modal-title" id="myModalLabel">字典编辑窗口</h5> <label class="control-label" for="dictCate">字典标签</label>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <input type="text" class="form-control flex-sm-fill" id="dictCate" placeholder="不可为空50字以内" maxlength="50" data-valid="true" />
</div> </div>
<div class="modal-body"> <div class="form-group col-12">
<form class="form-inline"> <label class="control-label" for="dictName">字典名称</label>
<div class="row"> <input type="text" class="form-control flex-sm-fill" id="dictName" placeholder="不可为空50字以内" maxlength="50" data-valid="true" />
<input type="hidden" id="dictID" /> </div>
<div class="form-group col-12"> <div class="form-group col-12">
<label class="control-label" for="dictCate">字典标签</label> <label class="control-label" for="dictCode">字典代码</label>
<input type="text" class="form-control flex-sm-fill" id="dictCate" placeholder="不可为空50字以内" maxlength="50" data-valid="true" /> <input type="text" class="form-control flex-sm-fill" id="dictCode" placeholder="不可为空50字以内" maxlength="50" data-valid="true" />
</div> </div>
<div class="form-group col-12"> <div class="form-group form-group-dropdown col-12">
<label class="control-label" for="dictName">字典名称</label> <label class="control-label" for="dictDefine">字典类型</label>
<input type="text" class="form-control flex-sm-fill" id="dictName" placeholder="不可为空50字以内" maxlength="50" data-valid="true" /> <div class="dropdown">
</div> <button id="dictDefine" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown" data-default-val="1">全部</button>
<div class="form-group col-12"> <div class="dropdown-menu">
<label class="control-label" for="dictCode">字典代码</label> <a href="#" data-val="0">系统使用</a>
<input type="text" class="form-control flex-sm-fill" id="dictCode" placeholder="不可为空50字以内" maxlength="50" data-valid="true" /> <a href="#" data-val="1">自定义</a>
</div> </div>
<div class="form-group form-group-dropdown col-12"> </div>
<label class="control-label" for="dictDefine">字典类型</label> </div>
<div class="dropdown"> </div>
<button id="dictDefine" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown" data-default-val="1">全部</button> </form>
<div class="dropdown-menu"> </div>
<a href="#" data-val="0">系统使用</a>
<a href="#" data-val="1">自定义</a>
</div>
</div>
</div>
</div>
</form>
</div>
} }

View File

@ -1,133 +1,135 @@
@model NavigatorBarModel @model NavigatorBarModel
@{ @{
ViewBag.Title = "程序异常"; ViewBag.Title = "程序异常";
} }
@section css { @section css {
<environment include="Development"> <environment include="Development">
<link href="~/lib/bootstrap-table/bootstrap-table.css" rel="stylesheet" /> <link href="~/lib/bootstrap-table/bootstrap-table.css" rel="stylesheet" />
<link href="~/lib/datetimepicker/css/bootstrap-datetimepicker.css" rel="stylesheet" /> <link href="~/lib/datetimepicker/css/bootstrap-datetimepicker.css" rel="stylesheet" />
</environment> </environment>
<environment exclude="Development"> <environment exclude="Development">
<link href="~/lib/bootstrap-table/bootstrap-table.min.css" rel="stylesheet" /> <link href="~/lib/bootstrap-table/bootstrap-table.min.css" rel="stylesheet" />
<link href="~/lib/datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" /> <link href="~/lib/datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
</environment> </environment>
<link href="~/css/fa.css" rel="stylesheet" asp-append-version="true" /> <link href="~/css/fa.css" rel="stylesheet" asp-append-version="true" />
} }
@section javascript { @section javascript {
<environment include="Development"> <environment include="Development">
<script src="~/lib/bootstrap-table/bootstrap-table.js"></script> <script src="~/lib/bootstrap-table/bootstrap-table.js"></script>
<script src="~/lib/bootstrap-table/extensions/export/bootstrap-table-export.js"></script> <script src="~/lib/bootstrap-table/extensions/export/bootstrap-table-export.js"></script>
<script src="~/lib/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script> <script src="~/lib/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
<script src="~/lib/tablexport/tableExport.js"></script> <script src="~/lib/tablexport/tableExport.js"></script>
<script src="~/lib/datetimepicker/js/bootstrap-datetimepicker.js"></script> <script src="~/lib/datetimepicker/js/bootstrap-datetimepicker.js"></script>
</environment> </environment>
<environment exclude="Development"> <environment exclude="Development">
<script src="~/lib/bootstrap-table/bootstrap-table.min.js"></script> <script src="~/lib/bootstrap-table/bootstrap-table.min.js"></script>
<script src="~/lib/bootstrap-table/extensions/export/bootstrap-table-export.min.js"></script> <script src="~/lib/bootstrap-table/extensions/export/bootstrap-table-export.min.js"></script>
<script src="~/lib/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script> <script src="~/lib/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="~/lib/tablexport/tableExport.min.js"></script> <script src="~/lib/tablexport/tableExport.min.js"></script>
<script src="~/lib/datetimepicker/js/bootstrap-datetimepicker.min.js"></script> <script src="~/lib/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
</environment> </environment>
<script src="~/lib/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script> <script src="~/lib/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="~/js/exceptions.js" asp-append-version="true"></script> <script src="~/js/exceptions.js" asp-append-version="true"></script>
} }
<div class="card"> <div class="card">
<div class="card-header">查询条件</div> <div class="card-header">查询条件</div>
<div class="card-body"> <div class="card-body">
<form class="form-inline"> <form class="form-inline">
<div class="row"> <div class="row">
<div class="form-group col-sm-auto"> <div class="form-group col-sm-auto">
<label class="control-label" for="txt_operate_start">起始时间</label> <label class="control-label" for="txt_operate_start">起始时间</label>
<div class="input-group date"> <div class="input-group date">
<input id="txt_operate_start" class="form-control" size="16" type="text" value="" readonly> <input id="txt_operate_start" class="form-control" size="16" type="text" value="" readonly>
<div class="input-group-append input-group-addon"> <div class="input-group-append input-group-addon">
<div class="input-group-text"><span class="fa fa-times"></span></div> <div class="input-group-text"><span class="fa fa-times"></span></div>
</div> </div>
<div class="input-group-append input-group-addon"> <div class="input-group-append input-group-addon">
<div class="input-group-text"><span class="fa fa-calendar"></span></div> <div class="input-group-text"><span class="fa fa-calendar"></span></div>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group col-sm-auto"> <div class="form-group col-sm-auto">
<label class="control-label" for="txt_operate_end">终止时间</label> <label class="control-label" for="txt_operate_end">终止时间</label>
<div class="input-group date"> <div class="input-group date">
<input id="txt_operate_end" class="form-control" size="16" type="text" value="" readonly> <input id="txt_operate_end" class="form-control" size="16" type="text" value="" readonly>
<div class="input-group-append input-group-addon"> <div class="input-group-append input-group-addon">
<div class="input-group-text"><span class="fa fa-times"></span></div> <div class="input-group-text"><span class="fa fa-times"></span></div>
</div> </div>
<div class="input-group-append input-group-addon"> <div class="input-group-append input-group-addon">
<div class="input-group-text"><span class="fa fa-calendar"></span></div> <div class="input-group-text"><span class="fa fa-calendar"></span></div>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group col-sm-auto flex-sm-fill justify-content-sm-end"> <div class="form-group col-sm-auto flex-sm-fill justify-content-sm-end">
<label class="sr-only"></label> <label class="sr-only"></label>
<button type="button" id="btn_query" class="btn btn-primary btn-fill"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button> <button type="button" id="btn_query" class="btn btn-primary btn-fill"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
<div id="toolbar" class="btn-group d-none"> <div id="toolbar" class="d-none">
<button id="btn_view" type="button" class="btn btn-danger"> <div class="toolbar btn-group">
<i class="fa fa-file-text-o" aria-hidden="true"></i><span>服务器日志</span> <button id="btn_view" type="button" class="btn btn-danger" asp-auth="log">
</button> <i class="fa fa-file-text-o" aria-hidden="true"></i><span>服务器日志</span>
<div class="toolbar btn-group dropdown"> </button>
<button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" type="button"><i class="fa fa-gear"></i></button> </div>
<div class="dropdown-menu"> <div class="gear btn-group dropdown">
<a id="tb_view" href="#" title="查看明细"><i class="fa fa-file-text-o"></i></a> <button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" type="button"><i class="fa fa-gear"></i></button>
</div> <div class="dropdown-menu">
</div> <a id="tb_view" href="#" title="查看明细" asp-auth="log"><i class="fa fa-file-text-o"></i></a>
</div> </div>
<div class="card"> </div>
<div class="card-header"> </div>
查询结果 <div class="card">
</div> <div class="card-header">
<div class="card-body"> 查询结果
<table></table> </div>
</div> <div class="card-body">
</div> <table></table>
@section modal { </div>
<div class="modal fade" id="dialogNew" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myModalLabel" aria-hidden="true"> </div>
<div id="errorList" class="modal-dialog modal-dialog-centered modal-lg" role="document"> @section modal {
<div class="modal-content"> <div class="modal fade" id="dialogNew" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header"> <div id="errorList" class="modal-dialog modal-dialog-centered modal-lg" role="document">
<h5 class="modal-title" id="myModalLabel">程序异常日志窗口</h5> <div class="modal-content">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <div class="modal-header">
</div> <h5 class="modal-title" id="myModalLabel">程序异常日志窗口</h5>
<div class="modal-body"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<form class="form-inline" id="dataForm" name="dataForm"><div class="form-row"></div></form> </div>
</div> <div class="modal-body">
<div class="modal-footer"> <form class="form-inline" id="dataForm" name="dataForm"><div class="form-row"></div></form>
<button type="button" class="btn btn-secondary" data-dismiss="modal"> </div>
<i class="fa fa-times"></i> <div class="modal-footer">
<span>关闭</span> <button type="button" class="btn btn-secondary" data-dismiss="modal">
</button> <i class="fa fa-times"></i>
</div> <span>关闭</span>
</div> </button>
</div> </div>
</div> </div>
<div id="errorDetail" class="modal-content icon-content"> </div>
<div class="modal-header"> </div>
<h5 class="modal-title" id="myDetailModalLabel">程序异常日志窗口</h5> <div id="errorDetail" class="modal-content icon-content">
<button type="button" class="close" aria-hidden="true">&times;</button> <div class="modal-header">
</div> <h5 class="modal-title" id="myDetailModalLabel">程序异常日志窗口</h5>
<div class="modal-body"> <button type="button" class="close" aria-hidden="true">&times;</button>
<div class="iconview"> </div>
<i id="fa-top" class="fa-target"></i> <div class="modal-body">
<div class="affix"> <div class="iconview">
<div><a href="#fa-top" class="fa fa-arrow-circle-up"></a></div> <i id="fa-top" class="fa-target"></i>
<div><a href="#fa-bottom" class="fa fa-arrow-circle-down"></a></div> <div class="affix">
</div> <div><a href="#fa-top" class="fa fa-arrow-circle-up"></a></div>
<div id="dataFormDetail" class="ex-content"><div class="text-center"><i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i></div></div> <div><a href="#fa-bottom" class="fa fa-arrow-circle-down"></a></div>
<i id="fa-bottom" class="fa-target"></i> </div>
</div> <div id="dataFormDetail" class="ex-content"><div class="text-center"><i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i></div></div>
</div> <i id="fa-bottom" class="fa-target"></i>
<div class="modal-footer"> </div>
<button type="button" class="btn btn-secondary"> </div>
<i class="fa fa-times"></i> <div class="modal-footer">
<span>关闭</span> <button type="button" class="btn btn-secondary">
</button> <i class="fa fa-times"></i>
</div> <span>关闭</span>
</div> </button>
} </div>
</div>
}

View File

@ -1,66 +1,62 @@
@model NavigatorBarModel @model NavigatorBarModel
@{ @{
ViewBag.Title = "部门管理"; ViewBag.Title = "部门管理";
Layout = "_Default"; Layout = "_Default";
} }
@section javascript { @section javascript {
<script src="~/js/groups.js" asp-append-version="true"></script> <script src="~/js/groups.js" asp-append-version="true"></script>
} }
@section query { @section query {
<form class="form-inline"> <form class="form-inline">
<div class="row"> <div class="row">
<div class="form-group col-sm-5 col-md-auto"> <div class="form-group col-sm-5 col-md-auto">
<label class="control-label" for="txt_search_name">部门名称</label> <label class="control-label" for="txt_search_name">部门名称</label>
<input type="text" class="form-control" id="txt_search_name" /> <input type="text" class="form-control" id="txt_search_name" />
</div> </div>
<div class="form-group col-sm-5 col-md-auto"> <div class="form-group col-sm-5 col-md-auto">
<label class="control-label" for="txt_group_desc">部门描述</label> <label class="control-label" for="txt_group_desc">部门描述</label>
<input type="text" class="form-control" id="txt_group_desc" /> <input type="text" class="form-control" id="txt_group_desc" />
</div> </div>
<div class="form-group col-sm-2 col-md-auto flex-md-fill justify-content-md-end"> <div class="form-group col-sm-2 col-md-auto flex-md-fill justify-content-md-end">
<button type="button" id="btn_query" class="btn btn-primary btn-fill align-self-sm-end align-self-md-auto"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button> <button type="button" id="btn_query" class="btn btn-primary btn-fill align-self-sm-end align-self-md-auto"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button>
</div> </div>
</div> </div>
</form> </form>
} }
@section toolbar { @section toolbar {
<button id="btn_assignUser" type="button" class="btn btn-info"> <button id="btn_assignUser" type="button" class="btn btn-info" asp-auth="assignUser">
<span class="fa fa-user" aria-hidden="true"></span><span>分配用户</span> <i class="fa fa-user" aria-hidden="true"></i><span>分配用户</span>
</button> </button>
<button id="btn_assignRole" type="button" class="btn btn-warning"> <button id="btn_assignRole" type="button" class="btn btn-warning" asp-auth="assignRole">
<span class="fa fa-sitemap" aria-hidden="true"></span><span>分配角色</span> <i class="fa fa-sitemap" aria-hidden="true"></i><span>分配角色</span>
</button> </button>
<div class="toolbar btn-group"> }
<button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" type="button"><i class="fa fa-gear"></i></button> @section gear {
<div class="dropdown-menu"> <a id="tb_assignUser" href="#" title="分配用户" asp-auth="assignUser"><i class="fa fa-user"></i></a>
@await Html.PartialAsync("_ButtonBarGroup") <a id="tb_assignRole" href="#" title="分配角色" asp-auth="assignRole"><i class="fa fa-sitemap"></i></a>
<a id="tb_assignRole" href="#" title="分配角色"><i class="fa fa-sitemap"></i></a> }
<a id="tb_assignUser" href="#" title="分配用户"><i class="fa fa-user"></i></a> @section modal {
</div> <div class="modal-header">
</div> <h5 class="modal-title" id="myModalLabel">部门编辑窗口</h5>
} <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
@section modal { </div>
<div class="modal-header"> <div class="modal-body">
<h5 class="modal-title" id="myModalLabel">部门编辑窗口</h5> <form class="form-inline">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <div class="row">
</div> <div class="form-group col-sm-6">
<div class="modal-body"> <label class="control-label" for="groupName">部门名称</label>
<form class="form-inline"> <input type="text" class="form-control" id="groupName" placeholder="不可为空50字以内" maxlength="50" data-valid="true" />
<div class="row"> </div>
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<label class="control-label" for="groupName">部门名称</label> <input type="hidden" id="groupID" />
<input type="text" class="form-control" id="groupName" placeholder="不可为空50字以内" maxlength="50" data-valid="true" /> <label class="control-label" for="groupDesc">部门描述</label>
</div> <input type="text" class="form-control" id="groupDesc" placeholder="描述信息(可为空)50字以内" maxlength="50" />
<div class="form-group col-sm-6"> </div>
<input type="hidden" id="groupID" /> </div>
<label class="control-label" for="groupDesc">部门描述</label> </form>
<input type="text" class="form-control" id="groupDesc" placeholder="描述信息(可为空)50字以内" maxlength="50" /> </div>
</div> }
</div> @section customModal {
</form> @await Html.PartialAsync("RoleConfig")
</div> @await Html.PartialAsync("UserConfig")
}
@section customModal {
@await Html.PartialAsync("RoleConfig")
@await Html.PartialAsync("UserConfig")
} }

View File

@ -60,6 +60,7 @@
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a href="#" data-val="0">菜单</a> <a href="#" data-val="0">菜单</a>
<a href="#" data-val="1">资源</a> <a href="#" data-val="1">资源</a>
<a href="#" data-val="2">按钮</a>
</div> </div>
</div> </div>
</div> </div>
@ -82,16 +83,12 @@
</form> </form>
} }
@section toolbar { @section toolbar {
<button id="btn_assignRole" type="button" class="btn btn-info"> <button id="btn_assignRole" type="button" class="btn btn-info" asp-auth="assignRole">
<span class="fa fa-sitemap" aria-hidden="true"></span><span>分配角色</span> <i class="fa fa-sitemap" aria-hidden="true"></i><span>分配角色</span>
</button> </button>
<div class="toolbar btn-group"> }
<button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" type="button"><i class="fa fa-gear"></i></button> @section gear {
<div class="dropdown-menu"> <a id="tb_assignRole" href="#" title="分配角色" asp-auth="assignRole"><i class="fa fa-sitemap"></i></a>
@await Html.PartialAsync("_ButtonBarGroup")
<a id="tb_assignRole" href="#" title="分配角色"><i class="fa fa-sitemap"></i></a>
</div>
</div>
} }
@section modal { @section modal {
<div class="modal-header"> <div class="modal-header">
@ -178,6 +175,7 @@
<div class="dropdown-menu"> <div class="dropdown-menu">
<a href="#" data-val="0">菜单</a> <a href="#" data-val="0">菜单</a>
<a href="#" data-val="1">资源</a> <a href="#" data-val="1">资源</a>
<a href="#" data-val="2">按钮</a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,128 +1,128 @@
@model ProfilesModel @model ProfilesModel
@{ @{
ViewBag.Title = "个人中心"; ViewBag.Title = "个人中心";
} }
@section css { @section css {
<environment include="Development"> <environment include="Development">
<link href="~/lib/bootstrap-fileinput/css/fileinput.css" rel="stylesheet" /> <link href="~/lib/bootstrap-fileinput/css/fileinput.css" rel="stylesheet" />
</environment> </environment>
<environment exclude="Development"> <environment exclude="Development">
<link href="~/lib/bootstrap-fileinput/css/fileinput.min.css" rel="stylesheet" /> <link href="~/lib/bootstrap-fileinput/css/fileinput.min.css" rel="stylesheet" />
</environment> </environment>
<link href="~/css/tasks.css" rel="stylesheet" asp-append-version="true" /> <link href="~/css/tasks.css" rel="stylesheet" asp-append-version="true" />
} }
@section javascript { @section javascript {
<environment include="Development"> <environment include="Development">
<script src="~/lib/bootstrap-fileinput/js/fileinput.js"></script> <script src="~/lib/bootstrap-fileinput/js/fileinput.js"></script>
<script src="~/lib/bootstrap-fileinput/js/locales/zh.js"></script> <script src="~/lib/bootstrap-fileinput/js/locales/zh.js"></script>
<script src="~/lib/bootstrap-fileinput/themes/fa/theme.js"></script> <script src="~/lib/bootstrap-fileinput/themes/fa/theme.js"></script>
<script src="~/lib/validate/jquery.validate.js"></script> <script src="~/lib/validate/jquery.validate.js"></script>
<script src="~/lib/validate/localization/messages_zh.js"></script> <script src="~/lib/validate/localization/messages_zh.js"></script>
</environment> </environment>
<environment exclude="Development"> <environment exclude="Development">
<script src="~/lib/bootstrap-fileinput/js/fileinput.min.js"></script> <script src="~/lib/bootstrap-fileinput/js/fileinput.min.js"></script>
<script src="~/lib/bootstrap-fileinput/js/locales/zh.min.js"></script> <script src="~/lib/bootstrap-fileinput/js/locales/zh.min.js"></script>
<script src="~/lib/bootstrap-fileinput/themes/fa/theme.min.js"></script> <script src="~/lib/bootstrap-fileinput/themes/fa/theme.min.js"></script>
<script src="~/lib/validate/jquery.validate.min.js"></script> <script src="~/lib/validate/jquery.validate.min.js"></script>
<script src="~/lib/validate/localization/messages_zh.min.js"></script> <script src="~/lib/validate/localization/messages_zh.min.js"></script>
</environment> </environment>
<script src="~/lib/longbow/longbow.dataentity.js" asp-append-version="true"></script> <script src="~/lib/longbow/longbow.dataentity.js" asp-append-version="true"></script>
<script src="~/lib/longbow/longbow.validate.js" asp-append-version="true"></script> <script src="~/lib/longbow/longbow.validate.js" asp-append-version="true"></script>
<script src="~/js/profiles.js" asp-append-version="true"></script> <script src="~/js/profiles.js" asp-append-version="true"></script>
} }
<div class="card"> <div class="card">
<div class="card-header">基本资料</div> <div class="card-header">基本资料</div>
<div class="card-body" data-toggle="LgbValidate" data-valid-button="#btnSaveDisplayName"> <div class="card-body" data-toggle="LgbValidate" data-valid-button="#btnSaveDisplayName">
<form class="form-inline"> <form class="form-inline">
<div class="row"> <div class="row">
<div class="form-group col-sm-6 col-md-auto"> <div class="form-group col-sm-6 col-md-auto">
<label class="control-label" for="userName">登陆名称</label> <label class="control-label" for="userName">登陆名称</label>
<input type="text" class="form-control ignore" id="userName" name="userName" value="@Model.UserName" readonly /> <input type="text" class="form-control ignore" id="userName" name="userName" value="@Model.UserName" readonly />
</div> </div>
<div class="form-group col-sm-6 col-md-auto"> <div class="form-group col-sm-6 col-md-auto">
<label class="control-label" for="DisplayName">显示名称</label> <label class="control-label" for="DisplayName">显示名称</label>
<input type="text" class="form-control" id="displayName" name="displayName" value="@Model.DisplayName" placeholder="不可为空20字以内" maxlength="20" data-valid="true" /> <input type="text" class="form-control" id="displayName" name="displayName" value="@Model.DisplayName" placeholder="不可为空20字以内" maxlength="20" data-valid="true" />
</div> </div>
</div> </div>
</form> </form>
<div class="modal-footer d-none" data-admin="@User.IsInRole("Administrators")"> <div class="modal-footer" asp-auth="saveDisplayName">
<button id="btnSaveDisplayName" data-method="user" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button> <button id="btnSaveDisplayName" data-method="user" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button>
</div> </div>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div class="card-header">修改密码</div> <div class="card-header">修改密码</div>
<div class="card-body" data-toggle="LgbValidate" data-valid-button="#btnSavePassword"> <div class="card-body" data-toggle="LgbValidate" data-valid-button="#btnSavePassword">
<form class="form-inline"> <form class="form-inline">
<div class="row"> <div class="row">
<div class="form-group col-sm-6 col-md-auto"> <div class="form-group col-sm-6 col-md-auto">
<label class="control-label" for="currentPassword">原密码: </label> <label class="control-label" for="currentPassword">原密码: </label>
<input type="password" class="form-control" id="currentPassword" placeholder="原密码" maxlength="16" data-valid="true" /> <input type="password" class="form-control" id="currentPassword" placeholder="原密码" maxlength="16" data-valid="true" />
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="form-group col-sm-6 col-md-auto"> <div class="form-group col-sm-6 col-md-auto">
<label class="control-label" for="newPassword">新密码: </label> <label class="control-label" for="newPassword">新密码: </label>
<input type="password" class="form-control" id="newPassword" placeholder="新密码" maxlength="16" data-valid="true" /> <input type="password" class="form-control" id="newPassword" placeholder="新密码" maxlength="16" data-valid="true" />
</div> </div>
<div class="form-group col-sm-6 col-md-auto"> <div class="form-group col-sm-6 col-md-auto">
<label class="control-label" for="confirmPassword">确认密码: </label> <label class="control-label" for="confirmPassword">确认密码: </label>
<input type="password" class="form-control" id="confirmPassword" placeholder="与新密码一致" maxlength="16" equalTo="#newPassword" data-valid="true" /> <input type="password" class="form-control" id="confirmPassword" placeholder="与新密码一致" maxlength="16" equalTo="#newPassword" data-valid="true" />
</div> </div>
</div> </div>
</form> </form>
<div class="modal-footer d-none" data-admin="@User.IsInRole("Administrators")"> <div class="modal-footer" asp-auth="savePassword">
<button id="btnSavePassword" data-method="password" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button> <button id="btnSavePassword" data-method="password" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button>
</div> </div>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div class="card-header">默认应用</div> <div class="card-header">默认应用</div>
<div class="card-body"> <div class="card-body">
<div class="form-group"> <div class="form-group">
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<button id="app" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown" data-default-val="" value="@Model.AppCode">未设置</button> <button id="app" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown" data-default-val="" value="@Model.AppCode">未设置</button>
<div class="dropdown-menu"> <div class="dropdown-menu">
@foreach (var app in Model.Applications) @foreach (var app in Model.Applications)
{ {
<a href="#" data-val="@app.Key">@app.Value</a> <a href="#" data-val="@app.Key">@app.Value</a>
} }
</div> </div>
</div> </div>
</div> </div>
<div class="modal-footer d-none" data-admin="@User.IsInRole("Administrators")"> <div class="modal-footer" asp-auth="saveApp">
<button id="btnSaveApp" data-method="app" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button> <button id="btnSaveApp" data-method="app" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button>
</div> </div>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div class="card-header">网站皮肤</div> <div class="card-header">网站皮肤</div>
<div class="card-body"> <div class="card-body">
<div class="form-group"> <div class="form-group">
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<button id="css" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown" data-default-val="" value="@Model.Theme">默认样式</button> <button id="css" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown" data-default-val="" value="@Model.Theme">默认样式</button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a href="#" data-val="">默认样式</a> <a href="#" data-val="">默认样式</a>
@foreach (var css in Model.Themes) @foreach (var css in Model.Themes)
{ {
<a href="#" data-val="@css.Code">@css.Name</a> <a href="#" data-val="@css.Code">@css.Name</a>
} }
</div> </div>
</div> </div>
</div> </div>
<div class="modal-footer d-none" data-admin="@User.IsInRole("Administrators")"> <div class="modal-footer" asp-auth="saveTheme">
<button id="btnSaveCss" data-method="css" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button> <button id="btnSaveCss" data-method="css" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button>
</div> </div>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div class="card-header">修改头像</div> <div class="card-header">修改头像</div>
<div class="card-body"> <div class="card-body">
<form enctype="multipart/form-data" class="d-none" data-admin="@User.IsInRole("Administrators")"> <form enctype="multipart/form-data" asp-auth="saveIcon">
<div class="form-group"> <div class="form-group">
<input id="fileIcon" type="file" data-init="@Model.Size" data-file="@Model.FileName"> <input id="fileIcon" type="file" data-init="@Model.Size" data-file="@Model.FileName">
</div> </div>
</form> </form>
<img class="card-img d-none" src="@Url.Content(Model.Icon)" /> <img class="card-img d-none" src="@Url.Content(Model.Icon)" />
</div> </div>
</div> </div>

View File

@ -1,91 +1,87 @@
@model NavigatorBarModel @model NavigatorBarModel
@{ @{
ViewBag.Title = "角色管理"; ViewBag.Title = "角色管理";
Layout = "_Default"; Layout = "_Default";
} }
@section css { @section css {
<environment include="Development"> <environment include="Development">
<link href="~/lib/nestable2/jquery.nestable.css" rel="stylesheet" /> <link href="~/lib/nestable2/jquery.nestable.css" rel="stylesheet" />
</environment> </environment>
<environment exclude="Development"> <environment exclude="Development">
<link href="~/lib/nestable2/jquery.nestable.min.css" rel="stylesheet" /> <link href="~/lib/nestable2/jquery.nestable.min.css" rel="stylesheet" />
</environment> </environment>
<link href="~/css/fa.css" rel="stylesheet" asp-append-version="true" /> <link href="~/css/fa.css" rel="stylesheet" asp-append-version="true" />
} }
@section javascript { @section javascript {
<environment include="Development"> <environment include="Development">
<script src="~/lib/nestable2/jquery.nestable.js"></script> <script src="~/lib/nestable2/jquery.nestable.js"></script>
</environment> </environment>
<environment exclude="Development"> <environment exclude="Development">
<script src="~/lib/nestable2/jquery.nestable.min.js"></script> <script src="~/lib/nestable2/jquery.nestable.min.js"></script>
</environment> </environment>
<script src="~/js/roles.js" asp-append-version="true"></script> <script src="~/js/roles.js" asp-append-version="true"></script>
} }
@section query { @section query {
<form class="form-inline"> <form class="form-inline">
<div class="row"> <div class="row">
<div class="form-group col-sm-5 col-md-auto"> <div class="form-group col-sm-5 col-md-auto">
<label class="control-label" for="txt_search_name">角色名称</label> <label class="control-label" for="txt_search_name">角色名称</label>
<input type="text" class="form-control" id="txt_search_name" /> <input type="text" class="form-control" id="txt_search_name" />
</div> </div>
<div class="form-group col-sm-5 col-md-auto"> <div class="form-group col-sm-5 col-md-auto">
<label class="control-label" for="txt_role_desc">角色描述</label> <label class="control-label" for="txt_role_desc">角色描述</label>
<input type="text" class="form-control" id="txt_role_desc" /> <input type="text" class="form-control" id="txt_role_desc" />
</div> </div>
<div class="form-group col-sm-2 col-md-auto flex-md-fill justify-content-md-end"> <div class="form-group col-sm-2 col-md-auto flex-md-fill justify-content-md-end">
<button type="button" id="btn_query" class="btn btn-primary btn-fill align-self-sm-end align-self-md-auto"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button> <button type="button" id="btn_query" class="btn btn-primary btn-fill align-self-sm-end align-self-md-auto"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button>
</div> </div>
</div> </div>
</form> </form>
} }
@section toolbar{ @section toolbar{
<button id="btn_assignUser" type="button" class="btn btn-info"> <button id="btn_assignUser" type="button" class="btn btn-info" asp-auth="assignUser">
<span class="fa fa-user" aria-hidden="true"></span><span>分配用户</span> <i class="fa fa-user" aria-hidden="true"></i><span>分配用户</span>
</button> </button>
<button id="btn_assignGroup" type="button" class="btn btn-warning"> <button id="btn_assignGroup" type="button" class="btn btn-warning" asp-auth="assignGroup">
<span class="fa fa-bank" aria-hidden="true"></span><span>分配部门</span> <i class="fa fa-bank" aria-hidden="true"></i><span>分配部门</span>
</button> </button>
<button id="btn_assignMenu" type="button" class="btn btn-secondary"> <button id="btn_assignMenu" type="button" class="btn btn-secondary" asp-auth="assignMenu">
<span class="fa fa-dashboard" aria-hidden="true"></span><span>分配菜单</span> <i class="fa fa-dashboard" aria-hidden="true"></i><span>分配菜单</span>
</button> </button>
<button id="btn_assignApp" type="button" class="btn btn-success"> <button id="btn_assignApp" type="button" class="btn btn-success" asp-auth="assignApp">
<span class="fa fa-cubes" aria-hidden="true"></span><span>分配应用</span> <i class="fa fa-cubes" aria-hidden="true"></i><span>分配应用</span>
</button> </button>
<div class="toolbar btn-group"> }
<button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" type="button"><i class="fa fa-gear"></i></button> @section gear {
<div class="dropdown-menu"> <a id="tb_assignUser" href="#" title="分配用户" asp-auth="assignUser"><i class="fa fa-user"></i></a>
@await Html.PartialAsync("_ButtonBarGroup") <a id="tb_assignGroup" href="#" title="分配部门" asp-auth="assignGroup"><i class="fa fa-bank"></i></a>
<a id="tb_assignUser" href="#" title="分配用户"><i class="fa fa-user"></i></a> <a id="tb_assignMenu" href="#" title="分配菜单" asp-auth="assignMenu"><i class="fa fa-dashboard"></i></a>
<a id="tb_assignGroup" href="#" title="分配部门"><i class="fa fa-bank"></i></a> <a id="tb_assignApp" href="#" title="分配应用" asp-auth="assignApp"><i class="fa fa-cubes"></i></a>
<a id="tb_assignMenu" href="#" title="分配菜单"><i class="fa fa-dashboard"></i></a> }
<a id="tb_assignApp" href="#" title="分配应用"><i class="fa fa-cubes"></i></a> @section modal {
</div> <div class="modal-header">
</div> <h5 class="modal-title" id="myModalLabel">角色编辑窗口</h5>
} <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
@section modal { </div>
<div class="modal-header"> <div class="modal-body">
<h5 class="modal-title" id="myModalLabel">角色编辑窗口</h5> <form class="form-inline">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <div class="row">
</div> <div class="form-group col-sm-6">
<div class="modal-body"> <label class="control-label" for="roleName">角色名称</label>
<form class="form-inline"> <input type="text" class="form-control" id="roleName" placeholder="不可为空50字以内" maxlength="50" data-valid="true" />
<div class="row"> </div>
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<label class="control-label" for="roleName">角色名称</label> <input type="hidden" id="roleID" />
<input type="text" class="form-control" id="roleName" placeholder="不可为空50字以内" maxlength="50" data-valid="true" /> <label class="control-label" for="roleDesc">角色描述</label>
</div> <input type="text" class="form-control" id="roleDesc" placeholder="描述信息(可为空)50字以内" maxlength="50" />
<div class="form-group col-sm-6"> </div>
<input type="hidden" id="roleID" /> </div>
<label class="control-label" for="roleDesc">角色描述</label> </form>
<input type="text" class="form-control" id="roleDesc" placeholder="描述信息(可为空)50字以内" maxlength="50" /> </div>
</div> }
</div> @section customModal{
</form> @await Html.PartialAsync("UserConfig")
</div> @await Html.PartialAsync("GroupConfig")
} @await Html.PartialAsync("NavigatorConfig")
@section customModal{ @await Html.PartialAsync("AppConfig")
@await Html.PartialAsync("UserConfig")
@await Html.PartialAsync("GroupConfig")
@await Html.PartialAsync("NavigatorConfig")
@await Html.PartialAsync("AppConfig")
} }

View File

@ -1,74 +1,74 @@
@model ThemeModel @model ThemeModel
@{ @{
ViewBag.Title = "网站设置"; ViewBag.Title = "网站设置";
} }
@section javascript { @section javascript {
<environment include="Development"> <environment include="Development">
<script src="~/lib/validate/jquery.validate.js"></script> <script src="~/lib/validate/jquery.validate.js"></script>
<script src="~/lib/validate/localization/messages_zh.js"></script> <script src="~/lib/validate/localization/messages_zh.js"></script>
</environment> </environment>
<environment exclude="Development"> <environment exclude="Development">
<script src="~/lib/validate/jquery.validate.min.js"></script> <script src="~/lib/validate/jquery.validate.min.js"></script>
<script src="~/lib/validate/localization/messages_zh.min.js"></script> <script src="~/lib/validate/localization/messages_zh.min.js"></script>
</environment> </environment>
<script src="~/lib/longbow/longbow.dataentity.js"></script> <script src="~/lib/longbow/longbow.dataentity.js"></script>
<script src="~/lib/longbow/longbow.validate.js"></script> <script src="~/lib/longbow/longbow.validate.js"></script>
<script src="~/js/settings.js" asp-append-version="true"></script> <script src="~/js/settings.js" asp-append-version="true"></script>
} }
<div class="card"> <div class="card">
<div class="card-header">系统名称设置</div> <div class="card-header">系统名称设置</div>
<div class="card-body" data-toggle="LgbValidate" data-valid-button="#sysSave"> <div class="card-body" data-toggle="LgbValidate" data-valid-button="#sysSave">
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control" id="sysName" placeholder="请输入网站标题50字以内" value="@Model.Title" maxlength="50" data-valid="true" /> <input type="text" class="form-control" id="sysName" placeholder="请输入网站标题50字以内" value="@Model.Title" maxlength="50" data-valid="true" />
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-secondary" type="button" data-method="title">保存</button> <button class="btn btn-secondary" type="button" data-method="title" asp-auth="saveTitle">保存</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div class="card-header">页脚设置</div> <div class="card-header">页脚设置</div>
<div class="card-body" data-toggle="LgbValidate" data-valid-button="#footSave"> <div class="card-body" data-toggle="LgbValidate" data-valid-button="#footSave">
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control" id="sysFoot" placeholder="请输入网站页脚50字以内" value="@Model.Footer" maxlength="50" data-valid="true" /> <input type="text" class="form-control" id="sysFoot" placeholder="请输入网站页脚50字以内" value="@Model.Footer" maxlength="50" data-valid="true" />
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-secondary" type="button" data-method="footer">保存</button> <button class="btn btn-secondary" type="button" data-method="footer" asp-auth="saveFooter">保存</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div class="card-header">网站样式</div> <div class="card-header">网站样式</div>
<div class="card-body"> <div class="card-body">
<div class="form-group text-right"> <div class="form-group text-right">
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<button id="dictCssDefine" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown" data-default-val="" value="@Model.Theme">默认样式</button> <button id="dictCssDefine" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown" data-default-val="" value="@Model.Theme">默认样式</button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a href="#" data-val="">默认样式</a> <a href="#" data-val="">默认样式</a>
@foreach (var css in Model.Themes) @foreach (var css in Model.Themes)
{ {
<a href="#" data-val="@css.Code">@css.Name</a> <a href="#" data-val="@css.Code">@css.Name</a>
} }
</div> </div>
</div> </div>
<button class="btn btn-secondary" type="button" data-method="css">保存</button> <button class="btn btn-secondary" type="button" data-method="css" asp-auth="saveTheme">保存</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<span class="flex-fill">网站缓存</span> <span class="flex-fill">网站缓存</span>
<a data-method="clear" href="#" class="fa fa-times-circle-o" data-admin="@User.IsInRole("Administrators")" title="全部清除" data-toggle="tooltip" data-placement="left"></a> <a data-method="clear" href="#" class="fa fa-times-circle-o" title="全部清除" data-toggle="tooltip" data-placement="left" asp-auth="clearAllCache"></a>
<a data-method="refresh" href="#" class="fa fa-refresh ml-3" title="点击刷新" data-toggle="tooltip"></a> <a data-method="refresh" href="#" class="fa fa-refresh ml-3" title="点击刷新" data-toggle="tooltip"></a>
</div> </div>
</div> </div>
<div class="card-body" id="sortable"> <div class="card-body" id="sortable">
</div> </div>
</div> </div>

View File

@ -1,112 +1,111 @@
@model NavigatorBarModel @model NavigatorBarModel
@{ @{
ViewBag.Title = "用户管理"; ViewBag.Title = "用户管理";
Layout = "_Default"; Layout = "_Default";
} }
@section javascript { @section javascript {
<script src="~/js/users.js" asp-append-version="true"></script> <script src="~/js/users.js" asp-append-version="true"></script>
} }
@section query { @section query {
<form class="form-inline"> <form class="form-inline">
<div class="row"> <div class="row">
<div class="form-group col-sm-5 col-md-auto"> <div class="form-group col-sm-5 col-md-auto">
<label class="control-label" for="txt_search_name">登陆名称</label> <label class="control-label" for="txt_search_name">登陆名称</label>
<input type="text" class="form-control" id="txt_search_name" maxlength="16" /> <input type="text" class="form-control" id="txt_search_name" maxlength="16" />
</div> </div>
<div class="form-group col-sm-5 col-md-auto"> <div class="form-group col-sm-5 col-md-auto">
<label class="control-label" for="txt_display_name">显示名称</label> <label class="control-label" for="txt_display_name">显示名称</label>
<input type="text" class="form-control" id="txt_display_name" maxlength="20" /> <input type="text" class="form-control" id="txt_display_name" maxlength="20" />
</div> </div>
<div class="form-group col-sm-2 col-md-auto flex-md-fill justify-content-md-end"> <div class="form-group col-sm-2 col-md-auto flex-md-fill justify-content-md-end">
<button type="button" id="btn_query" class="btn btn-primary btn-fill align-self-sm-end align-self-md-auto"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button> <button type="button" id="btn_query" class="btn btn-primary btn-fill align-self-sm-end align-self-md-auto"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button>
</div> </div>
</div> </div>
</form> </form>
} }
@section toolbar { @section toolbar {
<button id="btn_assignGroup" type="button" class="btn btn-info"> <button id="btn_assignGroup" type="button" class="btn btn-info" asp-auth="assignGroup">
<span class="fa fa-bank" aria-hidden="true"></span><span>分配部门</span> <i class="fa fa-bank" aria-hidden="true"></i><span>分配部门</span>
</button> </button>
<button id="btn_assignRole" type="button" class="btn btn-warning"> <button id="btn_assignRole" type="button" class="btn btn-warning" asp-auth="assignRole">
<span class="fa fa-sitemap" aria-hidden="true"></span><span>分配角色</span> <i class="fa fa-sitemap" aria-hidden="true"></i><span>分配角色</span>
</button> </button>
<div class="toolbar btn-group"> }
<button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" type="button"><i class="fa fa-gear"></i></button> @section gear {
<div class="dropdown-menu"> <a id="tb_assignRole" href="#" title="分配角色"><i class="fa fa-sitemap" asp-auth="assignGroup"></i></a>
@await Html.PartialAsync("_ButtonBarGroup") <a id="tb_assignGroup" href="#" title="分配部门"><i class="fa fa-bank" asp-auth="assignRole"></i></a>
<a id="tb_assignRole" href="#" title="分配角色"><i class="fa fa-sitemap"></i></a> }
<a id="tb_assignGroup" href="#" title="分配部门"><i class="fa fa-bank"></i></a> @section tableButtons {
</div> <button class="reset btn btn-warning" asp-auth="resetPassword"><i class="fa fa-remove"></i><span>重置</span></button>
</div> }
} @section modal {
@section modal { <div class="modal-header">
<div class="modal-header"> <h5 class="modal-title" id="myModalLabel">用户编辑窗口</h5>
<h5 class="modal-title" id="myModalLabel">用户编辑窗口</h5> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> </div>
</div> <div class="modal-body">
<div class="modal-body"> <form class="form-inline">
<form class="form-inline"> <input type="hidden" id="userID" />
<input type="hidden" id="userID" /> <div class="row">
<div class="row"> <div class="form-group col-sm-6">
<div class="form-group col-sm-6"> <label class="control-label" for="userName">登陆名称</label>
<label class="control-label" for="userName">登陆名称</label> <input type="text" class="form-control" id="userName" placeholder="不可为空16字以内" minlength="4" maxlength="16" userName="true" remote="api/Register" data-remote-msg="此用户已存在" data-valid="true" />
<input type="text" class="form-control" id="userName" placeholder="不可为空16字以内" minlength="4" maxlength="16" userName="true" remote="api/Register" data-remote-msg="此用户已存在" data-valid="true" /> </div>
</div> <div class="form-group col-sm-6">
<div class="form-group col-sm-6"> <label class="control-label" for="displayName">显示名称</label>
<label class="control-label" for="displayName">显示名称</label> <input type="text" class="form-control" id="displayName" placeholder="不可为空20字以内" maxlength="20" data-valid="true" />
<input type="text" class="form-control" id="displayName" placeholder="不可为空20字以内" maxlength="20" data-valid="true" /> </div>
</div> <div class="form-group col-sm-6">
<div class="form-group col-sm-6"> <label class="control-label" for="password">登录密码</label>
<label class="control-label" for="password">登录密码</label> <input type="password" class="form-control" id="password" placeholder="不可为空16字以内" maxlength="16" data-valid="true" />
<input type="password" class="form-control" id="password" placeholder="不可为空16字以内" maxlength="16" data-valid="true" /> </div>
</div> <div class="form-group col-sm-6">
<div class="form-group col-sm-6"> <label class="control-label" for="confirm">确认密码</label>
<label class="control-label" for="confirm">确认密码</label> <input type="password" class="form-control" id="confirm" placeholder="与登陆密码一致" maxlength="16" equalTo="#password" data-valid="true" />
<input type="password" class="form-control" id="confirm" placeholder="与登陆密码一致" maxlength="16" equalTo="#password" data-valid="true" /> </div>
</div> </div>
</div> </form>
</form> </div>
</div> }
} @section customModal {
@section customModal { @await Html.PartialAsync("RoleConfig")
@await Html.PartialAsync("RoleConfig") @await Html.PartialAsync("GroupConfig")
@await Html.PartialAsync("GroupConfig") <div class="modal fade" id="dialogReset" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myResetModalLabel" aria-hidden="true">
<div class="modal fade" id="dialogReset" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myResetModalLabel" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document"> <div class="modal-content" data-toggle="LgbValidate" data-valid-button="#btnReset" data-valid-modal="#dialogReset">
<div class="modal-content" data-toggle="LgbValidate" data-valid-button="#btnReset" data-valid-modal="#dialogReset"> <div class="modal-header">
<div class="modal-header"> <h5 class="modal-title" id="myResetModalLabel">重置密码窗口</h5>
<h5 class="modal-title" id="myResetModalLabel">重置密码窗口</h5> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> </div>
</div> <div class="modal-body">
<div class="modal-body"> <form class="form-inline">
<form class="form-inline"> <div class="form-row" id="resetForm">
<div class="form-row" id="resetForm"> <div class="form-group col-sm-6">
<div class="form-group col-sm-6"> <label class="control-label" for="password">登录密码</label>
<label class="control-label" for="password">登录密码</label> <input type="password" class="form-control" id="resetPassword" placeholder="不可为空16字以内" maxlength="16" data-valid="true" />
<input type="password" class="form-control" id="resetPassword" placeholder="不可为空16字以内" maxlength="16" data-valid="true" /> </div>
</div> <div class="form-group col-sm-6">
<div class="form-group col-sm-6"> <label class="control-label" for="confirm">确认密码</label>
<label class="control-label" for="confirm">确认密码</label> <input type="password" class="form-control" id="resetConfirm" placeholder="与登陆密码一致" maxlength="16" equalTo="#resetPassword" data-valid="true" />
<input type="password" class="form-control" id="resetConfirm" placeholder="与登陆密码一致" maxlength="16" equalTo="#resetPassword" data-valid="true" /> </div>
</div> <div class="form-group col-sm-12">
<div class="form-group col-sm-12"> <label class="control-label" for="resetReason">重置原因</label>
<label class="control-label" for="resetReason">重置原因</label> <textarea class="form-control flex-sm-fill" id="resetReason" rows="3" readonly="readonly" maxlength="200"></textarea>
<textarea class="form-control flex-sm-fill" id="resetReason" rows="3" readonly="readonly" maxlength="200"></textarea> </div>
</div> </div>
</div> </form>
</form> </div>
</div> <div class="modal-footer">
<div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">
<button type="button" class="btn btn-secondary" data-dismiss="modal"> <i class="fa fa-times"></i>
<i class="fa fa-times"></i> <span>关闭</span>
<span>关闭</span> </button>
</button> <button type="button" class="btn btn-primary" id="btnReset">
<button type="button" class="btn btn-primary" id="btnReset"> <i class="fa fa-save"></i>
<i class="fa fa-save"></i> <span>保存</span>
<span>保存</span> </button>
</button> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
} }

View File

@ -1,4 +0,0 @@
<a id="tb_add" href="#" title="新增"><i class="fa fa-plus"></i></a>
<a id="tb_delete" href="#" title="删除"><i class="fa fa-remove"></i></a>
<a id="tb_edit" href="#" title="编辑"><i class="fa fa-pencil"></i></a>

View File

@ -1,46 +1,48 @@
@{ @{
Layout = "_Bootstrap"; Layout = "_Bootstrap";
} }
@section css { @section css {
<environment include="Development"> <environment include="Development">
<link href="~/lib/toastr.js/toastr.css" rel="stylesheet" /> <link href="~/lib/toastr.js/toastr.css" rel="stylesheet" />
<link href="~/lib/nprogress/nprogress.css" rel="stylesheet" /> <link href="~/lib/nprogress/nprogress.css" rel="stylesheet" />
<link href="~/lib/bootstrap-sweetalert/sweetalert.css" rel="stylesheet" /> <link href="~/lib/bootstrap-sweetalert/sweetalert.css" rel="stylesheet" />
<link href="~/lib/scrollbar/jquery.mCustomScrollbar.css" rel="stylesheet" /> <link href="~/lib/scrollbar/jquery.mCustomScrollbar.css" rel="stylesheet" />
</environment> </environment>
<environment exclude="Development"> <environment exclude="Development">
<link href="~/lib/toastr.js/toastr.min.css" rel="stylesheet" /> <link href="~/lib/toastr.js/toastr.min.css" rel="stylesheet" />
<link href="~/lib/nprogress/nprogress.min.css" rel="stylesheet" /> <link href="~/lib/nprogress/nprogress.min.css" rel="stylesheet" />
<link href="~/lib/bootstrap-sweetalert/sweetalert.min.css" rel="stylesheet" /> <link href="~/lib/bootstrap-sweetalert/sweetalert.min.css" rel="stylesheet" />
<link href="~/lib/scrollbar/jquery.mCustomScrollbar.min.css" rel="stylesheet" /> <link href="~/lib/scrollbar/jquery.mCustomScrollbar.min.css" rel="stylesheet" />
</environment> </environment>
@RenderSection("css", false) @RenderSection("css", false)
} }
@section javascript { @section javascript {
<environment include="Development"> <environment include="Development">
<script src="~/lib/scrollbar/jquery.mCustomScrollbar.js"></script> <script src="~/lib/scrollbar/jquery.mousewheel.js"></script>
<script src="~/lib/signalr/dist/browser/signalr.js"></script> <script src="~/lib/scrollbar/jquery.mCustomScrollbar.js"></script>
<script src="~/lib/dcjqaccordion/js/jquery.dcjqaccordion.2.7.js"></script> <script src="~/lib/signalr/dist/browser/signalr.js"></script>
<script src="~/lib/bootstrap-sweetalert/sweetalert.js"></script> <script src="~/lib/dcjqaccordion/js/jquery.dcjqaccordion.2.7.js"></script>
<script src="~/lib/nprogress/nprogress.js"></script> <script src="~/lib/bootstrap-sweetalert/sweetalert.js"></script>
</environment> <script src="~/lib/nprogress/nprogress.js"></script>
<environment exclude="Development"> </environment>
<script src="~/lib/scrollbar/jquery.mCustomScrollbar.concat.min.js"></script> <environment exclude="Development">
<script src="~/lib/signalr/dist/browser/signalr.min.js"></script> <script src="~/lib/scrollbar/jquery.mousewheel.min.js"></script>
<script src="~/lib/dcjqaccordion/js/jquery.dcjqaccordion.2.7.min.js"></script> <script src="~/lib/scrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
<script src="~/lib/bootstrap-sweetalert/sweetalert.min.js"></script> <script src="~/lib/signalr/dist/browser/signalr.min.js"></script>
<script src="~/lib/nprogress/nprogress.min.js"></script> <script src="~/lib/dcjqaccordion/js/jquery.dcjqaccordion.2.7.min.js"></script>
</environment> <script src="~/lib/bootstrap-sweetalert/sweetalert.min.js"></script>
<script src="~/lib/toastr.js/toastr.min.js"></script> <script src="~/lib/nprogress/nprogress.min.js"></script>
<script src="~/lib/dcjqaccordion/js/jquery.cookie.js"></script> </environment>
<script src="~/js/common-scripts.js" asp-append-version="true"></script> <script src="~/lib/toastr.js/toastr.min.js"></script>
@RenderSection("javascript", false) <script src="~/lib/dcjqaccordion/js/jquery.cookie.js"></script>
<script src="~/js/log.js" asp-append-version="true"></script> <script src="~/js/common-scripts.js" asp-append-version="true"></script>
} @RenderSection("javascript", false)
@await Html.PartialAsync("navigator") <script src="~/js/log.js" asp-append-version="true"></script>
<section id="main-content" class="main-content"> }
@RenderBody() @await Html.PartialAsync("navigator")
</section> <section id="main-content" class="main-content">
@section modal { @RenderBody()
@RenderSection("modal", false) </section>
@section modal {
@RenderSection("modal", false)
} }

View File

@ -1,73 +1,92 @@
@{ @model NavigatorBarModel
Layout = "_Admin"; @{
} Layout = "_Admin";
@section css { }
<environment include="Development"> @section css {
<link href="~/lib/bootstrap-table/bootstrap-table.css" rel="stylesheet" /> <environment include="Development">
</environment> <link href="~/lib/bootstrap-table/bootstrap-table.css" rel="stylesheet" />
<environment exclude="Development"> </environment>
<link href="~/lib/bootstrap-table/bootstrap-table.min.css" rel="stylesheet" /> <environment exclude="Development">
</environment> <link href="~/lib/bootstrap-table/bootstrap-table.min.css" rel="stylesheet" />
@RenderSection("css", false) </environment>
} @RenderSection("css", false)
@section javascript { }
<environment include="Development"> @section javascript {
<script src="~/lib/bootstrap-table/bootstrap-table.js"></script> <environment include="Development">
<script src="~/lib/bootstrap-table/extensions/export/bootstrap-table-export.js"></script> <script src="~/lib/bootstrap-table/bootstrap-table.js"></script>
<script src="~/lib/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script> <script src="~/lib/bootstrap-table/extensions/export/bootstrap-table-export.js"></script>
<script src="~/lib/tablexport/tableExport.js"></script> <script src="~/lib/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
<script src="~/lib/validate/jquery.validate.js"></script> <script src="~/lib/tablexport/tableExport.js"></script>
<script src="~/lib/validate/localization/messages_zh.js"></script> <script src="~/lib/validate/jquery.validate.js"></script>
</environment> <script src="~/lib/validate/localization/messages_zh.js"></script>
<environment exclude="Development"> </environment>
<script src="~/lib/bootstrap-table/bootstrap-table.min.js"></script> <environment exclude="Development">
<script src="~/lib/bootstrap-table/extensions/export/bootstrap-table-export.min.js"></script> <script src="~/lib/bootstrap-table/bootstrap-table.min.js"></script>
<script src="~/lib/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script> <script src="~/lib/bootstrap-table/extensions/export/bootstrap-table-export.min.js"></script>
<script src="~/lib/tablexport/tableExport.min.js"></script> <script src="~/lib/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="~/lib/validate/jquery.validate.min.js"></script> <script src="~/lib/tablexport/tableExport.min.js"></script>
<script src="~/lib/validate/localization/messages_zh.min.js"></script> <script src="~/lib/validate/jquery.validate.min.js"></script>
</environment> <script src="~/lib/validate/localization/messages_zh.min.js"></script>
<script src="~/lib/longbow/longbow.dataentity.js" asp-append-version="true"></script> </environment>
<script src="~/lib/longbow/longbow.validate.js" asp-append-version="true"></script> <script src="~/lib/longbow/longbow.dataentity.js" asp-append-version="true"></script>
@RenderSection("javascript", false) <script src="~/lib/longbow/longbow.validate.js" asp-append-version="true"></script>
} @RenderSection("javascript", false)
@section modal { }
<div class="modal fade" id="dialogNew" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myModalLabel" aria-hidden="true"> @section modal {
<div class="modal-dialog modal-dialog-centered modal-lg" role="document"> <div class="modal fade" id="dialogNew" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-content" data-toggle="LgbValidate" data-valid-button="#btnSubmit" data-valid-modal="#dialogNew"> <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
@RenderSection("modal", false) <div class="modal-content" data-toggle="LgbValidate" data-valid-button="#btnSubmit" data-valid-modal="#dialogNew">
<div class="modal-footer"> @RenderSection("modal", false)
<button type="button" class="btn btn-secondary" data-dismiss="modal"> <div class="modal-footer">
<i class="fa fa-times"></i> <button type="button" class="btn btn-secondary" data-dismiss="modal">
<span>关闭</span> <i class="fa fa-times"></i>
</button> <span>关闭</span>
<button type="button" class="btn btn-primary" id="btnSubmit"> </button>
<i class="fa fa-save"></i> <button type="button" class="btn btn-primary" id="btnSubmit">
<span>保存</span> <i class="fa fa-save"></i>
</button> <span>保存</span>
</div> </button>
</div> </div>
</div> </div>
</div> </div>
@RenderSection("customModal", false) </div>
} @RenderSection("customModal", false)
<div class="card"> }
<div class="card-header">查询条件</div> <div class="card">
<div class="card-body"> <div class="card-header">查询条件</div>
@RenderSection("query", false) <div class="card-body">
</div> @RenderSection("query", false)
</div> </div>
<div id="toolbar" class="btn-group d-none"> </div>
<button id="btn_add" type="button" class="btn btn-success"><i class="fa fa-plus" aria-hidden="true"></i><span>新增</span></button> <div id="toolbar" class="d-none">
<button id="btn_delete" type="button" class="btn btn-danger"><i class="fa fa-remove" aria-hidden="true"></i><span>删除</span></button> <div class="gear btn-group">
<button id="btn_edit" type="button" class="btn btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i><span>编辑</span></button> <button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" type="button"><i class="fa fa-gear"></i></button>
@RenderSection("toolbar", false) <div class="dropdown-menu">
</div> <a id="tb_add" href="#" title="新增" asp-auth="add"><i class="fa fa-plus"></i></a>
<div class="card"> <a id="tb_delete" href="#" title="删除" asp-auth="del"><i class="fa fa-remove"></i></a>
<div class="card-header"> <a id="tb_edit" href="#" title="编辑" asp-auth="edit"><i class="fa fa-pencil"></i></a>
查询结果 @await RenderSectionAsync("gear", false)
</div> </div>
<div class="card-body"> </div>
<table></table> <div class="toolbar btn-group">
</div> <button id="btn_add" type="button" class="btn btn-success" asp-auth="add"><i class="fa fa-plus" aria-hidden="true"></i><span>新增</span></button>
<button id="btn_delete" type="button" class="btn btn-danger" asp-auth="del"><i class="fa fa-remove" aria-hidden="true"></i><span>删除</span></button>
<button id="btn_edit" type="button" class="btn btn-primary" asp-auth="edit"><i class="fa fa-pencil" aria-hidden="true"></i><span>编辑</span></button>
@RenderSection("toolbar", false)
</div>
</div>
<div class="card">
<div class="card-header">
查询结果
</div>
<div class="card-body">
<table></table>
</div>
</div>
<div id="tableButtons" class="d-none">
<div class='btn-group'>
<button class='edit btn btn-sm btn-success' asp-auth="edit"><i class='fa fa-edit'></i><span>编辑</span></button>
<button class='del btn btn-sm btn-danger' asp-auth="del"><i class='fa fa-remove'></i><span>删除</span></button>
@RenderSection("tableButtons", false)
</div>
</div> </div>

View File

@ -1,2 +1,3 @@
@using Bootstrap.Admin.Models @using Bootstrap.Admin.Models
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Bootstrap.Security.Mvc

View File

@ -11,6 +11,14 @@
white-space: nowrap; white-space: nowrap;
margin-left: 10px; margin-left: 10px;
} }
.bootstrap-table .bs-bars .gear {
display: none;
}
.bootstrap-table .bs-bars .toolbar {
display: inline-flex;
}
} }
@media (min-width: 667px) { @media (min-width: 667px) {

View File

@ -1,4 +1,4 @@
/*Title*/ /*Title*/
.header { .header {
padding: 0 15px; padding: 0 15px;
background: #fff; background: #fff;
@ -578,14 +578,36 @@ li[data-category="1"] .dd3-content .menuType {
margin-right: 4px; margin-right: 4px;
} }
.bootstrap-table .fa-info {
width: 9px;
}
.bootstrap-table .fixed-table-toolbar .bs-bars, .fixed-table-toolbar .search, .fixed-table-toolbar .columns {
line-height: normal;
}
.bootstrap-table .bs-bars .btn span:last-child { .bootstrap-table .bs-bars .btn span:last-child {
display: none; display: none;
} }
.bootstrap-table .fa-info { .bootstrap-table .bs-bars .toolbar {
width: 9px; display: none;
} }
.bootstrap-table .bs-bars .gear .dropdown-menu a {
padding: 8px 12px;
display: table-cell;
color: #504d4d;
}
.bootstrap-table .bs-bars .gear .dropdown-menu a:not(:first-child) {
border-left: solid 1px #aeb2b7;
}
.bootstrap-table .bs-bars .gear .dropdown-menu a:hover {
color: #235e90;
}
pre { pre {
padding: 5px; padding: 5px;
margin: 5px; margin: 5px;

View File

@ -1,4 +1,4 @@
@media (min-width: 375px) { @media (min-width: 375px) {
.toolbar .dropdown-menu a { .toolbar .dropdown-menu a {
padding: 0 14px; padding: 0 14px;
} }
@ -16,14 +16,6 @@
.sidebar-toggle-box span { .sidebar-toggle-box span {
display: inline; display: inline;
} }
.toolbar {
display: none;
}
.bs-bars {
display: inline-block;
}
} }
@media (min-width: 576px) { @media (min-width: 576px) {

View File

@ -1,4 +1,4 @@
html { html {
font-size: 16px; font-size: 16px;
-ms-overflow-style: auto; -ms-overflow-style: auto;
} }
@ -178,36 +178,10 @@ footer {
color: #2A3542; color: #2A3542;
} }
.bs-bars {
display: none;
}
.btn-fill { .btn-fill {
width: 100%; width: 100%;
} }
.toolbar {
position: relative;
margin-top: 10px;
margin-bottom: 10px;
line-height: 34px;
float: left;
}
.toolbar .dropdown-menu a {
padding: 0 12px;
display: table-cell;
color: #504d4d;
}
.toolbar .dropdown-menu a:not(:first-child) {
border-left: solid 1px #aeb2b7;
}
.toolbar .dropdown-menu a:hover {
color: #235e90;
}
.input-group .btn:focus, .btn-group .btn:focus, .page-link:focus { .input-group .btn:focus, .btn-group .btn:focus, .page-link:focus {
box-shadow: none; box-shadow: none;
} }
@ -365,10 +339,6 @@ input.pending {
border-top: none; border-top: none;
} }
.fixed-table-toolbar .bs-bars, .fixed-table-toolbar .search, .fixed-table-toolbar .columns {
line-height: normal;
}
.table-condensed > thead > tr > th, .table-condensed > tfoot > tr > th, .table-condensed > tbody > tr > td { .table-condensed > thead > tr > th, .table-condensed > tfoot > tr > th, .table-condensed > tbody > tr > td {
padding: 2px 0; padding: 2px 0;
} }

View File

@ -1,12 +1,20 @@
(function ($) { (function ($) {
var formatCategoryName = function(menu) {
var ret = "";
if (menu.IsResource === 2) ret = "按钮";
else if (menu.IsResource === 1) ret = "资源";
else ret = menu.CategoryName;
return ret;
};
var cascadeMenu = function (menus) { var cascadeMenu = function (menus) {
var html = ""; var html = "";
$.each(menus, function (index, menu) { $.each(menus, function (index, menu) {
if (menu.Menus.length === 0) { if (menu.Menus.length === 0) {
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{4}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{5}</span><span class="menuOrder">{4}</span></div></li>', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, menu.CategoryName); html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{4}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{5}</span><span class="menuOrder">{4}</span></div></li>', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, formatCategoryName(menu));
} }
else { else {
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{5}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{6}</span><span class="menuOrder">{5}</span></div><ol class="dd-list">{4}</ol></li>', menu.Id, menu.Icon, menu.Name, menu.Category, cascadeSubMenu(menu.Menus), menu.Order, menu.CategoryName); html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{5}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{6}</span><span class="menuOrder">{5}</span></div><ol class="dd-list">{4}</ol></li>', menu.Id, menu.Icon, menu.Name, menu.Category, cascadeSubMenu(menu.Menus), menu.Order, formatCategoryName(menu));
} }
}); });
return html; return html;
@ -15,7 +23,7 @@
var cascadeSubMenu = function (menus) { var cascadeSubMenu = function (menus) {
var html = ""; var html = "";
$.each(menus, function (index, menu) { $.each(menus, function (index, menu) {
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{4}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{5}</span><span class="menuOrder">{4}</span></div></li>', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, menu.CategoryName); html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{4}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{5}</span><span class="menuOrder">{4}</span></div></li>', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, formatCategoryName(menu));
}); });
return html; return html;
}; };
@ -187,70 +195,70 @@ $(function () {
}); });
// Apps // Apps
App = { window.App = {
url: 'api/Apps', url: 'api/Apps',
title: "分配应用" title: "分配应用"
}; };
// Roles // Roles
Role = { window.Role = {
url: 'api/Roles', url: 'api/Roles',
title: "分配角色" title: "分配角色"
}; };
// Users // Users
User = { window.User = {
url: 'api/Users', url: 'api/Users',
title: "分配用户" title: "分配用户"
}; };
// Groups // Groups
Group = { window.Group = {
url: 'api/Groups', url: 'api/Groups',
title: "分配部门" title: "分配部门"
}; };
// Menus // Menus
Menu = { window.Menu = {
url: 'api/Menus', url: 'api/Menus',
iconView: 'Admin/IconView', iconView: 'Admin/IconView',
title: "分配菜单" title: "分配菜单"
}; };
// Exceptions // Exceptions
Exceptions = { window.Exceptions = {
url: 'api/Exceptions', url: 'api/Exceptions',
title: "程序异常日志" title: "程序异常日志"
}; };
// Dicts // Dicts
Dicts = { window.Dicts = {
url: 'api/Dicts' url: 'api/Dicts'
}; };
// Profiles // Profiles
Profiles = { window.Profiles = {
url: 'api/Profiles', url: 'api/Profiles',
del: 'api/Profiles/Delete' del: 'api/Profiles/Delete'
}; };
// Settings // Settings
Settings = { window.Settings = {
url: 'api/Settings' url: 'api/Settings'
}; };
// Messages // Messages
Messages = { window.Messages = {
url: 'api/Messages' url: 'api/Messages'
}; };
// Tasks // Tasks
Tasks = { window.Tasks = {
url: 'api/Tasks' url: 'api/Tasks'
}; };
// Notifications // Notifications
Notifications = { window.Notifications = {
url: 'api/Notifications' url: 'api/Notifications'
}; };

View File

@ -21,7 +21,7 @@
], ],
exportOptions: { exportOptions: {
fileName: "数据字典", fileName: "数据字典",
ignoreColumn: [0, 1] ignoreColumn: [0, 5]
} }
} }
}); });

View File

@ -1,4 +1,4 @@
$(function () { $(function () {
var $dialogUser = $("#dialogUser"); var $dialogUser = $("#dialogUser");
var $dialogUserHeader = $('#myUserModalLabel'); var $dialogUserHeader = $('#myUserModalLabel');
var $dialogUserForm = $('#userForm'); var $dialogUserForm = $('#userForm');
@ -52,14 +52,14 @@
var roleIds = $dialogRole.find('input:checked').map(function (index, element) { var roleIds = $dialogRole.find('input:checked').map(function (index, element) {
return $(element).val(); return $(element).val();
}).toArray(); }).toArray();
$.bc({ id: groupId, url: Role.url, method: "put", data: roleIds, query: { type: "group" }, title: Role.title, modal: '#dialogRole' }); $.bc({ id: groupId, url: Group.url, method: "put", data: roleIds, query: { type: "role" }, title: Role.title, modal: '#dialogRole' });
}, },
'#btnSubmitUser': function (row) { '#btnSubmitUser': function (row) {
var groupId = row.Id; var groupId = row.Id;
var userIds = $dialogUser.find(':checked').map(function (index, element) { var userIds = $dialogUser.find(':checked').map(function (index, element) {
return $(element).val(); return $(element).val();
}).toArray(); }).toArray();
$.bc({ id: groupId, url: User.url, method: "put", data: userIds, query: { type: "group" }, title: User.title, modal: '#dialogUser' }); $.bc({ id: groupId, url: Group.url, method: "put", data: userIds, query: { type: "user" }, title: User.title, modal: '#dialogUser' });
} }
} }
}, },
@ -72,7 +72,7 @@
], ],
exportOptions: { exportOptions: {
fileName: "部门数据", fileName: "部门数据",
ignoreColumn: [0, 1] ignoreColumn: [0, 3]
} }
} }
}); });

View File

@ -61,7 +61,7 @@ $(function () {
var roleIds = $dialogRole.find('input:checked').map(function (index, element) { var roleIds = $dialogRole.find('input:checked').map(function (index, element) {
return $(element).val(); return $(element).val();
}).toArray(); }).toArray();
$.bc({ id: menuId, url: Role.url, method: "put", data: roleIds, query: { type: "menu" }, title: Role.title, modal: '#dialogRole' }); $.bc({ id: menuId, url: Menu.url, method: "put", data: roleIds, title: Role.title, modal: '#dialogRole' });
} }
}, },
callback: function (result) { callback: function (result) {
@ -72,11 +72,13 @@ $(function () {
} }
}, },
smartTable: { smartTable: {
pageSize: 100,
pageList: [100, 200, 400],
sortName: 'Order', sortName: 'Order',
queryParams: function (params) { return $.extend(params, { parentName: $('#txt_parent_menus_name').val(), name: $("#txt_menus_name").val(), category: $('#sel_menus_category').val(), isresource: $('#sel_menus_res').val(), appCode: $('#sel_app').val() }); }, //传递参数(* queryParams: function (params) { return $.extend(params, { parentName: $('#txt_parent_menus_name').val(), name: $("#txt_menus_name").val(), category: $('#sel_menus_category').val(), isresource: $('#sel_menus_res').val(), appCode: $('#sel_app').val() }); }, //传递参数(*
exportOptions: { exportOptions: {
fileName: "菜单数据", fileName: "菜单数据",
ignoreColumn: [0, 1] ignoreColumn: [0, 9]
}, },
columns: [ columns: [
{ {
@ -125,7 +127,10 @@ $(function () {
}, },
{ {
title: "菜单类型", field: "IsResource", sortable: true, formatter: function (value, row, index) { title: "菜单类型", field: "IsResource", sortable: true, formatter: function (value, row, index) {
return value === "0" ? "菜单" : "资源"; var ret = "菜单";
if (value === "1") ret = "资源";
else if (value === "2") ret = "按钮";
return ret;
} }
}, },
{ {
@ -151,7 +156,7 @@ $(function () {
}, },
onResetView: function () { onResetView: function () {
$table.treegrid({ $table.treegrid({
treeColumn: 2, treeColumn: 1,
expanderExpandedClass: 'fa fa-chevron-circle-down', expanderExpandedClass: 'fa fa-chevron-circle-down',
expanderCollapsedClass: 'fa fa-chevron-circle-down', expanderCollapsedClass: 'fa fa-chevron-circle-down',
onChange: function () { onChange: function () {
@ -253,7 +258,7 @@ $(function () {
case "order": case "order":
var data = $nestMenu.find('li:visible'); var data = $nestMenu.find('li:visible');
var mid = $('#menuID').val(); var mid = $('#menuID').val();
for (index in data) { for (var index in data) {
var $data = $(data[index]); var $data = $(data[index]);
if ($data.attr('data-id') === mid || $data.attr('data-id') === 0) { if ($data.attr('data-id') === mid || $data.attr('data-id') === 0) {
if (index > 0) index--; if (index > 0) index--;

View File

@ -2,7 +2,7 @@ $(function () {
var apiUrl = "api/OnlineUsers"; var apiUrl = "api/OnlineUsers";
var $table = $('table').smartTable({ var $table = $('table').smartTable({
url: apiUrl, url: apiUrl,
method: "post", method: "get",
sidePagination: "client", sidePagination: "client",
showToggle: false, showToggle: false,
showRefresh: false, showRefresh: false,

View File

@ -1,4 +1,4 @@
$(function () { $(function () {
var $headerIcon = $('#headerIcon'); var $headerIcon = $('#headerIcon');
var preIcon = $headerIcon.attr('src'); var preIcon = $headerIcon.attr('src');
var $file = $('#fileIcon'); var $file = $('#fileIcon');
@ -78,12 +78,12 @@
switch ($this.attr('data-method')) { switch ($this.attr('data-method')) {
case 'password': case 'password':
data.UserStatus = 'ChangePassword'; data.UserStatus = 'ChangePassword';
$.bc({ url: User.url, method: "put", data: data, title: "更改密码" }); $.bc({ url: Profiles.url, method: "put", data: data, title: "更改密码" });
break; break;
case 'user': case 'user':
data.UserStatus = 'ChangeDisplayName'; data.UserStatus = 'ChangeDisplayName';
$.bc({ $.bc({
url: User.url, method: "put", data: data, title: "修改用户显示名称", url: Profiles.url, method: "put", data: data, title: "修改用户显示名称",
callback: function (result) { callback: function (result) {
if (result) { if (result) {
$('#userDisplayName').text(data.DisplayName); $('#userDisplayName').text(data.DisplayName);
@ -94,7 +94,7 @@
case 'css': case 'css':
data.UserStatus = 'ChangeTheme'; data.UserStatus = 'ChangeTheme';
$.bc({ $.bc({
url: User.url, method: "put", data: data, title: "保存样式", callback: function (result) { url: Profiles.url, method: "put", data: data, title: "保存样式", callback: function (result) {
if (result) { if (result) {
window.setTimeout(function () { window.location.reload(true); }, 1000); window.setTimeout(function () { window.location.reload(true); }, 1000);
} }
@ -104,7 +104,7 @@
case 'app': case 'app':
data.UserStatus = 'SaveApp'; data.UserStatus = 'SaveApp';
$.bc({ $.bc({
url: User.url, method: "put", data: data, title: "保存应用", callback: function (result) { url: Profiles.url, method: "put", data: data, title: "保存应用", callback: function (result) {
if (result) { if (result) {
window.setTimeout(function () { window.location.reload(true); }, 1000); window.setTimeout(function () { window.location.reload(true); }, 1000);
} }
@ -113,8 +113,7 @@
break; break;
} }
}); });
$('[data-admin="False"]').removeClass('d-none'); if ($('[enctype="multipart/form-data"]').length === 0) {
if ($('[enctype="multipart/form-data"]').is(":hidden")) {
$('.card-img').removeClass('d-none'); $('.card-img').removeClass('d-none');
} }
$('#css').dropdown('val'); $('#css').dropdown('val');

View File

@ -1,4 +1,4 @@
$(function () { $(function () {
var $dialogUser = $("#dialogUser"); var $dialogUser = $("#dialogUser");
var $dialogUserHeader = $('#myUserModalLabel'); var $dialogUserHeader = $('#myUserModalLabel');
var $dialogUserForm = $('#userForm'); var $dialogUserForm = $('#userForm');
@ -76,7 +76,7 @@
}, },
'#btn_assignApp': function (row) { '#btn_assignApp': function (row) {
$.bc({ $.bc({
id: row.Id, url: App.url, method: "post", id: row.Id, url: App.url, method: "get",
callback: function (result) { callback: function (result) {
var htmlTemplate = this.htmlTemplate; var htmlTemplate = this.htmlTemplate;
var html = $.map(result, function (element, index) { var html = $.map(result, function (element, index) {
@ -95,28 +95,28 @@
var userIds = $dialogUser.find(':checked').map(function (index, element) { var userIds = $dialogUser.find(':checked').map(function (index, element) {
return $(element).val(); return $(element).val();
}).toArray(); }).toArray();
$.bc({ id: roleId, url: User.url, method: "put", data: userIds, query: { type: "role" }, modal: '#dialogUser', title: User.title }); $.bc({ id: roleId, url: Role.url, method: "put", data: userIds, query: { type: "user" }, modal: '#dialogUser', title: User.title });
}, },
'#btnSubmitGroup': function (row) { '#btnSubmitGroup': function (row) {
var roleId = row.Id; var roleId = row.Id;
var groupIds = $dialogGroup.find(':checked').map(function (index, element) { var groupIds = $dialogGroup.find(':checked').map(function (index, element) {
return $(element).val(); return $(element).val();
}).toArray(); }).toArray();
$.bc({ id: roleId, url: Group.url, method: "put", data: groupIds, query: { type: "role" }, modal: '#dialogGroup', title: Group.title }); $.bc({ id: roleId, url: Role.url, method: "put", data: groupIds, query: { type: "group" }, modal: '#dialogGroup', title: Group.title });
}, },
'#btnSubmitMenu': function (row) { '#btnSubmitMenu': function (row) {
var roleId = row.Id; var roleId = row.Id;
var menuIds = $nestMenuInput.find('input:checkbox:checked').map(function (index, element) { var menuIds = $nestMenuInput.find('input:checkbox:checked').map(function (index, element) {
return $(element).val(); return $(element).val();
}).toArray(); }).toArray();
$.bc({ id: roleId, url: Menu.url, method: "put", data: menuIds, modal: '#dialogMenu', title: Menu.title }); $.bc({ id: roleId, url: Role.url, method: "put", data: menuIds, query: { type: "menu" }, modal: '#dialogMenu', title: Menu.title });
}, },
'#btnSubmitApp': function (row) { '#btnSubmitApp': function (row) {
var roleId = row.Id; var roleId = row.Id;
var appIds = $dialogApp.find(':checked').map(function (index, element) { var appIds = $dialogApp.find(':checked').map(function (index, element) {
return $(element).val(); return $(element).val();
}).toArray(); }).toArray();
$.bc({ id: roleId, url: App.url, method: "put", data: appIds, modal: '#dialogApp', title: App.title }); $.bc({ id: roleId, url: Role.url, method: "put", data: appIds, query: { type: "app" }, modal: '#dialogApp', title: App.title });
} }
} }
}, },
@ -129,7 +129,7 @@
], ],
exportOptions: { exportOptions: {
fileName: "角色数据", fileName: "角色数据",
ignoreColumn: [0, 1] ignoreColumn: [0, 3]
} }
} }
}); });

View File

@ -1,6 +1,4 @@
$(function () { $(function () {
$('a[data-admin="False"]').hide();
var dataBinder = new DataEntity({ var dataBinder = new DataEntity({
Title: "#sysName", Title: "#sysName",
Footer: "#sysFoot" Footer: "#sysFoot"

View File

@ -1,4 +1,4 @@
$(function () { $(function () {
var $dialogRole = $('#dialogRole'); var $dialogRole = $('#dialogRole');
var $dialogRoleHeader = $('#myRoleModalLabel'); var $dialogRoleHeader = $('#myRoleModalLabel');
var $dialogRoleForm = $('#roleForm'); var $dialogRoleForm = $('#roleForm');
@ -58,14 +58,14 @@
var roleIds = $dialogRole.find(':checked').map(function (index, element) { var roleIds = $dialogRole.find(':checked').map(function (index, element) {
return $(element).val(); return $(element).val();
}).toArray(); }).toArray();
$.bc({ id: userId, url: Role.url, method: 'put', data: roleIds, query: { type: "user" }, title: Role.title, modal: '#dialogRole' }); $.bc({ id: userId, url: User.url, method: 'put', data: roleIds, query: { type: "role" }, title: Role.title, modal: '#dialogRole' });
}, },
'#btnSubmitGroup': function (row) { '#btnSubmitGroup': function (row) {
var userId = row.Id; var userId = row.Id;
var groupIds = $dialogGroup.find(':checked').map(function (index, element) { var groupIds = $dialogGroup.find(':checked').map(function (index, element) {
return $(element).val(); return $(element).val();
}).toArray(); }).toArray();
$.bc({ id: userId, url: Group.url, method: 'put', data: groupIds, query: { type: "user" }, title: Group.title, modal: '#dialogGroup' }); $.bc({ id: userId, url: User.url, method: 'put', data: groupIds, query: { type: "group" }, title: Group.title, modal: '#dialogGroup' });
}, },
'#btnReset': function (row) { '#btnReset': function (row) {
$.bc({ id: row.UserName, url: 'api/Register', method: 'put', data: { password: $('#resetPassword').val() }, modal: "#dialogReset", title: "重置密码", callback: function (result) { if (result) $table.bootstrapTable('refresh'); } }); $.bc({ id: row.UserName, url: 'api/Register', method: 'put', data: { password: $('#resetPassword').val() }, modal: "#dialogReset", title: "重置密码", callback: function (result) { if (result) $table.bootstrapTable('refresh'); } });
@ -93,34 +93,38 @@
{ title: "注册时间", field: "RegisterTime", sortable: true }, { title: "注册时间", field: "RegisterTime", sortable: true },
{ title: "授权时间", field: "ApprovedTime", sortable: true }, { title: "授权时间", field: "ApprovedTime", sortable: true },
{ title: "授权人", field: "ApprovedBy", sortable: true }, { title: "授权人", field: "ApprovedBy", sortable: true },
{ title: "说明", field: "Description", sortable: false }, { title: "说明", field: "Description", sortable: false }
{
title: "操作", field: "IsReset", formatter: function (value, row, index) {
return value === 1 ? '<button class="reset btn btn-danger"><i class="fa fa-remove"></i><span>重置</span></button>' : '';
},
events: {
'click .reset': function (e, value, row, index) {
$table.bootstrapTable('uncheckAll');
$table.bootstrapTable('check', index);
$dialogResetHeader.text($.format("{0} - 重置密码窗口", row.UserName));
$.bc({
id: row.UserName, url: User.url, method: 'post', query: { type: "reset" }, callback: function (result) {
if ($.isArray(result)) {
var reason = result.map(function (v, index) {
return $.format("{0}: {1}", v.Key, v.Value);
}).join('\n');
$resetReason.text(reason);
$dialogReset.modal('show');
}
}
});
}
}
}
], ],
editButtons: {
events : {
'click .reset': function (e, value, row, index) {
$table.bootstrapTable('uncheckAll');
$table.bootstrapTable('check', index);
$dialogResetHeader.text($.format("{0} - 重置密码窗口", row.UserName));
$.bc({
id: row.UserName, url: User.url, method: 'post', query: { type: "reset" }, callback: function (result) {
if ($.isArray(result)) {
var reason = result.map(function (v, index) {
return $.format("{0}: {1}", v.Key, v.Value);
}).join('\n');
$resetReason.text(reason);
$dialogReset.modal('show');
}
}
});
}
},
formatter: function (value, row, index) {
var $this = this.clone();
if (row.IsReset === 0) {
$this.find('button.reset').remove();
}
return $this.html();
}
},
exportOptions: { exportOptions: {
fileName: "用户数据", fileName: "用户数据",
ignoreColumn: [0, 1] ignoreColumn: [0, 7]
} }
} }
}); });

View File

@ -233,7 +233,7 @@
var base = $('#pathBase').attr('href'); var base = $('#pathBase').attr('href');
return base + url; return base + url;
}, },
safeHtml: function(text) { safeHtml: function (text) {
return $('<div>').text(text).html(); return $('<div>').text(text).html();
}, },
syntaxHighlight: function (json) { syntaxHighlight: function (json) {
@ -281,20 +281,29 @@
lgbTable: function (options) { lgbTable: function (options) {
var bsa = new DataTable($.extend(options.dataBinder, { url: options.url })); var bsa = new DataTable($.extend(options.dataBinder, { url: options.url }));
var settings = $.extend({ var settings = $.extend(true, {
url: options.url, url: options.url,
checkbox: true, checkbox: true,
edit: true, editButtons: {
id: "#tableButtons",
events: {},
formatter: false
},
editTitle: "操作", editTitle: "操作",
editField: "Id", editField: "Id",
queryButton: false queryButton: false
}, options.smartTable); }, options.smartTable);
if (settings.edit) settings.columns.unshift({
var $editButtons = $(settings.editButtons.id);
if ($editButtons.find('button').length > 0) settings.columns.push({
title: settings.editTitle, title: settings.editTitle,
field: settings.editField, field: settings.editField,
events: bsa.idEvents(), events: $.extend({}, bsa.idEvents(), settings.editButtons.events),
formatter: function (value, row, index) { formatter: function (value, row, index) {
return "<div class='btn-group'><button class='edit btn btn-sm btn-success'><i class='fa fa-edit'></i><span>编辑</span></button><button class='del btn btn-sm btn-danger'><i class='fa fa-remove'></i><span>删除</span></button></div>"; if ($.isFunction(settings.editButtons.formatter)) {
return settings.editButtons.formatter.call($editButtons, value, row, index);
}
return $editButtons.html();
} }
}); });
if (settings.checkbox) settings.columns.unshift({ checkbox: true }); if (settings.checkbox) settings.columns.unshift({ checkbox: true });
@ -337,17 +346,19 @@
} }
else { else {
var formatter = value.formatter; var formatter = value.formatter;
value.formatter = function(value, row, index, field) { value.formatter = function (value, row, index, field) {
return formatter.call(this, $.safeHtml(value), row, index, field); return formatter.call(this, $.safeHtml(value), row, index, field);
} }
} }
}); });
this.bootstrapTable(settings); this.bootstrapTable(settings);
$('.bootstrap-table .fixed-table-toolbar .columns .export .dropdown-menu').addClass("dropdown-menu-right"); $('.bootstrap-table .fixed-table-toolbar .columns .export .dropdown-menu').addClass("dropdown-menu-right");
$(settings.toolbar).removeClass('d-none').find('.toolbar').on('click', 'a', function (e) { var $gear = $(settings.toolbar).removeClass('d-none').find('.gear');
if ($gear.find('.dropdown-menu > a').length === 0) $gear.addClass('d-none');
$gear.on('click', 'a', function (e) {
e.preventDefault(); e.preventDefault();
$('#' + $(this).attr('id').replace('tb_', 'btn_')).trigger("click"); $('#' + $(this).attr('id').replace('tb_', 'btn_')).trigger("click");
}).insertBefore(this.parents('.bootstrap-table').find('.fixed-table-toolbar > .bs-bars')); });
if (settings.queryButton) { if (settings.queryButton) {
$(settings.queryButton).on('click', this, function (e) { $(settings.queryButton).on('click', this, function (e) {
e.data.bootstrapTable('refresh'); e.data.bootstrapTable('refresh');

View File

@ -0,0 +1,221 @@
/*!
* jQuery Mousewheel 3.1.13
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*/
(function (factory) {
if ( typeof define === 'function' && define.amd ) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS style for Browserify
module.exports = factory;
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
slice = Array.prototype.slice,
nullLowestDeltaTimeout, lowestDelta;
if ( $.event.fixHooks ) {
for ( var i = toFix.length; i; ) {
$.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
}
}
var special = $.event.special.mousewheel = {
version: '3.1.12',
setup: function() {
if ( this.addEventListener ) {
for ( var i = toBind.length; i; ) {
this.addEventListener( toBind[--i], handler, false );
}
} else {
this.onmousewheel = handler;
}
// Store the line height and page height for this particular element
$.data(this, 'mousewheel-line-height', special.getLineHeight(this));
$.data(this, 'mousewheel-page-height', special.getPageHeight(this));
},
teardown: function() {
if ( this.removeEventListener ) {
for ( var i = toBind.length; i; ) {
this.removeEventListener( toBind[--i], handler, false );
}
} else {
this.onmousewheel = null;
}
// Clean up the data we added to the element
$.removeData(this, 'mousewheel-line-height');
$.removeData(this, 'mousewheel-page-height');
},
getLineHeight: function(elem) {
var $elem = $(elem),
$parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
if (!$parent.length) {
$parent = $('body');
}
return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
},
getPageHeight: function(elem) {
return $(elem).height();
},
settings: {
adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
normalizeOffset: true // calls getBoundingClientRect for each event
}
};
$.fn.extend({
mousewheel: function(fn) {
return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
},
unmousewheel: function(fn) {
return this.unbind('mousewheel', fn);
}
});
function handler(event) {
var orgEvent = event || window.event,
args = slice.call(arguments, 1),
delta = 0,
deltaX = 0,
deltaY = 0,
absDelta = 0,
offsetX = 0,
offsetY = 0;
event = $.event.fix(orgEvent);
event.type = 'mousewheel';
// Old school scrollwheel delta
if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
// Firefox < 17 horizontal scrolling related to DOMMouseScroll event
if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
deltaX = deltaY * -1;
deltaY = 0;
}
// Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
delta = deltaY === 0 ? deltaX : deltaY;
// New school wheel delta (wheel event)
if ( 'deltaY' in orgEvent ) {
deltaY = orgEvent.deltaY * -1;
delta = deltaY;
}
if ( 'deltaX' in orgEvent ) {
deltaX = orgEvent.deltaX;
if ( deltaY === 0 ) { delta = deltaX * -1; }
}
// No change actually happened, no reason to go any further
if ( deltaY === 0 && deltaX === 0 ) { return; }
// Need to convert lines and pages to pixels if we aren't already in pixels
// There are three delta modes:
// * deltaMode 0 is by pixels, nothing to do
// * deltaMode 1 is by lines
// * deltaMode 2 is by pages
if ( orgEvent.deltaMode === 1 ) {
var lineHeight = $.data(this, 'mousewheel-line-height');
delta *= lineHeight;
deltaY *= lineHeight;
deltaX *= lineHeight;
} else if ( orgEvent.deltaMode === 2 ) {
var pageHeight = $.data(this, 'mousewheel-page-height');
delta *= pageHeight;
deltaY *= pageHeight;
deltaX *= pageHeight;
}
// Store lowest absolute delta to normalize the delta values
absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
if ( !lowestDelta || absDelta < lowestDelta ) {
lowestDelta = absDelta;
// Adjust older deltas if necessary
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
lowestDelta /= 40;
}
}
// Adjust older deltas if necessary
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
// Divide all the things by 40!
delta /= 40;
deltaX /= 40;
deltaY /= 40;
}
// Get a whole, normalized value for the deltas
delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
// Normalise offsetX and offsetY properties
if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
var boundingRect = this.getBoundingClientRect();
offsetX = event.clientX - boundingRect.left;
offsetY = event.clientY - boundingRect.top;
}
// Add information to the event object
event.deltaX = deltaX;
event.deltaY = deltaY;
event.deltaFactor = lowestDelta;
event.offsetX = offsetX;
event.offsetY = offsetY;
// Go ahead and set deltaMode to 0 since we converted to pixels
// Although this is a little odd since we overwrite the deltaX/Y
// properties with normalized deltas.
event.deltaMode = 0;
// Add event and delta to the front of the arguments
args.unshift(event, delta, deltaX, deltaY);
// Clearout lowestDelta after sometime to better
// handle multiple device types that give different
// a different lowestDelta
// Ex: trackpad = 3 and mouse wheel = 120
if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
return ($.event.dispatch || $.event.handle).apply(this, args);
}
function nullLowestDelta() {
lowestDelta = null;
}
function shouldAdjustOldDeltas(orgEvent, absDelta) {
// If this is an older event and the delta is divisable by 120,
// then we are assuming that the browser is treating this as an
// older mouse wheel event and that we should divide the deltas
// by 40 to try and get a more usable deltaFactor.
// Side note, this actually impacts the reported scroll distance
// in older browsers and can cause scrolling to be slower than native.
// Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
}
}));

View File

@ -0,0 +1,8 @@
/*!
* jQuery Mousewheel 3.1.13
*
* Copyright 2015 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});

View File

@ -56,9 +56,7 @@ namespace Bootstrap.DataAccess
/// <summary> /// <summary>
/// 保存网站个性化设置 /// 保存网站个性化设置
/// </summary> /// </summary>
/// <param name="name"></param> /// <param name="dict"></param>
/// <param name="code"></param>
/// <param name="category"></param>
/// <returns></returns> /// <returns></returns>
public static bool SaveSettings(BootstrapDict dict) public static bool SaveSettings(BootstrapDict dict)
{ {

View File

@ -1,7 +1,9 @@
using Bootstrap.Security; using Bootstrap.Security;
using Bootstrap.Security.DataAccess; using Bootstrap.Security.DataAccess;
using Longbow.Cache; using Longbow.Cache;
using Longbow.Data; using Longbow.Data;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -99,6 +101,26 @@ namespace Bootstrap.DataAccess
return DbHelper.CascadeMenus(menus, activeUrl); return DbHelper.CascadeMenus(menus, activeUrl);
} }
/// <summary>
/// 通过当前用户名与指定菜单路径获取此菜单下所有授权按钮集合
/// </summary>
/// <param name="context">请求上下文</param>
/// <param name="url">资源按钮所属菜单</param>
/// <param name="key">资源授权码</param>
/// <returns></returns>
public static bool AuthorizateButtons(HttpContext context, string url, string key)
{
if (context.User.IsInRole("Administrators")) return true;
var menus = RetrieveAllMenus(context.User.Identity.Name);
var activeMenu = menus.FirstOrDefault(m => m.Url.Equals(url, StringComparison.OrdinalIgnoreCase));
if (activeMenu == null) return false;
var authorKeys = menus.Where(m => m.ParentId == activeMenu.Id && m.IsResource == 2).Select(m => m.Url);
var keys = key.SpanSplitAny(",. ;", StringSplitOptions.RemoveEmptyEntries);
return keys.Any(m => authorKeys.Any(k => k == m));
}
/// <summary> /// <summary>
/// 通过当前用户名获得所有菜单,层次化后集合 /// 通过当前用户名获得所有菜单,层次化后集合
/// </summary> /// </summary>

View File

@ -43,30 +43,65 @@ INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'获取IP地点', '0', 0) INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'获取IP地点', '0', 0)
DELETE FROM Navigations DELETE FROM Navigations
SET IDENTITY_INSERT [dbo].[Navigations] ON DBCC CHECKIDENT(Navigations, RESEED, 0)
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (1, 0, N'后台管理', 10, N'fa fa-gear', N'~/Admin/Index', N'0') INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'后台管理', 10, N'fa fa-gear', N'~/Admin/Index', N'0')
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (2, 0, N'个人中心', 20, N'fa fa-suitcase', N'~/Admin/Profiles', N'0') INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'个人中心', 20, N'fa fa-suitcase', N'~/Admin/Profiles', N'0')
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (3, 0, N'返回前台', 30, N'fa fa-hand-o-left', N'~/Home/Index', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity, N'保存显示名称', 10, 'fa fa-fa', 'saveDisplayName', '0', 2);
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (4, 0, N'网站设置', 40, N'fa fa-fa', N'~/Admin/Settings', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 1, N'保存密码', 20, 'fa fa-fa', 'savePassword', '0', 2);
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (5, 0, N'菜单管理', 50, N'fa fa-dashboard', N'~/Admin/Menus', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 2, N'保存应用', 30, 'fa fa-fa', 'saveApp', '0', 2);
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (6, 0, N'用户管理', 60, N'fa fa-user', N'~/Admin/Users', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 3, N'保存样式', 40, 'fa fa-fa', 'saveTheme', '0', 2);
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (7, 0, N'角色管理', 70, N'fa fa-sitemap', N'~/Admin/Roles', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 4, N'保存头像', 50, 'fa fa-fa', 'saveIcon', '0', 2);
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (8, 0, N'部门管理', 80, N'fa fa-bank', N'~/Admin/Groups', N'0') INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'返回前台', 30, N'fa fa-hand-o-left', N'~/Home/Index', N'0')
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (9, 0, N'字典表维护', 90, N'fa fa-book', N'~/Admin/Dicts', N'0') INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'网站设置', 40, N'fa fa-fa', N'~/Admin/Settings', N'0')
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (10, 0, N'站内消息', 100, N'fa fa-envelope', N'~/Admin/Messages', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity, N'保存系统名称', 10, 'fa fa-fa', 'saveTitle', '0', 2);
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (11, 0, N'任务管理', 110, N'fa fa fa-tasks', N'~/Admin/Tasks', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 1, N'保存页脚设置', 20, 'fa fa-fa', 'saveFooter', '0', 2);
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (12, 0, N'通知管理', 120, N'fa fa-bell', N'~/Admin/Notifications', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 2, N'保存样式', 30, 'fa fa-fa', 'saveTheme', '0', 2);
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (13, 0, N'日志管理', 130, N'fa fa-gears', N'#', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 3, N'清理缓存', 40, 'fa fa-fa', 'clearCache', '0', 2);
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (20, 13, N'操作日志', 10, N'fa fa-edit', N'~/Admin/Logs', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 4, N'清理全部缓存', 50, 'fa fa-fa', 'clearAllCache', '0', 2);
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (21, 13, N'登录日志', 20, N'fa fa-user-circle-o', N'~/Admin/Logins', N'0') INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'菜单管理', 50, N'fa fa-dashboard', N'~/Admin/Menus', N'0')
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (22, 13, N'访问日志', 30, N'fa fa-bars', N'~/Admin/Traces', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity, N'新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (14, 0, N'在线用户', 140, N'fa fa-users', N'~/Admin/Online', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 1, N'编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (15, 0, N'程序异常', 150, N'fa fa-cubes', N'~/Admin/Exceptions', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 2, N'删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (16, 0, N'工具集合', 160, N'fa fa-gavel', N'#', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 3, N'分配角色', 40, 'fa fa-fa', 'assignRole', '0', 2);
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (17, 16, N'客户端测试', 10, N'fa fa-wrench', N'~/Admin/Mobile', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (0, N'图标页面', 50, 'fa fa-fa', '~/Admin/IconView', '0', 1);
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (18, 16, N'API文档', 10, N'fa fa-wrench', N'~/swagger', N'0') INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'用户管理', 60, N'fa fa-user', N'~/Admin/Users', N'0')
INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (19, 16, N'图标集', 10, N'fa fa-dashboard', N'~/Admin/FAIcon', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity, N'新增', 10, 'fa fa-fa', 'add', '0', 2);
SET IDENTITY_INSERT [dbo].[Navigations] OFF INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 1, N'编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 2, N'删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 3, N'分配部门', 40, 'fa fa-fa', 'assignGroup', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 4, N'分配角色', 50, 'fa fa-fa', 'assignRole', '0', 2);
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'角色管理', 70, N'fa fa-sitemap', N'~/Admin/Roles', N'0')
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity, N'新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 1, N'编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 2, N'删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 3, N'分配用户', 40, 'fa fa-fa', 'assignUser', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 4, N'分配部门', 50, 'fa fa-fa', 'assignGroup', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 5, N'分配菜单', 60, 'fa fa-fa', 'assignMenu', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 6, N'分配应用', 70, 'fa fa-fa', 'assignApp', '0', 2);
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'部门管理', 80, N'fa fa-bank', N'~/Admin/Groups', N'0')
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity, N'新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 1, N'编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 2, N'删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 3, N'分配用户', 40, 'fa fa-fa', 'assignUser', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 4, N'分配角色', 50, 'fa fa-fa', 'assignRole', '0', 2);
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'字典表维护', 90, N'fa fa-book', N'~/Admin/Dicts', N'0')
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity, N'新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 1, N'编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 2, N'删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'站内消息', 100, N'fa fa-envelope', N'~/Admin/Messages', N'0')
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'任务管理', 110, N'fa fa fa-tasks', N'~/Admin/Tasks', N'0')
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'通知管理', 120, N'fa fa-bell', N'~/Admin/Notifications', N'0')
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'日志管理', 130, N'fa fa-gears', N'#', N'0')
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (@@Identity, N'操作日志', 10, N'fa fa-edit', N'~/Admin/Logs', N'0')
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (@@Identity - 1, N'登录日志', 20, N'fa fa-user-circle-o', N'~/Admin/Logins', N'0')
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (@@Identity - 2, N'访问日志', 30, N'fa fa-bars', N'~/Admin/Traces', N'0')
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'在线用户', 140, N'fa fa-users', N'~/Admin/Online', N'0')
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'程序异常', 150, N'fa fa-cubes', N'~/Admin/Exceptions', N'0')
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity, N'服务器日志', 10, N'fa fa-fa', N'log', N'0', 2)
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'工具集合', 160, N'fa fa-gavel', N'#', N'0')
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (@@Identity, N'客户端测试', 10, N'fa fa-wrench', N'~/Admin/Mobile', N'0')
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (@@Identity - 1, N'API文档', 10, N'fa fa-wrench', N'~/swagger', N'0')
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (@@Identity - 2, N'图标集', 10, N'fa fa-dashboard', N'~/Admin/FAIcon', N'0')
DELETE FROM GROUPS WHERE ID = 1 DELETE FROM GROUPS WHERE ID = 1
SET IDENTITY_INSERT [dbo].[Groups] ON SET IDENTITY_INSERT [dbo].[Groups] ON

View File

@ -23,6 +23,66 @@
"IsResource": NumberInt(0), "IsResource": NumberInt(0),
"Application": "0" "Application": "0"
}, },
{
"_id": ObjectId("5bd7b8445fa31256f77e4a01"),
"ParentId": "5bd7b8445fa31256f77e4b91",
"Name": "保存显示名称",
"Order": NumberInt(10),
"Icon": "fa fa-fa",
"Url": "saveDisplayName",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4a02"),
"ParentId": "5bd7b8445fa31256f77e4b91",
"Name": "保存密码",
"Order": NumberInt(20),
"Icon": "fa fa-fa",
"Url": "savePassword",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4a03"),
"ParentId": "5bd7b8445fa31256f77e4b91",
"Name": "保存应用",
"Order": NumberInt(30),
"Icon": "fa fa-fa",
"Url": "saveApp",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4a04"),
"ParentId": "5bd7b8445fa31256f77e4b91",
"Name": "保存样式",
"Order": NumberInt(40),
"Icon": "fa fa-fa",
"Url": "saveTheme",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4a05"),
"ParentId": "5bd7b8445fa31256f77e4b91",
"Name": "保存头像",
"Order": NumberInt(50),
"Icon": "fa fa-fa",
"Url": "saveIcon",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{ {
"_id": ObjectId("5bd7b8445fa31256f77e4b92"), "_id": ObjectId("5bd7b8445fa31256f77e4b92"),
"ParentId": "0", "ParentId": "0",
@ -47,6 +107,66 @@
"IsResource": NumberInt(0), "IsResource": NumberInt(0),
"Application": "0" "Application": "0"
}, },
{
"_id": ObjectId("5bd7b8445fa31256f77e4b01"),
"ParentId": "5bd7b8445fa31256f77e4b93",
"Name": "保存系统名称",
"Order": NumberInt(10),
"Icon": "fa fa-fa",
"Url": "saveTitle",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b02"),
"ParentId": "5bd7b8445fa31256f77e4b93",
"Name": "保存页脚设置",
"Order": NumberInt(20),
"Icon": "fa fa-fa",
"Url": "saveFooter",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b03"),
"ParentId": "5bd7b8445fa31256f77e4b93",
"Name": "保存样式",
"Order": NumberInt(30),
"Icon": "fa fa-fa",
"Url": "saveTheme",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b04"),
"ParentId": "5bd7b8445fa31256f77e4b93",
"Name": "清理缓存",
"Order": NumberInt(40),
"Icon": "fa fa-fa",
"Url": "clearCache",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b05"),
"ParentId": "5bd7b8445fa31256f77e4b93",
"Name": "清理全部缓存",
"Order": NumberInt(50),
"Icon": "fa fa-fa",
"Url": "clearAllCache",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{ {
"_id": ObjectId("5bd7b8445fa31256f77e4b94"), "_id": ObjectId("5bd7b8445fa31256f77e4b94"),
"ParentId": "0", "ParentId": "0",
@ -59,6 +179,66 @@
"IsResource": NumberInt(0), "IsResource": NumberInt(0),
"Application": "0" "Application": "0"
}, },
{
"_id": ObjectId("5bd7b8445fa31256f77e4b10"),
"ParentId": "5bd7b8445fa31256f77e4b94",
"Name": "新增",
"Order": NumberInt(10),
"Icon": "fa fa-fa",
"Url": "add",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b11"),
"ParentId": "5bd7b8445fa31256f77e4b94",
"Name": "编辑",
"Order": NumberInt(20),
"Icon": "fa fa-fa",
"Url": "edit",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b12"),
"ParentId": "5bd7b8445fa31256f77e4b94",
"Name": "删除",
"Order": NumberInt(30),
"Icon": "fa fa-fa",
"Url": "del",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b13"),
"ParentId": "5bd7b8445fa31256f77e4b94",
"Name": "分配角色",
"Order": NumberInt(40),
"Icon": "fa fa-fa",
"Url": "assignRole",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b14"),
"ParentId": "0",
"Name": "图标页面",
"Order": NumberInt(55),
"Icon": "fa fa-fa",
"Url": "~/Admin/IconView",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(1),
"Application": "0"
},
{ {
"_id": ObjectId("5bd7b8445fa31256f77e4b95"), "_id": ObjectId("5bd7b8445fa31256f77e4b95"),
"ParentId": "0", "ParentId": "0",
@ -71,6 +251,66 @@
"IsResource": NumberInt(0), "IsResource": NumberInt(0),
"Application": "0" "Application": "0"
}, },
{
"_id": ObjectId("5bd7b8445fa31256f77e4b20"),
"ParentId": "5bd7b8445fa31256f77e4b95",
"Name": "新增",
"Order": NumberInt(10),
"Icon": "fa fa-fa",
"Url": "add",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b21"),
"ParentId": "5bd7b8445fa31256f77e4b95",
"Name": "编辑",
"Order": NumberInt(20),
"Icon": "fa fa-fa",
"Url": "edit",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b22"),
"ParentId": "5bd7b8445fa31256f77e4b95",
"Name": "删除",
"Order": NumberInt(30),
"Icon": "fa fa-fa",
"Url": "del",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b23"),
"ParentId": "5bd7b8445fa31256f77e4b95",
"Name": "分配部门",
"Order": NumberInt(40),
"Icon": "fa fa-fa",
"Url": "assignGroup",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b24"),
"ParentId": "5bd7b8445fa31256f77e4b95",
"Name": "分配角色",
"Order": NumberInt(50),
"Icon": "fa fa-fa",
"Url": "assignRole",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{ {
"_id": ObjectId("5bd7b8445fa31256f77e4b96"), "_id": ObjectId("5bd7b8445fa31256f77e4b96"),
"ParentId": "0", "ParentId": "0",
@ -83,6 +323,90 @@
"IsResource": NumberInt(0), "IsResource": NumberInt(0),
"Application": "0" "Application": "0"
}, },
{
"_id": ObjectId("5bd7b8445fa31256f77e4b30"),
"ParentId": "5bd7b8445fa31256f77e4b96",
"Name": "新增",
"Order": NumberInt(10),
"Icon": "fa fa-fa",
"Url": "add",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b31"),
"ParentId": "5bd7b8445fa31256f77e4b96",
"Name": "编辑",
"Order": NumberInt(20),
"Icon": "fa fa-fa",
"Url": "edit",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b32"),
"ParentId": "5bd7b8445fa31256f77e4b96",
"Name": "删除",
"Order": NumberInt(30),
"Icon": "fa fa-fa",
"Url": "del",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b33"),
"ParentId": "5bd7b8445fa31256f77e4b96",
"Name": "分配用户",
"Order": NumberInt(40),
"Icon": "fa fa-fa",
"Url": "assignUser",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b34"),
"ParentId": "5bd7b8445fa31256f77e4b96",
"Name": "分配部门",
"Order": NumberInt(50),
"Icon": "fa fa-fa",
"Url": "assignGroup",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b35"),
"ParentId": "5bd7b8445fa31256f77e4b96",
"Name": "分配菜单",
"Order": NumberInt(60),
"Icon": "fa fa-fa",
"Url": "assignMenu",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b36"),
"ParentId": "5bd7b8445fa31256f77e4b96",
"Name": "分配应用",
"Order": NumberInt(70),
"Icon": "fa fa-fa",
"Url": "assignApp",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{ {
"_id": ObjectId("5bd7b8445fa31256f77e4b97"), "_id": ObjectId("5bd7b8445fa31256f77e4b97"),
"ParentId": "0", "ParentId": "0",
@ -95,6 +419,66 @@
"IsResource": NumberInt(0), "IsResource": NumberInt(0),
"Application": "0" "Application": "0"
}, },
{
"_id": ObjectId("5bd7b8445fa31256f77e4b40"),
"ParentId": "5bd7b8445fa31256f77e4b97",
"Name": "新增",
"Order": NumberInt(10),
"Icon": "fa fa-fa",
"Url": "add",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b41"),
"ParentId": "5bd7b8445fa31256f77e4b97",
"Name": "编辑",
"Order": NumberInt(20),
"Icon": "fa fa-fa",
"Url": "edit",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b42"),
"ParentId": "5bd7b8445fa31256f77e4b97",
"Name": "删除",
"Order": NumberInt(30),
"Icon": "fa fa-fa",
"Url": "del",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b43"),
"ParentId": "5bd7b8445fa31256f77e4b97",
"Name": "分配用户",
"Order": NumberInt(40),
"Icon": "fa fa-fa",
"Url": "assignUser",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b44"),
"ParentId": "5bd7b8445fa31256f77e4b97",
"Name": "分配角色",
"Order": NumberInt(50),
"Icon": "fa fa-fa",
"Url": "assignRole",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{ {
"_id": ObjectId("5bd7b8445fa31256f77e4b98"), "_id": ObjectId("5bd7b8445fa31256f77e4b98"),
"ParentId": "0", "ParentId": "0",
@ -107,6 +491,42 @@
"IsResource": NumberInt(0), "IsResource": NumberInt(0),
"Application": "0" "Application": "0"
}, },
{
"_id": ObjectId("5bd7b8445fa31256f77e4b50"),
"ParentId": "5bd7b8445fa31256f77e4b98",
"Name": "新增",
"Order": NumberInt(10),
"Icon": "fa fa-fa",
"Url": "add",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b51"),
"ParentId": "5bd7b8445fa31256f77e4b98",
"Name": "编辑",
"Order": NumberInt(20),
"Icon": "fa fa-fa",
"Url": "edit",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{
"_id": ObjectId("5bd7b8445fa31256f77e4b52"),
"ParentId": "5bd7b8445fa31256f77e4b98",
"Name": "删除",
"Order": NumberInt(30),
"Icon": "fa fa-fa",
"Url": "del",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{ {
"_id": ObjectId("5bd7b8445fa31256f77e4b99"), "_id": ObjectId("5bd7b8445fa31256f77e4b99"),
"ParentId": "0", "ParentId": "0",
@ -215,6 +635,18 @@
"IsResource": NumberInt(0), "IsResource": NumberInt(0),
"Application": "0" "Application": "0"
}, },
{
"_id": ObjectId("5bd7b8445fa31256f77e4b60"),
"ParentId": "5bd7b8445fa31256f77e4b9d",
"Name": "服务器日志",
"Order": NumberInt(10),
"Icon": "fa fa-fa",
"Url": "log",
"Category": "0",
"Target": "_self",
"IsResource": NumberInt(2),
"Application": "0"
},
{ {
"_id": ObjectId("5bd7b8445fa31256f77e4b9e"), "_id": ObjectId("5bd7b8445fa31256f77e4b9e"),
"ParentId": "0", "ParentId": "0",

View File

@ -3,50 +3,14 @@
"_id": ObjectId("5bd7cc105fa31256f77e4eb7"), "_id": ObjectId("5bd7cc105fa31256f77e4eb7"),
"RoleName": "Administrators", "RoleName": "Administrators",
"Description": "系统管理员", "Description": "系统管理员",
"Menus": [ "Menus": [],
"5bd7b8445fa31256f77e4b90",
"5bd7b8445fa31256f77e4b91",
"5bd7b8445fa31256f77e4b92",
"5bd7b8445fa31256f77e4b93",
"5bd7b8445fa31256f77e4b94",
"5bd7b8445fa31256f77e4b95",
"5bd7b8445fa31256f77e4b96",
"5bd7b8445fa31256f77e4b97",
"5bd7b8445fa31256f77e4b98",
"5bd7b8445fa31256f77e4b99",
"5bd7b8445fa31256f77e4b9a",
"5bd7b8445fa31256f77e4b9b",
"5bd7b8445fa31256f77e4b9c",
"5bd7b8445fa31256f77e4b9d",
"5bd7b8445fa31256f77e4b9e",
"5bd7b8445fa31256f77e4b9f",
"5bd7b8445fa31256f77e4ba0",
"5bd7b8445fa31256f77e4ba1",
"5bd7b8445fa31256f77e4ba2",
"5bd9b3d868aa001661776f56",
"5bd7b8445fa31256f77e4ba4"
],
"Apps": [] "Apps": []
}, },
{ {
"_id": ObjectId("5bd7cc105fa31256f77e4eb8"), "_id": ObjectId("5bd7cc105fa31256f77e4eb8"),
"RoleName": "Default", "RoleName": "Default",
"Description": "默认用户,可访问前台页面", "Description": "默认用户,可访问前台页面",
"Menus": [ "Menus": [],
"5bd7b8445fa31256f77e4b90",
"5bd7b8445fa31256f77e4b91",
"5bd7b8445fa31256f77e4b92",
"5bd7b8445fa31256f77e4b99",
"5bd7b8445fa31256f77e4b9a",
"5bd7b8445fa31256f77e4b9b",
"5bd7b8445fa31256f77e4b9e",
"5bd7b8445fa31256f77e4b9f",
"5bd7b8445fa31256f77e4ba0",
"5bd7b8445fa31256f77e4ba1",
"5bd7b8445fa31256f77e4ba2",
"5bd9b3d868aa001661776f56",
"5bd7b8445fa31256f77e4ba4"
],
"Apps": [] "Apps": []
} }
] ]

View File

@ -40,30 +40,65 @@ INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'Cookie
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '获取IP地点', '0', 0); INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '获取IP地点', '0', 0);
DELETE FROM Navigations; DELETE FROM Navigations;
ALTER TABLE Navigations MODIFY COLUMN ID INT NOT NULL; Truncate Navigations;
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (1, 0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0');
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (2, 0, '个人中心', 20, 'fa fa-suitcase', '~/Admin/Profiles', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '个人中心', 20, 'fa fa-suitcase', '~/Admin/Profiles', '0');
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (3, 0, '返回前台', 30, 'fa fa-hand-o-left', '~/Home/Index', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity, '保存显示名称', 10, 'fa fa-fa', 'saveDisplayName', '0', 2);
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (4, 0, '网站设置', 40, 'fa fa-fa', '~/Admin/Settings', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 1, '保存密码', 20, 'fa fa-fa', 'savePassword', '0', 2);
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (5, 0, '菜单管理', 50, 'fa fa-dashboard', '~/Admin/Menus', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 2, '保存应用', 30, 'fa fa-fa', 'saveApp', '0', 2);
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (6, 0, '用户管理', 60, 'fa fa-user', '~/Admin/Users', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 3, '保存样式', 40, 'fa fa-fa', 'saveTheme', '0', 2);
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (7, 0, '角色管理', 70, 'fa fa-sitemap', '~/Admin/Roles', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 4, '保存头像', 50, 'fa fa-fa', 'saveIcon', '0', 2);
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (8, 0, '部门管理', 80, 'fa fa-bank', '~/Admin/Groups', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '返回前台', 30, 'fa fa-hand-o-left', '~/Home/Index', '0');
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (9, 0, '字典表维护', 90, 'fa fa-book', '~/Admin/Dicts', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '网站设置', 40, 'fa fa-fa', '~/Admin/Settings', '0');
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (10, 0, '站内消息', 100, 'fa fa-envelope', '~/Admin/Messages', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity, '保存系统名称', 10, 'fa fa-fa', 'saveTitle', '0', 2);
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (11, 0, '任务管理', 110, 'fa fa fa-tasks', '~/Admin/Tasks', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 1, '保存页脚设置', 20, 'fa fa-fa', 'saveFooter', '0', 2);
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (12, 0, '通知管理', 120, 'fa fa-bell', '~/Admin/Notifications', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 2, '保存样式', 30, 'fa fa-fa', 'saveTheme', '0', 2);
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (13, 0, '系统日志', 130, 'fa fa-gears', '#', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 3, '清理缓存', 40, 'fa fa-fa', 'clearCache', '0', 2);
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (20, 13, '操作日志', 10, 'fa fa-edit', '~/Admin/Logs', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 4, '清理全部缓存', 50, 'fa fa-fa', 'clearAllCache', '0', 2);
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (21, 13, '登录日志', 20, 'fa fa-user-circle-o', '~/Admin/Logins', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '菜单管理', 50, 'fa fa-dashboard', '~/Admin/Menus', '0');
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (21, 13, '访问日志', 30, 'fa fa-bars', '~/Admin/Traces', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity, '新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (14, 0, '在线用户', 140, 'fa fa-users', '~/Admin/Online', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 1, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (15, 0, '程序异常', 150, 'fa fa-cubes', '~/Admin/Exceptions', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 2, '删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (16, 0, '工具集合', 160, 'fa fa-gavel', '#', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 3, '分配角色', 40, 'fa fa-fa', 'assignRole', '0', 2);
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (17, 16, '客户端测试', 10, 'fa fa-wrench', '~/Admin/Mobile', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (0, '图标页面', 50, 'fa fa-fa', '~/Admin/IconView', '0', 1);
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (18, 16, 'API文档', 10, 'fa fa-wrench', '~/swagger', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '用户管理', 60, 'fa fa-user', '~/Admin/Users', '0');
INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (19, 16, '图标集', 10, 'fa fa-dashboard', '~/Admin/FAIcon', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity, '新增', 10, 'fa fa-fa', 'add', '0', 2);
ALTER TABLE Navigations MODIFY COLUMN ID INT NOT NULL AUTO_INCREMENT; INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 1, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 2, '删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 3, '分配部门', 40, 'fa fa-fa', 'assignGroup', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 4, '分配角色', 50, 'fa fa-fa', 'assignRole', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '角色管理', 70, 'fa fa-sitemap', '~/Admin/Roles', '0');
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity, '新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 1, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 2, '删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 3, '分配用户', 40, 'fa fa-fa', 'assignUser', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 4, '分配部门', 50, 'fa fa-fa', 'assignGroup', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 5, '分配菜单', 60, 'fa fa-fa', 'assignMenu', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 6, '分配应用', 70, 'fa fa-fa', 'assignApp', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '部门管理', 80, 'fa fa-bank', '~/Admin/Groups', '0');
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity, '新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 1, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 2, '删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 3, '分配用户', 40, 'fa fa-fa', 'assignUser', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 4, '分配角色', 50, 'fa fa-fa', 'assignRole', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '字典表维护', 90, 'fa fa-book', '~/Admin/Dicts', '0');
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity, '新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 1, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 2, '删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '站内消息', 100, 'fa fa-envelope', '~/Admin/Messages', '0');
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '任务管理', 110, 'fa fa fa-tasks', '~/Admin/Tasks', '0');
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '通知管理', 120, 'fa fa-bell', '~/Admin/Notifications', '0');
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '系统日志', 130, 'fa fa-gears', '#', '0');
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (@@identity, '操作日志', 10, 'fa fa-edit', '~/Admin/Logs', '0');
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (@@identity - 1, '登录日志', 20, 'fa fa-user-circle-o', '~/Admin/Logins', '0');
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (@@identity - 2, '访问日志', 30, 'fa fa-bars', '~/Admin/Traces', '0');
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '在线用户', 140, 'fa fa-users', '~/Admin/Online', '0');
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '程序异常', 150, 'fa fa-cubes', '~/Admin/Exceptions', '0');
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity, '服务器日志', 10, 'fa fa-fa', 'log', '0', 2);
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '工具集合', 160, 'fa fa-gavel', '#', '0');
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (@@identity, '客户端测试', 10, 'fa fa-wrench', '~/Admin/Mobile', '0');
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (@@identity - 1, 'API文档', 10, 'fa fa-wrench', '~/swagger', '0');
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (@@identity - 2, '图标集', 10, 'fa fa-dashboard', '~/Admin/FAIcon', '0');
DELETE FROM `Groups` WHERE ID = 1; DELETE FROM `Groups` WHERE ID = 1;
ALTER TABLE `Groups` MODIFY COLUMN ID INT NOT NULL; ALTER TABLE `Groups` MODIFY COLUMN ID INT NOT NULL;
@ -87,15 +122,6 @@ INSERT INTO UserRole (UserID, RoleID) VALUES (1, 1);
INSERT INTO UserRole (UserID, RoleID) VALUES (1, 2); INSERT INTO UserRole (UserID, RoleID) VALUES (1, 2);
DELETE FROM NavigationRole; DELETE FROM NavigationRole;
INSERT INTO NavigationRole SELECT NULL, ID, 1 FROM navigations;
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (1, 2);
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (2, 2);
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (3, 2);
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (10, 2);
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (16, 2);
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (17, 2);
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (18, 2);
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (19, 2);
-- Client Data -- Client Data
Delete From Dicts Where Category = '应用程序' and Code = 2; Delete From Dicts Where Category = '应用程序' and Code = 2;

View File

@ -153,7 +153,7 @@ CREATE TABLE LoginLogs(
ID INTEGER PRIMARY KEY Auto_increment, ID INTEGER PRIMARY KEY Auto_increment,
UserName VARCHAR (50) NOT NULL, UserName VARCHAR (50) NOT NULL,
LoginTime DATETIME NOT NULL, LoginTime DATETIME NOT NULL,
Ip VARCHAR NOT NULL, Ip VARCHAR (15) NOT NULL,
OS VARCHAR (50) NULL, OS VARCHAR (50) NULL,
Browser VARCHAR (50) NULL, Browser VARCHAR (50) NULL,
City VARCHAR (50) NULL, City VARCHAR (50) NULL,

View File

@ -43,13 +43,48 @@ DELETE FROM Navigations;
ALTER SEQUENCE navigations_id_seq RESTART WITH 1; ALTER SEQUENCE navigations_id_seq RESTART WITH 1;
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0');
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '个人中心', 20, 'fa fa-suitcase', '~/Admin/Profiles', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '个人中心', 20, 'fa fa-suitcase', '~/Admin/Profiles', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 1, '保存显示名称', 10, 'fa fa-fa', 'saveDisplayName', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 2, '保存密码', 20, 'fa fa-fa', 'savePassword', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 3, '保存应用', 30, 'fa fa-fa', 'saveApp', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 4, '保存样式', 40, 'fa fa-fa', 'saveTheme', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 5, '保存头像', 50, 'fa fa-fa', 'saveIcon', '0', 2);
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '返回前台', 30, 'fa fa-hand-o-left', '~/Home/Index', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '返回前台', 30, 'fa fa-hand-o-left', '~/Home/Index', '0');
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '网站设置', 40, 'fa fa-fa', '~/Admin/Settings', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '网站设置', 40, 'fa fa-fa', '~/Admin/Settings', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 1, '保存系统名称', 10, 'fa fa-fa', 'saveTitle', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 2, '保存页脚设置', 20, 'fa fa-fa', 'saveFooter', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 3, '保存样式', 30, 'fa fa-fa', 'saveTheme', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 4, '清理缓存', 40, 'fa fa-fa', 'clearCache', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 5, '清理全部缓存', 50, 'fa fa-fa', 'clearAllCache', '0', 2);
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '菜单管理', 50, 'fa fa-dashboard', '~/Admin/Menus', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '菜单管理', 50, 'fa fa-dashboard', '~/Admin/Menus', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 1, '新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 2, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 3, '删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 4, '分配角色', 40, 'fa fa-fa', 'assignRole', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (0, '图标页面', 50, 'fa fa-fa', '~/Admin/IconView', '0', 1);
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '用户管理', 60, 'fa fa-user', '~/Admin/Users', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '用户管理', 60, 'fa fa-user', '~/Admin/Users', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 1, '新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 2, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 3, '删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 4, '分配部门', 40, 'fa fa-fa', 'assignGroup', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 5, '分配角色', 50, 'fa fa-fa', 'assignRole', '0', 2);
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '角色管理', 70, 'fa fa-sitemap', '~/Admin/Roles', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '角色管理', 70, 'fa fa-sitemap', '~/Admin/Roles', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 1, '新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 2, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 3, '删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 4, '分配用户', 40, 'fa fa-fa', 'assignUser', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 5, '分配部门', 50, 'fa fa-fa', 'assignGroup', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 6, '分配菜单', 60, 'fa fa-fa', 'assignMenu', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 7, '分配应用', 70, 'fa fa-fa', 'assignApp', '0', 2);
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '部门管理', 80, 'fa fa-bank', '~/Admin/Groups', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '部门管理', 80, 'fa fa-bank', '~/Admin/Groups', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 1, '新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 2, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 3, '删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 4, '分配用户', 40, 'fa fa-fa', 'assignUser', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 5, '分配角色', 50, 'fa fa-fa', 'assignRole', '0', 2);
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '字典表维护', 90, 'fa fa-book', '~/Admin/Dicts', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '字典表维护', 90, 'fa fa-book', '~/Admin/Dicts', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 1, '新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 2, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 3, '删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '站内消息', 100, 'fa fa-envelope', '~/Admin/Messages', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '站内消息', 100, 'fa fa-envelope', '~/Admin/Messages', '0');
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '任务管理', 110, 'fa fa fa-tasks', '~/Admin/Tasks', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '任务管理', 110, 'fa fa fa-tasks', '~/Admin/Tasks', '0');
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '通知管理', 120, 'fa fa-bell', '~/Admin/Notifications', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '通知管理', 120, 'fa fa-bell', '~/Admin/Notifications', '0');
@ -59,6 +94,7 @@ INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (c
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (currval('navigations_id_seq') - 3, 0, '访问日志', 30, 'fa fa-bars', '~/Admin/Traces', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (currval('navigations_id_seq') - 3, 0, '访问日志', 30, 'fa fa-bars', '~/Admin/Traces', '0');
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '在线用户', 140, 'fa fa-users', '~/Admin/Online', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '在线用户', 140, 'fa fa-users', '~/Admin/Online', '0');
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '程序异常', 150, 'fa fa-cubes', '~/Admin/Exceptions', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '程序异常', 150, 'fa fa-cubes', '~/Admin/Exceptions', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 1, '服务器日志', 10, 'fa fa-fa', 'log', '0', 2);
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '工具集合', 160, 'fa fa-gavel', '#', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '工具集合', 160, 'fa fa-gavel', '#', '0');
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (currval('navigations_id_seq') - 1, '客户端测试', 10, 'fa fa-wrench', '~/Admin/Mobile', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (currval('navigations_id_seq') - 1, '客户端测试', 10, 'fa fa-wrench', '~/Admin/Mobile', '0');
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (currval('navigations_id_seq') - 2, 'API文档', 10, 'fa fa-wrench', '~/swagger', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (currval('navigations_id_seq') - 2, 'API文档', 10, 'fa fa-wrench', '~/swagger', '0');
@ -84,15 +120,6 @@ INSERT INTO UserRole (UserID, RoleID) VALUES (1, 1);
INSERT INTO UserRole (UserID, RoleID) VALUES (1, 2); INSERT INTO UserRole (UserID, RoleID) VALUES (1, 2);
DELETE FROM NavigationRole; DELETE FROM NavigationRole;
INSERT INTO NavigationRole (NavigationID, RoleID) SELECT ID, 1 FROM navigations;
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (1, 2);
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (2, 2);
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (3, 2);
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (10, 2);
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (16, 2);
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (17, 2);
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (18, 2);
INSERT INTO NavigationRole (NavigationID, RoleID) VALUES (19, 2);
-- Client Data -- Client Data
Delete From Dicts Where Category = '应用程序' and Code = '2'; Delete From Dicts Where Category = '应用程序' and Code = '2';

View File

@ -40,13 +40,48 @@ INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置
DELETE FROM Navigations; DELETE FROM Navigations;
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '个人中心', 20, 'fa fa-suitcase', '~/Admin/Profiles', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '个人中心', 20, 'fa fa-suitcase', '~/Admin/Profiles', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid(), '保存显示名称', 10, 'fa fa-fa', 'saveDisplayName', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 1, '保存密码', 20, 'fa fa-fa', 'savePassword', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 2, '保存应用', 30, 'fa fa-fa', 'saveApp', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 3, '保存样式', 40, 'fa fa-fa', 'saveTheme', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 4, '保存头像', 50, 'fa fa-fa', 'saveIcon', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '返回前台', 30, 'fa fa-hand-o-left', '~/Home/Index', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '返回前台', 30, 'fa fa-hand-o-left', '~/Home/Index', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '网站设置', 40, 'fa fa-fa', '~/Admin/Settings', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '网站设置', 40, 'fa fa-fa', '~/Admin/Settings', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid(), '保存系统名称', 10, 'fa fa-fa', 'saveTitle', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 1, '保存页脚设置', 20, 'fa fa-fa', 'saveFooter', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 2, '保存样式', 30, 'fa fa-fa', 'saveTheme', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 3, '清理缓存', 40, 'fa fa-fa', 'clearCache', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 4, '清理全部缓存', 50, 'fa fa-fa', 'clearAllCache', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '菜单管理', 50, 'fa fa-dashboard', '~/Admin/Menus', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '菜单管理', 50, 'fa fa-dashboard', '~/Admin/Menus', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid(), '新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 1, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 2, '删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 3, '分配角色', 40, 'fa fa-fa', 'assignRole', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (0, '图标页面', 50, 'fa fa-fa', '~/Admin/IconView', '0', 1);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '用户管理', 60, 'fa fa-user', '~/Admin/Users', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '用户管理', 60, 'fa fa-user', '~/Admin/Users', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid(), '新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 1, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 2, '删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 3, '分配部门', 40, 'fa fa-fa', 'assignGroup', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 4, '分配角色', 50, 'fa fa-fa', 'assignRole', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '角色管理', 70, 'fa fa-sitemap', '~/Admin/Roles', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '角色管理', 70, 'fa fa-sitemap', '~/Admin/Roles', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid(), '新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 1, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 2, '删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 3, '分配用户', 40, 'fa fa-fa', 'assignUser', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 4, '分配部门', 50, 'fa fa-fa', 'assignGroup', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 5, '分配菜单', 60, 'fa fa-fa', 'assignMenu', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 6, '分配应用', 70, 'fa fa-fa', 'assignApp', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '部门管理', 80, 'fa fa-bank', '~/Admin/Groups', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '部门管理', 80, 'fa fa-bank', '~/Admin/Groups', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid(), '新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 1, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 2, '删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 3, '分配用户', 40, 'fa fa-fa', 'assignUser', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 4, '分配角色', 50, 'fa fa-fa', 'assignRole', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '字典表维护', 90, 'fa fa-book', '~/Admin/Dicts', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '字典表维护', 90, 'fa fa-book', '~/Admin/Dicts', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid(), '新增', 10, 'fa fa-fa', 'add', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 1, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 2, '删除', 30, 'fa fa-fa', 'del', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '站内消息', 100, 'fa fa-envelope', '~/Admin/Messages', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '站内消息', 100, 'fa fa-envelope', '~/Admin/Messages', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '任务管理', 110, 'fa fa fa-tasks', '~/Admin/Tasks', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '任务管理', 110, 'fa fa fa-tasks', '~/Admin/Tasks', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '通知管理', 120, 'fa fa-bell', '~/Admin/Notifications', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '通知管理', 120, 'fa fa-bell', '~/Admin/Notifications', '0');
@ -56,10 +91,11 @@ INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (last_insert_rowid() - 2, '访问日志', 30, 'fa fa-bars', '~/Admin/Traces', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (last_insert_rowid() - 2, '访问日志', 30, 'fa fa-bars', '~/Admin/Traces', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '在线用户', 140, 'fa fa-users', '~/Admin/Online', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '在线用户', 140, 'fa fa-users', '~/Admin/Online', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '程序异常', 150, 'fa fa-cubes', '~/Admin/Exceptions', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '程序异常', 150, 'fa fa-cubes', '~/Admin/Exceptions', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid(), '服务器日志', 10, 'fa fa-fa', 'log', '0', 2);
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '工具集合', 160, 'fa fa-gavel', '#', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '工具集合', 160, 'fa fa-gavel', '#', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (last_insert_rowid(), '客户端测试', 10, 'fa fa-wrench', '~/Admin/Mobile', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (last_insert_rowid(), '客户端测试', 10, 'fa fa-wrench', '~/Admin/Mobile', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (last_insert_rowid() - 1, 'API文档', 10, 'fa fa-wrench', '~/swagger', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (last_insert_rowid() - 1, 'API文档', 20, 'fa fa-wrench', '~/swagger', '0');
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (last_insert_rowid() - 2, '图标集', 10, 'fa fa-dashboard', '~/Admin/FAIcon', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (last_insert_rowid() - 2, '图标集', 30, 'fa fa-dashboard', '~/Admin/FAIcon', '0');
DELETE FROM GROUPS WHERE ID = 1; DELETE FROM GROUPS WHERE ID = 1;
INSERT INTO [Groups] ([ID], [GroupName], [Description]) VALUES (1, 'Admin', '系统默认组'); INSERT INTO [Groups] ([ID], [GroupName], [Description]) VALUES (1, 'Admin', '系统默认组');
@ -79,15 +115,6 @@ INSERT INTO [UserRole] ([UserID], [RoleID]) VALUES (1, 1);
INSERT INTO [UserRole] ([UserID], [RoleID]) VALUES (1, 2); INSERT INTO [UserRole] ([UserID], [RoleID]) VALUES (1, 2);
DELETE FROM NavigationRole; DELETE FROM NavigationRole;
INSERT INTO NavigationRole SELECT NULL, ID, 1 FROM navigations;
INSERT INTO [NavigationRole] ([NavigationID], [RoleID]) VALUES (1, 2);
INSERT INTO [NavigationRole] ([NavigationID], [RoleID]) VALUES (2, 2);
INSERT INTO [NavigationRole] ([NavigationID], [RoleID]) VALUES (3, 2);
INSERT INTO [NavigationRole] ([NavigationID], [RoleID]) VALUES (10, 2);
INSERT INTO [NavigationRole] ([NavigationID], [RoleID]) VALUES (16, 2);
INSERT INTO [NavigationRole] ([NavigationID], [RoleID]) VALUES (17, 2);
INSERT INTO [NavigationRole] ([NavigationID], [RoleID]) VALUES (18, 2);
INSERT INTO [NavigationRole] ([NavigationID], [RoleID]) VALUES (19, 2);
-- Client Data -- Client Data
Delete From [Dicts] Where Category = '应用程序' and Code = 2; Delete From [Dicts] Where Category = '应用程序' and Code = 2;

View File

@ -10,19 +10,11 @@ namespace Bootstrap.Admin.Api
public AppsTest(BAWebHost factory) : base(factory, "api/Apps") { } public AppsTest(BAWebHost factory) : base(factory, "api/Apps") { }
[Fact] [Fact]
public async void Post_Ok() public async void Get_Ok()
{ {
var rid = new Role().Retrieves().Where(r => r.RoleName == "Administrators").First().Id; var rid = new Role().Retrieves().Where(r => r.RoleName == "Administrators").First().Id;
var cates = await Client.PostAsJsonAsync<string, IEnumerable<App>>(rid, string.Empty); var cates = await Client.GetAsJsonAsync<IEnumerable<App>>(rid);
Assert.NotEmpty(cates); Assert.NotEmpty(cates);
} }
[Fact]
public async void Put_Ok()
{
var rid = new Role().Retrieves().Where(r => r.RoleName == "Administrators").First().Id;
var ret = await Client.PutAsJsonAsync<IEnumerable<string>, bool>(rid, new string[] { "1", "2" });
Assert.True(ret);
}
} }
} }

View File

@ -0,0 +1,10 @@
using Xunit;
namespace Bootstrap.Admin.Api.MySql
{
[Collection("MySqlContext")]
public class ProfilesTest : Api.ProfilesTest
{
public ProfilesTest(MySqlBAWebHost factory) : base(factory) { }
}
}

View File

@ -9,14 +9,14 @@ namespace Bootstrap.Admin.Api
public OnlineTest(BAWebHost factory) : base(factory, "api/OnlineUsers") { } public OnlineTest(BAWebHost factory) : base(factory, "api/OnlineUsers") { }
[Fact] [Fact]
public async void Post_Ok() public async void Get_Ok()
{ {
var users = await Client.PostAsJsonAsync<string, IEnumerable<OnlineUser>>(string.Empty); var users = await Client.GetAsJsonAsync<IEnumerable<OnlineUser>>();
Assert.Single(users); Assert.Single(users);
} }
[Fact] [Fact]
public async void Get_Ok() public async void GetById_Ok()
{ {
var urls = await Client.GetAsJsonAsync<IEnumerable<KeyValuePair<DateTime, string>>>("UnitTest"); var urls = await Client.GetAsJsonAsync<IEnumerable<KeyValuePair<DateTime, string>>>("UnitTest");
Assert.Empty(urls); Assert.Empty(urls);

View File

@ -0,0 +1,50 @@
using Bootstrap.DataAccess;
using System;
using System.Linq;
using Xunit;
namespace Bootstrap.Admin.Api
{
public class ProfilesTest : ControllerTest
{
public ProfilesTest(BAWebHost factory) : base(factory, "api/Profiles") { }
[Fact]
public async void Put_Ok()
{
var usr = new User { UserName = "UnitTest_Change", Password = "1", DisplayName = "DisplayName", ApprovedBy = "System", ApprovedTime = DateTime.Now, Description = "Desc", Icon = "default.jpg", Css = "blue.css" };
usr.Delete(usr.Retrieves().Where(u => u.UserName == usr.UserName).Select(u => u.Id));
Assert.True(usr.Save(usr));
// change theme
usr.UserStatus = UserStates.ChangeTheme;
var resp = await Client.PutAsJsonAsync<User, bool>(usr);
Assert.True(resp);
// Login as new user
var client = Host.CreateClient();
await client.LoginAsync("UnitTest_Change", "1");
// change password
usr.UserStatus = UserStates.ChangePassword;
usr.NewPassword = "1";
usr.Password = "1";
resp = await client.PutAsJsonAsync<User, bool>("/api/Profiles", usr);
Assert.True(resp);
// change displayname
usr.UserStatus = UserStates.ChangeDisplayName;
resp = await client.PutAsJsonAsync<User, bool>("/api/Profiles", usr);
Assert.True(resp);
// change app
usr.App = "UnitTest";
usr.UserStatus = UserStates.SaveApp;
resp = await client.PutAsJsonAsync<User, bool>("/api/Profiles", usr);
Assert.True(resp);
// delete
usr.Delete(usr.Retrieves().Where(u => u.UserName == usr.UserName).Select(u => u.Id));
}
}
}

View File

@ -62,6 +62,9 @@ namespace Bootstrap.Admin.Api
ret = await Client.PutAsJsonAsync<IEnumerable<string>, bool>($"{mid}?type=menu", ids); ret = await Client.PutAsJsonAsync<IEnumerable<string>, bool>($"{mid}?type=menu", ids);
Assert.True(ret); Assert.True(ret);
ret = await Client.PutAsJsonAsync<IEnumerable<string>, bool>($"{mid}?type=app", ids);
Assert.True(ret);
} }
} }
} }

View File

@ -0,0 +1,10 @@
using Xunit;
namespace Bootstrap.Admin.Api.SQLite
{
[Collection("SQLiteContext")]
public class ProfilesTest : Api.ProfilesTest
{
public ProfilesTest(SQLiteBAWebHost factory) : base(factory) { }
}
}

View File

@ -76,51 +76,5 @@ namespace Bootstrap.Admin.Api
ret = await Client.PutAsJsonAsync<IEnumerable<string>, bool>($"{rid}?type=role", ids); ret = await Client.PutAsJsonAsync<IEnumerable<string>, bool>($"{rid}?type=role", ids);
Assert.True(ret); Assert.True(ret);
} }
[Fact]
public async void Put_Ok()
{
var usr = new User { UserName = "UnitTest_Change", Password = "1", DisplayName = "DisplayName", ApprovedBy = "System", ApprovedTime = DateTime.Now, Description = "Desc", Icon = "default.jpg" };
usr.Delete(usr.Retrieves().Where(u => u.UserName == usr.UserName).Select(u => u.Id));
Assert.True(usr.Save(usr));
// Add author
DbManager.Create().Execute("delete from NavigationRole where RoleID in (select ID from Roles where RoleName = 'Default')");
var rid = DbManager.Create().ExecuteScalar<string>("select ID from Roles where RoleName = 'Default'");
DbManager.Create().InsertBatch("NavigationRole", new Menu().RetrieveAllMenus("Admin").Select(m => new { RoleID = rid, NavigationID = m.Id }));
// change theme
usr.UserStatus = UserStates.ChangeTheme;
var resp = await Client.PutAsJsonAsync<User, bool>(usr);
Assert.False(resp);
// Login as new user
var client = Host.CreateClient();
client.BaseAddress = new Uri("http://localhost/api/Users");
await client.LoginAsync("UnitTest_Change", "1");
resp = await client.PutAsJsonAsync<User, bool>(usr);
Assert.True(resp);
// change password
usr.UserStatus = UserStates.ChangePassword;
usr.NewPassword = "1";
usr.Password = "1";
resp = await client.PutAsJsonAsync<User, bool>(usr);
Assert.True(resp);
// change displayname
usr.UserStatus = UserStates.ChangeDisplayName;
resp = await client.PutAsJsonAsync<User, bool>(usr);
Assert.True(resp);
// change app
usr.App = "UnitTest";
usr.UserStatus = UserStates.SaveApp;
resp = await client.PutAsJsonAsync<User, bool>(usr);
Assert.True(resp);
// delete
usr.Delete(usr.Retrieves().Where(u => u.UserName == usr.UserName).Select(u => u.Id));
}
} }
} }

Binary file not shown.