H5页面随机数字键盘支付页面

H5页面随机数字键盘支付页面

有个H5支付的业务需要随机数字的键盘

参考了下文:https://blog.csdn.net/Mr_Smile2014/article/details/52473351

做了一些小修改:

  在原有的基础上,增加了一些按键反馈的效果。

  每个按键加上边框。

最终效果:

  

下面是所有代码:

1.HTML页面+JS

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta name="viewport"content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" /><meta http-equiv="Cache-Control" CONTENT="private,must-revalidate"><link href="../media/css/bootstrap.min.css" rel="stylesheet" type="text/css"/><!-- 引入js脚本文件  begin --><!--[if lt IE 9]><script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script><script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script><![endif]--><title>H5付款</title><style type="text/css">.input-out {padding-top: 14px;}.btn-out {margin:30px 10px;}.btn-out button {width: 100%;background: #5CACEE;border: #5CACEE;color: #fff;height: 50px;border-radius: 3px;font-size: 18px;font-family: "Microsoft Yahei", "??????", SimHei, Tahoma, Arial, Helvetica, STHeiti;}.keyboard {background: #fff;}.keyboard table {width:100%;text-align:center;}.keyboard table td {padding: 15px;}.keyboard table a,.keyboard table a:hover,.keyboard table a:focus {color: #333;text-decoration: none;}.input-out label {color:#D2D1D1;font-weight: normal;font-size: 16px;}.bottom {color:#888888;margin-bottom: 15px;text-align:center;margin-top:100px;}.bottom a {color:#888888;}.bottom img {vertical-align: middle;width: 18px;}
/*.inputText { font-size: 16px;border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1px solid rgb(192,192,192); border-bottom: 1px solid #ddd;padding-left: 12px; width:100%;font-weight: normal;padding-top: 20px;height: 50px;
}*/
input[type="password"],input[type="text"]{ font-size: 30px;border-left: medium none; border-right: medium none; border-top: medium none; /*border-bottom: 1px solid rgb(192,192,192);*/ border-bottom: 1px solid #ddd;padding-left: 12px; width:100%;font-weight: normal;padding-top: 10px;height: 40px;
}
</style></head><body><div style="height: 20px;"></div><form action="../pay" method="post" id="from"><div class="content"><div><label  style="font-size: 20px;padding-left: 12px; ">账户</label><input type="text" id="loginName"  placeholder="" /></div><!--<div><label  style="font-size: 20px;padding-left: 12px; ">密码</label><input type="password"  id="pwd" placeholder="" /></div>--><label  style="font-size: 20px;padding-left: 12px; ">支付密码</label><div id="tradePwd" class="input-out pass-label" style="border-bottom: 1px solid #ddd;padding-left: 12px;" random="2321321321" path="../" ><label id="pin" style="color: #8C8C8C;height: 20px;"></label></div></div><div class="btn-out"><button type="button" class="btn btn-default" ontouchstart="check();" id="pay">支付</button></div></form><div class="bottom" id="bottom-out"><!--<img src="<c:url value="/images/phone.png"/>" />--><!--<span>客服电话:4000-xxx-xxx</span>--></div><!-- jianpan--><div class="keyboard" style="display:none;" id="keyboard"><table class="table-bordered" id="key_table"></table></div></body>
<script src="../media/js/jquery-1.10.1.min.js" type="text/javascript"></script>
<script src="../media/js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript">$(document).ready(function() {$("#pay").removeAttr("disabled");$("input").click(function() {hideKey();});$("button").click(function() {hideKey();});$(".pass-label").click(function() {var rangdom = $(this).attr("random");var path = $(this).attr("path");pwdkey(this, rangdom, path);});window.addEventListener("onorientationchange" in window ? "orientationchange": "resize", hengshuping, false);});//横竖屏function hengshuping() {if (window.orientation == 180 || window.orientation == 0) {$("div#keyboard td").each(function() {$(this).css("padding", "15px");});}if (window.orientation == 90 || window.orientation == -90) {$("div#keyboard td").each(function() {$(this).css("padding", "8px");});}window.scrollTo(0, $(".pass-label").offset().top);}//加载密码键盘function pwdkey(obj, rangdom, path) {$('.keyboard').addClass("navbar-fixed-bottom");$('.keyboard').css({"z-index" : "9999"});if (rangdom == null || rangdom == "") {alert("无法加载密码键盘,请刷新后重试!");return false;}if ($("#pkey").val() == null || $("#pkey").val() == "undefined") {$(obj).html($(obj).html()+ '<input type="hidden" name="pkey" id="pkey" />');}//$("#pin").html("支付密码");
            $("#pin").html("");setCssNomal();$("#pkey").val("");$.ajax({type : 'post',url : "../h5Pay/pkey",cache : false,async : false,data : {rangdom : rangdom},success : function(data) {if (data == null || data == "" || data == "undefined"|| data.length != 10) {alert("无法加载密码键盘,请刷新后重试!");return false;} else {var key_table = $("#key_table");key_table.html("");var content = '<tr>';for (var i = 0; i < 12; i++) {if ((i + 1) % 3 == 0 && i != 0 && i <= 5) {content = content+ '<td class="table-bordered" style="width:33%;"  key="'+ data[i]+ '"ontouchstart="ontouchreturn(this);" ontouchend="return ontouch(this);"><img src="'+ '../h5Pay/getKey?key='+ data[i]+ '&rangdom='+ rangdom+ '" style="height:20px;" id="key_img"/></td></tr><tr>';} else if (i <= 7) {content = content+ '<td class="table-bordered" style="width:33%;" key="'+ data[i]+ '"ontouchstart="ontouchreturn(this);" ontouchend="return ontouch(this);"><img src="'+ '../h5Pay/getKey?key='+ data[i]+ '&rangdom='+ rangdom+ '" style="height:20px;" id="key_img"/></td>';} else if (i == 8) {content = content+ '<td class="table-bordered" style="width:33%;" ontouchstart="ontouchreturn(this);"  ontouchend="return deleteOne(this);"><img src="'+ '../media/image/keys/delete.png" style="height:20px;"  id="key_img"/></td>'+ '</tr><tr>';} else if (i < 11) {content = content+ '<td class="table-bordered" style="width:33%;" key="'+ data[i - 1]+ '" ontouchstart="ontouchreturn(this);" ontouchend="return ontouch(this);"><img src="'+ '../h5Pay/getKey?key='+ data[i - 1]+ '&rangdom='+ rangdom+ '" style="height:20px;" id="key_img"/></td>';} else {content = content+ '<td class="table-bordered" style="width:33%;" ontouchstart="ontouchreturn(this);" ontouchend="return _ok(this);"><img src="'+ '../media/image/keys/ok.png" style="height:20px;" id="key_img"/></td>'+ '</tr>';}}key_table.html(content);setTimeout(function() {$("#keyboard").show();}, 600);hengshuping();}},error : function() {alert("无法加载键盘,请刷新后重试!");}});}function ontouchreturn(obj) {$(obj).attr("bgcolor","#c5c5c5");}//数字按钮映射inputfunction ontouch(obj) {$(obj).removeAttr("bgcolor");var pkey = $("#pkey").val();var key = $(obj).attr("key");if (pkey == "") {$("#pin").html("");}var content = $("#pin").html();if (content != "" && content.length >= 6) {return false;}if (pkey != "") {key = "," + key;}pkey = pkey + key;$("#pkey").val(pkey);$("#pin").append("");setCssKey();}//删除按钮function deleteOne(obj) {$(obj).removeAttr("bgcolor");var pkey = $("#pkey").val() + "";if (pkey == "") {return false;}var local = pkey.lastIndexOf(",");if (local == -1) {$("#pkey").val("");$("#pin").html("");//$("#pin").html("支付密码");
                setCssNomal();} else {pkey = pkey.substring(0, local - 1);var content = $("#pin").html();content = content.substring(0, content.length - 1);$("#pkey").val(pkey);$("#pin").html(content);}}//确认按钮function _ok(obj) {$(obj).removeAttr("bgcolor");$("#key_table").html("");$("#keyboard").hide();}function showkey() {$("#keyboard").show();}function hideKey() {$("#key_table").html("");$("#keyboard").hide();}function setCssKey() {$("#pin").css({"font-size" : "18px","color" : "#030303","font-weight" : "normal","letter-spacing" : "1px"});}function setCssNomal() {$("#pin").css({"font-size" : "16px","color" : "#8C8C8C","font-weight" : "normal"});}//支付按钮function check(){hideKey();var pin="";pin=$("#pkey").val();if(pin==""||pin==undefined){bool=false;alert("请输入支付密码");return false;}else{var keys=pin.split(",");if(keys.length!=6){alert("请输入6位支付密码");return false;}}$.ajax({type : 'post',url : "../h5Pay/pay",data : {random:"2321321321",pin:pin},cache : false,success : function(data) { if(data.success){alert(data.message);}else{}},error : function(){alert("系统异常,请重试!");}});}</script></html>

2.密码键盘的MODEL类

import java.io.Serializable;
import java.util.List;
import java.util.Map;public class PwdKeyDto implements Serializable{private static final long serialVersionUID = 1L;private List<String> rundomKeys;// 随机Keysprivate Map<String, String> valueKeyMaps;// 密文和明文映射private Map<String, String> imgKeyMaps;// 密文和明文映射public PwdKeyDto() {super();// TODO Auto-generated constructor stub
    }public List<String> getRundomKeys() {return rundomKeys;}public void setRundomKeys(List<String> rundomKeys) {this.rundomKeys = rundomKeys;}public PwdKeyDto(List<String> rundomKeys, Map<String, String> valueKeyMaps,Map<String, String> imgKeyMaps) {super();this.rundomKeys = rundomKeys;this.valueKeyMaps = valueKeyMaps;this.imgKeyMaps = imgKeyMaps;}public Map<String, String> getValueKeyMaps() {return valueKeyMaps;}public void setValueKeyMaps(Map<String, String> valueKeyMaps) {this.valueKeyMaps = valueKeyMaps;}public Map<String, String> getImgKeyMaps() {return imgKeyMaps;}public void setImgKeyMaps(Map<String, String> imgKeyMaps) {this.imgKeyMaps = imgKeyMaps;}}

3.后台Action

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.sanwing.spi.model.PwdKeyDto;
import com.sanwing.spi.utils.PwdKeyUtils;@Controller
@RequestMapping("/h5Pay")
public class H5Pay {private static final Logger logger = Logger.getLogger(H5Pay.class);@RequestMapping("/jumpH5Pay")public String jumpH5Pay(HttpServletRequest request,HttpServletResponse response){    return "/h5Pay";}/*** * @Description: 获取密码键盘* @param request* @param rangdom 随机字符串* @return* */@SuppressWarnings("unchecked")@ResponseBody@RequestMapping(value = "/pkey", method = RequestMethod.POST)public Object digitkeyboard(HttpServletRequest request, String rangdom) {try {if (isBlank(rangdom)) {return "";}PwdKeyDto pwdkey = PwdKeyUtils.digitkeyboard();HttpSession session = request.getSession();session.setAttribute("pwdkey_" + rangdom, pwdkey);/*redisUtil.set("pwdkey_" + rangdom, pwdkey,redisUtil.getDigitkeyimeOut());*/return pwdkey.getRundomKeys();} catch (Exception e) {logger.error("[获取密码键盘digitkeyboard][error:{}",e);}return "";}/*** 获取key图片* * @throws Exception*/@RequestMapping(value = "/getKey", method = RequestMethod.GET)public void getKey(String key, String rangdom, HttpServletRequest request,HttpServletResponse response) throws Exception {HttpSession session = request.getSession();PwdKeyDto pwdkey = (PwdKeyDto) session.getAttribute("pwdkey_" + rangdom);if (pwdkey == null || pwdkey.getImgKeyMaps() == null) {logger.error("获取图片[getKey]:未获取到对应的键盘的映射关系");throw new Exception();}Map<String, String> imagekeys = pwdkey.getImgKeyMaps();String path = imagekeys.get(key);String rootPath = request.getSession().getServletContext().getRealPath("/");path = rootPath + path;if (path != null && path.length() != 0) {try {InputStream fis = new FileInputStream(new File(path));BufferedInputStream bis = new BufferedInputStream(fis);OutputStream fos = response.getOutputStream();BufferedOutputStream bos = new BufferedOutputStream(fos);String fileName = "image.";String[] strs = path.split("\\.");fileName = fileName + strs[strs.length - 1];setFileDownloadHeader(request, response, fileName);int byteRead = 0;byte[] buffer = new byte[8192];while ((byteRead = bis.read(buffer, 0, 8192)) != -1) {bos.write(buffer, 0, byteRead);}bos.flush();fis.close();bis.close();fos.close();bos.close();} catch (Exception e) {logger.error("获取图片[path:" + path + "])失败:" + e.toString(), e);}}}/*** * @Description: 支付* @param pin 交易密码密文* @param random 随机码* @return* */@ResponseBody@RequestMapping(value = "/pay", method = RequestMethod.POST)public String pay(String pin,String random, HttpServletRequest request) {try {logger.info("[支付(pay)][params:pin=" + pin + ",random="+random+"]");if (!isBlank(pin)) {StringBuffer sb = new StringBuffer("");//PwdKeyDto pwdkey = (PwdKeyDto) redisUtil.get("pwdkey_" + random);HttpSession session = request.getSession();PwdKeyDto pwdkey = (PwdKeyDto) session.getAttribute("pwdkey_" + random);if (pwdkey == null || pwdkey.getValueKeyMaps() == null) {return "密码键盘已失效,请重新输入密码";}Map<String, String> valuekeys = pwdkey.getValueKeyMaps();String[] pins = pin.split(",");if (pins.length != 6) {return "交易密码位数不对";}for (String pinKey : pins) {String val = valuekeys.get(pinKey);if (isBlank(val)) {return "密码键盘已失效,请重新输入密码";}sb.append(val);}//sb.toString()就是明文交易密码
                System.out.println(sb.toString());}return "成功";} catch (Exception e) {logger.error("[支付(pay)][error:{}]",e);return "支付异常,请重试!";}}public static void setFileDownloadHeader(HttpServletRequest request,HttpServletResponse response, String fileName) {try {String encodedfileName = null;String agent = request.getHeader("USER-AGENT");if(null != agent && -1 != agent.indexOf("MSIE")){//IEencodedfileName = java.net.URLEncoder.encode(fileName,"UTF-8");}else if(null != agent && -1 != agent.indexOf("Mozilla")){encodedfileName = new String (fileName.getBytes("UTF-8"),"iso-8859-1");}else{encodedfileName = java.net.URLEncoder.encode(fileName,"UTF-8");}response.setHeader("Content-Disposition", "attachment; filename=\"" + encodedfileName + "\"");} catch (UnsupportedEncodingException e) {e.printStackTrace();}}public static boolean isBlank(final CharSequence cs) {int strLen;if (cs == null || (strLen = cs.length()) == 0) {return true;}for (int i = 0; i < strLen; i++) {if (Character.isWhitespace(cs.charAt(i)) == false) {return false;}}return true;}
}

4.密码键盘工具类

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;import javax.servlet.http.HttpServletRequest;import com.sanwing.spi.model.PwdKeyDto;public class PwdKeyUtils {private final static Map<String, String> imagesValueMap;/*** * @Description: 获取密码键盘映射关系* @param imagesValueMap* @return* */static {imagesValueMap = new HashMap<String, String>();imagesValueMap.put("0","/media/image/keys/0.png");imagesValueMap.put("1","/media/image/keys/1.png");imagesValueMap.put("2","/media/image/keys/2.png");imagesValueMap.put("3","/media/image/keys/3.png");imagesValueMap.put("4","/media/image/keys/4.png");imagesValueMap.put("5","/media/image/keys/5.png");imagesValueMap.put("6","/media/image/keys/6.png");imagesValueMap.put("7","/media/image/keys/7.png");imagesValueMap.put("8","/media/image/keys/8.png");imagesValueMap.put("9","/media/image/keys/9.png");}public static PwdKeyDto digitkeyboard() {List<String> rundomKeys = new ArrayList<String>();// 随机key映射Map<String, String> valueKeys = new HashMap<String, String>();// 密文和明文映射Map<String, String> imgKeyMaps = new HashMap<String, String>();// 密文和图片映射List<String> keys = new ArrayList<String>();for (int i = 0; i < 10; i++) {keys.add(i + "");}for (int i = 0; i < 10; i++) {Random r = new Random();int index = r.nextInt(keys.size());String key = keys.get(index);keys.remove(index);String randomkey = randomKey(24);rundomKeys.add(randomkey);valueKeys.put(randomkey, key);imgKeyMaps.put(randomkey, imagesValueMap.get(key));}PwdKeyDto dto = new PwdKeyDto(rundomKeys, valueKeys, imgKeyMaps);return dto;}/*** * @Description:获取动态key* @param num*            key位数* @return* */public static String randomKey(int num) {StringBuffer sb = new StringBuffer("");char[] chars = { '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', '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' };for (int i = 0; i < num; i++) {int id = (int) Math.ceil(Math.random() * 60);sb.append(chars[id]);}return sb.toString();}/*** * @Description:解密pin* @param request* @param pin* @return* */public static String decryptPinData(HttpServletRequest request,String ciphertextpin) throws Exception {if (!isBlank(ciphertextpin)) {Map<String, String> valuekeys = (Map<String, String>) request.getSession().getAttribute("valuekeys");if (valuekeys == null || valuekeys.size() != 10) {throw new Exception();}String[] ciphertextpins = ciphertextpin.split(",");StringBuffer sb = new StringBuffer("");for (String ctpin : ciphertextpins) {sb.append(valuekeys.get(ctpin));}}return null;}public static boolean isBlank(final CharSequence cs) {int strLen;if (cs == null || (strLen = cs.length()) == 0) {return true;}for (int i = 0; i < strLen; i++) {if (Character.isWhitespace(cs.charAt(i)) == false) {return false;}}return true;}
}

最后,还有扣下来的按键图片。

 

posted on 2018-11-26 17:05 米德 阅读(...) 评论(...) 编辑 收藏

转载于:https://www.cnblogs.com/mide0131/p/10021441.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/248941.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

expressjs路由和Nodejs服务器端发送REST请求 - - ITeye博客

Nodejs创建自己的server后&#xff0c;我们如果需要从客户端利用ajax调用别的服务器端的数据API的接口&#xff0c;这时候出现了ajax跨域问题。 一种是利用在客户端解决跨域问题 这种方案大家可以去网上查查 另一种方案是在服务器端去请求别的服务器&#xff0c;然后将数据再…

Jmeter操作mysql数据库测试

1. 选中线程组鼠标点击右键添加-->配置元件-->JDBC Connection Configuration&#xff1b; 2. DataBase Connection Configuration配置 Variable Name&#xff1a;配置元件的的所有配置所保存的变量&#xff0c;自定义变量名称(不能使用mysql作为变量名&#xff0c;多个…

前端“智能”静态资源管理 - Onebox - 博客园

前端“智能”静态资源管理 模块化/组件化开发&#xff0c;仅仅描述了一种开发理念&#xff0c;也可以认为是一种开发规范&#xff0c;倘若你认可这规范&#xff0c;对它的分治策略产生了共鸣&#xff0c;那我们就可以继续聊聊它的具体实现了。 很明显&#xff0c;模块化/组件化…

我们是如何做好前端工程化和静态资源管理 - 無雄 - 博客园

我们是如何做好前端工程化和静态资源管理 随着互联网的发展&#xff0c;我们的业务也日益变得更加复杂且多样化起来&#xff0c;前端工程师也不再只是做简单的页面开发这么简单&#xff0c;我们需要面对的十分复杂的系统性问题&#xff0c;例如&#xff0c;业务愈来愈复杂&…

峰度(Kurtosis)和偏度(Skewness)

峰度&#xff08;Kurtosis&#xff09; 定义峰度又称峰态系数&#xff0c;表征概率密度分布曲线在平均值处峰值高低的特征数&#xff0c;即是描述总体中所有取值分布形态陡缓程度的统计量。直观看来&#xff0c;峰度反映了峰部的尖度。这个统计量需要与正态分布相比较。 公式定…

多功能嵌入式解码软件(2)

多功能嵌入式解码软件&#xff08;2&#xff09; 验证类库 通信协议 下面进行一个示例&#xff1a; 下位机需要向上位机发送3中数据帧&#xff0c;数据帧以功能码来识别&#xff0c;每种数据帧的协议如下3个表格所示&#xff0c;上位机需要把这些数据按照协议解码出来&#xff…

vue项目如何打包扔向服务器 - Hi-Sen - 博客园

当我们将 vue 项目完成后&#xff0c;面临的就是如何将项目进行打包上线&#xff0c;放到服务器中。我使用的是 vue-cli&#xff08;simple&#xff09; 脚手架&#xff0c;所以就讲一下如何将项目进行打包&#xff0c;并放到 tomcat 上。 如果是 vue-cli (非 simple 脚手架…

MySQL备份与恢复-mysqldump备份与恢复

这片博文主要用来介绍MySQL的备份与恢复&#xff1a; MySQL的备份形式可以分为如下几种&#xff1a; 热备----即不停机备份冷备----需要关闭MySQL&#xff0c;然后备份其数据文件。&#xff08;停机备份一般是直接拷贝其datadir目录&#xff09;温备----在线备份&#xff0c;对…

第六次实训作业异常处理

第六次实训作业异常处理 编写一个类ExceptionTest&#xff0c;在main方法中使用try-catch-finally语句结构实现&#xff1a;在try语句块中&#xff0c;编写两个数相除操作&#xff0c;相除的两个操作数要求程序运行时用户输入&#xff1b;在catch语句块中&#xff0c;捕获被0除…

k8s学习笔记-调度之Affinity

Kubernetes中的调度策略可以大致分为两种 一种是全局的调度策略&#xff0c;要在启动调度器时配置&#xff0c;包括kubernetes调度器自带的各种predicates和priorities算法&#xff0c;具体可以参看上一篇文章&#xff1b; 另一种是运行时调度策略&#xff0c;包括nodeAffinity…

MapReduce编程实践

一、MapReduce编程思想 学些MapRedcue主要是学习它的编程思想&#xff0c;在MR的编程模型中&#xff0c;主要思想是把对数据的运算流程分成map和reduce两个阶段&#xff1a; Map阶段&#xff1a;读取原始数据&#xff0c;形成key-value数据&#xff08;map方法&#xff09;。即…

webpack基础+webpack配置文件常用配置项介绍+webpack-dev-server - QxQstar - 博客园

一.webpack基础 1.在项目中生成package.json&#xff1a;在项目根目录中输入npm init&#xff0c;根据提示输入相应信息。&#xff08;也可以不生成package.json文件&#xff0c;但是package.json是很有用的&#xff0c;所有建议生成&#xff09; 2.安装webpaack a.在全局中安装…

编译原理--NFA/DFA

现成的, 讲义: https://www.cnblogs.com/AndyEvans/p/10240790.html https://www.cnblogs.com/AndyEvans/p/10241031.html 一个例子, 写得非常好. 一下子就全明白了, 尤其是像我这种没有听过编译原理课程的人. https://blog.csdn.net/tyler_download/article/details/53139240 …

OpenLayers3关于Map Export的Canvas跨域

一 Canvas跨域现象 地图导出是地图中常用的功能&#xff0c;并且OpenLayers3中也提供了两个地图导出的例子:http://openlayers.org/en/latest/examples/export-map.html http://openlayers.org/en/latest/examples/export-pdf.html。 看到这两个例子我们都很兴奋&#xff0c;直…

typescript-koa-postgresql 实现一个简单的rest风格服务器 —— 连接 postgresql 数据库...

接上一篇&#xff0c;这里使用 sequelize 来连接 postgresql 数据库 1、安装 sequelize&#xff0c;数据库驱动 pg yarn add sequelize sequelize-typescript pg reflect-metadata 2、新建配置文件夹 conf 及 配置文件 db.conf.ts /*** name: 数据库配置* param : undefined* r…

SmartGit使用教程

说明 官网的客户端是命令行形式的&#xff0c;有兴趣可以去了解下。这里针对图形界面的smartgit做一个使用说明。 软件下载和安装 下载地址[2016.12.16测试可以] 按需选择,如果不知道自己电脑是什么系统的&#xff0c;那我没话说了https://www.syntevo.com/smartgit/ 安装 …

jquery 下拉框 select2 运用 笔记

1,添加select2 样式 参考&#xff08;https://select2.org/ &#xff09; 2,Html: <select id"txtType" name"Type" class"form-control select2" multiple"multiple"> </select> 3,jquery section scripts{ $(documen…

获取浏览器屏幕高度(js,jq) - 进击的小牛牛 - 博客园

javascript IE中&#xff1a; document.body.clientWidth > BODY对象宽度 document.body.clientHeight > BODY对象高度 document.documentElement.clientWidth > 可见区域宽度 document.documentElement.clientHeight > 可见区域高度 FireFox中&#xff1a; docum…

第一个爬虫和测试

Python测试函数的方法之一是用&#xff1a;try……except def gameover(a,b):if a>10 and b>10 and abs(a-b)2:return Trueif (a>11 and b<11) or (a<11 and b>11):return Truereturn False try:agameover(10,11)print(a) except:print("Error") g…

JS组件系列——Bootstrap 树控件使用经验分享 - 懒得安分 - 博客园

前言&#xff1a;很多时候我们在项目中需要用到树&#xff0c;有些树仅仅是展示层级关系&#xff0c;有些树是为了展示和编辑层级关系&#xff0c;还有些树是为了选中项然后其他地方调用选中项。不管怎么样&#xff0c;树控件都是很多项目里面不可或缺的组件之一。今天&#xf…