Commit e8e891f5c6d219536b62652af9b6dc80ded6a7eb
1 parent
22d16e28
登入页面删除多余的代码
Showing
4 changed files
with
8 additions
and
155 deletions
web/WebMvc/Controllers/LoginController.cs
... | ... | @@ -2,13 +2,10 @@ |
2 | 2 | using Hh.Mes.Common.config; |
3 | 3 | using Hh.Mes.Common.Json; |
4 | 4 | using Hh.Mes.POJO.Entity; |
5 | -using Hh.Mes.POJO.EnumEntitys; | |
6 | 5 | using Hh.Mes.POJO.Response; |
7 | 6 | using Hh.Mes.Service; |
8 | -using Hh.Mes.Service.Configure; | |
9 | 7 | using Hh.Mes.Service.Logs; |
10 | 8 | using Hh.Mes.Service.SystemAuth; |
11 | -using Hh.Mes.Service.WebService.Base; | |
12 | 9 | using Microsoft.AspNetCore.Http; |
13 | 10 | using Microsoft.AspNetCore.Mvc; |
14 | 11 | using Microsoft.Net.Http.Headers; |
... | ... | @@ -16,7 +13,6 @@ using System; |
16 | 13 | using System.Linq; |
17 | 14 | using System.Reflection; |
18 | 15 | using System.Text; |
19 | -using WebMvc.Common; | |
20 | 16 | |
21 | 17 | namespace WebMvc |
22 | 18 | { |
... | ... | @@ -25,32 +21,20 @@ namespace WebMvc |
25 | 21 | #region 属性 |
26 | 22 | private readonly string _appKey = "hhweb"; |
27 | 23 | private readonly IAuth _authUtil; |
28 | - private readonly SysCompanyService sysCompanyService; | |
29 | 24 | private readonly FaceLoginService faceLoginService; |
30 | - private readonly SysAppService sysAppService; | |
31 | 25 | private readonly LogService logService; |
32 | 26 | #endregion |
33 | 27 | |
34 | - public LoginController(IAuth authUtil, SysCompanyService sysCompanyService, FaceLoginService faceLoginService, SysAppService sysAppService,LogService logService) | |
28 | + public LoginController(IAuth authUtil, LogService logService, FaceLoginService faceLoginService) | |
35 | 29 | { |
36 | 30 | _authUtil = authUtil; |
37 | - | |
38 | - this.sysCompanyService = sysCompanyService; | |
39 | 31 | this.faceLoginService = faceLoginService; |
40 | - this.sysAppService = sysAppService; | |
41 | 32 | this.logService = logService; |
42 | 33 | } |
43 | 34 | |
44 | 35 | public ActionResult Index() |
45 | 36 | { |
46 | - //var company = sysCompanyService.GetSysCompanyOne(); | |
47 | - //var sysFile = sysCompanyService.GetSysFile(company.companyId); | |
48 | - ViewBag.filePath = sysAppService.Download(); | |
49 | - // ViewBag.ver = company.ver; | |
50 | - //ViewBag.keyStr = JsEncrypt._keyStr; | |
51 | - // ViewBag.Url = sysFile.FirstOrDefault(x => x.position == "home")?.url; | |
52 | 37 | ViewBag.copyright = "Copyright © " + DateTime.Now.ToString("yyyy ") + AppSettings.GetAppSeting("copyright"); |
53 | - | |
54 | 38 | return View(); |
55 | 39 | } |
56 | 40 | |
... | ... | @@ -77,20 +61,6 @@ namespace WebMvc |
77 | 61 | password = Encryption.Decrypt(faceResult.Result.password); |
78 | 62 | #endregion |
79 | 63 | } |
80 | - else if (!string.IsNullOrEmpty(webcam)) | |
81 | - { | |
82 | - #region 人脸登入 | |
83 | - Response faceResult = faceLoginService.FaceSearchService(webcam); | |
84 | - if (faceResult.Code == -100 || faceResult.Code == -200) | |
85 | - { | |
86 | - resp.Code = 500; | |
87 | - resp.Message = faceResult.Message; | |
88 | - return JsonHelper.Instance.Serialize(resp); | |
89 | - } | |
90 | - username = faceResult.Result.account; | |
91 | - password = Encryption.Decrypt(faceResult.Result.password); | |
92 | - #endregion | |
93 | - } | |
94 | 64 | password = JsEncrypt.DecodeBase64(Encoding.Default, password); |
95 | 65 | var result = _authUtil.Login(_appKey, username, password); |
96 | 66 | if (result.Code == 200) |
... | ... | @@ -145,13 +115,13 @@ namespace WebMvc |
145 | 115 | ViewBag.msgInfo = loginResponseResult.Message + "--" + userInfo; |
146 | 116 | return View(); |
147 | 117 | } |
148 | - var herf= sysCompanyService.GetDictionaryDictValue(MethodBase.GetCurrentMethod().Name); | |
118 | + //var herf= sysCompanyService.GetDictionaryDictValue(MethodBase.GetCurrentMethod().Name); | |
149 | 119 | var cookieOptions = new CookieOptions(); |
150 | 120 | Response.Cookies.Append(SSOAuthAttribute.token, loginResponseResult.Token, cookieOptions); |
151 | 121 | //javascript 输出到页面 写入缓存跳转页面 |
152 | - ViewBag.js = $@"localStorage.setItem('Account', '{loginResponseResult.Result.Account}'); | |
153 | - localStorage.setItem('Name', '{loginResponseResult.Result.Name}') | |
154 | - window.location.href = '{herf}'"; | |
122 | + //ViewBag.js = $@"localStorage.setItem('Account', '{loginResponseResult.Result.Account}'); | |
123 | + // localStorage.setItem('Name', '{loginResponseResult.Result.Name}') | |
124 | + // window.location.href = '{herf}'"; | |
155 | 125 | return View(); |
156 | 126 | } |
157 | 127 | |
... | ... |
web/WebMvc/Views/Login/Index.cshtml
1 | 1 | @using Hh.Mes.Common.config |
2 | -@model List<SelectListItem> | |
3 | 2 | @{ |
4 | 3 | Layout = null; |
5 | 4 | } |
... | ... | @@ -23,19 +22,12 @@ |
23 | 22 | color: black; |
24 | 23 | } |
25 | 24 | |
26 | - /* .layui-form-select dl dd.layui-select-tips { | |
27 | - color: black; | |
28 | - }*/ | |
29 | 25 | </style> |
30 | 26 | </head> |
31 | 27 | <body class="main"> |
32 | 28 | <div id="mainBody"> |
33 | 29 | <div id="cloud1" class="cloud" style="background-position: 891.1px 100px;"></div> |
34 | 30 | <div id="cloud2" class="cloud" style="background-position: 401px 460px;"></div> |
35 | - <div class="LoginQrCode"> | |
36 | - <h1 style="color:#FFFFFF">PDA 浏览器扫码打开地址</h1> | |
37 | - <img src="~/images/login/LoginQRCode.png" alt="" /> | |
38 | - </div> | |
39 | 31 | </div> |
40 | 32 | |
41 | 33 | <div class="logintop"> |
... | ... | @@ -44,21 +36,17 @@ |
44 | 36 | </ul> |
45 | 37 | <ul> |
46 | 38 | <li><b><lable style="font-size:30px;color: white;">@ConfigRead.GetInstance.GetAppsetConnection().LoginTitle</lable></b></li> |
47 | - <li><b><lable style="font-size:30px;color: white;"><a href="@ViewBag.filePath">PDA</a> </lable></b></li> | |
48 | - <li><b><lable style="font-size:30px;color: white;"><a href="~/app/kanbanv1.0.100.apk">看板</a> </lable></b></li> | |
49 | - <li><b><lable style="font-size:30px;color: white;"><a href="https://www.google.cn/chrome/thank-you.html?platform=win64&standalone=1&statcb=0&installdataindex=empty&defaultbrowser=0">Google</a> </lable></b></li> | |
39 | + <li><b><lable style="font-size:30px;color: white;"><a target="_blank" href="https://www.google.cn/chrome/thank-you.html?platform=win64&standalone=1&statcb=0&installdataindex=empty&defaultbrowser=0">Google浏览器下载</a> </lable></b></li> | |
50 | 40 | </ul> |
51 | 41 | </div> |
52 | 42 | |
53 | 43 | <div class="loginbody"> |
54 | 44 | <span class="systemlogo"></span> |
55 | 45 | <div class="loginbox" style="position: absolute; left: 40%;top:25%"> |
56 | - <lable class="ver">@ViewBag.ver</lable> | |
57 | 46 | <div class="layui-tab layui-tab-brief" style="margin-top:10px; width:320px" lay-filter="loginWebcam"> |
58 | 47 | <ul class="layui-tab-title"> |
59 | 48 | <li class="layui-this" lay-id="1">默认</li> |
60 | - <li lay-id="2">人脸识别</li> | |
61 | - <li lay-id="3">刷卡登入</li> | |
49 | + <li lay-id="2">刷卡登入</li> | |
62 | 50 | </ul> |
63 | 51 | <div class="layui-tab-content"> |
64 | 52 | <div class="layui-tab-item layui-show"> |
... | ... | @@ -71,20 +59,12 @@ |
71 | 59 | <input name="password" type="password" autocomplete="new-password" class="loginpwd ipt" placeholder="请输入密码" lay-verify="required"> |
72 | 60 | </li> |
73 | 61 | <li> |
74 | - <select name="lineCode" asp-items="@Model"></select> | |
75 | - </li> | |
76 | - <li> | |
77 | 62 | <button class="layui-btn loginbtn" style="width: 105px; margin-top: 30px" lay-submit lay-filter="login">登录</button> |
78 | 63 | </li> |
79 | 64 | </ul> |
80 | 65 | </form> |
81 | 66 | </div> |
82 | 67 | <div class="layui-tab-item"> |
83 | - <div id="webcam"></div> | |
84 | - <button class="layui-btn loginbtn" style="width: 105px; margin-top: 10px" id="btnTakeSnapshot">拍照登入</button> | |
85 | - </div> | |
86 | - <div id="ccvMessage" style="color: #009688;margin-top: 7px;"> </div> | |
87 | - <div class="layui-tab-item"> | |
88 | 68 | <form><input id="IdCard" name="IdCard" type="password" autocomplete="off" class="loginpwd ipt" placeholder="请输入卡号" lay-verify="required"> </form> |
89 | 69 | </div> |
90 | 70 | </div> |
... | ... | @@ -96,9 +76,6 @@ |
96 | 76 | <div class="loginbm">@ViewBag.copyright</div> |
97 | 77 | |
98 | 78 | <script type="text/javascript" src="/layui/layui.js"></script> |
99 | - <script src="~/js/face/webcam.js"></script> | |
100 | - <script src="~/js/face/ccv.js"></script> | |
101 | - <script src="~/js/face/face.js"></script> | |
102 | 79 | <script src="~/baseJs/JsEncrypt.js"></script> |
103 | 80 | <script type="text/javascript" src="/basejs/login.js" asp-append-version="true"></script> |
104 | 81 | </body> |
... | ... |
web/WebMvc/wwwroot/baseJs/login.js
1 | 1 | var layer = null, |
2 | 2 | $ = null, |
3 | 3 | IdCard = document.getElementById("IdCard"), |
4 | - canvas=document.createElement("canvas"), | |
5 | - btnTakeSnapshot = document.getElementById("btnTakeSnapshot"), | |
6 | - isSendFlag = false, | |
7 | - tabIndex=0, | |
8 | - WebcamObj = null; | |
4 | + tabIndex=0; | |
9 | 5 | |
10 | 6 | var login = { |
11 | - initWebCam: () => { | |
12 | - Webcam.set({ | |
13 | - width: 320, | |
14 | - height: 240, | |
15 | - image_format: "jpeg", | |
16 | - jpeg_quality: 90 | |
17 | - }); | |
18 | - Webcam.attach("#webcam"); | |
19 | - WebcamObj = true; | |
20 | - }, | |
21 | - | |
22 | - //销毁摄像头 | |
23 | - cancalCloseVideo: () => { | |
24 | - Webcam.reset("#webcam"); | |
25 | - Webcam.reset(); | |
26 | - }, | |
27 | 7 | //登入方法 |
28 | 8 | LoginMethod: (bodyValue) => { |
29 | - isSendFlag = true; | |
30 | 9 | var index = 0; |
31 | 10 | if (tabIndex != 1) index = layer.load(); |
32 | 11 | |
... | ... | @@ -39,7 +18,6 @@ var login = { |
39 | 18 | }).then(function (res) { |
40 | 19 | return res.json(); |
41 | 20 | }).then(function (data) { |
42 | - isSendFlag = false; | |
43 | 21 | if (data.Code === 200) { |
44 | 22 | layer.msg(data.Result.Account + " " + data.Result.Name, { icon: 6, shade: 0.4, time: 10000 }); |
45 | 23 | localStorage.setItem("Account", data.Result.Account); |
... | ... | @@ -52,63 +30,15 @@ var login = { |
52 | 30 | } |
53 | 31 | layer.close(index); |
54 | 32 | }).catch(function (error) { |
55 | - isSendFlag = false; | |
56 | 33 | if (layer != null) document.getElementById("loginMessage").innerHTML = "登入失败"; |
57 | 34 | }); |
58 | 35 | }, |
59 | 36 | |
60 | - //自动刷脸登入 | |
61 | - initWebcamLogin: () => { | |
62 | - setInterval(() => { | |
63 | - if (WebcamObj == null) return; | |
64 | - if (isSendFlag) { | |
65 | - console.log("请求中 "); | |
66 | - return; | |
67 | - }; | |
68 | - if (tabIndex != 1) return; | |
69 | - var v = document.querySelector('#webcam video'); | |
70 | - if (v == null) return; | |
71 | - var ctx = canvas.getContext('2d'); | |
72 | - var height = v.videoHeight; | |
73 | - var width = v.videoWidth; | |
74 | - if (height == 0 || width == 0) return; | |
75 | - canvas.height = height; | |
76 | - canvas.width = width; | |
77 | - ctx.drawImage(v, 0, 0, width, height); | |
78 | - | |
79 | - var comp = ccv.detect_objects({ | |
80 | - "canvas": ccv.grayscale(ccv.pre(canvas)), | |
81 | - "cascade": cascade, | |
82 | - "interval": 5, | |
83 | - "min_neighbors": 1 | |
84 | - }); | |
85 | - if (comp.length > 0) { | |
86 | - btnTakeSnapshot.click(); | |
87 | - } | |
88 | - document.getElementById("ccvMessage").innerHTML = "检测图片结果: " + (comp.length ? '有人脸' : "没人脸"); | |
89 | - }, 1500); | |
90 | - }, | |
91 | 37 | |
92 | 38 | //注册事件 |
93 | 39 | initEvents: () => { |
94 | 40 | //刷卡登入 |
95 | 41 | IdCard.addEventListener('input', debounce(handle, 500)); |
96 | - | |
97 | - //拍照 | |
98 | - btnTakeSnapshot.addEventListener("click", function () { | |
99 | - if (WebcamObj == null) { | |
100 | - alert("请等待摄像启动完成后再拍照登入"); | |
101 | - return; | |
102 | - } | |
103 | - Webcam.snap(function (data_uri) { | |
104 | - if (data_uri == null) { | |
105 | - alert("请等待摄像启动完成后再拍照登入"); | |
106 | - return; | |
107 | - } | |
108 | - var value = `username=''&password=''&webcam=${data_uri}&idcard=`; | |
109 | - login.LoginMethod(value); | |
110 | - }); | |
111 | - }); | |
112 | 42 | } |
113 | 43 | } |
114 | 44 | var isChrome = window.navigator.userAgent.indexOf("Chrome") > -1; |
... | ... | @@ -116,7 +46,6 @@ if (!isChrome) { |
116 | 46 | alert("推荐使用谷歌浏览器登录使用,以免产生浏览器不兼容出现的错误"); |
117 | 47 | } |
118 | 48 | login.initEvents(); |
119 | -login.initWebcamLogin(); | |
120 | 49 | |
121 | 50 | // 防抖 |
122 | 51 | function debounce(fn, delay) { |
... | ... | @@ -147,20 +76,12 @@ layui.config({ base: "/js/" }).use(["form", "layer", "element"], function () { |
147 | 76 | element.on("tab(loginWebcam)", function (data) { |
148 | 77 | tabIndex = data.index; |
149 | 78 | if (data.index===1) { |
150 | - login.initWebCam(); | |
151 | - } else if (data.index === 2) { | |
152 | 79 | IdCard.focus(); |
153 | 80 | } else { |
154 | 81 | document.getElementById("loginMessage").innerHTML = ""; |
155 | 82 | } |
156 | 83 | }); |
157 | 84 | |
158 | - localStorage.setItem("sysWhereLineSelect","all"); | |
159 | - form.on("select", function (data) { | |
160 | - localStorage.setItem("sysWhereLineSelect", data.value); | |
161 | - }); | |
162 | - | |
163 | - | |
164 | 85 | |
165 | 86 | //登录按钮事件 |
166 | 87 | form.on("submit(login)", function (data) { |
... | ... |
web/WebMvc/wwwroot/css/login.css
... | ... | @@ -35,7 +35,6 @@ h2{font-weight:normal;} |
35 | 35 | .loginbody{ width:80%; height:600px; overflow:hidden; position:fixed;left:20%;top:10%;} |
36 | 36 | .systemlogo{background:url(/images/login/logo.png) no-repeat center;width:100%; height:70px; margin-top:40px;} |
37 | 37 | .loginbox{width:400px; height:330px; margin-top:10px;margin-left:10%;background:rgba(255,255,255,0.03);border-radius:30px;} |
38 | -.ver {font-size: 20px;} | |
39 | 38 | .loginbox ul li {margin-bottom: 25px;} |
40 | 39 | .loginbox ul li label{color:#687f92; padding-left:25px;} |
41 | 40 | .loginbox ul li label a{color:#687f92;} |
... | ... | @@ -77,17 +76,3 @@ h2{font-weight:normal;} |
77 | 76 | font-family: "Helvetica Neue","Hiragino Sans GB","Microsoft YaHei","\9ED1\4F53",Arial,sans-serif;color:#DDD;font-size: 12px; |
78 | 77 | } |
79 | 78 | .loginbox {color: #fff;} |
80 | - | |
81 | -.LoginQrCode {display: none} | |
82 | - | |
83 | -/*手机*/ | |
84 | -@media screen and (max-width:600px) { | |
85 | - .loginbody { | |
86 | - display: none | |
87 | - } | |
88 | - | |
89 | - .LoginQrCode { | |
90 | - display: block; | |
91 | - padding-top: 200px; | |
92 | - } | |
93 | -} | |
94 | 79 | \ No newline at end of file |
... | ... |