|
@@ -3,86 +3,146 @@ require("../css/reset.less")
|
|
require("../css/login.less")
|
|
require("../css/login.less")
|
|
require("./modal.js")
|
|
require("./modal.js")
|
|
|
|
|
|
-const {api} = require('./api.js')
|
|
|
|
|
|
+const { api } = require('./api.js')
|
|
|
|
|
|
-const {post,setCookie,delCookie,getUrlArgObject} = require('../js/utils.js');
|
|
|
|
|
|
+const { post, setCookie, delCookie, getUrlArgObject, toast } = require('../js/utils.js');
|
|
const md5 = require('js-md5');
|
|
const md5 = require('js-md5');
|
|
const hideLogo = getUrlArgObject("hideLg");
|
|
const hideLogo = getUrlArgObject("hideLg");
|
|
const otherLogo = getUrlArgObject("adLg");
|
|
const otherLogo = getUrlArgObject("adLg");
|
|
-$(function(){
|
|
|
|
- if(hideLogo||otherLogo){
|
|
|
|
- $(".copy-right").text("");
|
|
|
|
- }
|
|
|
|
- delCookie('accessToken')
|
|
|
|
- $(document).keyup(function(event){
|
|
|
|
- if(event.keyCode ==13){
|
|
|
|
- sureLogin()
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- $(".sureLogin").click(()=>{
|
|
|
|
- sureLogin()
|
|
|
|
- })
|
|
|
|
- $("#password").focus(function(){
|
|
|
|
- $(this).attr("type","password")
|
|
|
|
- })
|
|
|
|
- $(".iptWrap input").focus(function(){
|
|
|
|
- $(this).parent().addClass('inputFocus')
|
|
|
|
- })
|
|
|
|
- $(".iptWrap input").blur(function(){
|
|
|
|
- $(this).parent().removeClass('inputFocus')
|
|
|
|
- })
|
|
|
|
- $("body").on('input','#username,#password',function(){
|
|
|
|
- if($(this).val().trim() != ''){
|
|
|
|
- $(".login .waring").html('')
|
|
|
|
|
|
+let type
|
|
|
|
+$(function () {
|
|
|
|
+ getHospitalMark()
|
|
|
|
+ if (hideLogo || otherLogo) {
|
|
|
|
+ $(".copy-right").text("");
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ delCookie('accessToken')
|
|
|
|
+ $(document).keyup(function (event) {
|
|
|
|
+ if (event.keyCode == 13) {
|
|
|
|
+ sureLogin()
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
});
|
|
});
|
|
-function sureLogin(){
|
|
|
|
- $(".login .waring").html('')
|
|
|
|
- localStorage.removeItem('accessToken')
|
|
|
|
- let username = $("#username").val().trim();
|
|
|
|
- let password = $("#password").val().trim();
|
|
|
|
- if(!username){
|
|
|
|
- $(".login .waring").css('display','block').html('请输入用户名')
|
|
|
|
- return
|
|
|
|
- }else if(!password){
|
|
|
|
- $(".login .waring").css('display','block').html('请输入密码')
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- $.alerModal({type:"loading"});
|
|
|
|
- post(api.getJwt,{
|
|
|
|
- username:username,
|
|
|
|
- password:password
|
|
|
|
- }).then((res)=>{
|
|
|
|
- const data = res.data;
|
|
|
|
- if(data.code == 0){
|
|
|
|
- setCookie('accessToken',data.data.accessToken)
|
|
|
|
- setCookie('isPlacefile',1)
|
|
|
|
- setCookie('passwordComplexity', data.data.passwordComplexity)
|
|
|
|
- //setCookie('mmps',password);
|
|
|
|
- localStorage.setItem('accessToken',data.data.accessToken)
|
|
|
|
- $(".divModal").remove()
|
|
|
|
- $.alerModal({"message":"登录成功",type:"tip",time:'1000',win:true});
|
|
|
|
- setTimeout(() => {
|
|
|
|
- cacheCheckDatas(data.data.selRoles);
|
|
|
|
- const otherLogoPm = otherLogo?'?adLg=1':'';
|
|
|
|
- const hideLgPm=hideLogo?'?hideLg=1':'';
|
|
|
|
- window.location.href = '/index.html'+hideLgPm+otherLogoPm;
|
|
|
|
- }, 600);
|
|
|
|
- }else{
|
|
|
|
- $(".divModal").remove()
|
|
|
|
- $(".login .waring").css('display','block').html(data.msg)
|
|
|
|
|
|
+
|
|
|
|
+function getHospitalMark() {
|
|
|
|
+ localStorage.removeItem('accessToken')
|
|
|
|
+ post(api.getHospitalMark).then((res) => {
|
|
|
|
+ const data = res.data;
|
|
|
|
+ if (data.code == 0) {
|
|
|
|
+ type = parseInt(data.data)
|
|
|
|
+ if (parseInt(data.data) == 1) {
|
|
|
|
+ str = '<div class="bg2">'
|
|
|
|
+ str += '<div class="login-info">'
|
|
|
|
+ str += '<div class="info-perPub">'
|
|
|
|
+ str += ' <p> 用户名:</p>'
|
|
|
|
+ str += '<div class="info-iptWrap">'
|
|
|
|
+ str += '<input type="text" placeholder="请输入用户名" id="username" value="" autocomplete="off">'
|
|
|
|
+ str += '</div></div>'
|
|
|
|
+ str += '<div class="info-perPub">'
|
|
|
|
+ str += ' <p> 密码:</p>'
|
|
|
|
+ str += '<div class="info-iptWrap">'
|
|
|
|
+ str += '<input type="text" placeholder="请输入密码" id="password" value="" autocomplete="off">'
|
|
|
|
+ str += '</div></div>'
|
|
|
|
+ str += '<p class="waring"></p><div class="sureLogin">登录</div></div>'
|
|
|
|
+ $('.login').html(str)
|
|
|
|
+ } else {
|
|
|
|
+ str = '<div class="bg fl"><p class="title">AI病案质控平台</p></div>'
|
|
|
|
+ str += '<div class="message fr"><div class="inner"><p class="welcome">欢迎使用!</p>'
|
|
|
|
+ str += '<div class="perPub">'
|
|
|
|
+ str += ' <p> 用户名:</p>'
|
|
|
|
+ str += '<div class="iptWrap">'
|
|
|
|
+ str += '<input type="text" placeholder="请输入用户名" id="username" value="" autocomplete="off">'
|
|
|
|
+ str += '</div></div><br>'
|
|
|
|
+ str += '<div class="perPub">'
|
|
|
|
+ str += ' <p> 密码:</p>'
|
|
|
|
+ str += '<div class="iptWrap">'
|
|
|
|
+ str += '<input type="text" placeholder="请输入密码" id="password" value="" autocomplete="off">'
|
|
|
|
+ str += '</div></div>'
|
|
|
|
+ str += '<p class="waring"></p><div class="sureLogin">登录</div></div><div class="copy-right">由杭州朗通信息技术有限公司提供技术支持</div></div>',
|
|
|
|
+ $('.login').html(str)
|
|
|
|
+ }
|
|
|
|
+ $(".sureLogin").click(() => {
|
|
|
|
+ sureLogin()
|
|
|
|
+ })
|
|
|
|
+ $("#password").focus(function () {
|
|
|
|
+ $(this).attr("type", "password")
|
|
|
|
+ })
|
|
|
|
+ $(".iptWrap input").focus(function () {
|
|
|
|
+ $(this).parent().addClass('inputFocus')
|
|
|
|
+ })
|
|
|
|
+ $(".iptWrap input").blur(function () {
|
|
|
|
+ $(this).parent().removeClass('inputFocus')
|
|
|
|
+ })
|
|
|
|
+ $("body").on('input', '#username,#password', function () {
|
|
|
|
+ if ($(this).val().trim() != '') {
|
|
|
|
+ $(".login .waring").html('')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }).catch(() => {
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+function sureLogin() {
|
|
|
|
+ localStorage.removeItem('accessToken')
|
|
|
|
+ $(".login .waring").html('')
|
|
|
|
+ let username = $("#username").val().trim();
|
|
|
|
+ let password = $("#password").val().trim();
|
|
|
|
+ if (!username) {
|
|
|
|
+ if(type == 1){
|
|
|
|
+ toast("请输入用户名!");
|
|
|
|
+ }else{
|
|
|
|
+ $(".login .waring").css('visibility', 'visible').html('请输入用户名')
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+ } else if (!password) {
|
|
|
|
+ if (type == 1) {
|
|
|
|
+ toast("请输入密码!");
|
|
|
|
+ } else {
|
|
|
|
+ $(".login .waring").css('visibility', 'visible').html('请输入密码')
|
|
|
|
+ }
|
|
|
|
+ return
|
|
}
|
|
}
|
|
- }).catch(()=>{
|
|
|
|
- $(".divModal").remove()
|
|
|
|
- })
|
|
|
|
|
|
+ $.alerModal({ type: "loading" });
|
|
|
|
+ post(api.getJwt, {
|
|
|
|
+ username: username,
|
|
|
|
+ password: password
|
|
|
|
+ }).then((res) => {
|
|
|
|
+ const data = res.data;
|
|
|
|
+ if (data.code == 0) {
|
|
|
|
+ setCookie('accessToken', data.data.accessToken)
|
|
|
|
+ setCookie('isPlacefile', 1)
|
|
|
|
+ setCookie('passwordComplexity', data.data.passwordComplexity)
|
|
|
|
+ //setCookie('mmps',password);
|
|
|
|
+ localStorage.setItem('accessToken', data.data.accessToken)
|
|
|
|
+ $(".divModal").remove()
|
|
|
|
+ $.alerModal({ "message": "登录成功", type: "tip", time: '1000', win: true });
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ cacheCheckDatas(data.data.selRoles);
|
|
|
|
+ const otherLogoPm = otherLogo ? '?adLg=1' : '';
|
|
|
|
+ const hideLgPm = hideLogo ? '?hideLg=1' : '';
|
|
|
|
+ window.location.href = 'index.html' + hideLgPm + otherLogoPm;
|
|
|
|
+ }, 600);
|
|
|
|
+ } else {
|
|
|
|
+ $(".divModal").remove()
|
|
|
|
+ if (type == 1) {
|
|
|
|
+ toast(data.msg);
|
|
|
|
+ } else {
|
|
|
|
+ $(".login .waring").css('visibility', 'visible').html(data.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }).catch(() => {
|
|
|
|
+ $(".divModal").remove()
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
//核查权限数据保存
|
|
//核查权限数据保存
|
|
-function cacheCheckDatas(data){
|
|
|
|
- delCookie("checkAuth");
|
|
|
|
- const arr = data&&data.map((it)=>{
|
|
|
|
- return it.id;
|
|
|
|
- })||[];
|
|
|
|
- setCookie("checkAuth",arr.join(","));
|
|
|
|
|
|
+function cacheCheckDatas(data) {
|
|
|
|
+ delCookie("checkAuth");
|
|
|
|
+ const arr = data && data.map((it) => {
|
|
|
|
+ return it.id;
|
|
|
|
+ }) || [];
|
|
|
|
+ setCookie("checkAuth", arr.join(","));
|
|
}
|
|
}
|