Merge branch 'sqlsugar-dev' into sqlsugar
@@ -6,7 +6,7 @@
|
||||
<members>
|
||||
<member name="T:Yi.Framework.ApiMicroservice.Controllers.AccountController">
|
||||
<summary>
|
||||
账户控制器
|
||||
账户管理
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.Framework.ApiMicroservice.Controllers.BaseCrudController`1">
|
||||
@@ -68,6 +68,29 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.Framework.ApiMicroservice.Controllers.MenuController">
|
||||
<summary>
|
||||
菜单管理
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.GetMenuTree">
|
||||
<summary>
|
||||
得到树形菜单
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.Framework.ApiMicroservice.Controllers.RoleController">
|
||||
<summary>
|
||||
角色管理
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.GiveRoleSetMenu(Yi.Framework.DTOModel.GiveRoleSetMenuDto)">
|
||||
<summary>
|
||||
给多用户设置多角色
|
||||
</summary>
|
||||
<param name="giveRoleSetMenuDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.Framework.ApiMicroservice.Controllers.TestController">
|
||||
<summary>
|
||||
测试控制器
|
||||
@@ -127,5 +150,30 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.Framework.ApiMicroservice.Controllers.UserController">
|
||||
<summary>
|
||||
用户管理
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.Add(Yi.Framework.Model.Models.UserEntity)">
|
||||
<summary>
|
||||
添加用户,去重,密码加密
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GiveUserSetRole(Yi.Framework.DTOModel.GiveUserSetRoleDto)">
|
||||
<summary>
|
||||
给多用户设置多角色
|
||||
</summary>
|
||||
<param name="giveUserSetRoleDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GetRoleListByUserId(System.Int64)">
|
||||
<summary>
|
||||
通过用户id得到角色列表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
@@ -18,7 +18,7 @@ using Yi.Framework.WebCore.AuthorizationPolicy;
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 账户控制器
|
||||
/// 账户管理
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/[controller]/[action]")]
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
/// <returns></returns>
|
||||
[Permission($"{nameof(T)}:get:one")]
|
||||
[HttpGet]
|
||||
public async Task<Result> GetById(long id)
|
||||
public virtual async Task<Result> GetById(long id)
|
||||
{
|
||||
return Result.Success().SetData(await _repository.GetByIdAsync(id));
|
||||
}
|
||||
@@ -45,7 +45,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
/// <returns></returns>
|
||||
[Permission($"{nameof(T)}:get:list")]
|
||||
[HttpPost]
|
||||
public async Task<Result> GetList(QueryCondition queryCondition)
|
||||
public virtual async Task<Result> GetList(QueryCondition queryCondition)
|
||||
{
|
||||
return Result.Success().SetData(await _repository.GetListAsync(queryCondition));
|
||||
}
|
||||
@@ -57,7 +57,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
/// <returns></returns>
|
||||
[Permission($"{nameof(T)}:get:page")]
|
||||
[HttpPost]
|
||||
public async Task<Result> PageList(QueryPageCondition queryCondition)
|
||||
public virtual async Task<Result> PageList(QueryPageCondition queryCondition)
|
||||
{
|
||||
return Result.Success().SetData(await _repository.CommonPageAsync(queryCondition));
|
||||
}
|
||||
@@ -69,7 +69,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
/// <returns></returns>
|
||||
[Permission($"{nameof(T)}:add")]
|
||||
[HttpPost]
|
||||
public async Task<Result> Add(T entity)
|
||||
public virtual async Task<Result> Add(T entity)
|
||||
{
|
||||
return Result.Success().SetData(await _repository.InsertReturnSnowflakeIdAsync(entity));
|
||||
}
|
||||
@@ -81,7 +81,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
/// <returns></returns>
|
||||
[Permission($"{nameof(T)}:update")]
|
||||
[HttpPut]
|
||||
public async Task<Result> Update(T entity)
|
||||
public virtual async Task<Result> Update(T entity)
|
||||
{
|
||||
return Result.Success().SetStatus(await _repository.UpdateIgnoreNullAsync(entity));
|
||||
}
|
||||
@@ -93,7 +93,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
/// <returns></returns>
|
||||
[Permission($"{nameof(T)}:delete:list")]
|
||||
[HttpDelete]
|
||||
public async Task<Result> DeleteList(List<long> ids)
|
||||
public virtual async Task<Result> DeleteList(List<long> ids)
|
||||
{
|
||||
return Result.Success().SetStatus(await _repository.DeleteByLogicAsync(ids));
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@ using Yi.Framework.WebCore.AuthorizationPolicy;
|
||||
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 菜单管理
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/[controller]/[action]")]
|
||||
public class MenuController : BaseCrudController<MenuEntity>
|
||||
@@ -24,5 +27,16 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
_iMenuService = iMenuService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 得到树形菜单
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
//暂未制作逻辑删除与多租户的过滤
|
||||
public async Task<List<MenuEntity>> GetMenuTree()
|
||||
{
|
||||
return await _iMenuService.GetMenuTreeAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DTOModel;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
using Yi.Framework.Repository;
|
||||
@@ -15,6 +16,9 @@ using Yi.Framework.WebCore.AuthorizationPolicy;
|
||||
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色管理
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/[controller]/[action]")]
|
||||
public class RoleController : BaseCrudController<RoleEntity>
|
||||
@@ -24,5 +28,18 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
_iRoleService = iRoleService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给多用户设置多角色
|
||||
/// </summary>
|
||||
/// <param name="giveRoleSetMenuDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
public async Task<Result> GiveRoleSetMenu(GiveRoleSetMenuDto giveRoleSetMenuDto)
|
||||
{
|
||||
return Result.Success().SetStatus(await _iRoleService.GiveRoleSetMenu(giveRoleSetMenuDto.RoleIds, giveRoleSetMenuDto.MenuIds));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DTOModel;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
using Yi.Framework.Repository;
|
||||
@@ -15,6 +16,9 @@ using Yi.Framework.WebCore.AuthorizationPolicy;
|
||||
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户管理
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/[controller]/[action]")]
|
||||
public class UserController : BaseCrudController<UserEntity>
|
||||
@@ -24,5 +28,44 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
_iUserService = iUserService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加用户,去重,密码加密
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[Permission($"{nameof(UserEntity)}:add")]
|
||||
[HttpPost]
|
||||
public override async Task<Result> Add(UserEntity entity)
|
||||
{
|
||||
if (!await _iUserService.Exist(entity.UserName))
|
||||
{
|
||||
entity.BuildPassword();
|
||||
return Result.Success().SetData(await _iUserService._repository.InsertReturnSnowflakeIdAsync(entity));
|
||||
}
|
||||
return Result.SuccessError("用户已存在");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给多用户设置多角色
|
||||
/// </summary>
|
||||
/// <param name="giveUserSetRoleDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
public async Task<Result> GiveUserSetRole(GiveUserSetRoleDto giveUserSetRoleDto)
|
||||
{
|
||||
return Result.Success().SetStatus(await _iUserService.GiveUserSetRole(giveUserSetRoleDto.UserIds, giveUserSetRoleDto.RoleIds));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 通过用户id得到角色列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> GetRoleListByUserId(long userId)
|
||||
{
|
||||
return Result.Success().SetData(await _iUserService.GetRoleListByUserId(userId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.DTOModel
|
||||
{
|
||||
public class GiveRoleSetMenuDto
|
||||
{
|
||||
public List<long> RoleIds { get; set; }
|
||||
public List<long> MenuIds { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.DTOModel
|
||||
{
|
||||
public class GiveUserSetRoleDto
|
||||
{
|
||||
public List<long> UserIds { get; set; }
|
||||
public List<long> RoleIds { get; set;}
|
||||
}
|
||||
}
|
||||
12
Yi.Framework.Net6/Yi.Framework.Interface/IMenuService.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Models;
|
||||
using Yi.Framework.Repository;
|
||||
|
||||
namespace Yi.Framework.Interface
|
||||
{
|
||||
public partial interface IMenuService:IBaseService<MenuEntity>
|
||||
{
|
||||
Task<List<MenuEntity>> GetMenuTreeAsync();
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,14 @@ namespace Yi.Framework.Interface
|
||||
/// DbTest
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<List<RoleEntity>> DbTest();
|
||||
Task<List<RoleEntity>> DbTest();
|
||||
|
||||
/// <summary>
|
||||
/// 给角色设置菜单,多角色,多菜单
|
||||
/// </summary>
|
||||
/// <param name="roleIds"></param>
|
||||
/// <param name="menuIds"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> GiveRoleSetMenu(List<long> roleIds, List<long> menuIds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using Yi.Framework.Model.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Models;
|
||||
using Yi.Framework.Repository;
|
||||
|
||||
namespace Yi.Framework.Interface
|
||||
{
|
||||
public partial interface IMenuService:IBaseService<MenuEntity>
|
||||
{
|
||||
public partial interface IMenuService : IBaseService<MenuEntity>
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Yi.Framework.Interface
|
||||
/// 测试仓储的上下文对象
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<List<UserEntity>> DbTest();
|
||||
Task<List<UserEntity>> DbTest();
|
||||
|
||||
/// <summary>
|
||||
/// 登录方法
|
||||
@@ -21,7 +21,7 @@ namespace Yi.Framework.Interface
|
||||
/// <param name="password"></param>
|
||||
/// <param name="userAction"></param>
|
||||
/// <returns></returns>
|
||||
public Task<bool> Login(string userName, string password, Action<UserEntity> userAction = null);
|
||||
Task<bool> Login(string userName, string password, Action<UserEntity> userAction = null);
|
||||
|
||||
/// <summary>
|
||||
/// 注册方法
|
||||
@@ -29,13 +29,35 @@ namespace Yi.Framework.Interface
|
||||
/// <param name="userEntity"></param>
|
||||
/// <param name="userAction"></param>
|
||||
/// <returns></returns>
|
||||
public Task<bool> Register(UserEntity userEntity, Action<UserEntity> userAction = null);
|
||||
|
||||
Task<bool> Register(UserEntity userEntity, Action<UserEntity> userAction = null);
|
||||
|
||||
/// <summary>
|
||||
/// 导航属性关联角色
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<List<UserEntity>> GetListInRole();
|
||||
Task<List<UserEntity>> GetListInRole();
|
||||
|
||||
/// <summary>
|
||||
/// 给用户设置角色,多用户,多角色
|
||||
/// </summary>
|
||||
/// <param name="userIds"></param>
|
||||
/// <param name="roleIds"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> GiveUserSetRole(List<long> userIds, List<long> roleIds);
|
||||
|
||||
/// <summary>
|
||||
/// 判断用户名是否存在,如果存在可返回该用户
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <param name="userAction"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> Exist(string userName, Action<UserEntity> userAction = null);
|
||||
|
||||
/// <summary>
|
||||
/// 通过用户id得到角色列表
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<RoleEntity>> GetRoleListByUserId(long userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@ namespace Yi.Framework.Model.Models
|
||||
public partial class MenuEntity
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsIgnore = true)]
|
||||
public List<MenuEntity> Childs { get; set; }
|
||||
public List<MenuEntity> Children { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
namespace Yi.Framework.Model.Models
|
||||
{
|
||||
@@ -15,10 +16,8 @@ namespace Yi.Framework.Model.Models
|
||||
this.IsDeleted = false;
|
||||
this.CreateTime = DateTime.Now;
|
||||
}
|
||||
/// <summary>
|
||||
/// 1
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
namespace Yi.Framework.Model.Models
|
||||
{
|
||||
@@ -15,10 +16,8 @@ namespace Yi.Framework.Model.Models
|
||||
this.IsDeleted = false;
|
||||
this.CreateTime = DateTime.Now;
|
||||
}
|
||||
/// <summary>
|
||||
/// 1
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
namespace Yi.Framework.Model.Models
|
||||
{
|
||||
@@ -15,10 +16,8 @@ namespace Yi.Framework.Model.Models
|
||||
this.IsDeleted = false;
|
||||
this.CreateTime = DateTime.Now;
|
||||
}
|
||||
/// <summary>
|
||||
/// 1
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
namespace Yi.Framework.Model.Models
|
||||
{
|
||||
@@ -15,10 +16,8 @@ namespace Yi.Framework.Model.Models
|
||||
this.IsDeleted = false;
|
||||
this.CreateTime = DateTime.Now;
|
||||
}
|
||||
/// <summary>
|
||||
/// 1
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
namespace Yi.Framework.Model.Models
|
||||
{
|
||||
@@ -15,10 +16,10 @@ namespace Yi.Framework.Model.Models
|
||||
this.IsDeleted = false;
|
||||
this.CreateTime = DateTime.Now;
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||
|
||||
|
||||
[Newtonsoft.Json.JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
@@ -75,5 +76,35 @@ namespace Yi.Framework.Model.Models
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="Salt" )]
|
||||
public string Salt { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="Icon" )]
|
||||
public long? Icon { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="Nick" )]
|
||||
public string Nick { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="Email" )]
|
||||
public string Email { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="Ip" )]
|
||||
public string Ip { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="Address" )]
|
||||
public string Address { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="Phone" )]
|
||||
public string Phone { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
namespace Yi.Framework.Model.Models
|
||||
{
|
||||
@@ -15,10 +16,8 @@ namespace Yi.Framework.Model.Models
|
||||
this.IsDeleted = false;
|
||||
this.CreateTime = DateTime.Now;
|
||||
}
|
||||
/// <summary>
|
||||
/// 1
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
14
Yi.Framework.Net6/Yi.Framework.Model/RoleEntity.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
namespace Yi.Framework.Model.Models
|
||||
{
|
||||
|
||||
public partial class RoleEntity
|
||||
{
|
||||
//[Navigate(typeof(UserRoleEntity), nameof(UserRoleEntity.RoleId), nameof(UserRoleEntity.UserId))]
|
||||
//public List<UserEntity> Users { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,21 @@ namespace Yi.Framework.Model.Models
|
||||
/// 看好啦!ORM精髓,导航属性
|
||||
///</summary>
|
||||
[Navigate(typeof(UserRoleEntity), nameof(UserRoleEntity.UserId), nameof(UserRoleEntity.RoleId))]
|
||||
public List<RoleEntity> Roles { get; set; }
|
||||
public List<RoleEntity> Roles { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 构建密码,MD5盐值加密
|
||||
/// </summary>
|
||||
public void BuildPassword(string password = null)
|
||||
{
|
||||
//如果不传值,那就把自己的password当作传进来的password
|
||||
if (password == null)
|
||||
{
|
||||
password = this.Password;
|
||||
}
|
||||
this.Salt = Common.Helper.MD5Helper.GenerateSalt();
|
||||
this.Password = Common.Helper.MD5Helper.SHA2Encode(password, this.Salt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
19
Yi.Framework.Net6/Yi.Framework.Service/MenuService.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using SqlSugar;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
using Yi.Framework.Repository;
|
||||
|
||||
namespace Yi.Framework.Service
|
||||
{
|
||||
public partial class MenuService : BaseService<MenuEntity>, IMenuService
|
||||
{
|
||||
public async Task<List<MenuEntity>> GetMenuTreeAsync()
|
||||
{
|
||||
//ParentId 0,代表为根目录,只能存在一个
|
||||
//复杂查询直接使用db代理
|
||||
return await _repository._Db.Queryable<MenuEntity>().ToTreeAsync(it=>it.Children,it=>it.ParentId,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,5 +13,34 @@ namespace Yi.Framework.Service
|
||||
{
|
||||
return await _repository._Db.Queryable<RoleEntity>().ToListAsync();
|
||||
}
|
||||
public async Task<bool> GiveRoleSetMenu(List<long> roleIds, List<long> menuIds)
|
||||
{
|
||||
var _repositoryRoleMenu = _repository.ChangeRepository<Repository<RoleMenuEntity>>();
|
||||
|
||||
//多次操作,需要事务确保原子性
|
||||
return await _repositoryRoleMenu.UseTranAsync(async () =>
|
||||
{
|
||||
|
||||
//遍历用户
|
||||
foreach (var roleId in roleIds)
|
||||
{
|
||||
//删除用户之前所有的用户角色关系(物理删除,没有恢复的必要)
|
||||
await _repositoryRoleMenu.DeleteAsync(u => u.RoleId==roleId);
|
||||
|
||||
//添加新的关系
|
||||
List<RoleMenuEntity> roleMenuEntity = new();
|
||||
foreach (var menu in menuIds)
|
||||
{
|
||||
roleMenuEntity.Add(new RoleMenuEntity() { RoleId = roleId,MenuId=menu });
|
||||
}
|
||||
|
||||
//一次性批量添加
|
||||
await _repositoryRoleMenu.InsertRangeAsync(roleMenuEntity);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Yi.Framework.Service
|
||||
{
|
||||
return await _repository._Db.Queryable<UserEntity>().ToListAsync();
|
||||
}
|
||||
public async Task<bool> Exist(Guid id, Action<UserEntity> userAction = null)
|
||||
public async Task<bool> Exist(long id, Action<UserEntity> userAction = null)
|
||||
{
|
||||
var user = await _repository.GetByIdAsync(id);
|
||||
userAction.Invoke(user);
|
||||
@@ -27,7 +27,7 @@ namespace Yi.Framework.Service
|
||||
}
|
||||
public async Task<bool> Exist(string userName, Action<UserEntity> userAction = null)
|
||||
{
|
||||
var user = await _repository.GetFirstAsync(u=>u.UserName== userName);
|
||||
var user = await _repository.GetFirstAsync(u => u.UserName == userName);
|
||||
if (userAction != null)
|
||||
{
|
||||
userAction.Invoke(user);
|
||||
@@ -38,18 +38,18 @@ namespace Yi.Framework.Service
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public async Task<bool> Login(string userName, string password,Action<UserEntity> userAction = null)
|
||||
public async Task<bool> Login(string userName, string password, Action<UserEntity> userAction = null)
|
||||
{
|
||||
var user=new UserEntity();
|
||||
var user = new UserEntity();
|
||||
if (await Exist(userName, o => user = o))
|
||||
{
|
||||
userAction.Invoke(user);
|
||||
if (user.Password== Common.Helper.MD5Helper.SHA2Encode(password, user.Salt))
|
||||
if (user.Password == Common.Helper.MD5Helper.SHA2Encode(password, user.Salt))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
public async Task<bool> Register(UserEntity userEntity, Action<UserEntity> userAction = null)
|
||||
@@ -57,9 +57,8 @@ namespace Yi.Framework.Service
|
||||
var user = new UserEntity();
|
||||
if (!await Exist(userEntity.UserName))
|
||||
{
|
||||
user.UserName= userEntity.UserName;
|
||||
user.Salt = Common.Helper.MD5Helper.GenerateSalt();
|
||||
user.Password = Common.Helper.MD5Helper.SHA2Encode(userEntity.Password,user.Salt);
|
||||
user.UserName = userEntity.UserName;
|
||||
user.BuildPassword();
|
||||
userAction.Invoke(await _repository.InsertReturnEntityAsync(user));
|
||||
return true;
|
||||
}
|
||||
@@ -69,7 +68,39 @@ namespace Yi.Framework.Service
|
||||
public async Task<List<UserEntity>> GetListInRole()
|
||||
{
|
||||
return await _repository._Db.Queryable<UserEntity>().Includes(u => u.Roles).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> GiveUserSetRole(List<long> userIds, List<long> roleIds)
|
||||
{
|
||||
var _repositoryUserRole = _repository.ChangeRepository<Repository<UserRoleEntity>>();
|
||||
|
||||
//多次操作,需要事务确保原子性
|
||||
return await _repositoryUserRole.UseTranAsync(async () =>
|
||||
{
|
||||
|
||||
//遍历用户
|
||||
foreach (var userId in userIds)
|
||||
{
|
||||
//删除用户之前所有的用户角色关系(物理删除,没有恢复的必要)
|
||||
await _repositoryUserRole.DeleteAsync(u => u.UserId == userId);
|
||||
|
||||
//添加新的关系
|
||||
List<UserRoleEntity> userRoleEntities = new();
|
||||
foreach (var roleId in roleIds)
|
||||
{
|
||||
userRoleEntities.Add(new UserRoleEntity() { UserId = userId, RoleId = roleId });
|
||||
}
|
||||
|
||||
//一次性批量添加
|
||||
await _repositoryUserRole.InsertRangeAsync(userRoleEntities);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<RoleEntity>> GetRoleListByUserId(long userId)
|
||||
{
|
||||
return (await _repository._Db.Queryable<UserEntity>().Includes(u => u.Roles).InSingleAsync(userId)).Roles;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -15,6 +17,8 @@ namespace Yi.Framework.WebCore.BuilderExtend
|
||||
{
|
||||
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
|
||||
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm";
|
||||
|
||||
//options.SerializerSettings.Converters.Add(new ValueToStringConverter());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
3
Yi.Vue2.x/.browserslistrc
Normal file
@@ -0,0 +1,3 @@
|
||||
> 1%
|
||||
last 2 versions
|
||||
not dead
|
||||
4
Yi.Vue2.x/.env.development
Normal file
@@ -0,0 +1,4 @@
|
||||
#接口服务地址
|
||||
VUE_APP_SERVICE_URL='http://localhost:19001/api'
|
||||
#开发环境路径前缀
|
||||
VUE_APP_BASE_API='/dev-apis'
|
||||
2
Yi.Vue2.x/.env.production
Normal file
@@ -0,0 +1,2 @@
|
||||
#生成环境路径前缀
|
||||
VUE_APP_BASE_API='/prod-apis'
|
||||
23
Yi.Vue2.x/.gitignore
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
19
Yi.Vue2.x/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# vuetify-test
|
||||
|
||||
## Project setup
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||
10212
Yi.Vue2.x/package-lock.json
generated
Normal file
30
Yi.Vue2.x/package.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "vuetify-test",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mdi/font": "^6.6.96",
|
||||
"axios": "^0.22.0",
|
||||
"json-bigint": "^1.0.0",
|
||||
"typeface-roboto": "^1.1.13",
|
||||
"vue": "^2.6.11",
|
||||
"vue-chartist": "^2.3.1",
|
||||
"vue-router": "^3.2.0",
|
||||
"vuetify": "^2.4.0",
|
||||
"vuetify-dialog": "^2.0.17",
|
||||
"vuex": "^3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-router": "~4.5.0",
|
||||
"@vue/cli-service": "~4.5.0",
|
||||
"sass": "~1.32.0",
|
||||
"sass-loader": "^10.0.0",
|
||||
"vue-cli-plugin-vuetify": "~2.4.2",
|
||||
"vue-template-compiler": "^2.6.11",
|
||||
"vuetify-loader": "^1.7.0"
|
||||
}
|
||||
}
|
||||
BIN
Yi.Vue2.x/public/favicon.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
20
Yi.Vue2.x/public/index.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title>Yi-Vue</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but Yi-Vue doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
|
||||
</html>
|
||||
23
Yi.Vue2.x/src/App.vue
Normal file
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<v-fade-transition mode="out-in">
|
||||
<router-view />
|
||||
</v-fade-transition>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Styles
|
||||
import '@/styles/overrides.sass'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
metaInfo: {
|
||||
title: 'App',
|
||||
titleTemplate: '%s | Material Dashboard Free',
|
||||
htmlAttrs: { lang: 'en' },
|
||||
meta: [
|
||||
{ charset: 'utf-8' },
|
||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
||||
],
|
||||
},
|
||||
}
|
||||
</script>
|
||||
46
Yi.Vue2.x/src/api/accountApi.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import myaxios from '@/util/myaxios'
|
||||
export default {
|
||||
login(username, password) {
|
||||
return myaxios({
|
||||
url: '/Account/login',
|
||||
method: 'post',
|
||||
data: {
|
||||
username,
|
||||
password
|
||||
}
|
||||
})
|
||||
},
|
||||
logout() {
|
||||
return myaxios({
|
||||
url: '/Account/logout',
|
||||
method: 'post',
|
||||
})
|
||||
},
|
||||
register(username, password, phone, code) {
|
||||
return myaxios({
|
||||
url: `/Account/register?code=${code}`,
|
||||
method: 'post',
|
||||
data: { username, password, phone }
|
||||
})
|
||||
},
|
||||
email(emailAddress) {
|
||||
return myaxios({
|
||||
url: `/Account/email?emailAddress=${emailAddress}`,
|
||||
method: 'post',
|
||||
})
|
||||
},
|
||||
SendSMS(smsAddress) {
|
||||
return myaxios({
|
||||
url: `/Account/SendSMS?SMSAddress=${smsAddress}`,
|
||||
method: 'post',
|
||||
})
|
||||
},
|
||||
changePassword(user, newPassword) {
|
||||
return myaxios({
|
||||
url: `/Account/changePassword`,
|
||||
method: 'put',
|
||||
data: { user, newPassword }
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
11
Yi.Vue2.x/src/api/fileApi.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import myaxios from '@/util/myaxios'
|
||||
export default {
|
||||
EditIcon(file) {
|
||||
return myaxios({
|
||||
url: '/File/EditIcon',
|
||||
method: 'post',
|
||||
headers: { "Content-Type": "multipart/form-data" },
|
||||
data: file
|
||||
})
|
||||
}
|
||||
}
|
||||
50
Yi.Vue2.x/src/api/menuApi.js
Normal file
@@ -0,0 +1,50 @@
|
||||
import myaxios from '@/util/myaxios'
|
||||
export default {
|
||||
GetMenuInMould() {
|
||||
return myaxios({
|
||||
url: '/Menu/GetMenuInMould',
|
||||
method: 'get'
|
||||
})
|
||||
},
|
||||
addChildrenMenu(id, data) {
|
||||
return myaxios({
|
||||
url: '/Menu/addChildrenMenu',
|
||||
method: 'post',
|
||||
data: { parentId: id, data }
|
||||
})
|
||||
},
|
||||
UpdateMenu(data) {
|
||||
return myaxios({
|
||||
url: '/Menu/UpdateMenu',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
},
|
||||
DelListMenu(ids) {
|
||||
return myaxios({
|
||||
url: '/Menu/DelListMenu',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
},
|
||||
AddTopMenu(data) {
|
||||
return myaxios({
|
||||
url: '/Menu/AddTopMenu',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
},
|
||||
SetMouldByMenu(menuId, mouldId) {
|
||||
return myaxios({
|
||||
url: '/Menu/SetMouldByMenu',
|
||||
method: 'post',
|
||||
data: { id1: menuId, id2: mouldId }
|
||||
})
|
||||
},
|
||||
GetTopMenusByHttpUser() {
|
||||
return myaxios({
|
||||
url: '/Menu/GetTopMenusByHttpUser',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
}
|
||||
10
Yi.Vue2.x/src/api/mouldApi.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import myaxios from '@/util/myaxios'
|
||||
export default {
|
||||
getMould() {
|
||||
return myaxios({
|
||||
url: '/Mould/GetMould',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
19
Yi.Vue2.x/src/api/panApi.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import myaxios from '@/util/myaxios'
|
||||
export default {
|
||||
GetPanFiles(dirName) {
|
||||
return myaxios({
|
||||
url: '/Pan/GetPanFiles',
|
||||
method: 'post',
|
||||
data: { dirName}
|
||||
})
|
||||
},
|
||||
Download(dirName,allName)
|
||||
{
|
||||
return myaxios({
|
||||
url: '/Pan/Download',
|
||||
method: 'post',
|
||||
data: { dirName,allName}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
24
Yi.Vue2.x/src/api/roleApi.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import myaxios from '@/util/myaxios'
|
||||
export default {
|
||||
getRole() {
|
||||
return myaxios({
|
||||
url: '/Role/getRole',
|
||||
method: 'get'
|
||||
})
|
||||
},
|
||||
setMenuByRole(roleList, menuList) {
|
||||
return myaxios({
|
||||
url: '/Role/setMenuByRole',
|
||||
method: 'post',
|
||||
data: { ids1: roleList, ids2: menuList }
|
||||
})
|
||||
},
|
||||
GetTopMenusByRoleId(roleId) {
|
||||
return myaxios({
|
||||
url: `/Role/GetTopMenusByRoleId?roleId=${roleId}`,
|
||||
method: 'get'
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
31
Yi.Vue2.x/src/api/userApi.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import myaxios from '@/util/myaxios'
|
||||
export default {
|
||||
SetRoleByUser(userIds, roleIds) {
|
||||
return myaxios({
|
||||
url: '/User/SetRoleByUser',
|
||||
method: 'post',
|
||||
data: { "ids1": userIds, "ids2": roleIds }
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
||||
GetUserInRolesByHttpUser() {
|
||||
return myaxios({
|
||||
url: `/User/GetUserInRolesByHttpUser`,
|
||||
method: 'get'
|
||||
})
|
||||
},
|
||||
GetMenuByHttpUser() {
|
||||
return myaxios({
|
||||
url: `/User/GetMenuByHttpUser`,
|
||||
method: 'get'
|
||||
})
|
||||
},
|
||||
GetRoleListByUserId(userId) {
|
||||
return myaxios({
|
||||
url: `/User/GetRoleListByUserId?userId=${userId}`,
|
||||
method: 'get'
|
||||
})
|
||||
},
|
||||
}
|
||||
BIN
Yi.Vue2.x/src/assets/clint-mckoy.jpg
Normal file
|
After Width: | Height: | Size: 170 KiB |
BIN
Yi.Vue2.x/src/assets/lock.jpg
Normal file
|
After Width: | Height: | Size: 808 KiB |
BIN
Yi.Vue2.x/src/assets/login.jpg
Normal file
|
After Width: | Height: | Size: 362 KiB |
1
Yi.Vue2.x/src/assets/login.svg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
Yi.Vue2.x/src/assets/logo.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
1
Yi.Vue2.x/src/assets/logo.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 87.5 100"><defs><style>.cls-1{fill:#1697f6;}.cls-2{fill:#7bc6ff;}.cls-3{fill:#1867c0;}.cls-4{fill:#aeddff;}</style></defs><title>Artboard 46</title><polyline class="cls-1" points="43.75 0 23.31 0 43.75 48.32"/><polygon class="cls-2" points="43.75 62.5 43.75 100 0 14.58 22.92 14.58 43.75 62.5"/><polyline class="cls-3" points="43.75 0 64.19 0 43.75 48.32"/><polygon class="cls-4" points="64.58 14.58 87.5 14.58 43.75 100 43.75 62.5 64.58 14.58"/></svg>
|
||||
|
After Width: | Height: | Size: 539 B |
BIN
Yi.Vue2.x/src/assets/mask-dark.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
Yi.Vue2.x/src/assets/mask-light.png
Normal file
|
After Width: | Height: | Size: 777 B |
BIN
Yi.Vue2.x/src/assets/pricing.jpg
Normal file
|
After Width: | Height: | Size: 637 KiB |
BIN
Yi.Vue2.x/src/assets/register.jpg
Normal file
|
After Width: | Height: | Size: 465 KiB |
BIN
Yi.Vue2.x/src/assets/tree-3.png
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
BIN
Yi.Vue2.x/src/assets/tree-4.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
Yi.Vue2.x/src/assets/tree.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
30
Yi.Vue2.x/src/assets/vmd.svg
Normal file
@@ -0,0 +1,30 @@
|
||||
<svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M132.472 205L182.534 118.292L162.162 130.093V119.162L191.975 102.019L221.665 50.5903L132.472 102.019V205Z" fill="#AEDDFF"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M132.472 194.938L173.714 123.386L162.162 130.094V124.255V119.162V113.448L189.863 97.423L214.584 54.5659L132.472 102.019V194.938Z" fill="#AEDDFF"/>
|
||||
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M183.155 101.274L189.987 97.2988L214.707 54.5659L175.329 77.2988C176.447 85.8702 179.18 93.9447 183.155 101.274Z" fill="#AEDDFF"/>
|
||||
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M132.472 194.938L173.839 123.385L162.162 130.093V124.255V123.634C151.23 125.497 141.168 129.845 132.472 135.932V194.938Z" fill="#AEDDFF"/>
|
||||
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M132.472 156.553V178.043C134.584 180.279 136.447 182.515 138.311 184.876L145.888 171.832C141.913 166.242 137.441 161.149 132.472 156.553Z" fill="#AEDDFF"/>
|
||||
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M132.472 146.242C139.056 151.584 145.019 157.671 150.112 164.379L166.137 136.677C156.323 127.236 145.019 119.286 132.472 113.447V146.242Z" fill="#AEDDFF"/>
|
||||
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M160.299 85.9946L141.665 96.8021C151.23 101.647 161.665 105.249 172.472 107.485L189.988 97.4232L195.205 88.3549C191.727 88.7275 188.249 88.8518 184.771 88.8518C176.323 88.8518 168.125 87.858 160.299 85.9946Z" fill="#AEDDFF"/>
|
||||
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M170.609 80.0311C175.206 80.6522 179.926 81.0249 184.771 81.0249C189.988 81.0249 195.081 80.6522 200.05 79.7826L212.1 58.9131C208.87 60.0311 205.516 61.0249 202.038 61.7702L170.609 80.0311Z" fill="#AEDDFF"/>
|
||||
<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M132.472 194.938L173.714 123.385L171.975 124.379L132.472 192.826" fill="#AEDDFF"/>
|
||||
<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M189.117 96.5534L161.043 112.827L162.161 119.162V113.448L189.863 97.423L214.583 54.5659L212.72 55.6839L189.117 96.5534Z" fill="#AEDDFF"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M123.528 205V102.019L34.3359 50.5903L84.398 137.298V113.696L93.8389 119.162V153.572L123.528 205Z" fill="#7BC6FF"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M123.528 194.937V102.018L43.0308 55.5586L84.3972 127.235V113.695V107.981L93.8381 113.447V119.161V143.509L123.528 194.937Z" fill="#7BC6FF"/>
|
||||
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M123.528 194.937V144.006C116.82 150.714 111.478 158.788 107.875 167.733L123.528 194.937Z" fill="#7BC6FF"/>
|
||||
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M60.5463 85.9933C68.2481 84.5026 75.4531 81.894 82.0369 78.1673L43.0308 55.5586L60.5463 85.9933Z" fill="#7BC6FF"/>
|
||||
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M69.7397 101.895L82.5348 124.006C83.1559 124.131 83.777 124.255 84.3981 124.379V113.82V107.982L93.8391 113.447V119.286V126.367C104.522 129.224 114.46 133.696 123.528 139.534V109.472C109.864 104.379 95.0813 101.522 79.5534 101.522C76.1994 101.522 72.9696 101.646 69.7397 101.895Z" fill="#7BC6FF"/>
|
||||
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M93.8384 143.509L100.671 155.31C108.994 158.912 116.695 163.633 123.528 169.223V148.85C114.584 142.515 104.646 137.546 93.8384 134.44V143.509Z" fill="#7BC6FF"/>
|
||||
<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M84.3973 114.939V113.696V107.982L93.8383 113.448V119.162V120.404L94.8321 112.827L83.2793 106.119L84.3973 114.939Z" fill="#7BC6FF"/>
|
||||
<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M43.0308 55.5586L84.3972 127.235V125.124L44.8941 56.6766L43.0308 55.5586Z" fill="#7BC6FF"/>
|
||||
<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M123.528 192.826L93.8384 141.398V143.51L123.528 194.938" fill="#7BC6FF"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M135.948 60.3699L128.124 64.8994L103.418 50.5903H54.2114L128.124 93.2086L202.037 50.5903H119.065L135.948 60.3699Z" fill="#1867C0"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M140.065 57.8993L135.947 60.3699L128.124 64.8994L103.418 50.5903H62.5493L128.124 88.4732L193.698 50.5903H127.3L140.065 57.8993Z" fill="#1867C0"/>
|
||||
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M167.036 66.0317L193.698 50.5903H170.33C168.58 55.4286 167.448 60.6787 167.036 66.0317Z" fill="#1867C0"/>
|
||||
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M62.5493 50.5903L100.432 72.4142C105.579 67.7817 110.006 62.3258 113.3 56.2522L103.418 50.5903H62.5493Z" fill="#1867C0"/>
|
||||
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M102.903 50.5903H94.1533C101.977 65.517 113.301 78.2819 127.095 87.8555L128.124 88.4732L140.272 81.4731C125.036 74.8848 112.168 64.0758 102.903 50.5903Z" fill="#1867C0"/>
|
||||
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M128.125 64.8994L118.86 59.5464C126.889 67.37 136.566 73.4436 147.375 77.3555L163.434 68.0906C153.654 67.1641 144.39 64.4876 135.948 60.3699L128.125 64.8994Z" fill="#1867C0"/>
|
||||
<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M127.301 50.5903L140.066 57.8993L135.948 60.3699L135.021 60.8846L141.816 57.8993L129.051 50.5903H127.301Z" fill="#1867C0"/>
|
||||
<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M128.124 87.4438L64.2993 50.5903H62.5493L128.124 88.4732L193.698 50.5903H191.948L128.124 87.4438Z" fill="#1867C0"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M167.037 66.0317L163.331 68.0906L147.375 77.3554L140.272 81.4731L128.125 88.4732V93.2086L202.038 50.5903H193.699L167.037 66.0317Z" fill="#1867C0"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.6 KiB |
1
Yi.Vue2.x/src/assets/vuetify.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 87.5 100"><defs><style>.cls-1{fill:#1697f6;}.cls-2{fill:#7bc6ff;}.cls-3{fill:#aeddff;}</style></defs><title>Artboard 47</title><polyline class="cls-1" points="43.75 0 23.31 0 43.75 48.32"/><polygon class="cls-2" points="43.75 62.5 43.75 100 0 14.58 22.92 14.58 43.75 62.5"/><polyline class="cls-2" points="43.75 0 64.19 0 43.75 48.32"/><polygon class="cls-3" points="64.58 14.58 87.5 14.58 43.75 100 43.75 62.5 64.58 14.58"/></svg>
|
||||
|
After Width: | Height: | Size: 518 B |
64
Yi.Vue2.x/src/components/Links.vue
Normal file
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<v-container>
|
||||
<v-row align="center">
|
||||
<v-col
|
||||
v-for="(link, i) in links"
|
||||
:key="i"
|
||||
class="text-center"
|
||||
cols="6"
|
||||
md="auto"
|
||||
>
|
||||
<a
|
||||
:href="link.href"
|
||||
class="text-decoration-none text-uppercase text-caption font-weight-regular"
|
||||
rel="noopener"
|
||||
target="_blank"
|
||||
v-text="link.text"
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
<v-spacer class="hidden-sm-and-down" />
|
||||
|
||||
<v-col
|
||||
cols="12"
|
||||
md="auto"
|
||||
>
|
||||
<div class="text-body-1 font-weight-light pt-6 pt-md-0 text-center">
|
||||
© {{ (new Date()).getFullYear() }}, Made by <v-icon>mdi-vuetify</v-icon>
|
||||
<a
|
||||
href="https://ccnetcore"
|
||||
class="text-decoration-none"
|
||||
>ccnetcore</a>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Links',
|
||||
|
||||
data: () => ({
|
||||
links: [
|
||||
{
|
||||
href: '#',
|
||||
text: 'YiFramework文档',
|
||||
},
|
||||
{
|
||||
href: '#',
|
||||
text: 'GitHub',
|
||||
},
|
||||
{
|
||||
href: '#',
|
||||
text: '论坛',
|
||||
}
|
||||
],
|
||||
}),
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="sass" scoped>
|
||||
a
|
||||
color: inherit !important
|
||||
</style>
|
||||
59
Yi.Vue2.x/src/components/MaterialAlert.vue
Normal file
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<v-alert
|
||||
class="v-alert--material"
|
||||
dark
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<template
|
||||
v-if="$attrs.icon"
|
||||
v-slot:prepend
|
||||
>
|
||||
<v-avatar
|
||||
class="align-self-start mt-n9 elevation-6 mr-4"
|
||||
size="38"
|
||||
>
|
||||
<v-icon
|
||||
:color="$attrs.color"
|
||||
class="elevation-6 white"
|
||||
light
|
||||
>
|
||||
{{ $attrs.icon }}
|
||||
</v-icon>
|
||||
</v-avatar>
|
||||
</template>
|
||||
|
||||
<slot />
|
||||
|
||||
<template
|
||||
v-if="$attrs.dismissible"
|
||||
v-slot:close="{ toggle }"
|
||||
>
|
||||
<v-btn
|
||||
:aria-label="$vuetify.lang.t('$vuetify.close')"
|
||||
class="ml-4"
|
||||
color
|
||||
icon
|
||||
small
|
||||
@click="toggle"
|
||||
>
|
||||
<v-icon>
|
||||
$vuetify.icons.cancel
|
||||
</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-alert>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default { name: 'MaterialAlert' }
|
||||
</script>
|
||||
|
||||
<style lang="sass">
|
||||
.v-alert--material
|
||||
margin-top: 32px
|
||||
|
||||
.v-alert__dismissible
|
||||
align-self: flex-start
|
||||
margin: 0 0 0 16px !important
|
||||
</style>
|
||||
113
Yi.Vue2.x/src/components/MaterialCard.vue
Normal file
@@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<app-card
|
||||
v-bind="$attrs"
|
||||
class="v-card--material mt-4"
|
||||
>
|
||||
<v-card-title class="align-start">
|
||||
<v-sheet
|
||||
:color="color"
|
||||
:width="fullHeader ? '100%' : undefined"
|
||||
class="overflow-hidden mt-n9 transition-swing v-card--material__sheet"
|
||||
elevation="6"
|
||||
max-width="100%"
|
||||
rounded
|
||||
>
|
||||
<v-theme-provider
|
||||
v-if="hasHeading"
|
||||
dark
|
||||
>
|
||||
<div
|
||||
v-if="icon"
|
||||
:class="iconSmall ? 'pa-7' : 'pa-8'"
|
||||
>
|
||||
<v-icon
|
||||
:large="!iconSmall"
|
||||
v-text="icon"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<slot name="heading" />
|
||||
|
||||
<div
|
||||
v-if="heading"
|
||||
class="text-h4 white--text pa-7 v-card--material__title"
|
||||
>
|
||||
{{ heading }}
|
||||
</div>
|
||||
</v-theme-provider>
|
||||
</v-sheet>
|
||||
|
||||
<div
|
||||
v-if="hasTitle"
|
||||
:class="fullHeader ? 'pt-4' : 'pl-3'"
|
||||
class="text-h4 v-card--material__title"
|
||||
>
|
||||
<slot name="title" />
|
||||
|
||||
<template v-if="title">
|
||||
{{ title }}
|
||||
</template>
|
||||
|
||||
<div class="text-subtitle-1 mb-n4">
|
||||
<slot name="subtitle" />
|
||||
|
||||
<template v-if="subtitle">
|
||||
{{ subtitle }}
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</v-card-title>
|
||||
|
||||
<slot />
|
||||
|
||||
<template v-if="$slots.actions">
|
||||
<v-divider class="mt-2 mx-4" />
|
||||
|
||||
<v-card-actions class="px-4 text-caption grey--text">
|
||||
<slot name="actions" />
|
||||
</v-card-actions>
|
||||
</template>
|
||||
</app-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'MaterialCard',
|
||||
|
||||
props: {
|
||||
color: String,
|
||||
fullHeader: Boolean,
|
||||
heading: String,
|
||||
icon: String,
|
||||
iconSmall: Boolean,
|
||||
subtitle: String,
|
||||
title: String,
|
||||
},
|
||||
|
||||
computed: {
|
||||
hasHeading () {
|
||||
return !!(
|
||||
this.icon ||
|
||||
this.heading ||
|
||||
this.$slots.heading
|
||||
)
|
||||
},
|
||||
hasTitle () {
|
||||
return !!(
|
||||
this.title ||
|
||||
this.subtitle ||
|
||||
this.$slots.title ||
|
||||
this.$slots.subtitle
|
||||
)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="sass">
|
||||
.v-card.v-card--material
|
||||
> .v-card__title
|
||||
> .v-card--material__title
|
||||
flex: 1 1 auto
|
||||
word-break: break-word
|
||||
</style>
|
||||
93
Yi.Vue2.x/src/components/MaterialChartCard.vue
Normal file
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<material-card
|
||||
v-bind="$attrs"
|
||||
class="v-card--material-chart"
|
||||
full-header
|
||||
>
|
||||
<template #heading>
|
||||
<div class="pa-4">
|
||||
<chartist
|
||||
:data="data"
|
||||
:event-handlers="eventHandlers"
|
||||
:options="options"
|
||||
:ratio="ratio"
|
||||
:responsive-options="responsiveOptions"
|
||||
:type="type"
|
||||
style="max-height: 150px;"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #subtitle>
|
||||
<slot name="subtitle" />
|
||||
</template>
|
||||
|
||||
<slot />
|
||||
|
||||
<template #actions>
|
||||
<slot name="actions" />
|
||||
</template>
|
||||
</material-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'MaterialChartCard',
|
||||
|
||||
inheritAttrs: false,
|
||||
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
eventHandlers: {
|
||||
type: Array,
|
||||
default: () => ([]),
|
||||
},
|
||||
options: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
ratio: String,
|
||||
responsiveOptions: {
|
||||
type: Array,
|
||||
default: () => ([]),
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
required: true,
|
||||
validator: v => ['Bar', 'Line', 'Pie'].includes(v),
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="sass">
|
||||
.v-card--material-chart
|
||||
p
|
||||
color: #999
|
||||
|
||||
.v-card--material__sheet
|
||||
max-height: 185px
|
||||
width: 100%
|
||||
|
||||
.ct-label
|
||||
color: rgba(255, 255, 255, 1)
|
||||
opacity: .7
|
||||
font-size: 0.875rem
|
||||
font-weight: 300
|
||||
|
||||
.ct-grid
|
||||
stroke: hsla(0,0%,100%,.2)
|
||||
|
||||
.ct-series-a .ct-point,
|
||||
.ct-series-a .ct-line,
|
||||
.ct-series-a .ct-bar,
|
||||
.ct-series-a .ct-slice-donut
|
||||
stroke: rgba(255,255,255,.8)
|
||||
|
||||
.ct-series-a .ct-slice-pie,
|
||||
.ct-series-a .ct-area
|
||||
fill: rgba(255,255,255,.4)
|
||||
</style>
|
||||
78
Yi.Vue2.x/src/components/MaterialSnackbar.vue
Normal file
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<v-snackbar
|
||||
v-model="internalValue"
|
||||
class="v-snackbar--material"
|
||||
v-bind="{
|
||||
...$attrs,
|
||||
'color': 'transparent'
|
||||
}"
|
||||
>
|
||||
<material-alert
|
||||
v-model="internalValue"
|
||||
:color="$attrs.color"
|
||||
:dismissible="dismissible"
|
||||
:type="type"
|
||||
class="ma-0"
|
||||
dark
|
||||
>
|
||||
<slot />
|
||||
</material-alert>
|
||||
</v-snackbar>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'MaterialSnackbar',
|
||||
|
||||
props: {
|
||||
dismissible: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
value: Boolean,
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
internalValue: this.value,
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
internalValue (val, oldVal) {
|
||||
if (val === oldVal) return
|
||||
|
||||
this.$emit('input', val)
|
||||
},
|
||||
value (val, oldVal) {
|
||||
if (val === oldVal) return
|
||||
|
||||
this.internalValue = val
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="sass">
|
||||
.v-snackbar--material
|
||||
margin-top: 32px
|
||||
margin-bottom: 32px
|
||||
|
||||
.v-alert
|
||||
padding: 32px 16px
|
||||
|
||||
.v-alert--material,
|
||||
.v-snack__wrapper
|
||||
border-radius: 4px
|
||||
|
||||
.v-snack__content
|
||||
overflow: visible
|
||||
padding: 0
|
||||
|
||||
.v-snack__action
|
||||
display: none
|
||||
</style>
|
||||
39
Yi.Vue2.x/src/components/MaterialStatsCard.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<material-card
|
||||
class="v-card--material-stats"
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<template #subtitle>
|
||||
<div
|
||||
class="text-right text-h3 v-card__subtitle--material-stats"
|
||||
v-text="value"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #actions>
|
||||
<slot name="actions" />
|
||||
</template>
|
||||
|
||||
<slot />
|
||||
</material-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'MaterialStatCard',
|
||||
|
||||
props: { value: String },
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="sass">
|
||||
.v-card--material-stats.v-card--material .v-card--material__title
|
||||
color: #999999
|
||||
font-size: .875rem !important
|
||||
margin-left: auto
|
||||
text-align: right
|
||||
|
||||
.v-card__subtitle--material-stats
|
||||
color: #3C4858
|
||||
</style>
|
||||
43
Yi.Vue2.x/src/components/TableApi.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import myaxios from '@/util/myaxios'
|
||||
export default {
|
||||
getItem(url) {
|
||||
return myaxios({
|
||||
url: url,
|
||||
method: 'post',
|
||||
data: {
|
||||
parameters: [
|
||||
{
|
||||
key: "isDeleted",
|
||||
value: "0",
|
||||
type: 0
|
||||
|
||||
}
|
||||
],
|
||||
orderBys: [
|
||||
"id"
|
||||
]
|
||||
}
|
||||
})
|
||||
},
|
||||
addItem(url, data) {
|
||||
return myaxios({
|
||||
url: url,
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
},
|
||||
updateItem(url, data) {
|
||||
return myaxios({
|
||||
url: url,
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
},
|
||||
delItemList(url, Ids) {
|
||||
return myaxios({
|
||||
url: url,
|
||||
method: 'delete',
|
||||
data: Ids
|
||||
})
|
||||
},
|
||||
}
|
||||
37
Yi.Vue2.x/src/components/ViewIntro.vue
Normal file
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<section class="mb-12 text-center">
|
||||
<h1
|
||||
class="mb-2 text-h3"
|
||||
v-text="heading"
|
||||
/>
|
||||
|
||||
<div
|
||||
v-if="link"
|
||||
class="text-body-2 font-weight-light"
|
||||
>
|
||||
Please checkout the <a
|
||||
:href="`https://vuetifyjs.com/en/${link}`"
|
||||
class="text-decoration-none secondary--text"
|
||||
target="_blank"
|
||||
>full documentation</a>
|
||||
</div>
|
||||
|
||||
<v-responsive
|
||||
class="text-center mx-auto text-body-1 font-weight-light"
|
||||
max-width="400"
|
||||
>
|
||||
<slot />
|
||||
</v-responsive>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'ViewIntro',
|
||||
|
||||
props: {
|
||||
heading: String,
|
||||
link: String,
|
||||
},
|
||||
}
|
||||
</script>
|
||||
29
Yi.Vue2.x/src/components/app/BarItem.vue
Normal file
@@ -0,0 +1,29 @@
|
||||
<script>
|
||||
import { VHover, VListItem } from 'vuetify/lib'
|
||||
|
||||
export default {
|
||||
name: 'AppBarItem',
|
||||
|
||||
render (h) {
|
||||
return h(VHover, {
|
||||
scopedSlots: {
|
||||
default: ({ hover }) => {
|
||||
return h(VListItem, {
|
||||
attrs: this.$attrs,
|
||||
class: {
|
||||
'black--text': !hover,
|
||||
'white--text secondary elevation-12': hover,
|
||||
},
|
||||
props: {
|
||||
activeClass: '',
|
||||
dark: hover,
|
||||
link: true,
|
||||
...this.$attrs,
|
||||
},
|
||||
}, this.$slots.default)
|
||||
},
|
||||
},
|
||||
})
|
||||
},
|
||||
}
|
||||
</script>
|
||||
22
Yi.Vue2.x/src/components/app/Btn.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<v-btn
|
||||
:color="color"
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<slot />
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'AppBtn',
|
||||
|
||||
props: {
|
||||
color: {
|
||||
type: String,
|
||||
default: 'primary',
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
12
Yi.Vue2.x/src/components/app/Card.vue
Normal file
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<v-card
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<slot />
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default { name: 'AppCard' }
|
||||
</script>
|
||||
42
Yi.Vue2.x/src/components/app/Tabs.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<v-tabs
|
||||
:active-class="`${color} ${theme.isDark ? 'black' : 'white'}--text`"
|
||||
class="v-tabs--pill"
|
||||
hide-slider
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<slot />
|
||||
|
||||
<slot name="items" />
|
||||
</v-tabs>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'AppTabs',
|
||||
|
||||
inject: ['theme'],
|
||||
|
||||
props: {
|
||||
color: {
|
||||
type: String,
|
||||
default: 'primary',
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="sass">
|
||||
.v-tabs--pill
|
||||
.v-tab,
|
||||
.v-tab:before
|
||||
border-radius: 24px
|
||||
|
||||
&.v-tabs--icons-and-text
|
||||
&:not(.v-tabs--vertical) > .v-tabs-bar
|
||||
height: 100px
|
||||
.v-tab,
|
||||
.v-tab:before
|
||||
border-radius: 4px
|
||||
</style>
|
||||
28
Yi.Vue2.x/src/components/ccAvatar.vue
Normal file
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<v-avatar :size="size" >
|
||||
<!-- <img src="https://z3.ax1x.com/2021/05/09/gJadhD.jpg" /> -->
|
||||
<img
|
||||
:src="baseurl +'/image/'+$store.state.user.user.icon"
|
||||
/>
|
||||
</v-avatar>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Utilities
|
||||
// import { get } from 'vuex-pathify'
|
||||
|
||||
export default {
|
||||
name: 'ccAvatar',
|
||||
mounted() {
|
||||
this.baseurl = process.env.VUE_APP_BASE_API;
|
||||
},
|
||||
data:()=>({
|
||||
baseurl: "",
|
||||
}),
|
||||
props: {
|
||||
size: {
|
||||
type: Number,
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
67
Yi.Vue2.x/src/components/ccCombobox.vue
Normal file
@@ -0,0 +1,67 @@
|
||||
<template>
|
||||
<v-dialog v-model="dialog" persistent max-width="600px">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn class="ma-2" color="primary" dark v-bind="attrs" v-on="on">
|
||||
{{ headers }}
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span class="text-h5">{{ headers }}</span>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col cols="12">
|
||||
<v-combobox
|
||||
v-model="select"
|
||||
:items="items"
|
||||
label="请点击选择"
|
||||
multiple
|
||||
chips
|
||||
:item-text="itemText"
|
||||
></v-combobox>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
<small>*可多选</small>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="blue darken-1" text @click="dialog = false"> 关闭 </v-btn>
|
||||
<div @click="dialog = false"> <slot name="save" ></slot> </div>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
headers: {
|
||||
type: String
|
||||
},
|
||||
items:{
|
||||
type:Array
|
||||
},
|
||||
itemText:{
|
||||
type: String
|
||||
}
|
||||
},
|
||||
name: "ccCombobox",
|
||||
data() {
|
||||
return {
|
||||
dialog: false,
|
||||
select: [],
|
||||
};
|
||||
},
|
||||
watch:{
|
||||
select:{//深度监听,可监听到对象、数组的变化
|
||||
handler(val, oldVal){
|
||||
this.$emit("select",val);
|
||||
},
|
||||
deep:true
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
245
Yi.Vue2.x/src/components/ccTable.vue
Normal file
@@ -0,0 +1,245 @@
|
||||
<template>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="desserts"
|
||||
sort-by="calories"
|
||||
class="elevation-1"
|
||||
item-key="id"
|
||||
show-select
|
||||
v-model="selected"
|
||||
:search="search"
|
||||
>
|
||||
<slot />
|
||||
<template v-slot:top>
|
||||
<!-- 搜索框 -->
|
||||
<v-toolbar flat>
|
||||
<v-spacer></v-spacer>
|
||||
<v-text-field
|
||||
v-model="search"
|
||||
append-icon="mdi-magnify"
|
||||
label="搜索"
|
||||
single-line
|
||||
hide-details
|
||||
class="mx-4"
|
||||
></v-text-field>
|
||||
|
||||
<v-btn
|
||||
v-if="axiosUrls.add != null"
|
||||
color="primary"
|
||||
dark
|
||||
class="mb-2 mx-2"
|
||||
@click="dialog = true"
|
||||
>
|
||||
添加新项
|
||||
</v-btn>
|
||||
|
||||
<!-- 添加提示框 -->
|
||||
<v-dialog
|
||||
v-if="axiosUrls.add != null"
|
||||
v-model="dialog"
|
||||
max-width="500px"
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span class="headline">{{ formTitle }}</span>
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col
|
||||
cols="12"
|
||||
sm="6"
|
||||
md="4"
|
||||
v-for="(value, key, index) in editedItem"
|
||||
:key="index"
|
||||
>
|
||||
<v-text-field
|
||||
v-model="editedItem[key]"
|
||||
:label="key"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="blue darken-1" text @click="close"> 取消 </v-btn>
|
||||
<v-btn color="blue darken-1" text @click="save"> 保存 </v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<v-btn
|
||||
v-if="axiosUrls.del != null"
|
||||
color="secondary"
|
||||
class="mb-2"
|
||||
@click="deleteItem(null)"
|
||||
>
|
||||
删除所选
|
||||
</v-btn>
|
||||
</v-toolbar>
|
||||
</template>
|
||||
|
||||
<!-- 表格中的删除和修改 -->
|
||||
<template v-slot:item.actions="{ item }">
|
||||
<slot name="action" :item="item"></slot>
|
||||
|
||||
<v-icon
|
||||
v-if="axiosUrls.update != null"
|
||||
small
|
||||
class="mr-2"
|
||||
@click="editItem(item)"
|
||||
>
|
||||
mdi-pencil
|
||||
</v-icon>
|
||||
<v-icon v-if="axiosUrls.del != null" small @click="deleteItem(item)">
|
||||
mdi-delete
|
||||
</v-icon>
|
||||
</template>
|
||||
|
||||
<!-- 初始化 -->
|
||||
<template v-slot:no-data>
|
||||
<v-btn color="primary" @click="initialize"> 刷新 </v-btn>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</template>
|
||||
<script>
|
||||
import itemApi from "./TableApi.js";
|
||||
export default {
|
||||
name: "ccTable",
|
||||
props: {
|
||||
defaultItem: {
|
||||
type: Object,
|
||||
},
|
||||
headers: {
|
||||
type: Array,
|
||||
},
|
||||
axiosUrls: {
|
||||
type: Object,
|
||||
},
|
||||
},
|
||||
data: () => ({
|
||||
page: 1,
|
||||
selected: [],
|
||||
search: "",
|
||||
dialog: false,
|
||||
desserts: [],
|
||||
editedIndex: -1,
|
||||
editedItem: {},
|
||||
}),
|
||||
|
||||
computed: {
|
||||
formTitle() {
|
||||
return this.editedIndex === -1 ? "添加数据" : "编辑数据";
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
axiosUrls: {
|
||||
handler(val, oldVal) {
|
||||
this.dataInit(val.get);
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
selected: {
|
||||
handler(val, oldVal) {
|
||||
this.$emit("selected", val);
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
dialog(val) {
|
||||
val || this.close();
|
||||
},
|
||||
},
|
||||
|
||||
created() {
|
||||
this.initialize();
|
||||
},
|
||||
|
||||
methods: {
|
||||
dataInit(getStr) {
|
||||
itemApi.getItem(getStr).then((resp) => {
|
||||
const response = resp.data;
|
||||
this.desserts = response;
|
||||
});
|
||||
},
|
||||
initialize() {
|
||||
if(this.axiosUrls.get!=undefined && this.axiosUrls.get!=null )
|
||||
{
|
||||
this.dataInit(this.axiosUrls.get)
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.editedItem = Object.assign({}, this.defaultItem);
|
||||
this.editedIndex = -1;
|
||||
});
|
||||
},
|
||||
// 添加和修改都打开同一个编辑框
|
||||
|
||||
editItem(item) {
|
||||
this.editedIndex = this.desserts.indexOf(item);
|
||||
this.editedItem = Object.assign({}, item);
|
||||
this.dialog = true;
|
||||
},
|
||||
|
||||
async deleteItem(item) {
|
||||
this.editedIndex = this.desserts.indexOf(item);
|
||||
this.editedItem = Object.assign({}, item);
|
||||
|
||||
var p = await this.$dialog.warning({
|
||||
text: "你确定要删除此条记录吗??",
|
||||
title: "警告",
|
||||
actions: {
|
||||
false: "取消",
|
||||
true: "确定",
|
||||
},
|
||||
});
|
||||
if (p) {
|
||||
this.deleteItemConfirm();
|
||||
}
|
||||
},
|
||||
deleteItemConfirm() {
|
||||
var Ids = [];
|
||||
if (this.editedIndex > -1) {
|
||||
Ids.push(this.editedItem.id);
|
||||
} else {
|
||||
this.selected.forEach(function (item) {
|
||||
Ids.push(item.id);
|
||||
});
|
||||
}
|
||||
itemApi
|
||||
.delItemList(this.axiosUrls.del, Ids)
|
||||
.then(() => this.initialize());
|
||||
},
|
||||
close() {
|
||||
this.dialog = false;
|
||||
this.$nextTick(() => {
|
||||
this.editedItem = Object.assign({}, this.defaultItem);
|
||||
this.editedIndex = -1;
|
||||
});
|
||||
},
|
||||
|
||||
closeDelete() {
|
||||
this.dialogDelete = false;
|
||||
this.$nextTick(() => {
|
||||
this.editedItem = Object.assign({}, this.defaultItem);
|
||||
this.editedIndex = -1;
|
||||
});
|
||||
},
|
||||
|
||||
save() {
|
||||
if (this.editedIndex > -1) {
|
||||
itemApi
|
||||
.updateItem(this.axiosUrls.update, this.editedItem)
|
||||
.then(() => this.initialize());
|
||||
} else {
|
||||
itemApi
|
||||
.addItem(this.axiosUrls.add, this.editedItem)
|
||||
.then(() => this.initialize());
|
||||
}
|
||||
this.close();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
227
Yi.Vue2.x/src/components/ccTreeview.vue
Normal file
@@ -0,0 +1,227 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-divider></v-divider>
|
||||
<app-btn dark class="ma-4" @click="showAll"> 展开全部</app-btn>
|
||||
<app-btn dark class="my-4 mr-4" @click="dialog = true"> 添加新项 </app-btn>
|
||||
<app-btn dark class="my-4" color="secondary" @click="deleteItem(null)">
|
||||
删除所选
|
||||
</app-btn>
|
||||
|
||||
|
||||
|
||||
|
||||
<v-dialog v-model="dialog" max-width="500px">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span class="headline">{{ formTitle }}</span>
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col
|
||||
cols="12"
|
||||
sm="6"
|
||||
md="4"
|
||||
v-for="(value, key, index) in editedItem"
|
||||
:key="index"
|
||||
>
|
||||
<v-text-field
|
||||
v-model="editedItem[key]"
|
||||
:label="key"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="blue darken-1" text @click="close"> 取消 </v-btn>
|
||||
<v-btn color="blue darken-1" text @click="save"> 保存 </v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<v-treeview
|
||||
ref="tree"
|
||||
open-on-click
|
||||
selectable
|
||||
:items="desserts"
|
||||
:selection-type="selectionType"
|
||||
v-model="selection"
|
||||
return-object
|
||||
open-all
|
||||
hoverable
|
||||
item-text="menu_name"
|
||||
>
|
||||
<template v-slot:append="{ item }">
|
||||
<v-btn class="mr-2">编号:{{ item.id }}</v-btn>
|
||||
<v-btn class="mr-2">图标:{{ item.icon }}</v-btn>
|
||||
<v-btn class="mr-2">路由:{{ item.router }}</v-btn>
|
||||
<v-btn v-if="item.mould" class="mr-2">接口名:{{ item.mould.mould_name }}</v-btn>
|
||||
<v-btn v-if="item.mould" class="mr-2" color="secondary">接口地址:{{ item.mould.url }}</v-btn>
|
||||
<ccCombobox
|
||||
headers="设置接口权限"
|
||||
itemText="url"
|
||||
:items="mouldList"
|
||||
@select="getSelect"
|
||||
>
|
||||
<template v-slot:save>
|
||||
<v-btn @click="setMould(item)" color="blue darken-1" text>
|
||||
保存</v-btn
|
||||
>
|
||||
</template>
|
||||
</ccCombobox>
|
||||
<app-btn
|
||||
@click="
|
||||
parentId = item.id;
|
||||
dialog = true;
|
||||
"
|
||||
>添加子菜单</app-btn
|
||||
>
|
||||
<app-btn class="mx-2" @click="editItem(item)">编辑</app-btn>
|
||||
|
||||
<app-btn color="secondary" class="mr-2" @click="deleteItem(item)">删除</app-btn>
|
||||
|
||||
</template>
|
||||
</v-treeview>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import mouldApi from "../api/mouldApi";
|
||||
import menuApi from "../api/menuApi";
|
||||
export default {
|
||||
name: "ccTreeview",
|
||||
|
||||
data: () => ({
|
||||
mouldSelect: [],
|
||||
mouldList: [],
|
||||
desserts: [],
|
||||
selectionType: "independent",
|
||||
selection: [],
|
||||
dialog: false,
|
||||
editedItem: {},
|
||||
editedIndex: -1,
|
||||
parentId: 0,
|
||||
defaultItem: {
|
||||
icon: "mdi-start",
|
||||
router: "test",
|
||||
menu_name: "测试",
|
||||
is_show:1
|
||||
},
|
||||
}),
|
||||
computed: {
|
||||
formTitle() {
|
||||
return this.editedIndex === -1 ? "添加数据" : "编辑数据";
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
showAll(){
|
||||
this.$refs.tree.updateAll(true);
|
||||
},
|
||||
|
||||
setMould(item) {
|
||||
menuApi.SetMouldByMenu(item.id, this.mouldSelect[0].id).then((resp) => {
|
||||
this.$dialog.notify.info(resp.msg, {
|
||||
position: "top-right",
|
||||
timeout: 5000,
|
||||
});
|
||||
this.init();
|
||||
});
|
||||
},
|
||||
|
||||
getSelect(data) {
|
||||
this.mouldSelect = data;
|
||||
},
|
||||
async deleteItem(item) {
|
||||
this.editedIndex = this.desserts.indexOf(item);
|
||||
this.editedItem = Object.assign({}, item);
|
||||
var p = await this.$dialog.warning({
|
||||
text: "你确定要删除此条记录吗??",
|
||||
title: "警告",
|
||||
actions: {
|
||||
false: "取消",
|
||||
true: "确定",
|
||||
},
|
||||
});
|
||||
if (p) {
|
||||
this.deleteItemConfirm();
|
||||
}
|
||||
},
|
||||
deleteItemConfirm() {
|
||||
var Ids = [];
|
||||
if (this.editedIndex > -1) {
|
||||
Ids.push(this.editedItem.id);
|
||||
} else {
|
||||
this.selection.forEach(function (item) {
|
||||
Ids.push(item.id);
|
||||
});
|
||||
}
|
||||
menuApi.DelListMenu(Ids).then(() => this.init());
|
||||
},
|
||||
|
||||
close() {
|
||||
this.dialog = false;
|
||||
this.$nextTick(() => {
|
||||
this.editedItem = Object.assign({}, this.defaultItem);
|
||||
this.editedIndex = -1;
|
||||
});
|
||||
},
|
||||
init() {
|
||||
this.parentId = 0;
|
||||
mouldApi.getMould().then((resp) => {
|
||||
this.mouldList = resp.data;
|
||||
});
|
||||
|
||||
menuApi.GetMenuInMould().then((resp) => {
|
||||
this.desserts =[ resp.data];
|
||||
});
|
||||
this.$nextTick(() => {
|
||||
this.editedItem = Object.assign({}, this.defaultItem);
|
||||
this.editedIndex = -1;
|
||||
});
|
||||
|
||||
|
||||
|
||||
},
|
||||
editItem(item) {
|
||||
this.editedIndex = item.id;
|
||||
this.editedItem = Object.assign({}, item);
|
||||
this.dialog = true;
|
||||
},
|
||||
|
||||
save() {
|
||||
if (this.editedIndex > -1) {
|
||||
menuApi.UpdateMenu(this.editedItem).then(() => this.init());
|
||||
} else {
|
||||
if (this.parentId == 0) {
|
||||
menuApi.AddTopMenu(this.editedItem).then(() => {
|
||||
this.init();
|
||||
});
|
||||
} else {
|
||||
menuApi.addChildrenMenu(this.parentId, this.editedItem).then(() => {
|
||||
this.init();
|
||||
});
|
||||
}
|
||||
}
|
||||
this.close();
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
selection: {
|
||||
//深度监听,可监听到对象、数组的变化
|
||||
handler(val, oldVal) {
|
||||
this.$emit("selection", val);
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
dialog(val) {
|
||||
val || this.close();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
79
Yi.Vue2.x/src/layouts/default/AppBar.vue
Normal file
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<v-app-bar
|
||||
id="default-app-bar"
|
||||
app
|
||||
absolute
|
||||
class="v-bar--underline"
|
||||
color="transparent"
|
||||
:clipped-left="$vuetify.rtl"
|
||||
:clipped-right="!$vuetify.rtl"
|
||||
height="70"
|
||||
flat
|
||||
>
|
||||
<v-app-bar-nav-icon class="hidden-md-and-up" @click="$store.state.home.drawer = !$store.state.home.drawer;" />
|
||||
|
||||
<default-drawer-toggle class="hidden-sm-and-down" />
|
||||
|
||||
<v-toolbar-title class="font-weight-light text-h5" v-text="name" />
|
||||
|
||||
<v-spacer />
|
||||
|
||||
<default-search class="hidden-sm-and-down" />
|
||||
|
||||
<default-go-home />
|
||||
|
||||
<default-notifications />
|
||||
|
||||
<default-account />
|
||||
|
||||
</v-app-bar>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Utilities
|
||||
// import { get, sync } from 'vuex-pathify'
|
||||
|
||||
export default {
|
||||
|
||||
data: () => ({
|
||||
name: "系统",
|
||||
}),
|
||||
name: "DefaultBar",
|
||||
|
||||
components: {
|
||||
DefaultAccount: () =>
|
||||
import(
|
||||
/* webpackChunkName: "default-account" */
|
||||
"./widgets/Account"
|
||||
),
|
||||
DefaultDrawerToggle: () =>
|
||||
import(
|
||||
/* webpackChunkName: "default-drawer-toggle" */
|
||||
"./widgets/DrawerToggle"
|
||||
),
|
||||
DefaultGoHome: () =>
|
||||
import(
|
||||
/* webpackChunkName: "default-go-home" */
|
||||
"./widgets/GoHome"
|
||||
),
|
||||
DefaultNotifications: () =>
|
||||
import(
|
||||
/* webpackChunkName: "default-notifications" */
|
||||
"./widgets/Notifications"
|
||||
),
|
||||
DefaultSearch: () =>
|
||||
import(
|
||||
/* webpackChunkName: "default-search" */
|
||||
"./widgets/Search"
|
||||
),
|
||||
},
|
||||
|
||||
// computed: {
|
||||
// ...sync('app', [
|
||||
// 'drawer',
|
||||
// 'mini',
|
||||
// ]),
|
||||
// name: get('route/name'),
|
||||
// },
|
||||
};
|
||||
</script>
|
||||
300
Yi.Vue2.x/src/layouts/default/Drawer.vue
Normal file
@@ -0,0 +1,300 @@
|
||||
<template>
|
||||
<v-navigation-drawer
|
||||
id="default-drawer"
|
||||
v-model="$store.state.home.drawer"
|
||||
:dark="dark"
|
||||
:right="$vuetify.rtl"
|
||||
:src="drawerImage ? image : ''"
|
||||
:mini-variant.sync="$store.state.home.mini"
|
||||
mini-variant-width="80"
|
||||
app
|
||||
width="260"
|
||||
>
|
||||
<template v-if="drawerImage" #img="props">
|
||||
<v-img :key="image" :gradient="gradient" v-bind="props" />
|
||||
</template>
|
||||
|
||||
<div class="px-2">
|
||||
<default-drawer-header />
|
||||
|
||||
<v-divider class="mx-3 mb-2" />
|
||||
|
||||
<default-list :items="items" />
|
||||
</div>
|
||||
|
||||
<template #append>
|
||||
<div class="pa-4 text-center">
|
||||
<app-btn
|
||||
class="text-none mb-4"
|
||||
color="white"
|
||||
href="https://vuetifyjs.com"
|
||||
small
|
||||
text
|
||||
>
|
||||
Documentation
|
||||
</app-btn>
|
||||
|
||||
<app-btn block class="text-none" color="secondary" @click="logout">
|
||||
<v-icon left> mdi-package-up </v-icon>
|
||||
|
||||
退出
|
||||
</app-btn>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="pt-12" />
|
||||
</v-navigation-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Utilities
|
||||
// import { get, sync } from 'vuex-pathify'
|
||||
import userApi from "@/api/userApi";
|
||||
export default {
|
||||
methods: {
|
||||
init() {
|
||||
//这里动态获取菜单,暂时写死
|
||||
// userApi.GetMenuByHttpUser().then((resp) => {
|
||||
// this.items = resp.data.children;
|
||||
// });
|
||||
this.items =
|
||||
|
||||
[
|
||||
{
|
||||
icon: "mdi-view-dashboard",
|
||||
router: "/",
|
||||
menu_name: "首页",
|
||||
roles: null,
|
||||
mould: null,
|
||||
is_top: 0,
|
||||
sort: 0,
|
||||
is_show: 1,
|
||||
parentId: 1,
|
||||
children: null,
|
||||
id: 2,
|
||||
is_delete: 0,
|
||||
},
|
||||
{
|
||||
icon: "mdi-account-box-multiple",
|
||||
router: null,
|
||||
menu_name: "用户角色管理",
|
||||
roles: null,
|
||||
mould: null,
|
||||
is_top: 0,
|
||||
sort: 0,
|
||||
is_show: 1,
|
||||
parentId: 1,
|
||||
children: [
|
||||
{
|
||||
icon: "mdi-account-box",
|
||||
router: "/AdmUser/",
|
||||
menu_name: "用户管理",
|
||||
roles: null,
|
||||
mould: null,
|
||||
is_top: 0,
|
||||
sort: 0,
|
||||
is_show: 1,
|
||||
parentId: 3,
|
||||
children: null,
|
||||
id: 4,
|
||||
is_delete: 0,
|
||||
},
|
||||
{
|
||||
icon: "mdi-account-circle",
|
||||
router: "/admrole/",
|
||||
menu_name: "角色管理",
|
||||
roles: null,
|
||||
mould: null,
|
||||
is_top: 0,
|
||||
sort: 0,
|
||||
is_show: 1,
|
||||
parentId: 3,
|
||||
children: null,
|
||||
id: 9,
|
||||
is_delete: 0,
|
||||
},
|
||||
],
|
||||
id: 3,
|
||||
is_delete: 0,
|
||||
},
|
||||
{
|
||||
icon: "mdi-account-cash",
|
||||
router: null,
|
||||
menu_name: "角色接口管理",
|
||||
roles: null,
|
||||
mould: null,
|
||||
is_top: 0,
|
||||
sort: 0,
|
||||
is_show: 1,
|
||||
parentId: 1,
|
||||
children: [
|
||||
{
|
||||
icon: "mdi-clipboard-check-multiple",
|
||||
router: "/AdmMenu/",
|
||||
menu_name: "菜单管理",
|
||||
roles: null,
|
||||
mould: null,
|
||||
is_top: 0,
|
||||
sort: 0,
|
||||
is_show: 1,
|
||||
parentId: 14,
|
||||
children: null,
|
||||
id: 15,
|
||||
is_delete: 0,
|
||||
},
|
||||
{
|
||||
icon: "mdi-circle-slice-8",
|
||||
router: "/admMould/",
|
||||
menu_name: "接口管理",
|
||||
roles: null,
|
||||
mould: null,
|
||||
is_top: 0,
|
||||
sort: 0,
|
||||
is_show: 1,
|
||||
parentId: 14,
|
||||
children: null,
|
||||
id: 20,
|
||||
is_delete: 0,
|
||||
},
|
||||
{
|
||||
icon: "mdi-clipboard-account",
|
||||
router: "/admRoleMenu/",
|
||||
menu_name: "角色菜单分配管理",
|
||||
roles: null,
|
||||
mould: null,
|
||||
is_top: 0,
|
||||
sort: 0,
|
||||
is_show: 1,
|
||||
parentId: 14,
|
||||
children: null,
|
||||
id: 25,
|
||||
is_delete: 0,
|
||||
},
|
||||
],
|
||||
id: 14,
|
||||
is_delete: 0,
|
||||
},
|
||||
{
|
||||
icon: "mdi-clipboard-flow-outline",
|
||||
router: null,
|
||||
menu_name: "路由管理",
|
||||
roles: null,
|
||||
mould: null,
|
||||
is_top: 0,
|
||||
sort: 0,
|
||||
is_show: 1,
|
||||
parentId: 1,
|
||||
children: [
|
||||
{
|
||||
icon: "mdi-account-eye",
|
||||
router: "/userinfo/",
|
||||
menu_name: "用户信息",
|
||||
roles: null,
|
||||
mould: null,
|
||||
is_top: 0,
|
||||
sort: 0,
|
||||
is_show: 1,
|
||||
parentId: 26,
|
||||
children: null,
|
||||
id: 27,
|
||||
is_delete: 0,
|
||||
},
|
||||
{
|
||||
icon: "mdi-account-eye",
|
||||
router: "/pan",
|
||||
menu_name: "云盘管理",
|
||||
roles: null,
|
||||
mould: null,
|
||||
is_top: 0,
|
||||
sort: 0,
|
||||
is_show: 1,
|
||||
parentId: 26,
|
||||
children: null,
|
||||
id: 28,
|
||||
is_delete: 0,
|
||||
},
|
||||
],
|
||||
id: 26,
|
||||
is_delete: 0,
|
||||
},
|
||||
]
|
||||
|
||||
},
|
||||
logout() {
|
||||
this.$store.dispatch("Logout");
|
||||
this.$router.push({ path: "/login" });
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.init();
|
||||
},
|
||||
computed: {
|
||||
image() {
|
||||
return this.$store.getters.image;
|
||||
},
|
||||
gradient() {
|
||||
return this.$store.getters.gradient;
|
||||
},
|
||||
drawerImage() {
|
||||
return this.$store.state.home.drawerImage;
|
||||
},
|
||||
dark() {
|
||||
return this.$store.state.user.dark;
|
||||
},
|
||||
},
|
||||
|
||||
data: () => ({
|
||||
items: [],
|
||||
}),
|
||||
name: "DefaultDrawer",
|
||||
|
||||
components: {
|
||||
DefaultDrawerHeader: () =>
|
||||
import(
|
||||
/* webpackChunkName: "default-drawer-header" */
|
||||
"./widgets/DrawerHeader"
|
||||
),
|
||||
DefaultList: () =>
|
||||
import(
|
||||
/* webpackChunkName: "default-list" */
|
||||
"./List"
|
||||
),
|
||||
},
|
||||
// computed: {
|
||||
// ...get('user', [
|
||||
// 'dark',
|
||||
// 'gradient',
|
||||
// 'image',
|
||||
// ]),
|
||||
// ...get('app', [
|
||||
// 'items',
|
||||
// 'version',
|
||||
// ]),
|
||||
// ...sync('app', [
|
||||
// 'drawer',
|
||||
// 'drawerImage',
|
||||
// 'mini',
|
||||
// ]),
|
||||
// },
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="sass">
|
||||
#default-drawer
|
||||
.v-list-item
|
||||
margin-bottom: 8px
|
||||
|
||||
.v-list-item::before,
|
||||
.v-list-item::after
|
||||
display: none
|
||||
|
||||
.v-list-group__header__prepend-icon,
|
||||
.v-list-item__icon
|
||||
margin-top: 12px
|
||||
margin-bottom: 12px
|
||||
margin-left: 4px
|
||||
|
||||
&.v-navigation-drawer--mini-variant
|
||||
.v-list-item
|
||||
justify-content: flex-start !important
|
||||
</style>
|
||||
22
Yi.Vue2.x/src/layouts/default/Footer.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<v-footer
|
||||
id="default-footer"
|
||||
color="transparent"
|
||||
absolute
|
||||
app
|
||||
inset
|
||||
>
|
||||
<links />
|
||||
</v-footer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Components
|
||||
import Links from '@/components/Links'
|
||||
|
||||
export default {
|
||||
name: 'DefaultFooter',
|
||||
|
||||
components: { Links },
|
||||
}
|
||||
</script>
|
||||
43
Yi.Vue2.x/src/layouts/default/Index.vue
Normal file
@@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<v-app>
|
||||
|
||||
<default-bar />
|
||||
|
||||
<default-drawer />
|
||||
|
||||
<default-view />
|
||||
|
||||
<default-footer />
|
||||
|
||||
<default-settings />
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DefaultLayout',
|
||||
|
||||
components: {
|
||||
DefaultBar: () => import(
|
||||
/* webpackChunkName: "default-app-bar" */
|
||||
'./AppBar'
|
||||
),
|
||||
DefaultDrawer: () => import(
|
||||
/* webpackChunkName: "default-drawer" */
|
||||
'./Drawer'
|
||||
),
|
||||
DefaultFooter: () => import(
|
||||
/* webpackChunkName: "default-footer" */
|
||||
'./Footer'
|
||||
),
|
||||
DefaultSettings: () => import(
|
||||
/* webpackChunkName: "default-settings" */
|
||||
'./Settings'
|
||||
),
|
||||
DefaultView: () => import(
|
||||
/* webpackChunkName: "default-view" */
|
||||
'./View'
|
||||
),
|
||||
},
|
||||
}
|
||||
</script>
|
||||
40
Yi.Vue2.x/src/layouts/default/List.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<v-list
|
||||
expand
|
||||
nav
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<template v-for="(item, i) in items">
|
||||
<default-list-group
|
||||
v-if="item.children"
|
||||
:key="`group-${i}`"
|
||||
:item="item"
|
||||
/>
|
||||
|
||||
<default-list-item
|
||||
v-else
|
||||
:key="`item-${i}`"
|
||||
:item="item"
|
||||
/>
|
||||
</template>
|
||||
</v-list>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DefaultList',
|
||||
|
||||
components: {
|
||||
DefaultListGroup: () => import('./ListGroup'),
|
||||
DefaultListItem: () => import('./ListItem'),
|
||||
},
|
||||
|
||||
props: {
|
||||
items: {
|
||||
type: Array,
|
||||
default: () => ([]),
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
83
Yi.Vue2.x/src/layouts/default/ListGroup.vue
Normal file
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<v-list-group :group="group" :prepend-icon="item.icon" eager v-bind="$attrs">
|
||||
<template v-slot:activator>
|
||||
<v-list-item-icon
|
||||
v-if="!item.icon && !item.avatar"
|
||||
class="text-caption text-uppercase text-center my-2 align-self-center"
|
||||
style="margin-top: 14px"
|
||||
>
|
||||
{{ title }}
|
||||
</v-list-item-icon>
|
||||
|
||||
<v-list-item-avatar v-if="item.avatar">
|
||||
<v-img :src="item.avatar" />
|
||||
</v-list-item-avatar>
|
||||
|
||||
<v-list-item-content v-if="item.menu_name">
|
||||
<v-list-item-title v-text="item.menu_name" />
|
||||
</v-list-item-content>
|
||||
</template>
|
||||
|
||||
<template v-for="(child, i) in item.children">
|
||||
<default-list-group
|
||||
v-if="child.children"
|
||||
:key="`sub-group-${i}`"
|
||||
:item="child"
|
||||
/>
|
||||
|
||||
<default-list-item
|
||||
v-if="!child.children"
|
||||
:key="`child-${i}`"
|
||||
:item="child"
|
||||
/>
|
||||
</template>
|
||||
</v-list-group>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Utilities
|
||||
// import { get } from 'vuex-pathify'
|
||||
|
||||
export default {
|
||||
name: "DefaultListGroup",
|
||||
|
||||
components: {
|
||||
DefaultListItem: () => import("./ListItem"),
|
||||
},
|
||||
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
group() {
|
||||
return this.genGroup(this.item.children);
|
||||
},
|
||||
title() {
|
||||
const matches = this.item.menu_name.match(/\b(\w)/g);
|
||||
if (matches != null) {
|
||||
return matches.join("");
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
genGroup(items) {
|
||||
return items
|
||||
.reduce((acc, cur) => {
|
||||
if (!cur.router) return acc;
|
||||
|
||||
acc.push(
|
||||
cur.children ? this.genGroup(cur.children) : cur.router.slice(1, -1)
|
||||
);
|
||||
|
||||
return acc;
|
||||
}, [])
|
||||
.join("|");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
58
Yi.Vue2.x/src/layouts/default/ListItem.vue
Normal file
@@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<v-list-item
|
||||
:href="item.href"
|
||||
:rel="item.href ? 'nofollow' : undefined"
|
||||
:target="item.href ? '_blank' : undefined"
|
||||
:to="item.router"
|
||||
active-class="primary white--text"
|
||||
link
|
||||
class="py-1"
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<v-list-item-icon
|
||||
v-if="!item.icon"
|
||||
class="text-caption text-uppercase justify-center ml-1 my-2 align-self-center"
|
||||
>
|
||||
{{ title }}
|
||||
</v-list-item-icon>
|
||||
|
||||
<v-list-item-avatar v-if="item.avatar">
|
||||
<v-img :src="item.avatar" />
|
||||
</v-list-item-avatar>
|
||||
|
||||
<v-list-item-icon
|
||||
v-if="item.icon"
|
||||
class="my-2 align-self-center"
|
||||
>
|
||||
<v-icon v-text="item.icon" />
|
||||
</v-list-item-icon>
|
||||
|
||||
<v-list-item-content v-if="item.menu_name">
|
||||
<v-list-item-title v-text="item.menu_name" />
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DefaultListItem',
|
||||
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
title () {
|
||||
const matches = this.item.menu_name.match(/\b(\w)/g)
|
||||
if(matches!=null)
|
||||
{
|
||||
return matches.join('')
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
303
Yi.Vue2.x/src/layouts/default/Settings.vue
Normal file
@@ -0,0 +1,303 @@
|
||||
<template>
|
||||
<div id="settings-wrapper">
|
||||
<v-card
|
||||
id="settings"
|
||||
class="py-2 px-4"
|
||||
color="rgba(0, 0, 0, .3)"
|
||||
dark
|
||||
flat
|
||||
link
|
||||
min-width="100"
|
||||
style="
|
||||
position: fixed;
|
||||
top: 115px;
|
||||
right: -35px;
|
||||
border-radius: 8px;
|
||||
z-index: 1;
|
||||
"
|
||||
>
|
||||
<v-icon large> mdi-cog </v-icon>
|
||||
</v-card>
|
||||
|
||||
<v-menu
|
||||
v-model="menu"
|
||||
:close-on-content-click="false"
|
||||
activator="#settings"
|
||||
bottom
|
||||
content-class="v-settings"
|
||||
left
|
||||
nudge-left="8"
|
||||
offset-x
|
||||
origin="top right"
|
||||
transition="scale-transition"
|
||||
>
|
||||
<v-card class="text-center mb-0" width="300">
|
||||
<v-card-text>
|
||||
<strong class="mb-3 d-inline-block">主题颜色</strong>
|
||||
|
||||
<v-item-group v-model="color" mandatory>
|
||||
<v-item v-for="color in colors" :key="color" :value="color">
|
||||
<template v-slot="{ active, toggle }">
|
||||
<v-avatar
|
||||
:class="active && 'v-settings__item--active'"
|
||||
:color="color"
|
||||
class="v-settings__item mx-1"
|
||||
size="25"
|
||||
@click="toggle"
|
||||
/>
|
||||
</template>
|
||||
</v-item>
|
||||
</v-item-group>
|
||||
|
||||
<v-divider class="my-4 secondary" />
|
||||
|
||||
<strong class="mb-3 d-inline-block">图层颜色</strong>
|
||||
|
||||
<v-item-group v-model="gradient" mandatory>
|
||||
<v-item
|
||||
v-for="(scrim, index) in gradients"
|
||||
:key="scrim"
|
||||
:value="index"
|
||||
class="mx-1"
|
||||
>
|
||||
<template v-slot="{ active, toggle }">
|
||||
<v-avatar
|
||||
:class="active && 'v-settings__item--active'"
|
||||
:color="scrim"
|
||||
class="v-settings__item"
|
||||
size="24"
|
||||
@click="toggle"
|
||||
/>
|
||||
</template>
|
||||
</v-item>
|
||||
</v-item-group>
|
||||
|
||||
<v-divider class="my-4 secondary" />
|
||||
|
||||
<v-row align="center" no-gutters>
|
||||
<v-col cols="auto"> 主题模式 </v-col>
|
||||
|
||||
<v-spacer />
|
||||
|
||||
<v-col cols="auto">
|
||||
<v-switch
|
||||
v-model="$vuetify.theme.dark"
|
||||
class="ma-0 pa-0"
|
||||
color="secondary"
|
||||
hide-details
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-divider class="my-4 secondary" />
|
||||
|
||||
<v-row align="center" no-gutters>
|
||||
<v-col cols="auto"> 迷你菜单 </v-col>
|
||||
|
||||
<v-spacer />
|
||||
|
||||
<v-col cols="auto">
|
||||
<v-switch
|
||||
v-model="$store.state.home.mini"
|
||||
class="ma-0 pa-0"
|
||||
color="secondary"
|
||||
hide-details
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-divider class="my-4 secondary" />
|
||||
|
||||
<v-row align="center" no-gutters>
|
||||
<v-col cols="auto"> 图片菜单 </v-col>
|
||||
|
||||
<v-spacer />
|
||||
|
||||
<v-col cols="auto">
|
||||
<v-switch
|
||||
v-model="drawerImage"
|
||||
class="ma-0 pa-0"
|
||||
color="secondary"
|
||||
hide-details
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-divider class="my-4 secondary" />
|
||||
|
||||
<strong class="mb-3 d-inline-block">图片</strong>
|
||||
|
||||
<v-card :disabled="!drawerImage" flat>
|
||||
<v-item-group
|
||||
v-model="image"
|
||||
class="d-flex justify-space-between mb-3"
|
||||
>
|
||||
<v-item
|
||||
v-for="(img, index) in images"
|
||||
:key="img"
|
||||
:value="index"
|
||||
class="mx-1"
|
||||
>
|
||||
<template v-slot="{ active, toggle }">
|
||||
<v-sheet
|
||||
:class="active && 'v-settings__item--active'"
|
||||
class="d-inline-block v-settings__item"
|
||||
@click="toggle"
|
||||
>
|
||||
<v-img :src="img" height="100" width="50" />
|
||||
</v-sheet>
|
||||
</template>
|
||||
</v-item>
|
||||
</v-item-group>
|
||||
</v-card>
|
||||
|
||||
<v-btn
|
||||
block
|
||||
class="mb-3"
|
||||
color="grey darken-1"
|
||||
dark
|
||||
href="https://github.com/ccnetcore/yi"
|
||||
rel="noopener"
|
||||
target="_blank"
|
||||
>
|
||||
Github 地址
|
||||
</v-btn>
|
||||
|
||||
<v-btn
|
||||
block
|
||||
color="info"
|
||||
href="https://ccnetcore.com"
|
||||
rel="noopener"
|
||||
target="_blank"
|
||||
>
|
||||
加入我们
|
||||
</v-btn>
|
||||
|
||||
<div class="my-12" />
|
||||
|
||||
<div>
|
||||
<strong class="mb-3 d-inline-block">感谢你的支持!</strong>
|
||||
</div>
|
||||
|
||||
<v-btn class="ma-1" color="#55acee" dark rounded>
|
||||
<v-icon>mdi-twitter</v-icon>
|
||||
- 45
|
||||
</v-btn>
|
||||
|
||||
<v-btn class="ma-1" color="#3b5998" dark default rounded>
|
||||
<v-icon>mdi-facebook</v-icon>
|
||||
- 50
|
||||
</v-btn>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-menu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Mixins
|
||||
import Proxyable from "vuetify/lib/mixins/proxyable";
|
||||
|
||||
// Vuex
|
||||
// import { get, sync } from 'vuex-pathify'
|
||||
|
||||
export default {
|
||||
name: "DashboardCoreSettings",
|
||||
|
||||
mixins: [Proxyable],
|
||||
computed: {
|
||||
|
||||
|
||||
gradients(){
|
||||
return this.$store.state.user.gradients},
|
||||
image:{
|
||||
get(){
|
||||
return this.$store.state.user.drawer.image;
|
||||
},
|
||||
set(value){
|
||||
this.$store.commit('SetImage',value)
|
||||
}
|
||||
},
|
||||
gradient:{
|
||||
get(){
|
||||
return this.$store.state.user.drawer.gradient;
|
||||
},
|
||||
set(value){
|
||||
this.$store.commit('SetGradient',value)
|
||||
}
|
||||
},
|
||||
images()
|
||||
{
|
||||
return this.$store.state.user.images;
|
||||
},
|
||||
drawerImage:
|
||||
{
|
||||
get(){
|
||||
return this.$store.state.home.drawerImage;
|
||||
},
|
||||
set(value){
|
||||
this.$store.commit('SetDrawerImage',value)
|
||||
},
|
||||
|
||||
|
||||
|
||||
},
|
||||
dark()
|
||||
{
|
||||
return this.$store.state.user.dark;
|
||||
},
|
||||
drawer()
|
||||
{
|
||||
return this.$store.state.home.drawer;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
data: () => ({
|
||||
color: "#E91E63",
|
||||
colors: ["#9C27b0", "#00CAE3", "#4CAF50", "#ff9800", "#E91E63", "#FF5252"],
|
||||
menu: false,
|
||||
saveImage: "",
|
||||
}),
|
||||
|
||||
// computed: {
|
||||
// ...sync('app', [
|
||||
// 'drawer',
|
||||
// 'drawerImage',
|
||||
// 'mini',
|
||||
// ]),
|
||||
// ...sync('user', [
|
||||
// 'drawer@gradient',
|
||||
// 'drawer@image',
|
||||
// ]),
|
||||
// ...get('user', [
|
||||
// 'images',
|
||||
// 'gradients',
|
||||
// ]),
|
||||
// },
|
||||
|
||||
watch: {
|
||||
color(val) {
|
||||
|
||||
this.$vuetify.theme.themes[this.isDark ? "dark" : "light"].primary = val;
|
||||
this.$vuetify.theme.dark=true;
|
||||
this.$vuetify.theme.dark=false;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="sass">
|
||||
.v-settings
|
||||
.v-item-group > *
|
||||
cursor: pointer
|
||||
|
||||
&__item
|
||||
border-width: 3px
|
||||
border-style: solid
|
||||
border-color: transparent !important
|
||||
|
||||
&--active
|
||||
border-color: #00cae3 !important
|
||||
</style>
|
||||
20
Yi.Vue2.x/src/layouts/default/View.vue
Normal file
@@ -0,0 +1,20 @@
|
||||
<template>
|
||||
<v-main>
|
||||
<v-container fluid>
|
||||
<v-progress-linear
|
||||
:active="this.$store.state.loader.load"
|
||||
:indeterminate="this.$store.state.loader.load"
|
||||
background-color="primary lighten-4"
|
||||
color="primary lighten-1"
|
||||
striped
|
||||
></v-progress-linear>
|
||||
<router-view :key="$route.path" />
|
||||
</v-container>
|
||||
</v-main>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DefaultView',
|
||||
}
|
||||
</script>
|
||||
50
Yi.Vue2.x/src/layouts/default/widgets/Account.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<v-menu
|
||||
bottom
|
||||
left
|
||||
min-width="200"
|
||||
offset-y
|
||||
origin="top right"
|
||||
transition="scale-transition"
|
||||
>
|
||||
<template v-slot:activator="{ attrs, on }">
|
||||
<v-btn class="ml-2" min-width="0" text v-bind="attrs" v-on="on">
|
||||
<!-- <v-icon>mdi-account</v-icon> -->
|
||||
<ccAvatar :size="36" class="elevation-2"></ccAvatar>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<v-list :tile="false" flat nav>
|
||||
<app-bar-item to="/"
|
||||
><v-list-item-title v-text="'用户名:'+$store.state.user.user.username"
|
||||
/></app-bar-item>
|
||||
<app-bar-item to="/"
|
||||
><v-list-item-title v-text="'称号:'+$store.state.user.user.nick"
|
||||
/></app-bar-item>
|
||||
|
||||
<v-divider class="mb-2 mt-2" />
|
||||
|
||||
<template v-for="(p, i) in profile">
|
||||
<v-divider v-if="p.divider" :key="`divider-${i}`" class="mb-2 mt-2" />
|
||||
|
||||
<app-bar-item v-else :key="`item-${i}`" to="/">
|
||||
<v-list-item-title v-text="p.title" />
|
||||
</app-bar-item>
|
||||
</template>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "DefaultAccount",
|
||||
data: () => ({
|
||||
profile: [
|
||||
{ title: "用户信息" },
|
||||
{ title: "设置" },
|
||||
{ divider: true },
|
||||
{ title: "登出" },
|
||||
],
|
||||
}),
|
||||
};
|
||||
</script>
|
||||
39
Yi.Vue2.x/src/layouts/default/widgets/AccountSettings.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<default-list
|
||||
:items="items"
|
||||
class="mb-n2"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DefaultAccountSettings',
|
||||
|
||||
components: {
|
||||
DefaultList: () => import(
|
||||
/* webpackChunkName: "default-list" */
|
||||
'../List'
|
||||
),
|
||||
},
|
||||
|
||||
data: () => ({
|
||||
items: [
|
||||
{
|
||||
title: 'John Leider',
|
||||
icon: 'mdi-vuetify',
|
||||
items: [
|
||||
{
|
||||
title: 'My Profile',
|
||||
},
|
||||
{
|
||||
title: 'Edit Profile',
|
||||
},
|
||||
{
|
||||
title: 'Settings',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}),
|
||||
}
|
||||
</script>
|
||||
29
Yi.Vue2.x/src/layouts/default/widgets/DrawerHeader.vue
Normal file
@@ -0,0 +1,29 @@
|
||||
<template>
|
||||
<v-list-item class="mb-0 justify-space-between pl-3">
|
||||
<v-list-item-avatar>
|
||||
<v-img
|
||||
:src="
|
||||
require('@/assets/vmd.svg')"
|
||||
/>
|
||||
</v-list-item-avatar>
|
||||
|
||||
<v-list-item-content class="pl-2">
|
||||
<v-list-item-title class="text-h3">
|
||||
<strong class="mr-1 font-weight-black">Yi</strong>
|
||||
|
||||
<span class="primary--text">Framework</span>
|
||||
</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Utilities
|
||||
// import { get } from 'vuex-pathify'
|
||||
|
||||
export default {
|
||||
name: 'DefaultDrawerHeader',
|
||||
|
||||
// computed: { version: get('app/version') },
|
||||
}
|
||||
</script>
|
||||
31
Yi.Vue2.x/src/layouts/default/widgets/DrawerToggle.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<v-btn
|
||||
class="ml-3 mr-4"
|
||||
elevation="1"
|
||||
fab
|
||||
small
|
||||
@click="$store.state.home.mini = !$store.state.home.mini"
|
||||
>
|
||||
<v-icon>
|
||||
{{ $store.state.home.mini ? 'mdi-format-list-bulleted' : 'mdi-dots-vertical' }}
|
||||
</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Utilities
|
||||
// import { sync } from 'vuex-pathify'
|
||||
|
||||
export default {
|
||||
|
||||
data:()=>({
|
||||
|
||||
}),
|
||||
name: 'DefaultDrawerToggle',
|
||||
|
||||
computed: {
|
||||
|
||||
// mini: sync('app/mini'),
|
||||
},
|
||||
}
|
||||
</script>
|
||||
17
Yi.Vue2.x/src/layouts/default/widgets/GoHome.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<v-btn
|
||||
class="ml-2"
|
||||
min-width="0"
|
||||
text
|
||||
to="/"
|
||||
exact
|
||||
>
|
||||
<v-icon>mdi-view-dashboard</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DefaultGoHome',
|
||||
}
|
||||
</script>
|
||||
62
Yi.Vue2.x/src/layouts/default/widgets/Notifications.vue
Normal file
@@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<v-menu
|
||||
bottom
|
||||
left
|
||||
offset-y
|
||||
origin="top right"
|
||||
transition="scale-transition"
|
||||
>
|
||||
<template v-slot:activator="{ attrs, on }">
|
||||
<v-btn
|
||||
class="ml-2"
|
||||
min-width="0"
|
||||
text
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
>
|
||||
<v-badge
|
||||
bordered
|
||||
color="red"
|
||||
overlap
|
||||
>
|
||||
<template v-slot:badge>
|
||||
<span>5</span>
|
||||
</template>
|
||||
|
||||
<v-icon>mdi-bell</v-icon>
|
||||
</v-badge>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<v-list
|
||||
flat
|
||||
nav
|
||||
>
|
||||
<app-bar-item
|
||||
v-for="(n, i) in notifications"
|
||||
:key="i"
|
||||
link
|
||||
>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>{{ n }} </v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</app-bar-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DefaultNotifications',
|
||||
|
||||
data: () => ({
|
||||
notifications: [
|
||||
'临时消息1,请检查邮箱',
|
||||
'临时消息2,请检查邮箱',
|
||||
'临时消息3,请检查邮箱',
|
||||
'临时消息4,请检查邮箱',
|
||||
'临时消息5,请检查邮箱',
|
||||
],
|
||||
}),
|
||||
}
|
||||
</script>
|
||||
31
Yi.Vue2.x/src/layouts/default/widgets/Search.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<v-text-field
|
||||
placeholder="全站搜索"
|
||||
class="mr-16"
|
||||
color="secondary"
|
||||
hide-details
|
||||
style="max-width: 400px"
|
||||
>
|
||||
<template
|
||||
v-if="$vuetify.breakpoint.mdAndUp"
|
||||
v-slot:append-outer
|
||||
>
|
||||
<v-btn
|
||||
class="mt-n2 ml-n2"
|
||||
fab
|
||||
small
|
||||
elevation="2"
|
||||
height="44"
|
||||
width="44"
|
||||
>
|
||||
<v-icon>mdi-magnify</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-text-field>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DefaultSearch',
|
||||
}
|
||||
</script>
|
||||
38
Yi.Vue2.x/src/layouts/login/Index.vue
Normal file
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<v-app>
|
||||
<div class="auth-wrapper auth-v1">
|
||||
|
||||
<div class="auth-inner">
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
|
||||
<!-- background triangle shape -->
|
||||
<img
|
||||
class="auth-mask-bg"
|
||||
height="173"
|
||||
:src="
|
||||
require(`@/assets/mask-${$vuetify.theme.dark ? 'dark' : 'light'}.png`)
|
||||
"
|
||||
/>
|
||||
|
||||
<!-- tree -->
|
||||
<v-img
|
||||
class="auth-tree"
|
||||
width="247"
|
||||
height="185"
|
||||
src="@/assets/tree.png"
|
||||
></v-img>
|
||||
|
||||
<!-- tree -->
|
||||
<v-img
|
||||
class="auth-tree-3"
|
||||
width="377"
|
||||
height="289"
|
||||
src="@/assets/tree-3.png"
|
||||
></v-img>
|
||||
</div>
|
||||
</v-app>
|
||||
</template>
|
||||
<style lang="scss">
|
||||
@import "@/styles/auth.scss";
|
||||
</style>
|
||||
24
Yi.Vue2.x/src/main.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import vuetify from './plugins/vuetify'
|
||||
import VuetifyDialog from 'vuetify-dialog'
|
||||
import 'vuetify-dialog/dist/vuetify-dialog.css'
|
||||
import './plugins'
|
||||
import "./permission"
|
||||
import store from './store/index'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
Vue.use(VuetifyDialog, {
|
||||
context: {
|
||||
vuetify
|
||||
}
|
||||
});
|
||||
let vm = new Vue({
|
||||
router,
|
||||
store,
|
||||
vuetify,
|
||||
render: function(h) { return h(App) }
|
||||
}).$mount('#app')
|
||||
|
||||
export default vm;
|
||||
18
Yi.Vue2.x/src/permission.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import router from './router/index'
|
||||
import store from './store/index'
|
||||
// import accountApi from '@/api/accountApi'
|
||||
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
const user = store.state.user.user; //获取是有user
|
||||
if (!user) { //如果没有登入
|
||||
if (to.path == '/login/' || to.path == '/register/' || to.path == '/reset_password/' || to.path == '/qq/') {
|
||||
next();
|
||||
} else {
|
||||
next({ path: '/login/' });
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
|
||||
})
|
||||
20
Yi.Vue2.x/src/plugins/app.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* plugins/app.js
|
||||
*
|
||||
* Automatically loads and bootstraps files
|
||||
* in the `./src/components/` folder.
|
||||
*/
|
||||
|
||||
// Imports
|
||||
import Vue from 'vue'
|
||||
|
||||
const requireComponent = require.context('@/components', true, /\.vue$/)
|
||||
|
||||
for (const file of requireComponent.keys()) {
|
||||
const componentConfig = requireComponent(file)
|
||||
|
||||
Vue.component(
|
||||
componentConfig.default.name,
|
||||
componentConfig.default || componentConfig,
|
||||
)
|
||||
}
|
||||
4
Yi.Vue2.x/src/plugins/chartist.js
Normal file
@@ -0,0 +1,4 @@
|
||||
import Vue from 'vue'
|
||||
import 'chartist/dist/chartist.min.css'
|
||||
|
||||
Vue.use(require('vue-chartist'))
|
||||
6
Yi.Vue2.x/src/plugins/index.js
Normal file
@@ -0,0 +1,6 @@
|
||||
// Automatically included in './src/main.js'
|
||||
|
||||
import './app'
|
||||
import './chartist'
|
||||
// import './webfontloader'
|
||||
// import './vue-meta'
|
||||
39
Yi.Vue2.x/src/plugins/vuetify.js
Normal file
@@ -0,0 +1,39 @@
|
||||
// Vuetify Documentation https://vuetifyjs.com
|
||||
|
||||
import Vue from 'vue'
|
||||
import Vuetify from 'vuetify/lib/framework'
|
||||
import ripple from 'vuetify/lib/directives/ripple'
|
||||
import zhHans from 'vuetify/es5/locale/zh-Hans' // 引入中文语言包
|
||||
import 'typeface-roboto/index.css' // 引入本地的Roboto字体资源
|
||||
import '@mdi/font/css/materialdesignicons.css' // 引入本地的Material Design Icons资源
|
||||
|
||||
|
||||
Vue.use(Vuetify, { directives: { ripple } })
|
||||
|
||||
const theme = {
|
||||
primary: '#E91E63',
|
||||
secondary: '#9C27b0',
|
||||
accent: '#e91e63',
|
||||
info: '#00CAE3',
|
||||
success: '#4CAF50',
|
||||
warning: '#FB8C00',
|
||||
error: '#FF5252',
|
||||
}
|
||||
|
||||
export default new Vuetify({
|
||||
lang:{
|
||||
locales: {zhHans},
|
||||
current: 'zhHans'
|
||||
},
|
||||
breakpoint: { mobileBreakpoint: 960 },
|
||||
icons: {
|
||||
iconfont: 'mdi',
|
||||
values: { expand: 'mdi-menu-down' },
|
||||
},
|
||||
theme: {
|
||||
themes: {
|
||||
dark: theme,
|
||||
light: theme,
|
||||
},
|
||||
},
|
||||
})
|
||||
45
Yi.Vue2.x/src/router/index.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import Vue from 'vue'
|
||||
import VueRouter from 'vue-router'
|
||||
|
||||
|
||||
import { trailingSlash } from '@/util/helpers'
|
||||
import {
|
||||
layout,
|
||||
route,
|
||||
} from '@/util/routes'
|
||||
Vue.use(VueRouter)
|
||||
|
||||
|
||||
|
||||
const router = new VueRouter({
|
||||
mode: 'history',
|
||||
base: process.env.BASE_URL,
|
||||
scrollBehavior: (to, from, savedPosition) => {
|
||||
if (to.hash) return { selector: to.hash }
|
||||
if (savedPosition) return savedPosition
|
||||
|
||||
return { x: 0, y: 0 }
|
||||
},
|
||||
routes: [
|
||||
layout('Default', [
|
||||
route('Index'),
|
||||
route('AdmUser', null, 'AdmUser'),
|
||||
route('AdmRole', null, 'AdmRole'),
|
||||
route('AdmMenu', null, 'AdmMenu'),
|
||||
route('AdmMould', null, 'AdmMould'),
|
||||
route('AdmRoleMenu', null, 'AdmRoleMenu'),
|
||||
route('userInfo', null, 'userInfo'),
|
||||
route('Pan',null,'pan'),
|
||||
route('PanInfo',null,'PanInfo')
|
||||
]),
|
||||
layout('Login', [
|
||||
route('login', null, 'login'),
|
||||
route('register', null, 'register')
|
||||
])
|
||||
|
||||
]
|
||||
})
|
||||
router.beforeEach((to, from, next) => {
|
||||
return to.path.endsWith('/') ? next() : next(trailingSlash(to.path))
|
||||
})
|
||||
export default router
|
||||