| | |
| | | import { DndProvider } from 'react-dnd' |
| | | import { is, fromJS } from 'immutable' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { Card, notification, Row, Button, Modal, Input, Icon } from 'antd' |
| | | import { Card, notification, Row, Button, Modal, Input, Icon, Switch } from 'antd' |
| | | import DragElement from './dragelement' |
| | | import MutilForm from './mutilform' |
| | | import SourceElement from './dragelement/source' |
| | |
| | | upPlus: 1, |
| | | upMinus: 1, |
| | | leftPlus: 1, |
| | | leftMinus: 1 |
| | | leftMinus: 1, |
| | | debug: false |
| | | } |
| | | |
| | | getclickpoint = (e) => { |
| | |
| | | } |
| | | |
| | | resetbox = () => { |
| | | const { config } = this.state |
| | | const { config, debug } = this.state |
| | | |
| | | let ratio = (config.height || 1) / (config.width || 1) |
| | | |
| | | document.getElementById('darea').style.height = parseInt(document.getElementById('darea').style.width) * ratio + 'px' |
| | | |
| | | printCtrl.sketch(config, null) |
| | | printCtrl.sketch(config, null, debug) |
| | | } |
| | | |
| | | resetview () { |
| | | const { config, editItemId } = this.state |
| | | const { config, editItemId, debug } = this.state |
| | | |
| | | printCtrl.sketch(config, editItemId) |
| | | printCtrl.sketch(config, editItemId, debug) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | new Promise(resolve => { |
| | | printCtrl.sketch(config, null).then(res => { |
| | | printCtrl.sketch(config, null, false).then(res => { |
| | | let param = { |
| | | Base64Img: res |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | changeDebug = (val) => { |
| | | this.setState({ |
| | | debug: val |
| | | }, () => { |
| | | this.resetview() |
| | | }) |
| | | } |
| | | |
| | | render () { |
| | | return ( |
| | | <div className="print-template"> |
| | |
| | | <Input addonBefore={<Icon title="距上" type="arrow-up" />} addonAfter={<Icon onClick={() => this.updatePosition('upMinus')} type="minus" />} onChange={(e) => this.change(e, 'upMinus')} value={this.state.upMinus} /> |
| | | <Input addonBefore={<Icon title="距左" type="arrow-left" />} addonAfter={<Icon onClick={() => this.updatePosition('leftPlus')} type="plus" />} onChange={(e) => this.change(e, 'leftPlus')} value={this.state.leftPlus} /> |
| | | <Input addonBefore={<Icon title="距左" type="arrow-left" />} addonAfter={<Icon onClick={() => this.updatePosition('leftMinus')} type="minus" />} onChange={(e) => this.change(e, 'leftMinus')} value={this.state.leftMinus} /> |
| | | <div style={{marginTop: '10px'}}> |
| | | <span>调试模式:</span><Switch onChange={this.changeDebug} /> |
| | | </div> |
| | | </Card> |
| | | </aside> |
| | | <div className="switchbox" onClick={this.switchbox}></div> |