init
This commit is contained in:
BIN
Html-Javascript/二维码/beijin.jpg
Normal file
BIN
Html-Javascript/二维码/beijin.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 139 KiB |
101
Html-Javascript/二维码/index-jc.html
Normal file
101
Html-Javascript/二维码/index-jc.html
Normal file
@@ -0,0 +1,101 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<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>Document</title>
|
||||
|
||||
<!-- 引入资源 -->
|
||||
<script src="./js/jquery.min.js"></script>
|
||||
<script src="./js/qrcode.min.js"></script>
|
||||
|
||||
<style>
|
||||
#app {
|
||||
background-color: salmon;
|
||||
width: 220px;
|
||||
height: 220px;
|
||||
box-sizing: border-box;
|
||||
padding: 10px;
|
||||
/* position: absolute;
|
||||
bottom: 363px;
|
||||
left: 184px; */
|
||||
}
|
||||
|
||||
#qrcode {
|
||||
width: 345px;
|
||||
height: 345px;
|
||||
}
|
||||
|
||||
.bodyCode {
|
||||
width: 750px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.bodyCode img {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- <div class="bodyCode">
|
||||
<div id="app">
|
||||
<div id="qrcode"></div>
|
||||
</div>
|
||||
<img src="./beijin.jpg" alt="">
|
||||
</div> -->
|
||||
|
||||
|
||||
|
||||
<input id="text" type="text" value="wxp://f2f0dTmFHoy4ykvPLTAxFWC2Vu7bsLaQenhn8LEH590zZX0"
|
||||
style="width:80%" /><br />
|
||||
<!-- 画二维码的盒子 -->
|
||||
<div id="app">
|
||||
<div id="qrcode"></div>
|
||||
<img id="logo"
|
||||
src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fa.zdmimg.com%2F201604%2F22%2F57197db54326d2842.png_a200.jpg&refer=http%3A%2F%2Fa.zdmimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1644069953&t=b7f77fa0903dd6245db2dcd30bdffcaa"
|
||||
style="display: none;">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
// 画二维码 的配置
|
||||
var qrcode = new QRCode(document.getElementById("qrcode"), {
|
||||
text: "wxp://f2f0dTmFHoy4ykvPLTAxFWC2Vu7bsLaQenhn8LEH590zZX0",
|
||||
width: 200,
|
||||
height: 200,
|
||||
colorDark: "#FA8072", // 二维码的颜色
|
||||
colorLight: "#ffffff", // 二维码的反色
|
||||
correctLevel: QRCode.CorrectLevel.H,
|
||||
typeNumber: -1,//计算模式
|
||||
correctLevel: 2,//二维码纠错级别
|
||||
});
|
||||
|
||||
// console.dir(QRCode);
|
||||
// 获取input内容 并生成二维码
|
||||
|
||||
// 你要再画
|
||||
// qrcode.clear(); // 清除代码
|
||||
// qrcode.makeCode("http://www.w3cschool.cc"); // 生成另外一个二维码
|
||||
|
||||
|
||||
// 实现更改 input内容 就实时跟新二维码
|
||||
let text = document.querySelector("#text");
|
||||
text.oninput = function () {
|
||||
this.value
|
||||
qrcode.clear(); // 清除代码
|
||||
qrcode.makeCode(this.value); // 生成另外一个二维码
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
129
Html-Javascript/二维码/index.html
Normal file
129
Html-Javascript/二维码/index.html
Normal file
@@ -0,0 +1,129 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<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>Document</title>
|
||||
|
||||
<!-- 引入资源 -->
|
||||
<script src="./js/jquery.min.js"></script>
|
||||
<script src="./js/qrcode.min.js"></script>
|
||||
|
||||
<style>
|
||||
#app {
|
||||
background-color: salmon;
|
||||
width: 220px;
|
||||
height: 220px;
|
||||
box-sizing: border-box;
|
||||
padding: 10px;
|
||||
/* position: absolute;
|
||||
bottom: 363px;
|
||||
left: 184px; */
|
||||
}
|
||||
|
||||
#qrcode {
|
||||
width: 345px;
|
||||
height: 345px;
|
||||
}
|
||||
|
||||
.bodyCode {
|
||||
width: 750px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.bodyCode img {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- <div class="bodyCode">
|
||||
<div id="app">
|
||||
<div id="qrcode"></div>
|
||||
</div>
|
||||
<img src="./beijin.jpg" alt="">
|
||||
</div> -->
|
||||
|
||||
|
||||
|
||||
<input id="text" type="text" value="wxp://f2f0dTmFHoy4ykvPLTAxFWC2Vu7bsLaQenhn8LEH590zZX0"
|
||||
style="width:80%" /><br />
|
||||
<!-- 画二维码的盒子 -->
|
||||
<div id="app">
|
||||
<div id="qrcode"></div>
|
||||
<img id="logo"
|
||||
src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fa.zdmimg.com%2F201604%2F22%2F57197db54326d2842.png_a200.jpg&refer=http%3A%2F%2Fa.zdmimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1644069953&t=b7f77fa0903dd6245db2dcd30bdffcaa"
|
||||
style="display: none;">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var _url = document.querySelector("#text").value;
|
||||
var qrWidth = 200;
|
||||
var qrHeight = 200;
|
||||
var logoQrWidth = qrWidth / 4;
|
||||
var logoQrHeight = qrHeight / 4;
|
||||
var qrcode = new QRCode($("#qrcode")[0], {
|
||||
render: "canvas",
|
||||
ecLevel: 'H',//识别度
|
||||
text: _url,
|
||||
width: qrWidth, //二维码的宽度
|
||||
height: qrHeight, //二维码的高度
|
||||
colorDark: "#FA8072",
|
||||
colorLight: "#ffffff",
|
||||
typeNumber: -1,//计算模式
|
||||
correctLevel: 2,//二维码纠错级别
|
||||
});
|
||||
|
||||
// 画二维码 的配置
|
||||
// var qrcode = new QRCode(document.getElementById("qrcode"), {
|
||||
// text: "wxp://f2f0dTmFHoy4ykvPLTAxFWC2Vu7bsLaQenhn8LEH590zZX0",
|
||||
// width: 385,
|
||||
// height: 385,
|
||||
// colorDark: "#000000", // 二维码的颜色
|
||||
// colorLight: "#ffffff", // 二维码的反色
|
||||
// correctLevel: QRCode.CorrectLevel.H,
|
||||
// typeNumber: -1,//计算模式
|
||||
// correctLevel: 2,//二维码纠错级别
|
||||
// });
|
||||
|
||||
// console.dir(QRCode);
|
||||
// 获取input内容 并生成二维码
|
||||
|
||||
// 你要再画
|
||||
// qrcode.clear(); // 清除代码
|
||||
// qrcode.makeCode("http://www.w3cschool.cc"); // 生成另外一个二维码
|
||||
|
||||
|
||||
// 实现更改 input内容 就实时跟新二维码
|
||||
let text = document.querySelector("#text");
|
||||
text.oninput = function () {
|
||||
this.value
|
||||
qrcode.clear(); // 清除代码
|
||||
qrcode.makeCode(this.value); // 生成另外一个二维码
|
||||
}
|
||||
|
||||
|
||||
|
||||
//二维码与logo图绘制为canvas
|
||||
$("#qrcode canvas")[0].getContext('2d').drawImage($("#logo")[0], (qrWidth - logoQrWidth) / 2, (qrHeight - logoQrHeight) / 2, logoQrWidth, logoQrHeight);
|
||||
var cover_canvas = document.getElementsByTagName('canvas')[0];
|
||||
// var img = converCanvasToImage(cover_canvas);
|
||||
// //图片放入容器
|
||||
// $('.transit_qrcode').append(img);
|
||||
// // canvas转Image
|
||||
// function converCanvasToImage(canvas) {
|
||||
// var image = new Image();
|
||||
// image.src = canvas.toDataURL("image/png");
|
||||
// return image;
|
||||
// }
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
2
Html-Javascript/二维码/js/jquery.min.js
vendored
Normal file
2
Html-Javascript/二维码/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
Html-Javascript/二维码/js/qrcode.min.js
vendored
Normal file
1
Html-Javascript/二维码/js/qrcode.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user