From 7e46c386be5c2cfc20af3936d26839ad3fce44b0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 16 八月 2023 17:40:32 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/components/tabview/index.jsx | 20 - src/index.js | 43 +-- src/components/tabview/index.scss | 5 src/views/design/index.jsx | 32 ++ src/tabviews/custom/components/card/prop-card/index.jsx | 10 src/views/design/header/index.jsx | 29 -- src/views/login/loginform.jsx | 3 src/components/header/index.jsx | 170 +++++++--------- src/views/menudesign/printmenuform/index.jsx | 7 /dev/null | 50 ----- src/tabviews/home/index.jsx | 52 ++-- src/views/billprint/index.jsx | 6 src/views/design/sidemenu/index.jsx | 19 - src/components/sidemenu/index.jsx | 78 +++---- src/views/design/sidemenu/editthdmenu/index.jsx | 16 - src/views/login/index.jsx | 1 16 files changed, 206 insertions(+), 335 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index c9d7275..032fd3d 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -1,16 +1,9 @@ import React, {Component} from 'react' import { withRouter } from 'react-router-dom' -import PropTypes from 'prop-types' -import {connect} from 'react-redux' import { is, fromJS } from 'immutable' import { Dropdown, Menu, Modal, notification, Switch, Input } from 'antd' import { SearchOutlined, DownOutlined, MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons' -import { - toggleCollapse, - modifyMainMenu, - logout -} from '@/store/action' import asyncSpinComponent from '@/utils/asyncSpinComponent' import asyncComponent from '@/utils/asyncComponent' import Api from '@/api' @@ -26,9 +19,6 @@ const LoginForm = asyncSpinComponent(() => import('./loginform')) class Header extends Component { - static propTpyes = { - collapse: PropTypes.bool - } state = { menulist: null, // 涓�绾ц彍鍗� userName: '', @@ -40,13 +30,73 @@ systems: [], searchkey: '', thdMenuList: [], - debug: sessionStorage.getItem('debug') === 'true' + debug: sessionStorage.getItem('debug') === 'true', + collapse: sessionStorage.getItem('collapse') === 'true' + } + + UNSAFE_componentWillMount () { + window.GLOB.mainMenu = null + // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 + this.getRolesMenu() + + let fullName = sessionStorage.getItem('Full_Name') || '' + let userName = sessionStorage.getItem('User_Name') || '' + + if (fullName.toLowerCase() === userName.toLowerCase()) { + userName = '' + } + + this.setState({fullName, userName}) + } + + componentDidMount () { + // 鑾峰彇绯荤粺鐨勭増鏈俊鎭紝寤舵椂鏌ヨ + setTimeout(() => { + Api.getAppVersion() + }, 1000) + + // sessionStorage 璺ㄩ〉闈㈠叡浜� + window.addEventListener('storage', (e) => { + if (e.key === 'getSessionStorage' && e.newValue === window.GLOB.appkey) { + localStorage.setItem('sessionStorage', JSON.stringify(sessionStorage)) + } else if (e.key === 'getSysPermission' && e.newValue === window.GLOB.appkey) { + localStorage.setItem('sysPermissions', JSON.stringify({mkThdMenus: window.GLOB.mkThdMenus, mkActions: window.GLOB.mkActions})) + } else if (e.key === 'menuUpdate') { + let vals = e.newValue.split(',') + let menuId = vals[1] + let position = vals[2] || '' + if (position === 'menu') { + MKEmitter.emit('reloadMenuView', menuId) + } else if (menuId) { + Api.getAppVersion(menuId).then(() => { + MKEmitter.emit('reloadMenuView', menuId) + }) + } + } + }) + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 + */ + componentWillUnmount () { + this.setState = () => { + return + } } handleCollapse = () => { - // 灞曞紑銆佹敹璧峰乏渚ц彍鍗曟爮 - this.props.toggleCollapse(!this.props.collapse) - localStorage.setItem('collapse', !this.props.collapse) + const { collapse } = this.state + + sessionStorage.setItem('collapse', !collapse) + + this.setState({collapse: !collapse}) + + MKEmitter.emit('toggleCollapse', !collapse) } changePassword = () => { @@ -54,7 +104,6 @@ MKEmitter.emit('resetpassword', () => { setTimeout(() => { sessionStorage.clear() - this.props.logout() this.props.history.replace('/login') }, 2000) }) @@ -70,7 +119,6 @@ cancelText: '鍙栨秷', onOk() { sessionStorage.clear() - _this.props.logout() _this.props.history.replace('/login') }, onCancel() {} @@ -84,7 +132,8 @@ } else if (value.OpenType === 'newtab') { MKEmitter.emit('modifyTabs', value) } else if (value.OpenType === 'menu') { - this.props.modifyMainMenu(value) + window.GLOB.mainMenu = value + MKEmitter.emit('mainMenuChange') } } @@ -130,9 +179,10 @@ sessionStorage.removeItem('ThirdMenu') } - this.props.modifyMainMenu(mainMenu) - + window.GLOB.mainMenu = mainMenu window.GLOB.mkThdMenus = [...thdMenuList, {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}] + + MKEmitter.emit('mainMenuChange') if (_menu) { this.openTab(_menu, 0) @@ -313,8 +363,7 @@ loginVisible: true }) } else { - this.props.modifyMainMenu(null) - + window.GLOB.mainMenu = null this.props.history.replace('/design') } } @@ -360,7 +409,8 @@ localStorage.setItem(_url, window.btoa(window.encodeURIComponent(JSON.stringify({time: new Date().getTime(), username: param.username, password: ''})))) } - this.props.modifyMainMenu(null) + window.GLOB.mainMenu = null + this.props.history.replace('/design') } else { if (res.message.indexOf('瀵嗙爜閿欒') > -1) { @@ -441,60 +491,6 @@ }, 500) } }) - } - - UNSAFE_componentWillMount () { - // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 - this.getRolesMenu() - - let fullName = sessionStorage.getItem('Full_Name') || '' - let userName = sessionStorage.getItem('User_Name') || '' - - if (fullName.toLowerCase() === userName.toLowerCase()) { - userName = '' - } - - this.setState({fullName, userName}) - } - - componentDidMount () { - // 鑾峰彇绯荤粺鐨勭増鏈俊鎭紝寤舵椂鏌ヨ - setTimeout(() => { - Api.getAppVersion() - }, 1000) - - // sessionStorage 璺ㄩ〉闈㈠叡浜� - window.addEventListener('storage', (e) => { - if (e.key === 'getSessionStorage' && e.newValue === window.GLOB.appkey) { - localStorage.setItem('sessionStorage', JSON.stringify(sessionStorage)) - } else if (e.key === 'getSysPermission' && e.newValue === window.GLOB.appkey) { - localStorage.setItem('sysPermissions', JSON.stringify({mkThdMenus: window.GLOB.mkThdMenus, mkActions: window.GLOB.mkActions})) - } else if (e.key === 'menuUpdate') { - let vals = e.newValue.split(',') - let menuId = vals[1] - let position = vals[2] || '' - if (position === 'menu') { - MKEmitter.emit('reloadMenuView', menuId) - } else if (menuId) { - Api.getAppVersion(menuId).then(() => { - MKEmitter.emit('reloadMenuView', menuId) - }) - } - } - }) - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } } gotoDoc = () => { @@ -579,8 +575,7 @@ } render () { - const { mainMenu, collapse } = this.props - const { thdMenuList, searchkey, debug, menulist } = this.state + const { thdMenuList, searchkey, debug, menulist, collapse } = this.state const navBar = window.GLOB.navBar const menu = ( @@ -622,7 +617,7 @@ <ul className="header-menu">{ menulist.map(item => { return ( - <li key={item.MenuID} onClick={() => {this.changeMenu(item)}} className={mainMenu && mainMenu.MenuID === item.MenuID ? 'active' : ''}> + <li key={item.MenuID} onClick={() => {this.changeMenu(item)}} className={window.GLOB.mainMenu && window.GLOB.mainMenu.MenuID === item.MenuID ? 'active' : ''}> <span>{item.MenuName}</span> </li> ) @@ -777,19 +772,4 @@ } } -const mapStateToProps = (state) => { - return { - collapse: state.collapse, - mainMenu: state.mainMenu - } -} - -const mapDispatchToProps = (dispatch) => { - return { - toggleCollapse: (collapse) => dispatch(toggleCollapse(collapse)), - modifyMainMenu: (mainMenu) => dispatch(modifyMainMenu(mainMenu)), - 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 diff --git a/src/components/sidemenu/index.jsx b/src/components/sidemenu/index.jsx index 2e51d24..263d66f 100644 --- a/src/components/sidemenu/index.jsx +++ b/src/components/sidemenu/index.jsx @@ -1,6 +1,4 @@ import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { connect } from 'react-redux' import { is, fromJS } from 'immutable' import { Menu } from 'antd' @@ -11,17 +9,44 @@ const { SubMenu } = Menu class Sidemenu extends Component { - static propTypes = { - collapse: PropTypes.bool - } - state = { subMenulist: [], // 浜岀骇鑿滃崟 rootSubmenuKeys: null, + collapse: sessionStorage.getItem('collapse') === 'true', openKeys: null } - async loadsubmenu (menu) { + componentDidMount() { + MKEmitter.addListener('mainMenuChange', this.loadsubmenu) + MKEmitter.addListener('toggleCollapse', this.toggleCollapse) + + if (window.GLOB.mainMenu) { + this.loadsubmenu() + } + } + + shouldComponentUpdate(nextProps, nextState) { + return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + } + + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('mainMenuChange', this.loadsubmenu) + MKEmitter.removeListener('toggleCollapse', this.toggleCollapse) + } + + toggleCollapse = (collapse) => { + this.setState({ + collapse: collapse, + openKeys: [] + }) + } + + loadsubmenu = () => { + let menu = window.GLOB.mainMenu + if (!menu || !menu.MenuID) { // 娌℃湁涓昏彍鍗曟椂锛屾竻绌轰笅绾ц彍鍗� this.setState({ subMenulist: [], @@ -41,7 +66,7 @@ this.setState({ subMenulist: menu.children, rootSubmenuKeys: menu.children.map(item => item.MenuID), - openKeys: this.props.collapse ? [] : [openKey], + openKeys: this.state.collapse ? [] : [openKey], }) } @@ -59,22 +84,6 @@ } } - UNSAFE_componentWillReceiveProps (nextProps) { - if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu))) { - // 涓昏彍鍗曞垏鎹紝璇锋眰2銆�3绾ц彍鍗曟暟鎹� - this.loadsubmenu(nextProps.mainMenu) - } else if (nextProps.collapse && this.props.collapse !== nextProps.collapse) { - // 灞曞紑鍚堝苟鏃讹紝鍏抽棴灞曞紑鑿滃崟 - this.setState({ - openKeys: [] - }) - } - } - - shouldComponentUpdate(nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) - } - onOpenChange = openKeys => { const latestOpenKey = openKeys.find(key => this.state.openKeys.indexOf(key) === -1) if (this.state.rootSubmenuKeys.indexOf(latestOpenKey) === -1) { @@ -87,13 +96,13 @@ } render () { - const { mainMenu } = this.props + const { collapse } = this.state - if (mainMenu === '') return (<span className="mk-side-menu-hidden"></span>) + if (window.GLOB.mainMenu === '') return (<span className="mk-side-menu-hidden"></span>) return ( - <aside id="mk-sidemenu-wrap" className={'mk-side-menu ant-menu-dark' + (this.props.collapse ? ' collapsed' : '')}> - <Menu openKeys={this.state.openKeys} onOpenChange={this.onOpenChange} mode="inline" theme="dark" inlineCollapsed={this.props.collapse}> + <aside id="mk-sidemenu-wrap" className={'mk-side-menu ant-menu-dark' + (collapse ? ' collapsed' : '')}> + <Menu openKeys={this.state.openKeys} onOpenChange={this.onOpenChange} mode="inline" theme="dark" inlineCollapsed={collapse}> {this.state.subMenulist && this.state.subMenulist.map((item) => { return ( <SubMenu @@ -121,15 +130,4 @@ } } -const mapStateToProps = (state) => { - return { - collapse: state.collapse, - mainMenu: state.mainMenu, - } -} - -const mapDispatchToProps = () => { - return {} -} - -export default connect(mapStateToProps, mapDispatchToProps)(Sidemenu) \ No newline at end of file +export default Sidemenu \ No newline at end of file diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx index f34c03f..06635eb 100644 --- a/src/components/tabview/index.jsx +++ b/src/components/tabview/index.jsx @@ -1,6 +1,4 @@ import React, {Component} from 'react' -import PropTypes from 'prop-types' -import {connect} from 'react-redux' import { fromJS } from 'immutable' import {Tabs, BackTop, notification} from 'antd' import { RedoOutlined, CloseOutlined } from '@ant-design/icons' @@ -24,10 +22,6 @@ moment.locale('zh-cn') class TabViews extends Component { - static propTpyes = { - collapse: PropTypes.bool - } - state = { activeId: '', tabviews: [], @@ -245,7 +239,7 @@ const { tabviews, activeId } = this.state return ( - <section id="mk-tabgroup-wrap" className={'mk-tabview-wrap' + (this.props.collapse ? ' collapsed' : '')}> + <section id="mk-tabgroup-wrap" className="mk-tabview-wrap"> <div className="content-header"> {tabviews.length > 0 && <Tabs activeKey={activeId}> @@ -284,14 +278,4 @@ } } -const mapStateToProps = (state) => { - return { - collapse: state.collapse, - } -} - -const mapDispatchToProps = (dispatch) => { - return {} -} - -export default connect(mapStateToProps, mapDispatchToProps)(TabViews) \ No newline at end of file +export default TabViews \ No newline at end of file diff --git a/src/components/tabview/index.scss b/src/components/tabview/index.scss index 4e303c7..5b85043 100644 --- a/src/components/tabview/index.scss +++ b/src/components/tabview/index.scss @@ -97,10 +97,11 @@ .header-container + .mk-tabview-wrap { max-width: 100%; } -.mk-tabview-wrap.collapsed { + +.mk-side-menu.collapsed + .mk-tabview-wrap { max-width: calc(100% - 80px); } -.mk-side-menu-hidden + .mk-tabview-wrap, .mk-side-menu-hidden + .mk-tabview-wrap.collapsed { +.mk-side-menu-hidden + .mk-tabview-wrap { max-width: 100%; >.content-header >.ant-tabs >.ant-tabs-bar { display: none; diff --git a/src/index.js b/src/index.js index 7efb3a6..3abc76b 100644 --- a/src/index.js +++ b/src/index.js @@ -1,9 +1,7 @@ import React from 'react' import ReactDOM from 'react-dom' import Route from './router' -import { Provider } from 'react-redux' import md5 from 'md5' -import store from '@/store' import * as serviceWorker from './serviceWorker' import options, { styles } from '@/store/options.js' import '@/assets/css/main.scss' @@ -23,9 +21,7 @@ const render = Component => { ReactDOM.render( - <Provider store={store}> - <Component/> - </Provider>, + <Component/>, document.getElementById('root') ) } @@ -59,7 +55,10 @@ GLOB.WXNotice = config.WXNotice + '' === 'true' GLOB.accessToken = {} GLOB.mkHS = false + GLOB.debugger = false + GLOB.dataFormat = false GLOB.navBar = 'shutter' // 榛樿涓虹櫨鍙剁獥 + GLOB.style = 'bg_black_style_blue' GLOB.sysType = options.sysType if (GLOB.sysType !== 'cloud') { @@ -93,6 +92,7 @@ } } else if (GLOB.sysType === 'local') { GLOB.probation = true + GLOB.debugger = true GLOB.systemType = '' GLOB.mainSystemApi = 'https://cloud.positecgroup.com/webapi/dostars' @@ -109,8 +109,6 @@ GLOB.systemType = '' GLOB.mainSystemApi = '' } - - GLOB.debugger = GLOB.sysType === 'local' && GLOB.systemType !== 'production' if (/#\/hs$/.test(window.location.href)) { // hs涓嬩笉鎵撳嵃鑴氭湰 GLOB.debugger = false @@ -165,7 +163,7 @@ GLOB.mainlogo = _systemMsg.mainlogo GLOB.doclogo = _systemMsg.doclogo GLOB.webSite = _systemMsg.webSite - GLOB.style = _systemMsg.style + GLOB.style = _systemMsg.style || 'bg_black_style_blue' GLOB.showline = _systemMsg.showline || '' GLOB.navBar = _systemMsg.navBar || 'shutter' GLOB.appVersion = _systemMsg.app_version || '' @@ -177,17 +175,12 @@ link.href = GLOB.favicon document.getElementsByTagName('head')[0].appendChild(link) } - if (GLOB.style && styles[GLOB.style]) { + if (styles[GLOB.style]) { className = styles[GLOB.style] + ' ' + (GLOB.showline === 'false' ? 'hidden-split-line' : '') } } catch (e) { console.warn('Parse Failure') } - } - - // 涓嶄娇鐢ㄧ櫨鍙剁獥鎵撳紑鑿滃崟鏃讹紝鍘绘帀鍚堝苟鏍囪 - if (GLOB.navBar !== 'shutter') { - localStorage.removeItem('collapse') } document.body.className = className @@ -217,20 +210,18 @@ GLOB.host = config.host.replace(/http(s)?:\/\//ig, '') + (config.service ? '_' + config.service.replace(/\//ig, '') : '') GLOB.baseurl = GLOB.location + '/' + GLOB.service GLOB.linkurl = GLOB.baseurl + 'index.html' + GLOB.dataFormat = false + + let mark = sessionStorage.getItem('system_mark') + let _mark = `sys_${GLOB.service.replace('/', '') || 'service'}` + if (mark && mark !== _mark) { + sessionStorage.clear() + } + sessionStorage.setItem('system_mark', _mark) } - let mark = sessionStorage.getItem('system_mark') - let _mark = `sys_${GLOB.service.replace('/', '') || 'service'}` - if (mark && mark !== _mark) { - sessionStorage.clear() - } - sessionStorage.setItem('system_mark', _mark) - - if (localStorage.getItem(_href + 'lang')) { - sessionStorage.setItem('lang', localStorage.getItem(_href + 'lang')) - } else { - sessionStorage.setItem('lang', config.defaultLang !== 'en-US' ? 'zh-CN' : 'en-US') - } + let lang = localStorage.getItem(_href + 'lang') || (config.defaultLang !== 'en-US' ? 'zh-CN' : 'en-US') + sessionStorage.setItem('lang', lang) let _level = 10 let _Mlevel = sessionStorage.getItem('Member_Level') diff --git a/src/store/action-type.js b/src/store/action-type.js deleted file mode 100644 index 9443fa6..0000000 --- a/src/store/action-type.js +++ /dev/null @@ -1,17 +0,0 @@ -// 鍒濆鍖栬彍鍗曚俊鎭� -export const MODIFY_MENUTREE = 'MODIFY_MENUTREE' - -// 鍒囨崲涓昏彍鍗� -export const MODIFY_MAINMENU = 'MODIFY_MAINMENU' - -// 灞曞紑鍚堝苟鑿滃崟鏍� -export const Toggle_COLLAPSE = 'Toggle_COLLAPSE' - -// 鍒锋柊tab椤甸潰 -export const REFRESH_TABVIEW = 'REFRESH_TABVIEW' - -// 閲嶇疆缂栬緫绾у埆 -export const RESET_EDITLEVEL = 'RESET_EDITLEVEL' - -// 閫�鍑� -export const LOGOUT = 'LOGOUT' \ No newline at end of file diff --git a/src/store/action.js b/src/store/action.js deleted file mode 100644 index c0115e7..0000000 --- a/src/store/action.js +++ /dev/null @@ -1,40 +0,0 @@ -import * as user from './action-type' - -// 灞曞紑鍚堝苟鑿滃崟鏍� -export const toggleCollapse = (collapse) => { - return { - type: user.Toggle_COLLAPSE, - collapse - } -} - -// 鍒濆鍖栬彍鍗曚俊鎭� -export const modifyMenuTree = (menuTree) => { - return { - type: user.MODIFY_MENUTREE, - menuTree - } -} - -// 鍒囨崲涓昏彍鍗� -export const modifyMainMenu = (mainMenu) => { - return { - type: user.MODIFY_MAINMENU, - mainMenu - } -} - -// 閲嶇疆缂栬緫绾у埆 -export const resetEditLevel = (editLevel) => { - return { - type: user.RESET_EDITLEVEL, - editLevel - } -} - -// 閫�鍑洪噸缃� -export const logout = () => { - return { - type: user.LOGOUT - } -} \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js deleted file mode 100644 index 4407580..0000000 --- a/src/store/index.js +++ /dev/null @@ -1,10 +0,0 @@ -import {createStore, applyMiddleware} from 'redux' -import userReducer from './reducer' -import thunk from 'redux-thunk' - -let store = createStore( - userReducer, - applyMiddleware(thunk) -) - -export default store \ No newline at end of file diff --git a/src/store/reducer.js b/src/store/reducer.js deleted file mode 100644 index b33716d..0000000 --- a/src/store/reducer.js +++ /dev/null @@ -1,50 +0,0 @@ -import * as Type from './action-type' - -let _mainMenu = null -let _collapse = localStorage.getItem('collapse') === 'true' - -let defaultState = { - menuTree: null, // 鑿滃崟缁撴瀯鏍� - mainMenu: _mainMenu, // 宸查�変富鑿滃崟 - collapse: _collapse, // 鏄惁鏀惰捣渚ц竟鏍忓鑸� - editLevel: null, // 缂栬緫鑿滃崟绾у埆锛屽�间负level1銆乴evel2銆乴evel3銆丠S -} - -// 鐢ㄦ埛娑堟伅 -export default (state = defaultState, action = {}) => { - switch (action.type) { - case Type.Toggle_COLLAPSE: - // 鍒囨崲鑿滃崟鏍忓睍寮�鍚堝苟鐘舵�� - return { - ...state, - collapse: action.collapse - } - case Type.MODIFY_MENUTREE: - // 鍒濆鍖栬彍鍗曚俊鎭� - return { - ...state, - menuTree: action.menuTree - } - case Type.MODIFY_MAINMENU: - // 鍒囨崲涓昏彍鍗� - return { - ...state, - mainMenu: action.mainMenu - } - case Type.RESET_EDITLEVEL: - // 閲嶇疆缂栬緫绾у埆 - return { - ...state, - editLevel: action.editLevel - } - case Type.LOGOUT: - return { - menuTree: null, - mainMenu: null, - collapse: localStorage.getItem('collapse') === 'true', - editLevel: null - } - default: - return state - } -} diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index 2dcd2c2..ed061cf 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -278,11 +278,11 @@ if (config.$cache && config.$time && config.wrap.autoExec) { Api.getLCacheConfig(config.uuid, config.$time).then(res => { - if (!res.valid) { - this.autoExec() - } else { - Api.writeCacheConfig(config.uuid, []) - } + if (res.valid) return + + this.autoExec() + + Api.writeCacheConfig(config.uuid, []) }) } else { this.autoExec() diff --git a/src/tabviews/home/index.jsx b/src/tabviews/home/index.jsx index a6a8a60..d91ecef 100644 --- a/src/tabviews/home/index.jsx +++ b/src/tabviews/home/index.jsx @@ -56,42 +56,36 @@ MenuID: this.props.MenuID } Api.getCacheConfig(_param).then(result => { - if (result.status) { - if (result.LongParam) { - let config = '' + let view = 'default' + if (result.status && result.LongParam) { + let config = '' - try { // 閰嶇疆淇℃伅瑙f瀽 - config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - } catch (e) { - console.warn('Parse Failure') - config = '' - } - - if (!config || !config.enabled) { - this.setState({ - loading: false, - waiting: false, - view: 'default' - }) - } else { - this.setState({ - loading: false, - view: 'custom' - }) - } - } else { - this.setState({ - loading: false, - waiting: false, - view: 'default' - }) + try { // 閰嶇疆淇℃伅瑙f瀽 + config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) + } catch (e) { + console.warn('Parse Failure') + config = '' } - } else { + + if (config && config.enabled) { + view = 'custom' + } + } + + if (view === 'default') { this.setState({ loading: false, waiting: false, view: 'default' }) + } else { + this.setState({ + loading: false, + view: 'custom' + }) + } + + if (!result.status) { notification.warning({ top: 92, message: result.message, diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index cca0591..d125630 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -882,7 +882,7 @@ if (!res.status) { notification.warning({ top: 92, - message: res.message, + message: res.message || '鎵ц澶辫触锛�', duration: 5 }) @@ -890,9 +890,11 @@ return } + let refresh = !/@no_target_menu@/i.test(res.message) + this.setState({loading: false}) - if (pageId) { + if (pageId && refresh) { localStorage.setItem('menuUpdate', new Date().getTime() + ',' + pageId + ',menu') } diff --git a/src/views/design/header/index.jsx b/src/views/design/header/index.jsx index 500dcba..3fe5ad4 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' @@ -43,7 +36,6 @@ content: '', onOk() { sessionStorage.clear() - _this.props.logout() _this.props.history.replace('/login') }, onCancel() {} @@ -543,21 +535,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 diff --git a/src/views/design/index.jsx b/src/views/design/index.jsx index d357a7f..a616714 100644 --- a/src/views/design/index.jsx +++ b/src/views/design/index.jsx @@ -1,19 +1,23 @@ import React, {Component} from 'react' import { withRouter } from 'react-router-dom' import { ConfigProvider } from 'antd' -import enUS from 'antd/es/locale/en_US' +// import enUS from 'antd/es/locale/en_US' import zhCN from 'antd/es/locale/zh_CN' import Header from './header' -import { setGLOBFuncs } from '@/utils/utils.js' import Sidemenu from './sidemenu' +import { setGLOBFuncs } from '@/utils/utils.js' import '@/assets/css/design.scss' import './index.scss' -const _locale = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS - class Design extends Component { + state = { + editLevel: false, + mainMenu: null, + menuTree: [] + } + componentDidMount() { if (sessionStorage.getItem('isEditState') === 'true') { sessionStorage.removeItem('isEditState') @@ -27,13 +31,27 @@ setGLOBFuncs() } } + + resetEditLevel = (level) => { + this.setState({editLevel: level}) + } + + modifyMenuTree = (menulist) => { + this.setState({menuTree: menulist}) + } + + modifyMainMenu = (menu) => { + this.setState({mainMenu: menu}) + } render () { + const { editLevel, menuTree, mainMenu } = this.state + return ( <div className={'mk-main-view ' + (window.GLOB.systemType || '')}> - <ConfigProvider locale={_locale}> - <Sidemenu key="sidemenu"/> - <Header key="header"/> + <ConfigProvider locale={zhCN}> + <Sidemenu key="sidemenu" editLevel={editLevel} menuTree={menuTree} mainMenu={mainMenu} resetEditLevel={this.resetEditLevel}/> + <Header key="header" editLevel={editLevel} mainMenu={mainMenu} resetEditLevel={this.resetEditLevel} modifyMenuTree={this.modifyMenuTree} modifyMainMenu={this.modifyMainMenu}/> </ConfigProvider> </div> ) diff --git a/src/views/design/sidemenu/editthdmenu/index.jsx b/src/views/design/sidemenu/editthdmenu/index.jsx index 28e78e7..2402f75 100644 --- a/src/views/design/sidemenu/editthdmenu/index.jsx +++ b/src/views/design/sidemenu/editthdmenu/index.jsx @@ -1,7 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { connect } from 'react-redux' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' import { notification, Modal, Button } from 'antd' @@ -21,6 +20,7 @@ class EditMenu extends Component { static propTpyes = { + menuTree: PropTypes.array, // 鑿滃崟鏍� menulist: PropTypes.any, // 涓夌骇鑿滃崟鍒楄〃 exitEdit: PropTypes.func, // 閫�鍑虹紪杈戠姸鎬� supMenu: PropTypes.object, // 瀵瑰簲鐨勪笂绾ц彍鍗� @@ -117,7 +117,7 @@ } else if (_menu.PageParam.Template === 'BaseTable') { sessionStorage.setItem('menuTree', JSON.stringify(this.props.menuTree)) let _param = window.btoa(window.encodeURIComponent(JSON.stringify(_menu))) - + window.open(`#/tabledesign/${_param}`) } else if (_menu.PageParam.Template === 'CustomPage') { let _param = { @@ -304,14 +304,4 @@ } } -const mapStateToProps = (state) => { - return { - menuTree: state.menuTree - } -} - -const mapDispatchToProps = () => { - return {} -} - -export default connect(mapStateToProps, mapDispatchToProps)(EditMenu) \ No newline at end of file +export default EditMenu \ No newline at end of file diff --git a/src/views/design/sidemenu/index.jsx b/src/views/design/sidemenu/index.jsx index 5874b6d..3e07e00 100644 --- a/src/views/design/sidemenu/index.jsx +++ b/src/views/design/sidemenu/index.jsx @@ -1,12 +1,10 @@ import React, {Component} from 'react' -import { connect } from 'react-redux' import { is, fromJS } from 'immutable' import { Menu, Popover, Modal, notification } from 'antd' import { EditOutlined, PlusOutlined, SettingOutlined } from '@ant-design/icons' import moment from 'moment' import asyncComponent from '@/utils/asyncComponent' -import { resetEditLevel } from '@/store/action' import Utils from '@/utils/utils.js' import Api from '@/api' import MKEmitter from '@/utils/events.js' @@ -349,6 +347,7 @@ menulist={this.state.editMenu.children} supMenuList={mainMenu.children} supMenu={this.state.editMenu} + menuTree={this.props.menuTree} exitEdit={this.exitEdit} /> : null } @@ -386,18 +385,4 @@ } } -const mapStateToProps = (state) => { - return { - mainMenu: state.mainMenu, - menuTree: state.menuTree, - editLevel: state.editLevel - } -} - -const mapDispatchToProps = (dispatch) => { - return { - resetEditLevel: (level) => dispatch(resetEditLevel(level)) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(Sidemenu) \ No newline at end of file +export default Sidemenu \ No newline at end of file diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index 335bac1..4250869 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -930,7 +930,6 @@ </div> <div className="login-middle" style={lineColor ? {borderColor: lineColor} : {}}> {loginWays ? <LoginForm - platName={this.state.platName} dict={this.state.dict} auth={this.state.auth} authError={this.state.authError} diff --git a/src/views/login/loginform.jsx b/src/views/login/loginform.jsx index 3f5ea61..4fdab93 100644 --- a/src/views/login/loginform.jsx +++ b/src/views/login/loginform.jsx @@ -27,8 +27,7 @@ touristLogin: PropTypes.bool, lang: PropTypes.string, langList: PropTypes.array, - loginWays: PropTypes.array, - platName: PropTypes.string + loginWays: PropTypes.array } state = { diff --git a/src/views/menudesign/printmenuform/index.jsx b/src/views/menudesign/printmenuform/index.jsx index 09dfdf1..315cbe0 100644 --- a/src/views/menudesign/printmenuform/index.jsx +++ b/src/views/menudesign/printmenuform/index.jsx @@ -231,7 +231,12 @@ </Form.Item> </Col> {config.callback === 'true' ? <Col span={24}> - <Form.Item label="鍥炶皟鍑芥暟"> + <Form.Item label={ + <Tooltip placement="topLeft" title="鍥炶皟鍑芥暟鎵ц鎴愬姛鍚庨粯璁や細鍒锋柊婧愯彍鍗曢〉锛岃繑鍥炰俊鎭紙@retmsg锛変腑鍚湁锛園no_target_menu@锛夊彲闃绘姝ら」鍒锋柊銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鍥炶皟鍑芥暟 + </Tooltip> + }> s_print_proc <EditOutlined style={{cursor: 'pointer'}} onClick={() => {window.open('#/proc/s_print_proc')}}/> </Form.Item> </Col> : null} -- Gitblit v1.8.0