From 29432c9167e3fcdf83f35d0bb9dbe9acb7c7ffbf Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 22 六月 2021 14:35:23 +0800
Subject: [PATCH] 2021-06-22

---
 src/templates/modalconfig/checkCard/index.jsx |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/templates/modalconfig/checkCard/index.jsx b/src/templates/modalconfig/checkCard/index.jsx
index 63c3164..60a6e3e 100644
--- a/src/templates/modalconfig/checkCard/index.jsx
+++ b/src/templates/modalconfig/checkCard/index.jsx
@@ -6,19 +6,14 @@
 
 class CheckCard extends Component {
   static propTpyes = {
-    multiple: PropTypes.bool,    // 鏄惁鍙閫�
-    ratio: PropTypes.string,     // 鍥剧墖姣斾緥
-    width: PropTypes.number,     // 瀹藉害
-    display: PropTypes.string,   // 鏄剧ず涓猴細text锛堟枃鏈級銆乸icture锛堝浘鐗囷級
-    fields: PropTypes.array,     // 瀛楁闆�
-    options: PropTypes.array,    // 鏁版嵁鍒楄〃
+    config: PropTypes.object,    // 琛ㄥ崟閰嶇疆淇℃伅
     onChange: PropTypes.func,    // 鏁版嵁鍒囨崲
   }
 
   state = {}
 
   getCards = () => {
-    const { display, width, options, fields, ratio } = this.props
+    const { display, width, options, fields, ratio, backgroundColor, borderColor } = this.props.config
 
     let paddingTop = '100%'
     if (ratio === '4:3') {
@@ -29,10 +24,19 @@
       paddingTop = '56.25%'
     }
 
+    let style = {}
+    
+    if (borderColor) {
+      style.borderColor = borderColor
+    }
+
     if (display !== 'picture') {
+      if (backgroundColor) {
+        style.backgroundColor = backgroundColor
+      }
       if (!options || options.length === 0) {
         return <Col span={width}>
-          <div className="card-cell">
+          <div className="card-cell" style={style}>
             {fields ? fields.map(col => {
               return <span key={col.key} style={{color: col.color, fontSize: col.fontSize + 'px', height: col.fontSize * 1.5 + 'px', textAlign: col.align}}>{col.field}</span>
             }) : null}
@@ -42,7 +46,7 @@
       }
       return options.map(item => {
         return <Col span={width} key={item.key}>
-          <div className="card-cell">
+          <div className="card-cell" style={style}>
             {fields.map(col => {
               return <span key={col.key} style={{color: col.color, fontSize: col.fontSize + 'px', height: col.fontSize * 1.5 + 'px', textAlign: col.align}}>{item[col.field]}</span>
             })}
@@ -52,13 +56,13 @@
     } else {
       if (!options || options.length === 0) {
         return <Col span={width}>
-          <div className="card-pic-cell" style={{paddingTop, background: '#91d5ff'}}>
+          <div className="card-pic-cell" style={{...style, paddingTop, background: '#91d5ff'}}>
           </div>
         </Col>
       }
       return options.map(item => {
         return <Col span={width} key={item.key}>
-          <div className="card-pic-cell" style={{paddingTop, backgroundImage: `url(${item.$url})`}}>
+          <div className="card-pic-cell" style={{...style, paddingTop, backgroundImage: `url(${item.$url})`}}>
           </div>
         </Col>
       })

--
Gitblit v1.8.0