From c95918fb0fffb61b1117fbf4cd429e291b9594d0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 17 九月 2021 01:02:34 +0800
Subject: [PATCH] 2021-09-17

---
 src/tabviews/custom/components/carousel/cardItem/index.jsx |   32 +++-----------------------------
 1 files changed, 3 insertions(+), 29 deletions(-)

diff --git a/src/tabviews/custom/components/carousel/cardItem/index.jsx b/src/tabviews/custom/components/carousel/cardItem/index.jsx
index 2a29eee..94144cb 100644
--- a/src/tabviews/custom/components/carousel/cardItem/index.jsx
+++ b/src/tabviews/custom/components/carousel/cardItem/index.jsx
@@ -1,10 +1,8 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { connect } from 'react-redux'
 import { is, fromJS } from 'immutable'
 
 import asyncComponent from '@/utils/asyncComponent'
-import { modifyTabview } from '@/store/action'
 import MKEmitter from '@/utils/events.js'
 
 import './index.scss'
@@ -64,21 +62,9 @@
       }
 
       if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) {
-        this.props.modifyTabview([newtab])
+        MKEmitter.emit('modifyTabs', newtab, 'replace')
       } else {
-        let tabs = this.props.tabviews.filter((tab, i) => {
-          tab.selected = false
-          return tab.MenuID !== newtab.MenuID
-        })
-
-        if (this.props.tabviews.length > tabs.length) {
-          this.props.modifyTabview(fromJS(tabs).toJS())
-        }
-
-        this.setState({}, () => {
-          tabs.push(newtab)
-          this.props.modifyTabview(tabs)
-        })
+        MKEmitter.emit('modifyTabs', newtab, 'plus')
       }
     } else if (card.setting.click === 'link') {
       let src = card.setting.linkurl
@@ -114,16 +100,4 @@
   }
 }
 
-const mapStateToProps = (state) => {
-  return {
-    tabviews: state.tabviews,
-  }
-}
-
-const mapDispatchToProps = (dispatch) => {
-  return {
-    modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews))
-  }
-}
-
-export default connect(mapStateToProps, mapDispatchToProps)(CardBoxComponent)
\ No newline at end of file
+export default CardBoxComponent
\ No newline at end of file

--
Gitblit v1.8.0