diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs index eb3fcf16..b1c7f0b7 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs @@ -50,7 +50,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers if ( user_data!=null) { var token = MakeJwt.app(new jwtUser() {user=user_data,menuIds= menuList}); - return Result.Success().SetData(new { user = new { _user.id, _user.username, _user.introduction, _user.icon, _user.nick }, token }); + return Result.Success().SetData(new { user = new { user_data.id, user_data.username, user_data.introduction, user_data.icon, user_data.nick }, token }); } return Result.Error(); } diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/FileController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/FileController.cs index 40224c9b..7c1e4662 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/FileController.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/FileController.cs @@ -23,28 +23,42 @@ namespace Yi.Framework.ApiMicroservice.Controllers { _userService = userService; _env = env; - } + } [HttpPost] [Authorize] public async Task EditIcon(IFormFile file) { - var _user = HttpContext.GetCurrentUserInfo(); - var user_data = await _userService.GetUserById(_user.id); - var type = "image"; - var filename = await Upload(type, file); - user_data.icon = filename; - await _userService.UpdateAsync(user_data); - return Result.Success(); + try + { + var _user = HttpContext.GetCurrentUserInfo(); + var user_data = await _userService.GetUserById(_user.id); + var type = "image"; + var filename = await Upload(type, file); + user_data.icon = filename; + await _userService.UpdateAsync(user_data); + return Result.Success(); + } + catch + { + return Result.Error(); + } } - [Route("{type}/{fileNmae}")] + [Route("/api/{type}/{fileName}")] [HttpGet] - public IActionResult Get(string type, string fileNmae) + public IActionResult Get(string type, string fileName) { - var path = Path.Combine($"wwwroot\\{type}", fileNmae); - var stream = System.IO.File.OpenRead(path); - var MimeType = Common.Helper.MimeHelper.GetMimeMapping(fileNmae); - return new FileStreamResult(stream, MimeType); + try + { + var path = Path.Combine($"wwwroot/{type}", fileName); + var stream = System.IO.File.OpenRead(path); + var MimeType = Common.Helper.MimeHelper.GetMimeMapping(fileName); + return new FileStreamResult(stream, MimeType); + } + catch + { + return new NotFoundResult(); + } } /// @@ -53,11 +67,10 @@ namespace Yi.Framework.ApiMicroservice.Controllers /// /// /// - private async Task Upload(string type,IFormFile file) + private async Task Upload(string type, IFormFile file) { - string filename = Guid.NewGuid().ToString() + Path.GetExtension(file.FileName); - using (var stream = new FileStream(Path.Combine($"wwwroot\\{type}", filename), FileMode.CreateNew, FileAccess.Write)) + using (var stream = new FileStream(Path.Combine($"wwwroot/{type}", filename), FileMode.CreateNew, FileAccess.Write)) { await file.CopyToAsync(stream); } @@ -65,15 +78,15 @@ namespace Yi.Framework.ApiMicroservice.Controllers return filename; } - [HttpGet] - public async TaskExportFile() + [HttpGet] + public async Task ExportFile() { var userdata = await _userService.GetAllEntitiesTrueAsync(); var userList = userdata.ToList(); - List header = new() { "用户", "密码", "头像", "昵称", "邮箱", "ip","年龄", "个人介绍", "地址", "手机", "角色" }; - var filename= Common.Helper.ExcelHelper.CreateExcelFromList(userList,header,_env.ContentRootPath.ToString()); + List header = new() { "用户", "密码", "头像", "昵称", "邮箱", "ip", "年龄", "个人介绍", "地址", "手机", "角色" }; + var filename = Common.Helper.ExcelHelper.CreateExcelFromList(userList, header, _env.ContentRootPath.ToString()); var MimeType = Common.Helper.MimeHelper.GetMimeMapping(filename); - return new FileStreamResult(new FileStream(Path.Combine(_env.ContentRootPath+@"\wwwroot\Excel", filename), FileMode.Open),MimeType); + return new FileStreamResult(new FileStream(Path.Combine(_env.ContentRootPath + @"\wwwroot\Excel", filename), FileMode.Open), MimeType); } } } diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs index 7ed91dd8..97d9f5c5 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs @@ -103,6 +103,11 @@ namespace Yi.Framework.ApiMicroservice #endregion //app.UseErrorHandlingService(); + #region + //̬ļע + #endregion + //app.UseStaticFiles(); + #region //HttpsRedirectionע #endregion diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json b/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json index e08f7152..ee2132c0 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json @@ -15,7 +15,7 @@ "Cors_Enabled": true, "RabbitMQ_Enabled": false, "Redis_Enabled": true, - "RedisSeed_Enabled": true, + "RedisSeed_Enabled": false, "Kafka_Enabled": false, "MutiDB_Enabled": false, "DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ], diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/wwwroot/image/1b0a926d-ddce-4048-9b09-e2b8ec37c161.jpg b/Yi.Framework/Yi.Framework.ApiMicroservice/wwwroot/image/1b0a926d-ddce-4048-9b09-e2b8ec37c161.jpg new file mode 100644 index 00000000..aa4daf73 Binary files /dev/null and b/Yi.Framework/Yi.Framework.ApiMicroservice/wwwroot/image/1b0a926d-ddce-4048-9b09-e2b8ec37c161.jpg differ diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/wwwroot/image/3d6ed457-0c20-4ce6-b91c-8c424f2f03bb.jpeg b/Yi.Framework/Yi.Framework.ApiMicroservice/wwwroot/image/3d6ed457-0c20-4ce6-b91c-8c424f2f03bb.jpeg new file mode 100644 index 00000000..a1070258 Binary files /dev/null and b/Yi.Framework/Yi.Framework.ApiMicroservice/wwwroot/image/3d6ed457-0c20-4ce6-b91c-8c424f2f03bb.jpeg differ diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/wwwroot/image/7ca98a58-8822-40f5-a766-2a2dd21d2431.jpg b/Yi.Framework/Yi.Framework.ApiMicroservice/wwwroot/image/7ca98a58-8822-40f5-a766-2a2dd21d2431.jpg new file mode 100644 index 00000000..aa4daf73 Binary files /dev/null and b/Yi.Framework/Yi.Framework.ApiMicroservice/wwwroot/image/7ca98a58-8822-40f5-a766-2a2dd21d2431.jpg differ diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/wwwroot/image/feae1964-04ce-464b-848b-86f2245f3f63.jpeg b/Yi.Framework/Yi.Framework.ApiMicroservice/wwwroot/image/feae1964-04ce-464b-848b-86f2245f3f63.jpeg new file mode 100644 index 00000000..76a391b4 Binary files /dev/null and b/Yi.Framework/Yi.Framework.ApiMicroservice/wwwroot/image/feae1964-04ce-464b-848b-86f2245f3f63.jpeg differ diff --git a/Yi.Framework/Yi.Framework.Core/TreeMenuBuild.cs b/Yi.Framework/Yi.Framework.Core/TreeMenuBuild.cs index cedaff6b..14b0e6f8 100644 --- a/Yi.Framework/Yi.Framework.Core/TreeMenuBuild.cs +++ b/Yi.Framework/Yi.Framework.Core/TreeMenuBuild.cs @@ -93,7 +93,7 @@ namespace Yi.Framework.Core { for (int i = menu_data.children.Count() - 1; i >= 0; i--) { - menu_data.children = menu_data.children.AsEnumerable().OrderBy(u => u.sort).ToList(); + menu_data.children = menu_data.children.AsEnumerable().OrderByDescending(u => u.sort).ToList(); if (menu_data.children != null || menu_data.children.Count() != 0) { diff --git a/Yi.Framework/Yi.Framework.WebCore/Init/RedisInit.cs b/Yi.Framework/Yi.Framework.WebCore/Init/RedisInit.cs index da18bf72..d8579352 100644 --- a/Yi.Framework/Yi.Framework.WebCore/Init/RedisInit.cs +++ b/Yi.Framework/Yi.Framework.WebCore/Init/RedisInit.cs @@ -16,7 +16,7 @@ namespace Yi.Framework.WebCore.Init if (_cacheClientDB.Get(RedisConst.key)==null) { - Newtonsoft.Json.JsonConvert.SerializeObject(); + //Newtonsoft.Json.JsonConvert.SerializeObject(); _cacheClientDB.Add(RedisConst.key, new SettingDto() { ImageList_key = { "默认图片", "默认图片" } , diff --git a/Yi.Vue/src/components/ccAvatar.vue b/Yi.Vue/src/components/ccAvatar.vue new file mode 100644 index 00000000..a8709e15 --- /dev/null +++ b/Yi.Vue/src/components/ccAvatar.vue @@ -0,0 +1,28 @@ + + + diff --git a/Yi.Vue/src/layouts/default/ListGroup.vue b/Yi.Vue/src/layouts/default/ListGroup.vue index 3fbcb133..2f4811ef 100644 --- a/Yi.Vue/src/layouts/default/ListGroup.vue +++ b/Yi.Vue/src/layouts/default/ListGroup.vue @@ -65,8 +65,10 @@ }, title () { const matches = this.item.menu_name.match(/\b(\w)/g) - +if(matches!=null) +{ return matches.join('') +} }, }, diff --git a/Yi.Vue/src/layouts/default/ListItem.vue b/Yi.Vue/src/layouts/default/ListItem.vue index 16056715..47b1ee83 100644 --- a/Yi.Vue/src/layouts/default/ListItem.vue +++ b/Yi.Vue/src/layouts/default/ListItem.vue @@ -48,8 +48,10 @@ computed: { title () { const matches = this.item.menu_name.match(/\b(\w)/g) - +if(matches!=null) +{ return matches.join('') +} }, }, } diff --git a/Yi.Vue/src/layouts/default/widgets/Account.vue b/Yi.Vue/src/layouts/default/widgets/Account.vue index c51c2d2d..a6218329 100644 --- a/Yi.Vue/src/layouts/default/widgets/Account.vue +++ b/Yi.Vue/src/layouts/default/widgets/Account.vue @@ -8,50 +8,26 @@ transition="scale-transition" > - + + + - - - - + @@ -60,16 +36,15 @@ diff --git a/Yi.Vue/src/views/userInfo.vue b/Yi.Vue/src/views/userInfo.vue index ff20c18f..cd11f4d1 100644 --- a/Yi.Vue/src/views/userInfo.vue +++ b/Yi.Vue/src/views/userInfo.vue @@ -3,11 +3,7 @@ - +
@@ -321,8 +317,12 @@ export default { this.userInfo = resp.data; this.userInfo.password = ""; this.editInfo = Object.assign({}, this.userInfo); + this.$store.commit('SET_USER',this.userInfo) }); + + + menuApi.GetTopMenusByHttpUser().then((resp) => { this.menuInfo = resp.data; }); @@ -333,9 +333,13 @@ choiceImg() { uploadImage() { const file = this.$refs.imgFile.files[0]; let formData = new FormData(); - formData.append("img", file); + formData.append("file", file); fileApi.EditIcon(formData).then(resp=>{ this.init(); + this.$dialog.notify.success(resp.msg, { + position: "top-right", + timeout: 5000, + }); }) },