king
2020-03-10 c39ea1f23d21b070188abcf5f4dd5bdd7b47c1f9
src/views/printTemplate/index.jsx
@@ -47,10 +47,11 @@
    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 {
@@ -104,10 +105,11 @@
          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 {
@@ -298,7 +300,14 @@
    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) {
@@ -306,8 +315,6 @@
    } else if (document.body.offsetWidth < 1920) {
      document.getElementById('darea').style.width = '800px'
    }
    this.loadconfig()
  }
  resetbox = () => {
@@ -381,6 +388,18 @@
        duration: 10
      })
    }
  }
  switchbox = () => {
    const { config } = this.state
    this.setState({
      editItemId: config.uuid,
      editItemType: config.type,
      formlist: getpageform(config)
    }, () => {
      this.resetview()
    })
  }
  /**
@@ -658,22 +677,21 @@
          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 => {
@@ -710,6 +728,7 @@
              })}
            </Card>
          </aside>
          <div className="switchbox" onClick={this.switchbox}></div>
          <DragElement dropcard={this.dropcard} />
          <aside className="setting">
            {this.state.editItemId ?