king
2022-02-09 d59f518f466274b2caeb2e01c10c92deafe7c93b
src/menu/components/share/usercomponent/index.jsx
@@ -1,7 +1,8 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Icon, Modal, notification } from 'antd'
import { Modal, notification } from 'antd'
import { UserOutlined } from '@ant-design/icons'
import html2canvas from 'html2canvas'
import Api from '@/api'
@@ -13,10 +14,9 @@
import MKEmitter from '@/utils/events.js'
import './index.scss'
class DataSource extends Component {
class UserComponent extends Component {
  static propTpyes = {
    btnlog: PropTypes.array,
    handlelog: PropTypes.func
    btnlog: PropTypes.array
  }
  state = {
@@ -146,7 +146,8 @@
      document.getElementsByClassName('menu-view')[0].classList.add('saving')
      this.setState({loading: true})
      setTimeout(() => {
        let template = this.getUserComponent()
        // let template = this.getUserComponent()
        let template = fromJS(config).toJS()
        html2canvas(document.getElementById(config.uuid)).then(canvas => {
          let param = {
            Base64Img: canvas.toDataURL('image/png') // 获取生成的图片
@@ -164,6 +165,7 @@
                func: 's_custom_components_adduptdel',
                c_id: config.uuid,
                images: Utils.getcloudurl(result.Images),
                typename: sessionStorage.getItem('appType') || '',
                c_name: res.name,
                long_param: window.btoa(window.encodeURIComponent(JSON.stringify(template))),
                del_type: ''
@@ -210,7 +212,7 @@
    return (
      <div className="user-component-wrap">
        <Icon type="user" title="生成自定义组件" onClick={this.trigger} />
        <UserOutlined title="生成自定义组件" onClick={this.trigger} />
        <Modal
          title="自定义组件"
          visible={visible}
@@ -228,4 +230,4 @@
  }
}
export default DataSource
export default UserComponent