From 58826d6f4eab9f8c9acf9fa8696f60039c645cfe Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 20 八月 2024 18:18:00 +0800 Subject: [PATCH] 2024-08-20 --- src/views/design/header/index.jsx | 177 ++++++++++++++++++++++++++-------------------------------- 1 files changed, 80 insertions(+), 97 deletions(-) diff --git a/src/views/design/header/index.jsx b/src/views/design/header/index.jsx index aed4a99..edbf8e8 100644 --- a/src/views/design/header/index.jsx +++ b/src/views/design/header/index.jsx @@ -1,21 +1,14 @@ import React, {Component} from 'react' import { withRouter } from 'react-router-dom' -import {connect} from 'react-redux' import { Dropdown, Menu, Modal, notification, Switch, Button, Popover } from 'antd' import { MenuFoldOutlined, SettingOutlined, AppstoreOutlined, DownOutlined, HomeOutlined, ApiOutlined, PlusOutlined, EditOutlined, MenuOutlined, DatabaseOutlined } from '@ant-design/icons' import moment from 'moment' -import asyncComponent from '@/utils/asyncComponent' -import { - modifyMenuTree, - modifyMainMenu, - resetEditLevel, - logout -} from '@/store/action' import Api from '@/api' import Utils from '@/utils/utils.js' import avatar from '@/assets/img/avatar.jpg' import MainLogo from '@/assets/img/main-logo.png' +import asyncComponent from '@/utils/asyncComponent' import MKEmitter from '@/utils/events.js' import './index.scss' @@ -23,6 +16,8 @@ const VersionsUp = asyncComponent(() => import('./versions')) const ThawMenu = asyncComponent(() => import('@/components/thawmenu')) const MenuForm = asyncComponent(() => import('./editfirstmenu/menuform')) +const TransMenu = asyncComponent(() => import('./transmenu')) + const { confirm } = Modal class Header extends Component { @@ -30,7 +25,8 @@ menulist: null, // 涓�绾ц彍鍗� userName: sessionStorage.getItem('CloudUserName'), avatar: Utils.getrealurl(sessionStorage.getItem('CloudAvatar')), - memberLevel: Utils.getMemberLevel(), + logo: sessionStorage.getItem('CloudLogo') || MainLogo, + subLang: sessionStorage.getItem('subLangList') !== null, visible: false, loading: false } @@ -43,8 +39,8 @@ content: '', onOk() { sessionStorage.clear() - _this.props.logout() _this.props.history.replace('/login') + window.location.reload() }, onCancel() {} }) @@ -150,6 +146,7 @@ EasyCode: trd.EasyCode, type: 'CommonTable', // 榛樿鍊间负甯哥敤琛� OpenType: 'newtab', // 鎵撳紑鏂瑰紡 + up_action: window.GLOB.upStatus && trd.up_action === 'Y', level: 'third' } @@ -162,7 +159,7 @@ trdItem.PageParam = {OpenType: 'newtab'} } - if (trdItem.type === 'CustomPage' && this.state.memberLevel < 20) { // 浼氬憳绛夌骇澶т簬绛変簬20鏃讹紝鏈夌紪杈戞潈闄� + if (trdItem.type === 'CustomPage' && window.GLOB.memberLevel < 20) { // 浼氬憳绛夌骇澶т簬绛変簬20鏃讹紝鏈夌紪杈戞潈闄� trdItem.forbidden = true } @@ -236,69 +233,69 @@ }, () => {}) } - setSystemFuncs = () => { - if (!window.GLOB.IndexDB) { - return - } - this.getfuncTime().then(res => { - Api.getSystemFuncs(res.createDate).then(result => { - if (!result.status) { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } else if (result.func_detail && result.func_detail.length > 0) { - this.writeFuncs(result.func_detail) - } - }) - }) - } + // setSystemFuncs = () => { + // if (!window.GLOB.IndexDB) { + // return + // } + // this.getfuncTime().then(res => { + // Api.getSystemFuncs(res.createDate).then(result => { + // if (!result.status) { + // notification.error({ + // top: 92, + // message: result.message, + // duration: 10 + // }) + // } else if (result.func_detail && result.func_detail.length > 0) { + // this.writeFuncs(result.func_detail) + // } + // }) + // }) + // } - writeFuncs = (funcs) => { - let shim = +sessionStorage.getItem('sys_time_shim') - let timestamp = moment().add(shim, 'seconds').format('YYYY-MM-DD HH:mm:ss') + // writeFuncs = (funcs) => { + // let shim = +sessionStorage.getItem('sys_time_shim') + // let timestamp = moment().add(shim, 'seconds').format('YYYY-MM-DD HH:mm:ss') - let objectStore = window.GLOB.IndexDB.transaction(['funcs'], 'readwrite').objectStore('funcs') + // let objectStore = window.GLOB.IndexDB.transaction(['funcs'], 'readwrite').objectStore('funcs') - objectStore.clear() + // objectStore.clear() - funcs.forEach(item => { - if (!item.key_sql) return - item.id = item.func_code - objectStore.add(item) - }) + // funcs.forEach(item => { + // if (!item.key_sql) return + // item.id = item.func_code + // objectStore.add(item) + // }) - let funcStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') - funcStore.put({id: 'funcs', version: '1.0', createDate: timestamp}) - } + // let funcStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') + // funcStore.put({id: 'funcs', version: '1.0', createDate: timestamp}) + // } - getfuncTime = () => { - return new Promise((resolve, reject) => { - let objectStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') - let request = objectStore.get('funcs') + // getfuncTime = () => { + // return new Promise((resolve, reject) => { + // let objectStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') + // let request = objectStore.get('funcs') - request.onerror = (event) => { - console.warn(event) - reject() - } + // request.onerror = (event) => { + // console.warn(event) + // reject() + // } - request.onsuccess = () => { - if (request.result) { - resolve(request.result) - } else { - let add = objectStore.add({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) + // request.onsuccess = () => { + // if (request.result) { + // resolve(request.result) + // } else { + // let add = objectStore.add({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) - add.onerror = () => { - reject() - } - add.onsuccess = () => { - resolve({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) - } - } - } - }) - } + // add.onerror = () => { + // reject() + // } + // add.onsuccess = () => { + // resolve({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) + // } + // } + // } + // }) + // } getSmStemp = () => { if (!sessionStorage.getItem('msgTemplate')) { @@ -306,17 +303,18 @@ inner join (select openid from sapp where id='${window.GLOB.appkey}') b on a.openid=b.openid` - _sql = Utils.formatOptions(_sql) + _sql = Utils.formatOptions(_sql, 'x') let param = { func: 'sPC_Get_SelectedList', LText: _sql, obj_name: 'data', - arr_field: 'ID,TemplateCode,SignName' + arr_field: 'ID,TemplateCode,SignName', + exec_type: 'x' } param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getCloudConfig(param).then(res => { @@ -346,10 +344,6 @@ window.addEventListener('storage', (e) => { if (e.key === 'menuUpdate') { this.reload() - } else if (e.key === 'wxTemplates') { - if (e.newValue) { - sessionStorage.setItem('wxTemplates', e.newValue) - } } }) MKEmitter.addListener('mkUpdateMenuList', this.reload) @@ -387,7 +381,7 @@ }, 100) setTimeout(() => { - this.setSystemFuncs() + // this.setSystemFuncs() this.getSmStemp() }, 500) } @@ -415,11 +409,11 @@ render () { const { mainMenu, editLevel } = this.props - const { menulist, memberLevel, visible, loading } = this.state + const { menulist, visible, loading, logo, subLang } = this.state return ( <header className={'sys-header-container ant-menu-dark ' + (['level2', 'level3'].includes(editLevel) ? 'mask' : '')} id="main-header-container"> - <div className="header-logo"><img src={MainLogo} alt=""/></div> + <div className="header-logo"><img src={logo} alt=""/></div> <div className="header-collapse"> <MenuFoldOutlined/> </div> @@ -457,7 +451,7 @@ <div className="icon"><HomeOutlined /></div> <div className="title">棣栭〉</div> <div className="detail">鍩轰簬鑷畾涔夐〉闈㈢殑棣栭〉璁捐锛屽彲瀹炵幇鐏垫椿鐨勫厓绱犻厤缃強鏍峰紡璋冩暣锛屽睍鐜板綋鍓嶇郴缁熺殑椋庢牸銆�</div> - <Button type="primary" disabled={!(memberLevel >= 20)} title={memberLevel >= 20 ? '' : '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��'} onClick={() => {window.open('#/menudesign/JTdCJTIyTWVudVR5cGUlMjIlM0ElMjJob21lJTIyJTJDJTIyTWVudUlkJTIyJTNBJTIyaG9tZV9wYWdlX2lkJTIyJTJDJTIyTWVudU5hbWUlMjIlM0ElMjIlRTklQTYlOTYlRTklQTElQjUlMjIlN0Q=')}}> + <Button type="primary" disabled={window.GLOB.memberLevel < 20} title={window.GLOB.memberLevel < 20 ? '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��' : ''} onClick={() => {window.open('#/menudesign/JTdCJTIyTWVudVR5cGUlMjIlM0ElMjJob21lJTIyJTJDJTIyTWVudUlkJTIyJTNBJTIyaG9tZV9wYWdlX2lkJTIyJTJDJTIyTWVudU5hbWUlMjIlM0ElMjIlRTklQTYlOTYlRTklQTElQjUlMjIlN0Q=')}}> 缂栬緫 </Button> </div> : null @@ -466,7 +460,7 @@ <div className="icon"><ApiOutlined /></div> <div className="title">鎺ュ彛璋冭瘯</div> <div className="detail">鍙嚜鍔ㄥ鐞嗙櫥褰曟帴鍙g殑鍙傛暟鍔犲瘑锛屼互鍙婁笟鍔℃帴鍙g殑绛惧悕璁$畻锛屾柟渚垮紑鍙戜汉鍛樼殑鎺ュ彛娴嬭瘯宸ヤ綔銆�</div> - <Button type="primary" disabled={!(memberLevel >= 20)} title={memberLevel >= 20 ? '' : '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��'} onClick={() => {window.open('#/interface')}}> + <Button type="primary" disabled={window.GLOB.memberLevel < 20} title={window.GLOB.memberLevel < 20 ? '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��' : ''} onClick={() => {window.open('#/interface')}}> 缂栬緫 </Button> </div> @@ -475,10 +469,10 @@ <div className="title">搴旂敤绠$悊</div> <div className="detail">鍙垱寤哄強绠$悊PC銆乸ad鍙婄Щ鍔ㄧ绛変笉鍚岃澶囩殑搴旂敤锛屽疄鐜版槑绉戜簯APP銆佸井淇″叕浼楀彿銆佸皬绋嬪簭绛夊骞冲彴鐨勫簲鐢ㄥ叡浜��</div> {window.GLOB.systemType !== 'production' ? - <Button type="primary" disabled={!(memberLevel >= 20)} title={memberLevel >= 20 ? '' : '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��'} onClick={() => {window.open('#/appmanage')}}> + <Button type="primary" disabled={window.GLOB.memberLevel < 20} title={window.GLOB.memberLevel < 20 ? '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��' : ''} onClick={() => {window.open('#/appmanage')}}> 缂栬緫 </Button> : - <Button type="primary" disabled={!(memberLevel >= 20)} title={memberLevel >= 20 ? '' : '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��'} onClick={() => {window.open('#/appcheck')}}> + <Button type="primary" disabled={window.GLOB.memberLevel < 20} title={window.GLOB.memberLevel < 20 ? '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��' : ''} onClick={() => {window.open('#/appcheck')}}> 鏌ョ湅 </Button> } @@ -498,6 +492,12 @@ <Button type="primary" onClick={() => {window.open('#/proc')}}> 缂栬緫 </Button> + </div> : null} + {window.GLOB.systemType !== 'production' && subLang ? <div className="entrance"> + <div className="icon"><PlusOutlined /></div> + <div className="title">鑿滃崟杞崲</div> + <div className="detail">鍙�夋嫨姣嶈绯荤粺鐨勮彍鍗曪紝蹇�熻浆鎹㈠埌褰撳墠璇█銆傛墦鍗版ā鏉胯鍦℉S涓嬪鍒跺悗锛屽湪姝ゅ閫夋嫨鎸囧畾妯℃澘杩涜璇█杞崲銆�</div> + <TransMenu reload={this.reload} menulist={menulist}/> </div> : null} </div> {/* 缂栬緫鑿滃崟 */} @@ -542,21 +542,4 @@ } } -const mapStateToProps = (state) => { - return { - menuTree: state.menuTree, - mainMenu: state.mainMenu, - editLevel: state.editLevel - } -} - -const mapDispatchToProps = (dispatch) => { - return { - modifyMenuTree: (menuTree) => dispatch(modifyMenuTree(menuTree)), - modifyMainMenu: (mainMenu) => dispatch(modifyMainMenu(mainMenu)), - resetEditLevel: (level) => dispatch(resetEditLevel(level)), - logout: () => dispatch(logout()) - } -} - -export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Header)) \ No newline at end of file +export default withRouter(Header) \ No newline at end of file -- Gitblit v1.8.0