[Params adjustment]
This commit is contained in:
parent
fdf1f1c0a0
commit
58535095e5
|
@ -13,6 +13,10 @@ class QrItem extends React.Component {
|
|||
this.handleClick = this.handleClick.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.forceUpdate()
|
||||
}
|
||||
|
||||
handleClick(e) {
|
||||
this.props.onSelected(this.props.index);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ function listPoint(props) {
|
|||
const qrcode = props.qrcode;
|
||||
const nCount = qrcode.getModuleCount();
|
||||
const pointList = new Array(nCount);
|
||||
const params = props.getParamValue();
|
||||
const params = props.params;
|
||||
|
||||
let id = 0;
|
||||
for (let row = 0; row < nCount; row++) {
|
||||
|
@ -33,21 +33,23 @@ function calViewBox(props) {
|
|||
class QrRendererBase extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.props.setParamInfo([
|
||||
{
|
||||
key: '大小',
|
||||
default: 1
|
||||
},
|
||||
{
|
||||
key: '定位点样式',
|
||||
default: 0,
|
||||
choices: [
|
||||
"矩形",
|
||||
"圆形"
|
||||
]
|
||||
}
|
||||
]
|
||||
);
|
||||
if (this.props.setParamInfo) {
|
||||
this.props.setParamInfo([
|
||||
{
|
||||
key: '大小',
|
||||
default: 1
|
||||
},
|
||||
{
|
||||
key: '定位点样式',
|
||||
default: 0,
|
||||
choices: [
|
||||
"矩形",
|
||||
"圆形"
|
||||
]
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -50,25 +50,27 @@ function calViewBox(props) {
|
|||
class QrRendererRound extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.props.setParamInfo([
|
||||
{
|
||||
key: '没有choices的文本框1',
|
||||
default: 1
|
||||
},
|
||||
{
|
||||
key: '没有choices的文本框2',
|
||||
default: 100
|
||||
},
|
||||
{
|
||||
key: '有choices的选择框',
|
||||
default: 0,
|
||||
choices: [
|
||||
"option1",
|
||||
"option2"
|
||||
]
|
||||
}
|
||||
]
|
||||
);
|
||||
if (this.props.setParamInfo) {
|
||||
this.props.setParamInfo([
|
||||
{
|
||||
key: '没有choices的文本框1',
|
||||
default: 1
|
||||
},
|
||||
{
|
||||
key: '没有choices的文本框2',
|
||||
default: 100
|
||||
},
|
||||
{
|
||||
key: '有choices的选择框',
|
||||
default: 0,
|
||||
choices: [
|
||||
"option1",
|
||||
"option2"
|
||||
]
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -53,9 +53,14 @@ class Qrcode extends React.Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.setState({paramInfo: this.paramInfoBuffer, paramValue: this.paramValueBuffer}, () => {
|
||||
this.handleCreate();
|
||||
})
|
||||
const text = 'https://qrbtf.com/';
|
||||
this.setState({
|
||||
paramInfo: this.paramInfoBuffer,
|
||||
paramValue: this.paramValueBuffer,
|
||||
text: text,
|
||||
options: {text: text},
|
||||
qrcode: getQrcodeData({text: text})
|
||||
});
|
||||
}
|
||||
|
||||
setParamInfo(index) {
|
||||
|
@ -95,13 +100,13 @@ class Qrcode extends React.Component {
|
|||
|
||||
downloadSvg(e) {
|
||||
const style = styleList[this.state.selectedIndex]
|
||||
const el = React.createElement(style.renderer, {qrcode: this.state.qrcode})
|
||||
const el = React.createElement(style.renderer, {qrcode: this.state.qrcode, params: this.state.paramValue[this.state.selectedIndex]})
|
||||
saveSvg(style.value, ReactDOMServer.renderToString(el))
|
||||
}
|
||||
|
||||
downloadImg(e) {
|
||||
const style = styleList[this.state.selectedIndex]
|
||||
const el = React.createElement(style.renderer, {qrcode: this.state.qrcode})
|
||||
const el = React.createElement(style.renderer, {qrcode: this.state.qrcode, params: this.state.paramValue[this.state.selectedIndex]})
|
||||
saveImg(style.value, ReactDOMServer.renderToString(el), 1500, 1500)
|
||||
}
|
||||
|
||||
|
@ -152,6 +157,7 @@ class Qrcode extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
console.log(1)
|
||||
return (
|
||||
<div>
|
||||
<div className="Qr-Centered">
|
||||
|
@ -181,7 +187,7 @@ class Qrcode extends React.Component {
|
|||
qrcode={this.state.qrcode}
|
||||
renderer={React.createElement(style.renderer, {
|
||||
qrcode: this.state.qrcode,
|
||||
getParamValue: this.getParamValue(index),
|
||||
params: this.state.paramValue[index],
|
||||
setParamInfo: this.setParamInfo(index)
|
||||
})}
|
||||
text={this.state.text}
|
||||
|
|
Loading…
Reference in New Issue