From 14da702d1dafff2c98f1836027c20bf49d98e13e Mon Sep 17 00:00:00 2001 From: dyy <18335927079@163.com> Date: Tue, 2 Feb 2021 17:51:15 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E9=80=89?= =?UTF-8?q?=E4=BF=AE=E8=AF=BE=E9=80=89=E8=AF=BE=E7=BB=93=E6=9E=9C=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E3=80=81=E9=80=89=E4=BF=AE=E8=AF=BE=E9=A2=84=E9=80=89?= =?UTF-8?q?=E8=AF=BE=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E5=BD=A2=E5=BC=8F=E7=9A=84=E8=B0=83=E6=95=B4=EF=BC=9B=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E9=80=89=E4=BF=AE=E8=AF=BE=E9=80=89=E8=AF=BE?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E6=8F=90=E7=A4=BA=E3=80=81=E9=A2=84=E9=80=89?= =?UTF-8?q?=E8=AF=BE=E7=BB=93=E6=9E=9C=E6=8F=90=E7=A4=BA=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E6=95=B4=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/form.js | 3 +- .../form/form.js | 3 +- .../Modules/BaseNoAuthentication.cs | 5 ++ .../OpenLessonPlanOfElectiveStudentApi.cs | 50 +++++++++++++------ 4 files changed, 43 insertions(+), 18 deletions(-) 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