| | |
| | | webSite: window.GLOB.webSite || '', |
| | | langList: [], |
| | | syncApp: false, |
| | | loginWays: null, |
| | | touristLogin: false, |
| | | syncing: false |
| | | } |
| | | |
| | |
| | | this.setState({ |
| | | isDisabled: true |
| | | }) |
| | | |
| | | if (res.type === 'uname_pwd') { |
| | | this.loginsubmit(res) |
| | | } else if (res.type === 'sms_vcode') { |
| | | this.phoneloginsubmit(res) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | async phoneloginsubmit (param) { |
| | | if (options.sysType === 'local' && !window.GLOB.mainSystemApi) { // 业务系统必须设置单点地址 |
| | | Modal.warning({ |
| | | title: '未设置单点服务器地址,请联系管理员!' |
| | | }) |
| | | return |
| | | } |
| | | |
| | | // 登录提交 |
| | | let res = await Api.getphoneusermsg(param.phone, param.vercode) |
| | | if (res.status) { |
| | | sessionStorage.setItem('UserID', res.UserID) |
| | | sessionStorage.setItem('LoginUID', res.LoginUID) |
| | | sessionStorage.setItem('User_Name', res.UserName) |
| | | sessionStorage.setItem('Full_Name', res.FullName) |
| | | sessionStorage.setItem('avatar', res.icon || '') |
| | | |
| | | localStorage.setItem('lang', param.lang || 'zh-CN') |
| | | |
| | | if (this.props.location.state && this.props.location.state.from.pathname) { |
| | | // 查看是否为其他页面跳转,路径存在时,跳回原页面 |
| | | this.props.history.replace(this.props.location.state.from.pathname) |
| | | } else { |
| | | this.props.history.replace('/main') |
| | | } |
| | | } else if (res.ErrCode === 'Need_Get_Appkey' && options.sysType === 'SSO') { |
| | | message.warning('应用尚未创建,请向云端同步应用!') |
| | | |
| | | this.setState({ |
| | | isDisabled: false, |
| | | syncApp: true |
| | | }) |
| | | } else { |
| | | message.warning(res.message) |
| | | this.setState({ |
| | | isDisabled: false |
| | | }) |
| | | } |
| | | } |
| | | |
| | | componentDidMount () { |
| | | let timeStamp = new Date().getTime() |
| | | let _appId = window.GLOB.appId |
| | |
| | | let str = md5('MK19' + _appId + timeStamp) |
| | | |
| | | let param = { |
| | | rduri: 'http://minkesoft.com/mksepc/webapi/dostar', |
| | | rduri: 'http://minkesoft.com/mksepc/webapi/dostars', |
| | | func: 'sEmpowerCloud_Get_LinkUrl', |
| | | AppID: _appId, |
| | | TimeStamp: timeStamp |
| | | TimeStamp: timeStamp, |
| | | userid: 'bh0bapabtd45epsgra79segbch6c1ibk', |
| | | LoginUID: 'bh0bapabtd45epsgra79segbch6c1ibk' |
| | | } |
| | | |
| | | Api.dostarInterface(param).then(res => { |
| | | Api.dostarToDostars(param).then(res => { |
| | | if (res.status) { |
| | | if (res.EPC === str) { |
| | | let box = [] |
| | |
| | | }) |
| | | } |
| | | |
| | | Api.getTouristMsg().then(result => { |
| | | if (result.status) { |
| | | if (!sessionStorage.getItem('UserID') && result.UserID) { |
| | | sessionStorage.setItem('UserID', result.UserID) |
| | | } |
| | | if (!sessionStorage.getItem('LoginUID') && result.LoginUID) { |
| | | sessionStorage.setItem('LoginUID', result.LoginUID) |
| | | } |
| | | |
| | | if (result.UserID && result.LoginUID) { |
| | | this.setState({touristLogin: true}) |
| | | } |
| | | |
| | | // 获取系统信息 |
| | | let _param = { |
| | | func: 's_Get_style', |
| | | Appkey: window.GLOB.appkey || '', |
| | | TypeCharOne: 'PC', |
| | | LText: `select '${window.GLOB.appkey}'`, |
| | | } |
| | |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) |
| | | |
| | | if (window.GLOB.mainSystemApi) { |
| | | _param.rduri = window.GLOB.mainSystemApi.replace('dostars', 'dostar') |
| | | } |
| | | |
| | | Api.dostarInterface(_param).then(res => { |
| | | Api.getSystemConfig(_param).then(res => { |
| | | if (res.status) { |
| | | let _url = window.location.href.split('#')[0] + 'system' |
| | | let systemMsg = { |
| | |
| | | localStorage.removeItem(_url) |
| | | } |
| | | |
| | | let _loginurl = window.location.href.split('#')[0] + 'loginways' |
| | | let login_ways = [] |
| | | let login_types = [] |
| | | if (res.login_ways && res.login_ways.length > 0) { |
| | | res.login_ways.forEach(item => { |
| | | // 短信验证码登录,必须设置短信Id |
| | | if (item.way_no === 'sms_vcode' && !item.sms_id) return |
| | | if (login_types.includes(item.way_no)) return |
| | | |
| | | login_types.push(item.way_no) |
| | | |
| | | login_ways.push({ |
| | | label: item.way_name, |
| | | type: item.way_no, |
| | | smsId: item.sms_id |
| | | }) |
| | | }) |
| | | } else { |
| | | login_ways.push({ |
| | | label: '账号密码登录', |
| | | type: 'uname_pwd', |
| | | smsId: '' |
| | | }) |
| | | } |
| | | |
| | | try { |
| | | localStorage.setItem(_loginurl, window.btoa(window.encodeURIComponent(JSON.stringify(login_ways)))) |
| | | } catch { |
| | | localStorage.removeItem(_loginurl) |
| | | } |
| | | |
| | | this.setState({ |
| | | loginWays: login_ways, |
| | | langList: res.lang_data || [], |
| | | ...systemMsg |
| | | }) |
| | |
| | | message.warning(res.message) |
| | | } |
| | | }) |
| | | } else { |
| | | message.warning(result.message) |
| | | } |
| | | }) |
| | | |
| | | let loginWays = localStorage.getItem(window.location.href.split('#')[0] + 'loginways') |
| | | if (loginWays) { |
| | | try { |
| | | loginWays = JSON.parse(window.decodeURIComponent(window.atob(loginWays))) |
| | | } catch { |
| | | localStorage.removeItem(window.location.href.split('#')[0] + 'loginways') |
| | | } |
| | | |
| | | if (loginWays) { |
| | | this.setState({ |
| | | loginWays: loginWays |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | syncSubmit = () => { |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { lineColor, bgImage, loginlogo, copyRight, webSite, ICP } = this.state |
| | | const { lineColor, bgImage, loginlogo, copyRight, webSite, ICP, loginWays, touristLogin } = this.state |
| | | |
| | | return ( |
| | | <div className="login-container" style={bgImage ? {backgroundImage: 'url(' + bgImage + ')'} : {}}> |
| | |
| | | {loginlogo ? <img src={loginlogo} alt=""/> : null} |
| | | </div> |
| | | <div className="login-middle" style={lineColor ? {borderColor: lineColor} : {}}> |
| | | <LoginForm |
| | | {loginWays ? <LoginForm |
| | | platName={this.state.platName} |
| | | dict={this.state.dict} |
| | | auth={this.state.auth} |
| | | touristLogin={touristLogin} |
| | | loginWays={loginWays} |
| | | lang={this.state.selectedlang} |
| | | langList={this.state.langList} |
| | | isDisabled={this.state.isDisabled} |
| | | changelang={(value) => this.changelang(value)} |
| | | handleSubmit={() => this.handleSubmit()} |
| | | wrappedComponentRef={(inst) => this.loginformRef = inst} |
| | | /> |
| | | /> : null} |
| | | </div> |
| | | <div className="login-bottom"> |
| | | {webSite && copyRight ? |