king
2021-03-08 75f3fd6e67851b9079e0b82c8cd94bf7649fe8bd
src/views/pcdesign/index.jsx
@@ -1,6 +1,7 @@
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { DndProvider } from 'react-dnd'
import { withRouter } from 'react-router'
import { is, fromJS } from 'immutable'
import moment from 'moment'
import HTML5Backend from 'react-dnd-html5-backend'
@@ -81,18 +82,26 @@
          localedict: sessionStorage.getItem('lang') !== 'en-US' ? antdZhCN : antdEnUS,
          dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
        })
        this.getAppMessage()
      } else if (param.type === 'view') {
        this.setState({
          MenuId: param.MenuID
        }, () => {
          this.getMenuParam()
        })
      }
      this.getAppMessage()
    } catch {
      notification.warning({
        top: 92,
        message: '菜单信息解析错误!',
        duration: 5
      })
    }
  }
  UNSAFE_componentWillReceiveProps(nextProps) {
    if (this.props.match.params.param !== nextProps.match.params.param) {
      window.location.reload()
    }
  }
@@ -142,8 +151,7 @@
      return
    }
    this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: menu.MenuID, type: 'view'}))))
    window.location.reload()
    this.props.history.push('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: menu.MenuID, copyMenuId: menu.copyMenuId || '', type: 'view'}))))
  }
  getAppMessage = () => {
@@ -161,13 +169,6 @@
      }
      let homeId = ''
      if (this.state.MenuId) {
        let appViewList = res.data && res.data.length > 0 ? res.data : []
        homeId = this.state.MenuId
        sessionStorage.setItem('appViewList', JSON.stringify(appViewList))
      } else {
        let appViewList = []
        if (res.data && res.data.length > 0) {
          appViewList = res.data
@@ -211,17 +212,15 @@
                message: result.message,
                duration: 5
              })
            }
          })
        }
          } else {
        sessionStorage.setItem('appViewList', JSON.stringify(appViewList))
      }
      this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: homeId, type: 'view'}))))
      this.setState({MenuId: homeId}, () => {
        this.getMenuParam()
          }
      })
      } else {
        sessionStorage.setItem('appViewList', JSON.stringify(appViewList))
        this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: homeId, type: 'view'}))))
      }
    })
  }
@@ -1221,4 +1220,4 @@
  }
}
export default connect(mapStateToProps, mapDispatchToProps)(MenuDesign)
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(MenuDesign))