|
@@ -32,9 +32,6 @@ function getSecurityCode() {
|
|
|
url:api.getCaptcha,
|
|
|
method:'get',
|
|
|
responseType:'blob',
|
|
|
- emulateJSON:true,
|
|
|
- /*contentType:'image/png',
|
|
|
- dataType:'blob',*/
|
|
|
success:function(res){
|
|
|
console.log('success');
|
|
|
const img = document.createElement("img");
|
|
@@ -46,7 +43,7 @@ function getSecurityCode() {
|
|
|
window.URL.revokeObjectURL(qrUrl)
|
|
|
}
|
|
|
const imgDiv = document.getElementById("codeImg");
|
|
|
- imgDiv.appendChild(img);
|
|
|
+ $(imgDiv).html(img);
|
|
|
},
|
|
|
error:function(error){
|
|
|
console.log('error:',error)
|
|
@@ -56,8 +53,8 @@ function getSecurityCode() {
|
|
|
|
|
|
function getHospitalMark() {
|
|
|
localStorage.removeItem('accessToken')
|
|
|
- post(api.getHospitalMark).then((res) => {
|
|
|
- const data = res.data;
|
|
|
+ //post(api.getHospitalMark).then((res) => {
|
|
|
+ const data = {code:0,data:0}//res.data;
|
|
|
if (data.code == 0) {
|
|
|
type = parseInt(data.data)
|
|
|
if (parseInt(data.data) == 1) { //湘雅三院登录样式
|
|
@@ -93,7 +90,7 @@ function getHospitalMark() {
|
|
|
str += '<div class="iptWrap security-code">'
|
|
|
str += '<input type="text" placeholder="请输入验证码" id="code" value="" autocomplete="off">'
|
|
|
str += '<div id="codeImg" class="code-img"></div>'
|
|
|
- str += '<a href="changeCode">换一张</a>'
|
|
|
+ str += '<a id="changeCode" >换一张</a>'
|
|
|
str += '</div></div>'
|
|
|
str += '<p class="waring"></p><div class="sureLogin">登录</div></div><div class="copy-right">由杭州朗通信息技术有限公司提供技术支持</div></div>',
|
|
|
$('.login').html(str)
|
|
@@ -102,6 +99,10 @@ function getHospitalMark() {
|
|
|
$(".sureLogin").click(() => {
|
|
|
sureLogin()
|
|
|
})
|
|
|
+ //点击换一张事件
|
|
|
+ $("#codeImg,#changeCode").click(function(){
|
|
|
+ getSecurityCode();
|
|
|
+ })
|
|
|
$("#password").focus(function () {
|
|
|
$(this).attr("type", "password")
|
|
|
})
|
|
@@ -121,15 +122,16 @@ function getHospitalMark() {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- }).catch(() => {
|
|
|
+ /*}).catch(() => {
|
|
|
|
|
|
- })
|
|
|
+ })*/
|
|
|
}
|
|
|
function sureLogin() {
|
|
|
localStorage.removeItem('accessToken')
|
|
|
$(".login .waring").html('')
|
|
|
let username = $("#username").val().trim();
|
|
|
let password = $("#password").val().trim();
|
|
|
+ const captcha = $("#code").val().trim();
|
|
|
if (!username) {
|
|
|
if(type == 1){
|
|
|
toast("请输入用户名!");
|
|
@@ -144,11 +146,19 @@ function sureLogin() {
|
|
|
$(".login .waring").css('visibility', 'visible').html('请输入密码')
|
|
|
}
|
|
|
return
|
|
|
+ } else if (!captcha) {
|
|
|
+ if (type == 1) {
|
|
|
+ toast("请输入验证码!");
|
|
|
+ } else {
|
|
|
+ $(".login .waring").css('visibility', 'visible').html('请输入验证码')
|
|
|
+ }
|
|
|
+ return
|
|
|
}
|
|
|
$.alerModal({ type: "loading" });
|
|
|
post(api.getJwt, {
|
|
|
username: username,
|
|
|
- password: password
|
|
|
+ password: password,
|
|
|
+ captcha:captcha
|
|
|
}).then((res) => {
|
|
|
const data = res.data;
|
|
|
if (data.code == 0) {
|