| | |
| | | import { withRouter } from 'react-router' |
| | | import { is, fromJS } from 'immutable' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { ConfigProvider, notification, Modal, Collapse, Switch, Button, message, Spin, Typography } from 'antd' |
| | | import { notification, Modal, Collapse, Switch, Button, message, Spin, Typography } from 'antd' |
| | | import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, ArrowLeftOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import Utils, { setGLOBFuncs } from '@/utils/utils.js' |
| | | import { getTables, getFuncsAndInters } from '@/utils/utils-custom.js' |
| | | import antdZhCN from 'antd/es/locale/zh_CN' |
| | | import Utils from '@/utils/utils.js' |
| | | import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MenuUtils from '@/utils/utils-custom.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | eyeopen: false, |
| | | view: '', |
| | | popConfig: null, |
| | | needUpdate: false |
| | | needUpdate: false, |
| | | appLoginId: '', |
| | | appHomeId: '' |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | |
| | | try { |
| | | let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) |
| | | |
| | | if (param.lang) { |
| | | sessionStorage.setItem('lang', param.lang) |
| | | } |
| | | |
| | | if (param.type === 'app') { |
| | | sessionStorage.setItem('appId', param.ID || '') |
| | | sessionStorage.setItem('appName', param.remark || '') |
| | | sessionStorage.setItem('lang', param.lang || 'zh-CN') |
| | | sessionStorage.setItem('kei_no', param.kei_no || '') |
| | | sessionStorage.setItem('sysBgColor', param.sysBgColor || '#ffffff') |
| | | |
| | | if (param.applangList) { |
| | | sessionStorage.setItem('applangList', param.applangList) |
| | | } else { |
| | | sessionStorage.removeItem('applangList') |
| | | } |
| | | |
| | | if (param.wxAppId) { |
| | | sessionStorage.setItem('wxAppId', param.wxAppId) |
| | | } |
| | | |
| | | this.getAppMessage(param.MenuID) |
| | | } else if (param.type === 'view') { |
| | | let appLoginId = '' |
| | | let appHomeId = '' |
| | | if (sessionStorage.getItem('appViewList')) { |
| | | try { |
| | | let appMenus = JSON.parse(sessionStorage.getItem('appViewList')) |
| | | appMenus.forEach(item => { |
| | | if (item.keys_type === 'login') { |
| | | appLoginId = item.keys_id |
| | | } else if (item.keys_type === 'index') { |
| | | appHomeId = item.keys_id |
| | | } |
| | | }) |
| | | } catch (e) { |
| | | |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | MenuId: param.MenuID |
| | | MenuId: param.MenuID, |
| | | appLoginId: appLoginId, |
| | | appHomeId: appHomeId |
| | | }, () => { |
| | | this.getMenuParam(param) |
| | | }) |
| | |
| | | MKEmitter.addListener('changeEditMenu', this.changeEditMenu) |
| | | MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) |
| | | |
| | | if (sessionStorage.getItem('wxAppId')) { |
| | | window.GLOB.WXAppID = sessionStorage.getItem('wxAppId') |
| | | } |
| | | |
| | | setTimeout(() => { |
| | | this.getRoleFields() |
| | | setGLOBFuncs() |
| | | // setGLOBFuncs() |
| | | }, 1000) |
| | | |
| | | document.onkeydown = (event) => { |
| | |
| | | MenuID: menu.MenuID, |
| | | copyMenuId: menu.copyMenuId || '', |
| | | clearMenu: menu.clearMenu !== 'false', |
| | | type: 'view' |
| | | type: 'view', |
| | | lang: sessionStorage.getItem('lang') |
| | | } |
| | | |
| | | // param.MenuNo = menu.MenuNo || '' |
| | |
| | | }) |
| | | } else { |
| | | sessionStorage.setItem('appViewList', JSON.stringify(appViewList)) |
| | | this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: homeId, type: 'view'})))) |
| | | this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: homeId, type: 'view', lang: sessionStorage.getItem('lang')})))) |
| | | } |
| | | }) |
| | | } else { |
| | | sessionStorage.setItem('appViewList', JSON.stringify(appViewList)) |
| | | this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: MenuID || homeId, type: 'view'})))) |
| | | this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: MenuID || homeId, type: 'view', lang: sessionStorage.getItem('lang')})))) |
| | | } |
| | | }) |
| | | } |
| | |
| | | if (!this.checkBase()) { |
| | | return |
| | | } else if (this.checklog()) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '当前配置未修改,无需保存。', |
| | | duration: 5 |
| | | }) |
| | | MKEmitter.emit('completeSave') |
| | | return |
| | | if (sessionStorage.getItem('applangList') && !config.trans) { |
| | | |
| | | } else { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '当前配置未修改,无需保存。', |
| | | duration: 5 |
| | | }) |
| | | MKEmitter.emit('completeSave') |
| | | return |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | |
| | | let interfaces = getFuncsAndInters(config) |
| | | roleParam.interfaces = interfaces |
| | | let langSql = getLangTrans(config) |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | |
| | | debug_md5: key, |
| | | debug_url: url, |
| | | debug_list: window.btoa(tbs) |
| | | } |
| | | |
| | | if (langSql) { |
| | | param.lang_translation = window.btoa(window.encodeURIComponent(langSql)) |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | const that = this |
| | | |
| | | confirm({ |
| | | title: '确定设置本页面为首页吗?', |
| | | content: '', |
| | |
| | | }) |
| | | } else { |
| | | sessionStorage.setItem('appViewList', JSON.stringify(appViewList)) |
| | | |
| | | that.setState({ |
| | | appHomeId: config.MenuID |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | let hasLogin = config.components.findIndex(item => item.type === 'login') > -1 |
| | | const that = this |
| | | |
| | | confirm({ |
| | | title: '确定设置本页面为登录页吗?', |
| | |
| | | }) |
| | | } else { |
| | | sessionStorage.setItem('appViewList', JSON.stringify(appViewList)) |
| | | |
| | | that.setState({ |
| | | appLoginId: config.MenuID |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { view, loading, comloading, activeKey, settingshow, controlshow, MenuId, config, menuloading, eyeopen, needUpdate } = this.state |
| | | const { view, loading, comloading, activeKey, settingshow, controlshow, MenuId, config, menuloading, eyeopen, needUpdate, appLoginId, appHomeId } = this.state |
| | | |
| | | return ( |
| | | <ConfigProvider locale={antdZhCN}> |
| | | <> |
| | | <DndProvider backend={HTML5Backend}> |
| | | {view !== 'popview' ? <div className={'mk-pc-view '} id="mk-pc-design-view"> |
| | | {loading ? <Spin className="view-spin" size="large" /> : null} |
| | |
| | | <PictureController/> |
| | | <Quotecomponent config={config} updateConfig={this.updateConfig}/> |
| | | <StyleCombControlButton menu={config} /> |
| | | <Button className="mk-border-green" onClick={this.setHomeView}><HomeOutlined /> 设为首页</Button> |
| | | <Button className="mk-border-purple" onClick={this.setLoginView}><LoginOutlined/> 设为登录页</Button> |
| | | <Button className="mk-border-green" disabled={MenuId === appHomeId} onClick={this.setHomeView}><HomeOutlined /> 设为首页</Button> |
| | | <Button className="mk-border-purple" disabled={MenuId === appLoginId} onClick={this.setLoginView}><LoginOutlined/> 设为登录页</Button> |
| | | <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> |
| | | <Transfer MenuID={MenuId} /> |
| | | {config ? <Versions MenuId={MenuId} Template="webPage" checklog={this.checklog} updateConfig={this.updateLogConfig}/> : null} |
| | |
| | | <StyleController /> |
| | | <StyleCombController /> |
| | | <ModalController /> |
| | | </ConfigProvider> |
| | | </> |
| | | ) |
| | | } |
| | | } |