| | |
| | | import React, {Component} from 'react' |
| | | import React, { Component } from 'react' |
| | | import { message, Modal } from 'antd' |
| | | import { connect } from 'react-redux' |
| | | import md5 from 'md5' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import zhCN from '@/locales/zh-CN/login.js' |
| | | import enUS from '@/locales/en-US/login.js' |
| | | import options from '@/store/options.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncLoadComponent from '@/utils/asyncLoadComponent' |
| | | import { modifyMemberLevel } from '@/store/action' |
| | | import './index.scss' |
| | | |
| | | const LoginForm = asyncLoadComponent(() => import('./loginform')) |
| | | const LoginCloudForm = asyncLoadComponent(() => import('./logincloudform')) |
| | | const Action = asyncComponent(() => import('@/tabviews/zshare/actionList')) |
| | | const iszhCN = !localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN' |
| | | const iszhCN = localStorage.getItem('lang') !== 'en-US' |
| | | |
| | | class Login extends Component { |
| | | state = { |
| | |
| | | dict: iszhCN ? zhCN : enUS, |
| | | isDisabled: false, |
| | | auth: false, |
| | | loginlogo: window.GLOB.loginlogo, |
| | | bgImage: window.GLOB.bgImage, |
| | | platName: window.GLOB.platName, |
| | | copyRight: window.GLOB.copyRight, |
| | | ICP: window.GLOB.ICP, |
| | | lineColor: window.GLOB.lineColor, |
| | | webSite: window.GLOB.webSite, |
| | | loginlogo: window.GLOB.loginlogo || '', |
| | | bgImage: window.GLOB.bgImage || '', |
| | | platName: window.GLOB.platName || '', |
| | | copyRight: window.GLOB.copyRight || '', |
| | | ICP: window.GLOB.ICP || '', |
| | | lineColor: window.GLOB.lineColor || '', |
| | | webSite: window.GLOB.webSite || '', |
| | | langList: [], |
| | | loaded: false, |
| | | syncApp: false, |
| | | syncing: false |
| | | } |
| | |
| | | } |
| | | |
| | | async loginsubmit (param) { |
| | | if (options.systemType === 'local' && !window.GLOB.mainSystemApi) { // 业务系统必须设置单点地址 |
| | | if (options.sysType === 'local' && !window.GLOB.mainSystemApi) { // 业务系统必须设置单点地址 |
| | | Modal.warning({ |
| | | title: '未设置单点服务器地址,请联系管理员!' |
| | | }) |
| | |
| | | } else { |
| | | this.props.history.replace('/main') |
| | | } |
| | | } else if (res.ErrCode === 'Need_Get_Appkey' && options.systemType === 'SSO') { |
| | | } else if (res.ErrCode === 'Need_Get_Appkey' && options.sysType === 'SSO') { |
| | | message.warning('应用尚未创建,请向云端同步应用!') |
| | | |
| | | this.setState({ |
| | |
| | | let timeStamp = new Date().getTime() |
| | | let _appId = window.GLOB.appId |
| | | |
| | | if (options.systemType === 'cloud') { // 云端使用系统配置appid |
| | | _appId = options.AppId |
| | | if (options.sysType === 'cloud') { // 云端使用系统配置appid |
| | | _appId = options.caId |
| | | } |
| | | |
| | | let str = md5('MK19' + _appId + timeStamp) |
| | |
| | | ICP: res.ICP || '', |
| | | mainlogo: res.indexlogo || '', |
| | | doclogo: res.doclogo || '', |
| | | style: res.CSS || '', |
| | | webSite: res.WebSite || '' |
| | | } |
| | | |
| | | // url标题 |
| | | document.title = systemMsg.platTitle |
| | | |
| | | try { |
| | | localStorage.setItem(_url, window.btoa(window.encodeURIComponent(JSON.stringify(systemMsg)))) |
| | |
| | | link.href = res.titlelogo |
| | | document.getElementsByTagName('head')[0].appendChild(link) |
| | | } |
| | | |
| | | let memberLevel = res.member_level |
| | | |
| | | if (typeof(memberLevel) === 'number' && memberLevel > 10 && parseInt(memberLevel / 10) * 10 === memberLevel) { |
| | | sessionStorage.setItem('Member_Level', md5('mksoft' + moment().format('YYYYMM') + memberLevel)) |
| | | this.props.modifyMemberLevel(memberLevel) |
| | | } |
| | | } else { |
| | | message.warning(res.message) |
| | | } |
| | |
| | | func: 's_get_app_from_cloud', |
| | | UserName: '', |
| | | Password: '', |
| | | systemType: options.systemType, |
| | | systemType: options.sysType, |
| | | Type: 'X', |
| | | debug: 'Y' |
| | | } |
| | |
| | | Appkey: window.GLOB.appkey || '' |
| | | } |
| | | |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | _param.secretkey = Utils.encrypt(_param.LTextOut, _param.timestamp) |
| | | _param.open_key = Utils.encrypt(_param.secretkey, _param.timestamp, true) |
| | | |
| | | Api.dostarInterface(_param).then(response => { |
| | | if (response.status) { |
| | | message.success('应用创建成功。') |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | render () { |
| | | const { lineColor, bgImage, loginlogo, copyRight, webSite, ICP } = this.state |
| | | |
| | |
| | | isDisabled={this.state.isDisabled} |
| | | changelang={(value) => this.changelang(value)} |
| | | handleSubmit={() => this.handleSubmit()} |
| | | handleloaded={() => {this.setState({loaded: true})}} |
| | | wrappedComponentRef={(inst) => this.loginformRef = inst} |
| | | /> |
| | | </div> |
| | |
| | | > |
| | | <LoginCloudForm handleSubmit={() => this.syncSubmit()} wrappedComponentRef={(inst) => this.logincloudRef = inst}/> |
| | | </Modal> |
| | | {this.state.loaded ? <div style={{position: 'fixed', bottom: '-300px'}}> |
| | | <Action |
| | | BID="" |
| | | type="" |
| | | menuType="" |
| | | setting={{}} |
| | | actions={[]} |
| | | triggerBtn={{}} |
| | | dict={{}} |
| | | MenuID="" |
| | | permRoles={{}} |
| | | logcolumns={[]} |
| | | ContainerId="" |
| | | refreshdata={() => {}} |
| | | triggerPopview={() => {}} |
| | | getexceloutparam={() => {}} |
| | | gettableselected={() => {}} |
| | | /> |
| | | </div> : null} |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default Login |
| | | const mapStateToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | modifyMemberLevel: (memberLevel) => dispatch(modifyMemberLevel(memberLevel)) |
| | | } |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(Login) |