diff --git a/WebFirst/database/sqlite.db b/WebFirst/database/sqlite.db index b7d7dd70..bb11b1a4 100644 Binary files a/WebFirst/database/sqlite.db and b/WebFirst/database/sqlite.db differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml index b9c3e71f..ad7c241a 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml @@ -67,6 +67,21 @@ + + + 动态条件分页查询 + + + + + + + + 添加 + + + + Json To Sql 类比模式,通用模型 diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ArticleController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ArticleController.cs new file mode 100644 index 00000000..04f6de14 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ArticleController.cs @@ -0,0 +1,51 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Yi.Framework.Common.Models; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; +using Yi.Framework.WebCore; +using Yi.Framework.WebCore.AttributeExtend; +using Yi.Framework.WebCore.AuthorizationPolicy; + +namespace Yi.Framework.ApiMicroservice.Controllers +{ + [ApiController] + [Route("api/[controller]/[action]")] + public class ArticleController : BaseSimpleCrudController + { + private IArticleService _iArticleService; + public ArticleController(ILogger logger, IArticleService iArticleService) : base(logger, iArticleService) + { + _iArticleService = iArticleService; + } + + /// + /// 动态条件分页查询 + /// + /// + /// + /// + [HttpGet] + public async Task PageList([FromQuery] ArticleEntity entity, [FromQuery] PageParModel page) + { + return Result.Success().SetData(await _iArticleService.SelctPageList(entity, page)); + } + + /// + /// 添加 + /// + /// + /// + public override Task Add(ArticleEntity entity) + { + entity.UserId=HttpContext.GetUserIdInfo(); + return base.Add(entity); + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/FileController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/FileController.cs index c9ccd77c..ac3be741 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/FileController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/FileController.cs @@ -4,9 +4,11 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Hosting; using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Threading.Tasks; +using Yi.Framework.Common.Enum; using Yi.Framework.Common.Models; using Yi.Framework.Interface; using Yi.Framework.WebCore; @@ -39,10 +41,15 @@ namespace Yi.Framework.ApiMicroservice.Controllers /// /// /// - [Route("/api/{type}/{fileName}")] + [Route("/api/file/{type}/{fileName}")] [HttpGet] public IActionResult Get(string type, string fileName) { + type = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(type.ToLower()); + if (!Enum.IsDefined(typeof(PathEnum), type)) + { + return new NotFoundResult(); + } try { var path = Path.Combine($"wwwroot/{type}", fileName); @@ -64,8 +71,13 @@ namespace Yi.Framework.ApiMicroservice.Controllers /// [Route("/api/Upload/{type}")] [HttpPost] - public async Task Upload(string type, IFormFile file) + public async Task Upload(string type,IFormFile file) { + type = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(type.ToLower()); + if (!Enum.IsDefined(typeof(PathEnum), type)) + { + return Result.Error("上传失败!文件类型不存在!"); + } try { string filename = Guid.NewGuid().ToString() + Path.GetExtension(file.FileName); diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/056392ba-5b14-40ec-b679-32595e07ab6f.jpg b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/056392ba-5b14-40ec-b679-32595e07ab6f.jpg new file mode 100644 index 00000000..fbeee125 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/056392ba-5b14-40ec-b679-32595e07ab6f.jpg differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/1474a0e7-d8e4-4ad3-871f-8cc0ff8d69f9.png b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/1474a0e7-d8e4-4ad3-871f-8cc0ff8d69f9.png new file mode 100644 index 00000000..5b2d9dc6 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/1474a0e7-d8e4-4ad3-871f-8cc0ff8d69f9.png differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/19e7fb2c-f4c9-4759-9e84-967fd6d47893.png b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/19e7fb2c-f4c9-4759-9e84-967fd6d47893.png new file mode 100644 index 00000000..5b2d9dc6 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/19e7fb2c-f4c9-4759-9e84-967fd6d47893.png differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/1bae78ff-d172-4daf-8cb2-99d886d5bf2d.png b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/1bae78ff-d172-4daf-8cb2-99d886d5bf2d.png new file mode 100644 index 00000000..5b2d9dc6 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/1bae78ff-d172-4daf-8cb2-99d886d5bf2d.png differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/1eda98b7-d529-486a-88d2-1cfb59f1cd1a.png b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/1eda98b7-d529-486a-88d2-1cfb59f1cd1a.png new file mode 100644 index 00000000..dc4b7124 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/1eda98b7-d529-486a-88d2-1cfb59f1cd1a.png differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/2bd1e552-bfd6-45df-8fe3-f3db5e1c31f9.jpg b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/2bd1e552-bfd6-45df-8fe3-f3db5e1c31f9.jpg new file mode 100644 index 00000000..fbeee125 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/2bd1e552-bfd6-45df-8fe3-f3db5e1c31f9.jpg differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/3aad676f-0083-4588-b0fb-8d35f4e4403f.gif b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/3aad676f-0083-4588-b0fb-8d35f4e4403f.gif new file mode 100644 index 00000000..d0be1ed6 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/3aad676f-0083-4588-b0fb-8d35f4e4403f.gif differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/5330a5c0-2f99-43a0-a038-e0ae1cbd835b.png b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/5330a5c0-2f99-43a0-a038-e0ae1cbd835b.png new file mode 100644 index 00000000..dc4b7124 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/5330a5c0-2f99-43a0-a038-e0ae1cbd835b.png differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/5e604d16-06bc-4047-9145-6959a28e1fc7.png b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/5e604d16-06bc-4047-9145-6959a28e1fc7.png new file mode 100644 index 00000000..dc4b7124 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/5e604d16-06bc-4047-9145-6959a28e1fc7.png differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/730c3a36-bef0-4fdc-8fb7-58029814db5d.jpg b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/730c3a36-bef0-4fdc-8fb7-58029814db5d.jpg new file mode 100644 index 00000000..fbeee125 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/730c3a36-bef0-4fdc-8fb7-58029814db5d.jpg differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/754478f6-b361-47e0-a764-406b9e230d9e.jpg b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/754478f6-b361-47e0-a764-406b9e230d9e.jpg new file mode 100644 index 00000000..fbeee125 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/754478f6-b361-47e0-a764-406b9e230d9e.jpg differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/7cb6a4f2-bc22-4450-9761-ff407c1f2310.gif b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/7cb6a4f2-bc22-4450-9761-ff407c1f2310.gif new file mode 100644 index 00000000..d916a66d Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/7cb6a4f2-bc22-4450-9761-ff407c1f2310.gif differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/9ed4c33b-f342-404f-87ed-a8ce85fc2848.png b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/9ed4c33b-f342-404f-87ed-a8ce85fc2848.png new file mode 100644 index 00000000..dc4b7124 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/9ed4c33b-f342-404f-87ed-a8ce85fc2848.png differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/a43726f9-7ee2-4237-b505-af9a79ea0aee.jpg b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/a43726f9-7ee2-4237-b505-af9a79ea0aee.jpg new file mode 100644 index 00000000..fbeee125 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/a43726f9-7ee2-4237-b505-af9a79ea0aee.jpg differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/a808725a-68e2-47b1-a8b7-301be4b6d84b.gif b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/a808725a-68e2-47b1-a8b7-301be4b6d84b.gif new file mode 100644 index 00000000..d916a66d Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/a808725a-68e2-47b1-a8b7-301be4b6d84b.gif differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/a8c4308b-7d08-4938-a822-afc321ecbd89.png b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/a8c4308b-7d08-4938-a822-afc321ecbd89.png new file mode 100644 index 00000000..5b2d9dc6 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/a8c4308b-7d08-4938-a822-afc321ecbd89.png differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/ac2f7690-8b7c-4602-8579-1837c7478586.gif b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/ac2f7690-8b7c-4602-8579-1837c7478586.gif new file mode 100644 index 00000000..d916a66d Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/ac2f7690-8b7c-4602-8579-1837c7478586.gif differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/b259089a-fb38-49a3-898d-4719533ba43f.gif b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/b259089a-fb38-49a3-898d-4719533ba43f.gif new file mode 100644 index 00000000..d916a66d Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/b259089a-fb38-49a3-898d-4719533ba43f.gif differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/b25e620f-53ef-4baf-9e70-281fad40dc04.gif b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/b25e620f-53ef-4baf-9e70-281fad40dc04.gif new file mode 100644 index 00000000..d916a66d Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/b25e620f-53ef-4baf-9e70-281fad40dc04.gif differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/baa1aed0-4333-44c3-9f02-17993205d50e.ico b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/baa1aed0-4333-44c3-9f02-17993205d50e.ico new file mode 100644 index 00000000..e0895f23 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/baa1aed0-4333-44c3-9f02-17993205d50e.ico differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/be9a4d42-c469-45e2-8c6e-6a28f7b81fee.gif b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/be9a4d42-c469-45e2-8c6e-6a28f7b81fee.gif new file mode 100644 index 00000000..d916a66d Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/be9a4d42-c469-45e2-8c6e-6a28f7b81fee.gif differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/d0f11804-d3f0-4d33-9338-09444d9a070a.gif b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/d0f11804-d3f0-4d33-9338-09444d9a070a.gif new file mode 100644 index 00000000..d0be1ed6 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/d0f11804-d3f0-4d33-9338-09444d9a070a.gif differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/e530c6f8-2723-4567-9166-b1d3e61dcc6a.jpg b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/e530c6f8-2723-4567-9166-b1d3e61dcc6a.jpg new file mode 100644 index 00000000..fbeee125 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/e530c6f8-2723-4567-9166-b1d3e61dcc6a.jpg differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/ecb112b2-b2c4-4e7a-9ea0-88e47bbd1173.jpg b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/ecb112b2-b2c4-4e7a-9ea0-88e47bbd1173.jpg new file mode 100644 index 00000000..fbeee125 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/ecb112b2-b2c4-4e7a-9ea0-88e47bbd1173.jpg differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/ef4747f1-48d0-4e02-9910-1a0c8c301f94.png b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/ef4747f1-48d0-4e02-9910-1a0c8c301f94.png new file mode 100644 index 00000000..5b2d9dc6 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/ef4747f1-48d0-4e02-9910-1a0c8c301f94.png differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/ef4c708d-3b6a-49c4-9285-44351c2ac5ef.gif b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/ef4c708d-3b6a-49c4-9285-44351c2ac5ef.gif new file mode 100644 index 00000000..d0be1ed6 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/ef4c708d-3b6a-49c4-9285-44351c2ac5ef.gif differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/fe195729-1a55-45db-8588-7bbbf0cbe1fa.png b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/fe195729-1a55-45db-8588-7bbbf0cbe1fa.png new file mode 100644 index 00000000..5b2d9dc6 Binary files /dev/null and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/wwwroot/image/fe195729-1a55-45db-8588-7bbbf0cbe1fa.png differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db index b0e30f62..90c2d750 100644 Binary files a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db differ diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IArticleService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IArticleService.cs new file mode 100644 index 00000000..e2eb4c5f --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IArticleService.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Yi.Framework.Common.Models; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Interface +{ + public partial interface IArticleService:IBaseService + { + Task>> SelctPageList(ArticleEntity eneity, PageParModel page); + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IArticleService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IArticleService.cs new file mode 100644 index 00000000..ea7137fb --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IArticleService.cs @@ -0,0 +1,9 @@ +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Interface +{ + public partial interface IArticleService:IBaseService + { + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ArticleEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ArticleEntity.cs new file mode 100644 index 00000000..9f3cbcf4 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ArticleEntity.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json.Serialization; +using SqlSugar; +namespace Yi.Framework.Model.Models +{ + /// + /// 文章表 + /// + [SugarTable("Article")] + public partial class ArticleEntity:IBaseModelEntity + { + public ArticleEntity() + { + this.CreateTime = DateTime.Now; + } + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )] + public long Id { get; set; } + /// + /// 文章标题 + /// + [SugarColumn(ColumnName="Title" )] + public string Title { get; set; } + /// + /// 文章内容 + /// + [SugarColumn(ColumnName="Content" )] + public string Content { get; set; } + /// + /// 用户id + /// + [SugarColumn(ColumnName="UserId" )] + public long? UserId { get; set; } + /// + /// 创建者 + /// + [SugarColumn(ColumnName="CreateUser" )] + public long? CreateUser { get; set; } + /// + /// 创建时间 + /// + [SugarColumn(ColumnName="CreateTime" )] + public DateTime? CreateTime { get; set; } + /// + /// 修改者 + /// + [SugarColumn(ColumnName="ModifyUser" )] + public long? ModifyUser { get; set; } + /// + /// 修改时间 + /// + [SugarColumn(ColumnName="ModifyTime" )] + public DateTime? ModifyTime { get; set; } + /// + /// 是否删除 + /// + [SugarColumn(ColumnName="IsDeleted" )] + public bool? IsDeleted { get; set; } + /// + /// 租户Id + /// + [SugarColumn(ColumnName="TenantId" )] + public long? TenantId { get; set; } + /// + /// 排序字段 + /// + [SugarColumn(ColumnName="OrderNum" )] + public int? OrderNum { get; set; } + /// + /// 描述 + /// + [SugarColumn(ColumnName="Remark" )] + public string Remark { get; set; } + /// + /// 图片列表 + /// + [SugarColumn(ColumnName="Images",IsJson = true)] + public List Images { get; set; } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ArticleService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ArticleService.cs new file mode 100644 index 00000000..f2970ee0 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Service/ArticleService.cs @@ -0,0 +1,28 @@ +using SqlSugar; +using System.Collections.Generic; +using System.Threading.Tasks; +using Yi.Framework.Common.Models; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Service +{ + public partial class ArticleService : BaseService, IArticleService + { + public async Task>> SelctPageList(ArticleEntity entity, PageParModel page) + { + RefAsync total = 0; + var data = await _repository._DbQueryable + //.WhereIF(!string.IsNullOrEmpty(config.ConfigName), u => u.ConfigName.Contains(config.ConfigName)) + //.WhereIF(!string.IsNullOrEmpty(config.ConfigKey), u => u.ConfigKey.Contains(config.ConfigKey)) + .WhereIF(page.StartTime is not null && page.EndTime is not null, u => u.CreateTime >= page.StartTime && u.CreateTime <= page.EndTime) + .WhereIF(entity.IsDeleted is not null, u => u.IsDeleted == entity.IsDeleted) + .OrderBy(u => u.CreateTime, OrderByType.Desc) + .ToPageListAsync(page.PageNum, page.PageSize, total); + + return new PageModel>(data, total); + } + + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/ArticleService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/ArticleService.cs new file mode 100644 index 00000000..2a230eea --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/ArticleService.cs @@ -0,0 +1,14 @@ +using SqlSugar; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Service +{ + public partial class ArticleService : BaseService, IArticleService + { + public ArticleService(IRepository repository) : base(repository) + { + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/CommonExtend/HttpContextExtend.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/CommonExtend/HttpContextExtend.cs index 273d29d4..790e85be 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/CommonExtend/HttpContextExtend.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/CommonExtend/HttpContextExtend.cs @@ -37,7 +37,12 @@ namespace Yi.Framework.WebCore public static long GetUserIdInfo(this HttpContext httpContext) { var p = httpContext; - return Convert.ToInt64(httpContext.User.Claims.FirstOrDefault(u => u.Type == JwtRegisteredClaimNames.Sid).Value); + var value = httpContext.User.Claims.FirstOrDefault(u => u.Type == JwtRegisteredClaimNames.Sid)?.Value; + if (value is not null) + { + return Convert.ToInt64(value); + } + return 0; } /// diff --git a/Yi.Vue3.x.Vant/.env.development b/Yi.Vue3.x.Vant/.env.development new file mode 100644 index 00000000..fa4ea55e --- /dev/null +++ b/Yi.Vue3.x.Vant/.env.development @@ -0,0 +1,17 @@ +# 页面标题 +VITE_APP_TITLE = 意框架管理系统 + +# 开发环境配置 +VITE_APP_ENV = 'development' + +# 若依管理系统/开发环境 +VITE_APP_BASE_API = '/dev-api' + +# ws/开发环境 +VITE_APP_BASE_WS = '/dev-ws' + + +VITE_APP_BASE_URL='http://localhost:19001/api' + + + diff --git a/Yi.Vue3.x.Vant/.env.production b/Yi.Vue3.x.Vant/.env.production new file mode 100644 index 00000000..565a45ef --- /dev/null +++ b/Yi.Vue3.x.Vant/.env.production @@ -0,0 +1,15 @@ +# 页面标题 +VITE_APP_TITLE = 意框架管理系统 + +# 生产环境配置 +VITE_APP_ENV = 'production' + +# 意框架管理系统/生产环境 +VITE_APP_BASE_API = '/prod-api' + +# ws/开发环境 +VITE_APP_BASE_WS = '/prod-ws' + +# 是否在打包时开启压缩,支持 gzip 和 brotli +VITE_BUILD_COMPRESS = gzip + diff --git a/Yi.Vue3.x.Vant/.env.staging b/Yi.Vue3.x.Vant/.env.staging new file mode 100644 index 00000000..58e3fbcd --- /dev/null +++ b/Yi.Vue3.x.Vant/.env.staging @@ -0,0 +1,15 @@ +# 页面标题 +VITE_APP_TITLE = 意框架管理系统 + +# 生产环境配置 +VITE_APP_ENV = 'staging' + +# 若依管理系统/生产环境 +VITE_APP_BASE_API = '/stage-api' + +# ws/开发环境 +VITE_APP_BASE_WS = '/stage-ws' + +# 是否在打包时开启压缩,支持 gzip 和 brotli +VITE_BUILD_COMPRESS = gzip + diff --git a/Yi.Vue3.x.Vant/components.d.ts b/Yi.Vue3.x.Vant/components.d.ts index 623a4e74..c2a4e70d 100644 --- a/Yi.Vue3.x.Vant/components.d.ts +++ b/Yi.Vue3.x.Vant/components.d.ts @@ -7,6 +7,7 @@ export {} declare module '@vue/runtime-core' { export interface GlobalComponents { + AppCreateTime: typeof import('./src/components/AppCreateTime.vue')['default'] AppGrid: typeof import('./src/components/AppGrid.vue')['default'] HelloWorld: typeof import('./src/components/HelloWorld.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/Yi.Vue3.x.Vant/package-lock.json b/Yi.Vue3.x.Vant/package-lock.json index 1d510f17..a9120d45 100644 --- a/Yi.Vue3.x.Vant/package-lock.json +++ b/Yi.Vue3.x.Vant/package-lock.json @@ -8,11 +8,14 @@ "name": "yi", "version": "0.0.0", "dependencies": { + "axios": "^1.1.2", + "json-bigint": "^1.0.0", "vant": "^3.6.3", "vue": "^3.2.37", "vue-router": "^4.1.5" }, "devDependencies": { + "@types/json-bigint": "^1.0.1", "@types/node": "^18.8.2", "@vitejs/plugin-vue": "^3.1.0", "typescript": "^4.6.4", @@ -121,6 +124,12 @@ "node": ">= 8.0.0" } }, + "node_modules/@types/json-bigint": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@types/json-bigint/-/json-bigint-1.0.1.tgz", + "integrity": "sha512-zpchZLNsNuzJHi6v64UBoFWAvQlPhch7XAi36FkH6tL1bbbmimIF+cS7vwkzY4u5RaSWMoflQfu+TshMPPw8uw==", + "dev": true + }, "node_modules/@types/node": { "version": "18.8.2", "resolved": "https://registry.npmmirror.com/@types/node/-/node-18.8.2.tgz", @@ -355,12 +364,35 @@ "node": ">= 8" } }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.2.tgz", + "integrity": "sha512-bznQyETwElsXl2RK7HLLwb5GPpOLlycxHCtrpDR/4RqqBzjARaOTo3jz4IgtntWUYee7Ne4S8UHd92VCuzPaWA==", + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/bignumber.js": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.0.tgz", + "integrity": "sha512-4LwHK4nfDOraBCtst+wOWIHbu1vhvAPJK8g8nROd4iuc3PSEjWif/qwbkh8jwCJz6yDBvtU4KPynETgrfh7y3A==", + "engines": { + "node": "*" + } + }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmmirror.com/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -418,6 +450,17 @@ "fsevents": "~2.3.2" } }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/csstype": { "version": "2.6.21", "resolved": "https://registry.npmmirror.com/csstype/-/csstype-2.6.21.tgz", @@ -440,6 +483,14 @@ } } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/esbuild": { "version": "0.15.10", "resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.15.10.tgz", @@ -839,6 +890,38 @@ "node": ">=8" } }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fsevents": { "version": "2.3.2", "resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.2.tgz", @@ -937,6 +1020,14 @@ "node": ">=0.12.0" } }, + "node_modules/json-bigint": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "dependencies": { + "bignumber.js": "^9.0.0" + } + }, "node_modules/local-pkg": { "version": "0.4.2", "resolved": "https://registry.npmmirror.com/local-pkg/-/local-pkg-0.4.2.tgz", @@ -991,6 +1082,25 @@ "node": ">=8.6" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/minimatch": { "version": "5.1.0", "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-5.1.0.tgz", @@ -1075,6 +1185,11 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -1482,6 +1597,12 @@ "picomatch": "^2.2.2" } }, + "@types/json-bigint": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@types/json-bigint/-/json-bigint-1.0.1.tgz", + "integrity": "sha512-zpchZLNsNuzJHi6v64UBoFWAvQlPhch7XAi36FkH6tL1bbbmimIF+cS7vwkzY4u5RaSWMoflQfu+TshMPPw8uw==", + "dev": true + }, "@types/node": { "version": "18.8.2", "resolved": "https://registry.npmmirror.com/@types/node/-/node-18.8.2.tgz", @@ -1700,12 +1821,32 @@ "picomatch": "^2.0.4" } }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "axios": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.2.tgz", + "integrity": "sha512-bznQyETwElsXl2RK7HLLwb5GPpOLlycxHCtrpDR/4RqqBzjARaOTo3jz4IgtntWUYee7Ne4S8UHd92VCuzPaWA==", + "requires": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "bignumber.js": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.0.tgz", + "integrity": "sha512-4LwHK4nfDOraBCtst+wOWIHbu1vhvAPJK8g8nROd4iuc3PSEjWif/qwbkh8jwCJz6yDBvtU4KPynETgrfh7y3A==" + }, "binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmmirror.com/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -1746,6 +1887,14 @@ "readdirp": "~3.6.0" } }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, "csstype": { "version": "2.6.21", "resolved": "https://registry.npmmirror.com/csstype/-/csstype-2.6.21.tgz", @@ -1760,6 +1909,11 @@ "ms": "2.1.2" } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, "esbuild": { "version": "0.15.10", "resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.15.10.tgz", @@ -1966,6 +2120,21 @@ "to-regex-range": "^5.0.1" } }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "fsevents": { "version": "2.3.2", "resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.2.tgz", @@ -2036,6 +2205,14 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "json-bigint": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "requires": { + "bignumber.js": "^9.0.0" + } + }, "local-pkg": { "version": "0.4.2", "resolved": "https://registry.npmmirror.com/local-pkg/-/local-pkg-0.4.2.tgz", @@ -2075,6 +2252,19 @@ "picomatch": "^2.3.1" } }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, "minimatch": { "version": "5.1.0", "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-5.1.0.tgz", @@ -2128,6 +2318,11 @@ "source-map-js": "^1.0.2" } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz", diff --git a/Yi.Vue3.x.Vant/package.json b/Yi.Vue3.x.Vant/package.json index e7b302e5..a715b5b4 100644 --- a/Yi.Vue3.x.Vant/package.json +++ b/Yi.Vue3.x.Vant/package.json @@ -9,11 +9,14 @@ "preview": "vite preview" }, "dependencies": { + "axios": "^1.1.2", + "json-bigint": "^1.0.0", "vant": "^3.6.3", "vue": "^3.2.37", "vue-router": "^4.1.5" }, "devDependencies": { + "@types/json-bigint": "^1.0.1", "@types/node": "^18.8.2", "@vitejs/plugin-vue": "^3.1.0", "typescript": "^4.6.4", diff --git a/Yi.Vue3.x.Vant/src/api/articleApi.ts b/Yi.Vue3.x.Vant/src/api/articleApi.ts new file mode 100644 index 00000000..56127ad0 --- /dev/null +++ b/Yi.Vue3.x.Vant/src/api/articleApi.ts @@ -0,0 +1,20 @@ +import myaxios from '@/utils/myaxios.ts' +import { ArticleEntity } from '@/type/interface/ArticleEntity' + +export default { + add(data: ArticleEntity) { + console.log(data) + return myaxios({ + url: `/article/add`, + method: 'post', + data: data + }) + }, + pageList(data:ArticleEntity) { + return myaxios({ + url: '/article/pageList', + method: 'get', + params: data + }) + } +} \ No newline at end of file diff --git a/Yi.Vue3.x.Vant/src/api/fileApi.ts b/Yi.Vue3.x.Vant/src/api/fileApi.ts new file mode 100644 index 00000000..4137b018 --- /dev/null +++ b/Yi.Vue3.x.Vant/src/api/fileApi.ts @@ -0,0 +1,12 @@ +import myaxios from '@/utils/myaxios.ts' + +export default{ + upload(type:string,data:any){ + return myaxios({ + url: `/upload/${type}`, + headers:{"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"}, + method: 'POST', + data:data + }); +} +} \ No newline at end of file diff --git a/Yi.Vue3.x.Vant/src/components/AppCreateTime.vue b/Yi.Vue3.x.Vant/src/components/AppCreateTime.vue new file mode 100644 index 00000000..6f38aea9 --- /dev/null +++ b/Yi.Vue3.x.Vant/src/components/AppCreateTime.vue @@ -0,0 +1,37 @@ + + + + + \ No newline at end of file diff --git a/Yi.Vue3.x.Vant/src/layout/tab/index.vue b/Yi.Vue3.x.Vant/src/layout/tab/index.vue index 8be18b14..b92c4f71 100644 --- a/Yi.Vue3.x.Vant/src/layout/tab/index.vue +++ b/Yi.Vue3.x.Vant/src/layout/tab/index.vue @@ -15,7 +15,7 @@ -
+
\ No newline at end of file + + \ No newline at end of file diff --git a/Yi.Vue3.x.Vant/src/view/send/imageText.vue b/Yi.Vue3.x.Vant/src/view/send/imageText.vue index 13e180b5..3745018d 100644 --- a/Yi.Vue3.x.Vant/src/view/send/imageText.vue +++ b/Yi.Vue3.x.Vant/src/view/send/imageText.vue @@ -1,95 +1,126 @@ \ No newline at end of file diff --git a/Yi.Vue3.x.Vant/vite.config.ts b/Yi.Vue3.x.Vant/vite.config.ts index c4590c60..2be3bef5 100644 --- a/Yi.Vue3.x.Vant/vite.config.ts +++ b/Yi.Vue3.x.Vant/vite.config.ts @@ -1,4 +1,4 @@ -import { defineConfig } from 'vite' +import { defineConfig, loadEnv } from 'vite' import path from 'path' import vue from '@vitejs/plugin-vue' import Components from 'unplugin-vue-components/vite'; @@ -6,38 +6,47 @@ import { VantResolver } from 'unplugin-vue-components/resolvers'; // https://vitejs.dev/config/ -export default defineConfig({ - plugins: [vue(), Components({ - resolvers: [VantResolver()], - }),], - resolve: { - // https://cn.vitejs.dev/config/#resolve-alias - alias: { - // 设置路径 - '~': path.resolve(__dirname, './'), - // 设置别名 - '@': path.resolve(__dirname, './src') - } - }, - server: { - port: 17000, - host: true, - open: true, - // proxy: { - // // https://cn.vitejs.dev/config/#server-proxy - // '/dev-api': { - // target: VITE_APP_BASE_URL, - // changeOrigin: true, - // rewrite: (p) => p.replace(/^\/dev-api/, ''), - // }, +export default defineConfig(({ mode, command }) => { + const env = loadEnv(mode, process.cwd()) + const { VITE_APP_ENV, VITE_APP_BASE_URL} = env + return { + plugins: [vue(), Components({ + resolvers: [VantResolver()], + }),], + resolve: { + // https://cn.vitejs.dev/config/#resolve-alias + alias: { + // 设置路径 + '~': path.resolve(__dirname, './'), + // 设置别名 + '@': path.resolve(__dirname, './src') + } + }, + server: { + port: 17000, + host: true, + open: true, + + + proxy: { + // https://cn.vitejs.dev/config/#server-proxy + '/dev-api': { + target: VITE_APP_BASE_URL, + changeOrigin: true, + rewrite: (p) => p.replace(/^\/dev-api/, ''), + }, + + '/dev-ws': { + target: VITE_APP_BASE_URL, + changeOrigin: true, + rewrite: (p) => p.replace(/^\/dev-ws/, ''), + ws: true + } + + } + }, + } - // '/dev-ws': { - // target: VITE_APP_BASE_URL, - // changeOrigin: true, - // rewrite: (p) => p.replace(/^\/dev-ws/, ''), - // ws: true - // } +} - // } - }, -}) +)