From 6c44bc79e5edc338b44fdc469220ddf0e3fc4028 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 14 九月 2021 22:51:27 +0800
Subject: [PATCH] 2021-09-14

---
 src/tabviews/custom/components/carousel/cardItem/index.jsx |   80 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 78 insertions(+), 2 deletions(-)

diff --git a/src/tabviews/custom/components/carousel/cardItem/index.jsx b/src/tabviews/custom/components/carousel/cardItem/index.jsx
index 709043f..2a29eee 100644
--- a/src/tabviews/custom/components/carousel/cardItem/index.jsx
+++ b/src/tabviews/custom/components/carousel/cardItem/index.jsx
@@ -1,8 +1,11 @@
 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'
 
@@ -39,15 +42,88 @@
     }
   }
 
+  openView = () => {
+    const { card, data, cards } = this.props
+
+    if (card.setting.click === 'menu' && card.setting.MenuID) {
+      let menu = {
+        MenuID: card.setting.MenuID,
+        MenuName: card.setting.MenuName,
+        MenuNo: card.setting.MenuNo,
+        type: card.setting.tabType
+      }
+
+      let newtab = {
+        ...menu,
+        selected: true,
+        param: {}
+      }
+
+      if (card.setting.joint === 'true') {
+        newtab.param.$BID = data.$$uuid || ''
+      }
+
+      if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) {
+        this.props.modifyTabview([newtab])
+      } 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)
+        })
+      }
+    } else if (card.setting.click === 'link') {
+      let src = card.setting.linkurl
+
+      if (card.setting.joint === 'true') {
+        let con = '?'
+
+        if (/\?/ig.test(src)) {
+          con = '&'
+        }
+
+        src = src + `${con}id=${data.$$uuid || ''}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}`
+      }
+
+      window.open(src)
+    } else if (card.setting.click === 'button' && card.setting.linkbtn) {
+      if (cards.subtype === 'datacard') {
+        MKEmitter.emit('triggerBtnId', card.setting.linkbtn, [data], 'linkbtn')
+      } else {
+        MKEmitter.emit('triggerBtnId', card.setting.linkbtn, [data])
+      }
+    }
+  }
+
   render() {
     const { card, data, cards } = this.props
 
     return (
-      <div className="card-item-box" style={card.style}>
+      <div className="card-item-box" style={card.style} onClick={this.openView}>
         <CardCellComponent data={data} cards={cards} cardCell={card} elements={card.elements}/>
       </div>
     )
   }
 }
 
-export default CardBoxComponent
\ No newline at end of file
+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

--
Gitblit v1.8.0