| | |
| | | // 设置路径 |
| | | inPath=UK_Data.return_value;//获得返回的UK的路径 |
| | | |
| | | s_simnew1.GetChipID(inPath);//返回芯片唯一ID |
| | | s_simnew1.GetProduceDate(inPath);//返回芯片唯一ID |
| | | break; |
| | | case 2: |
| | | if(UK_Data.LastError!=0){ |
| | |
| | | <canvas ref="canvas" width="480" height="320"></canvas> |
| | | <p style="text-align:center">{{face.detect}}</p> |
| | | </Modal> |
| | | <Modal |
| | | v-model="status" |
| | | title="图片上传" |
| | | width="480px" |
| | | footer-hide> |
| | | <Upload |
| | | multiple |
| | | :max-size="10240" |
| | | :format="['jpg','jpeg','png']" |
| | | :before-upload="beforeAvatarUpload" |
| | | type="drag" |
| | | action=""> |
| | | <div style="padding: 20px 0"> |
| | | <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon> |
| | | <p style="color:red;">提示:图片大小不超过2MB,图像人脸角度端正,图像清晰;</p> |
| | | </div> |
| | | </Upload> |
| | | </Modal> |
| | | </div> |
| | | <script type="text/javascript" src="js/jquery.js"></script> |
| | | <script type="text/javascript" src="element-ui/vue.min.js"></script> |
| | |
| | | }, |
| | | // ukey对应的用户的登录方式 1为用户名密码 2为人脸 |
| | | login_type: 1, |
| | | softUKey: new SoftUKey(SoftKey3W) |
| | | softUKey: new SoftUKey(SoftKey3W), |
| | | status: false, |
| | | UName: '', |
| | | UId: '', |
| | | }, |
| | | watch: { |
| | | userfocus: function() { |
| | |
| | | url: 'LoginAction_getRandom', |
| | | data: null, |
| | | success: function(res) { |
| | | console.log(res); |
| | | let rs = JSON.parse(res.result); |
| | | if(rs.code == 1) { |
| | | let randomNumber = rs.data; |
| | | console.log(self.softUKey); |
| | | self.softUKey.getSign(randomNumber, self.checkUKeySign); |
| | | }else { |
| | | self.$message.error("服务器连接异常!"); |
| | |
| | | self.checkUser(); |
| | | }else { |
| | | self.msg = rs.msg; |
| | | self.checkUser(); |
| | | } |
| | | }, |
| | | error: function(error) { |
| | |
| | | var UKey_ID = this.info.UKey_ID; |
| | | password = hex_md5(password); |
| | | // 请求后台 |
| | | ajax({ |
| | | $.ajax({ |
| | | url: 'LoginAction_login', |
| | | data: "uinf.UName="+user+"&uinf.Upassword="+password+"&uinf.UId=1"+"&uinf.UKey_ID="+UKey_ID, |
| | | success: function(res) { |
| | |
| | | //self.loading = true; |
| | | // 进入首页 |
| | | //self.toIndex(rs.msg); |
| | | self.login_type = 2; |
| | | self.$Message.message('success', { |
| | | content: '静态密码验证成功', |
| | | duration: 3 |
| | | }); |
| | | //self.login_type = 2; |
| | | self.checkFaceExist(user); |
| | | }else { |
| | | self.msg = rs.msg; |
| | | if (rs.data) { |
| | |
| | | complete: function() { |
| | | self.verify = false; |
| | | } |
| | | }); |
| | | }, |
| | | checkFaceExist(UName) { |
| | | let self = this; |
| | | $.ajax({ |
| | | type: "post", |
| | | url: 'LoginAction_faceExist', |
| | | data: 'json='+JSON.stringify({ |
| | | UName, |
| | | }), |
| | | success: function(res) { |
| | | let rs = JSON.parse(res.result); |
| | | if(rs.code == 1) { |
| | | self.$Message.message('success', { |
| | | content: '静态密码验证成功', |
| | | duration: 3 |
| | | }); |
| | | self.login_type = 2; |
| | | }else { |
| | | self.status = true; |
| | | self.$Message.message('warning', { |
| | | content: '用户未录入人脸,请先录入。', |
| | | duration: 3 |
| | | }); |
| | | } |
| | | self.UName = UName; |
| | | self.UId = "1002"; |
| | | }, |
| | | error: function(e){ |
| | | self.$Message.message('warning', { |
| | | content: '请求网路异常', |
| | | duration: 3 |
| | | }); |
| | | console.log(e); |
| | | } |
| | | }); |
| | | }, |
| | | // 图片上传前 |
| | | beforeAvatarUpload(file) { |
| | | let seft = this; |
| | | const isJPG = file.type === 'image/jpeg' || file.type === 'image/png'; |
| | | const isLt2M = file.size / 1024 / 1024 < 2; |
| | | if (!isJPG) { |
| | | seft.$Message.error({ |
| | | duration:3, |
| | | background: true, |
| | | content: '上传头像图片只能是 JPG或PNG 格式!' |
| | | }); |
| | | return false; |
| | | } |
| | | if (!isLt2M) { |
| | | seft.$Message.error({ |
| | | duration:3, |
| | | background: true, |
| | | content: '上传头像图片大小不能超过 2MB!' |
| | | }); |
| | | return false; |
| | | } |
| | | // 图片转base64 |
| | | seft.getBase64(file).then(res=>{ |
| | | seft.imageUrl = res; |
| | | let jsontemp = { |
| | | fileData:res, |
| | | uId:seft.UId, |
| | | uName:seft.UName |
| | | } |
| | | $.ajax({ |
| | | type: 'post', |
| | | url: 'FaceIdentifyAction_face_add', |
| | | data: "json="+JSON.stringify(jsontemp), |
| | | success: function(res) { |
| | | let rs = JSON.parse(res.result); |
| | | if(rs.code == 1){ |
| | | //隐藏弹窗 |
| | | seft.status = false; |
| | | let text = '新增人脸成功!'; |
| | | seft.$Message.success({ |
| | | duration:3, |
| | | background: true, |
| | | content: text |
| | | }); |
| | | }else{ |
| | | seft.$Message.success({ |
| | | duration:3, |
| | | background: true, |
| | | content: '上传失败,请重新上传!' |
| | | }); |
| | | } |
| | | }, |
| | | error: function(e) { |
| | | seft.$Message.success({ |
| | | duration:3, |
| | | background: true, |
| | | content: '网络请求异常,上传失败!' |
| | | }); |
| | | console.log(e); |
| | | } |
| | | }); |
| | | }) |
| | | return false |
| | | }, |
| | | // 图片转base64 |
| | | getBase64(file) { |
| | | return new Promise(function (resolve, reject) { |
| | | let reader = new FileReader(); |
| | | let imgResult = ""; |
| | | reader.readAsDataURL(file); |
| | | reader.onload = function () { |
| | | imgResult = reader.result; |
| | | }; |
| | | reader.onerror = function (error) { |
| | | reject(error); |
| | | }; |
| | | reader.onloadend = function () { |
| | | resolve(imgResult); |
| | | }; |
| | | }); |
| | | }, |
| | | ukeyLoad: function(){ |
| | |
| | | if(UK_Data.LastError!=0){self.bConnect=false;s_simnew1.Socket_UK.close();return false;} |
| | | DevicePath=UK_Data.return_value;//获得返回的UK的路径 |
| | | //console.log(DevicePath) |
| | | s_simnew1.GetChipID(DevicePath); //发送命令取UK的版本 |
| | | s_simnew1.GetProduceDate(DevicePath); //发送命令取UK的版本 |
| | | } |
| | | break; |
| | | case 2: |
| | |
| | | data: 'addjson=' + JSON.stringify(param), |
| | | success: function(res) { |
| | | var rs = JSON.parse(res.result); |
| | | console.log(rs); |
| | | if(rs.code) { |
| | | //self.login_type = rs.data; |
| | | self.login_type = 1; |
| | |
| | | if(UK_Data.LastError!=0){self.bConnect=false;s_simnew1.Socket_UK.close();return false;} |
| | | DevicePath=UK_Data.return_value;//获得返回的UK的路径 |
| | | console.log(DevicePath) |
| | | s_simnew1.GetChipID(DevicePath); //发送命令取UK的版本 |
| | | s_simnew1.GetProduceDate(DevicePath); //发送命令取UK的版本 |
| | | } |
| | | break; |
| | | case 2: { |
| | |
| | | // 设置路径 |
| | | inPath=UK_Data.return_value;//获得返回的UK的路径 |
| | | |
| | | s_simnew1.GetChipID(inPath);//返回芯片唯一ID |
| | | s_simnew1.GetProduceDate(inPath);//返回芯片唯一ID |
| | | break; |
| | | case 2: |
| | | if(UK_Data.LastError!=0){ |
| | |
| | | <canvas ref="canvas" width="480" height="320"></canvas> |
| | | <p style="text-align:center">{{face.detect}}</p> |
| | | </Modal> |
| | | <Modal |
| | | v-model="status" |
| | | title="图片上传" |
| | | width="480px" |
| | | footer-hide> |
| | | <Upload |
| | | multiple |
| | | :max-size="10240" |
| | | :format="['jpg','jpeg','png']" |
| | | :before-upload="beforeAvatarUpload" |
| | | type="drag" |
| | | action=""> |
| | | <div style="padding: 20px 0"> |
| | | <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon> |
| | | <p style="color:red;">提示:图片大小不超过2MB,图像人脸角度端正,图像清晰;</p> |
| | | </div> |
| | | </Upload> |
| | | </Modal> |
| | | </div> |
| | | <script type="text/javascript" src="js/jquery.js"></script> |
| | | <script type="text/javascript" src="element-ui/vue.min.js"></script> |
| | |
| | | }, |
| | | // ukey对应的用户的登录方式 1为用户名密码 2为人脸 |
| | | login_type: 1, |
| | | softUKey: new SoftUKey(SoftKey3W) |
| | | softUKey: new SoftUKey(SoftKey3W), |
| | | status: false, |
| | | UName: '', |
| | | UId: '', |
| | | }, |
| | | watch: { |
| | | userfocus: function() { |
| | |
| | | url: 'LoginAction_getRandom', |
| | | data: null, |
| | | success: function(res) { |
| | | console.log(res); |
| | | let rs = JSON.parse(res.result); |
| | | if(rs.code == 1) { |
| | | let randomNumber = rs.data; |
| | | console.log(self.softUKey); |
| | | self.softUKey.getSign(randomNumber, self.checkUKeySign); |
| | | }else { |
| | | self.$message.error("服务器连接异常!"); |
| | |
| | | self.checkUser(); |
| | | }else { |
| | | self.msg = rs.msg; |
| | | //self.checkUser(); |
| | | } |
| | | }, |
| | | error: function(error) { |
| | |
| | | var UKey_ID = this.info.UKey_ID; |
| | | password = hex_md5(password); |
| | | // 请求后台 |
| | | ajax({ |
| | | $.ajax({ |
| | | url: 'LoginAction_login', |
| | | data: "uinf.UName="+user+"&uinf.Upassword="+password+"&uinf.UId=1"+"&uinf.UKey_ID="+UKey_ID, |
| | | success: function(res) { |
| | |
| | | //self.loading = true; |
| | | // 进入首页 |
| | | //self.toIndex(rs.msg); |
| | | self.login_type = 2; |
| | | self.$Message.message('success', { |
| | | content: '静态密码验证成功', |
| | | duration: 3 |
| | | }); |
| | | //self.login_type = 2; |
| | | self.checkFaceExist(user); |
| | | }else { |
| | | self.msg = rs.msg; |
| | | if (rs.data) { |
| | |
| | | complete: function() { |
| | | self.verify = false; |
| | | } |
| | | }); |
| | | }, |
| | | checkFaceExist(UName) { |
| | | let self = this; |
| | | $.ajax({ |
| | | type: "post", |
| | | url: 'LoginAction_faceExist', |
| | | data: 'json='+JSON.stringify({ |
| | | UName, |
| | | }), |
| | | success: function(res) { |
| | | console.log(res); |
| | | let rs = JSON.parse(res.result); |
| | | if(rs.code == 1) { |
| | | self.$Message.message('success', { |
| | | content: '静态密码验证成功', |
| | | duration: 3 |
| | | }); |
| | | self.login_type = 2; |
| | | }else { |
| | | self.status = true; |
| | | self.$Message.message('warning', { |
| | | content: '用户未录入人脸,请先录入。', |
| | | duration: 3 |
| | | }); |
| | | } |
| | | self.UName = UName; |
| | | self.UId = rs.data+""; |
| | | }, |
| | | error: function(e){ |
| | | self.$Message.message('warning', { |
| | | content: '请求网路异常', |
| | | duration: 3 |
| | | }); |
| | | console.log(e); |
| | | } |
| | | }); |
| | | }, |
| | | // 图片上传前 |
| | | beforeAvatarUpload(file) { |
| | | let seft = this; |
| | | const isJPG = file.type === 'image/jpeg' || file.type === 'image/png'; |
| | | const isLt2M = file.size / 1024 / 1024 < 2; |
| | | if (!isJPG) { |
| | | seft.$Message.error({ |
| | | duration:3, |
| | | background: true, |
| | | content: '上传头像图片只能是 JPG或PNG 格式!' |
| | | }); |
| | | return false; |
| | | } |
| | | if (!isLt2M) { |
| | | seft.$Message.error({ |
| | | duration:3, |
| | | background: true, |
| | | content: '上传头像图片大小不能超过 2MB!' |
| | | }); |
| | | return false; |
| | | } |
| | | // 图片转base64 |
| | | seft.getBase64(file).then(res=>{ |
| | | seft.imageUrl = res; |
| | | let jsontemp = { |
| | | fileData:res, |
| | | uId:seft.UId, |
| | | uName:seft.UName |
| | | } |
| | | $.ajax({ |
| | | type: 'post', |
| | | url: 'FaceIdentifyAction_face_add', |
| | | data: "json="+JSON.stringify(jsontemp), |
| | | success: function(res) { |
| | | let rs = JSON.parse(res.result); |
| | | if(rs.code == 1){ |
| | | //隐藏弹窗 |
| | | seft.status = false; |
| | | let text = '新增人脸成功!'; |
| | | seft.$Message.success({ |
| | | duration:3, |
| | | background: true, |
| | | content: text |
| | | }); |
| | | }else{ |
| | | seft.$Message.success({ |
| | | duration:3, |
| | | background: true, |
| | | content: '上传失败,请重新上传!' |
| | | }); |
| | | } |
| | | }, |
| | | error: function(e) { |
| | | seft.$Message.success({ |
| | | duration:3, |
| | | background: true, |
| | | content: '网络请求异常,上传失败!' |
| | | }); |
| | | console.log(e); |
| | | } |
| | | }); |
| | | }) |
| | | return false |
| | | }, |
| | | // 图片转base64 |
| | | getBase64(file) { |
| | | return new Promise(function (resolve, reject) { |
| | | let reader = new FileReader(); |
| | | let imgResult = ""; |
| | | reader.readAsDataURL(file); |
| | | reader.onload = function () { |
| | | imgResult = reader.result; |
| | | }; |
| | | reader.onerror = function (error) { |
| | | reject(error); |
| | | }; |
| | | reader.onloadend = function () { |
| | | resolve(imgResult); |
| | | }; |
| | | }); |
| | | }, |
| | | ukeyLoad: function(){ |
| | |
| | | if(UK_Data.LastError!=0){self.bConnect=false;s_simnew1.Socket_UK.close();return false;} |
| | | DevicePath=UK_Data.return_value;//获得返回的UK的路径 |
| | | //console.log(DevicePath) |
| | | s_simnew1.GetChipID(DevicePath); //发送命令取UK的版本 |
| | | s_simnew1.GetProduceDate(DevicePath); //发送命令取UK的版本 |
| | | } |
| | | break; |
| | | case 2: |
| | |
| | | data: 'addjson=' + JSON.stringify(param), |
| | | success: function(res) { |
| | | var rs = JSON.parse(res.result); |
| | | console.log(rs); |
| | | if(rs.code) { |
| | | //self.login_type = rs.data; |
| | | self.login_type = 1; |
| | |
| | | if(UK_Data.LastError!=0){self.bConnect=false;s_simnew1.Socket_UK.close();return false;} |
| | | DevicePath=UK_Data.return_value;//获得返回的UK的路径 |
| | | console.log(DevicePath) |
| | | s_simnew1.GetChipID(DevicePath); //发送命令取UK的版本 |
| | | s_simnew1.GetProduceDate(DevicePath); //发送命令取UK的版本 |
| | | } |
| | | break; |
| | | case 2: { |