From ffb227b38092d98c7394a2ba5e7dff1135fdb28f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 20 九月 2022 22:02:35 +0800
Subject: [PATCH] 2022-09-20
---
src/menu/components/share/normalheader/index.jsx | 51 ++++++++++++++++++++++++++++++++-------------------
1 files changed, 32 insertions(+), 19 deletions(-)
diff --git a/src/menu/components/share/normalheader/index.jsx b/src/menu/components/share/normalheader/index.jsx
index f2274ba..2f552fd 100644
--- a/src/menu/components/share/normalheader/index.jsx
+++ b/src/menu/components/share/normalheader/index.jsx
@@ -1,7 +1,8 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
-import { Popover, Icon } from 'antd'
+import { Popover } from 'antd'
+import { FontColorsOutlined, SearchOutlined } from '@ant-design/icons'
import asyncComponent from '@/utils/asyncComponent'
import MKEmitter from '@/utils/events.js'
@@ -12,14 +13,13 @@
class NormalHeader extends Component {
static propTpyes = {
- defaultshow: PropTypes.any, // 鏍囬涓庢悳绱㈡潯浠朵笉瀛樺湪鏃堕殣钘�
hideSearch: PropTypes.any, // 闅愯棌鎼滅储鏉′欢
config: PropTypes.object, // 閰嶇疆淇℃伅
updateComponent: PropTypes.func // 閰嶇疆鏇存柊
}
- componentDidMount () {
- MKEmitter.addListener('submitStyle', this.getStyle)
+ state = {
+ appType: sessionStorage.getItem('appType')
}
shouldComponentUpdate (nextProps, nextState) {
@@ -33,15 +33,14 @@
this.setState = () => {
return
}
- MKEmitter.removeListener('submitStyle', this.getStyle)
}
- getStyle = (comIds, style) => {
- const { config } = this.props
+ getStyle = (style) => {
+ if (!style.borderBottomWidth) {
+ style.borderBottomWidth = '0px'
+ }
- if (comIds[0] !== config.uuid || comIds[1] !== 'header') return
-
- let _config = {...config, headerStyle: style}
+ let _config = {...this.props.config, headerStyle: style}
this.props.updateComponent(_config)
}
@@ -49,31 +48,45 @@
changeStyle = () => {
const { config } = this.props
- MKEmitter.emit('changeStyle', [config.uuid, 'header'], ['font', 'border'], config.headerStyle)
+ let options = ['font', 'border', 'background']
+ if (config.type === 'menubar') {
+ options.push('padding')
+ }
+
+ MKEmitter.emit('changeStyle', options, config.headerStyle, this.getStyle)
}
render() {
- const { config, defaultshow, hideSearch } = this.props
+ const { config, hideSearch } = this.props
+ // const { appType } = this.state
let title = config.plot ? config.plot.title : config.wrap.title
let show = true
- if (defaultshow === 'hidden') {
- if (!title && (!config.search || config.search.length === 0)) {
- show = false
- }
+
+ // if (!title && appType === 'mob' && config.type === 'card' && config.subtype === 'datacard' && config.action && config.action.length) {
+ // title = ' '
+ // }
+
+ if (!title && (!config.search || config.search.length === 0 || hideSearch === 'true')) {
+ show = false
}
let _style = resetStyle(config.headerStyle)
+
+ let _s = {display: 'block', flex: 1}
+ if (show && ((config.wrap && config.wrap.searchable === 'true') || (hideSearch !== 'true' && config.search && config.search.length))) {
+ _s = null
+ }
return (
<div className={'normal-header' + (!show ? ' hidden' : '') + (config.wrap && config.wrap.searchable === 'true' ? ' tree-search' : '')} style={_style}>
<Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
<div className="mk-popover-control">
- <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" />
+ <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/>
</div>
} trigger="hover">
- <span className="title">{title}</span>
+ <span className="title" style={_s}>{title}</span>
</Popover>
- {config.wrap && config.wrap.searchable === 'true' ? <span className="ant-input-search ant-input-affix-wrapper"><span className="ant-input-suffix"><Icon type="search" /></span></span> : null}
+ {config.wrap && config.wrap.searchable === 'true' ? <span className="ant-input-search ant-input-affix-wrapper"><span className="ant-input-suffix"><SearchOutlined /></span></span> : null}
{hideSearch !== 'true' && config.search ? <SearchComponent config={config} updatesearch={this.props.updateComponent}/> : null}
</div>
)
--
Gitblit v1.8.0