佛山验证码更新

master
hujl 3 years ago
parent 5a962d3ec4
commit 98e09c3125

@ -24,6 +24,23 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>com.ramostear</groupId>
<artifactId>Happy-Captcha</artifactId>
<version>1.0.1</version>
</dependency>
<!-- redis 依赖-->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.1.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>com.manage</groupId> <groupId>com.manage</groupId>
<artifactId>power-service</artifactId> <artifactId>power-service</artifactId>
@ -141,18 +158,18 @@
<build> <build>
<finalName>power</finalName> <finalName>power</finalName>
<plugins> <plugins>
<plugin> <!--<plugin>-->
<!-- 指定maven编译的jdk版本,如果不指定,maven3默认用jdk 1.5 maven2默认用jdk1.3 --> <!--&lt;!&ndash; 指定maven编译的jdk版本,如果不指定,maven3默认用jdk 1.5 maven2默认用jdk1.3 &ndash;&gt;-->
<groupId>org.apache.maven.plugins</groupId> <!--<groupId>org.apache.maven.plugins</groupId>-->
<artifactId>maven-compiler-plugin</artifactId> <!--<artifactId>maven-compiler-plugin</artifactId>-->
<version>3.1</version> <!--<version>3.1</version>-->
<configuration> <!--<configuration>-->
<!-- 一般而言target与source是保持一致的但是有时候为了让程序能在其他版本的jdk中运行(对于低版本目标jdk源代码中不能使用低版本jdk中不支持的语法)会存在target不同于source的情况 --> <!--&lt;!&ndash; 一般而言target与source是保持一致的但是有时候为了让程序能在其他版本的jdk中运行(对于低版本目标jdk源代码中不能使用低版本jdk中不支持的语法)会存在target不同于source的情况 &ndash;&gt;-->
<source>1.8</source> <!-- 源代码使用的JDK版本 --> <!--<source>1.8</source> &lt;!&ndash; 源代码使用的JDK版本 &ndash;&gt;-->
<target>1.8</target> <!-- 需要生成的目标class文件的编译版本 --> <!--<target>1.8</target> &lt;!&ndash; 需要生成的目标class文件的编译版本 &ndash;&gt;-->
<encoding>UTF-8</encoding><!-- 字符集编码 --> <!--<encoding>UTF-8</encoding>&lt;!&ndash; 字符集编码 &ndash;&gt;-->
</configuration> <!--</configuration>-->
</plugin> <!--</plugin>-->
<plugin> <plugin>
<groupId>org.apache.tomcat.maven</groupId> <groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId> <artifactId>tomcat7-maven-plugin</artifactId>

@ -0,0 +1,51 @@
package com.manage.bean;
public class LoginVoRedis {
private String username;
private String password;
private int loginFailureCount;
private String loginTime;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getLoginFailureCount() {
return loginFailureCount;
}
public void setLoginFailureCount(int loginFailureCount) {
this.loginFailureCount = loginFailureCount;
}
public String getLoginTime() {
return loginTime;
}
public void setLoginTime(String loginTime) {
this.loginTime = loginTime;
}
@Override
public String toString() {
return "LoginVo_Redis{" +
"username='" + username + '\'' +
", password='" + password + '\'' +
", loginFailureCount=" + loginFailureCount +
", loginTime='" + loginTime + '\'' +
'}';
}
}

@ -0,0 +1,65 @@
package com.manage.controller;
import com.manage.util.DrawCheckcode;
import com.ramostear.captcha.HappyCaptcha;
import com.ramostear.captcha.support.CaptchaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
import static java.lang.System.*;
@Controller
@RequestMapping("/checkController")
public class CheckcodeController {
@RequestMapping("/check")
@ResponseBody
public String checkcodeCheck(String codeClient, HttpServletRequest request){
String codeServer = (String)request.getSession().getAttribute("CHECKCODE");
if (codeClient.equals(codeServer)){
return "验证码正确";
}else{
return "验证码错误";
}
}
@RequestMapping("/checkcode")
public void checkcodeMake(HttpServletResponse response, HttpServletRequest request) throws IOException {
//画验证码
DrawCheckcode drawCheckcode = new DrawCheckcode();
BufferedImage image = drawCheckcode.doDraw();
//设置响应头,防止缓存
response.setHeader("Pragma","no-cache");
response.setHeader("Cache-Control","no-cache");
response.setHeader("Expires","0");
//将验证码的值保存在session中以便校验
request.getSession().setAttribute("CHECKCODE",drawCheckcode.getCheckCode());
ServletOutputStream outputStream = response.getOutputStream();
ImageIO.write(image,"jpeg",outputStream);
outputStream.flush(); //清空缓冲区数据
outputStream.close(); //关闭流
}
@RequestMapping(value="captcha")
@ResponseBody
public void happyCaptcha(HttpServletRequest request, HttpServletResponse response){
out.println("======生成一次验证码======");
HappyCaptcha.require(request,response).type(CaptchaType.NUMBER).build().finish();
}
}

@ -598,21 +598,13 @@ public class FontController {
@RequestMapping(value="getQRcode") @RequestMapping(value="getQRcode")
@ResponseBody @ResponseBody
public QrBean getQRcode(QRcode qRcode, HttpServletRequest request){ public QrBean getQRcode(QRcode qRcode, HttpServletRequest request){
// 获得Http客户端 // 获得Http客户端
CloseableHttpClient httpClient = HttpClientBuilder.create().build(); CloseableHttpClient httpClient = HttpClientBuilder.create().build();
// 创建Post请求 // 创建Post请求
HttpPost httpPost = new HttpPost("http://192.168.1.212:8080/cloudkeyserver/api/login/qrcode/nostatus/2CKV1"); HttpPost httpPost = new HttpPost("http://192.168.1.212:8080/cloudkeyserver/api/login/qrcode/nostatus/2CKV1");
// qRcode.setLoginTypeBitValue(16);
// qRcode.setType(3);
// qRcode.setProjectUid("cloudkey-fstth");
// qRcode.setApplicationId("fstth-wzh");
System.out.println("qRcode:::::"+qRcode.getApplicationId());
//json格式转换 //json格式转换
String jsonString = JSON.toJSONString(qRcode); String jsonString = JSON.toJSONString(qRcode);
System.out.println("jsonString1::::"+jsonString);
StringEntity entity = new StringEntity(jsonString, "UTF-8"); StringEntity entity = new StringEntity(jsonString, "UTF-8");
System.out.println("jsonString::::"+jsonString);
// post请求是将参数放在请求体里面传过去的;这里将entity放入post请求体中 // post请求是将参数放在请求体里面传过去的;这里将entity放入post请求体中
httpPost.setEntity(entity); httpPost.setEntity(entity);
httpPost.setHeader("Content-Type", "application/json;charset=utf8"); httpPost.setHeader("Content-Type", "application/json;charset=utf8");
@ -626,7 +618,6 @@ public class FontController {
response = httpClient.execute(httpPost); response = httpClient.execute(httpPost);
// 从响应模型中获取响应实体 // 从响应模型中获取响应实体
responseEntity = response.getEntity(); responseEntity = response.getEntity();
System.out.println("responseEntity::::"+responseEntity);
System.out.println("响应状态为:" + response.getStatusLine()); System.out.println("响应状态为:" + response.getStatusLine());
if (responseEntity != null) { if (responseEntity != null) {
JSONObject jsonObject = JSONObject.parseObject(EntityUtils.toString(responseEntity)); JSONObject jsonObject = JSONObject.parseObject(EntityUtils.toString(responseEntity));
@ -635,11 +626,8 @@ public class FontController {
String qrCodeIdentity = contentsObject.getString("qrCodeIdentity"); String qrCodeIdentity = contentsObject.getString("qrCodeIdentity");
JSONArray qrCodes = contentsObject.getJSONArray("qrCodes"); JSONArray qrCodes = contentsObject.getJSONArray("qrCodes");
String qrCodeBase64 = qrCodes.getJSONObject(0).get("qrCodeBase64").toString(); String qrCodeBase64 = qrCodes.getJSONObject(0).get("qrCodeBase64").toString();
qrBean.setQrCodeBase64(qrCodeBase64); qrBean.setQrCodeBase64(qrCodeBase64);
qrBean.setQrCodeIdentity(qrCodeIdentity); qrBean.setQrCodeIdentity(qrCodeIdentity);
System.out.println("qrBean::::"+qrBean.getQrCodeIdentity());
} }
} catch (ClientProtocolException e) { } catch (ClientProtocolException e) {
e.printStackTrace(); e.printStackTrace();

@ -0,0 +1,69 @@
package com.manage.controller;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import java.io.IOException;
import java.util.Properties;
public class JedisPoolUtil {
private static volatile JedisPool jedisPool = null;
// 获得资源包
private static Properties properties;
static {
try {
properties = PropertiesLoaderUtils.loadAllProperties("redis.properties");
} catch (IOException e) {
e.printStackTrace();
}
}
private static String host = properties.getProperty("redis.host");
private static Integer port = Integer.valueOf(properties.getProperty("redis.port"));
// private static String auth = properties.getProperty("redis.auth");
private static Integer maxTotal = Integer.valueOf(properties.getProperty("redis.maxTotal"));
private static Integer maxWait = Integer.valueOf(properties.getProperty("redis.maxWait"));
private static Integer timeout = Integer.valueOf(properties.getProperty("redis.timeOut"));
private static Integer maxIdle = Integer.valueOf(properties.getProperty("redis.maxIdle"));
private static Boolean testOnBorrow = Boolean.valueOf(properties.getProperty("redis.testOnBorrow"));
private JedisPoolUtil() {};
public static JedisPool getJedisPoolInstance() {
synchronized (JedisPoolUtil.class) {
if (jedisPool == null) {
JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMaxTotal(maxTotal);
poolConfig.setMaxIdle(maxIdle);
poolConfig.setMaxWaitMillis(maxWait);
poolConfig.setTestOnBorrow(testOnBorrow);
jedisPool = new JedisPool(poolConfig, host,port,timeout);
}
}
return jedisPool;
}
//释放回池子
public static void close(Jedis jedis){
if(jedis != null){
if (jedis.isConnected()) {
try {
System.out.println("退出" + jedis.toString() + ":" + jedis.quit());
jedis.disconnect();
} catch (Exception e) {
System.out.println("退出失败");
e.printStackTrace();
}
}
jedis.close();
}
}
}

@ -1,9 +1,9 @@
package com.manage.controller; package com.manage.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.manage.bean.LoginVoRedis;
import com.manage.dao.Power_Login_SetMapper; import com.manage.dao.Power_Login_SetMapper;
import com.manage.encrypt.Base64;
import com.manage.encrypt.MD5;
import com.manage.entity.*; import com.manage.entity.*;
import com.manage.service.*; import com.manage.service.*;
import com.manage.service.cache.Cache; import com.manage.service.cache.Cache;
@ -11,6 +11,7 @@ import com.manage.service.cache.CacheManager;
import com.manage.util.*; import com.manage.util.*;
import com.manage.vo.*; import com.manage.vo.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.DateUtil;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -19,10 +20,13 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import redis.clients.jedis.Jedis;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@ -51,10 +55,16 @@ public class LoginController {
@Value("${EMRMEDICALRECORD_PORT}") @Value("${EMRMEDICALRECORD_PORT}")
private String port; private String port;
//
// @Autowired
// private JedisPool jedisPool;
@Value("${POWER_PORT}")
private String POWER_PORT;
@RequestMapping(value = "login",method = RequestMethod.GET) @RequestMapping(value = "login",method = RequestMethod.GET)
public String toLogin(Model model){ public String toLogin(Model model){
Power_Login_Set loginSet = powerLoginSetMapper.selectByPrimaryKey(sysFlag); Power_Login_Set loginSet = powerLoginSetMapper.selectByPrimaryKey(1);
model.addAttribute("loginSet",loginSet); model.addAttribute("loginSet",loginSet);
CacheManager.addExcCount("noExc"); CacheManager.addExcCount("noExc");
return "loginDir/login"; return "loginDir/login";
@ -63,24 +73,47 @@ public class LoginController {
@RequestMapping(value = "login",method = RequestMethod.POST) @RequestMapping(value = "login",method = RequestMethod.POST)
@ResponseBody @ResponseBody
public Msg login(Power_User powerUser,HttpServletResponse response, HttpServletRequest request,Model model){ public Msg login(Power_User powerUser,HttpServletResponse response, HttpServletRequest request,Model model){
LoginVoRedis loginVo = new LoginVoRedis();
Msg msg = new Msg();
String userName = powerUser.getUserName();
String userPwd = powerUser.getUserPwd();
if (!userName.equals("admin")){
String s ="00" + userName;
powerUser.setUserName(s);
}
loginVo.setUsername(userName);
loginVo.setPassword(userPwd);
Date date = new Date();
SimpleDateFormat sdFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
loginVo.setLoginTime(sdFormatter.toString());
System.out.println("loginVo"+loginVo.getLoginTime());
Jedis redis = JedisPoolUtil.getJedisPoolInstance().getResource();
String userInfo = redis.get(userName);
if (userInfo==null){
loginVo.setLoginFailureCount(0);
redis.set(userName, JSONObject.toJSONString(loginVo));
userInfo = redis.get(userName);
}
JSON json =JSONObject.parseObject(userInfo);
System.out.println(json);
LoginVoRedis userLoginInfo = JSONObject.toJavaObject(json, LoginVoRedis.class);
int loginFailCount = userLoginInfo.getLoginFailureCount();
if (loginFailCount >= 5 ) {
}
try { try {
Power_UserVo user = powerUserService.findPowerUserByUserNameAndUserPwd(powerUser); Power_UserVo user = powerUserService.findPowerUserByUserNameAndUserPwd(powerUser);
//添加进操作日志 //添加进操作日志
Power_Log log = new Power_Log(); Power_Log log = new Power_Log();
if(user != null){ if(user != null){
//存session密码置空 //存session密码置空
//是否记住密码功能 //是否记住密码功能
MyCookieUtil.remember(request, response); MyCookieUtil.remember(request, response);
//设置token缓存 //设置token缓存
String token = UUID.randomUUID().toString(); String token = UUID.randomUUID().toString();
//查询归属医院
/*long start5 = System.currentTimeMillis();
Power_User_Dict powerUserDict = powerUserDictMapper.selectDictIdByUserId(user.getUserId());
long end5 = System.currentTimeMillis();
System.out.println("查询医院时间="+(end5-start5)/1000.0+"s");
user.setDictId(powerUserDict.getDictId());*/
//设置用户登录次数缓存
//CacheManager.addloginUserCount(fmt.format(new Date()),user.getUserName());
CacheManager.addExcCount("noExc"); CacheManager.addExcCount("noExc");
List<Power_Menu> list = null; List<Power_Menu> list = null;
List<User_Dept_Menu> menuList = new ArrayList<>(); List<User_Dept_Menu> menuList = new ArrayList<>();
@ -126,6 +159,7 @@ public class LoginController {
CacheManager.putCache(token,new Cache(user,System.currentTimeMillis(),TOKEN_EXPIRE_TIME*1000)); CacheManager.putCache(token,new Cache(user,System.currentTimeMillis(),TOKEN_EXPIRE_TIME*1000));
ActionScopeUtils.setSessionAttribute("token",token,Integer.valueOf(String.valueOf(TOKEN_EXPIRE_TIME))); ActionScopeUtils.setSessionAttribute("token",token,Integer.valueOf(String.valueOf(TOKEN_EXPIRE_TIME)));
ActionScopeUtils.setSessionAttribute("CURRENT_USER",user,Integer.valueOf(String.valueOf(TOKEN_EXPIRE_TIME))); ActionScopeUtils.setSessionAttribute("CURRENT_USER",user,Integer.valueOf(String.valueOf(TOKEN_EXPIRE_TIME)));
Power_User user1 = (Power_User)request.getSession().getAttribute("CURRENT_USER");
//单点登录跳转 //单点登录跳转
String url = ""; String url = "";
if(sysFlag == 2){ if(sysFlag == 2){
@ -135,10 +169,8 @@ public class LoginController {
int POWER_PORT = request.getLocalPort(); int POWER_PORT = request.getLocalPort();
url = "http://"+ip+":"+POWER_PORT+"/power/gatewayPage"; url = "http://"+ip+":"+POWER_PORT+"/power/gatewayPage";
} }
//request.getRequestDispatcher(url).forward(request, response); redis.set(userName, JSONObject.toJSONString(loginVo));
request.getSession().setAttribute("user",loginVo);
//response.sendRedirect(url);
//return "redirect:gatewayPage";
return Msg.success().add("url",url); return Msg.success().add("url",url);
}else{ }else{
//登录失败 //登录失败
@ -158,6 +190,11 @@ public class LoginController {
log.setRemark("已错误【"+wrongNum+"】次"); log.setRemark("已错误【"+wrongNum+"】次");
logService.insert(log); logService.insert(log);
request.setAttribute("msg", "用户名或密码不正确"); request.setAttribute("msg", "用户名或密码不正确");
loginFailCount ++;
loginVo.setLoginFailureCount(loginFailCount);
redis.set(userName,JSONObject.toJSONString(loginVo));
request.getSession().setAttribute("user",loginVo);
return Msg.failUser();
} }
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
@ -171,6 +208,11 @@ public class LoginController {
} }
//获取session所剩时间 //获取session所剩时间
@RequestMapping(value = "getSessionRemainingTime",method = RequestMethod.GET,produces = {"text/json;charset=UTF-8"}) @RequestMapping(value = "getSessionRemainingTime",method = RequestMethod.GET,produces = {"text/json;charset=UTF-8"})
@ResponseBody @ResponseBody

@ -129,7 +129,6 @@ public class SsoLogin {
paramMap.put("code",code); paramMap.put("code",code);
paramMap.put("grant_type","authorization_code"); paramMap.put("grant_type","authorization_code");
paramMap.put("redirect_uri",urlAddress); paramMap.put("redirect_uri",urlAddress);
String param="client_id="+clientId+"&client_secret="+clientSecret+"&code="+code+"&grant_type=authorization_code&redirect_uri="+StringUrl;
String returnObject =doPost(url,paramMap,null); String returnObject =doPost(url,paramMap,null);
String userName=""; String userName="";
if(returnObject!=null){ if(returnObject!=null){

@ -168,7 +168,7 @@ public class UserController {
ServletRequestAttributes attr=(ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); ServletRequestAttributes attr=(ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request =attr.getRequest(); HttpServletRequest request =attr.getRequest();
Power_UserVo powerUser = powerUserService.selectByPrimaryKey(userId); Power_UserVo powerUser = powerUserService.selectByPrimaryKey(userId);
powerUser.setUserPwd(Base64.encode(MD5.KL("000000"))); powerUser.setUserPwd("EUwQTRBEEE0WFxJERRVCREVEEkYQEBFBTUJATU1GR0I=");
powerUserService.updateByPrimaryKeySelective(powerUser,request); powerUserService.updateByPrimaryKeySelective(powerUser,request);
CacheManager.addExcCount("noExc"); CacheManager.addExcCount("noExc");
return Msg.success(); return Msg.success();

@ -0,0 +1,16 @@
##redis\u6570\u636E\u5E93\u7684\u76F8\u5173\u914D\u7F6E
##\u8FDE\u63A5\u5730\u5740ip
redis.host =localhost
##\u7AEF\u53E3\u53F7
redis.port = 6379
##\u8BBF\u95EE\u5BC6\u7801
#redis.auth =
##\u63A7\u5236\u4E00\u4E2Apool\u6700\u591A\u53EF\u4EE5\u6709\u591A\u5C11\u4E2A\u72B6\u6001\u4E3AIdle(\u7A7A)\u7684jedis\u5B9E\u4F8B\u9ED8\u8BA4\u503C\u4E3A8
redis.maxIdle = 200
##\u7B49\u5F85\u53EF\u7528\u8FDE\u63A5\u7684\u6700\u5927\u65F6\u95F4\u5355\u4F4D\u4E3A\u6BEB\u79D2 \u9ED8\u8BA4\u4E3A-1\u8868\u793A\u6C38\u4E0D\u8D85\u65F6\uFF0C\u4E00\u65E6\u8D85\u8FC7\u7B49\u5F85\u65F6\u95F4\u5219\u76F4\u63A5\u629B\u51FA
redis.maxWait = 100000
redis.timeOut = 10000
##\u8BBE\u7F6E\u4E3Atrue\u5219\u4F1A\u5728borrow\u4E00\u4E2Ajedis\u5B9E\u4F8B\u65F6\uFF0C\u63D0\u524D\u505Avalidate\u64CD\u4F5C
redis.testOnBorrow =true
##\u6700\u5927\u8FDE\u63A5\u6570
redis.maxTotal=30

@ -21,77 +21,178 @@
} }
} }
%> %>
<html> <html lang="en">
<head> <head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>嘉时软件</title> <title>嘉时软件</title>
<!--导入CSS -->
<link rel="stylesheet" href="${path}/static/css/login.css">
<script>
var path = "${path}";
</script>
</head> </head>
<body style="background:url('${path}/static/img/login/bg.png')"> <style>
<!--头部--> *{
<div class="login_head"> margin: 0;
<!--头部文字--> padding: 0;
<div class="head_left left"> box-sizing: border-box;
<div class="head_left_span"> }
<span>${loginSet.context}</span></div> .login{
width: 100%;
height: 100vh;
display: flex;
}
#banar{
width: 300px;
height: 50px;
background-color: #999;
font-weight: bold;
font-size: 3em;
text-align: center;
line-height: 40px;
font-family: "fantasy";
color: burlywood;
margin: 10px;
display: inline-block;
}
#chang{
font-size: 14px;
color: darkgreen;
cursor: pointer;/* 鼠标经过变成小手 */
}
#txt{
font-size: 22px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #555555;
margin: 10px 0;
/*width: 200px;*/
/*height: 40px;*/
/*outline: none;!* 鼠标聚焦文本框没有边框线*!*/
}
.login .left{
width: 1100px;
height: 100%;
}
.login .left img{
width: 100%;
height: 100%;
}
.login .right{
margin: 0 auto;
margin-top: 30px;
}
.logo{
margin-top: 74px;
margin-bottom: 123px;
display: flex;
align-items: center;
}
.title{
text-align: center;
font-size: 40px;
font-weight: 500;
margin-top: 34px;
}
.shuru{
width: 500px;
height: 50px;
background: #EFF0F4;
border-radius: 6px;
border: 1px solid #EFF0F4;
outline: none;
padding-left: 20px;
font-size: 16px;
}
.shuru:focus{
border-color: #09f !important;
}
.item{
margin-bottom: 20px;
}
.item1{
margin-bottom: 30px;
}
.item-name{
font-size: 22px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #555555;
margin: 10px 0;
}
.btn{
width: 500px;
height: 64px;
background: linear-gradient(90deg, #00AFFF 0%, #007CFF 100%);
border-radius: 6px;
text-align: center;
line-height: 53px;
cursor: pointer;
font-size: 22px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #FFFFFF;
margin-top: 108px;
}
.boxCss{
margin-top: 60px;
}
.bottom{
width: 500px;
text-align: center;
font-size: 14px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #919191;
margin-top: 120px;
}
</style>
<body>
<div class="login">
<div class="left">
<img src="./static/img/login/login_bg.png" alt="">
</div> </div>
<!--右边logon--> <div class="right">
<div class="head_right left">
<c:if test="${loginSet.logoPath != ''}"> <c:if test="${loginSet.logoPath != ''}">
<img src="${path}/${loginSet.logoPath}" width="${loginSet.logoWidth}px" height="${loginSet.logoHeight}px"> <img src="${path}/${loginSet.logoPath}" width="${loginSet.logoWidth}px" height="${loginSet.logoHeight}px">
</c:if> </c:if>
<div class="title">
账号登录
</div> </div>
<div class="boxCss">
<form action="">
<div class="item item1">
<div class="item-name">用户名</div>
<input type="text" placeholder="请输入" class="shuru" id="userName" name="userName" >
</div> </div>
<!--中间--> <div class="item">
<div class="login_content"> <div class="item-name">用户密码</div>
<div class="content_left left"> <input type="password" placeholder="请输入" class="shuru" id="userPwd" name="userPwd">
<c:if test="${loginSet.pic1Path != ''}">
<div class="image1" style="background:url('${path}/${loginSet.pic1Path}') no-repeat">
</div>
</c:if>
</div>
<div class="content_login left">
<div id="switchHandoff" class="login_div" style="background:url('${path}/static/img/login/登录框.png')no-repeat" >
<div class="login_title">
<h3 style="text-align: center">账号登录</h3>
</div>
<div class="inputDiv">
<input type="text" id="userName" name="userName" class="form-control uname left" placeholder="用户名" required value="<%=userName%>"/>
</div>
<div class="inputDiv">
<input type="password" id="userPwd" name="userPwd" class="form-control pword m-b" placeholder="密码" required value="<%=password%>" autocomplete="new-password"/>
</div>
<div class="inputDiv">
<label><input type="checkbox" name="rememberMe" id="rememberMe" value="yes" style="vertical-align:middle; margin-top:0;" <%=checked%>>记住密码</label>
</div>
<%--<a href="#" id="forgetPwd" style="float: right;">忘记密码了?</a>--%>
<div class="inputDiv">
<button class="btn btn-success btn-block" onclick="login()">登录</button>
<%--<button class="btn btn-success btn-block" onclick="handoffLogin()">二维码登录</button>--%>
<p class="text-danger">${msg}</p>
</div>
</div>
<div id="switchHandoff2" class="login_div" style="background:url('${path}/static/img/login/登录框.png')no-repeat;display:none;" >
<div class="login_title">
<h3 style="text-align: center">二维码登录</h3>
</div>
<div class="qRCodeDiv">
<img id="QRcordImg" height="300px" width="300px" class="QRcordImg">
</div> </div>
<div class="inputDiv"> <div class="item">
<button class="btn btn-success btn-block" onclick="handoffLogin2()">账号密码登录</button> <div class="item-name" id="txt1">验证码</div>
<p class="text-danger">${msg}</p> <input type="text" placeholder="请输入" class="shuru" id="txt" name="txt">
</div> </div>
<%--验证码:<input type="text" id="txt"><br>--%>
<div id="banar"></div>
<span id="chang">看不清换一张</span><br>
<%--<input type="submit" value="验证" id="sub">--%>
<div >
<input type="checkbox" name="" id="">
<span>记住密码</span>
</div> </div>
</form>
</div> </div>
<div class="btn" onclick="login()">立即登录</div>
<div class="bottom">
<div class="top">技术支持:厦门嘉时软件科技有限公司 </div>
<div class="bot">Copyright © 2019-2090 厦门嘉时软件. All rights reserved.</div>
</div> </div>
<!--尾部-->
<div class="login_foot">
<div class="span_div"><span>${loginSet.footContext}</span></div>
</div> </div>
</div>
<script type="text/javascript" src="${path}/static/js/login.js?time=2022-01-13"></script> <script type="text/javascript" src="${path}/static/js/login.js?time=2022-01-13"></script>
</body> </body>
</html> </html>

@ -1,18 +1,18 @@
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=GBK" language="java" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jspf/common.jspf" %> <%@ include file="/WEB-INF/jspf/common.jspf" %>
<%@ include file="/WEB-INF/jspf/confirmJsp.jspf" %> <%@ include file="/WEB-INF/jspf/confirmJsp.jspf" %>
<html> <html>
<head> <head>
<title>角色管理</title> <title>角色管理</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- 引入 Bootstrap --> <!-- 引入 Bootstrap -->
<link rel="stylesheet" href="${path}/static/zTree_v3-master/css/zTreeStyle/zTreeStyle.css"> <link rel="stylesheet" href="${path}/static/zTree_v3-master/css/zTreeStyle/zTreeStyle.css">
<style type="text/css"> <style type="text/css">
hr{ hr{
margin:0; margin:0;
} }
/*模态框表单*/ /*模态框表单*/
.formDiv{ .formDiv{
width:100%; width:100%;
height:30px; height:30px;
@ -27,7 +27,7 @@
width:50%; width:50%;
float:left; float:left;
} }
/*模态框*/ /*模态框*/
.modal-header{ .modal-header{
text-align: center; text-align: center;
} }
@ -64,30 +64,30 @@
<input type="hidden" id="userNames"> <input type="hidden" id="userNames">
<div class="row" style="margin-right: 0px;"> <div class="row" style="margin-right: 0px;">
<div class="col-md-12"> <div class="col-md-12">
<div class="panel-heading"><h4>基本管理/角色管理</h4></div> <div class="panel-heading"><h4>基本管理/角色管理</h4></div>
<hr> <hr>
<form class="form-inline" style="margin-top: 5px;margin-bottom: 0px;" role="form"> <form class="form-inline" style="margin-top: 5px;margin-bottom: 0px;" role="form">
<div class=""> <div class="">
<div class="form-group"> <div class="form-group">
<label>角色名:</label> <label>角色名:</label>
<input type="text" class="form-control input-sm" id="role_name" maxlength="16"/> <input type="text" class="form-control input-sm" id="role_name" maxlength="16"/>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="effective">是否有效</label> <label for="effective">是否有效</label>
<div class=" form-group form-inline"> <div class=" form-group form-inline">
<select class=" form-control input-sm" id="effective"> <select class=" form-control input-sm" id="effective">
<option value="">全部</option> <option value="">全部</option>
<option value="1">是</option> <option value="1">是</option>
<option value="0">否</option> <option value="0">否</option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="creater">创建人</label> <label for="creater">创建人</label>
<input type="text" class="form-control input-sm" id="creater" maxlength="16"/> <input type="text" class="form-control input-sm" id="creater" maxlength="16"/>
</div> </div>
<div class="form-group"> <div class="form-group">
<button type="button" style="margin-left:20px" id="queryBtn" class="btn btn-info btn-sm">查询</button> <button type="button" style="margin-left:20px" id="queryBtn" class="btn btn-info btn-sm">查询</button>
</div> </div>
</div> </div>
</form> </form>
@ -95,13 +95,13 @@
</div> </div>
<div class="btns"> <div class="btns">
<pm:myPermissions permissions="/role/add"> <pm:myPermissions permissions="/role/add">
<button type="button" onclick="add()" class="btn btn-warning btn-sm">增加</button> <button type="button" onclick="add()" class="btn btn-warning btn-sm">增加</button>
</pm:myPermissions> </pm:myPermissions>
<pm:myPermissions permissions="/r ole/importExcel"> <pm:myPermissions permissions="/r ole/importExcel">
<button type="button" class="btn btn-success btn-sm" onclick="importBtn()">导入Excel</button> <button type="button" class="btn btn-success btn-sm" onclick="importBtn()">导入Excel</button>
</pm:myPermissions> </pm:myPermissions>
<pm:myPermissions permissions="/role/export"> <pm:myPermissions permissions="/role/export">
<button type="button" class="btn btn-primary btn-sm" onclick="exportExcel()">导出Excel</button> <button type="button" class="btn btn-primary btn-sm" onclick="exportExcel()">导出Excel</button>
</pm:myPermissions> </pm:myPermissions>
</div> </div>
<div class="tableDiv"> <div class="tableDiv">
@ -109,72 +109,72 @@
</div> </div>
</div> </div>
</div> </div>
<!-- 模态框Modal --> <!-- 模态框Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">角色信息</h4> <h4 class="modal-title" id="myModalLabel">角色信息</h4>
</div> </div>
<div class="modal-body" style="height:auto"> <div class="modal-body" style="height:auto">
<form id="updateaddform"> <form id="updateaddform">
<div class="formDiv"> <div class="formDiv">
<label class="control-label left">角色名:</label> <label class="control-label left">角色名:</label>
<input type="hidden" id="re_roleId" name="roleId"> <input type="hidden" id="re_roleId" name="roleId">
<input type="text" class="form-control input input-sm" id="re_roleName" name="roleName" maxlength="15"> <input type="text" class="form-control input input-sm" id="re_roleName" name="roleName" maxlength="15">
</div> </div>
<div class="formDiv"> <div class="formDiv">
<label for="re_effective" class="control-label left">有效否:</label> <label for="re_effective" class="control-label left">有效否:</label>
<select class="form-control input input-sm shortInput" id="re_effective" name="effective"> <select class="form-control input input-sm shortInput" id="re_effective" name="effective">
<option value="1">是</option> <option value="1">是</option>
<option value="0">否</option> <option value="0">否</option>
</select> </select>
</div> </div>
<div class="formDiv"> <div class="formDiv">
<label for="re_remark" class="control-label left">备注:</label> <label for="re_remark" class="control-label left">备注:</label>
<textarea id="re_remark" class="form-control input input-sm" name="remark" maxlength="50"></textarea> <textarea id="re_remark" class="form-control input input-sm" name="remark" maxlength="50"></textarea>
</div> </div>
</form> </form>
</div> </div>
<div class="modelBtns"> <div class="modelBtns">
<button type="button" class="btn btn-primary btn-sm modelBtn" id="btn_submit">提交</button> <button type="button" class="btn btn-primary btn-sm modelBtn" id="btn_submit">提交</button>
<button type="button" class="btn btn-default btn-sm modelBtn" onclick="clearForm()">清空</button> <button type="button" class="btn btn-default btn-sm modelBtn" onclick="clearForm()">清空</button>
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div> </div>
<!-- 模态框Modal1 导入--> <!-- 模态框Modal1 导入-->
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> <div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel1">导入信息</h4> <h4 class="modal-title" id="myModalLabel1">导入信息</h4>
</div> </div>
<div class="modal-body" style="height:240px"> <div class="modal-body" style="height:240px">
<form method="POST" enctype="multipart/form-data" <form method="POST" enctype="multipart/form-data"
id="form1"> id="form1">
<div class="formDiv"> <div class="formDiv">
<label class="control-label left">下载模板:</label> <label class="control-label left">下载模板:</label>
<input class="btn btn-primary btn-sm" onclick="window.open('${path }/static/template/角色列表导入模板无下载.xls');" type="button" value="下载模板"> <input class="btn btn-primary btn-sm" onclick="window.open('${path }/static/template/角色列表导入模板无下载.xls');" type="button" value="下载模板">
</div> </div>
<div class="formDiv"> <div class="formDiv">
<label for="re_effective" class="control-label left">选择文件:</label> <label for="re_effective" class="control-label left">选择文件:</label>
<input id="upfile" type="file" name="upfile" calss="layui-btn"> <input id="upfile" type="file" name="upfile" calss="layui-btn">
</div> </div>
<div class="modelBtns"> <div class="modelBtns">
<input class="btn btn-primary btn-sm" type="button" value="批量导入Excel数据" <input class="btn btn-primary btn-sm" type="button" value="批量导入Excel数据"
onclick="importExcel('/role/importExcelNotDown','角色')"> onclick="importExcel('/role/importExcelNotDown','角色')">
</div> </div>
<div class="formDiv"> <div class="formDiv">
<label class="warningLabel">友情提醒:</label> <label class="warningLabel">友情提醒:</label>
<div class="warningDiv"> <div class="warningDiv">
<span style="color: red"></br>1、角色名不能为空,不能重复,内容最多16个字。</span></br> <span style="color: red"></br>1、角色名不能为空,不能重复,内容最多16个字。</span></br>
<span style="color: red">2、备注可为空,内容最多50个字。</span></br> <span style="color: red">2、备注可为空,内容最多50个字。</span></br>
<span style="color: red">3、是否有效不能为空,内容最多9个字。</span></br> <span style="color: red">3、是否有效不能为空,内容最多9个字。</span></br>
<span style="color: red">4、值包含逗号必须单元格设置为文本类型。</span></br> <span style="color: red">4、值包含逗号必须单元格设置为文本类型。</span></br>
</div> </div>
</div> </div>
</form> </form>
@ -184,7 +184,7 @@
</div> </div>
<script> <script>
$(function () { $(function () {
$(".modal-dialog").draggable();//为模态对话框添加拖拽 $(".modal-dialog").draggable();//为模态对话框添加拖拽
}) })
</script> </script>
<script src="${path}/static/zTree_v3-master/js/jquery.ztree.core.js"></script> <script src="${path}/static/zTree_v3-master/js/jquery.ztree.core.js"></script>

@ -70,6 +70,19 @@ h3{
margin-top: 11%; margin-top: 11%;
} }
/** /**
*div
*/
.qRCodeDiv{
width: 70%;
height: 240px;
margin-left: 80px;
margin-top: 11%;
}
.QRcordImg{
margin-left: -20px;
margin-top: -8%;
}
/**
* *
*/ */
.login_foot{ .login_foot{

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 KiB

@ -1,6 +1,6 @@
var form = '' var form = ''
var pageNumber = 1; var pageNumber = 1;
//定义表格内容最大高度 //定义表格内容最大高度
var maxHeight = 0; var maxHeight = 0;
$(function(){ $(function(){
var columns = []; var columns = [];
@ -8,93 +8,93 @@ $(function(){
checkbox:true checkbox:true
}, },
{ {
title:'序号', title:'序号',
field:'no', field:'no',
formatter: function (value, row, index) { formatter: function (value, row, index) {
//获取每页显示的数量 //获取每页显示的数量
var pageSize = $('#bootstrapTable').bootstrapTable('getOptions').pageSize; var pageSize = $('#bootstrapTable').bootstrapTable('getOptions').pageSize;
//获取当前是第几页 //获取当前是第几页
if(pageNumber == 1){ if(pageNumber == 1){
pageNumber = $('#bootstrapTable').bootstrapTable('getOptions').pageNumber; pageNumber = $('#bootstrapTable').bootstrapTable('getOptions').pageNumber;
} }
//返回序号注意index是从0开始的所以要加上1 //返回序号注意index是从0开始的所以要加上1
return pageSize * (pageNumber - 1) + index + 1; return pageSize * (pageNumber - 1) + index + 1;
} }
}, },
{ {
title:'科室名', title:'科室名',
field:'deptName', field:'deptName',
}); });
var roleId = $("#roleId").val(); var roleId = $("#roleId").val();
if(roleId == 0){ if(roleId == 0){
columns.push({ columns.push({
title:'所属医院', title:'所属医院',
field:'hospitalName', field:'hospitalName',
}); });
} }
columns.push( columns.push(
{ {
title:'是否有效', title:'是否有效',
field:'effective', field:'effective',
formatter: function (value, row, index) { formatter: function (value, row, index) {
if(value ==1){ if(value ==1){
return '是' return '是'
}else if(value ==0){ }else if(value ==0){
return '否' return '否'
} }
} }
}, },
{ {
title:'创建时间', title:'创建时间',
field:'createDate', field:'createDate',
}, },
{ {
title:'创建人', title:'创建人',
field:'creater', field:'creater',
}, },
{ {
title:'修改时间', title:'修改时间',
field:'updateDate', field:'updateDate',
}, },
{ {
title:'修改人', title:'修改人',
field:'updater', field:'updater',
}, },
{ {
title:'操作', title:'操作',
field:'deptId', formatter: function(value,row,index){ field:'deptId', formatter: function(value,row,index){
var editanddrop = ''; var editanddrop = '';
if(row.isUpdate == 1){ if(row.isUpdate == 1){
editanddrop += '<button type="button" onclick="edit('+row.deptId+')" class="btn btn-info operBtns btn-sm" >编辑</button>'; editanddrop += '<button type="button" onclick="edit('+row.deptId+')" class="btn btn-info operBtns btn-sm" >编辑</button>';
} }
if(row.isDelete == 1){ if(row.isDelete == 1){
editanddrop += '<button type="button" onclick="drop('+row.deptId+')" class="btn btn-danger operBtns btn-sm">删除</button>'; editanddrop += '<button type="button" onclick="drop('+row.deptId+')" class="btn btn-danger operBtns btn-sm">删除</button>';
} }
return editanddrop; return editanddrop;
} }
}); });
$('#myModal').modal('hide'); $('#myModal').modal('hide');
loadDict(); loadDict();
//先销毁表格 //先销毁表格
$('#bootstrapTable').bootstrapTable({ $('#bootstrapTable').bootstrapTable({
//表格高度 //表格高度
//height: getHeight(), //height: getHeight(),
method : 'get', method : 'get',
url :path+ "/dept/pageList",//请求路径 url :path+ "/dept/pageList",//请求路径
striped : true, //是否显示行间隔色 striped : true, //是否显示行间隔色
pageNumber : 1, //初始化加载第一页 pageNumber : 1, //初始化加载第一页
pagination : true,//是否分页 pagination : true,//是否分页
sidePagination : 'server',//server:服务器端分页|client前端分页 sidePagination : 'server',//server:服务器端分页|client前端分页
pageSize : 10,//单页记录数 pageSize : 10,//单页记录数
pageList : [ 5, 10, 20, 30 ],//可选择单页记录数 pageList : [ 5, 10, 20, 30 ],//可选择单页记录数
cache: false, cache: false,
paginationPreText : '上一页', paginationPreText : '上一页',
paginationNextText : '下一页', paginationNextText : '下一页',
queryParams : function(params) {//上传服务器的参数 queryParams : function(params) {//上传服务器的参数
var temp = {//如果是在服务器端实现分页limit、offset这两个参数是必须的 var temp = {//如果是在服务器端实现分页limit、offset这两个参数是必须的
limit : params.limit, // 每页显示数量 limit : params.limit, // 每页显示数量
offset : params.offset, // SQL语句起始索引 offset : params.offset, // SQL语句起始索引
page : (params.offset / params.limit) + 1, //当前页码 page : (params.offset / params.limit) + 1, //当前页码
deptName:$("#dept_name").val(), deptName:$("#dept_name").val(),
dictId:$("#dict_id option:selected").val(), dictId:$("#dict_id option:selected").val(),
effective : $("#effective option:selected").val(), effective : $("#effective option:selected").val(),
@ -103,28 +103,28 @@ $(function(){
return temp; return temp;
}, },
columns : columns, columns : columns,
onLoadSuccess: function(){ //加载成功时执行 onLoadSuccess: function(){ //加载成功时执行
$(".page-list").show(); $(".page-list").show();
$("th").css({'text-align':'center','vertical-align':'middle'}); $("th").css({'text-align':'center','vertical-align':'middle'});
$("td").css({'text-align':'center','vertical-align':'middle'}); $("td").css({'text-align':'center','vertical-align':'middle'});
reloadTableHeight("bootstrapTable"); reloadTableHeight("bootstrapTable");
}, },
//监听分页点击事件 //监听分页点击事件
onPageChange: function(num, type) { onPageChange: function(num, type) {
pageNumber = num; pageNumber = num;
}, },
//选中单个复选框 //选中单个复选框
onCheck:function(row){ onCheck:function(row){
var checks = $("#checks").val(); var checks = $("#checks").val();
$("#checks").val(checks+=row.deptId + ","); $("#checks").val(checks+=row.deptId + ",");
}, },
//取消单个复选框 //取消单个复选框
onUncheck:function(row){ onUncheck:function(row){
var checks = $("#checks").val(); var checks = $("#checks").val();
checks = checks.replace(row.deptId + ",",""); checks = checks.replace(row.deptId + ",","");
$("#checks").val(checks); $("#checks").val(checks);
}, },
//全选 //全选
onCheckAll:function(rows){ onCheckAll:function(rows){
$("#checks").val(""); $("#checks").val("");
var checks = ''; var checks = '';
@ -134,15 +134,15 @@ $(function(){
} }
$("#checks").val(checks); $("#checks").val(checks);
}, },
//全不选 //全不选
onUncheckAll: function (rows) { onUncheckAll: function (rows) {
$("#checks").val(""); $("#checks").val("");
} }
}); });
//初始化表单验证 //初始化表单验证
//formValidator(); //formValidator();
}); });
/*//回跳表格页码 /*//回跳表格页码
function backToPage(){ function backToPage(){
var pageSize=$('#bootstrapTable').bootstrapTable('getOptions').pageSize; var pageSize=$('#bootstrapTable').bootstrapTable('getOptions').pageSize;
var rows=$('#bootstrapTable').bootstrapTable("getOptions").totalRows; var rows=$('#bootstrapTable').bootstrapTable("getOptions").totalRows;
@ -152,18 +152,18 @@ function backToPage(){
} }
$('#bootstrapTable').bootstrapTable('selectPage', pageNumber); $('#bootstrapTable').bootstrapTable('selectPage', pageNumber);
}*/ }*/
//先销毁modal //先销毁modal
/*$('#myModal').on('hidden.bs.modal', function() { /*$('#myModal').on('hidden.bs.modal', function() {
$("#updateaddform").data('bootstrapValidator').destroy(); $("#updateaddform").data('bootstrapValidator').destroy();
$('#updateaddform').data('bootstrapValidator', null); $('#updateaddform').data('bootstrapValidator', null);
formValidator(); formValidator();
}); });
//form验证规则 //form验证规则
function formValidator() { function formValidator() {
//表单校验 //表单校验
form = $('#updateaddform'); form = $('#updateaddform');
form.bootstrapValidator({ form.bootstrapValidator({
message: '输入值不合法', message: '输入值不合法',
feedbackIcons: { feedbackIcons: {
valid: 'glyphicon glyphicon-ok', valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove', invalid: 'glyphicon glyphicon-remove',
@ -171,19 +171,19 @@ function formValidator() {
}, },
fields: { fields: {
re_deptName: { re_deptName: {
message: '科室名不合法', message: '科室名不合法',
validators: { validators: {
notEmpty: { notEmpty: {
message: '角色名不能为空' message: '角色名不能为空'
}, },
stringLength: { stringLength: {
min: 2, min: 2,
max: 32, max: 32,
message: '请输入2到32个字符' message: '请输入2到32个字符'
}, },
regexp: { regexp: {
regexp: /^[a-zA-Z0-9_\. \u4e00-\u9fa5 ]+$/, regexp: /^[a-zA-Z0-9_\. \u4e00-\u9fa5 ]+$/,
message: '角色名只能由字母、数字、点、下划线和汉字组成 ' message: '角色名只能由字母、数字、点、下划线和汉字组成 '
} }
} }
} }
@ -203,7 +203,7 @@ function formValidator() {
} }
}); });
}*/ }*/
//加载 //加载
function loadDict(){ function loadDict(){
$.ajax({ $.ajax({
type: "GET", type: "GET",
@ -222,7 +222,7 @@ function loadDict(){
} }
}); });
} }
//验证科室名不能重复 //验证科室名不能重复
$("#re_deptName").blur(function(){ $("#re_deptName").blur(function(){
var deptId = $("#re_deptId").val(); var deptId = $("#re_deptId").val();
var deptName = $("#re_deptName").val(); var deptName = $("#re_deptName").val();
@ -235,7 +235,7 @@ $("#re_deptName").blur(function(){
dataType:'json', dataType:'json',
success:function(data){ success:function(data){
if(data.code == 200){ if(data.code == 200){
toastr.warning("部门名已存在"); toastr.warning("部门名已存在");
$("#re_deptName").val(""); $("#re_deptName").val("");
$("#re_deptName").focus(); $("#re_deptName").focus();
} }
@ -244,9 +244,9 @@ $("#re_deptName").blur(function(){
} }
}) })
//编辑框回显 //编辑框回显
function edit(id){ function edit(id){
$("#myModalLabel").text("编辑"); $("#myModalLabel").text("编辑");
$.ajax({ $.ajax({
type: "post", type: "post",
url: path+ "/dept/selectDept", url: path+ "/dept/selectDept",
@ -264,11 +264,11 @@ function edit(id){
}); });
$('#myModal').modal('show') $('#myModal').modal('show')
} }
//删除 //删除
function drop(id) { function drop(id) {
Common.confirm({ Common.confirm({
title: "提示", title: "提示",
message: "确定是否删除这条记录", message: "确定是否删除这条记录",
operate: function (reselt) { operate: function (reselt) {
if (reselt) { if (reselt) {
$.ajax({ $.ajax({
@ -280,35 +280,35 @@ function drop(id) {
async: false, async: false,
success: function (data) { success: function (data) {
if ("success" == data.msg) { if ("success" == data.msg) {
toastr.success("删除成功!"); toastr.success("删除成功!");
$("#checks").val(""); $("#checks").val("");
backToPage(); backToPage();
} }
}, },
error: function () { error: function () {
window.confirm("删除失败"); window.confirm("删除失败");
} }
}) })
} }
} }
}) })
} }
//新增框 //新增框
function add() { function add() {
initable(); initable();
$("#myModalLabel").text('增加'); $("#myModalLabel").text('增加');
$('#myModal').modal('show'); $('#myModal').modal('show');
$("#re_dictId").empty(); $("#re_dictId").empty();
loadDict(); loadDict();
} }
//提交更改 //提交更改
$('#btn_submit').click(function () { $('#btn_submit').click(function () {
var deptName = $("#re_deptName").val(); var deptName = $("#re_deptName").val();
var dictId = $("#re_dictId").val(); var dictId = $("#re_dictId").val();
if(deptName != ''){ if(deptName != ''){
if(dictId != ''){ if(dictId != ''){
var btype = $("#myModalLabel").text(); var btype = $("#myModalLabel").text();
if(btype=='编辑'){ if(btype=='编辑'){
$.ajax({ $.ajax({
type: "post", type: "post",
url: path+ "/dept/update", url: path+ "/dept/update",
@ -316,7 +316,7 @@ $('#btn_submit').click(function () {
dataType:"json", dataType:"json",
success: function(data){ success: function(data){
if("success"==data.msg){ if("success"==data.msg){
toastr.success("修改成功!"); toastr.success("修改成功!");
backToPage(); backToPage();
$('#myModal').modal('hide'); $('#myModal').modal('hide');
}else{ }else{
@ -324,7 +324,7 @@ $('#btn_submit').click(function () {
} }
} }
}) })
}else if(btype =='增加'){ }else if(btype =='增加'){
$.ajax({ $.ajax({
type: "post", type: "post",
url:path+ "/dept/add", url:path+ "/dept/add",
@ -332,7 +332,7 @@ $('#btn_submit').click(function () {
dataType:"json", dataType:"json",
success: function(data){ success: function(data){
if("success"==data.msg){ if("success"==data.msg){
toastr.success("添加成功!"); toastr.success("添加成功!");
setTimeout(function(){ setTimeout(function(){
window.location.reload(); window.location.reload();
},500) },500)
@ -344,18 +344,18 @@ $('#btn_submit').click(function () {
}) })
} }
}else{ }else{
toastr.warning("所属医院不能为空!"); toastr.warning("所属医院不能为空!");
} }
}else{ }else{
toastr.warning("部门名称不能为空!"); toastr.warning("部门名称不能为空!");
} }
}) })
//初始化模态框 //初始化模态框
function initable(){ function initable(){
$("#re_deptId").val(""); $("#re_deptId").val("");
$("#updateaddform")[0].reset(); $("#updateaddform")[0].reset();
} }
//导出excel功能 //导出excel功能
function exportExcel(){ function exportExcel(){
var roleId = $("#roleId").val(); var roleId = $("#roleId").val();
var url = ''; var url = '';
@ -370,8 +370,8 @@ function exportExcel(){
window.location.href = url; window.location.href = url;
}else{ }else{
Common.confirm({ Common.confirm({
title: "提示", title: "提示",
message: "没有选中,您确定要按搜索栏条件导出?", message: "没有选中,您确定要按搜索栏条件导出?",
operate: function (reselt) { operate: function (reselt) {
if (reselt) { if (reselt) {
if (roleId == 0) { if (roleId == 0) {
@ -385,22 +385,22 @@ function exportExcel(){
}) })
} }
} }
//搜索 //搜索
$('#queryBtn').click(function () { $('#queryBtn').click(function () {
$("#checks").val(""); $("#checks").val("");
refresh(); refresh();
}) })
//刷新表格 //刷新表格
function refresh() { function refresh() {
$('#bootstrapTable').bootstrapTable('refresh',{ $('#bootstrapTable').bootstrapTable('refresh',{
url :path+ '/dept/pageList' url :path+ '/dept/pageList'
}) })
} }
//清空 //清空
function clearForm(){ function clearForm(){
$("#updateaddform")[0].reset(); $("#updateaddform")[0].reset();
} }
//监听关闭模态框刷新事件 //监听关闭模态框刷新事件
$('#myModal1').on('hide.bs.modal', function () { $('#myModal1').on('hide.bs.modal', function () {
window.location.reload(); window.location.reload();
}); });

@ -1,3 +1,6 @@
/** /**
* Created by ljx on 2019/4/25. * Created by ljx on 2019/4/25.
*/ */
@ -32,86 +35,142 @@ $(function(){
}); });
function login(){
var banar = document.getElementById('banar');
var txt = document.getElementById('txt');
var sub = document.getElementById('sub');
var chang = document.getElementById('chang');
//创建一个数组,里面包含着随机验证码所能出现的全部字符
var allchar = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "a", "b", "c", "d", "e",
"f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r",
"s", "t", "u", "v", "w", "x", "y", "z"];
var result;
function randomChar() {
result = "";//创建空的字符串,方便等下接收值
//循环找出4的字符
for (var i = 0; i < 4; i++) {
//随机生成一个0-61的数字
var index = Math.floor(Math.random() * 36);
//将随机生成的数字作为数组的索引然后赋给result
//每次赋一个数组值循环4次最后就是4个字符
result += allchar[index];
}
//把随机生成的4个字符添加到ID为banar的div里面
banar.innerHTML = result;
//点击验证按钮,判断我们输入的值和随机生成的值是否一样?
//一样就弹出验证成功,不一样就弹出验证错误。
sub.onclick = function () {
if (txt.value == result) {
alert("验证成功!!!");
} else {
alert("验证错误!!!");
randomChar();//如果错误执行randomChar方法重新随机生成4个字符
txt.value = "";//如果错误,我们输入的验证码等于空,方便我们再次输入
}
};
}
randomChar();
//点击"看不见换一张"时,执行randomChar方法重新随机生成4个字符我们输入的验证码等于空方便我们再次输入
chang.onclick = function () {
txt.value = "";
randomChar();
}
function login() {
var userName = $("#userName").val(); var userName = $("#userName").val();
var userPwd = $("#userPwd").val(); var userPwd = $("#userPwd").val();
userPwd = hex_hmac_md5(userPwd,userPwd); var txt = $("#txt").val();
var rememberMeChecked = $("input[type='checkbox']").is(':checked'); var rememberMeChecked = $("input[type='checkbox']").is(':checked');
var rememberMe = ''; var rememberMe = '';
if(rememberMeChecked){ if (rememberMeChecked) {
rememberMe = 'yes'; rememberMe = 'yes';
} }
if(userName == ''){ if (userName == '') {
toastr.warning("用户名不能为空!"); toastr.warning("用户名不能为空!");
}else{ } else {
if(userPwd == ''){ if (userPwd == '') {
toastr.warning("密码不能为空!"); toastr.warning("密码不能为空!");
}else{ } else {
if (txt == '') {
toastr.warning("验证码不能为空!");
} else {
$.ajax({ $.ajax({
type : "POST", type: "POST",
url : path+"/login", url: path + "/login",
data: {userName:userName, userPwd:userPwd,rememberMe:rememberMe}, data: {userName: userName, userPwd: userPwd, rememberMe: rememberMe},
dataType:'json', dataType: 'json',
success : function(data) { success: function (data) {
if(data.code == 100){ if (result==txt) {
if (data.code == 100) {
window.location.href = data.extend.url; window.location.href = data.extend.url;
}else{ } else {
$("#msg").text(data.msg); toastr.warning(data.extend.msg);
}
}else {
toastr.warning("验证码错误!!!");
} }
} }
}) })
} }
} }
}
} }
var interval =""; var interval = "";
var qrCodeIdentity =""; var qrCodeIdentity = "";
function handoffLogin(){
//获取扫码登录二维码
function handoffLogin() {
$.ajax({ $.ajax({
type : "POST", type: "POST",
data:{loginTypeBitValue:16,type:3,projectUid:"cloudkey-fstth",ApplicationId:"fstth-wzh"}, data: {loginTypeBitValue: 16, type: 3, projectUid: "cloudkey-fstth", ApplicationId: "fstth-wzh"},
url : path+'/font/getQRcode', url: path + '/font/getQRcode',
success : function(data) { success: function (data) {
qrCodeIdentity = data.qrCodeIdentity; qrCodeIdentity = data.qrCodeIdentity;
$("#QRcordImg").prop("src","data:image/jpeg;base64,"+data.qrCodeBase64); $("#QRcordImg").prop("src", "data:image/jpeg;base64," + data.qrCodeBase64);
interval = setInterval(scanCodeLogin, 1000,qrCodeIdentity); //轮询监听用户扫码
interval = setInterval(scanCodeLogin, 1000, qrCodeIdentity);
} }
}) })
$("#switchHandoff").css("display","none"); $("#switchHandoff").css("display", "none");
$("#switchHandoff2").css("display","block"); $("#switchHandoff2").css("display", "block");
} }
function scanCodeLogin() { function scanCodeLogin() {
$.ajax({ $.ajax({
type:"POST", type: "POST",
data:{qrCodeIdentity:qrCodeIdentity}, data: {qrCodeIdentity: qrCodeIdentity},
url : path+'/font/getScanCode', url: path + '/font/getScanCode',
success : function (body) { success: function (body) {
if (body.verifyStatus ==0) { if (body.verifyStatus == 0) {
//扫码认证成功后撤销监听
clearInterval(interval); clearInterval(interval);
$.ajax({ $.ajax({
type:"POST", type: "POST",
data:{userToken:body.userToken}, data: {userToken: body.userToken},
url : path+'/font/getUserInfo', url: path + '/font/getUserInfo',
success : function (tlte) { success: function (tlte) {
if (tlte.msgType==1){ if (tlte.msgType == 1) {
$.ajax({ $.ajax({
type:"POST", type: "POST",
data:{userName:tlte.uid }, data: {userName: tlte.uid},
url : path+'/font/qRCodeLogin', url: path + '/font/qRCodeLogin',
success:function (tltel) { success: function (tltel) {
if(tltel.code == 100){ if (tltel.code == 100) {
window.location.href = tltel.extend.url; window.location.href = tltel.extend.url;
}else{ } else {
$("#msg").text(tltel.msg); $("#msg").text(tltel.msg);
} }
} }
}) })
}else { } else {
alert("登录失败请重新登录") alert("登录失败请重新登录")
} }
} }
@ -120,32 +179,30 @@ function scanCodeLogin() {
} }
}) })
} }
function handoffLogin2(){ function handoffLogin2() {
$("#switchHandoff").css("display","block"); $("#switchHandoff").css("display", "block");
$("#switchHandoff2").css("display","none"); $("#switchHandoff2").css("display", "none");
clearInterval(interval); clearInterval(interval);
} }
$('body').keydown(function () { $('body').keydown(function () {
if(event.keyCode == '13'){ if (event.keyCode == '13') {
login(); login();
} }
}) })
/** /**
* 判断是iframe框架跳出iframe框架使用top链接 * 判断是iframe框架跳出iframe框架使用top链接
*/ */
if (top.location != location){ if (top.location != location) {
top.location.href = location.href; top.location.href = location.href;
} }

@ -24,6 +24,12 @@ $(function() {
toastr.warning("重复密码与密码不一致!") toastr.warning("重复密码与密码不一致!")
return false; return false;
} }
reg = /^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)])+$)(?=.*[\W]).{8,32}$/;
var mm = $("#newUserPwd").val();
if (!reg.test($("#newUserPwd").val())) {
toastr.warning("密码不低于8位包含大写字母、小写字母、符号、数字!")
return false;
}
$.ajax({ $.ajax({
type: "post", type: "post",
url: path+"/user/updatePassword", url: path+"/user/updatePassword",

@ -1,4 +1,4 @@
jdbc.driver=com.mysql.jdbc.Driver jdbc.driver=com.mysql.jdbc.Driver
#jdbc.url=jdbc\:mysql\://localhost\:3306/power?useUnicode\=true&characterEncoding\=utf-8 #jdbc.url=jdbc\:mysql\://localhost\:3306/power?useUnicode\=true&characterEncoding\=utf-8
jdbc.url=jdbc\:mysql\://120.27.212.36\:3306/power?useUnicode\=true&characterEncoding\=utf-8 jdbc.url=jdbc\:mysql\://120.27.212.36\:3306/power?useUnicode\=true&characterEncoding\=utf-8
jdbc.username=root jdbc.username=root

@ -357,7 +357,7 @@
dict.dict_area dict.dict_area
FROM FROM
power_sys_dict dict power_sys_dict dict
LEFT JOIN power_dept dept ON dict.dept_id = dept.dict_id LEFT JOIN power_dept dept ON dict.dict_id = dept.dict_id
AND dict.dict_status = 1 AND dept.effective = 1 AND dict.dict_status = 1 AND dept.effective = 1
</select> </select>
<!--查询全部--> <!--查询全部-->

@ -259,7 +259,8 @@
power_dept.dept_id, power_dept.dept_id,
power_user.dept_id power_user.dept_id
) )
where power_user.effective = #{effective,jdbcType=INTEGER} and user_name = #{userName,jdbcType=VARCHAR} and user_pwd = #{userPwd,jdbcType=VARCHAR} where
power_user.user_name = #{userName,jdbcType=VARCHAR} and power_user.user_pwd = #{userPwd,jdbcType=VARCHAR}
GROUP BY user_id GROUP BY user_id
</select> </select>

@ -1,5 +1,7 @@
package com.manage.util; package com.manage.util;
import org.apache.commons.lang3.StringUtils;
import java.text.ParseException; import java.text.ParseException;
import java.text.ParsePosition; import java.text.ParsePosition;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -96,6 +98,9 @@ public class DateUtils {
return calendar.getTime(); return calendar.getTime();
} }
/** /**
* *
* *

@ -0,0 +1,74 @@
package com.manage.util;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.Random;
public class DrawCheckcode {
private String checkCode;
public String getCheckCode() {
return checkCode;
}
public void setCheckCode(String checkCode) {
this.checkCode = checkCode;
}
//随机产生颜色
public Color getColor(){
Random random = new Random();
//获取0-255随机值
int r = random.nextInt(256);
int g = random.nextInt(256);
int b = random.nextInt(256);
return new Color(r,g,b);
}
//产生验证码值
public String getNum(){
//原来是0-8999+1000后变成1000-9999
int ran = (int)(Math.random()*9000)+1000;
return String.valueOf(ran);
}
public BufferedImage doDraw(){
//绘制验证码
//参数:长,宽,图片类型
BufferedImage image = new BufferedImage(80, 30, BufferedImage.TYPE_INT_RGB);
//画笔
Graphics graphics = image.getGraphics();
//画长方形坐标从0,0,到8030
graphics.fillRect(0,0,80,30);
//绘制50条干扰条
for(int i=0;i<50;i++){
Random random = new Random();
int xBegin = random.nextInt(80);
int yBegin = random.nextInt(30);
int xEnd = random.nextInt(xBegin +10);
int yEnd = random.nextInt(yBegin +10);
//画笔颜色,随机
graphics.setColor(getColor());
//绘制线条
graphics.drawLine(xBegin,yBegin,xEnd,yEnd);
}
//绘制验证码
//字体加粗,变大
graphics.setFont(new Font("seif",Font.BOLD,20));
//画笔颜色
graphics.setColor(Color.BLACK);
//得到随机取得的数字
String checode = getNum();
checkCode = checode;
//在数字中间加上空格分开
StringBuffer buffer = new StringBuffer();
for(int i=0;i<checode.length();i++){
buffer.append(checode.charAt(i)+" ");
}
//在长方形里绘制验证码15,20是起始坐标
graphics.drawString(buffer.toString(),15,20);
return image;
}
}

@ -15,6 +15,8 @@ import java.util.Map;
*/ */
public class Msg { public class Msg {
//state:100-success 200-fail //state:100-success 200-fail
private Boolean result;
private int code; private int code;
//提示信息 //提示信息
private String msg; private String msg;
@ -35,6 +37,14 @@ public class Msg {
return result; return result;
} }
public static Msg failUser(){
Msg result=new Msg();
result.setCode(200);
result.setMsg("账号或密码错误");
return result;
}
public static Msg fail(String msg){ public static Msg fail(String msg){
Msg result=new Msg(); Msg result=new Msg();
result.setCode(200); result.setCode(200);
@ -63,6 +73,14 @@ public class Msg {
public void setMsg(String msg) { public void setMsg(String msg) {
this.msg = msg; this.msg = msg;
} }
public Boolean getResult() {
return result;
}
public void setResult(Boolean result) {
this.result = result;
}
public Map<String, Object> getExtend() { public Map<String, Object> getExtend() {
return extend; return extend;

Loading…
Cancel
Save