├── .gitattributes ├── .gitignore ├── .nuget ├── .tfignore ├── Colder.Admin.AntdVue.sln ├── Directory.Build.props ├── LICENSE ├── README.md ├── clear.bat ├── docs ├── 初始化文件 │ ├── MySQL.sql │ ├── Oracle.sql │ ├── PostgreSQL.sql │ └── SQLServer.sql └── 数据库设计 │ ├── Base_Table.pdm │ └── Base_Table.sws └── src ├── Coldairarrow.Api ├── 05.Coldairarrow.Api.csproj ├── 0_install.bat ├── 0_uninstall.bat ├── BuildCodeTemplate │ ├── Business.txt │ ├── Controller.txt │ ├── EditForm.txt │ ├── IBusiness.txt │ └── List.txt ├── Controllers │ ├── BaseApiController.cs │ ├── BaseController.cs │ ├── Base_Manage │ │ ├── Base_ActionController.cs │ │ ├── Base_AppSecretController.cs │ │ ├── Base_DbLinkController.cs │ │ ├── Base_DepartmentController.cs │ │ ├── Base_RoleController.cs │ │ ├── Base_UserController.cs │ │ ├── Base_UserLogController.cs │ │ ├── BuildCodeController.cs │ │ ├── HomeController.cs │ │ └── UploadController.cs │ └── TestController.cs ├── DependencyInjection │ └── Operator.cs ├── Dockerfile ├── Extentions │ ├── HostExtentions.cs │ └── JwtExtentions.cs ├── Filters │ ├── BaseActionFilterAsync.cs │ ├── FilterExtentions.cs │ ├── 全局错误过滤 │ │ └── GlobalExceptionFilter.cs │ ├── 参数校验 │ │ └── ValidFilterAttribute.cs │ ├── 对外接口签名校验 │ │ ├── CheckSignAttribute.cs │ │ └── IgnoreSignAttribute.cs │ ├── 接口权限 │ │ ├── ApiPermissionAttribute.cs │ │ └── NoApiPermissionAttribute.cs │ └── 格式化返回结果 │ │ ├── FormatResponseAttribute.cs │ │ └── NoFormatResponseAttribute.cs ├── Middlewares │ ├── RequestBody.cs │ ├── RequestBodyMiddleware.cs │ └── RequestLogMiddleware.cs ├── Options │ ├── CacheOptions.cs │ ├── CacheType.cs │ └── JwtOptions.cs ├── Program.cs ├── Properties │ ├── PublishProfiles │ │ └── FolderProfile.pubxml │ └── launchSettings.json ├── Startup.cs ├── appsettings.Development.json ├── appsettings.json ├── nssm.exe └── wwwroot │ └── Upload │ └── _.txt ├── Coldairarrow.Business ├── 04.Coldairarrow.Business.csproj ├── AOP │ ├── DataAddLogAttribute.cs │ ├── DataDeleteLogAttribute.cs │ ├── DataEditLogAttribute.cs │ ├── DataRepeatValidateAttribute.cs │ └── WriteDataLogAttribute.cs ├── BaseBusiness.T.cs ├── Base_Manage │ ├── Base_ActionBusiness.cs │ ├── Base_AppSecretBusiness.cs │ ├── Base_DbLinkBusiness.cs │ ├── Base_DepartmentBusiness.cs │ ├── Base_RoleBusiness.cs │ ├── Base_UserBusiness.cs │ ├── Base_UserLogBusiness.cs │ ├── BuildCodeBusiness.cs │ ├── HomeBusiness.cs │ └── PermissionBusiness.cs └── Cache │ ├── BaseCache.T.cs │ ├── Base_UserCache.cs │ ├── IBaseCache.T.cs │ └── IBase_UserCache.cs ├── Coldairarrow.Entity ├── 02.Coldairarrow.Entity.csproj ├── Base_Manage │ ├── Base_Action.cs │ ├── Base_AppSecret.cs │ ├── Base_DbLink.cs │ ├── Base_Department.cs │ ├── Base_Role.cs │ ├── Base_RoleAction.cs │ ├── Base_User.cs │ ├── Base_UserLog.cs │ └── Base_UserRole.cs ├── DTO │ └── Base_UserDTO.cs └── Enum │ ├── ActionType.cs │ └── RoleTypes.cs ├── Coldairarrow.IBusiness ├── 03.Coldairarrow.IBusiness.csproj ├── Base_Manage │ ├── IBase_ActionBusiness.cs │ ├── IBase_AppSecretBusiness.cs │ ├── IBase_DbLinkBusiness.cs │ ├── IBase_DepartmentBusiness.cs │ ├── IBase_RoleBusiness.cs │ ├── IBase_UserBusiness.cs │ ├── IBase_UserLogBusiness.cs │ ├── IBuildCodeBusiness.cs │ ├── IHomeBusiness.cs │ └── IPermissionBusiness.cs └── IOperator.cs ├── Coldairarrow.Util ├── 01.Coldairarrow.Util.csproj ├── AOP │ ├── Abstraction │ │ ├── BaseAOPAttribute.cs │ │ ├── CastleAOPContext.cs │ │ ├── CastleInterceptor.cs │ │ └── IAOPContext.cs │ └── TransactionalAttribute.cs ├── ClassLibrary │ ├── BloomFilter.cs │ ├── ConsistentHash.cs │ ├── MurmurHash2.cs │ ├── ParentChildrenMapping.cs │ ├── ShareMemory.cs │ ├── TaskQeury.cs │ └── UsingLock.cs ├── DI │ ├── IScopeDependency.cs │ ├── ISingletonDependency.cs │ └── ITransientDependency.cs ├── DataAccess │ ├── DbHelper.cs │ ├── DbHelperFactory.cs │ ├── DbProviderFactoryHelper.cs │ ├── MySqlHelper.cs │ ├── OracleHelper.cs │ ├── PostgreSqlHelper.cs │ └── SqlServerHelper.cs ├── Extention │ ├── Extention.Byte.cs │ ├── Extention.DataTable.cs │ ├── Extention.DateTime.cs │ ├── Extention.Delegate.cs │ ├── Extention.Enum.cs │ ├── Extention.ExpandoObject.cs │ ├── Extention.Expression.cs │ ├── Extention.IEnumerable.cs │ ├── Extention.IQueryable.cs │ ├── Extention.IServiceCollection.cs │ ├── Extention.Int.cs │ ├── Extention.Json.cs │ ├── Extention.Object.cs │ ├── Extention.Stream.cs │ └── Extention.String.cs ├── GlobalAssemblies.cs ├── Helper │ ├── AsyncHelper.cs │ ├── DbSearchHelper.cs │ ├── DelegateHelper.cs │ ├── EncodingHelper.cs │ ├── EnumHelper.cs │ ├── ExceptionHelper.cs │ ├── FileZipHelper.cs │ ├── ImgHelper.cs │ ├── ImgVerifyCodeHelper.cs │ ├── IpHelper.cs │ ├── JobHelper.cs │ ├── LinqHelper.cs │ ├── LoopHelper.cs │ ├── PathHelper.cs │ ├── QRCodeHelper.cs │ ├── RandomHelper.cs │ ├── TreeHelper.cs │ ├── TypeBuilderHelper.cs │ └── XmlHelper.cs └── Primitives │ ├── AjaxResult.T.cs │ ├── AjaxResult.cs │ ├── BusException.cs │ ├── CacheType.cs │ ├── ConditionDTO.cs │ ├── DatabaseOptions.cs │ ├── DbTableInfo.cs │ ├── DeleteMode.cs │ ├── DynamicModel.cs │ ├── ErrorResult.cs │ ├── FileEntry.cs │ ├── IdInputDTO.cs │ ├── JWTPayload.cs │ ├── LogType.cs │ ├── MapAttribute.cs │ ├── OptionListInputDTO.cs │ ├── PageInput.T.cs │ ├── PageInput.cs │ ├── PageResult.cs │ ├── SelectOption.cs │ ├── TableInfo.cs │ └── TreeModel.cs └── Coldairarrow.Web ├── .editorconfig ├── .env ├── .env.preview ├── .gitattributes ├── .gitignore ├── .prettierrc ├── .travis.yml ├── LICENSE ├── babel.config.js ├── config └── plugin.config.js ├── jest.config.js ├── jsconfig.json ├── package-lock.json ├── package.json ├── public ├── Dockerfile ├── avatar2.jpg ├── color.less ├── default.conf ├── index.html ├── loading │ ├── loading.css │ ├── loading.html │ └── option2 │ │ ├── html_code_segment.html │ │ ├── loading.css │ │ └── loading.svg └── logo.png ├── src ├── App.vue ├── assets │ ├── background.svg │ ├── icons │ │ └── bx-analyse.svg │ ├── logo.png │ └── logo.svg ├── components │ ├── CSelect │ │ └── CSelect.vue │ ├── CUploadFile │ │ └── CUploadFile.vue │ ├── CUploadImg │ │ └── CUploadImg.vue │ ├── ChartCard │ │ ├── ChartCard.vue │ │ └── Trend.vue │ ├── Exception │ │ ├── ExceptionPage.vue │ │ ├── index.js │ │ └── type.js │ ├── GlobalFooter │ │ ├── GlobalFooter.vue │ │ └── index.js │ ├── GlobalHeader │ │ ├── GlobalHeader.vue │ │ └── index.js │ ├── IconSelector │ │ ├── IconSelector.vue │ │ ├── README.md │ │ ├── icons.js │ │ └── index.js │ ├── Menu │ │ ├── SideMenu.vue │ │ ├── index.js │ │ ├── menu.js │ │ └── menu.render.js │ ├── MultiTab │ │ ├── MultiTab.vue │ │ ├── index.js │ │ └── index.less │ ├── NoticeIcon │ │ ├── NoticeIcon.vue │ │ └── index.js │ ├── PageHeader │ │ ├── PageHeader.vue │ │ └── index.js │ ├── SettingDrawer │ │ ├── SettingDrawer.vue │ │ ├── SettingItem.vue │ │ ├── index.js │ │ ├── settingConfig.js │ │ └── themeColor.js │ ├── WangEditor │ │ └── WangEditor.vue │ ├── _util │ │ └── util.js │ ├── global.less │ ├── index.js │ ├── index.less │ └── tools │ │ ├── Breadcrumb.vue │ │ ├── ChangePwdForm.vue │ │ ├── DetailList.vue │ │ ├── HeadInfo.vue │ │ ├── Logo.vue │ │ ├── TwoStepCaptcha.vue │ │ ├── UserMenu.vue │ │ └── index.js ├── config │ ├── defaultSettings.js │ └── router.config.js ├── core │ ├── bootstrap.js │ ├── directives │ │ └── action.js │ ├── icons.js │ ├── lazy_lib │ │ └── components_use.js │ ├── lazy_use.js │ └── use.js ├── layouts │ ├── BasicLayout.vue │ ├── BlankLayout.vue │ ├── PageView.vue │ ├── RouteView.vue │ ├── UserLayout.vue │ └── index.js ├── main.js ├── permission.js ├── router │ ├── README.md │ └── index.js ├── store │ ├── getters.js │ ├── index.js │ ├── modules │ │ └── app.js │ └── mutation-types.js ├── utils │ ├── cache │ │ ├── OperatorCache.js │ │ └── TokenCache.js │ ├── device.js │ ├── domUtil.js │ ├── filter.js │ ├── helper │ │ ├── ProcessHelper.js │ │ ├── TreeHelper.js │ │ └── TypeHelper.js │ ├── mixin.js │ ├── plugin │ │ ├── axios-plugin.js │ │ └── operator-plugin.js │ ├── routerUtil.js │ ├── util.js │ └── utils.less └── views │ ├── Base_Manage │ ├── Base_Action │ │ ├── EditForm.vue │ │ ├── List.vue │ │ └── PermissionList.vue │ ├── Base_AppSecret │ │ ├── EditForm.vue │ │ └── List.vue │ ├── Base_DbLink │ │ ├── EditForm.vue │ │ └── List.vue │ ├── Base_Department │ │ ├── EditForm.vue │ │ └── List.vue │ ├── Base_Role │ │ ├── EditForm.vue │ │ └── List.vue │ ├── Base_User │ │ ├── EditForm.vue │ │ └── List.vue │ ├── Base_UserLog │ │ └── List.vue │ └── BuildCode │ │ ├── EditForm.vue │ │ └── List.vue │ ├── Develop │ ├── Editor.vue │ ├── IconSelectorView.vue │ ├── SelectSearch.vue │ ├── UploadFile.vue │ └── UploadImg.vue │ ├── Home │ ├── Introduce.vue │ ├── Login.vue │ └── Statis.vue │ └── exception │ ├── 403.vue │ ├── 404.vue │ └── 500.vue ├── tests └── unit │ └── .eslintrc.js ├── vue.config.js ├── webstorm.config.js └── yarn.lock /.nuget: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.tfignore: -------------------------------------------------------------------------------- 1 | \packages 2 | !\packages\repositories.config -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Coldairarrow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Colder.Admin.AntdVue 2 | Web后台快速开发框架,.NET5+Ant Design Vue版本 3 | 4 | **代码(GitHub):** 5 | **文档(GitHub):** 6 | **代码(码云镜像):** 7 | **文档(码云镜像):** 8 | **在线预览地址**: (账号/密码:Admin 123456) 9 | -------------------------------------------------------------------------------- /clear.bat: -------------------------------------------------------------------------------- 1 | ::删除所有bin与obj下的文件 2 | @echo off 3 | set nowpath=%cd% 4 | cd \ 5 | cd %nowpath% 6 | ::delete specify file(*.pdb,*.vshost.*) 7 | for /r %nowpath% %%i in (*.pdb,*.vshost.*) do (del %%i && echo delete %%i) 8 | 9 | ::delete specify folder(obj,bin) 10 | for /r %nowpath% %%i in (obj,bin) do (IF EXIST %%i (RD /s /q %%i && echo delete %%i)) 11 | 12 | pause -------------------------------------------------------------------------------- /docs/数据库设计/Base_Table.sws: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Coldairarrow.Api/0_install.bat: -------------------------------------------------------------------------------- 1 | cd /d %~dp0 2 | set serviceName="Coldairarrow.Api" 3 | set exePath="Coldairarrow.Api.exe" 4 | nssm install %serviceName% %~dp0\%exePath% 5 | ::参数设置 6 | ::nssm set emqx AppParameters start 7 | nssm start %serviceName% -------------------------------------------------------------------------------- /src/Coldairarrow.Api/0_uninstall.bat: -------------------------------------------------------------------------------- 1 | cd /d %~dp0 2 | set serviceName="Coldairarrow.Api" 3 | nssm stop %serviceName% 4 | nssm remove %serviceName% confirm -------------------------------------------------------------------------------- /src/Coldairarrow.Api/BuildCodeTemplate/Business.txt: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity.%areaName%; 2 | using Coldairarrow.Util; 3 | using EFCore.Sharding; 4 | using LinqKit; 5 | using Microsoft.EntityFrameworkCore; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Linq.Dynamic.Core; 9 | using System.Threading.Tasks; 10 | 11 | namespace Coldairarrow.Business.%areaName% 12 | { 13 | public class %entityName%Business : BaseBusiness<%entityName%>, I%entityName%Business, ITransientDependency 14 | { 15 | public %entityName%Business(IDbAccessor db) 16 | : base(db) 17 | { 18 | } 19 | 20 | #region 外部接口 21 | 22 | public async Task> GetDataListAsync(PageInput input) 23 | { 24 | var q = GetIQueryable(); 25 | var where = LinqHelper.True<%entityName%>(); 26 | var search = input.Search; 27 | 28 | //筛选 29 | if (!search.Condition.IsNullOrEmpty() && !search.Keyword.IsNullOrEmpty()) 30 | { 31 | var newWhere = DynamicExpressionParser.ParseLambda<%entityName%, bool>( 32 | ParsingConfig.Default, false, $@"{search.Condition}.Contains(@0)", search.Keyword); 33 | where = where.And(newWhere); 34 | } 35 | 36 | return await q.Where(where).GetPageResultAsync(input); 37 | } 38 | 39 | public async Task<%entityName%> GetTheDataAsync(string id) 40 | { 41 | return await GetEntityAsync(id); 42 | } 43 | 44 | public async Task AddDataAsync(%entityName% data) 45 | { 46 | await InsertAsync(data); 47 | } 48 | 49 | public async Task UpdateDataAsync(%entityName% data) 50 | { 51 | await UpdateAsync(data); 52 | } 53 | 54 | public async Task DeleteDataAsync(List ids) 55 | { 56 | await DeleteAsync(ids); 57 | } 58 | 59 | #endregion 60 | 61 | #region 私有成员 62 | 63 | #endregion 64 | } 65 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/BuildCodeTemplate/Controller.txt: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Business.%areaName%; 2 | using Coldairarrow.Entity.%areaName%; 3 | using Coldairarrow.Util; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System.Collections.Generic; 6 | using System.Threading.Tasks; 7 | 8 | namespace Coldairarrow.Api.Controllers.%areaName% 9 | { 10 | [Route("/%areaName%/[controller]/[action]")] 11 | public class %entityName%Controller : BaseApiController 12 | { 13 | #region DI 14 | 15 | public %entityName%Controller(I%entityName%Business %busName%) 16 | { 17 | %_busName% = %busName%; 18 | } 19 | 20 | I%entityName%Business %_busName% { get; } 21 | 22 | #endregion 23 | 24 | #region 获取 25 | 26 | [HttpPost] 27 | public async Task> GetDataList(PageInput input) 28 | { 29 | return await %_busName%.GetDataListAsync(input); 30 | } 31 | 32 | [HttpPost] 33 | public async Task<%entityName%> GetTheData(IdInputDTO input) 34 | { 35 | return await %_busName%.GetTheDataAsync(input.id); 36 | } 37 | 38 | #endregion 39 | 40 | #region 提交 41 | 42 | [HttpPost] 43 | public async Task SaveData(%entityName% data) 44 | { 45 | if (data.Id.IsNullOrEmpty()) 46 | { 47 | InitEntity(data); 48 | 49 | await %_busName%.AddDataAsync(data); 50 | } 51 | else 52 | { 53 | await %_busName%.UpdateDataAsync(data); 54 | } 55 | } 56 | 57 | [HttpPost] 58 | public async Task DeleteData(List ids) 59 | { 60 | await %_busName%.DeleteDataAsync(ids); 61 | } 62 | 63 | #endregion 64 | } 65 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/BuildCodeTemplate/EditForm.txt: -------------------------------------------------------------------------------- 1 |  17 | 18 | 79 | -------------------------------------------------------------------------------- /src/Coldairarrow.Api/BuildCodeTemplate/IBusiness.txt: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity.%areaName%; 2 | using Coldairarrow.Util; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | 6 | namespace Coldairarrow.Business.%areaName% 7 | { 8 | public interface I%entityName%Business 9 | { 10 | Task> GetDataListAsync(PageInput input); 11 | Task<%entityName%> GetTheDataAsync(string id); 12 | Task AddDataAsync(%entityName% data); 13 | Task UpdateDataAsync(%entityName% data); 14 | Task DeleteDataAsync(List ids); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Controllers/BaseApiController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | 3 | namespace Coldairarrow.Api 4 | { 5 | /// 6 | /// 对外接口基控制器 7 | /// 8 | [ApiController] 9 | public class BaseApiController : BaseController 10 | { 11 | 12 | } 13 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Controllers/Base_Manage/Base_AppSecretController.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Business.Base_Manage; 2 | using Coldairarrow.Entity.Base_Manage; 3 | using Coldairarrow.Util; 4 | using Microsoft.AspNetCore.Mvc; 5 | using NSwag.Annotations; 6 | using System.Collections.Generic; 7 | using System.Threading.Tasks; 8 | 9 | namespace Coldairarrow.Api.Controllers.Base_Manage 10 | { 11 | /// 12 | /// 应用密钥 13 | /// 14 | /// 15 | [Route("/Base_Manage/[controller]/[action]")] 16 | [OpenApiTag("应用密钥")] 17 | public class Base_AppSecretController : BaseApiController 18 | { 19 | #region DI 20 | 21 | public Base_AppSecretController(IBase_AppSecretBusiness appSecretBus) 22 | { 23 | _appSecretBus = appSecretBus; 24 | } 25 | 26 | IBase_AppSecretBusiness _appSecretBus { get; } 27 | 28 | #endregion 29 | 30 | #region 获取 31 | 32 | [HttpPost] 33 | public async Task> GetDataList(PageInput input) 34 | { 35 | return await _appSecretBus.GetDataListAsync(input); 36 | } 37 | 38 | [HttpPost] 39 | public async Task GetTheData(IdInputDTO input) 40 | { 41 | return await _appSecretBus.GetTheDataAsync(input.id) ?? new Base_AppSecret(); 42 | } 43 | 44 | #endregion 45 | 46 | #region 提交 47 | 48 | /// 49 | /// 保存 50 | /// 51 | /// 保存的数据 52 | [HttpPost] 53 | public async Task SaveData(Base_AppSecret theData) 54 | { 55 | if (theData.Id.IsNullOrEmpty()) 56 | { 57 | InitEntity(theData); 58 | 59 | await _appSecretBus.AddDataAsync(theData); 60 | } 61 | else 62 | { 63 | await _appSecretBus.UpdateDataAsync(theData); 64 | } 65 | } 66 | 67 | /// 68 | /// 删除数据 69 | /// 70 | /// id数组,JSON数组 71 | [HttpPost] 72 | public async Task DeleteData(List ids) 73 | { 74 | await _appSecretBus.DeleteDataAsync(ids); 75 | } 76 | 77 | #endregion 78 | } 79 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Controllers/Base_Manage/Base_DbLinkController.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Business.Base_Manage; 2 | using Coldairarrow.Entity.Base_Manage; 3 | using Coldairarrow.Util; 4 | using Microsoft.AspNetCore.Mvc; 5 | using NSwag.Annotations; 6 | using System.Collections.Generic; 7 | using System.Threading.Tasks; 8 | 9 | namespace Coldairarrow.Api.Controllers.Base_Manage 10 | { 11 | /// 12 | /// 数据库连接 13 | /// 14 | /// 15 | [Route("/Base_Manage/[controller]/[action]")] 16 | [OpenApiTag("数据库连接")] 17 | public class Base_DbLinkController : BaseApiController 18 | { 19 | #region DI 20 | 21 | public Base_DbLinkController(IBase_DbLinkBusiness dbLinkBus) 22 | { 23 | _dbLinkBus = dbLinkBus; 24 | } 25 | 26 | IBase_DbLinkBusiness _dbLinkBus { get; } 27 | 28 | #endregion 29 | 30 | #region 获取 31 | 32 | [HttpPost] 33 | public async Task>> GetDataList(PageInput input) 34 | { 35 | return await _dbLinkBus.GetDataListAsync(input); 36 | } 37 | 38 | [HttpPost] 39 | public async Task GetTheData(IdInputDTO input) 40 | { 41 | return await _dbLinkBus.GetTheDataAsync(input.id) ?? new Base_DbLink(); 42 | } 43 | 44 | #endregion 45 | 46 | #region 提交 47 | 48 | /// 49 | /// 保存 50 | /// 51 | /// 保存的数据 52 | [HttpPost] 53 | public async Task SaveData(Base_DbLink theData) 54 | { 55 | if (theData.Id.IsNullOrEmpty()) 56 | { 57 | InitEntity(theData); 58 | 59 | await _dbLinkBus.AddDataAsync(theData); 60 | } 61 | else 62 | { 63 | await _dbLinkBus.UpdateDataAsync(theData); 64 | } 65 | } 66 | 67 | /// 68 | /// 删除数据 69 | /// 70 | /// id数组,JSON数组 71 | [HttpPost] 72 | public async Task DeleteData(List ids) 73 | { 74 | await _dbLinkBus.DeleteDataAsync(ids); 75 | } 76 | 77 | #endregion 78 | } 79 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Controllers/Base_Manage/Base_DepartmentController.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Business.Base_Manage; 2 | using Coldairarrow.Entity.Base_Manage; 3 | using Coldairarrow.Util; 4 | using Microsoft.AspNetCore.Mvc; 5 | using NSwag.Annotations; 6 | using System.Collections.Generic; 7 | using System.Threading.Tasks; 8 | 9 | namespace Coldairarrow.Api.Controllers.Base_Manage 10 | { 11 | /// 12 | /// 部门 13 | /// 14 | [Route("/Base_Manage/[controller]/[action]")] 15 | [OpenApiTag("部门")] 16 | public class Base_DepartmentController : BaseApiController 17 | { 18 | #region DI 19 | 20 | public Base_DepartmentController(IBase_DepartmentBusiness departmentBus) 21 | { 22 | _departmentBus = departmentBus; 23 | } 24 | 25 | IBase_DepartmentBusiness _departmentBus { get; } 26 | 27 | #endregion 28 | 29 | #region 获取 30 | 31 | [HttpPost] 32 | public async Task GetTheData(IdInputDTO input) 33 | { 34 | return await _departmentBus.GetTheDataAsync(input.id) ?? new Base_Department(); 35 | } 36 | 37 | [HttpPost] 38 | public async Task> GetTreeDataList(DepartmentsTreeInputDTO input) 39 | { 40 | return await _departmentBus.GetTreeDataListAsync(input); 41 | } 42 | 43 | #endregion 44 | 45 | #region 提交 46 | 47 | [HttpPost] 48 | public async Task SaveData(Base_Department theData) 49 | { 50 | if (theData.Id.IsNullOrEmpty()) 51 | { 52 | InitEntity(theData); 53 | 54 | await _departmentBus.AddDataAsync(theData); 55 | } 56 | else 57 | { 58 | await _departmentBus.UpdateDataAsync(theData); 59 | } 60 | } 61 | 62 | [HttpPost] 63 | public async Task DeleteData(List ids) 64 | { 65 | await _departmentBus.DeleteDataAsync(ids); 66 | } 67 | 68 | #endregion 69 | } 70 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Controllers/Base_Manage/Base_RoleController.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Business.Base_Manage; 2 | using Coldairarrow.Util; 3 | using Microsoft.AspNetCore.Mvc; 4 | using NSwag.Annotations; 5 | using System.Collections.Generic; 6 | using System.Threading.Tasks; 7 | 8 | namespace Coldairarrow.Api.Controllers.Base_Manage 9 | { 10 | /// 11 | /// 系统角色 12 | /// 13 | /// 14 | [Route("/Base_Manage/[controller]/[action]")] 15 | [OpenApiTag("系统角色")] 16 | public class Base_RoleController : BaseApiController 17 | { 18 | #region DI 19 | 20 | public Base_RoleController(IBase_RoleBusiness roleBus) 21 | { 22 | _roleBus = roleBus; 23 | } 24 | 25 | IBase_RoleBusiness _roleBus { get; } 26 | 27 | #endregion 28 | 29 | #region 获取 30 | 31 | [HttpPost] 32 | public async Task> GetDataList(PageInput input) 33 | { 34 | return await _roleBus.GetDataListAsync(input); 35 | } 36 | 37 | [HttpPost] 38 | public async Task GetTheData(IdInputDTO input) 39 | { 40 | return await _roleBus.GetTheDataAsync(input.id) ?? new Base_RoleInfoDTO(); 41 | } 42 | 43 | #endregion 44 | 45 | #region 提交 46 | 47 | [HttpPost] 48 | public async Task SaveData(Base_RoleInfoDTO input) 49 | { 50 | if (input.Id.IsNullOrEmpty()) 51 | { 52 | InitEntity(input); 53 | 54 | await _roleBus.AddDataAsync(input); 55 | } 56 | else 57 | { 58 | await _roleBus.UpdateDataAsync(input); 59 | } 60 | } 61 | 62 | [HttpPost] 63 | public async Task DeleteData(List ids) 64 | { 65 | await _roleBus.DeleteDataAsync(ids); 66 | } 67 | 68 | #endregion 69 | } 70 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Controllers/Base_Manage/Base_UserController.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Business.Base_Manage; 2 | using Coldairarrow.Entity; 3 | using Coldairarrow.Util; 4 | using Microsoft.AspNetCore.Mvc; 5 | using NSwag.Annotations; 6 | using System.Collections.Generic; 7 | using System.Threading.Tasks; 8 | 9 | namespace Coldairarrow.Api.Controllers.Base_Manage 10 | { 11 | [Route("/Base_Manage/[controller]/[action]")] 12 | [OpenApiTag("系统用户")] 13 | public class Base_UserController : BaseApiController 14 | { 15 | #region DI 16 | 17 | public Base_UserController(IBase_UserBusiness userBus) 18 | { 19 | _userBus = userBus; 20 | } 21 | 22 | IBase_UserBusiness _userBus { get; } 23 | 24 | #endregion 25 | 26 | #region 获取 27 | 28 | [HttpPost] 29 | public async Task> GetDataList(PageInput input) 30 | { 31 | return await _userBus.GetDataListAsync(input); 32 | } 33 | 34 | [HttpPost] 35 | public async Task GetTheData(IdInputDTO input) 36 | { 37 | return await _userBus.GetTheDataAsync(input.id) ?? new Base_UserDTO(); 38 | } 39 | 40 | [HttpPost] 41 | public async Task> GetOptionList(OptionListInputDTO input) 42 | { 43 | return await _userBus.GetOptionListAsync(input); 44 | } 45 | 46 | #endregion 47 | 48 | #region 提交 49 | 50 | [HttpPost] 51 | public async Task SaveData(UserEditInputDTO input) 52 | { 53 | if (!input.newPwd.IsNullOrEmpty()) 54 | input.Password = input.newPwd.ToMD5String(); 55 | if (input.Id.IsNullOrEmpty()) 56 | { 57 | InitEntity(input); 58 | 59 | await _userBus.AddDataAsync(input); 60 | } 61 | else 62 | { 63 | await _userBus.UpdateDataAsync(input); 64 | } 65 | } 66 | 67 | [HttpPost] 68 | public async Task DeleteData(List ids) 69 | { 70 | await _userBus.DeleteDataAsync(ids); 71 | } 72 | 73 | #endregion 74 | } 75 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Controllers/Base_Manage/Base_UserLogController.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Business.Base_Manage; 2 | using Coldairarrow.Entity.Base_Manage; 3 | using Coldairarrow.Util; 4 | using Microsoft.AspNetCore.Mvc; 5 | using NSwag.Annotations; 6 | using System.Collections.Generic; 7 | using System.Threading.Tasks; 8 | 9 | namespace Coldairarrow.Api.Controllers.Base_Manage 10 | { 11 | [Route("/Base_Manage/[controller]/[action]")] 12 | [OpenApiTag("审计日志")] 13 | public class Base_UserLogController : BaseApiController 14 | { 15 | #region DI 16 | 17 | public Base_UserLogController(IBase_UserLogBusiness logBus) 18 | { 19 | _logBus = logBus; 20 | } 21 | 22 | IBase_UserLogBusiness _logBus { get; } 23 | 24 | #endregion 25 | 26 | #region 获取 27 | 28 | [HttpPost] 29 | public async Task> GetLogList(PageInput input) 30 | { 31 | input.SortField = "CreateTime"; 32 | input.SortType = "desc"; 33 | 34 | return await _logBus.GetLogListAsync(input); 35 | } 36 | 37 | [HttpPost] 38 | public List GetLogTypeList() 39 | { 40 | return EnumHelper.ToOptionList(typeof(UserLogType)); 41 | } 42 | 43 | #endregion 44 | 45 | #region 提交 46 | 47 | #endregion 48 | } 49 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Controllers/Base_Manage/BuildCodeController.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Business.Base_Manage; 2 | using Coldairarrow.Entity.Base_Manage; 3 | using Coldairarrow.Util; 4 | using Microsoft.AspNetCore.Mvc; 5 | using NSwag.Annotations; 6 | using System.Collections.Generic; 7 | 8 | namespace Coldairarrow.Api.Controllers.Base_Manage 9 | { 10 | [Route("/Base_Manage/[controller]/[action]")] 11 | [OpenApiTag("代码生成")] 12 | public class BuildCodeController : BaseApiController 13 | { 14 | #region DI 15 | 16 | public BuildCodeController(IBuildCodeBusiness buildCodeBus) 17 | { 18 | _buildCodeBus = buildCodeBus; 19 | } 20 | 21 | IBuildCodeBusiness _buildCodeBus { get; } 22 | 23 | #endregion 24 | 25 | [HttpPost] 26 | public List GetAllDbLink() 27 | { 28 | return _buildCodeBus.GetAllDbLink(); 29 | } 30 | 31 | [HttpPost] 32 | public List GetDbTableList(DbTablesInputDTO input) 33 | { 34 | return _buildCodeBus.GetDbTableList(input.linkId); 35 | } 36 | 37 | [HttpPost] 38 | public void Build(BuildInputDTO input) 39 | { 40 | _buildCodeBus.Build(input); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Controllers/Base_Manage/UploadController.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Util; 2 | using Microsoft.AspNetCore.Http; 3 | using Microsoft.AspNetCore.Mvc; 4 | using Microsoft.Extensions.Configuration; 5 | using NSwag.Annotations; 6 | using System; 7 | using System.IO; 8 | 9 | namespace Coldairarrow.Api.Controllers.Base_Manage 10 | { 11 | [Route("/Base_Manage/[controller]/[action]")] 12 | [OpenApiTag("上传")] 13 | public class UploadController : BaseApiController 14 | { 15 | readonly IConfiguration _configuration; 16 | public UploadController(IConfiguration configuration) 17 | { 18 | _configuration = configuration; 19 | } 20 | 21 | [HttpPost] 22 | //[AllowAnonymous] 23 | public IActionResult UploadFileByForm(IFormFile formFile) 24 | { 25 | var file = formFile; 26 | if (file == null) 27 | return JsonContent(new { status = "error" }.ToJson()); 28 | 29 | string path = $"/Upload/{Guid.NewGuid().ToString("N")}/{file.FileName}"; 30 | string physicPath = GetAbsolutePath($"~{path}"); 31 | string dir = Path.GetDirectoryName(physicPath); 32 | if (!Directory.Exists(dir)) 33 | Directory.CreateDirectory(dir); 34 | using (FileStream fs = new FileStream(physicPath, FileMode.Create)) 35 | { 36 | file.CopyTo(fs); 37 | } 38 | 39 | string url = $"{_configuration["WebRootUrl"]}{path}"; 40 | var res = new 41 | { 42 | name = file.FileName, 43 | status = "done", 44 | thumbUrl = url, 45 | url = url 46 | }; 47 | 48 | return JsonContent(res.ToJson()); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Controllers/TestController.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity.Base_Manage; 2 | using Coldairarrow.Util; 3 | using EFCore.Sharding; 4 | using Microsoft.AspNetCore.Authorization; 5 | using Microsoft.AspNetCore.Mvc; 6 | using Microsoft.EntityFrameworkCore; 7 | using System; 8 | using System.Linq; 9 | using System.Threading.Tasks; 10 | 11 | namespace Coldairarrow.Api.Controllers 12 | { 13 | [Route("/[controller]/[action]")] 14 | [AllowAnonymous] 15 | public class TestController : BaseController 16 | { 17 | readonly IDbAccessor _repository; 18 | public TestController(IDbAccessor repository) 19 | { 20 | _repository = repository; 21 | } 22 | 23 | [HttpGet] 24 | public async Task PressTest() 25 | { 26 | Base_User base_User = new Base_User 27 | { 28 | Id = Guid.NewGuid().ToString(), 29 | Birthday = DateTime.Now, 30 | CreateTime = DateTime.Now, 31 | CreatorId = Guid.NewGuid().ToString(), 32 | DepartmentId = Guid.NewGuid().ToString(), 33 | Password = Guid.NewGuid().ToString(), 34 | RealName = Guid.NewGuid().ToString(), 35 | Sex = Sex.Man, 36 | UserName = Guid.NewGuid().ToString() 37 | }; 38 | 39 | await _repository.InsertAsync(base_User); 40 | await _repository.UpdateAsync(base_User); 41 | await _repository.GetIQueryable().Where(x => x.Id == base_User.Id).FirstOrDefaultAsync(); 42 | await _repository.DeleteAsync(base_User); 43 | } 44 | 45 | [HttpGet] 46 | public async Task> GetLogList() 47 | { 48 | return await _repository.GetIQueryable().GetPageResultAsync(new PageInput()); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Dockerfile: -------------------------------------------------------------------------------- 1 | #使用阿里云镜像,微软镜像太慢 2 | #FROM docker pull mcr.microsoft.com/dotnet/aspnet:5.0.2 3 | FROM registry.cn-hangzhou.aliyuncs.com/colder-public/aspnet:5.0.2 4 | RUN rm -f /etc/localtime && ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone 5 | WORKDIR /app 6 | COPY . . 7 | EXPOSE 5000 8 | ENTRYPOINT ["dotnet","Coldairarrow.Api.dll"] -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Extentions/JwtExtentions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Authentication.JwtBearer; 2 | using Microsoft.Extensions.Configuration; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using Microsoft.IdentityModel.Tokens; 5 | using System; 6 | using System.Text; 7 | 8 | namespace Coldairarrow.Api 9 | { 10 | public static class JwtExtentions 11 | { 12 | public static IServiceCollection AddJwt(this IServiceCollection services, IConfiguration configuration) 13 | { 14 | services.Configure(configuration.GetSection("jwt")); 15 | var jwtOptions = configuration.GetSection("jwt").Get(); 16 | 17 | services.AddAuthentication(x => 18 | { 19 | x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; 20 | x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; 21 | }).AddJwtBearer(x => 22 | { 23 | x.RequireHttpsMetadata = false; 24 | x.SaveToken = false; 25 | //Token Validation Parameters 26 | x.TokenValidationParameters = new TokenValidationParameters 27 | { 28 | ClockSkew = TimeSpan.Zero,//到时间立即过期 29 | ValidateIssuerSigningKey = true, 30 | //获取或设置要使用的Microsoft.IdentityModel.Tokens.SecurityKey用于签名验证。 31 | IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8. 32 | GetBytes(jwtOptions.Secret)), 33 | ValidateIssuer = false, 34 | ValidateAudience = false, 35 | }; 36 | }); 37 | 38 | return services; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Filters/FilterExtentions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.Filters; 2 | using System.Linq; 3 | 4 | namespace Coldairarrow.Api 5 | { 6 | public static class FilterExtentions 7 | { 8 | /// 9 | /// 是否拥有某过滤器 10 | /// 11 | /// 过滤器类型 12 | /// 上下文 13 | /// 14 | public static bool ContainsFilter(this FilterContext actionExecutingContext) 15 | { 16 | return actionExecutingContext.Filters.Any(x => x.GetType() == typeof(T)); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Filters/全局错误过滤/GlobalExceptionFilter.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Util; 2 | using Microsoft.AspNetCore.Mvc.Filters; 3 | using Microsoft.Extensions.Logging; 4 | using System; 5 | using System.Threading.Tasks; 6 | 7 | namespace Coldairarrow.Api 8 | { 9 | public class GlobalExceptionFilter : BaseActionFilterAsync, IAsyncExceptionFilter 10 | { 11 | readonly ILogger _logger; 12 | public GlobalExceptionFilter(ILogger logger) 13 | { 14 | _logger = logger; 15 | } 16 | 17 | public async Task OnExceptionAsync(ExceptionContext context) 18 | { 19 | Exception ex = context.Exception; 20 | 21 | if (ex is BusException busEx) 22 | { 23 | _logger.LogInformation(busEx.Message); 24 | context.Result = Error(busEx.Message, busEx.ErrorCode); 25 | } 26 | else 27 | { 28 | _logger.LogError(ex, ""); 29 | context.Result = Error("系统繁忙"); 30 | } 31 | 32 | await Task.CompletedTask; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Filters/参数校验/ValidFilterAttribute.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.Filters; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | 5 | namespace Coldairarrow.Api 6 | { 7 | public class ValidFilterAttribute : BaseActionFilterAsync 8 | { 9 | public override async Task OnActionExecuting(ActionExecutingContext context) 10 | { 11 | if (!context.ModelState.IsValid) 12 | { 13 | var msgList = context.ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage); 14 | 15 | context.Result = Error(string.Join(",", msgList)); 16 | } 17 | 18 | await Task.CompletedTask; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Filters/对外接口签名校验/IgnoreSignAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Api 2 | { 3 | /// 4 | /// 忽略接口签名校验 5 | /// 6 | public class IgnoreSignAttribute : BaseActionFilterAsync 7 | { 8 | 9 | } 10 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Filters/接口权限/ApiPermissionAttribute.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Business.Base_Manage; 2 | using Coldairarrow.IBusiness; 3 | using Coldairarrow.Util; 4 | using Microsoft.AspNetCore.Mvc.Filters; 5 | using Microsoft.Extensions.DependencyInjection; 6 | using System; 7 | using System.Threading.Tasks; 8 | 9 | namespace Coldairarrow.Api 10 | { 11 | /// 12 | /// 接口权限校验 13 | /// 14 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)] 15 | public class ApiPermissionAttribute : BaseActionFilterAsync 16 | { 17 | public ApiPermissionAttribute(string permissionValue) 18 | { 19 | if (permissionValue.IsNullOrEmpty()) 20 | throw new Exception("permissionValue不能为空"); 21 | 22 | _permissionValue = permissionValue; 23 | } 24 | 25 | public string _permissionValue { get; } 26 | 27 | /// 28 | /// Action执行之前执行 29 | /// 30 | /// 过滤器上下文 31 | public async override Task OnActionExecuting(ActionExecutingContext context) 32 | { 33 | if (context.ContainsFilter()) 34 | return; 35 | IServiceProvider serviceProvider = context.HttpContext.RequestServices; 36 | IPermissionBusiness _permissionBus = serviceProvider.GetService(); 37 | IOperator _operator = serviceProvider.GetService(); 38 | 39 | var permissions = await _permissionBus.GetUserPermissionValuesAsync(_operator.UserId); 40 | if (!permissions.Contains(_permissionValue)) 41 | context.Result = Error("权限不足!"); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Filters/接口权限/NoApiPermissionAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Api 2 | { 3 | /// 4 | /// 忽略接口权限校验 5 | /// 6 | public class NoApiPermissionAttribute : BaseActionFilterAsync 7 | { 8 | 9 | } 10 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Filters/格式化返回结果/FormatResponseAttribute.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Util; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.AspNetCore.Mvc.Filters; 4 | using System.Threading.Tasks; 5 | 6 | namespace Coldairarrow.Api 7 | { 8 | /// 9 | /// 若Action返回对象为自定义对象,则将其转为JSON 10 | /// 11 | public class FormatResponseAttribute : BaseActionFilterAsync 12 | { 13 | public override async Task OnActionExecuted(ActionExecutedContext context) 14 | { 15 | if (context.ContainsFilter()) 16 | return; 17 | 18 | if (context.Result is EmptyResult) 19 | context.Result = Success(); 20 | else if (context.Result is ObjectResult res) 21 | { 22 | if (res.Value is AjaxResult) 23 | context.Result = JsonContent(res.Value.ToJson()); 24 | else 25 | context.Result = Success(res.Value); 26 | } 27 | 28 | await Task.CompletedTask; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Filters/格式化返回结果/NoFormatResponseAttribute.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.Filters; 2 | using System; 3 | 4 | namespace Coldairarrow.Api 5 | { 6 | /// 7 | /// 返回结果不进行格式化 8 | /// 9 | public class NoFormatResponseAttribute : Attribute, IActionFilter 10 | { 11 | /// 12 | /// Action执行之前执行 13 | /// 14 | /// 过滤器上下文 15 | public void OnActionExecuting(ActionExecutingContext context) 16 | { 17 | 18 | } 19 | 20 | /// 21 | /// Action执行完毕之后执行 22 | /// 23 | /// 24 | public void OnActionExecuted(ActionExecutedContext context) 25 | { 26 | 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Middlewares/RequestBody.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Util; 2 | 3 | namespace Coldairarrow.Api 4 | { 5 | public class RequestBody : IScopedDependency 6 | { 7 | public string Body { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Middlewares/RequestBodyMiddleware.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Util; 2 | using Microsoft.AspNetCore.Http; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Coldairarrow.Api 8 | { 9 | public class RequestBodyMiddleware 10 | { 11 | private readonly RequestDelegate _next; 12 | 13 | public RequestBodyMiddleware(RequestDelegate next) 14 | { 15 | _next = next; 16 | } 17 | 18 | public async Task Invoke(HttpContext context) 19 | { 20 | if ((context.Request.ContentType ?? string.Empty).Contains("application/json")) 21 | { 22 | context.Request.EnableBuffering(); 23 | string body = await context.Request.Body?.ReadToStringAsync(Encoding.UTF8); 24 | context.RequestServices.GetService().Body = body; 25 | } 26 | 27 | await _next(context); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Options/CacheOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Api 2 | { 3 | internal class CacheOptions 4 | { 5 | public CacheType CacheType { get; set; } 6 | public string RedisEndpoint { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Options/CacheType.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Api 2 | { 3 | /// 4 | /// 缓存类型 5 | /// 6 | public enum CacheType 7 | { 8 | /// 9 | /// 使用内存缓存(不支持分布式) 10 | /// 11 | Memory, 12 | 13 | /// 14 | /// 使用Redis缓存(支持分布式) 15 | /// 16 | Redis 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Options/JwtOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Api 2 | { 3 | public class JwtOptions 4 | { 5 | public string Secret { get; set; } 6 | public int AccessExpireHours { get; set; } 7 | public int RefreshExpireHours { get; set; } 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Program.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Util; 2 | using Colder.Logging.Serilog; 3 | using EFCore.Sharding; 4 | using Microsoft.AspNetCore.Hosting; 5 | using Microsoft.Extensions.Configuration; 6 | using Microsoft.Extensions.Hosting; 7 | 8 | namespace Coldairarrow.Api 9 | { 10 | public class Program 11 | { 12 | public static void Main(string[] args) 13 | { 14 | Host.CreateDefaultBuilder(args) 15 | .ConfigureLoggingDefaults() 16 | .UseIdHelper() 17 | .UseCache() 18 | .ConfigureServices((hostContext, services) => 19 | { 20 | services.AddFxServices(); 21 | services.AddAutoMapper(); 22 | services.AddEFCoreSharding(config => 23 | { 24 | config.SetEntityAssemblies(GlobalAssemblies.AllAssemblies); 25 | 26 | var dbOptions = hostContext.Configuration.GetSection("Database:BaseDb").Get(); 27 | 28 | config.UseDatabase(dbOptions.ConnectionString, dbOptions.DatabaseType); 29 | }); 30 | }) 31 | .ConfigureWebHostDefaults(webBuilder => 32 | { 33 | webBuilder.UseStartup(); 34 | }) 35 | .Build() 36 | .Run(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Properties/PublishProfiles/FolderProfile.pubxml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | FileSystem 9 | FileSystem 10 | Release 11 | Any CPU 12 | 13 | True 14 | False 15 | bea1bf0d-b063-4931-89c7-22f92973143a 16 | bin\Release\netcoreapp3.1\publish\ 17 | False 18 | 19 | -------------------------------------------------------------------------------- /src/Coldairarrow.Api/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Coldairarrow.Api": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "launchUrl": "swagger", 7 | "environmentVariables": { 8 | "ASPNETCORE_ENVIRONMENT": "Development" 9 | }, 10 | "applicationUrl": "http://localhost:5000" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Api/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/Coldairarrow.Api/appsettings.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coldairarrow/Colder.Admin.AntdVue/42631fcbe0d8a1355642004f1421f8ee586357e2/src/Coldairarrow.Api/appsettings.json -------------------------------------------------------------------------------- /src/Coldairarrow.Api/nssm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coldairarrow/Colder.Admin.AntdVue/42631fcbe0d8a1355642004f1421f8ee586357e2/src/Coldairarrow.Api/nssm.exe -------------------------------------------------------------------------------- /src/Coldairarrow.Api/wwwroot/Upload/_.txt: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /src/Coldairarrow.Business/04.Coldairarrow.Business.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net5.0 5 | Coldairarrow.Business 6 | Coldairarrow.Business 7 | 8 | 9 | 10 | 1701;1702;CS1591 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Coldairarrow.Business/AOP/DataAddLogAttribute.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.IBusiness; 2 | using Coldairarrow.Util; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using System.Threading.Tasks; 5 | 6 | namespace Coldairarrow.Business 7 | { 8 | public class DataAddLogAttribute : WriteDataLogAttribute 9 | { 10 | public DataAddLogAttribute(UserLogType logType, string nameField, string dataName) 11 | : base(logType, nameField, dataName) 12 | { 13 | } 14 | 15 | public override async Task After(IAOPContext context) 16 | { 17 | var op = context.ServiceProvider.GetService(); 18 | var obj = context.Arguments[0]; 19 | op.WriteUserLog(_logType, $"添加{_dataName}:{obj.GetPropertyValue(_nameField)?.ToString()}"); 20 | 21 | await Task.CompletedTask; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Coldairarrow.Business/AOP/DataDeleteLogAttribute.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.IBusiness; 2 | using Coldairarrow.Util; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Linq.Dynamic.Core; 7 | using System.Threading.Tasks; 8 | 9 | namespace Coldairarrow.Business 10 | { 11 | public class DataDeleteLogAttribute : WriteDataLogAttribute 12 | { 13 | public DataDeleteLogAttribute(UserLogType logType, string nameField, string dataName) 14 | : base(logType, nameField, dataName) 15 | { 16 | } 17 | 18 | private string _names; 19 | public override async Task Befor(IAOPContext context) 20 | { 21 | List ids = context.Arguments[0] as List; 22 | var q = context.InvocationTarget.GetType().GetMethod("GetIQueryable").Invoke(context.InvocationTarget, new object[] { }) as IQueryable; 23 | var deleteList = q.Where("@0.Contains(Id)", ids).CastToList(); 24 | 25 | _names = string.Join(",", deleteList.Select(x => x.GetPropertyValue(_nameField)?.ToString())); 26 | 27 | await Task.CompletedTask; 28 | } 29 | public override async Task After(IAOPContext context) 30 | { 31 | var op = context.ServiceProvider.GetService(); 32 | 33 | op.WriteUserLog(_logType, $"删除{_dataName}:{_names}"); 34 | 35 | await Task.CompletedTask; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Coldairarrow.Business/AOP/DataEditLogAttribute.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.IBusiness; 2 | using Coldairarrow.Util; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using System.Threading.Tasks; 5 | 6 | namespace Coldairarrow.Business 7 | { 8 | public class DataEditLogAttribute : WriteDataLogAttribute 9 | { 10 | public DataEditLogAttribute(UserLogType logType, string nameField, string dataName) 11 | : base(logType, nameField, dataName) 12 | { 13 | } 14 | 15 | public override async Task After(IAOPContext context) 16 | { 17 | var op = context.ServiceProvider.GetService(); 18 | var obj = context.Arguments[0]; 19 | op.WriteUserLog(_logType, $"修改{_dataName}:{obj.GetPropertyValue(_nameField)?.ToString()}"); 20 | 21 | await Task.CompletedTask; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Coldairarrow.Business/AOP/WriteDataLogAttribute.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Util; 2 | using System; 3 | 4 | namespace Coldairarrow.Business 5 | { 6 | public abstract class WriteDataLogAttribute : BaseAOPAttribute 7 | { 8 | public WriteDataLogAttribute(UserLogType logType, string nameField, string dataName) 9 | { 10 | _logType = logType; 11 | _dataName = dataName; 12 | _nameField = nameField; 13 | } 14 | protected UserLogType _logType { get; } 15 | protected string _dataName { get; } 16 | protected string _nameField { get; } 17 | protected Type _entityType { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Coldairarrow.Business/Base_Manage/Base_DbLinkBusiness.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity.Base_Manage; 2 | using Coldairarrow.Util; 3 | using EFCore.Sharding; 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | 7 | namespace Coldairarrow.Business.Base_Manage 8 | { 9 | public class Base_DbLinkBusiness : BaseBusiness, IBase_DbLinkBusiness, ITransientDependency 10 | { 11 | public Base_DbLinkBusiness(IDbAccessor db) 12 | : base(db) 13 | { 14 | } 15 | 16 | #region 外部接口 17 | 18 | public async Task> GetDataListAsync(PageInput input) 19 | { 20 | return await GetIQueryable().GetPageResultAsync(input); 21 | } 22 | 23 | public async Task GetTheDataAsync(string id) 24 | { 25 | return await GetEntityAsync(id); 26 | } 27 | 28 | public async Task AddDataAsync(Base_DbLink newData) 29 | { 30 | await InsertAsync(newData); 31 | } 32 | 33 | public async Task UpdateDataAsync(Base_DbLink theData) 34 | { 35 | await UpdateAsync(theData); 36 | } 37 | 38 | public async Task DeleteDataAsync(List ids) 39 | { 40 | await DeleteAsync(ids); 41 | } 42 | 43 | #endregion 44 | 45 | #region 私有成员 46 | 47 | #endregion 48 | 49 | #region 数据模型 50 | 51 | #endregion 52 | } 53 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Business/Base_Manage/Base_UserLogBusiness.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity.Base_Manage; 2 | using Coldairarrow.Util; 3 | using EFCore.Sharding; 4 | using LinqKit; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | 8 | namespace Coldairarrow.Business.Base_Manage 9 | { 10 | public class Base_UserLogBusiness : BaseBusiness, IBase_UserLogBusiness, ITransientDependency 11 | { 12 | public Base_UserLogBusiness(IDbAccessor db) 13 | : base(db) 14 | { 15 | } 16 | 17 | public async Task> GetLogListAsync(PageInput input) 18 | { 19 | var whereExp = LinqHelper.True(); 20 | var search = input.Search; 21 | if (!search.logContent.IsNullOrEmpty()) 22 | whereExp = whereExp.And(x => x.LogContent.Contains(search.logContent)); 23 | if (!search.logType.IsNullOrEmpty()) 24 | whereExp = whereExp.And(x => x.LogType == search.logType); 25 | if (!search.opUserName.IsNullOrEmpty()) 26 | whereExp = whereExp.And(x => x.CreatorRealName.Contains(search.opUserName)); 27 | if (!search.startTime.IsNullOrEmpty()) 28 | whereExp = whereExp.And(x => x.CreateTime >= search.startTime); 29 | if (!search.endTime.IsNullOrEmpty()) 30 | whereExp = whereExp.And(x => x.CreateTime <= search.endTime); 31 | 32 | return await GetIQueryable().Where(whereExp).GetPageResultAsync(input); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Business/Base_Manage/HomeBusiness.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using Coldairarrow.Business.Cache; 3 | using Coldairarrow.Entity.Base_Manage; 4 | using Coldairarrow.IBusiness; 5 | using Coldairarrow.Util; 6 | using EFCore.Sharding; 7 | using Microsoft.EntityFrameworkCore; 8 | using System.Linq; 9 | using System.Threading.Tasks; 10 | 11 | namespace Coldairarrow.Business.Base_Manage 12 | { 13 | public class HomeBusiness : BaseBusiness, IHomeBusiness, ITransientDependency 14 | { 15 | readonly IOperator _operator; 16 | readonly IMapper _mapper; 17 | private readonly IBase_UserCache _base_UserCache; 18 | public HomeBusiness(IDbAccessor db, IOperator @operator, IMapper mapper, IBase_UserCache base_UserCache) 19 | : base(db) 20 | { 21 | _operator = @operator; 22 | _mapper = mapper; 23 | _base_UserCache = base_UserCache; 24 | } 25 | 26 | public async Task SubmitLoginAsync(LoginInputDTO input) 27 | { 28 | input.password = input.password.ToMD5String(); 29 | var theUser = await GetIQueryable() 30 | .Where(x => x.UserName == input.userName && x.Password == input.password) 31 | .FirstOrDefaultAsync(); 32 | 33 | if (theUser.IsNullOrEmpty()) 34 | throw new BusException("账号或密码不正确!"); 35 | 36 | return theUser.Id; 37 | } 38 | 39 | public async Task ChangePwdAsync(ChangePwdInputDTO input) 40 | { 41 | var theUser = _operator.Property; 42 | if (theUser.Password != input.oldPwd?.ToMD5String()) 43 | throw new BusException("原密码错误!"); 44 | 45 | theUser.Password = input.newPwd.ToMD5String(); 46 | await UpdateAsync(_mapper.Map(theUser)); 47 | 48 | //更新缓存 49 | await _base_UserCache.UpdateCacheAsync(theUser.Id); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Coldairarrow.Business/Cache/BaseCache.T.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Util; 2 | using Microsoft.Extensions.Caching.Distributed; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | 6 | namespace Coldairarrow.Business.Cache 7 | { 8 | public abstract class BaseCache : IBaseCache where T : class 9 | { 10 | readonly IDistributedCache _cache; 11 | public BaseCache(IDistributedCache cache) 12 | { 13 | _cache = cache; 14 | } 15 | 16 | #region 私有成员 17 | 18 | protected abstract Task GetDbDataAsync(string key); 19 | protected string BuildKey(string idKey) 20 | { 21 | return $"Cache_{GetType().FullName}_{idKey}"; 22 | } 23 | 24 | #endregion 25 | 26 | #region 外部接口 27 | 28 | public async Task GetCacheAsync(string idKey) 29 | { 30 | if (idKey.IsNullOrEmpty()) 31 | return null; 32 | 33 | string cacheKey = BuildKey(idKey); 34 | var cache = (await _cache.GetStringAsync(cacheKey))?.ToObject(); 35 | if (cache == null) 36 | { 37 | cache = await GetDbDataAsync(idKey); 38 | if (cache != null) 39 | await _cache.SetStringAsync(cacheKey, cache.ToJson()); 40 | } 41 | 42 | return cache; 43 | } 44 | 45 | public async Task UpdateCacheAsync(string idKey) 46 | { 47 | await _cache.RemoveAsync(BuildKey(idKey)); 48 | } 49 | 50 | public async Task UpdateCacheAsync(List idKeys) 51 | { 52 | foreach (var aKey in idKeys) 53 | { 54 | await UpdateCacheAsync(aKey); 55 | } 56 | } 57 | 58 | #endregion 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Coldairarrow.Business/Cache/Base_UserCache.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Business.Base_Manage; 2 | using Coldairarrow.Entity; 3 | using Coldairarrow.Util; 4 | using Microsoft.Extensions.Caching.Distributed; 5 | using Microsoft.Extensions.DependencyInjection; 6 | using System; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace Coldairarrow.Business.Cache 11 | { 12 | class Base_UserCache : BaseCache, IBase_UserCache, ITransientDependency 13 | { 14 | readonly IServiceProvider _serviceProvider; 15 | public Base_UserCache(IServiceProvider serviceProvider, IDistributedCache cache) 16 | : base(cache) 17 | { 18 | _serviceProvider = serviceProvider; 19 | } 20 | 21 | protected override async Task GetDbDataAsync(string key) 22 | { 23 | PageInput input = new PageInput 24 | { 25 | Search = new Base_UsersInputDTO 26 | { 27 | all = true, 28 | userId = key 29 | } 30 | }; 31 | var list = await _serviceProvider.GetService().GetDataListAsync(input); 32 | 33 | return list.Data.FirstOrDefault(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Coldairarrow.Business/Cache/IBaseCache.T.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | namespace Coldairarrow.Business.Cache 5 | { 6 | public interface IBaseCache where T : class 7 | { 8 | Task GetCacheAsync(string idKey); 9 | Task UpdateCacheAsync(string idKey); 10 | Task UpdateCacheAsync(List idKeys); 11 | } 12 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Business/Cache/IBase_UserCache.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity; 2 | 3 | namespace Coldairarrow.Business.Cache 4 | { 5 | public interface IBase_UserCache : IBaseCache 6 | { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Coldairarrow.Entity/02.Coldairarrow.Entity.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net5.0 5 | Coldairarrow.Entity 6 | Coldairarrow.Entity 7 | 8 | 9 | 10 | 1701;1702;CS1591 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Coldairarrow.Entity/Base_Manage/Base_Action.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace Coldairarrow.Entity.Base_Manage 6 | { 7 | /// 8 | /// 系统权限表 9 | /// 10 | [Table("Base_Action")] 11 | public class Base_Action 12 | { 13 | 14 | /// 15 | /// 主键 16 | /// 17 | [Key, Column(Order = 1)] 18 | public String Id { get; set; } 19 | 20 | /// 21 | /// 创建时间 22 | /// 23 | public DateTime CreateTime { get; set; } 24 | 25 | /// 26 | /// 创建人Id 27 | /// 28 | public String CreatorId { get; set; } 29 | 30 | /// 31 | /// 否已删除 32 | /// 33 | public Boolean Deleted { get; set; } 34 | 35 | /// 36 | /// 父级Id 37 | /// 38 | public String ParentId { get; set; } 39 | 40 | /// 41 | /// 类型,菜单=0,页面=1,权限=2 42 | /// 43 | public ActionType Type { get; set; } 44 | 45 | /// 46 | /// 权限名/菜单名 47 | /// 48 | public String Name { get; set; } 49 | 50 | /// 51 | /// 菜单地址 52 | /// 53 | public String Url { get; set; } 54 | 55 | /// 56 | /// 权限值 57 | /// 58 | public String Value { get; set; } 59 | 60 | /// 61 | /// 是否需要权限(仅页面有效) 62 | /// 63 | public bool NeedAction { get; set; } 64 | 65 | /// 66 | /// 图标 67 | /// 68 | public string Icon { get; set; } 69 | 70 | /// 71 | /// 排序 72 | /// 73 | public int Sort { get; set; } 74 | } 75 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Entity/Base_Manage/Base_AppSecret.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace Coldairarrow.Entity.Base_Manage 6 | { 7 | /// 8 | /// 应用密钥表 9 | /// 10 | [Table("Base_AppSecret")] 11 | public class Base_AppSecret 12 | { 13 | 14 | /// 15 | /// 自然主键 16 | /// 17 | [Key, Column(Order = 1)] 18 | public String Id { get; set; } 19 | 20 | /// 21 | /// 创建时间 22 | /// 23 | public DateTime CreateTime { get; set; } 24 | 25 | /// 26 | /// 创建人Id 27 | /// 28 | public String CreatorId { get; set; } 29 | 30 | /// 31 | /// 否已删除 32 | /// 33 | public Boolean Deleted { get; set; } 34 | 35 | /// 36 | /// 应用Id 37 | /// 38 | public String AppId { get; set; } 39 | 40 | /// 41 | /// 应用密钥 42 | /// 43 | public String AppSecret { get; set; } 44 | 45 | /// 46 | /// 应用名 47 | /// 48 | public String AppName { get; set; } 49 | 50 | } 51 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Entity/Base_Manage/Base_DbLink.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace Coldairarrow.Entity.Base_Manage 6 | { 7 | /// 8 | /// 数据库连接表 9 | /// 10 | [Table("Base_DbLink")] 11 | public class Base_DbLink 12 | { 13 | 14 | /// 15 | /// 自然主键 16 | /// 17 | [Key, Column(Order = 1)] 18 | public String Id { get; set; } 19 | 20 | /// 21 | /// 创建时间 22 | /// 23 | public DateTime CreateTime { get; set; } 24 | 25 | /// 26 | /// 创建人Id 27 | /// 28 | public String CreatorId { get; set; } 29 | 30 | /// 31 | /// 否已删除 32 | /// 33 | public Boolean Deleted { get; set; } 34 | 35 | /// 36 | /// 连接名 37 | /// 38 | public String LinkName { get; set; } 39 | 40 | /// 41 | /// 连接字符串 42 | /// 43 | public String ConnectionStr { get; set; } 44 | 45 | /// 46 | /// 数据库类型 47 | /// 48 | public String DbType { get; set; } 49 | } 50 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Entity/Base_Manage/Base_Department.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace Coldairarrow.Entity.Base_Manage 6 | { 7 | /// 8 | /// 部门表 9 | /// 10 | [Table("Base_Department")] 11 | public class Base_Department 12 | { 13 | 14 | /// 15 | /// 主键 16 | /// 17 | [Key, Column(Order = 1)] 18 | public String Id { get; set; } 19 | 20 | /// 21 | /// 创建时间 22 | /// 23 | public DateTime CreateTime { get; set; } 24 | 25 | /// 26 | /// 创建人Id 27 | /// 28 | public String CreatorId { get; set; } 29 | 30 | /// 31 | /// 否已删除 32 | /// 33 | public Boolean Deleted { get; set; } 34 | 35 | /// 36 | /// 部门名 37 | /// 38 | public String Name { get; set; } 39 | 40 | /// 41 | /// 上级部门Id 42 | /// 43 | public String ParentId { get; set; } 44 | 45 | } 46 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Entity/Base_Manage/Base_Role.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace Coldairarrow.Entity.Base_Manage 6 | { 7 | /// 8 | /// 系统角色表 9 | /// 10 | [Table("Base_Role")] 11 | public class Base_Role 12 | { 13 | 14 | /// 15 | /// 主键 16 | /// 17 | [Key, Column(Order = 1)] 18 | public String Id { get; set; } 19 | 20 | /// 21 | /// 创建时间 22 | /// 23 | public DateTime CreateTime { get; set; } 24 | 25 | /// 26 | /// 创建人Id 27 | /// 28 | public String CreatorId { get; set; } 29 | 30 | /// 31 | /// 否已删除 32 | /// 33 | public Boolean Deleted { get; set; } 34 | 35 | /// 36 | /// 角色名 37 | /// 38 | public String RoleName { get; set; } 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Entity/Base_Manage/Base_RoleAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace Coldairarrow.Entity.Base_Manage 6 | { 7 | /// 8 | /// 角色权限表 9 | /// 10 | [Table("Base_RoleAction")] 11 | public class Base_RoleAction 12 | { 13 | 14 | /// 15 | /// 主键 16 | /// 17 | [Key, Column(Order = 1)] 18 | public String Id { get; set; } 19 | 20 | /// 21 | /// 创建时间 22 | /// 23 | public DateTime CreateTime { get; set; } 24 | 25 | /// 26 | /// 创建人Id 27 | /// 28 | public String CreatorId { get; set; } 29 | 30 | /// 31 | /// 否已删除 32 | /// 33 | public Boolean Deleted { get; set; } 34 | 35 | /// 36 | /// 用户Id 37 | /// 38 | public String RoleId { get; set; } 39 | 40 | /// 41 | /// 权限Id 42 | /// 43 | public String ActionId { get; set; } 44 | 45 | } 46 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Entity/Base_Manage/Base_User.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | 6 | namespace Coldairarrow.Entity.Base_Manage 7 | { 8 | /// 9 | /// 系统用户表 10 | /// 11 | [Table("Base_User")] 12 | public class Base_User 13 | { 14 | 15 | /// 16 | /// 主键 17 | /// 18 | [Key, Column(Order = 1)] 19 | public String Id { get; set; } 20 | 21 | /// 22 | /// 创建时间 23 | /// 24 | public DateTime CreateTime { get; set; } 25 | 26 | /// 27 | /// 创建人Id 28 | /// 29 | public String CreatorId { get; set; } 30 | 31 | /// 32 | /// 否已删除 33 | /// 34 | public Boolean Deleted { get; set; } 35 | 36 | /// 37 | /// 用户名 38 | /// 39 | public String UserName { get; set; } 40 | 41 | /// 42 | /// 密码 43 | /// 44 | public String Password { get; set; } 45 | 46 | /// 47 | /// 姓名 48 | /// 49 | public String RealName { get; set; } 50 | 51 | /// 52 | /// 性别 53 | /// 54 | public Sex Sex { get; set; } 55 | 56 | /// 57 | /// 出生日期 58 | /// 59 | public DateTime? Birthday { get; set; } 60 | 61 | /// 62 | /// 所属部门Id 63 | /// 64 | public String DepartmentId { get; set; } 65 | } 66 | 67 | public enum Sex 68 | { 69 | [Description("男人")] 70 | Man = 1, 71 | 72 | [Description("女人")] 73 | Woman = 0 74 | } 75 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Entity/Base_Manage/Base_UserLog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace Coldairarrow.Entity.Base_Manage 6 | { 7 | /// 8 | /// 操作记录表 9 | /// 10 | [Table("Base_UserLog")] 11 | public class Base_UserLog 12 | { 13 | /// 14 | /// 自然主键 15 | /// 16 | [Key, Column(Order = 1)] 17 | public String Id { get; set; } 18 | 19 | /// 20 | /// 创建时间 21 | /// 22 | public DateTime CreateTime { get; set; } 23 | 24 | /// 25 | /// 创建人Id 26 | /// 27 | public String CreatorId { get; set; } 28 | 29 | /// 30 | /// 创建人姓名 31 | /// 32 | public String CreatorRealName { get; set; } 33 | 34 | /// 35 | /// 日志类型 36 | /// 37 | public String LogType { get; set; } 38 | 39 | /// 40 | /// 日志内容 41 | /// 42 | public String LogContent { get; set; } 43 | } 44 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Entity/Base_Manage/Base_UserRole.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace Coldairarrow.Entity.Base_Manage 6 | { 7 | /// 8 | /// 用户角色表 9 | /// 10 | [Table("Base_UserRole")] 11 | public class Base_UserRole 12 | { 13 | 14 | /// 15 | /// 主键 16 | /// 17 | [Key, Column(Order = 1)] 18 | public String Id { get; set; } 19 | 20 | /// 21 | /// 创建时间 22 | /// 23 | public DateTime CreateTime { get; set; } 24 | 25 | /// 26 | /// 创建人Id 27 | /// 28 | public String CreatorId { get; set; } 29 | 30 | /// 31 | /// 否已删除 32 | /// 33 | public Boolean Deleted { get; set; } 34 | 35 | /// 36 | /// 用户Id 37 | /// 38 | public String UserId { get; set; } 39 | 40 | /// 41 | /// 角色Id 42 | /// 43 | public String RoleId { get; set; } 44 | 45 | } 46 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Entity/DTO/Base_UserDTO.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity.Base_Manage; 2 | using Coldairarrow.Util; 3 | using System.Collections.Generic; 4 | 5 | namespace Coldairarrow.Entity 6 | { 7 | [Map(typeof(Base_User))] 8 | public class Base_UserDTO : Base_User 9 | { 10 | public string RoleNames { get => string.Join(",", RoleNameList ?? new List()); } 11 | public List RoleIdList { get; set; } 12 | public List RoleNameList { get; set; } 13 | public RoleTypes RoleType 14 | { 15 | get 16 | { 17 | int type = 0; 18 | 19 | var values = typeof(RoleTypes).GetEnumValues(); 20 | foreach (var aValue in values) 21 | { 22 | if (RoleNames.Contains(aValue.ToString())) 23 | type += (int)aValue; 24 | } 25 | 26 | return (RoleTypes)type; 27 | } 28 | } 29 | public string DepartmentName { get; set; } 30 | public string SexText { get => Sex.GetDescription(); } 31 | public string BirthdayText { get => Birthday?.ToString("yyyy-MM-dd"); } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Coldairarrow.Entity/Enum/ActionType.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Entity 2 | { 3 | /// 4 | /// 类型,菜单=0,页面=1,权限=2 5 | /// 6 | public enum ActionType 7 | { 8 | 菜单 = 0, 9 | 页面 = 1, 10 | 权限 = 2 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Coldairarrow.Entity/Enum/RoleTypes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Coldairarrow.Entity 4 | { 5 | /// 6 | /// 系统角色类型 7 | /// 8 | [Flags] 9 | public enum RoleTypes 10 | { 11 | 超级管理员 = 1, 12 | 部门管理员 = 2 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Coldairarrow.IBusiness/03.Coldairarrow.IBusiness.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | Coldairarrow.IBusiness 6 | Coldairarrow.IBusiness 7 | 8 | 9 | 10 | 1701;1702;CS1591 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Coldairarrow.IBusiness/Base_Manage/IBase_ActionBusiness.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity; 2 | using Coldairarrow.Entity.Base_Manage; 3 | using Coldairarrow.Util; 4 | using Newtonsoft.Json; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Threading.Tasks; 8 | 9 | namespace Coldairarrow.Business.Base_Manage 10 | { 11 | public interface IBase_ActionBusiness 12 | { 13 | Task> GetDataListAsync(Base_ActionsInputDTO input); 14 | Task> GetTreeDataListAsync(Base_ActionsInputDTO input); 15 | Task GetTheDataAsync(string id); 16 | Task AddDataAsync(ActionEditInputDTO input); 17 | Task UpdateDataAsync(ActionEditInputDTO input); 18 | Task DeleteDataAsync(List ids); 19 | } 20 | 21 | [Map(typeof(Base_Action))] 22 | public class ActionEditInputDTO : Base_Action 23 | { 24 | public List permissionList { get; set; } = new List(); 25 | } 26 | 27 | public class Base_ActionsInputDTO 28 | { 29 | public string[] ActionIds { get; set; } 30 | public string parentId { get; set; } 31 | public ActionType[] types { get; set; } 32 | public bool selectable { get; set; } 33 | public bool checkEmptyChildren { get; set; } 34 | } 35 | 36 | public class Base_ActionDTO : TreeModel 37 | { 38 | public ActionType Type { get; set; } 39 | public String Url { get; set; } 40 | public string path { get => Url; } 41 | public bool NeedAction { get; set; } 42 | public string TypeText { get => ((ActionType)Type).ToString(); } 43 | public string NeedActionText { get => NeedAction ? "是" : "否"; } 44 | public object children { get => Children; } 45 | public string title { get => Text; } 46 | public string value { get => Id; } 47 | public string key { get => Id; } 48 | public bool selectable { get; set; } 49 | [JsonIgnore] 50 | public string Icon { get; set; } 51 | public string icon { get => Icon; } 52 | public int Sort { get; set; } 53 | public List PermissionValues { get; set; } 54 | } 55 | } -------------------------------------------------------------------------------- /src/Coldairarrow.IBusiness/Base_Manage/IBase_AppSecretBusiness.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity.Base_Manage; 2 | using Coldairarrow.Util; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | 6 | namespace Coldairarrow.Business.Base_Manage 7 | { 8 | public interface IBase_AppSecretBusiness 9 | { 10 | Task> GetDataListAsync(PageInput input); 11 | Task GetTheDataAsync(string id); 12 | Task GetAppSecretAsync(string appId); 13 | Task AddDataAsync(Base_AppSecret newData); 14 | Task UpdateDataAsync(Base_AppSecret theData); 15 | Task DeleteDataAsync(List ids); 16 | } 17 | 18 | public class AppSecretsInputDTO 19 | { 20 | public string keyword { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Coldairarrow.IBusiness/Base_Manage/IBase_DbLinkBusiness.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity.Base_Manage; 2 | using Coldairarrow.Util; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | 6 | namespace Coldairarrow.Business.Base_Manage 7 | { 8 | public interface IBase_DbLinkBusiness 9 | { 10 | Task> GetDataListAsync(PageInput input); 11 | Task GetTheDataAsync(string id); 12 | Task AddDataAsync(Base_DbLink newData); 13 | Task UpdateDataAsync(Base_DbLink theData); 14 | Task DeleteDataAsync(List ids); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Coldairarrow.IBusiness/Base_Manage/IBase_DepartmentBusiness.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity.Base_Manage; 2 | using Coldairarrow.Util; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | 6 | namespace Coldairarrow.Business.Base_Manage 7 | { 8 | public interface IBase_DepartmentBusiness 9 | { 10 | Task> GetTreeDataListAsync(DepartmentsTreeInputDTO input); 11 | Task GetTheDataAsync(string id); 12 | Task> GetChildrenIdsAsync(string departmentId); 13 | Task AddDataAsync(Base_Department newData); 14 | Task UpdateDataAsync(Base_Department theData); 15 | Task DeleteDataAsync(List ids); 16 | } 17 | 18 | public class DepartmentsTreeInputDTO 19 | { 20 | public string parentId { get; set; } 21 | } 22 | 23 | public class Base_DepartmentTreeDTO : TreeModel 24 | { 25 | public object children { get => Children; } 26 | public string title { get => Text; } 27 | public string value { get => Id; } 28 | public string key { get => Id; } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Coldairarrow.IBusiness/Base_Manage/IBase_RoleBusiness.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity; 2 | using Coldairarrow.Entity.Base_Manage; 3 | using Coldairarrow.Util; 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | 7 | namespace Coldairarrow.Business.Base_Manage 8 | { 9 | public interface IBase_RoleBusiness 10 | { 11 | Task> GetDataListAsync(PageInput input); 12 | Task GetTheDataAsync(string id); 13 | Task AddDataAsync(Base_RoleInfoDTO input); 14 | Task UpdateDataAsync(Base_RoleInfoDTO input); 15 | Task DeleteDataAsync(List ids); 16 | } 17 | 18 | public class RolesInputDTO 19 | { 20 | public string roleId { get; set; } 21 | public string roleName { get; set; } 22 | } 23 | 24 | [Map(typeof(Base_Role))] 25 | public class Base_RoleInfoDTO : Base_Role 26 | { 27 | public RoleTypes? RoleType { get => RoleName?.ToEnum(); } 28 | public List Actions { get; set; } = new List(); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Coldairarrow.IBusiness/Base_Manage/IBase_UserBusiness.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity; 2 | using Coldairarrow.Entity.Base_Manage; 3 | using Coldairarrow.Util; 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | 7 | namespace Coldairarrow.Business.Base_Manage 8 | { 9 | public interface IBase_UserBusiness 10 | { 11 | Task> GetDataListAsync(PageInput input); 12 | Task> GetOptionListAsync(OptionListInputDTO input); 13 | Task GetTheDataAsync(string id); 14 | Task AddDataAsync(UserEditInputDTO input); 15 | Task UpdateDataAsync(UserEditInputDTO input); 16 | Task DeleteDataAsync(List ids); 17 | } 18 | 19 | [Map(typeof(Base_User))] 20 | public class UserEditInputDTO : Base_User 21 | { 22 | public string newPwd { get; set; } 23 | public List RoleIdList { get; set; } 24 | } 25 | 26 | public class Base_UsersInputDTO 27 | { 28 | public bool all { get; set; } 29 | public string userId { get; set; } 30 | public string keyword { get; set; } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Coldairarrow.IBusiness/Base_Manage/IBase_UserLogBusiness.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity.Base_Manage; 2 | using Coldairarrow.Util; 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | namespace Coldairarrow.Business.Base_Manage 7 | { 8 | public interface IBase_UserLogBusiness 9 | { 10 | Task> GetLogListAsync(PageInput input); 11 | } 12 | 13 | public class UserLogsInputDTO 14 | { 15 | public string logContent { get; set; } 16 | public string logType { get; set; } 17 | public string opUserName { get; set; } 18 | public DateTime? startTime { get; set; } 19 | public DateTime? endTime { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Coldairarrow.IBusiness/Base_Manage/IBuildCodeBusiness.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity.Base_Manage; 2 | using Coldairarrow.Util; 3 | using System.Collections.Generic; 4 | 5 | namespace Coldairarrow.Business.Base_Manage 6 | { 7 | public interface IBuildCodeBusiness 8 | { 9 | List GetAllDbLink(); 10 | 11 | List GetDbTableList(string linkId); 12 | 13 | void Build(BuildInputDTO input); 14 | } 15 | 16 | public class DbTablesInputDTO 17 | { 18 | public string linkId { get; set; } 19 | } 20 | 21 | public class BuildInputDTO 22 | { 23 | public string linkId { get; set; } 24 | public string areaName { get; set; } 25 | public List tables { get; set; } 26 | public List buildTypes { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Coldairarrow.IBusiness/Base_Manage/IHomeBusiness.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.Threading.Tasks; 3 | 4 | namespace Coldairarrow.Business.Base_Manage 5 | { 6 | public interface IHomeBusiness 7 | { 8 | Task SubmitLoginAsync(LoginInputDTO input); 9 | Task ChangePwdAsync(ChangePwdInputDTO input); 10 | } 11 | 12 | public class LoginInputDTO 13 | { 14 | [Required] 15 | public string userName { get; set; } 16 | 17 | [Required] 18 | public string password { get; set; } 19 | } 20 | 21 | public class ChangePwdInputDTO 22 | { 23 | [Required] 24 | public string oldPwd { get; set; } 25 | 26 | [Required] 27 | public string newPwd { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Coldairarrow.IBusiness/Base_Manage/IPermissionBusiness.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | namespace Coldairarrow.Business.Base_Manage 5 | { 6 | public interface IPermissionBusiness 7 | { 8 | Task> GetUserPermissionValuesAsync(string userId); 9 | Task> GetUserMenuListAsync(string userId); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Coldairarrow.IBusiness/IOperator.cs: -------------------------------------------------------------------------------- 1 | using Coldairarrow.Entity; 2 | using Coldairarrow.Util; 3 | 4 | namespace Coldairarrow.IBusiness 5 | { 6 | /// 7 | /// 操作者 8 | /// 9 | public interface IOperator 10 | { 11 | /// 12 | /// 当前操作者UserId 13 | /// 14 | string UserId { get; } 15 | 16 | Base_UserDTO Property { get; } 17 | 18 | #region 操作方法 19 | 20 | /// 21 | /// 判断是否为超级管理员 22 | /// 23 | /// 24 | bool IsAdmin(); 25 | 26 | /// 27 | /// 记录操作日志 28 | /// 29 | /// 用户日志类型 30 | /// 内容 31 | void WriteUserLog(UserLogType userLogType, string msg); 32 | 33 | #endregion 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/01.Coldairarrow.Util.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net5.0 5 | Coldairarrow.Util 6 | Coldairarrow.Util 7 | 8 | 9 | 10 | 1701;1702;CS1591 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/AOP/Abstraction/BaseAOPAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Coldairarrow.Util 5 | { 6 | /// 7 | /// AOP基类 8 | /// 注:不支持控制器,需要定义接口并实现接口,自定义AOP特性放到接口实现类上 9 | /// 10 | public abstract class BaseAOPAttribute : Attribute 11 | { 12 | public virtual async Task Befor(IAOPContext context) 13 | { 14 | await Task.CompletedTask; 15 | } 16 | 17 | public virtual async Task After(IAOPContext context) 18 | { 19 | await Task.CompletedTask; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/AOP/Abstraction/CastleAOPContext.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using System; 3 | using System.Reflection; 4 | 5 | namespace Coldairarrow.Util 6 | { 7 | public class CastleAOPContext : IAOPContext 8 | { 9 | private readonly IInvocation _invocation; 10 | public CastleAOPContext(IInvocation invocation, IServiceProvider serviceProvider) 11 | { 12 | _invocation = invocation; 13 | ServiceProvider = serviceProvider; 14 | } 15 | public IServiceProvider ServiceProvider { get; } 16 | 17 | public object[] Arguments => _invocation.Arguments; 18 | 19 | public Type[] GenericArguments => _invocation.GenericArguments; 20 | 21 | public MethodInfo Method => _invocation.Method; 22 | 23 | public MethodInfo MethodInvocationTarget => _invocation.MethodInvocationTarget; 24 | 25 | public object Proxy => _invocation.Proxy; 26 | 27 | public object ReturnValue { get => _invocation.ReturnValue; set => _invocation.ReturnValue = value; } 28 | 29 | public Type TargetType => _invocation.TargetType; 30 | 31 | public object InvocationTarget => _invocation.InvocationTarget; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/AOP/Abstraction/CastleInterceptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Castle.DynamicProxy; 6 | 7 | namespace Coldairarrow.Util 8 | { 9 | internal class CastleInterceptor : AsyncInterceptorBase 10 | { 11 | private readonly IServiceProvider _serviceProvider; 12 | public CastleInterceptor(IServiceProvider serviceProvider) 13 | { 14 | _serviceProvider = serviceProvider; 15 | } 16 | 17 | private IAOPContext _aopContext; 18 | private List _aops; 19 | private async Task Befor() 20 | { 21 | foreach (var aAop in _aops) 22 | { 23 | await aAop.Befor(_aopContext); 24 | } 25 | } 26 | private async Task After() 27 | { 28 | foreach (var aAop in _aops) 29 | { 30 | await aAop.After(_aopContext); 31 | } 32 | } 33 | private void Init(IInvocation invocation) 34 | { 35 | _aopContext = new CastleAOPContext(invocation, _serviceProvider); 36 | 37 | _aops = invocation.MethodInvocationTarget.GetCustomAttributes(typeof(BaseAOPAttribute), true) 38 | .Concat(invocation.InvocationTarget.GetType().GetCustomAttributes(typeof(BaseAOPAttribute), true)) 39 | .Select(x => (BaseAOPAttribute)x) 40 | .ToList(); 41 | } 42 | 43 | protected override async Task InterceptAsync(IInvocation invocation, Func proceed) 44 | { 45 | Init(invocation); 46 | 47 | await Befor(); 48 | await proceed(invocation); 49 | await After(); 50 | } 51 | 52 | protected override async Task InterceptAsync(IInvocation invocation, Func> proceed) 53 | { 54 | Init(invocation); 55 | 56 | TResult result; 57 | 58 | await Befor(); 59 | result = await proceed(invocation); 60 | await After(); 61 | 62 | return result; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/AOP/Abstraction/IAOPContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace Coldairarrow.Util 5 | { 6 | public interface IAOPContext 7 | { 8 | IServiceProvider ServiceProvider { get; } 9 | object[] Arguments { get; } 10 | Type[] GenericArguments { get; } 11 | MethodInfo Method { get; } 12 | MethodInfo MethodInvocationTarget { get; } 13 | object Proxy { get; } 14 | object ReturnValue { get; set; } 15 | Type TargetType { get; } 16 | object InvocationTarget { get; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/DI/IScopeDependency.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | /// 4 | /// 注入标记,生命周期为Scope 5 | /// 6 | public interface IScopedDependency 7 | { 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/DI/ISingletonDependency.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | /// 4 | /// 注入标记,生命周期为Singleton 5 | /// 6 | public interface ISingletonDependency 7 | { 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/DI/ITransientDependency.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | /// 4 | /// 注入标记,生命周期为Transient 5 | /// 6 | public interface ITransientDependency 7 | { 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/DataAccess/DbHelperFactory.cs: -------------------------------------------------------------------------------- 1 | using EFCore.Sharding; 2 | using System; 3 | 4 | namespace Coldairarrow.Util 5 | { 6 | /// 7 | /// 数据库帮助类工厂 8 | /// 9 | public class DbHelperFactory 10 | { 11 | /// 12 | /// 获取指定的数据库帮助类 13 | /// 14 | /// 数据库类型 15 | /// 连接字符串 16 | /// 17 | public static DbHelper GetDbHelper(DatabaseType dbType, string conString) 18 | { 19 | switch (dbType) 20 | { 21 | case DatabaseType.SqlServer: return new SqlServerHelper(conString); 22 | case DatabaseType.MySql: return new MySqlHelper(conString); 23 | case DatabaseType.Oracle: return new OracleHelper(conString); 24 | case DatabaseType.PostgreSql: return new PostgreSqlHelper(conString); 25 | default: throw new Exception("暂不支持"); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Extention/Extention.Delegate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Coldairarrow.Util 4 | { 5 | /// 6 | /// 拓展方法静态类 7 | /// 8 | public static partial class Extention 9 | { 10 | /// 11 | /// 异步,按顺序执行第一个方法和第二个方法 12 | /// 13 | /// 第一个方法 14 | /// 下一个方法 15 | public static void Done(this Action firstFunc, Action next) 16 | { 17 | DelegateHelper.RunAsync(firstFunc, next); 18 | } 19 | 20 | /// 21 | /// 异步,按顺序执行第一个方法和下一个方法 22 | /// 23 | /// 第一个方法 24 | /// 下一个方法 25 | public static void Done(this Func firstFunc, Action next) 26 | { 27 | DelegateHelper.RunAsync(firstFunc, next); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Extention/Extention.Enum.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Linq; 4 | 5 | namespace Coldairarrow.Util 6 | { 7 | /// 8 | /// 拓展类 9 | /// 10 | public static partial class Extention 11 | { 12 | /// 13 | /// 获取枚举描述 14 | /// 15 | /// 枚举值 16 | /// 17 | public static string GetDescription(this Enum value) 18 | { 19 | DescriptionAttribute attribute = value.GetType() 20 | .GetField(value.ToString()) 21 | .GetCustomAttributes(typeof(DescriptionAttribute), false) 22 | .SingleOrDefault() as DescriptionAttribute; 23 | return attribute == null ? value.ToString() : attribute.Description; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Extention/Extention.Int.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Coldairarrow.Util 4 | { 5 | public static partial class Extention 6 | { 7 | /// 8 | /// int转Ascll字符 9 | /// 10 | /// 11 | /// 12 | public static string ToAscllStr(this int ascllCode) 13 | { 14 | if (ascllCode >= 0 && ascllCode <= 255) 15 | { 16 | System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding(); 17 | byte[] byteArray = new byte[] { (byte)ascllCode }; 18 | string strCharacter = asciiEncoding.GetString(byteArray); 19 | return (strCharacter); 20 | } 21 | else 22 | { 23 | throw new Exception("ASCII Code is not valid."); 24 | } 25 | } 26 | 27 | /// 28 | /// jsGetTime转为DateTime 29 | /// 30 | /// js中Date.getTime() 31 | /// 32 | public static DateTime ToDateTime_From_JsGetTime(this long jsGetTime) 33 | { 34 | DateTime dtStart = new DateTime(1970, 1, 1).ToLocalTime(); 35 | long lTime = long.Parse(jsGetTime + "0000"); //说明下,时间格式为13位后面补加4个"0",如果时间格式为10位则后面补加7个"0",至于为什么我也不太清楚,也是仿照人家写的代码转换的 36 | TimeSpan toNow = new TimeSpan(lTime); 37 | DateTime dtResult = dtStart.Add(toNow); //得到转换后的时间 38 | 39 | return dtResult; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Extention/Extention.Json.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Serialization; 3 | using System; 4 | 5 | namespace Coldairarrow.Util 6 | { 7 | /// 8 | /// 拓展类 9 | /// 10 | public static class JsonExtention 11 | { 12 | static JsonExtention() 13 | { 14 | JsonConvert.DefaultSettings = () => DefaultJsonSetting; 15 | } 16 | public static JsonSerializerSettings DefaultJsonSetting = new JsonSerializerSettings 17 | { 18 | ContractResolver = new DefaultContractResolver(), 19 | DateFormatHandling = DateFormatHandling.MicrosoftDateFormat, 20 | DateFormatString = "yyyy-MM-dd HH:mm:ss.fff" 21 | }; 22 | 23 | /// 24 | /// 将对象序列化成Json字符串 25 | /// 26 | /// 需要序列化的对象 27 | /// 28 | public static string ToJson(this object obj) 29 | { 30 | return JsonConvert.SerializeObject(obj); 31 | } 32 | 33 | /// 34 | /// 将Json字符串反序列化为对象 35 | /// 36 | /// 对象类型 37 | /// Json字符串 38 | /// 39 | public static T ToObject(this string jsonStr) 40 | { 41 | return JsonConvert.DeserializeObject(jsonStr); 42 | } 43 | 44 | /// 45 | /// 将Json字符串反序列化为对象 46 | /// 47 | /// json字符串 48 | /// 对象类型 49 | /// 50 | public static object ToObject(this string jsonStr, Type type) 51 | { 52 | return JsonConvert.DeserializeObject(jsonStr, type); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Extention/Extention.Stream.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Text; 3 | using System.Threading.Tasks; 4 | 5 | namespace Coldairarrow.Util 6 | { 7 | public static partial class Extention 8 | { 9 | /// 10 | /// 将流读为字符串 11 | /// 注:默认使用UTF-8编码 12 | /// 13 | /// 流 14 | /// 指定编码 15 | /// 16 | public static async Task ReadToStringAsync(this Stream stream, Encoding encoding = null) 17 | { 18 | if (!stream.CanRead) 19 | { 20 | return string.Empty; 21 | } 22 | if (encoding == null) 23 | encoding = Encoding.UTF8; 24 | 25 | if (stream.CanSeek) 26 | { 27 | stream.Seek(0, SeekOrigin.Begin); 28 | } 29 | 30 | string resStr = string.Empty; 31 | resStr = await new StreamReader(stream, encoding).ReadToEndAsync(); 32 | 33 | if (stream.CanSeek) 34 | { 35 | stream.Seek(0, SeekOrigin.Begin); 36 | } 37 | 38 | return resStr; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/GlobalAssemblies.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Reflection; 4 | 5 | namespace Coldairarrow.Util 6 | { 7 | public static class GlobalAssemblies 8 | { 9 | /// 10 | /// 解决方案所有程序集 11 | /// 12 | public static readonly Assembly[] AllAssemblies = new Assembly[] 13 | { 14 | Assembly.Load("Coldairarrow.Util"), 15 | Assembly.Load("Coldairarrow.Entity"), 16 | Assembly.Load("Coldairarrow.IBusiness"), 17 | Assembly.Load("Coldairarrow.Business"), 18 | Assembly.Load("Coldairarrow.Api"), 19 | }; 20 | 21 | /// 22 | /// 解决方案所有自定义类 23 | /// 24 | public static readonly Type[] AllTypes = AllAssemblies.SelectMany(x => x.GetTypes()).ToArray(); 25 | 26 | /// 27 | /// 超级管理员UserIId 28 | /// 29 | public const string ADMINID = "Admin"; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Helper/AsyncHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | namespace Coldairarrow.Util 6 | { 7 | /// 8 | /// 异步转同步,防止ASP.NET中死锁 9 | /// https://cpratt.co/async-tips-tricks/ 10 | /// 11 | public static class AsyncHelper 12 | { 13 | private static readonly TaskFactory _myTaskFactory = 14 | new TaskFactory(CancellationToken.None, TaskCreationOptions.None, TaskContinuationOptions.None, TaskScheduler.Default); 15 | 16 | /// 17 | /// 同步执行 18 | /// 19 | /// 任务 20 | public static void RunSync(Func func) 21 | { 22 | _myTaskFactory.StartNew(func).Unwrap().GetAwaiter().GetResult(); 23 | } 24 | 25 | /// 26 | /// 同步执行 27 | /// 28 | /// 返回类型 29 | /// 任务 30 | /// 31 | public static TResult RunSync(Func> func) 32 | { 33 | return _myTaskFactory.StartNew(func).Unwrap().GetAwaiter().GetResult(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Helper/DelegateHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Coldairarrow.Util 5 | { 6 | /// 7 | /// 委托帮助类 8 | /// 9 | public class DelegateHelper 10 | { 11 | /// 12 | /// 异步执行方法 13 | /// 14 | /// 首先执行的方法 15 | /// 接下来执行的方法 16 | public static void RunAsync(Action firstFunc, Action next) 17 | { 18 | Task firstTask = new Task(() => 19 | { 20 | firstFunc(); 21 | }); 22 | 23 | firstTask.Start(); 24 | firstTask.ContinueWith(x => next()); 25 | } 26 | 27 | /// 28 | /// 异步执行方法 29 | /// 30 | /// 首先执行的方法 31 | /// 接下来执行的方法 32 | public static void RunAsync(Func firstFunc, Action next) 33 | { 34 | Task firstTask = new Task(() => 35 | { 36 | return firstFunc(); 37 | }); 38 | 39 | firstTask.Start(); 40 | firstTask.ContinueWith(x => next(x.Result)); 41 | } 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Helper/EnumHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace Coldairarrow.Util 6 | { 7 | public static class EnumHelper 8 | { 9 | /// 10 | /// 将枚举类型转为选项列表 11 | /// 注:value为值,text为显示内容 12 | /// 13 | /// 枚举类型 14 | /// 15 | public static List ToOptionList(Type enumType) 16 | { 17 | var values = Enum.GetValues(enumType); 18 | List list = new List(); 19 | foreach (var aValue in values) 20 | { 21 | list.Add(new SelectOption 22 | { 23 | value = ((int)aValue).ToString(), 24 | text = aValue.ToString() 25 | }); 26 | } 27 | 28 | return list; 29 | } 30 | 31 | /// 32 | /// 多选枚举转为对应文本,逗号隔开 33 | /// 34 | /// 多个值 35 | /// 枚举类型 36 | /// 37 | public static string ToMultipleText(List values, Type enumType) 38 | { 39 | if (values == null) 40 | return string.Empty; 41 | 42 | List textList = new List(); 43 | 44 | var allValues = Enum.GetValues(enumType); 45 | foreach (var aValue in allValues) 46 | { 47 | if (values.Contains((int)aValue)) 48 | textList.Add(aValue.ToString()); 49 | } 50 | 51 | return string.Join(",", textList); 52 | } 53 | 54 | /// 55 | /// 多选枚举转为对应文本,逗号隔开 56 | /// 57 | /// 多个值逗号隔开 58 | /// 枚举类型 59 | /// 60 | public static string ToMultipleText(string values, Type enumType) 61 | { 62 | return ToMultipleText(values?.Split(',')?.Select(x => x.ToInt())?.ToList(), enumType); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Helper/ExceptionHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Text; 4 | 5 | namespace Coldairarrow.Util 6 | { 7 | /// 8 | /// 异常处理帮助类 9 | /// 10 | public static class ExceptionHelper 11 | { 12 | /// 13 | /// 获取异常位置 14 | /// 15 | /// 异常 16 | /// 17 | private static string GetExceptionAddr(Exception e) 18 | { 19 | StringBuilder excAddrBuilder = new StringBuilder(); 20 | e?.StackTrace?.Split("\r\n".ToArray())?.ToList()?.ForEach(item => 21 | { 22 | if (item.Contains("行号") || item.Contains("line")) 23 | excAddrBuilder.Append($" {item}\r\n"); 24 | }); 25 | 26 | string addr = excAddrBuilder.ToString(); 27 | 28 | return addr.IsNullOrEmpty() ? " 无" : addr; 29 | } 30 | 31 | /// 32 | /// 获取异常消息 33 | /// 34 | /// 捕捉的异常 35 | /// 内部异常层级 36 | /// 37 | private static string GetExceptionAllMsg(Exception ex, int level) 38 | { 39 | StringBuilder builder = new StringBuilder(); 40 | builder.Append($@" 41 | {level}层错误: 42 | 消息: 43 | {ex?.Message} 44 | 位置: 45 | {GetExceptionAddr(ex)} 46 | "); 47 | if (ex.InnerException != null) 48 | { 49 | builder.Append(GetExceptionAllMsg(ex.InnerException, level + 1)); 50 | } 51 | 52 | return builder.ToString(); 53 | } 54 | 55 | /// 56 | /// 获取异常消息 57 | /// 58 | /// 捕捉的异常 59 | /// 60 | public static string GetExceptionAllMsg(Exception ex) 61 | { 62 | string msg = GetExceptionAllMsg(ex, 1); 63 | // try 64 | // { 65 | // msg += $@" 66 | ////url:{HttpContextCore.Current.Request.GetDisplayUrl()} 67 | ////body:{HttpContextCore.Current.Request.Body.ReadToString()} 68 | //"; 69 | // } 70 | // catch 71 | // { 72 | 73 | // } 74 | return msg; 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Helper/FileZipHelper.cs: -------------------------------------------------------------------------------- 1 | using ICSharpCode.SharpZipLib.Zip; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | 6 | namespace Coldairarrow.Util 7 | { 8 | /// 9 | /// 文件压缩帮助类 10 | /// 11 | public class FileZipHelper 12 | { 13 | /// 14 | /// 压缩一个文件 15 | /// 16 | /// 文件信息 17 | /// 18 | public static byte[] ZipFile(FileEntry file) 19 | { 20 | return ZipFile(new List { file }); 21 | } 22 | 23 | /// 24 | /// 压缩多个文件 25 | /// 26 | /// 文件信息列表 27 | /// 28 | public static byte[] ZipFile(List files) 29 | { 30 | using (MemoryStream ms = new MemoryStream()) 31 | { 32 | using (ZipOutputStream zipStream = new ZipOutputStream(ms)) 33 | { 34 | files.ForEach(aFile => 35 | { 36 | byte[] fileBytes = aFile.FileBytes; 37 | ZipEntry entry = new ZipEntry(aFile.FileName) 38 | { 39 | DateTime = DateTime.Now, 40 | IsUnicodeText = true 41 | }; 42 | zipStream.PutNextEntry(entry); 43 | zipStream.Write(fileBytes, 0, fileBytes.Length); 44 | zipStream.CloseEntry(); 45 | }); 46 | 47 | zipStream.IsStreamOwner = false; 48 | zipStream.Finish(); 49 | zipStream.Close(); 50 | ms.Position = 0; 51 | 52 | return ms.ToArray(); 53 | } 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Helper/LinqHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | 4 | namespace Coldairarrow.Util 5 | { 6 | /// 7 | /// Linq操作帮助类 8 | /// 9 | public static class LinqHelper 10 | { 11 | /// 12 | /// 创建初始条件为True的表达式 13 | /// 14 | /// 15 | /// 16 | public static Expression> True() 17 | { 18 | return x => true; 19 | } 20 | 21 | /// 22 | /// 创建初始条件为False的表达式 23 | /// 24 | /// 25 | /// 26 | public static Expression> False() 27 | { 28 | return x => false; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Helper/LoopHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Coldairarrow.Util 4 | { 5 | /// 6 | /// 循环帮助类 7 | /// 8 | public class LoopHelper 9 | { 10 | /// 11 | /// 循环指定次数 12 | /// 13 | /// 循环次数 14 | /// 执行的方法 15 | public static void Loop(int count,Action method) 16 | { 17 | for (int i = 0; i < count; i++) 18 | { 19 | method(); 20 | } 21 | } 22 | 23 | /// 24 | /// 循环指定次数 25 | /// 26 | /// 循环次数 27 | /// 执行的方法 28 | public static void Loop(int count, Action method) 29 | { 30 | for (int i = 0; i < count; i++) 31 | { 32 | method(i); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Helper/PathHelper.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | public static class PathHelper 4 | { 5 | /// 6 | /// 获取Url 7 | /// 8 | /// 虚拟Url 9 | /// 10 | public static string GetUrl(string virtualUrl) 11 | { 12 | //if (!virtualUrl.IsNullOrEmpty()) 13 | //{ 14 | // UrlHelper urlHelper = new UrlHelper(AutofacHelper.GetScopeService().ActionContext); 15 | 16 | // return urlHelper.Content(virtualUrl); 17 | //} 18 | //else 19 | throw new System.Exception(); 20 | } 21 | 22 | /// 23 | /// 获取绝对路径 24 | /// 25 | /// 虚拟路径 26 | /// 27 | public static string GetAbsolutePath(string virtualPath) 28 | { 29 | //string path = virtualPath.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); 30 | //if (path[0] == '~') 31 | // path = path.Remove(0, 2); 32 | //string rootPath = AutofacHelper.GetScopeService().WebRootPath; 33 | 34 | //return Path.Combine(rootPath, path); 35 | 36 | throw new System.Exception(); 37 | } 38 | 39 | /// 40 | /// 获取项目代码根目录 41 | /// 42 | /// 43 | public static string GetProjectRootpath() 44 | { 45 | //return AutofacHelper.GetScopeService().ContentRootPath; 46 | throw new System.Exception(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Helper/RandomHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace Coldairarrow.Util 7 | { 8 | /// 9 | /// Random随机数帮助类 10 | /// 11 | public static class RandomHelper 12 | { 13 | private static Random _random { get; } = new Random(); 14 | 15 | /// 16 | /// 下一个随机数 17 | /// 18 | /// 最小值 19 | /// 最大值 20 | /// 21 | public static int Next(int minValue, int maxValue) 22 | { 23 | return _random.Next(minValue, maxValue); 24 | } 25 | 26 | /// 27 | /// 下一个随机值 28 | /// 29 | /// 值类型 30 | /// 值的集合 31 | /// 32 | public static T Next(IEnumerable source) 33 | { 34 | return source.ToList()[Next(0, source.Count())]; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Helper/XmlHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Xml.Serialization; 4 | 5 | namespace Coldairarrow.Util 6 | { 7 | /// 8 | /// XML文档操作帮助类 9 | /// 10 | public class XmlHelper 11 | { 12 | /// 13 | /// 序列化为XML字符串 14 | /// 15 | /// 对象 16 | /// 17 | public static string Serialize(object obj) 18 | { 19 | Type type = obj.GetType(); 20 | MemoryStream Stream = new MemoryStream(); 21 | XmlSerializer xml = new XmlSerializer(type); 22 | try 23 | { 24 | //序列化对象 25 | xml.Serialize(Stream, obj); 26 | } 27 | catch (InvalidOperationException) 28 | { 29 | throw; 30 | } 31 | Stream.Position = 0; 32 | StreamReader sr = new StreamReader(Stream); 33 | string str = sr.ReadToEnd(); 34 | 35 | sr.Dispose(); 36 | Stream.Dispose(); 37 | 38 | return str; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/AjaxResult.T.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | /// 4 | /// Ajax请求结果 5 | /// 6 | public class AjaxResult : AjaxResult 7 | { 8 | /// 9 | /// 返回数据 10 | /// 11 | public T Data { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/AjaxResult.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | /// 4 | /// Ajax请求结果 5 | /// 6 | public class AjaxResult 7 | { 8 | /// 9 | /// 是否成功 10 | /// 11 | public bool Success { get; set; } = true; 12 | 13 | /// 14 | /// 错误代码 15 | /// 16 | public int ErrorCode { get; set; } 17 | 18 | /// 19 | /// 返回消息 20 | /// 21 | public string Msg { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/BusException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Coldairarrow.Util 4 | { 5 | /// 6 | /// 业务异常 7 | /// 注:并不会当作真正的异常处理,仅为方便返回前端错误提示信息 8 | /// 9 | public class BusException : Exception 10 | { 11 | /// 12 | /// 错误代码 13 | /// 14 | public int ErrorCode { get; set; } 15 | 16 | /// 17 | /// 构造函数 18 | /// 19 | public BusException() 20 | { 21 | 22 | } 23 | 24 | /// 25 | /// 构造函数 26 | /// 27 | /// 错误信息 28 | public BusException(string message) 29 | : base(message) 30 | { 31 | 32 | } 33 | 34 | /// 35 | /// 构造函数 36 | /// 37 | /// 错误信息 38 | /// 错误代码 39 | public BusException(string message, int errorCode) 40 | : base(message) 41 | { 42 | ErrorCode = errorCode; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/CacheType.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | /// 4 | /// 缓存类型 5 | /// 6 | public enum CacheType 7 | { 8 | /// 9 | /// 使用内存缓存(不支持分布式) 10 | /// 11 | Memory, 12 | 13 | /// 14 | /// 使用Redis缓存(支持分布式) 15 | /// 16 | Redis 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/ConditionDTO.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | /// 4 | /// 通用条件查询DTO 5 | /// 6 | public class ConditionDTO 7 | { 8 | public string Condition { get; set; } 9 | public string Keyword { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/DatabaseOptions.cs: -------------------------------------------------------------------------------- 1 | using EFCore.Sharding; 2 | 3 | namespace Coldairarrow.Util 4 | { 5 | public class DatabaseOptions 6 | { 7 | public string ConnectionString { get; set; } 8 | public DatabaseType DatabaseType { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/DbTableInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | /// 4 | /// 数据库所有表的信息 5 | /// 6 | public class DbTableInfo 7 | { 8 | /// 9 | /// 表名 10 | /// 11 | public string TableName { get; set; } 12 | 13 | /// 14 | /// 表描述说明 15 | /// 16 | public string Description 17 | { 18 | get 19 | { 20 | return _description.IsNullOrEmpty() ? TableName : _description; 21 | } 22 | set 23 | { 24 | _description = value; 25 | } 26 | } 27 | 28 | private string _description { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/DeleteMode.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | /// 4 | /// 删除模式 5 | /// 6 | public enum DeleteMode 7 | { 8 | /// 9 | /// 物理删除,即直接从数据库删除 10 | /// 11 | Physic, 12 | 13 | /// 14 | /// 逻辑删除,即仅将Deleted字段置为true 15 | /// 16 | Logic 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/DynamicModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Coldairarrow.Util 4 | { 5 | /// 6 | /// 动态数据模型类 7 | /// 8 | public class DynamicModel : Dictionary 9 | { 10 | /// 11 | /// 索引器 12 | /// 13 | public new object this[string key] 14 | { 15 | get 16 | { 17 | return GetProperty(key); 18 | } 19 | set 20 | { 21 | AddProperty(key, value); 22 | } 23 | } 24 | 25 | /// 26 | /// 添加属性 27 | /// 28 | /// 属性名 29 | /// 属性值 30 | public void AddProperty(string key, object obj) 31 | { 32 | if (ContainsKey(key)) 33 | base[key] = obj; 34 | else 35 | Add(key, obj); 36 | } 37 | 38 | /// 39 | /// 设置属性值 40 | /// 41 | /// 属性名 42 | /// 属性值 43 | public void SetProperty(string key, object obj) 44 | { 45 | if (ContainsKey(key)) 46 | base[key] = obj; 47 | else 48 | Add(key, obj); 49 | } 50 | 51 | /// 52 | /// 获取属性值 53 | /// 54 | /// 属性名 55 | /// 56 | public object GetProperty(string key) 57 | { 58 | if (ContainsKey(key)) 59 | return base[key]; 60 | else 61 | return null; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/ErrorResult.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | public class ErrorResult : AjaxResult 4 | { 5 | public ErrorResult(string msg = "操作失败!", int errorCode = 0) 6 | { 7 | Msg = msg; 8 | Success = false; 9 | ErrorCode = errorCode; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/FileEntry.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | /// 4 | /// 文件信息 5 | /// 6 | public struct FileEntry 7 | { 8 | public FileEntry(string fileName,byte[] fileBytes) 9 | { 10 | FileName = fileName; 11 | FileBytes = fileBytes; 12 | } 13 | 14 | /// 15 | /// 文件名 16 | /// 17 | public string FileName { get; set; } 18 | 19 | /// 20 | /// 文件字节 21 | /// 22 | public byte[] FileBytes { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/IdInputDTO.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | public class IdInputDTO 4 | { 5 | /// 6 | /// id 7 | /// 8 | public string id { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/JWTPayload.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Coldairarrow.Util 4 | { 5 | public class JWTPayload 6 | { 7 | public string UserId { get; set; } 8 | public DateTime Expire { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/LogType.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | /// 4 | /// 系统日志类型 5 | /// 6 | public enum UserLogType 7 | { 8 | 系统异常, 9 | 系统用户管理, 10 | 系统角色管理, 11 | 接口密钥管理, 12 | 部门管理 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/MapAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Coldairarrow.Util 4 | { 5 | public class MapAttribute : Attribute 6 | { 7 | public MapAttribute(params Type[] targetTypes) 8 | { 9 | TargetTypes = targetTypes; 10 | } 11 | public Type[] TargetTypes { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/OptionListInputDTO.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Coldairarrow.Util 4 | { 5 | public class OptionListInputDTO 6 | { 7 | public List selectedValues { get; set; } 8 | public string q { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/PageInput.T.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | public class PageInput : PageInput where T : new() 4 | { 5 | public T Search { get; set; } = new T(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/PageInput.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | /// 4 | /// 分页查询基类 5 | /// 6 | public class PageInput 7 | { 8 | private string _sortType { get; set; } = "asc"; 9 | 10 | /// 11 | /// 当前页码 12 | /// 13 | public int PageIndex { get; set; } = 1; 14 | 15 | /// 16 | /// 每页行数 17 | /// 18 | public int PageRows { get; set; } = int.MaxValue; 19 | 20 | /// 21 | /// 排序列 22 | /// 23 | public string SortField { get; set; } = "Id"; 24 | 25 | /// 26 | /// 排序类型 27 | /// 28 | public string SortType { get => _sortType; set => _sortType = (value ?? string.Empty).ToLower().Contains("desc") ? "desc" : "asc"; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/PageResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Coldairarrow.Util 4 | { 5 | /// 6 | /// 分页返回结果 7 | /// 8 | /// 9 | public class PageResult : AjaxResult> 10 | { 11 | /// 12 | /// 总记录数 13 | /// 14 | public int Total { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/SelectOption.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | /// 4 | /// 前端SelectOption 5 | /// 6 | public class SelectOption 7 | { 8 | public string value { get; set; } 9 | public string text { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/TableInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Coldairarrow.Util 2 | { 3 | /// 4 | /// 数据库表信息 5 | /// 6 | public class TableInfo 7 | { 8 | /// 9 | /// 字段Id 10 | /// 11 | public int ColumnId { get; set; } 12 | 13 | /// 14 | /// 字段名 15 | /// 16 | public string Name { get; set; } 17 | 18 | /// 19 | /// 字段类型 20 | /// 21 | public string Type { get; set; } 22 | 23 | /// 24 | /// 是否为主键 25 | /// 26 | public bool IsKey { get; set; } 27 | 28 | /// 29 | /// 是否为空 30 | /// 31 | public bool IsNullable { get; set; } 32 | 33 | /// 34 | /// 字段描述说明 35 | /// 36 | public string Description 37 | { 38 | get 39 | { 40 | return _description.IsNullOrEmpty() ? Name : _description; 41 | } 42 | set 43 | { 44 | _description = value; 45 | } 46 | } 47 | 48 | private string _description { get; set; } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Coldairarrow.Util/Primitives/TreeModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Coldairarrow.Util 4 | { 5 | /// 6 | /// 树模型(可以作为父类) 7 | /// 8 | public class TreeModel 9 | { 10 | /// 11 | /// 唯一标识Id 12 | /// 13 | public string Id { get; set; } 14 | 15 | /// 16 | /// 数据值 17 | /// 18 | public string Value { get; set; } 19 | 20 | /// 21 | /// 父Id 22 | /// 23 | public string ParentId { get; set; } 24 | 25 | /// 26 | /// 节点深度 27 | /// 28 | public int? Level { get; set; } = 1; 29 | 30 | /// 31 | /// 显示的内容 32 | /// 33 | public string Text { get; set; } 34 | 35 | /// 36 | /// 孩子节点 37 | /// 38 | public List Children { get; set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | charset=utf-8 3 | end_of_line=lf 4 | insert_final_newline=false 5 | indent_style=space 6 | indent_size=2 7 | 8 | [{*.ng,*.sht,*.html,*.shtm,*.shtml,*.htm}] 9 | indent_style=space 10 | indent_size=2 11 | 12 | [{*.jhm,*.xslt,*.xul,*.rng,*.xsl,*.xsd,*.ant,*.tld,*.fxml,*.jrxml,*.xml,*.jnlp,*.wsdl}] 13 | indent_style=space 14 | indent_size=2 15 | 16 | [{.babelrc,.stylelintrc,jest.config,.eslintrc,.prettierrc,*.json,*.jsb3,*.jsb2,*.bowerrc}] 17 | indent_style=space 18 | indent_size=2 19 | 20 | [*.svg] 21 | indent_style=space 22 | indent_size=2 23 | 24 | [*.js.map] 25 | indent_style=space 26 | indent_size=2 27 | 28 | [*.less] 29 | indent_style=space 30 | indent_size=2 31 | 32 | [*.vue] 33 | indent_style=space 34 | indent_size=2 35 | 36 | [{.analysis_options,*.yml,*.yaml}] 37 | indent_style=space 38 | indent_size=2 39 | 40 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/.env: -------------------------------------------------------------------------------- 1 | NODE_ENV=production 2 | VUE_APP_PREVIEW=false 3 | #项目名 4 | VUE_APP_ProjectName=Colder框架 5 | #首页路径 6 | VUE_APP_DesktopPath=/Home/Introduce 7 | #发布后接口根地址 8 | VUE_APP_PublishRootUrl=http://localhost:5000 9 | #本地调试接口根地址 10 | VUE_APP_LocalRootUrl=http://localhost:5000 11 | #接口超时时间ms 12 | VUE_APP_ApiTimeout=10000 13 | #本地开发启动端口 14 | VUE_APP_DevPort=5001 15 | #接口签名appId 16 | VUE_APP_AppId=PcAdmin 17 | #接口签名appSecret 18 | VUE_APP_AppSecret=wtMaiTRPTT3hrf5e -------------------------------------------------------------------------------- /src/Coldairarrow.Web/.env.preview: -------------------------------------------------------------------------------- 1 | NODE_ENV=production 2 | VUE_APP_PREVIEW=true 3 | VUE_APP_API_BASE_URL=/api -------------------------------------------------------------------------------- /src/Coldairarrow.Web/.gitattributes: -------------------------------------------------------------------------------- 1 | public/* linguist-vendored -------------------------------------------------------------------------------- /src/Coldairarrow.Web/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw* 22 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "semi": false, 4 | "singleQuote": true 5 | } 6 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 10.15.0 4 | cache: yarn 5 | script: 6 | - yarn 7 | - yarn run lint --no-fix && yarn run build 8 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Anan Yang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Coldairarrow.Web/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app', 4 | [ 5 | '@babel/preset-env', 6 | { 7 | 'useBuiltIns': 'entry' 8 | } 9 | ] 10 | ] 11 | // if your use import on Demand, Use this code 12 | // , 13 | // plugins: [ 14 | // [ 'import', { 15 | // 'libraryName': 'ant-design-vue', 16 | // 'libraryDirectory': 'es', 17 | // 'style': true // `style: true` 会加载 less 文件 18 | // } ] 19 | // ] 20 | } 21 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | moduleFileExtensions: [ 3 | 'js', 4 | 'jsx', 5 | 'json', 6 | 'vue' 7 | ], 8 | transform: { 9 | '^.+\\.vue$': 'vue-jest', 10 | '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', 11 | '^.+\\.jsx?$': 'babel-jest' 12 | }, 13 | moduleNameMapper: { 14 | '^@/(.*)$': '/src/$1' 15 | }, 16 | snapshotSerializers: [ 17 | 'jest-serializer-vue' 18 | ], 19 | testMatch: [ 20 | '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)' 21 | ], 22 | testURL: 'http://localhost/' 23 | } 24 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "baseUrl": ".", 5 | "paths": { 6 | "@/*": [ 7 | "src/*" 8 | ] 9 | } 10 | }, 11 | "exclude": [ 12 | "node_modules", 13 | "dist" 14 | ], 15 | "include": [ 16 | "src/**/*" 17 | ] 18 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Web/public/Dockerfile: -------------------------------------------------------------------------------- 1 | # 设置基础镜像 2 | FROM nginx 3 | WORKDIR /app 4 | COPY default.conf /etc/nginx/conf.d/ 5 | COPY . . -------------------------------------------------------------------------------- /src/Coldairarrow.Web/public/avatar2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coldairarrow/Colder.Admin.AntdVue/42631fcbe0d8a1355642004f1421f8ee586357e2/src/Coldairarrow.Web/public/avatar2.jpg -------------------------------------------------------------------------------- /src/Coldairarrow.Web/public/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | 4 | location / { 5 | root /app; 6 | index index.html; 7 | # vue的路由并不是真实物理路由,所以用try_files,路径都指向根目录下的index.html 8 | try_files $uri $uri/ /index.html; 9 | 10 | gzip on;#开启gzip 11 | gzip_types text/plain application/x-javascript application/javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; 12 | } 13 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Web/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= VUE_APP_ProjectName %> 9 | 10 | 11 | 12 | 15 |
16 |
17 |
18 | 19 |
20 |
21 |
22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/public/loading/loading.css: -------------------------------------------------------------------------------- 1 | #preloadingAnimation{position:fixed;left:0;top:0;height:100%;width:100%;background:#ffffff;user-select:none;z-index: 9999;overflow: hidden}.lds-roller{display:inline-block;position:relative;left:50%;top:50%;transform:translate(-50%,-50%);width:64px;height:64px;}.lds-roller div{animation:lds-roller 1.2s cubic-bezier(0.5,0,0.5,1) infinite;transform-origin:32px 32px;}.lds-roller div:after{content:" ";display:block;position:absolute;width:6px;height:6px;border-radius:50%;background:#13c2c2;margin:-3px 0 0 -3px;}.lds-roller div:nth-child(1){animation-delay:-0.036s;}.lds-roller div:nth-child(1):after{top:50px;left:50px;}.lds-roller div:nth-child(2){animation-delay:-0.072s;}.lds-roller div:nth-child(2):after{top:54px;left:45px;}.lds-roller div:nth-child(3){animation-delay:-0.108s;}.lds-roller div:nth-child(3):after{top:57px;left:39px;}.lds-roller div:nth-child(4){animation-delay:-0.144s;}.lds-roller div:nth-child(4):after{top:58px;left:32px;}.lds-roller div:nth-child(5){animation-delay:-0.18s;}.lds-roller div:nth-child(5):after{top:57px;left:25px;}.lds-roller div:nth-child(6){animation-delay:-0.216s;}.lds-roller div:nth-child(6):after{top:54px;left:19px;}.lds-roller div:nth-child(7){animation-delay:-0.252s;}.lds-roller div:nth-child(7):after{top:50px;left:14px;}.lds-roller div:nth-child(8){animation-delay:-0.288s;}.lds-roller div:nth-child(8):after{top:45px;left:10px;}#preloadingAnimation .load-tips{color: #13c2c2;font-size:2rem;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);margin-top:80px;text-align:center;width:400px;height:64px;} @keyframes lds-roller{0%{transform:rotate(0deg);} 100%{transform:rotate(360deg);}} -------------------------------------------------------------------------------- /src/Coldairarrow.Web/public/loading/loading.html: -------------------------------------------------------------------------------- 1 |
Loading
-------------------------------------------------------------------------------- /src/Coldairarrow.Web/public/loading/option2/html_code_segment.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
-------------------------------------------------------------------------------- /src/Coldairarrow.Web/public/loading/option2/loading.css: -------------------------------------------------------------------------------- 1 | .preloading-animate{background:#ffffff;width:100%;height:100%;position:fixed;left:0;top:0;z-index:299;}.preloading-animate .preloading-wrapper{position:absolute;width:5rem;height:5rem;left:50%;top:50%;transform:translate(-50%,-50%);}.preloading-animate .preloading-wrapper .preloading-balls{font-size:5rem;} -------------------------------------------------------------------------------- /src/Coldairarrow.Web/public/loading/option2/loading.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coldairarrow/Colder.Admin.AntdVue/42631fcbe0d8a1355642004f1421f8ee586357e2/src/Coldairarrow.Web/public/logo.png -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/App.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 27 | 32 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/assets/icons/bx-analyse.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coldairarrow/Colder.Admin.AntdVue/42631fcbe0d8a1355642004f1421f8ee586357e2/src/Coldairarrow.Web/src/assets/logo.png -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/ChartCard/Trend.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 52 | 53 | 83 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/Exception/index.js: -------------------------------------------------------------------------------- 1 | import ExceptionPage from './ExceptionPage.vue' 2 | export default ExceptionPage 3 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/Exception/type.js: -------------------------------------------------------------------------------- 1 | const types = { 2 | 403: { 3 | img: 'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg', 4 | title: '403', 5 | desc: '抱歉,你无权访问该页面' 6 | }, 7 | 404: { 8 | img: 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg', 9 | title: '404', 10 | desc: '抱歉,该页面不存在或您无权访问该页面' 11 | }, 12 | 500: { 13 | img: 'https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg', 14 | title: '500', 15 | desc: '抱歉,服务器出错了' 16 | } 17 | } 18 | 19 | export default types 20 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/GlobalFooter/GlobalFooter.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 32 | 33 | 60 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/GlobalFooter/index.js: -------------------------------------------------------------------------------- 1 | import GlobalFooter from './GlobalFooter' 2 | export default GlobalFooter 3 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/GlobalHeader/index.js: -------------------------------------------------------------------------------- 1 | import GlobalHeader from './GlobalHeader' 2 | export default GlobalHeader 3 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/IconSelector/IconSelector.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 62 | 63 | 87 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/IconSelector/README.md: -------------------------------------------------------------------------------- 1 | IconSelector 2 | ==== 3 | 4 | > 图标选择组件,常用于为某一个数据设定一个图标时使用 5 | > eg: 设定菜单列表时,为每个菜单设定一个图标 6 | 7 | 该组件由 [@Saraka](https://github.com/saraka-tsukai) 封装 8 | 9 | 10 | 11 | ### 使用方式 12 | 13 | ```vue 14 | 19 | 20 | 39 | ``` 40 | 41 | 42 | 43 | ### 事件 44 | 45 | 46 | | 名称 | 说明 | 类型 | 默认值 | 47 | | ------ | -------------------------- | ------ | ------ | 48 | | change | 当改变了 `icon` 选中项触发 | String | - | 49 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/IconSelector/index.js: -------------------------------------------------------------------------------- 1 | import IconSelector from './IconSelector' 2 | export default IconSelector 3 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/Menu/SideMenu.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 62 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/Menu/index.js: -------------------------------------------------------------------------------- 1 | import SMenu from './menu' 2 | export default SMenu 3 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/MultiTab/index.js: -------------------------------------------------------------------------------- 1 | import MultiTab from './MultiTab' 2 | import './index.less' 3 | 4 | export default MultiTab 5 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/MultiTab/index.less: -------------------------------------------------------------------------------- 1 | @import '../index'; 2 | 3 | @multi-tab-prefix-cls: ~"@{ant-pro-prefix}-multi-tab"; 4 | @multi-tab-wrapper-prefix-cls: ~"@{ant-pro-prefix}-multi-tab-wrapper"; 5 | 6 | /* 7 | .topmenu .@{multi-tab-prefix-cls} { 8 | max-width: 1200px; 9 | margin: -23px auto 24px auto; 10 | } 11 | */ 12 | .@{multi-tab-prefix-cls} { 13 | margin: -23px -24px 24px -24px; 14 | background: #fff; 15 | } 16 | 17 | .topmenu .@{multi-tab-wrapper-prefix-cls} { 18 | max-width: 1200px; 19 | margin: 0 auto; 20 | } 21 | 22 | .topmenu.content-width-Fluid .@{multi-tab-wrapper-prefix-cls} { 23 | max-width: 100%; 24 | margin: 0 auto; 25 | } 26 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/NoticeIcon/index.js: -------------------------------------------------------------------------------- 1 | import NoticeIcon from './NoticeIcon' 2 | export default NoticeIcon 3 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/PageHeader/index.js: -------------------------------------------------------------------------------- 1 | import PageHeader from './PageHeader' 2 | export default PageHeader 3 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/SettingDrawer/SettingItem.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 24 | 25 | 39 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/SettingDrawer/index.js: -------------------------------------------------------------------------------- 1 | import SettingDrawer from './SettingDrawer' 2 | export default SettingDrawer 3 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/SettingDrawer/themeColor.js: -------------------------------------------------------------------------------- 1 | import client from 'webpack-theme-color-replacer/client' 2 | import generate from '@ant-design/colors/lib/generate' 3 | 4 | export default { 5 | getAntdSerials (color) { 6 | // 淡化(即less的tint) 7 | const lightens = new Array(9).fill().map((t, i) => { 8 | return client.varyColor.lighten(color, i / 10) 9 | }) 10 | // colorPalette变换得到颜色值 11 | const colorPalettes = generate(color) 12 | return lightens.concat(colorPalettes) 13 | }, 14 | changeColor (newColor) { 15 | var options = { 16 | newColors: this.getAntdSerials(newColor), // new colors array, one-to-one corresponde with `matchColors` 17 | changeUrl (cssUrl) { 18 | return `/${cssUrl}` // while router is not `hash` mode, it needs absolute path 19 | } 20 | } 21 | return client.changer.changeColor(options, Promise) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/WangEditor/WangEditor.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 65 | 66 | 73 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/_util/util.js: -------------------------------------------------------------------------------- 1 | /** 2 | * components util 3 | */ 4 | 5 | /** 6 | * 清理空值,对象 7 | * @param children 8 | * @returns {*[]} 9 | */ 10 | export function filterEmpty (children = []) { 11 | return children.filter(c => c.tag || (c.text && c.text.trim() !== '')) 12 | } 13 | 14 | /** 15 | * 获取字符串长度,英文字符 长度1,中文字符长度2 16 | * @param {*} str 17 | */ 18 | export const getStrFullLength = (str = '') => 19 | str.split('').reduce((pre, cur) => { 20 | const charCode = cur.charCodeAt(0) 21 | if (charCode >= 0 && charCode <= 128) { 22 | return pre + 1 23 | } 24 | return pre + 2 25 | }, 0) 26 | 27 | /** 28 | * 截取字符串,根据 maxLength 截取后返回 29 | * @param {*} str 30 | * @param {*} maxLength 31 | */ 32 | export const cutStrByFullLength = (str = '', maxLength) => { 33 | let showLength = 0 34 | return str.split('').reduce((pre, cur) => { 35 | const charCode = cur.charCodeAt(0) 36 | if (charCode >= 0 && charCode <= 128) { 37 | showLength += 1 38 | } else { 39 | showLength += 2 40 | } 41 | if (showLength <= maxLength) { 42 | return pre + cur 43 | } 44 | return pre 45 | }, '') 46 | } 47 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/index.js: -------------------------------------------------------------------------------- 1 | import MultiTab from '@/components/MultiTab' 2 | import IconSelector from '@/components/IconSelector' 3 | import ExceptionPage from '@/components/Exception' 4 | 5 | export { 6 | MultiTab, 7 | ExceptionPage, 8 | IconSelector 9 | } 10 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/index.less: -------------------------------------------------------------------------------- 1 | @import "~ant-design-vue/lib/style/index"; 2 | 3 | // The prefix to use on all css classes from ant-pro. 4 | @ant-pro-prefix : ant-pro; 5 | @ant-global-header-zindex : 105; -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/tools/Breadcrumb.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/tools/ChangePwdForm.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 71 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/tools/DetailList.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/tools/HeadInfo.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 32 | 33 | 68 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/tools/Logo.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 32 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/tools/UserMenu.vue: -------------------------------------------------------------------------------- 1 | 35 | 36 | 75 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/components/tools/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coldairarrow/Colder.Admin.AntdVue/42631fcbe0d8a1355642004f1421f8ee586357e2/src/Coldairarrow.Web/src/components/tools/index.js -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/config/defaultSettings.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 项目默认配置项 3 | * primaryColor - 默认主题色, 如果修改颜色不生效,请清理 localStorage 4 | * navTheme - sidebar theme ['dark', 'light'] 两种主题 5 | * colorWeak - 色盲模式 6 | * layout - 整体布局方式 ['sidemenu', 'topmenu'] 两种布局 7 | * fixedHeader - 固定 Header : boolean 8 | * fixSiderbar - 固定左侧菜单栏 : boolean 9 | * autoHideHeader - 向下滚动时,隐藏 Header : boolean 10 | * contentWidth - 内容区布局: 流式 | 固定 11 | * 12 | * storageOptions: {} - Vue-ls 插件配置项 (localStorage/sessionStorage) 13 | * 14 | */ 15 | 16 | export default { 17 | primaryColor: '#1890FF', // primary color of ant design 18 | navTheme: 'dark', // theme for nav menu 19 | layout: 'sidemenu', // nav menu position: sidemenu or topmenu 20 | contentWidth: 'Fixed', // layout of content: Fluid or Fixed, only works when layout is topmenu 21 | fixedHeader: false, // sticky header 22 | fixSiderbar: true, // sticky siderbar 23 | autoHideHeader: false, // auto hide header 24 | colorWeak: false, 25 | multiTab: true, 26 | production: process.env.NODE_ENV === 'production' && process.env.VUE_APP_PREVIEW !== 'true', 27 | // vue-ls options 28 | storageOptions: { 29 | namespace: 'pro__', 30 | name: 'ls', 31 | storage: 'local' 32 | }, 33 | projectName: process.env.VUE_APP_ProjectName,//项目名 34 | desktopPath: process.env.VUE_APP_DesktopPath,//首页路径 35 | publishRootUrl: process.env.VUE_APP_PublishRootUrl,//发布后接口根地址 36 | localRootUrl: process.env.VUE_APP_LocalRootUrl,//本地调试接口根地址 37 | apiTimeout: parseInt(process.env.VUE_APP_ApiTimeout),//接口超时时间ms 38 | devPort: parseInt(process.env.VUE_APP_DevPort), //本地开发启动端口 39 | appId: process.env.VUE_APP_AppId, 40 | appSecret: process.env.VUE_APP_AppSecret 41 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/config/router.config.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line 2 | import { UserLayout, PageView } from '@/layouts' 3 | 4 | /** 5 | * 基础路由 6 | * @type { *[] } 7 | */ 8 | export const constantRouterMap = [ 9 | { 10 | path: '/Home', 11 | component: UserLayout, 12 | redirect: '/Home/Login', 13 | hidden: true, 14 | children: [ 15 | { 16 | path: '/Home/Login', 17 | name: 'Login', 18 | component: () => import('@/views/Home/Login') 19 | } 20 | ] 21 | }, 22 | { 23 | path: '/404', 24 | component: () => import('@/views/exception/404') 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/core/bootstrap.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import store from '@/store/' 3 | import { 4 | DEFAULT_COLOR, 5 | DEFAULT_THEME, 6 | DEFAULT_LAYOUT_MODE, 7 | DEFAULT_COLOR_WEAK, 8 | SIDEBAR_TYPE, 9 | DEFAULT_FIXED_HEADER, 10 | DEFAULT_FIXED_HEADER_HIDDEN, 11 | DEFAULT_FIXED_SIDEMENU, 12 | DEFAULT_CONTENT_WIDTH_TYPE, 13 | DEFAULT_MULTI_TAB 14 | } from '@/store/mutation-types' 15 | import config from '@/config/defaultSettings' 16 | 17 | export default function Initializer() { 18 | // console.log(`API_URL: ${process.env.VUE_APP_API_BASE_URL}`) 19 | 20 | store.commit('SET_SIDEBAR_TYPE', Vue.ls.get(SIDEBAR_TYPE, true)) 21 | store.commit('TOGGLE_THEME', Vue.ls.get(DEFAULT_THEME, config.navTheme)) 22 | store.commit('TOGGLE_LAYOUT_MODE', Vue.ls.get(DEFAULT_LAYOUT_MODE, config.layout)) 23 | store.commit('TOGGLE_FIXED_HEADER', Vue.ls.get(DEFAULT_FIXED_HEADER, config.fixedHeader)) 24 | store.commit('TOGGLE_FIXED_SIDERBAR', Vue.ls.get(DEFAULT_FIXED_SIDEMENU, config.fixSiderbar)) 25 | store.commit('TOGGLE_CONTENT_WIDTH', Vue.ls.get(DEFAULT_CONTENT_WIDTH_TYPE, config.contentWidth)) 26 | store.commit('TOGGLE_FIXED_HEADER_HIDDEN', Vue.ls.get(DEFAULT_FIXED_HEADER_HIDDEN, config.autoHideHeader)) 27 | store.commit('TOGGLE_WEAK', Vue.ls.get(DEFAULT_COLOR_WEAK, config.colorWeak)) 28 | store.commit('TOGGLE_COLOR', Vue.ls.get(DEFAULT_COLOR, config.primaryColor)) 29 | store.commit('TOGGLE_MULTI_TAB', Vue.ls.get(DEFAULT_MULTI_TAB, config.multiTab)) 30 | } 31 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/core/directives/action.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import store from '@/store' 3 | 4 | /** 5 | * Action 权限指令 6 | * 指令用法: 7 | * - 在需要控制 action 级别权限的组件上使用 v-action:[method] , 如下: 8 | * 添加用户 9 | * 删除用户 10 | * 修改 11 | * 12 | * - 当前用户没有权限时,组件上使用了该指令则会被隐藏 13 | * - 当后台权限跟 pro 提供的模式不同时,只需要针对这里的权限过滤进行修改即可 14 | * 15 | * @see https://github.com/sendya/ant-design-pro-vue/pull/53 16 | */ 17 | const action = Vue.directive('action', { 18 | inserted: function (el, binding, vnode) { 19 | const actionName = binding.arg 20 | const roles = store.getters.roles 21 | const elVal = vnode.context.$route.meta.permission 22 | const permissionId = elVal instanceof String && [elVal] || elVal 23 | roles.permissions.forEach(p => { 24 | if (!permissionId.includes(p.permissionId)) { 25 | return 26 | } 27 | if (p.actionList && !p.actionList.includes(actionName)) { 28 | el.parentNode && el.parentNode.removeChild(el) || (el.style.display = 'none') 29 | } 30 | }) 31 | } 32 | }) 33 | 34 | export default action 35 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/core/icons.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Custom icon list 3 | * All icons are loaded here for easy management 4 | * @see https://vue.ant.design/components/icon/#Custom-Font-Icon 5 | * 6 | * 自定义图标加载表 7 | * 所有图标均从这里加载,方便管理 8 | */ 9 | import bxAnaalyse from '@/assets/icons/bx-analyse.svg?inline' // path to your '*.svg?inline' file. 10 | 11 | export { bxAnaalyse } 12 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/core/lazy_lib/components_use.js: -------------------------------------------------------------------------------- 1 | 2 | /* eslint-disable */ 3 | /** 4 | * 该文件是为了按需加载,剔除掉了一些不需要的框架组件。 5 | * 减少了编译支持库包大小 6 | * 7 | * 当需要更多组件依赖时,在该文件加入即可 8 | */ 9 | import Vue from 'vue' 10 | import { 11 | LocaleProvider, 12 | Layout, 13 | Input, 14 | InputNumber, 15 | Button, 16 | Switch, 17 | Radio, 18 | Checkbox, 19 | Select, 20 | Card, 21 | Form, 22 | Row, 23 | Col, 24 | Modal, 25 | Table, 26 | Tabs, 27 | Icon, 28 | Badge, 29 | Popover, 30 | Dropdown, 31 | List, 32 | Avatar, 33 | Breadcrumb, 34 | Steps, 35 | Spin, 36 | Menu, 37 | Drawer, 38 | Tooltip, 39 | Alert, 40 | Tag, 41 | Divider, 42 | DatePicker, 43 | TimePicker, 44 | Upload, 45 | Progress, 46 | Skeleton, 47 | Popconfirm, 48 | message, 49 | notification 50 | } from 'ant-design-vue' 51 | // import VueCropper from 'vue-cropper' 52 | 53 | Vue.use(LocaleProvider) 54 | Vue.use(Layout) 55 | Vue.use(Input) 56 | Vue.use(InputNumber) 57 | Vue.use(Button) 58 | Vue.use(Switch) 59 | Vue.use(Radio) 60 | Vue.use(Checkbox) 61 | Vue.use(Select) 62 | Vue.use(Card) 63 | Vue.use(Form) 64 | Vue.use(Row) 65 | Vue.use(Col) 66 | Vue.use(Modal) 67 | Vue.use(Table) 68 | Vue.use(Tabs) 69 | Vue.use(Icon) 70 | Vue.use(Badge) 71 | Vue.use(Popover) 72 | Vue.use(Dropdown) 73 | Vue.use(List) 74 | Vue.use(Avatar) 75 | Vue.use(Breadcrumb) 76 | Vue.use(Steps) 77 | Vue.use(Spin) 78 | Vue.use(Menu) 79 | Vue.use(Drawer) 80 | Vue.use(Tooltip) 81 | Vue.use(Alert) 82 | Vue.use(Tag) 83 | Vue.use(Divider) 84 | Vue.use(DatePicker) 85 | Vue.use(TimePicker) 86 | Vue.use(Upload) 87 | Vue.use(Progress) 88 | Vue.use(Skeleton) 89 | Vue.use(Popconfirm) 90 | // Vue.use(VueCropper) 91 | Vue.use(notification) 92 | 93 | Vue.prototype.$confirm = Modal.confirm 94 | Vue.prototype.$message = message 95 | Vue.prototype.$notification = notification 96 | Vue.prototype.$info = Modal.info 97 | Vue.prototype.$success = Modal.success 98 | Vue.prototype.$error = Modal.error 99 | Vue.prototype.$warning = Modal.warning -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/core/lazy_use.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueStorage from 'vue-ls' 3 | import config from '@/config/defaultSettings' 4 | 5 | // base library 6 | import '@/core/lazy_lib/components_use' 7 | // import Viser from 'viser-vue' 8 | 9 | // ext library 10 | import VueClipboard from 'vue-clipboard2' 11 | // import PermissionHelper from '@/utils/helper/permission' 12 | import './directives/action' 13 | 14 | VueClipboard.config.autoSetContainer = true 15 | 16 | // Vue.use(Viser) 17 | 18 | Vue.use(VueStorage, config.storageOptions) 19 | Vue.use(VueClipboard) 20 | // Vue.use(PermissionHelper) 21 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/core/use.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueStorage from 'vue-ls' 3 | import config from '@/config/defaultSettings' 4 | 5 | // base library 6 | import Antd from 'ant-design-vue' 7 | // import Viser from 'viser-vue' 8 | import VueCropper from 'vue-cropper' 9 | import 'ant-design-vue/dist/antd.less' 10 | 11 | // ext library 12 | import VueClipboard from 'vue-clipboard2' 13 | // import PermissionHelper from '@/utils/helper/permission' 14 | // import '@/components/use' 15 | import './directives/action' 16 | 17 | VueClipboard.config.autoSetContainer = true 18 | 19 | Vue.use(Antd) 20 | // Vue.use(Viser) 21 | 22 | Vue.use(VueStorage, config.storageOptions) 23 | Vue.use(VueClipboard) 24 | // Vue.use(PermissionHelper) 25 | Vue.use(VueCropper) 26 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/layouts/BlankLayout.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 13 | 14 | 17 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/layouts/RouteView.vue: -------------------------------------------------------------------------------- 1 | 33 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/layouts/index.js: -------------------------------------------------------------------------------- 1 | import UserLayout from './UserLayout' 2 | import BlankLayout from './BlankLayout' 3 | import BasicLayout from './BasicLayout' 4 | import RouteView from './RouteView' 5 | import PageView from './PageView' 6 | 7 | export { UserLayout, BasicLayout, BlankLayout, RouteView, PageView } 8 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/main.js: -------------------------------------------------------------------------------- 1 | // ie polyfill 2 | import '@babel/polyfill' 3 | 4 | import Vue from 'vue' 5 | import App from './App.vue' 6 | import router from './router' 7 | import store from './store/' 8 | // import { VueAxios } from './utils/request' 9 | import AxiosPlugin from '@/utils/plugin/axios-plugin' 10 | 11 | // mock 12 | // import './mock' 13 | 14 | import bootstrap from './core/bootstrap' 15 | import './core/use' 16 | import './permission' // permission control 17 | import './utils/filter' // global filter 18 | import operatorPlugin from './utils/plugin/operator-plugin' 19 | 20 | import moment from 'moment' 21 | moment.prototype.toJSON = function () { return moment(this).format("YYYY-MM-DD HH:mm:ss") } 22 | 23 | Vue.config.productionTip = false 24 | 25 | // mount axios Vue.$http and this.$http 26 | // Vue.use(VueAxios) 27 | Vue.use(AxiosPlugin) 28 | Vue.use(operatorPlugin) 29 | 30 | new Vue({ 31 | router, 32 | store, 33 | created: bootstrap, 34 | render: h => h(App) 35 | }).$mount('#app') 36 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/permission.js: -------------------------------------------------------------------------------- 1 | import router from '@/router' 2 | import NProgress from 'nprogress' // progress bar 3 | import 'nprogress/nprogress.css' // progress bar style 4 | import { setDocumentTitle, domTitle } from '@/utils/domUtil' 5 | import TokenCache from '@/utils/cache/TokenCache' 6 | import OperatorCache from '@/utils/cache/OperatorCache' 7 | import { initRouter } from '@/utils/routerUtil' 8 | import defaultSettings from '@/config/defaultSettings' 9 | 10 | NProgress.configure({ showSpinner: false }) // NProgress Configuration 11 | 12 | const whiteList = ['Login'] // no redirect whitelist 13 | 14 | router.beforeEach((to, from, next) => { 15 | NProgress.start() // start progress bar 16 | to.meta && (typeof to.meta.title !== 'undefined' && setDocumentTitle(`${to.meta.title} - ${domTitle}`)) 17 | // 已授权 18 | if (TokenCache.getToken()) { 19 | OperatorCache.init(() => { 20 | if (to.path === '/Home/Login') { 21 | next({ path: '/' }) 22 | NProgress.done() 23 | } else { 24 | initRouter(to, from, next).then(() => { 25 | const redirect = decodeURIComponent(from.query.redirect || to.path) 26 | //桌面特殊处理 27 | if (to.path == defaultSettings.desktopPath || to.path == '/404') { 28 | next() 29 | } else { 30 | if (to.path === redirect) { 31 | next() 32 | } else { 33 | // 跳转到目的路由 34 | next({ path: redirect }) 35 | } 36 | } 37 | }) 38 | } 39 | }) 40 | } else { 41 | if (whiteList.includes(to.name)) { 42 | // 在免登录白名单,直接进入 43 | next() 44 | } else { 45 | next({ path: '/Home/Login', query: { redirect: to.fullPath } }) 46 | NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it 47 | } 48 | } 49 | }) 50 | 51 | router.afterEach(() => { 52 | NProgress.done() // finish progress bar 53 | }) 54 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | 4 | import { constantRouterMap } from '@/config/router.config' 5 | 6 | Vue.use(Router) 7 | 8 | export default new Router({ 9 | mode: 'history', 10 | base: process.env.BASE_URL, 11 | scrollBehavior: () => ({ y: 0 }), 12 | routes: constantRouterMap 13 | }) 14 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/store/getters.js: -------------------------------------------------------------------------------- 1 | const getters = { 2 | device: state => state.app.device, 3 | theme: state => state.app.theme, 4 | color: state => state.app.color, 5 | token: state => state.user.token, 6 | avatar: state => state.user.avatar, 7 | nickname: state => state.user.name, 8 | welcome: state => state.user.welcome, 9 | roles: state => state.user.roles, 10 | userInfo: state => state.user.info, 11 | addRouters: state => state.permission.addRouters, 12 | multiTab: state => state.app.multiTab 13 | } 14 | 15 | export default getters 16 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | import app from './modules/app' 5 | // import user from './modules/user' 6 | // import permission from './modules/permission' 7 | import getters from './getters' 8 | 9 | Vue.use(Vuex) 10 | 11 | export default new Vuex.Store({ 12 | modules: { 13 | app, 14 | // user 15 | // permission 16 | }, 17 | state: { 18 | 19 | }, 20 | mutations: { 21 | 22 | }, 23 | actions: { 24 | 25 | }, 26 | getters 27 | }) 28 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/store/mutation-types.js: -------------------------------------------------------------------------------- 1 | export const ACCESS_TOKEN = 'Access-Token' 2 | export const SIDEBAR_TYPE = 'SIDEBAR_TYPE' 3 | export const DEFAULT_THEME = 'DEFAULT_THEME' 4 | export const DEFAULT_LAYOUT_MODE = 'DEFAULT_LAYOUT_MODE' 5 | export const DEFAULT_COLOR = 'DEFAULT_COLOR' 6 | export const DEFAULT_COLOR_WEAK = 'DEFAULT_COLOR_WEAK' 7 | export const DEFAULT_FIXED_HEADER = 'DEFAULT_FIXED_HEADER' 8 | export const DEFAULT_FIXED_SIDEMENU = 'DEFAULT_FIXED_SIDEMENU' 9 | export const DEFAULT_FIXED_HEADER_HIDDEN = 'DEFAULT_FIXED_HEADER_HIDDEN' 10 | export const DEFAULT_CONTENT_WIDTH_TYPE = 'DEFAULT_CONTENT_WIDTH_TYPE' 11 | export const DEFAULT_MULTI_TAB = 'DEFAULT_MULTI_TAB' 12 | 13 | export const CONTENT_WIDTH_TYPE = { 14 | Fluid: 'Fluid', 15 | Fixed: 'Fixed' 16 | } 17 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/utils/cache/OperatorCache.js: -------------------------------------------------------------------------------- 1 | import { Axios } from "@/utils/plugin/axios-plugin" 2 | 3 | let permissions = [] 4 | let inited = false 5 | 6 | let OperatorCache = { 7 | info: {}, 8 | inited() { 9 | return inited 10 | }, 11 | init(callBack) { 12 | if (inited) 13 | callBack() 14 | else { 15 | Axios.post('/Base_Manage/Home/GetOperatorInfo').then(resJson => { 16 | this.info = resJson.Data.UserInfo 17 | permissions = resJson.Data.Permissions 18 | inited = true 19 | callBack() 20 | }) 21 | } 22 | }, 23 | hasPermission(thePermission) { 24 | return permissions.includes(thePermission) 25 | }, 26 | clear() { 27 | inited = false 28 | permissions = [] 29 | this.info = {} 30 | } 31 | } 32 | 33 | export default OperatorCache -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/utils/cache/TokenCache.js: -------------------------------------------------------------------------------- 1 | const tokenKey = 'jwtToken' 2 | 3 | let TokenCache = { 4 | getToken() { 5 | return localStorage.getItem(tokenKey) 6 | }, 7 | setToken(newToken) { 8 | localStorage.setItem(tokenKey, newToken) 9 | }, 10 | deleteToken() { 11 | localStorage.removeItem(tokenKey) 12 | } 13 | } 14 | 15 | export default TokenCache -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/utils/device.js: -------------------------------------------------------------------------------- 1 | import enquireJs from 'enquire.js' 2 | 3 | export const DEVICE_TYPE = { 4 | DESKTOP: 'desktop', 5 | TABLET: 'tablet', 6 | MOBILE: 'mobile' 7 | } 8 | 9 | export const deviceEnquire = function (callback) { 10 | const matchDesktop = { 11 | match: () => { 12 | callback && callback(DEVICE_TYPE.DESKTOP) 13 | } 14 | } 15 | 16 | const matchLablet = { 17 | match: () => { 18 | callback && callback(DEVICE_TYPE.TABLET) 19 | } 20 | } 21 | 22 | const matchMobile = { 23 | match: () => { 24 | callback && callback(DEVICE_TYPE.MOBILE) 25 | } 26 | } 27 | 28 | // screen and (max-width: 1087.99px) 29 | enquireJs 30 | .register('screen and (max-width: 576px)', matchMobile) 31 | .register('screen and (min-width: 576px) and (max-width: 1199px)', matchLablet) 32 | .register('screen and (min-width: 1200px)', matchDesktop) 33 | } 34 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/utils/domUtil.js: -------------------------------------------------------------------------------- 1 | export const setDocumentTitle = function (title) { 2 | document.title = title 3 | const ua = navigator.userAgent 4 | // eslint-disable-next-line 5 | const regex = /\bMicroMessenger\/([\d\.]+)/ 6 | if (regex.test(ua) && /ip(hone|od|ad)/i.test(ua)) { 7 | const i = document.createElement('iframe') 8 | i.src = '/favicon.ico' 9 | i.style.display = 'none' 10 | i.onload = function () { 11 | setTimeout(function () { 12 | i.remove() 13 | }, 9) 14 | } 15 | document.body.appendChild(i) 16 | } 17 | } 18 | 19 | export const domTitle = process.env.VUE_APP_ProjectName 20 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/utils/filter.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import moment from 'moment' 3 | import 'moment/locale/zh-cn' 4 | moment.locale('zh-cn') 5 | 6 | Vue.filter('NumberFormat', function (value) { 7 | if (!value) { 8 | return '0' 9 | } 10 | const intPartFormat = value.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') // 将整数部分逢三一断 11 | return intPartFormat 12 | }) 13 | 14 | Vue.filter('dayjs', function (dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') { 15 | return moment(dataStr).format(pattern) 16 | }) 17 | 18 | Vue.filter('moment', function (dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') { 19 | return moment(dataStr).format(pattern) 20 | }) 21 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/utils/helper/ProcessHelper.js: -------------------------------------------------------------------------------- 1 | const productKey = 'production' 2 | const ProcessHelper = { 3 | isProduction() { 4 | return process.env.NODE_ENV == productKey 5 | }, 6 | isPreview() { 7 | return process.env.VUE_APP_PREVIEW === 'true' 8 | } 9 | } 10 | export default ProcessHelper -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/utils/helper/TreeHelper.js: -------------------------------------------------------------------------------- 1 | //固定列表结构:[{Id:'xxx',ParentId:'xxx'}] 2 | let TreeHelper = { 3 | getParentIds(id, allNodes) { 4 | let parents = [] 5 | let theNode = this.findTheNode(id, allNodes) 6 | if (theNode.ParentId) { 7 | parents.push(theNode.ParentId) 8 | parents.push(...this.getParentIds(theNode.ParentId, allNodes)) 9 | } 10 | 11 | return parents 12 | }, 13 | getChildrenIds(id, allNodes) { 14 | var childrenIds = [] 15 | let children = allNodes.filter(item => item.ParentId == id) 16 | .map(item => item.Id) 17 | if (children.length > 0) { 18 | childrenIds.push(...children) 19 | children.forEach(item => { 20 | childrenIds.push(...this.getChildrenIds(item, allNodes)) 21 | }) 22 | } 23 | return childrenIds 24 | }, 25 | findTheNode(id, allNodes) { 26 | return allNodes.filter(item => item.Id == id)[0] 27 | } 28 | } 29 | 30 | export default TreeHelper -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/utils/helper/TypeHelper.js: -------------------------------------------------------------------------------- 1 | const TypeHelper = { 2 | isString(o) { //是否字符串 3 | return Object.prototype.toString.call(o).slice(8, -1) === 'String' 4 | }, 5 | isNumber(o) { //是否数字 6 | return Object.prototype.toString.call(o).slice(8, -1) === 'Number' 7 | }, 8 | isBoolean(o) { //是否boolean 9 | return Object.prototype.toString.call(o).slice(8, -1) === 'Boolean' 10 | }, 11 | isFunction(o) { //是否函数 12 | return Object.prototype.toString.call(o).slice(8, -1) === 'Function' 13 | }, 14 | isNull(o) { //是否为null 15 | return Object.prototype.toString.call(o).slice(8, -1) === 'Null' 16 | }, 17 | isUndefined(o) { //是否undefined 18 | return Object.prototype.toString.call(o).slice(8, -1) === 'Undefined' 19 | }, 20 | isObj(o) { //是否对象 21 | return Object.prototype.toString.call(o).slice(8, -1) === 'Object' 22 | }, 23 | isArray(o) { //是否数组 24 | return Object.prototype.toString.call(o).slice(8, -1) === 'Array' 25 | }, 26 | isDate(o) { //是否时间 27 | return Object.prototype.toString.call(o).slice(8, -1) === 'Date' 28 | }, 29 | isRegExp(o) { //是否正则 30 | return Object.prototype.toString.call(o).slice(8, -1) === 'RegExp' 31 | }, 32 | isError(o) { //是否错误对象 33 | return Object.prototype.toString.call(o).slice(8, -1) === 'Error' 34 | }, 35 | isSymbol(o) { //是否Symbol函数 36 | return Object.prototype.toString.call(o).slice(8, -1) === 'Symbol' 37 | }, 38 | isPromise(o) { //是否Promise对象 39 | return Object.prototype.toString.call(o).slice(8, -1) === 'Promise' 40 | }, 41 | isSet(o) { //是否Set对象 42 | return Object.prototype.toString.call(o).slice(8, -1) === 'Set' 43 | }, 44 | isFalse(o) { 45 | if (!o || o === 'null' || o === 'undefined' || o === 'false' || o === 'NaN') return true 46 | return false 47 | }, 48 | isTrue(o) { 49 | return !this.isFalse(o) 50 | } 51 | } 52 | 53 | export default TypeHelper -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/utils/mixin.js: -------------------------------------------------------------------------------- 1 | // import Vue from 'vue' 2 | import { deviceEnquire, DEVICE_TYPE } from '@/utils/device' 3 | import { mapState } from 'vuex' 4 | 5 | // const mixinsComputed = Vue.config.optionMergeStrategies.computed 6 | // const mixinsMethods = Vue.config.optionMergeStrategies.methods 7 | 8 | const mixin = { 9 | computed: { 10 | ...mapState({ 11 | layoutMode: state => state.app.layout, 12 | navTheme: state => state.app.theme, 13 | primaryColor: state => state.app.color, 14 | colorWeak: state => state.app.weak, 15 | fixedHeader: state => state.app.fixedHeader, 16 | fixSiderbar: state => state.app.fixSiderbar, 17 | fixSidebar: state => state.app.fixSiderbar, 18 | contentWidth: state => state.app.contentWidth, 19 | autoHideHeader: state => state.app.autoHideHeader, 20 | sidebarOpened: state => state.app.sidebar, 21 | multiTab: state => state.app.multiTab 22 | }) 23 | }, 24 | methods: { 25 | isTopMenu () { 26 | return this.layoutMode === 'topmenu' 27 | }, 28 | isSideMenu () { 29 | return !this.isTopMenu() 30 | } 31 | } 32 | } 33 | 34 | const mixinDevice = { 35 | computed: { 36 | ...mapState({ 37 | device: state => state.app.device 38 | }) 39 | }, 40 | methods: { 41 | isMobile () { 42 | return this.device === DEVICE_TYPE.MOBILE 43 | }, 44 | isDesktop () { 45 | return this.device === DEVICE_TYPE.DESKTOP 46 | }, 47 | isTablet () { 48 | return this.device === DEVICE_TYPE.TABLET 49 | } 50 | } 51 | } 52 | 53 | const AppDeviceEnquire = { 54 | mounted () { 55 | const { $store } = this 56 | deviceEnquire(deviceType => { 57 | switch (deviceType) { 58 | case DEVICE_TYPE.DESKTOP: 59 | $store.commit('TOGGLE_DEVICE', 'desktop') 60 | $store.dispatch('setSidebar', true) 61 | break 62 | case DEVICE_TYPE.TABLET: 63 | $store.commit('TOGGLE_DEVICE', 'tablet') 64 | $store.dispatch('setSidebar', false) 65 | break 66 | case DEVICE_TYPE.MOBILE: 67 | default: 68 | $store.commit('TOGGLE_DEVICE', 'mobile') 69 | $store.dispatch('setSidebar', true) 70 | break 71 | } 72 | }) 73 | } 74 | } 75 | 76 | export { mixin, AppDeviceEnquire, mixinDevice } 77 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/utils/plugin/operator-plugin.js: -------------------------------------------------------------------------------- 1 | import OperatorCache from "@/utils/cache/OperatorCache" 2 | 3 | export default { 4 | install(Vue) { 5 | Object.defineProperty(Vue.prototype, '$op', { value: OperatorCache }) 6 | Object.defineProperty(Vue.prototype, 'hasPerm', { value: OperatorCache.hasPermission }) 7 | } 8 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/utils/util.js: -------------------------------------------------------------------------------- 1 | export function timeFix () { 2 | const time = new Date() 3 | const hour = time.getHours() 4 | return hour < 9 ? '早上好' : hour <= 11 ? '上午好' : hour <= 13 ? '中午好' : hour < 20 ? '下午好' : '晚上好' 5 | } 6 | 7 | export function welcome () { 8 | const arr = ['休息一会儿吧', '准备吃什么呢?', '要不要打一把 DOTA', '我猜你可能累了'] 9 | const index = Math.floor(Math.random() * arr.length) 10 | return arr[index] 11 | } 12 | 13 | /** 14 | * 触发 window.resize 15 | */ 16 | export function triggerWindowResizeEvent () { 17 | const event = document.createEvent('HTMLEvents') 18 | event.initEvent('resize', true, true) 19 | event.eventType = 'message' 20 | window.dispatchEvent(event) 21 | } 22 | 23 | export function handleScrollHeader (callback) { 24 | let timer = 0 25 | 26 | let beforeScrollTop = window.pageYOffset 27 | callback = callback || function () {} 28 | window.addEventListener( 29 | 'scroll', 30 | event => { 31 | clearTimeout(timer) 32 | timer = setTimeout(() => { 33 | let direction = 'up' 34 | const afterScrollTop = window.pageYOffset 35 | const delta = afterScrollTop - beforeScrollTop 36 | if (delta === 0) { 37 | return false 38 | } 39 | direction = delta > 0 ? 'down' : 'up' 40 | callback(direction) 41 | beforeScrollTop = afterScrollTop 42 | }, 50) 43 | }, 44 | false 45 | ) 46 | } 47 | 48 | /** 49 | * Remove loading animate 50 | * @param id parent element id or class 51 | * @param timeout 52 | */ 53 | export function removeLoadingAnimate (id = '', timeout = 1500) { 54 | if (id === '') { 55 | return 56 | } 57 | setTimeout(() => { 58 | document.body.removeChild(document.getElementById(id)) 59 | }, timeout) 60 | } 61 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/utils/utils.less: -------------------------------------------------------------------------------- 1 | .textOverflow() { 2 | overflow: hidden; 3 | white-space: nowrap; 4 | text-overflow: ellipsis; 5 | word-break: break-all; 6 | } 7 | 8 | .textOverflowMulti(@line: 3, @bg: #fff) { 9 | position: relative; 10 | max-height: @line * 1.5em; 11 | margin-right: -1em; 12 | padding-right: 1em; 13 | overflow: hidden; 14 | line-height: 1.5em; 15 | text-align: justify; 16 | &::before { 17 | position: absolute; 18 | right: 14px; 19 | bottom: 0; 20 | padding: 0 1px; 21 | background: @bg; 22 | content: '...'; 23 | } 24 | &::after { 25 | position: absolute; 26 | right: 14px; 27 | width: 1em; 28 | height: 1em; 29 | margin-top: 0.2em; 30 | background: white; 31 | content: ''; 32 | } 33 | } 34 | 35 | // mixins for clearfix 36 | // ------------------------ 37 | .clearfix() { 38 | zoom: 1; 39 | &::before, 40 | &::after { 41 | display: table; 42 | content: ' '; 43 | } 44 | &::after { 45 | clear: both; 46 | height: 0; 47 | font-size: 0; 48 | visibility: hidden; 49 | } 50 | } -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/views/Develop/Editor.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/views/Develop/IconSelectorView.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 37 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/views/Develop/UploadFile.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 41 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/views/Develop/UploadImg.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 51 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/views/Home/Statis.vue: -------------------------------------------------------------------------------- 1 | 2 | 36 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/views/exception/403.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 14 | 15 | 18 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/views/exception/404.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 14 | 15 | 18 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/src/views/exception/500.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 14 | 15 | 18 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/tests/unit/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | jest: true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/Coldairarrow.Web/webstorm.config.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | 4 | function resolve (dir) { 5 | return path.join(__dirname, '.', dir) 6 | } 7 | 8 | module.exports = { 9 | context: path.resolve(__dirname, './'), 10 | resolve: { 11 | extensions: ['.js', '.vue', '.json'], 12 | alias: { 13 | '@': resolve('src') 14 | } 15 | } 16 | } 17 | --------------------------------------------------------------------------------