SOURCE

console 命令行工具 X clear

                    
>
console
!function(){
	"use strict";
	

	let getObjectURL = function(file){
	    let url = null ; 
	    if (window.createObjectURL!=undefined) { // basic
	        url = window.createObjectURL(file) ;
	    } else if (window.URL!=undefined) { // mozilla(firefox)
	        url = window.URL.createObjectURL(file) ;
	    } else if (window.webkitURL!=undefined) { // webkit or chrome
	        url = window.webkitURL.createObjectURL(file) ;
	    }
	    return url ;
	}
	
	
	window.analyticCode = {
		getUrl : function(type,elem,fn){
			let url = null,src = null;
			
			if(type === 'img-url'){
				url = elem.src;
			}else if(type === 'file-url' && elem.files.length > 0){
				url = getObjectURL(elem.files[0]);
			}
			qrcode.decode(url);
			qrcode.callback = function(imgMsg){
				fn(imgMsg,url);
			}
		}
	}
}()
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>识别二维码</title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<style type="text/css">
			body{margin: 0;}
			.module-content{
				min-width: 770px;
				max-width: 1000px;
				width: 100%;
				color: #000;
				margin: 0 auto;
			}
			.module-head{
				text-align: center;
				font-weight: 500;
				margin: 0;
				font-size: 30px;
				height: 100px;
				line-height: 100px;
				color: #000;
			}
			.box h3{
				font-weight: 300;
				margin: 0;
				font-size: 20px;
				height: 60px;
				line-height: 60px;
				color: #000;
			}
			.url-box{
				height: 30px;
				line-height: 30px;
				font-size: 14px;
			}
			#file{
				position: absolute;
				width: 120px;
				height: 120px;
				opacity: 0;
				top: 0;
				left: 0;
				overflow: hidden;
				z-index: 10;
			}
		</style>
</head>
<body>
<div class="module-content">
<h1 class="module-head">解析二维码</h1>
<div class="box">
<h3>长按二维码解析</h3>
<img onClick="getUrl(this,'img-url')" src="img/2.png"/>
<p class="url-box" id="urlBox"></p>
</div>
<div class="box">
<h3>上传二维码解析</h3>
<div style="position: relative;">
<img style="width: 120px;height: 120px;" src="img/analyticCode.png"/>
<input type="file" onChange="getUrl(this,'file-url')" name="" id="file" value="" />
<p class="url-box" id="urlBox"></p>
</div>
</div>
</div>
<script src="js/llqrcode.js" type="text/javascript" charset="utf-8"></script>
<!--script src="js/analyticCode.js" type="text/javascript" charset="utf-8"></script-->
<script type="text/javascript">
			function getUrl(e,param){
				analyticCode.getUrl(param,e,function(url1,url2){
					e.nextElementSibling.innerHTML = url1;
					e.previousElementSibling.src = url2;
				});
			}
		</script>
</body>
</html>

本项目引用的自定义外部资源