From 48a18736c461ad730bd264b0ac7b40b68a0e33a1 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 28 六月 2020 20:30:20 +0800 Subject: [PATCH] 2020-06-28 --- src/views/login/index.jsx | 94 +++++++++++++++++++++++++++-------------------- 1 files changed, 54 insertions(+), 40 deletions(-) diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index fa3842f..b6cf556 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -1,20 +1,21 @@ -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 = { @@ -22,15 +23,14 @@ 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 } @@ -58,7 +58,7 @@ } async loginsubmit (param) { - if (options.systemType === 'local' && !window.GLOB.mainSystemApi) { // 涓氬姟绯荤粺蹇呴』璁剧疆鍗曠偣鍦板潃 + if (options.sysType === 'local' && !window.GLOB.mainSystemApi) { // 涓氬姟绯荤粺蹇呴』璁剧疆鍗曠偣鍦板潃 Modal.warning({ title: '鏈缃崟鐐规湇鍔″櫒鍦板潃锛岃鑱旂郴绠$悊鍛橈紒' }) @@ -91,7 +91,7 @@ } 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({ @@ -110,8 +110,8 @@ 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) @@ -187,8 +187,12 @@ 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)))) @@ -210,6 +214,13 @@ 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) } @@ -225,7 +236,7 @@ func: 's_get_app_from_cloud', UserName: '', Password: '', - systemType: options.systemType, + systemType: options.sysType, Type: 'X', debug: 'Y' } @@ -252,6 +263,10 @@ 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('搴旂敤鍒涘缓鎴愬姛銆�') @@ -277,6 +292,15 @@ }) } + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 + */ + componentWillUnmount () { + this.setState = () => { + return + } + } + render () { const { lineColor, bgImage, loginlogo, copyRight, webSite, ICP } = this.state @@ -295,7 +319,6 @@ isDisabled={this.state.isDisabled} changelang={(value) => this.changelang(value)} handleSubmit={() => this.handleSubmit()} - handleloaded={() => {this.setState({loaded: true})}} wrappedComponentRef={(inst) => this.loginformRef = inst} /> </div> @@ -321,28 +344,19 @@ > <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 \ No newline at end of file +const mapStateToProps = () => { + return {} +} + +const mapDispatchToProps = (dispatch) => { + return { + modifyMemberLevel: (memberLevel) => dispatch(modifyMemberLevel(memberLevel)) + } +} + +export default connect(mapStateToProps, mapDispatchToProps)(Login) \ No newline at end of file -- Gitblit v1.8.0