From f3ec8c20eeabee6eaab1508d2f3896c28aab611c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 22 七月 2021 14:42:42 +0800
Subject: [PATCH] 修改页面中按钮保存

---
 src/menu/components/carousel/prop-card/index.jsx |   44 +++++++++++++++++++++-----------------------
 1 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/src/menu/components/carousel/prop-card/index.jsx b/src/menu/components/carousel/prop-card/index.jsx
index 2bdb7d0..404d434 100644
--- a/src/menu/components/carousel/prop-card/index.jsx
+++ b/src/menu/components/carousel/prop-card/index.jsx
@@ -1,12 +1,11 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import {connect} from 'react-redux'
 import { is, fromJS } from 'immutable'
 import { Icon, Popover, Modal, notification, Carousel } from 'antd'
 
 import asyncComponent from '@/utils/asyncComponent'
 import asyncIconComponent from '@/utils/asyncIconComponent'
-
+import { resetStyle } from '@/utils/utils-custom.js'
 import MKEmitter from '@/utils/events.js'
 import Utils from '@/utils/utils.js'
 import zhCN from '@/locales/zh-CN/model.js'
@@ -32,6 +31,7 @@
 
   state = {
     dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
+    appType: sessionStorage.getItem('appType'),
     card: null,
     back: false
   }
@@ -101,7 +101,7 @@
   }
 
   shouldComponentUpdate (nextProps, nextState) {
-    return !is(fromJS(this.state), fromJS(nextState)) || (!this.props.menu && nextProps.menu)
+    return !is(fromJS(this.state), fromJS(nextState))
   }
 
   /**
@@ -181,6 +181,7 @@
    * @description 鍗曚釜鍗$墖淇℃伅鏇存柊
    */
   deleteCard = (cell) => {
+    const { appType } = this.state
     let card = fromJS(this.state.card).toJS()
     let _this = this
 
@@ -188,14 +189,6 @@
       content: '纭畾鍒犻櫎鍗$墖鍚楋紵',
       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)
@@ -203,6 +196,20 @@
 
         _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() {}
     })
@@ -329,9 +336,10 @@
 
   render() {
     const { card } = this.state
+    let _style = resetStyle(card.style)
 
     return (
-      <div className="menu-prop-carousel-edit-box" style={{...card.style}} onClick={this.clickComponent} id={card.uuid}>
+      <div className="menu-prop-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">
             <Icon className="plus" title="娣诲姞鍗$墖" onClick={this.addCard} type="plus" />
@@ -356,14 +364,4 @@
   }
 }
 
-const mapStateToProps = (state) => {
-  return {
-    menu: state.customMenu
-  }
-}
-
-const mapDispatchToProps = () => {
-  return {}
-}
-
-export default connect(mapStateToProps, mapDispatchToProps)(PropCardEditComponent)
\ No newline at end of file
+export default PropCardEditComponent
\ No newline at end of file

--
Gitblit v1.8.0