From 6e48e976c327a2ba4d31b7c652ab10005ae60a76 Mon Sep 17 00:00:00 2001 From: dyy <18335927079@163.com> Date: Fri, 20 Nov 2020 11:22:50 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF-=E5=A4=9A=E8=B4=A6=E5=8F=B7=E7=BB=91?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LoginUserBind/LoginUserBind.js | 15 +++++--- .../LoginUserBind/form/form.js | 18 ++++++---- .../LoginUserBindApi.cs | 36 +++++++++++++++++++ 3 files changed, 57 insertions(+), 12 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/LoginUserBind/LoginUserBind.js b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/LoginUserBind/LoginUserBind.js index 2c9f1751e..0f856dd05 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/LoginUserBind/LoginUserBind.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/LoginUserBind/LoginUserBind.js @@ -53,16 +53,17 @@ pagination: { rows: param.rows, page: param.page, - sidx: 'Id', + sidx: 'CreateTime desc', sord: 'DESC' }, - queryJson: '{}' + queryJson: JSON.stringify({ CreateUserId: learun.storage.get('userinfo').baseinfo.userId }) }; if (param.multipleData) { + multipleData.CreateUserId = learun.storage.get('userinfo').baseinfo.userId; _postParam.queryJson = JSON.stringify(multipleData); } if (param.begin && param.end) { - _postParam.queryJson = JSON.stringify({ StartTime: param.begin, EndTime: param.end }); + _postParam.queryJson = JSON.stringify({ StartTime: param.begin, EndTime: param.end, CreateUserId: learun.storage.get('userinfo').baseinfo.userId }); } learun.httpget(config.webapi + 'learun/EducationalAdministration/LoginUserBind/pagelist', _postParam, (data) => { $page.find('.lr-badge').text('0'); @@ -78,7 +79,11 @@ rowRender: function (_index, _item, _$item, $page) {// 渲染列表行数据 _$item.addClass('lr-list-item lr-list-item-multi'); _$item.append($('

绑定账号:

').dataFormatter({ value: _item.BindUserAccount })); - _$item.append($('

绑定密码:

').dataFormatter({ value: _item.BindUserPassword })); + _$item.append($('

绑定时间:

').dataFormatter({ + value: _item.CreateTime, + type: 'datetime', + dateformat: 'yyyy-MM-dd hh:mm:ss' + })); return ''; }, rowClick: function (item, $item, $page) {// 列表行点击触发方法 @@ -95,7 +100,7 @@ learun.layer.loading(false); }); } - }, 'Learun智慧校园提示', ['取消', '确定']); + }, '智慧校园提示', ['取消', '确定']); }, rowBtns: ['删除'] // 列表行左滑按钮 }; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/LoginUserBind/form/form.js b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/LoginUserBind/form/form.js index 83bac60f1..76da3018e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/LoginUserBind/form/form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/LoginUserBind/form/form.js @@ -12,14 +12,14 @@ isScroll: true, init: function ($page, param) { keyValue = param.keyValue; - // 添加头部按钮列表 - var _html = '\ - < div class="lr-form-header-cancel" > 取消\ -
\ + // 添加头部按钮列表 + var _html = '\ +
取消
\ +
\
\
\
\ -
提交
'; +
提交
'; $header = $page.parents('.f-page').find('.f-page-header'); $header.append(_html); // 取消 @@ -70,7 +70,7 @@ } }); } - }, 'Learun智慧校园提示', ['取消', '确定']); + }, '智慧校园提示', ['取消', '确定']); } } ], @@ -84,9 +84,13 @@ if (!$page.find('.lr-form-container').lrformValid()) { return false; } + var data = $page.find('.lr-form-container').lrformGet(); + data.BindUserAccount = $page.find('#BindUserAccount').val().trim(); + data.BindUserPassword = $page.find('#BindUserPassword').val().trim(); + data.BindUserPasswordTemp = $.md5(data.BindUserPassword); var _postData = {} _postData.keyValue = keyValue; - _postData.strEntity = JSON.stringify($page.find('.lr-form-container').lrformGet()); + _postData.strEntity = JSON.stringify(data); learun.layer.loading(true, '正在提交数据'); learun.httppost(config.webapi + 'learun/EducationalAdministration/LoginUserBind/save', _postData, (data) => { learun.layer.loading(false); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EducationalAdministration/LoginUserBindApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EducationalAdministration/LoginUserBindApi.cs index 1ca3ea4fd..2d0f5c022 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EducationalAdministration/LoginUserBindApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EducationalAdministration/LoginUserBindApi.cs @@ -2,6 +2,9 @@ using Learun.Util; using System.Collections.Generic; using Learun.Application.TwoDevelopment.EducationalAdministration; +using Learun.Application.Organization; +using System; + namespace Learun.Application.WebApi { /// @@ -14,6 +17,7 @@ namespace Learun.Application.WebApi public class LoginUserBindApi : BaseApi { private LoginUserBindIBLL loginUserBindIBLL = new LoginUserBindBLL(); + private UserIBLL userIBLL = new UserBLL(); /// /// 注册接口 @@ -97,6 +101,38 @@ namespace Learun.Application.WebApi { ReqFormEntity parameter = this.GetReqData(); LoginUserBindEntity entity = parameter.strEntity.ToObject(); + + if (entity.BindUserAccount == userInfo.account) + { + return Fail("绑定账号不能为登录用户账号!"); + } + //判断账号是否已绑定 + if (string.IsNullOrEmpty(parameter.keyValue)) + { + var aa = loginUserBindIBLL.GetEntityByBindUserAccount(entity.BindUserAccount, userInfo.userId); + if (aa != null) + { + return Fail("绑定账号已存在!"); + } + } + else + { + var aa = loginUserBindIBLL.GetEntityByBindUserAccount(entity.BindUserAccount, userInfo.userId); + if (aa != null && aa.Id != parameter.keyValue) + { + return Fail("绑定账号已存在!"); + } + } + //判断账号、密码是否可以登录 + var model = userIBLL.CheckLogin(entity.BindUserAccount, entity.BindUserPasswordTemp); + if (!model.LoginOk) + { + return Fail(model.LoginMsg); + } + entity.BindUserId = model.F_UserId; + entity.CreateUserId = userInfo.userId; + entity.CreateUserName = userInfo.realName; + entity.CreateTime = DateTime.Now; loginUserBindIBLL.SaveEntity(this.userInfo, parameter.keyValue, entity); return Success("保存成功!"); }