Merge branch 'master' of https://github.com/ciaochaos/qrbtf
This commit is contained in:
commit
f1a2d3d442
|
@ -0,0 +1,20 @@
|
|||
import React from "react";
|
||||
import './Qrcode.css';
|
||||
|
||||
const currentYear = new Date().getFullYear();
|
||||
|
||||
class Footer extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div className="Qr-titled">
|
||||
<div className="Qr-Centered Qr-footer note-font">
|
||||
<div><strong>作者</strong> <a href="https://blog.ciaochaos.com/" rel="noopener noreferrer" target="_blank">ciaochaos</a> <a href="https://github.com/CPunisher/" rel="noopener noreferrer" target="_blank">CPunisher</a></div>
|
||||
<div className="Gray">Copyright © {currentYear} QRBTF. 保留所有权利。</div>
|
||||
<div className="Gray"><a href="http://www.beian.miit.gov.cn/" rel="noopener noreferrer" target="_blank">浙 ICP 备 19005869 号 </a></div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Footer
|
|
@ -8,6 +8,7 @@ import {isWeiXin} from "../utils/util";
|
|||
import './Qrcode.css';
|
||||
import logo from '../qrbtf-logo.svg';
|
||||
|
||||
import Footer from "./Footer";
|
||||
import QrItem from "./QrItem";
|
||||
import QrRendererBase from "./QrRendererBase";
|
||||
import QrRendererRound from "./QrRendererRound";
|
||||
|
@ -33,7 +34,6 @@ const styleList = [
|
|||
{value: "D2", renderer: QrRendererBlank},
|
||||
];
|
||||
|
||||
const currentYear = new Date().getFullYear();
|
||||
|
||||
class Qrcode extends React.Component {
|
||||
paramInfoBuffer;
|
||||
|
@ -54,7 +54,8 @@ class Qrcode extends React.Component {
|
|||
options: {text: ''},
|
||||
qrcode: null,
|
||||
paramInfo: [],
|
||||
paramValue: []
|
||||
paramValue: [],
|
||||
correctLevel: 0
|
||||
};
|
||||
this.paramInfoBuffer = new Array(16).fill(new Array(16));
|
||||
this.paramValueBuffer = new Array(16).fill(new Array(16));
|
||||
|
@ -67,7 +68,7 @@ class Qrcode extends React.Component {
|
|||
paramValue: this.paramValueBuffer,
|
||||
text: text,
|
||||
options: {text: text},
|
||||
qrcode: getQrcodeData({text: text})
|
||||
qrcode: getQrcodeData({text: text, correctLevel: this.state.correctLevel})
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -96,13 +97,8 @@ class Qrcode extends React.Component {
|
|||
|
||||
handleCreate(e) {
|
||||
let text = this.state.text
|
||||
|
||||
if (text.length > 0)
|
||||
this.setState({options: {text: text}, qrcode: getQrcodeData({text: text})});
|
||||
else {
|
||||
text = 'https://qrbtf.com/';
|
||||
this.setState({text: text, options: {text: text}, qrcode: getQrcodeData({text: text})});
|
||||
}
|
||||
if (text.length <= 0) text = 'https://qrbtf.com/';
|
||||
this.setState({text: text, options: {text: text}, qrcode: getQrcodeData({text: text, correctLevel: this.state.correctLevel})});
|
||||
if (e) e.target.blur();
|
||||
}
|
||||
|
||||
|
@ -220,15 +216,24 @@ class Qrcode extends React.Component {
|
|||
<div className="Qr-div-table">
|
||||
<table className="Qr-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>容错率</td>
|
||||
<td>
|
||||
<select className="Qr-select">
|
||||
<option>123</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
{this.renderAdjustment()}
|
||||
<tr>
|
||||
<td>容错率</td>
|
||||
<td>
|
||||
<select
|
||||
className="Qr-select"
|
||||
value={this.state.correctLevel}
|
||||
onChange={(e) => { this.setState({correctLevel: parseInt(e.target.value)})
|
||||
this.setState({correctLevel: parseInt(e.target.value)})
|
||||
this.handleCreate()
|
||||
}}>
|
||||
<option value={1}>7%</option>
|
||||
<option value={0}>15%</option>
|
||||
<option value={3}>20%</option>
|
||||
<option value={2}>30%</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
{this.renderAdjustment()}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -267,13 +272,7 @@ class Qrcode extends React.Component {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="Qr-titled">
|
||||
<div className="Qr-Centered Qr-footer note-font">
|
||||
<div><strong>作者</strong> <a href="https://blog.ciaochaos.com/" rel="noopener noreferrer" target="_blank">ciaochaos</a> <a href="https://github.com/CPunisher/" rel="noopener noreferrer" target="_blank">CPunisher</a></div>
|
||||
<div className="Gray">Copyright © {currentYear} QRBTF. 保留所有权利。</div>
|
||||
<div className="Gray"><a href="http://www.beian.miit.gov.cn/" rel="noopener noreferrer" target="_blank">浙 ICP 备 19005869 号 </a></div>
|
||||
</div>
|
||||
</div>
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue