From 28d65cf7ebfe0dd30ade6973e0634e1c8f663b63 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 28 十月 2020 16:12:20 +0800
Subject: [PATCH] 2020-10-28

---
 src/templates/sharecomponent/cardcomponent/index.jsx |   38 ++++++++++++++++++--------------------
 1 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/src/templates/sharecomponent/cardcomponent/index.jsx b/src/templates/sharecomponent/cardcomponent/index.jsx
index eb6002a..4e4dd82 100644
--- a/src/templates/sharecomponent/cardcomponent/index.jsx
+++ b/src/templates/sharecomponent/cardcomponent/index.jsx
@@ -211,7 +211,7 @@
     this.setState({
       cardcell: _cell,
       modaltype: 'avatar',
-      formlist: getCardDetailForm(_cell, _columns, 'avatar', [], card.widthType === 'ratio')
+      formlist: getCardDetailForm(_cell, _columns, 'avatar', [])
     })
   }
 
@@ -335,7 +335,16 @@
     if (card.bottom && card.bottom.actions.length > 0) {
       _width = Math.floor((100 / card.bottom.actions.length) * 10000) / 10000 + '%'
     }
-    let outclass = card.widthType === 'ratio' ? ' ant-col ant-col-' + card.cardWidth : ''
+    
+    if (card.widthType === 'absolute') {
+      card.cardWidth = 6
+    }
+    if (card.avatar && card.avatar.widthType === 'absolute') {
+      card.avatar.width = 32
+    }
+
+    let outclass = 'ant-col-' + card.cardWidth
+
     if (card.background) {
       outclass += ' background ' + card.background
     }
@@ -347,23 +356,13 @@
 
     let metastyle = {}
     if (card.subelement.includes('avatar')) {
-      let _cardWidth = card.cardWidth
-  
       // 璁$畻鍗$墖瀹藉害
-      if (card.widthType === 'ratio' && card.over !== 'roll') {
-        let _outWidth = document.body.offsetWidth - 260
-        _cardWidth = Math.floor(_outWidth * card.cardWidth / 24 - 20)
-      }
+      let _outWidth = document.body.offsetWidth - 260
+      let _cardWidth = Math.floor(_outWidth * card.cardWidth / 24 - 20)
       
       if (card.avatar.type === 'picture') {
-        if (card.avatar.widthType === 'ratio') {
-          if (card.avatar.width < 90 && card.avatar.display !== 'block') {
-            metastyle.display = 'flex'
-          }
-        } else {
-          if (card.avatar.width < _cardWidth * 0.9 && card.avatar.display !== 'block') {
-            metastyle.display = 'flex'
-          }
+        if (card.avatar.width < 90 && card.avatar.display !== 'block') {
+          metastyle.display = 'flex'
         }
       } else {
         if (card.avatar.size < _cardWidth * 0.9 && card.avatar.display !== 'block') {
@@ -377,8 +376,7 @@
         {card.title ? <p className="chart-title">{card.title}</p> : null}
         <div
           ref={(ref) => this.cardRef = ref}
-          className={'ant-card chart-card ' + outclass}
-          style={card.widthType === 'absolute' ? { width: card.cardWidth } : null}
+          className={'ant-card chart-card ant-col ' + outclass}
         >
           {card.subelement.includes('header') ?
             <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
@@ -412,7 +410,7 @@
                     <Icon className="close" title="close" type="close" onClick={() => this.deleteElem('avatar')} />
                   </div>
                 } trigger="hover">
-                  <div className="ant-card-meta-avatar" style={{width: card.avatar.avatarWidth || 32, paddingTop: card.avatar.avatarWidth || 32}}>
+                  <div className="ant-card-meta-avatar" style={card.avatar.type === 'icon' ? {width: card.avatar.width, paddingTop: card.avatar.width} : {width: card.avatar.width + '%', paddingTop: card.avatar.width + '%'}}>
                     <span className="ant-avatar ant-avatar-circle ant-avatar-image" style={{borderRadius: card.avatar.radius === 'true' ? '50%' : 0}}>
                       {card.avatar.type === 'picture' ? <img src={avatar} alt=""/> : null}
                       {card.avatar.type === 'icon' ? <Icon className={'font ' + card.avatar.color} style={{fontSize: card.avatar.size + 'px'}} type={card.avatar.icon} /> : null}
@@ -449,7 +447,7 @@
           }
         </div>
         {card.extraAction ?
-          <div className={'ant-card chart-card chart-card-insert' + outclass} style={{ width: cardwidth, height: cardheight }} >
+          <div className={'ant-card chart-card chart-card-insert ' + outclass} style={{ width: cardwidth, height: cardheight }} >
             <Icon type="plus" style={cardwidth > cardheight ? {fontSize: cardheight / 2 + 'px', lineHeight: cardheight + 'px'} : {fontSize: cardwidth / 2 + 'px', lineHeight: cardheight + 'px'}} />
           </div> : null
         }

--
Gitblit v1.8.0