From 81c3fd3ac5017591d987d9c9fe42042fae5c7d7d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 30 十一月 2021 14:30:47 +0800 Subject: [PATCH] 2021-11-30 --- src/views/design/header/index.jsx | 123 +++++++++++++++++++++++++++------------- 1 files changed, 82 insertions(+), 41 deletions(-) diff --git a/src/views/design/header/index.jsx b/src/views/design/header/index.jsx index 258382a..8e60745 100644 --- a/src/views/design/header/index.jsx +++ b/src/views/design/header/index.jsx @@ -2,13 +2,12 @@ import { withRouter } from 'react-router-dom' import {connect} from 'react-redux' import { is, fromJS } from 'immutable' -import { Dropdown, Menu, Icon, Modal, Form, notification, Switch, Button } from 'antd' +import { Dropdown, Menu, Icon, Modal, notification, Switch, Button } from 'antd' import asyncComponent from '@/utils/asyncComponent' import { modifyMenuTree, modifyMainMenu, - modifyTabview, resetEditLevel, logout } from '@/store/action' @@ -19,9 +18,11 @@ import Utils from '@/utils/utils.js' import avatar from '@/assets/img/avatar.jpg' import MainLogo from '@/assets/img/main-logo.png' +import MKEmitter from '@/utils/events.js' import './index.scss' const EditMenu = asyncComponent(() => import('@/templates/menuconfig/editfirstmenu')) +const VersionsUp = asyncComponent(() => import('./versions')) const { confirm } = Modal class Header extends Component { @@ -91,6 +92,7 @@ getMenulist = (result) => { let iframes = ['Main/Index', 'bda/rdt', 'Home/rdt'] let menulist = [] + let thdMenuList = [] result.fst_menu && result.fst_menu.forEach(fst => { let fstItem = { MenuID: fst.MenuID, @@ -139,7 +141,7 @@ if (trd.LinkUrl && iframes.includes(trd.LinkUrl.split('?')[0])) { trdItem.type = 'iframe' - trdItem.LinkUrl = trd.LinkUrl + trdItem.LinkUrl = trd.LinkUrl.replace('&', '&') trdItem.forbidden = true } else { try { @@ -156,6 +158,8 @@ } } + thdMenuList.push(trdItem) + return trdItem }) } @@ -167,6 +171,7 @@ menulist.push(fstItem) }) + sessionStorage.setItem('thdMenuList', JSON.stringify(thdMenuList)) return { menulist } } @@ -209,7 +214,8 @@ this.props.modifyMainMenu(menulist[0] || null) this.props.resetEditLevel(false) - this.props.modifyTabview([]) + + MKEmitter.emit('modifyTabs', null, 'replace') } exitEdit = () => { @@ -235,34 +241,36 @@ componentDidMount () { if (window.GLOB.systemType !== 'production') { - Api.getSystemConfig({func: 'sPC_Get_Roles_sModular'}).then(res => { - if (res.status) { - let _permFuncField = [] - let _sysRoles = [] - - if (res.Roles && res.Roles.length > 0) { - _sysRoles = res.Roles.map(role => { - return { - uuid: Utils.getuuid(), - value: role.RoleID, - text: role.RoleName - } - }) + setTimeout(() => { + Api.getSystemConfig({func: 'sPC_Get_Roles_sModular'}).then(res => { + if (res.status) { + let _permFuncField = [] + let _sysRoles = [] + + if (res.Roles && res.Roles.length > 0) { + _sysRoles = res.Roles.map(role => { + return { + uuid: Utils.getuuid(), + value: role.RoleID, + text: role.RoleName + } + }) + } + + if (res.sModular && res.sModular.length > 0) { + res.sModular.forEach(field => { + if (field.ModularNo) { + _permFuncField.push(field.ModularNo) + } + }) + _permFuncField = _permFuncField.sort() + } + + sessionStorage.setItem('sysRoles', JSON.stringify(_sysRoles)) + sessionStorage.setItem('permFuncField', JSON.stringify(_permFuncField)) } - - if (res.sModular && res.sModular.length > 0) { - res.sModular.forEach(field => { - if (field.ModularNo) { - _permFuncField.push(field.ModularNo) - } - }) - _permFuncField = _permFuncField.sort() - } - - sessionStorage.setItem('sysRoles', JSON.stringify(_sysRoles)) - sessionStorage.setItem('permFuncField', JSON.stringify(_permFuncField)) - } - }) + }) + }, 50) } else if (window.GLOB.systemType === 'production') { this.props.resetEditLevel('HS') this.props.modifyMainMenu({ @@ -323,15 +331,47 @@ } {editLevel === 'HS' ? <Button className="level4-close" type="primary" onClick={this.exitManage}>閫�鍑�</Button> : null} {/* 杩涘叆缂栬緫鎸夐挳 */} - {!editLevel ? <Icon onClick={this.enterEdit} className="edit-check" type="edit" /> : null} - {!editLevel && options.sysType === 'local' && window.GLOB.systemType !== 'production' && this.props.memberLevel >= 30 ? - <span onClick={() => {window.open('#/appmanage')}} className="mobile" type="edit"> 搴旂敤绠$悊 <Icon type="arrow-right" /></span> : null + {!editLevel && menulist ? <Icon onClick={this.enterEdit} className="edit-check" type="edit" /> : null} + {!editLevel && options.sysType === 'local' && window.GLOB.systemType !== 'production' && this.props.memberLevel >= 20 ? + <div className="app-entrance entrance"> + <div className="icon"><Icon type="appstore" /></div> + <div className="title">搴旂敤绠$悊</div> + <div className="detail">鍙垱寤哄強绠$悊PC銆乸ad鍙婄Щ鍔ㄧ绛変笉鍚岃澶囩殑搴旂敤锛屽疄鐜版槑绉戜簯APP銆佸井淇″叕浼楀彿銆佸皬绋嬪簭绛夊骞冲彴鐨勫簲鐢ㄥ叡浜��</div> + <Button type="primary" onClick={() => {window.open('#/appmanage')}}> + 缂栬緫 + </Button> + </div> : null + } + {editLevel === 'HS' && options.sysType === 'local' && window.GLOB.systemType === 'production' && this.props.memberLevel >= 20 ? + <div className="app-prod-entrance entrance"> + <div className="icon"><Icon type="appstore" /></div> + <div className="title">搴旂敤绠$悊</div> + <div className="detail">鍙垱寤哄強绠$悊PC銆乸ad鍙婄Щ鍔ㄧ绛変笉鍚岃澶囩殑搴旂敤锛屽疄鐜版槑绉戜簯APP銆佸井淇″叕浼楀彿銆佸皬绋嬪簭绛夊骞冲彴鐨勫簲鐢ㄥ叡浜��</div> + <Button type="primary" onClick={() => {window.open('#/appcheck')}}> + 鏌ョ湅 + </Button> + </div> : null + } + {!editLevel && options.sysType === 'local' && this.props.memberLevel >= 20 ? + <div className="api-entrance entrance"> + <div className="icon"><Icon type="api" /></div> + <div className="title">鎺ュ彛璋冭瘯</div> + <div className="detail">鍙嚜鍔ㄥ鐞嗙櫥褰曟帴鍙g殑鍙傛暟鍔犲瘑锛屼互鍙婁笟鍔℃帴鍙g殑绛惧悕璁$畻锛屾柟渚垮紑鍙戜汉鍛樼殑鎺ュ彛娴嬭瘯宸ヤ綔銆�</div> + <Button type="primary" onClick={() => {window.open('#/interface')}}> + 缂栬緫 + </Button> + </div> : null } {/* window.btoa(window.encodeURIComponent(JSON.stringify({ MenuType: 'home', MenuId: 'home_page_id', MenuName: '棣栭〉' }))) */} {!editLevel && window.GLOB.systemType !== 'production' && this.props.memberLevel >= 20 ? - <span className="home-edit" onClick={() => {window.open('#/menudesign/JTdCJTIyTWVudVR5cGUlMjIlM0ElMjJob21lJTIyJTJDJTIyTWVudUlkJTIyJTNBJTIyaG9tZV9wYWdlX2lkJTIyJTJDJTIyTWVudU5hbWUlMjIlM0ElMjIlRTklQTYlOTYlRTklQTElQjUlMjIlN0Q=')}}> - 棣栭〉 <Icon type="arrow-right" /> - </span> : null + <div className="home-entrance entrance"> + <div className="icon"><Icon type="home" /></div> + <div className="title">棣栭〉</div> + <div className="detail">鍩轰簬鑷畾涔夐〉闈㈢殑棣栭〉璁捐锛屽彲瀹炵幇鐏垫椿鐨勫厓绱犻厤缃強鏍峰紡璋冩暣锛屽睍鐜板綋鍓嶇郴缁熺殑椋庢牸銆�</div> + <Button type="primary" onClick={() => {window.open('#/menudesign/JTdCJTIyTWVudVR5cGUlMjIlM0ElMjJob21lJTIyJTJDJTIyTWVudUlkJTIyJTNBJTIyaG9tZV9wYWdlX2lkJTIyJTJDJTIyTWVudU5hbWUlMjIlM0ElMjIlRTklQTYlOTYlRTklQTElQjUlMjIlN0Q=')}}> + 缂栬緫 + </Button> + </div> : null } {/* 缂栬緫鑿滃崟 */} {editLevel === 'level1' ? <EditMenu menulist={this.state.menulist} reload={this.reload} exitEdit={this.exitEdit}/> : null} @@ -343,10 +383,13 @@ <Switch size="small" style={{marginLeft: '7px'}} disabled={!!editLevel} checked={true} onChange={this.changeEditState} /> </Menu.Item> <Menu.Item key="doc" onClick={this.gotoDoc}>{this.state.dict['main.doc']}</Menu.Item> + {options.sysType !== 'cloud' ? <Menu.Item style={{padding: 0}} key="verup"> + <VersionsUp /> + </Menu.Item> : null} <Menu.Item key="logout" onClick={this.logout}>{this.state.dict['main.logout']}</Menu.Item> </Menu> }> - <div> + <div style={{zIndex: 1, position: 'relative'}}> <img src={this.state.avatar || avatar} alt=""/> <span> <span className="username">{this.state.userName}</span> <Icon type="down" /> @@ -360,7 +403,6 @@ const mapStateToProps = (state) => { return { - tabviews: state.tabviews, menuTree: state.menuTree, mainMenu: state.mainMenu, editLevel: state.editLevel, @@ -371,7 +413,6 @@ const mapDispatchToProps = (dispatch) => { return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)), modifyMenuTree: (menuTree) => dispatch(modifyMenuTree(menuTree)), modifyMainMenu: (mainMenu) => dispatch(modifyMainMenu(mainMenu)), resetEditLevel: (level) => dispatch(resetEditLevel(level)), @@ -379,4 +420,4 @@ } } -export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Form.create()(Header))) \ No newline at end of file +export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Header)) \ No newline at end of file -- Gitblit v1.8.0