king
2021-04-06 f71bb7d6a8907b9219f39361725e94c28259bd61
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
 
import asyncComponent from '@/utils/asyncComponent'
 
import './index.scss'
 
const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList'))
 
class CardBoxComponent extends Component {
  static propTpyes = {
    cards: PropTypes.object,    // 卡片行配置信息
    card: PropTypes.object,     // 卡片配置信息
    data: PropTypes.object,
  }
 
  state = {
    card: null,            // 卡片信息,包括正反面
  }
 
  /**
   * @description 搜索条件初始化
   */
  UNSAFE_componentWillMount () {
 
  }
 
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.state), fromJS(nextState)) || !is(fromJS(this.props), fromJS(nextProps))
  }
 
  /**
   * @description 组件销毁,清除state更新,清除快捷键设置
   */
  componentWillUnmount () {
    this.setState = () => {
      return
    }
  }
 
  render() {
    const { card, data, cards } = this.props
 
    return (
      <div className="card-item-box" style={card.style}>
        <CardCellComponent data={data} cards={cards} cardCell={card} elements={card.elements}/>
      </div>
    )
  }
}
 
export default CardBoxComponent