diff --git a/.gitignore b/.gitignore index be4510866..d97eb9a0c 100644 --- a/.gitignore +++ b/.gitignore @@ -75,3 +75,4 @@ typings/ unpackage Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js +/Learun.Framework.Ultimate V7/Learun.Application.Web/Resource/System/20200831 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs index 767ce3dda..8b6bbbca1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs @@ -1069,5 +1069,56 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers #endregion + #region 上传图片 + [HttpPost] + [AjaxOnly] + public ActionResult IsPhoto(string stuId, string base64url) + { + var loginuser = LoginUserInfo.Get(); + //头像处理 + var folderId = Guid.NewGuid().ToString(); + + string filePath = Config.GetValue("AnnexesFile"); + string uploadDate = DateTime.Now.ToString("yyyyMMdd"); + string FileEextension = ".png"; + string fileGuid = Guid.NewGuid().ToString(); + + string virtualPath = string.Format("{0}/{1}/{2}/{3}{4}", filePath, loginuser.account, uploadDate, fileGuid, FileEextension); + + //创建文件夹 + string path = Path.GetDirectoryName(virtualPath); + Directory.CreateDirectory(path); + AnnexesFileEntity fileAnnexesEntity = new AnnexesFileEntity(); + if (!System.IO.File.Exists(virtualPath)) + { + byte[] bytes = Convert.FromBase64String(base64url.Replace("data:image/png;base64,", "")); + FileInfo file = new FileInfo(virtualPath); + FileStream fs = file.Create(); + fs.Write(bytes, 0, bytes.Length); + fs.Close(); + + //文件信息写入数据库 + fileAnnexesEntity.F_Id = fileGuid; + fileAnnexesEntity.F_FileName = "userphoto.png"; + fileAnnexesEntity.F_FilePath = virtualPath; + fileAnnexesEntity.F_FileSize = bytes.Length.ToString(); + fileAnnexesEntity.F_FileExtensions = FileEextension; + fileAnnexesEntity.F_FileType = FileEextension.Replace(".", ""); + fileAnnexesEntity.F_CreateUserId = loginuser.userId; + fileAnnexesEntity.F_CreateUserName = loginuser.realName; + annexesFileIBLL.SaveEntity(folderId, fileAnnexesEntity); + } + var result = stuInfoFreshIBLL.IsPhoto(stuId, true, fileGuid); + if (result.Item1) + { + return Success(result.Item2); + } + else + { + return Fail(result.Item2); + } + } + #endregion + } } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/RegisterIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/RegisterIndex.cshtml index 6edaf1c20..3972a842e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/RegisterIndex.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/RegisterIndex.cshtml @@ -6,7 +6,6 @@ .lr-select { width: 150px; } -
@@ -17,7 +16,7 @@
-
+
 查询 @@ -29,8 +28,8 @@
 打印报道流程单 -  查看 -  确认报到 +  查看 +  确认报到  取消报到
@@ -39,7 +38,226 @@
+ + + -@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuInfoFresh/RegisterIndex.js") +@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuInfoFresh/RegisterIndex.js", "/Content/camera/cropper.min.js", + "/Areas/EducationalAdministration/Views/StuEnroll/LodopFuncs.js") +@Html.AppendCssFile("/Content/camera/cropper.min.css", "/Content/camera/ImgCropping.css") + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/RegisterIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/RegisterIndex.js index 487dbcded..327e400fe 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/RegisterIndex.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/RegisterIndex.js @@ -6,13 +6,14 @@ */ var selectedRow; var refreshGirdData; +var StuId; var bootstrap = function ($, learun) { "use strict"; var page = { init: function () { page.bind(); page.initGird(); - + }, bind: function () { // 查询 @@ -44,22 +45,38 @@ var bootstrap = function ($, learun) { }); // 确认报到 $('#lr_register').on('click', function () { - var keyValue = $('#gridtable').jfGridValue('ID'); + StuId = $('#gridtable').jfGridValue('ID'); selectedRow = $('#gridtable').jfGridGet('rowdata'); - if (learun.checkrow(keyValue)) { + if (learun.checkrow(StuId)) { if (selectedRow.RegisterStatus == "1") { learun.alert.warning("当前新生已报到!"); return; } + + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuInfoFresh/GetFormData?keyValue=' + StuId, function (data) { + console.log(data); + $('#userPhoto').attr('src', data.Url); + takeImg(); + }); + + + + } + }); + $("#sureReport").on('click', function () { + StuId = $('#gridtable').jfGridValue('ID'); + if (learun.checkrow(StuId)) { learun.layerConfirm('是否确认报到!', function (res) { if (res) { - learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuInfoFresh/IsRegister', { keyValue: keyValue, status: 1 }, function () { + learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuInfoFresh/IsRegister', { keyValue: StuId, status: 1 }, function () { + refreshGirdData(); + closeTailor(); refreshGirdData(); }); } }); } - }); + }) //打印报道流程单 $('#lr_printlc').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config index ba0b18104..3ae661d68 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config @@ -63,7 +63,7 @@ - + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshBLL.cs index 3b9475e39..728828dbd 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshBLL.cs @@ -689,11 +689,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } - public void GetUniform(string keyValue,bool Status) + public void GetUniform(string keyValue, bool Status) { try { - stuInfoFreshService.GetUniform(keyValue,Status); + stuInfoFreshService.GetUniform(keyValue, Status); } catch (Exception ex) { @@ -707,11 +707,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } - public void PayUniform(string keyValue,bool Status) + public void PayUniform(string keyValue, bool Status) { try { - stuInfoFreshService.PayUniform(keyValue,Status); + stuInfoFreshService.PayUniform(keyValue, Status); } catch (Exception ex) { @@ -771,5 +771,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } #endregion + #region 上传图片 + public (bool, string) IsPhoto(string stuId, bool status, string fileGuid) + { + try + { + return stuInfoFreshService.IsPhoto(stuId, status, fileGuid); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshIBLL.cs index 7f330cee1..5a6792b0f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshIBLL.cs @@ -200,5 +200,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// void DeleteBed(string keyValue); #endregion + + #region 上传图片 + + (bool, string) IsPhoto(string stuId, bool status, string fileGuid); + + #endregion } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshService.cs index ab3504cc3..37ffb8927 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshService.cs @@ -1606,5 +1606,41 @@ where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo #endregion + #region 上传图片 + + internal (bool, string) IsPhoto(string stuId, bool status, string fileGuid) + { + try + { + string result = ""; + bool resultBool = false; + var model = this.BaseRepository("CollegeMIS").FindEntity(a => a.ID == stuId); + if (model != null) + { + model.Photo = fileGuid; + resultBool = true; + result = "操作成功!"; + this.BaseRepository("CollegeMIS").Update(model); + } + else + { + result = "错误"; + } + return (resultBool, result); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion } }