king
2022-03-24 26d0fa42ea8c63a87e8ef93d0915f75f46fb1f9c
src/menu/components/share/copycomponent/index.jsx
@@ -1,7 +1,8 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { fromJS } from 'immutable'
import { Icon, message } from 'antd'
import { message } from 'antd'
import { CopyOutlined } from '@ant-design/icons'
import './index.scss'
class CopyComponent extends Component {
@@ -12,14 +13,19 @@
  trigger = () => {
    const { card, type } = this.props
    let copycard = fromJS(card).toJS()
    copycard.copyType = type
    let _val = ''
    let _val = fromJS(card).toJS()
    _val.copyType = type
    try {
      _val = window.btoa(window.encodeURIComponent(JSON.stringify(copycard)))
    } catch {
      delete _val.$srcId
      let srcid = localStorage.getItem(window.location.href.split('#')[0] + 'srcId')
      if (srcid) {
        _val.$srcId = srcid
      }
      _val = window.btoa(window.encodeURIComponent(JSON.stringify(_val)))
    } catch (e) {
      message.warning('复制失败,请重试!')
      _val = ''
    }
@@ -38,7 +44,7 @@
  render () {
    return (
      <Icon type="copy" title="复制" style={{color: '#26C281'}} onClick={this.trigger} />
      <CopyOutlined title="复制" style={{color: '#26C281'}} onClick={this.trigger} />
    )
  }
}