From c98e45bfac25e9110ad0383faac54a54d98ea9d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 18 十一月 2021 20:47:04 +0800
Subject: [PATCH] 2021-11-18

---
 src/menu/components/carousel/data-card/index.jsx |   47 ++++++++++++++++++++++++++++++++++-------------
 1 files changed, 34 insertions(+), 13 deletions(-)

diff --git a/src/menu/components/carousel/data-card/index.jsx b/src/menu/components/carousel/data-card/index.jsx
index e69ebc9..2144877 100644
--- a/src/menu/components/carousel/data-card/index.jsx
+++ b/src/menu/components/carousel/data-card/index.jsx
@@ -8,13 +8,14 @@
 import { resetStyle } from '@/utils/utils-custom.js'
 import MKEmitter from '@/utils/events.js'
 import Utils from '@/utils/utils.js'
+import getWrapForm from './options'
 import zhCN from '@/locales/zh-CN/model.js'
 import enUS from '@/locales/en-US/model.js'
 import './index.scss'
 
 const SettingComponent = asyncIconComponent(() => import('@/menu/datasource'))
-const WrapComponent = asyncIconComponent(() => import('./wrapsetting'))
-const CardComponent = asyncComponent(() => import('../cardcomponent'))
+const NormalForm = asyncIconComponent(() => import('@/components/normalform'))
+const CardSimpleComponent = asyncComponent(() => import('@/menu/components/card/cardsimplecomponent'))
 const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent'))
 const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
 const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent'))
@@ -30,6 +31,7 @@
 
   state = {
     dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
+    appType: sessionStorage.getItem('appType'),
     card: null,
     back: false
   }
@@ -163,6 +165,7 @@
    * @description 鍗曚釜鍗$墖淇℃伅鏇存柊
    */
   deleteCard = (cell) => {
+    const { appType } = this.state
     let card = fromJS(this.state.card).toJS()
     let _this = this
 
@@ -171,20 +174,26 @@
       onOk() {
         card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid)
 
-        let uuids = []
-        cell.elements && cell.elements.forEach(c => {
-          if (c.eleType === 'button') {
-            uuids.push(c.uuid)
-          }
-        })
-        MKEmitter.emit('delButtons', uuids)
-
         if (card.btnlog) {
           card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid)
         }
 
         _this.setState({card})
         _this.props.updateConfig(card)
+
+        if (appType === 'mob') return
+
+        let uuids = []
+
+        cell.elements && cell.elements.forEach(c => {
+          if (c.eleType !== 'button' || (appType === 'pc' && c.OpenType !== 'popview')) return
+
+          uuids.push(c.uuid)
+        })
+
+        if (uuids.length === 0) return
+        
+        MKEmitter.emit('delButtons', uuids)
       },
       onCancel() {}
     })
@@ -193,7 +202,7 @@
   changeStyle = () => {
     const { card } = this.state
 
-    MKEmitter.emit('changeStyle', [card.uuid], ['height', 'background', 'border', 'padding', 'margin'], card.style)
+    MKEmitter.emit('changeStyle', [card.uuid], ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style)
   }
 
   getStyle = (comIds, style) => {
@@ -242,6 +251,16 @@
     }
   }
 
+  getWrapForms = () => {
+    const { card } = this.state
+
+    return getWrapForm(card.wrap, card.subtype)
+  }
+
+  updateWrap = (res) => {
+    this.updateComponent({...this.state.card, wrap: res})
+  }
+
   clickComponent = (e) => {
     if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') {
       e.stopPropagation()
@@ -257,7 +276,9 @@
       <div className="menu-data-carousel-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}>
         <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control">
-            <WrapComponent config={card} updateConfig={this.updateComponent}/>
+            <NormalForm title="杞挱-鍔ㄦ�佹暟鎹�" width={800} update={this.updateWrap} getForms={this.getWrapForms}>
+              <Icon type="edit" style={{color: '#1890ff'}} title="缂栬緫"/>
+            </NormalForm>
             <CopyComponent type="datacard" card={card}/>
             <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors"/>
             <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog}/>
@@ -268,7 +289,7 @@
         } trigger="hover">
           <Icon type="tool"/>
         </Popover>
-        <CardComponent cards={card} card={card.subcards[0]} updateElement={this.updateCard} deleteElement={this.deleteCard}/>
+        <CardSimpleComponent cards={card} card={card.subcards[0]} updateElement={this.updateCard} deleteElement={this.deleteCard}/>
       </div>
     )
   }

--
Gitblit v1.8.0