| | |
| | | let scrollTop = document.documentElement.scrollTop || document.body.scrollTop |
| | | let screenX = e.clientX |
| | | let screenY = e.clientY + scrollTop |
| | | let offsetT = screenY - document.getElementById('darea').offsetTop |
| | | let offsetL = screenX - document.getElementById('darea').offsetLeft |
| | | |
| | | let cx = Math.floor(offsetL / parseInt(document.getElementById('darea').style.width) * config.width) |
| | | let offsetT = screenY - 75 |
| | | let _width = parseInt(document.getElementById('darea').style.width) |
| | | let offsetL = screenX - (document.body.offsetWidth - _width - 30) / 2 |
| | | |
| | | let cx = Math.floor(offsetL / _width * config.width) |
| | | let cy = Math.floor(offsetT / parseInt(document.getElementById('darea').style.height) * config.height) |
| | | |
| | | return { |
| | |
| | | y -= 4 |
| | | height = 8 |
| | | } |
| | | if (cx > x && cx < x + width && cy > y && cy < y + height) { |
| | | if (cx >= x && cx <= x + width && cy >= y && cy <= y + height) { |
| | | _selectItem = element |
| | | } |
| | | }) |
| | | |
| | | if (!_selectItem) { |
| | | _selectItem = _config |
| | | } else { |
| | |
| | | document.getElementById('darea').addEventListener('drop', (e) => { |
| | | dropPoint = this.getclickpoint(e) |
| | | }) |
| | | |
| | | this.handleResize() |
| | | window.addEventListener('resize', this.handleResize) |
| | | |
| | | this.loadconfig() |
| | | } |
| | | |
| | | handleResize = () => { |
| | | if (document.body.offsetWidth < 1360) { |
| | | document.getElementById('darea').style.width = '600px' |
| | | } else if (document.body.offsetWidth < 1500) { |
| | |
| | | } else if (document.body.offsetWidth < 1920) { |
| | | document.getElementById('darea').style.width = '800px' |
| | | } |
| | | |
| | | this.loadconfig() |
| | | } |
| | | |
| | | resetbox = () => { |
| | |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | switchbox = () => { |
| | | const { config } = this.state |
| | | |
| | | this.setState({ |
| | | editItemId: config.uuid, |
| | | editItemType: config.type, |
| | | formlist: getpageform(config) |
| | | }, () => { |
| | | this.resetview() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | if (result.status) { |
| | | resolve(Utils.getcloudurl(result.Images)) |
| | | } else { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: result.ErrMesg, |
| | | // duration: 10 |
| | | // }) |
| | | // this.setState({ |
| | | // saveloading: false |
| | | // }) |
| | | // resolve(false) |
| | | resolve(true) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.ErrMesg, |
| | | duration: 10 |
| | | }) |
| | | this.setState({ |
| | | saveloading: false |
| | | }) |
| | | resolve(false) |
| | | } |
| | | }) |
| | | }) |
| | | }).then(res => { |
| | | if (!res) return |
| | | param.Images = 'http://css.positecgroup.com/Content/Upload/2020-01-08/2020010810525808769824_U000000001.png' |
| | | param.Images = res |
| | | |
| | | return Api.getCloudConfig(param) |
| | | }).then(res => { |
| | |
| | | })} |
| | | </Card> |
| | | </aside> |
| | | <div className="switchbox" onClick={this.switchbox}></div> |
| | | <DragElement dropcard={this.dropcard} /> |
| | | <aside className="setting"> |
| | | {this.state.editItemId ? |