diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/OpenLessonPlanOfElectiveStudent/form/form.js b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/OpenLessonPlanOfElectiveStudent/form/form.js index 8830da9a6..a99713025 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/OpenLessonPlanOfElectiveStudent/form/form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/OpenLessonPlanOfElectiveStudent/form/form.js @@ -35,7 +35,8 @@ dataresult, inforesult) => { learun.layer.loading(false); clearInterval(timer); - learun.layer.toast(inforesult); + //learun.layer.toast(inforesult); + learun.layer.toast(dataresult.msg); learun.nav.closeCurrent(); var prepage = learun.nav.getpage('EducationalAdministration/OpenLessonPlanOfElectiveStudent'); prepage.grid.reload(); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/OpenLessonPlanOfElectiveStudentPre/form/form.js b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/OpenLessonPlanOfElectiveStudentPre/form/form.js index 8dc1d0760..91bd59fd0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/OpenLessonPlanOfElectiveStudentPre/form/form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/OpenLessonPlanOfElectiveStudentPre/form/form.js @@ -26,7 +26,8 @@ learun.httppost(config.webapi + 'learun/EducationalAdministration/OpenLessonPlanOfElectiveStudent/SignInPre', _postData, (data,info) => { learun.layer.loading(false); if (data) {// 表单数据保存成功 - learun.layer.toast(info); + //learun.layer.toast(info); + learun.layer.toast(data.msg); learun.nav.closeCurrent(); var prepage = learun.nav.getpage('EducationalAdministration/OpenLessonPlanOfElectiveStudentPre'); prepage.grid.reload(); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseNoAuthentication.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseNoAuthentication.cs index 9fa1916c4..03d41f4bc 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseNoAuthentication.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseNoAuthentication.cs @@ -139,6 +139,11 @@ namespace Learun.Application.WebApi ResParameter res = new ResParameter { code = ResponseCode.fail, info = info, data = new object { } }; return Response.AsText(res.ToJson()).WithContentType("application/json"); } + public Response Fail(T data) where T : class + { + ResParameter res = new ResParameter { code = ResponseCode.fail, info = "响应失败", data = data }; + return Response.AsText(res.ToJson()).WithContentType("application/json"); + } public Response FailNoLogin(string info) { ResParameter res = new ResParameter { code = ResponseCode.nologin, info = info, data = new object { } }; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/OpenLessonPlanOfElectiveStudentApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/OpenLessonPlanOfElectiveStudentApi.cs index 3165b4cbb..f349f5856 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/OpenLessonPlanOfElectiveStudentApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/OpenLessonPlanOfElectiveStudentApi.cs @@ -42,6 +42,8 @@ namespace Learun.Application.WebApi private Response GetApplyResult(dynamic _) { + var msg = "正在提交,请等待!";//返回结果信息 + var resultData = new { msg = msg }; dynamic parameter = this.GetReqData(); string keyValue = parameter.keyValue; string account = parameter.StuNo; @@ -49,13 +51,15 @@ namespace Learun.Application.WebApi var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(account); if (stuInfoBasicEntity == null) { - return Success("当前学员不存在!"); + msg = "当前学员不存在!"; + return Success(resultData); } //课程信息 var olpeEntity = openLessonPlanOfElectiveIbll.GetOpenLessonPlanOfElectiveEntity(keyValue); if (olpeEntity == null) { - return Success("当前课程不存在!"); + msg = "当前课程不存在!"; + return Success(resultData); } //当前学员本学期是否有报名课程:每学期一门 @@ -93,11 +97,13 @@ namespace Learun.Application.WebApi { if (sslleEntity.Status == 1) { - return Success("当前课程报名审核中,请耐心等待!"); + msg = "当前课程报名审核中,请耐心等待!"; + return Success(resultData); } else if (sslleEntity.Status == 2) { - return Success("当前课程已报名成功!"); + msg = "当前课程已报名成功!"; + return Success(resultData); } } else @@ -107,7 +113,8 @@ namespace Learun.Application.WebApi var aaa = aa.Count(x => x.Status == 1 || x.Status == 2); if (aaa >= olpeEntity.StuNumMax) { - return Success("当前课程报名人数已满,请选择其他课程!"); + msg = "当前课程报名人数已满,请选择其他课程!"; + return Success(resultData); } //每学期最多两门 var sslleList = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveListByStuNo(account); @@ -115,17 +122,19 @@ namespace Learun.Application.WebApi var sslleListOfNow1 = sslleListOfNow.Where(x => x.Status == 1 || x.Status == 2); if (sslleListOfNow1.Count() >= Config.GetValue("ElectiveLessonApplyMax").ToInt()) { - return Success("每学期最多选择" + Config.GetValue("ElectiveLessonApplyMax").ToInt() + "门选修课!"); + msg = "每学期最多选择" + Config.GetValue("ElectiveLessonApplyMax").ToInt() + "门选修课!"; + return Success(resultData); } //相同时间不能报名 if (sslleListOfNow1.Where(x => x.LessonSection == olpeEntity.LessonSection).Any()) { //相同时间不能报名 - return Success("本学期此时间段已有报名的选修课!"); + msg = "本学期此时间段已有报名的选修课!"; + return Success(resultData); } } - return Fail("正在提交,请等待!"); + return Fail(resultData); } #region 获取数据 @@ -312,6 +321,8 @@ namespace Learun.Application.WebApi /// public Response SignInPre(dynamic _) { + var msg = "报名成功";//返回结果信息 + var resultData = new { msg = msg }; dynamic parameter = this.GetReqData(); string keyValue = parameter.keyValue; string account = parameter.StuNo; @@ -319,20 +330,23 @@ namespace Learun.Application.WebApi var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(account); if (stuInfoBasicEntity == null) { - return Fail("当前学员不存在!"); + msg = "当前学员不存在!"; + return Fail(resultData); } //课程信息 var olpeEntity = openLessonPlanOfElectiveIbll.GetOpenLessonPlanOfElectiveEntity(keyValue); if (olpeEntity == null) { - return Fail("当前课程不存在!"); + msg = "当前课程不存在!"; + return Fail(resultData); } //所选课程的报名人数是否已满 var aa = stuSelectLessonListOfElectivePreIBLL.GetStuSelectLessonListOfElectivePreListByOLPEId(olpeEntity.Id); var aaa = aa.Where(x => x.Status == 2).Count(); if (aaa >= olpeEntity.StuNumMax) { - return Fail("当前课程报名人数已满,请选择其他课程!"); + msg = "当前课程报名人数已满,请选择其他课程!"; + return Fail(resultData); } //当前学员本学期是否有报名课程:每学期一门 //var sslleEntity = stuSelectLessonListOfElectivePreIBLL.GetStuSelectLessonListOfElectivePreEntityByStuNo(account, ""); @@ -364,7 +378,8 @@ namespace Learun.Application.WebApi var sslleListOfNow2 = sslleListOfNow.Where(x => x.Status == 3); if (sslleListOfNow1.Count() >= Config.GetValue("ElectiveLessonApplyMax").ToInt()) { - return Fail("每学期最多选择" + Config.GetValue("ElectiveLessonApplyMax").ToInt() + "门选修课!"); + msg = "每学期最多选择" + Config.GetValue("ElectiveLessonApplyMax").ToInt() + "门选修课!"; + return Fail(resultData); } else { @@ -373,11 +388,13 @@ namespace Learun.Application.WebApi { if (m.Status == 1) { - return Fail("当前课程报名审核中,请耐心等待!"); + msg = "当前课程报名审核中,请耐心等待!"; + return Fail(resultData); } else if (m.Status == 2) { - return Fail("当前课程已报名成功!"); + msg = "当前课程已报名成功!"; + return Fail(resultData); } } } @@ -392,7 +409,8 @@ namespace Learun.Application.WebApi if (sslleListOfNow1.Select(x => x.LessonSection == olpeEntity.LessonSection).Any()) { //相同时间不能报名 - return Success("本学期此时间段已有报名的选修课!"); + msg = "本学期此时间段已有报名的选修课!"; + return Success(resultData); } //新增报名数据 var model = new StuSelectLessonListOfElectivePreEntity() @@ -434,7 +452,7 @@ namespace Learun.Application.WebApi }; stuSelectLessonListOfElectivePreIBLL.SaveEntity("", model); - return Success("报名成功"); + return Success(resultData); } #endregion