| | |
| | | import React, { Component } from 'react' |
| | | import { message, Modal, notification } from 'antd' |
| | | import { connect } from 'react-redux' |
| | | import { message, Modal } from 'antd' |
| | | import md5 from 'md5' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import options, { styles } from '@/store/options.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import { styles } from '@/store/options.js' |
| | | import zhCN from '@/locales/zh-CN/login.js' |
| | | import enUS from '@/locales/en-US/login.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 Resetpwd = asyncLoadComponent(() => import('@/components/header/resetpwd')) |
| | | const Resetpwd = asyncLoadComponent(() => import('@/components/resetPassword')) |
| | | const LoginCloudForm = asyncComponent(() => import('./logincloudform')) |
| | | const iszhCN = sessionStorage.getItem('lang') !== 'en-US' |
| | | |
| | | const _href = window.location.href.split('#')[0] |
| | | if (localStorage.getItem(_href + 'paramsmain')) { |
| | | sessionStorage.setItem('history', localStorage.getItem(_href + 'paramsmain')) |
| | | localStorage.removeItem(_href + 'paramsmain') |
| | | } |
| | | |
| | | class Login extends Component { |
| | | state = { |
| | |
| | | loginWays: null, |
| | | touristLogin: false, |
| | | syncing: false, |
| | | visible: false, |
| | | resetLoading: false |
| | | } |
| | | |
| | | changelang (item) { |
| | | // 切换语言 |
| | | this.setState({ |
| | | dict: item === 'zh-CN' ? zhCN : enUS |
| | | }) |
| | | } |
| | | |
| | | handleSubmit = () => { |
| | |
| | | * @param {Object} param 用户名密码等信息 |
| | | */ |
| | | async loginsubmit (param) { |
| | | let city = sessionStorage.getItem('city') || '' |
| | | let ipAddress = sessionStorage.getItem('ipAddress') || '' |
| | | |
| | | // 登录提交 |
| | | let res = await Api.getusermsg(param.username, param.password, false, ipAddress, city) |
| | | let res = await Api.getusermsg(param.username, param.password, false) |
| | | if (res.status) { |
| | | if (res.check_mob) { |
| | | let loginWays = this.state.loginWays.filter(item => item.type === 'sms_vcode') |
| | | |
| | | if (loginWays.length > 0) { |
| | | this.setState({loginWays: null, isDisabled: false}, () => { |
| | | this.setState({loginWays: loginWays}) |
| | | }) |
| | | Modal.warning({ |
| | | title: '为确认是您本人操作,请使用手机短信验证码进行身份认证', |
| | | okText: '知道了' |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | 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 || '') |
| | | sessionStorage.setItem('dataM', res.dataM ? 'true' : '') |
| | | sessionStorage.setItem('localDataM', res.dataM ? 'true' : '') |
| | | sessionStorage.setItem('debug', res.debug || '') |
| | | sessionStorage.setItem('role_id', res.role_id || '') |
| | | sessionStorage.setItem('departmentcode', res.departmentcode || '') |
| | | sessionStorage.setItem('organization', res.organization || '') |
| | | sessionStorage.setItem('localRole_id', res.role_id || '') |
| | | sessionStorage.setItem('mk_user_type', res.mk_user_type || '') |
| | | |
| | | if (res.paas_externalDatabase) { |
| | | sessionStorage.setItem('externalDatabase', res.paas_externalDatabase) |
| | | window.GLOB.externalDatabase = `[${res.paas_externalDatabase}]..` |
| | | } |
| | | |
| | | localStorage.setItem(_href + 'lang', param.lang || 'zh-CN') |
| | | sessionStorage.setItem('lang', param.lang || 'zh-CN') |
| | |
| | | sessionStorage.removeItem('visitorUserID') |
| | | sessionStorage.removeItem('visitorLoginUID') |
| | | |
| | | if (param.remember) { // 记住密码时账号密码存入localStorage |
| | | localStorage.setItem(_href, window.btoa(window.encodeURIComponent(JSON.stringify({username: param.username, password: param.password})))) |
| | | let users = localStorage.getItem(_href + 'users') |
| | | |
| | | if (users) { |
| | | try { |
| | | users = JSON.parse(window.decodeURIComponent(window.atob(users))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | users = [] |
| | | } |
| | | } else { |
| | | localStorage.removeItem(_href) |
| | | users = [] |
| | | } |
| | | |
| | | users = users.filter(item => item.username !== param.username) |
| | | |
| | | if (users.length > 4) { |
| | | users.length = 4 |
| | | } |
| | | |
| | | users.unshift({username: param.username, password: param.remember ? param.password : ''}) |
| | | |
| | | localStorage.setItem(_href + 'users', window.btoa(window.encodeURIComponent(JSON.stringify(users)))) |
| | | |
| | | let level = localStorage.getItem(_href + 'pwdlevel') |
| | | |
| | | if (level) { |
| | | if (level && process.env.NODE_ENV === 'production') { |
| | | let visible = false |
| | | let tip = '密码强度不够,请修改密码!' |
| | | if (param.password.length < 8) { |
| | | visible = true |
| | | } else if (level === 'letter_num' && /^([^0-9]*|[^a-zA-Z]*)$/.test(param.password)) { |
| | | visible = true |
| | | } else if ((level === 'char_num' || level === 'char_num_90') && /^([^0-9]*|[^a-zA-Z]*|[^!@#$%^&*()_]*)$/.test(param.password)) { |
| | | } else if ((level === 'char_num' || level === 'char_num_90' || level === 'char_num_90_sms') && /^([^0-9]*|[^a-zA-Z]*|[^!@#$%^&*()_]*)$/.test(param.password)) { |
| | | visible = true |
| | | } else if (level === 'char_num_90' && res.modifydate) { |
| | | } else if ((level === 'char_num_90' || level === 'char_num_90_sms') && res.modifydate) { |
| | | let s = (new Date().getTime() - new Date(res.modifydate).getTime()) / (1000 * 24 * 60 * 60) |
| | | if (!isNaN(s) && s > 90) { |
| | | visible = true |
| | |
| | | if (visible) { |
| | | message.warning(tip) |
| | | this.setState({ |
| | | isDisabled: false, |
| | | visible: true |
| | | isDisabled: false |
| | | }) |
| | | |
| | | MKEmitter.emit('resetpassword', () => { |
| | | const input = document.getElementById('password') |
| | | if (input) { |
| | | input.select() |
| | | } |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | let _history = sessionStorage.getItem('history') |
| | | if (_history) { |
| | | sessionStorage.removeItem('history') |
| | | // 查看是否为其他页面跳转,路径存在时,跳回原页面 |
| | | this.props.history.replace(_history) |
| | | let iframe = sessionStorage.getItem('iframe') |
| | | if (iframe) { |
| | | sessionStorage.removeItem('iframe') |
| | | this.props.history.replace(iframe.replace(/@loginuid@/, res.LoginUID)) |
| | | } else { |
| | | this.props.history.replace('/main') |
| | | } |
| | | } else if (res.ErrCode === 'Need_Get_Appkey' && options.sysType === 'SSO') { |
| | | } else if (res.ErrCode === 'Need_Get_Appkey' && window.GLOB.sysType === 'SSO') { |
| | | message.warning('应用尚未创建,请向云端同步应用!') |
| | | |
| | | this.setState({ |
| | |
| | | input.select() |
| | | } |
| | | } else if (res.message.indexOf('登录权限') > -1) { |
| | | const input = document.getElementById('username') |
| | | const wrap = document.getElementById('username') |
| | | const input = wrap ? wrap.getElementsByTagName('input')[0] : null |
| | | if (input) { |
| | | input.select() |
| | | } |
| | |
| | | } |
| | | |
| | | async phoneloginsubmit (param) { |
| | | let city = sessionStorage.getItem('city') || '' |
| | | let ipAddress = sessionStorage.getItem('ipAddress') || '' |
| | | |
| | | // 登录提交 |
| | | let res = await Api.getphoneusermsg(param.phone, param.vercode, false, ipAddress, city) |
| | | let res = await Api.getphoneusermsg(param.phone, param.vercode, false) |
| | | if (res.status) { |
| | | sessionStorage.setItem('UserID', res.UserID) |
| | | sessionStorage.setItem('LoginUID', res.LoginUID) |
| | |
| | | sessionStorage.setItem('Full_Name', res.FullName) |
| | | sessionStorage.setItem('avatar', res.icon || '') |
| | | sessionStorage.setItem('dataM', res.dataM ? 'true' : '') |
| | | sessionStorage.setItem('localDataM', res.dataM ? 'true' : '') |
| | | sessionStorage.setItem('debug', res.debug || '') |
| | | sessionStorage.setItem('role_id', res.role_id || '') |
| | | sessionStorage.setItem('departmentcode', res.departmentcode || '') |
| | | sessionStorage.setItem('organization', res.organization || '') |
| | | sessionStorage.setItem('localRole_id', res.role_id || '') |
| | | sessionStorage.setItem('mk_user_type', res.mk_user_type || '') |
| | | |
| | | if (res.paas_externalDatabase) { |
| | | sessionStorage.setItem('externalDatabase', res.paas_externalDatabase) |
| | | window.GLOB.externalDatabase = `[${res.paas_externalDatabase}]..` |
| | | } |
| | | |
| | | localStorage.setItem(_href + 'lang', param.lang || 'zh-CN') |
| | | sessionStorage.setItem('lang', param.lang || 'zh-CN') |
| | |
| | | sessionStorage.removeItem('visitorUserID') |
| | | sessionStorage.removeItem('visitorLoginUID') |
| | | |
| | | let _history = sessionStorage.getItem('history') |
| | | if (_history) { |
| | | sessionStorage.removeItem('history') |
| | | // 查看是否为其他页面跳转,路径存在时,跳回原页面 |
| | | this.props.history.replace(_history) |
| | | let iframe = sessionStorage.getItem('iframe') |
| | | if (iframe) { |
| | | sessionStorage.removeItem('iframe') |
| | | this.props.history.replace(iframe.replace(/@loginuid@/, res.LoginUID)) |
| | | } else { |
| | | this.props.history.replace('/main') |
| | | } |
| | | } else if (res.ErrCode === 'Need_Get_Appkey' && options.sysType === 'SSO') { |
| | | } else if (res.ErrCode === 'Need_Get_Appkey' && window.GLOB.sysType === 'SSO') { |
| | | message.warning('应用尚未创建,请向云端同步应用!') |
| | | |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | authLogin = (appid, openid, memberid, scanId) => { |
| | | Api.getTouristMsg(appid, openid, memberid, scanId).then(res => { |
| | | Api.getTouristMsg('mk', appid, openid, memberid, scanId).then(res => { |
| | | if (res.status) { |
| | | sessionStorage.setItem('UserID', res.UserID) |
| | | sessionStorage.setItem('LoginUID', res.LoginUID) |
| | |
| | | sessionStorage.setItem('Full_Name', res.FullName) |
| | | sessionStorage.setItem('avatar', res.icon || '') |
| | | sessionStorage.setItem('dataM', res.dataM ? 'true' : '') |
| | | sessionStorage.setItem('localDataM', res.dataM ? 'true' : '') |
| | | sessionStorage.setItem('debug', res.debug || '') |
| | | sessionStorage.setItem('role_id', res.role_id || '') |
| | | sessionStorage.setItem('departmentcode', res.departmentcode || '') |
| | | sessionStorage.setItem('organization', res.organization || '') |
| | | sessionStorage.setItem('localRole_id', res.role_id || '') |
| | | sessionStorage.setItem('mk_user_type', res.mk_user_type || '') |
| | | |
| | | if (res.paas_externalDatabase) { |
| | | sessionStorage.setItem('externalDatabase', res.paas_externalDatabase) |
| | | window.GLOB.externalDatabase = `[${res.paas_externalDatabase}]..` |
| | | } |
| | | |
| | | sessionStorage.removeItem('visitorUserID') |
| | | sessionStorage.removeItem('visitorLoginUID') |
| | | |
| | | let _history = sessionStorage.getItem('history') |
| | | if (_history) { |
| | | sessionStorage.removeItem('history') |
| | | // 查看是否为其他页面跳转,路径存在时,跳回原页面 |
| | | this.props.history.replace(_history) |
| | | let iframe = sessionStorage.getItem('iframe') |
| | | if (iframe) { |
| | | sessionStorage.removeItem('iframe') |
| | | this.props.history.replace(iframe.replace(/@loginuid@/, res.LoginUID)) |
| | | } else { |
| | | this.props.history.replace('/main') |
| | | } |
| | | } else if (res.ErrCode === 'Need_Get_Appkey' && options.sysType === 'SSO') { |
| | | } else if (res.ErrCode === 'Need_Get_Appkey' && window.GLOB.sysType === 'SSO') { |
| | | message.warning('应用尚未创建,请向云端同步应用!') |
| | | |
| | | this.setState({ |
| | |
| | | document.getElementsByTagName('head')[0].removeChild(JSONP) |
| | | },500) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | componentDidMount () { |
| | | // md5("/ws/location/v1/ip?callback=callbackFunction&key=key&output=jsonp secret key") |
| | | // md5("/ws/location/v1/ip?callback=callbackFunction&key=BA7BZ-4QB65-LFCIA-QPDA6-4G6O7-MJB4Q&output=jsonpuThL4ZM3XOj642ksEQh76tyHFjh4") |
| | | |
| | | // 获取ip及城市信息 |
| | | // let ipurl = window.atob('aHR0cHM6Ly9lcGMubWs5a$mkC5jbi93ZWJhcGkvaXBsb2M='.replace(/\$mk/ig, '')) |
| | | // Api.directRequest(ipurl, 'get', null, 'true').then(res => { |
| | | // if (!res || !res.ip) return |
| | | // sessionStorage.setItem('ipAddress', res.ip) |
| | | // }) |
| | | if (sessionStorage.getItem('loginError')) { |
| | | try { |
| | | let res = JSON.parse(sessionStorage.getItem('loginError')) |
| | | console.info(res.url) |
| | | console.info(res.request) |
| | | console.info(res.response) |
| | | setTimeout(() => { |
| | | Api.delCacheConfig() |
| | | }, 50) |
| | | |
| | | let result = JSON.parse(res.response) |
| | | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | } catch (e) {} |
| | | if (window.GLOB.filter) { |
| | | let view = document.getElementById('mk-login-view') |
| | | |
| | | setTimeout(() => { |
| | | sessionStorage.removeItem('loginError') |
| | | }, 2000) |
| | | if (view) { |
| | | view.style.filter = 'grayscale(100%)' |
| | | } |
| | | } |
| | | |
| | | const _addressUrl = _href + 'queryAddress' |
| | | |
| | | if (localStorage.getItem(_addressUrl) !== 'true') { |
| | | sessionStorage.setItem('city', '') |
| | | sessionStorage.setItem('ipAddress', '') |
| | | } else { |
| | | if (localStorage.getItem(_addressUrl) === 'true') { |
| | | this.queryAddress() |
| | | } |
| | | |
| | |
| | | authCode = authCode ? authCode.split(',') : [] |
| | | let index = authCode.findIndex(key => key === _s) |
| | | let license = false |
| | | let appkey = window.GLOB.localkey || window.GLOB.appkey |
| | | |
| | | if (window.GLOB.licenseKey) { |
| | | if (window.GLOB.licenseKey.length !== 20) { |
| | |
| | | okText: '知道了' |
| | | }) |
| | | } else { |
| | | let key = md5(window.GLOB.appId + 'minke_software' + window.GLOB.appkey).toUpperCase().substr(-6) |
| | | let key = md5(window.GLOB.appId + 'minke_software' + appkey).toUpperCase().substr(-6) |
| | | |
| | | let key1 = window.GLOB.licenseKey.substring(0, 6) |
| | | let key2 = window.GLOB.licenseKey.substring(6, 14) |
| | |
| | | let key4 = md5(key1 + key2).toUpperCase().substr(-6) |
| | | |
| | | if (key === key1 && key3 === key4) { |
| | | let last = window.GLOB.appkey[window.GLOB.appkey.length - 1] |
| | | let last = appkey[appkey.length - 1] |
| | | let offset = 0 |
| | | let keys = {} |
| | | |
| | |
| | | } |
| | | |
| | | if (!window.GLOB.licenseKey && (index === -1 || index > 5)) { |
| | | let _appId = window.GLOB.appId |
| | | |
| | | if (options.sysType === 'cloud') { // 云端使用系统配置appid |
| | | _appId = options.caId |
| | | } |
| | | |
| | | let str = md5('MK19' + _appId + timeStamp) |
| | | let str = md5('MK19' + window.GLOB.appId + timeStamp) |
| | | let _rduri = window.atob('aHR0cHM6Ly9lcGMubWs5aC5$mkjbi93ZWJhcGkvZG9zdGFycw=='.replace(/\$mk/ig, '')) |
| | | let _func = window.atob('c0VtcG93ZXJDbG91$mkZF9HZXRfTGlua1VybA=='.replace(/\$mk/ig, '')) |
| | | let _id = window.atob('YmgwYmFwYWJ0ZDQ1ZXBz$mkZ3JhNzlzZWdiY2g2YzFpYms='.replace(/\$mk/ig, '')) |
| | | |
| | | let param = { |
| | | func: _func, |
| | | AppID: _appId, |
| | | AppID: window.GLOB.appId, |
| | | TimeStamp: timeStamp, |
| | | appkey: window.GLOB.appkey, |
| | | appkey: appkey, |
| | | SessionUid: localStorage.getItem('SessionUid') || '', |
| | | userid: _id, |
| | | LoginUID: _id, |
| | | nonc: Utils.getuuid() |
| | |
| | | param.sign = md5(values) |
| | | param.t = new Date().getTime() |
| | | |
| | | Api.directRequest(_rduri + '/' + _func, 'post', param, 'true').then(res => { |
| | | Api.directRequest({ |
| | | url: _rduri + '/' + _func, |
| | | method: 'post', |
| | | data: JSON.stringify(param) |
| | | }).then(res => { |
| | | if (res.status) { |
| | | if (res.EPC === str) { |
| | | let box = [] |
| | |
| | | } |
| | | box = box.join(',') |
| | | localStorage.setItem(_authUrl, box) |
| | | |
| | | if (res.e_files === 'true') { |
| | | localStorage.setItem(_href + 'files', md5(_href + 'files')) |
| | | localStorage.setItem(_href + 'filesDate', res.e_files_end_date) |
| | | window.GLOB.storeFiles = true |
| | | window.GLOB.storeDate = Math.ceil((new Date(res.e_files_end_date).getTime() - new Date().getTime()) / 86400000) |
| | | } else { |
| | | localStorage.removeItem(_href + 'files') |
| | | window.GLOB.storeFiles = false |
| | | } |
| | | |
| | | this.setState({ |
| | | auth: true |
| | |
| | | } |
| | | } else { |
| | | localStorage.removeItem(_authUrl) |
| | | localStorage.removeItem(_href + 'files') |
| | | window.GLOB.storeFiles = false |
| | | |
| | | this.setState({ |
| | | auth: false |
| | | }) |
| | |
| | | authError: res.message |
| | | }) |
| | | } |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') { |
| | | let param = { |
| | | func: 's_visitor_login', |
| | | timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), |
| | | SessionUid: _id, |
| | | TypeCharOne: 'pc', |
| | | appkey: '202004041613277377A6A2456D34A4948AE84' |
| | | } |
| | | |
| | | param.LText = md5(window.btoa(_id + param.timestamp)) |
| | | param.secretkey = md5(param.LText + 'mingke' + param.timestamp) |
| | | |
| | | let params = { |
| | | url: _rduri.replace('dostars', 'dologon'), |
| | | method: 'post', |
| | | data: JSON.stringify(param) |
| | | } |
| | | |
| | | Api.directRequest(params) |
| | | |
| | | return |
| | | } |
| | | |
| | | if (index === -1 || index > 10) { |
| | | this.setState({ |
| | | auth: false, |
| | | authError: '网络错误导致系统授权失败,请联系管理员。' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | Api.getTouristMsg().then(result => { |
| | | if (result.status) { |
| | | // if (result.website && process.env.NODE_ENV === 'production') { |
| | | // let website = result.website.replace(/http(s)?:\/\/|\/$/ig, '').toLowerCase() |
| | | // let current = window.GLOB.baseurl.replace(/http(s)?:\/\/|\/$/ig, '').toLowerCase() |
| | | |
| | | // if (website !== current) { |
| | | // try { |
| | | // window.history.replaceState(null, null, result.website.replace(/\/$/ig, '') + '/admin/index.html#/login') |
| | | // window.location.reload() |
| | | // } catch(e) { |
| | | // window.location.href = result.website.replace(/\/$/ig, '') + '/admin/index.html#/login' |
| | | // } |
| | | // return |
| | | // } |
| | | // } |
| | | |
| | | sessionStorage.setItem('visitorUserID', result.UserID || '') |
| | | sessionStorage.setItem('visitorLoginUID', result.LoginUID || '') |
| | | |
| | |
| | | let _param = { |
| | | func: 's_Get_style', |
| | | TypeCharOne: 'PC', |
| | | LText: `select '${window.GLOB.appkey}'`, |
| | | LText: `select '${appkey}'`, |
| | | appkey: appkey |
| | | } |
| | | |
| | | _param.userid = result.UserID |
| | |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) |
| | | |
| | | Api.getSystemConfig(_param).then(res => { |
| | | if (!res) return |
| | | |
| | | if (res.status) { |
| | | // positecgroup |
| | | // res.Banner = res.Banner ? res.Banner.replace(/:8080/ig, '').replace(/http:/ig, 'https:') : '' |
| | | // res.doclogo = res.doclogo ? res.doclogo.replace(/:8080/ig, '').replace(/http:/ig, 'https:') : '' |
| | | // res.indexlogo = res.indexlogo ? res.indexlogo.replace(/:8080/ig, '').replace(/http:/ig, 'https:') : '' |
| | | // res.loginlogo = res.loginlogo ? res.loginlogo.replace(/:8080/ig, '').replace(/http:/ig, 'https:') : '' |
| | | if (window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') { |
| | | if (md5(('mk' + appkey + res.sys_datetime + res.member_type + res.registry_date).toLowerCase()) !== res.secret_key) { |
| | | Modal.warning({ |
| | | title: '密钥错误,请联系管理员!', |
| | | okText: '知道了' |
| | | }) |
| | | this.setState({ |
| | | auth: false, |
| | | authError: '密钥错误,请联系管理员!' |
| | | }) |
| | | return |
| | | } else if (res.member_type === 'personal' && res.registry_date) { |
| | | let saveDelay = 0 |
| | | try { |
| | | saveDelay = parseInt((new Date().getTime() - new Date(res.registry_date).getTime()) / 4320000) |
| | | sessionStorage.setItem('mkDelay', saveDelay) |
| | | } catch(e) {} |
| | | } |
| | | } |
| | | |
| | | if (!['shutter', 'linkage_navigation', 'linkage', 'menu_board', 'menu_board_navigation'].includes(res.menu_type)) { |
| | | res.menu_type = 'shutter' |
| | | } |
| | | |
| | | let _url = _href + 'system' |
| | | let systemMsg = { |
| | |
| | | style: res.CSS || '', |
| | | showline: res.split_line_show || 'true', |
| | | webSite: res.WebSite || '', |
| | | navBar: res.menu_type, |
| | | app_version: res.app_version |
| | | navBar: res.menu_type, // shutter 百叶窗、linkage_navigation 联动菜单、linkage 联动菜单_无导航栏、menu_board 菜单面板、menu_board_navigation 菜单面板_标签页 |
| | | app_version: res.app_version, |
| | | Member_Level: 0, |
| | | appname: res.appname || '' |
| | | } |
| | | |
| | | if ([10, 20, 30, 40, 50, 60, 70, 80, 90, 100].includes(res.member_level)) { |
| | | systemMsg.Member_Level = md5('mksoft' + appkey + res.member_level) |
| | | if (!window.GLOB.memberLevel) { |
| | | Object.defineProperty(window.GLOB, 'memberLevel', { |
| | | writable: false, |
| | | value: res.member_level |
| | | }) |
| | | } |
| | | } |
| | | |
| | | let level = res.pwd_level || '' |
| | | |
| | | if (level && !['letter_num', 'char_num', 'char_num_90'].includes(level)) { |
| | | if (level && !['letter_num', 'char_num', 'char_num_90', 'char_num_90_sms'].includes(level)) { |
| | | level = '' |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | sessionStorage.setItem('home_background', res.index_background_color || '') |
| | | |
| | | let seconds = 0 |
| | | if (res.sys_datetime) { |
| | | sessionStorage.setItem('sys_datetime', res.sys_datetime) |
| | | sessionStorage.setItem('app_datetime', new Date().getTime()) |
| | | seconds = Math.floor((new Date(res.sys_datetime).getTime() - new Date().getTime()) / 1000) |
| | | } |
| | | sessionStorage.setItem('sys_time_shim', isNaN(seconds) ? 0 : seconds) |
| | | |
| | | // url标题 |
| | | document.title = systemMsg.platTitle |
| | |
| | | login_ways.push({ |
| | | type: item.way_no, |
| | | smsId: item.sms_id |
| | | }) |
| | | }) |
| | | |
| | | if (item.way_no === 'sms_vcode' && item.sms_id) { |
| | | sessionStorage.setItem('mk_sms_id', item.sms_id) |
| | | } |
| | | }) |
| | | } else { |
| | | login_ways.push({ |
| | |
| | | window.GLOB.style = systemMsg.style |
| | | window.GLOB.navBar = systemMsg.navBar |
| | | window.GLOB.appVersion = systemMsg.app_version |
| | | sessionStorage.setItem('appname', res.appname || '') |
| | | |
| | | if (window.GLOB.style && styles[window.GLOB.style]) { |
| | | document.body.className = styles[window.GLOB.style] + ' ' + (res.split_line_show === 'false' ? 'hidden-split-line' : '') |
| | |
| | | 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) |
| | | } |
| | | |
| | | if (res.users_upt === 'true' && window.GLOB.systemType === 'production') { |
| | | Api.getLocalConfig ({ |
| | | func: 's_Get_local_u_deleted', |
| | | users_upt_date: res.users_upt_date, |
| | | userid: result.UserID, |
| | | LoginUID: result.LoginUID |
| | | }).then(localres => { |
| | | if (!localres.status) return |
| | | Api.getSystemConfig({ |
| | | func: 's_get_sso_u_create', |
| | | user_ids: localres.user_ids, |
| | | user_ids_local: localres.user_ids_local, |
| | | users_upt_date: localres.users_upt_date, |
| | | userid: result.UserID, |
| | | LoginUID: result.LoginUID |
| | | }).then(ssores => { |
| | | if (!ssores.status) return |
| | | Api.getLocalConfig ({ |
| | | func: 's_get_local_u_create', |
| | | user_ids_local: ssores.user_ids_local, |
| | | userid: result.UserID, |
| | | LoginUID: result.LoginUID |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | // positecgroup |
| | | // if (res.users_upt === 'true' && window.GLOB.systemType === 'production') { |
| | | // Api.genericInterface ({ |
| | | // func: 's_Get_local_u_deleted', |
| | | // users_upt_date: res.users_upt_date, |
| | | // userid: result.UserID, |
| | | // LoginUID: result.LoginUID |
| | | // }).then(localres => { |
| | | // if (!localres.status) return |
| | | // Api.getSystemConfig({ |
| | | // func: 's_get_sso_u_create', |
| | | // user_ids: localres.user_ids, |
| | | // user_ids_local: localres.user_ids_local, |
| | | // users_upt_date: localres.users_upt_date, |
| | | // userid: result.UserID, |
| | | // LoginUID: result.LoginUID |
| | | // }).then(ssores => { |
| | | // if (!ssores.status) return |
| | | // Api.genericInterface ({ |
| | | // func: 's_get_local_u_create', |
| | | // user_ids_local: ssores.user_ids_local, |
| | | // userid: result.UserID, |
| | | // LoginUID: result.LoginUID |
| | | // }) |
| | | // }) |
| | | // }) |
| | | // } |
| | | } else { |
| | | message.warning(res.message) |
| | | } |
| | |
| | | queryAddress = () => { |
| | | window.callbackFunction = (res) => { |
| | | if (res.result && res.result.ad_info) { |
| | | sessionStorage.setItem('city', res.result.ad_info.city) |
| | | sessionStorage.setItem('ipAddress', res.result.ip) |
| | | sessionStorage.setItem('nation', res.result.ad_info.nation || '') |
| | | sessionStorage.setItem('province', res.result.ad_info.province || '') |
| | | sessionStorage.setItem('city', res.result.ad_info.city || '') |
| | | sessionStorage.setItem('district', res.result.ad_info.district || '') |
| | | sessionStorage.setItem('address', res.result.ad_info.address || '') |
| | | sessionStorage.setItem('ipAddress', res.result.ip || '') |
| | | } |
| | | } |
| | | |
| | |
| | | func: 's_get_app_from_cloud', |
| | | UserName: '', |
| | | Password: '', |
| | | systemType: options.sysType, |
| | | systemType: window.GLOB.sysType, |
| | | Type: 'X', |
| | | debug: 'Y' |
| | | } |
| | | |
| | | param.appkey = window.GLOB.appkey || '' |
| | | |
| | | if (options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi.replace('dostars', 'dostar') |
| | | if (window.GLOB.cloudServiceApi) { |
| | | param.rduri = window.GLOB.cloudServiceApi.replace('dostars', 'dostar') |
| | | } |
| | | |
| | | this.logincloudRef.handleConfirm().then(result => { |
| | |
| | | }) |
| | | } |
| | | |
| | | resetPwdSubmit = () => { |
| | | this.formRef.handleConfirm().then(res => { |
| | | this.setState({ |
| | | resetLoading: true |
| | | }) |
| | | |
| | | let _param = { |
| | | func: 's_PwdUpt', |
| | | LText: `select '${res.originpwd}','${res.password}'` |
| | | } |
| | | |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') // 时间戳 |
| | | _param.LText = Utils.formatOptions(_param.LText) // 关键字符替换,base64加密 |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) // md5密钥 |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | this.setState({ |
| | | visible: !result.status, |
| | | resetLoading: false |
| | | }) |
| | | |
| | | if (result.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '修改成功,请重新登录。', |
| | | duration: 2 |
| | | }) |
| | | const input = document.getElementById('password') |
| | | if (input) { |
| | | input.select() |
| | | } |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | }, () => {}) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | |
| | | const { lineColor, bgImage, loginlogo, copyRight, webSite, ICP, loginWays, touristLogin } = this.state |
| | | |
| | | return ( |
| | | <div className="login-container" style={bgImage ? {backgroundImage: 'url(' + bgImage + ')'} : {}}> |
| | | <div className="login-container" id="mk-login-view" style={bgImage ? {backgroundImage: 'url(' + bgImage + ')'} : {}}> |
| | | <div className="logo" style={lineColor ? {borderColor: lineColor} : {}}> |
| | | {loginlogo ? <img src={loginlogo} alt=""/> : null} |
| | | {this.state.platName ? <p className="plat-name">{this.state.platName}</p> : null} |
| | | </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} |
| | |
| | | lang={this.state.selectedlang} |
| | | langList={this.state.langList} |
| | | isDisabled={this.state.isDisabled} |
| | | changelang={(value) => this.changelang(value)} |
| | | handleSubmit={() => this.handleSubmit()} |
| | | authLogin={this.authLogin} |
| | | wrappedComponentRef={(inst) => this.loginformRef = inst} |
| | |
| | | <a target="_blank" rel="noopener noreferrer" href={webSite} dangerouslySetInnerHTML={{ __html: copyRight.replace(/\s/ig, ' ') }}></a> : |
| | | <p dangerouslySetInnerHTML={{ __html: copyRight ? copyRight.replace(/\s/ig, ' ') : '' }}></p> |
| | | } |
| | | {ICP ? <p dangerouslySetInnerHTML={{ __html: ICP.replace(/\s/ig, ' ') }}></p> : null} |
| | | <br/> |
| | | {ICP ? <a target="_blank" rel="noopener noreferrer" href="https://beian.miit.gov.cn/#/Integrated/index" dangerouslySetInnerHTML={{ __html: ICP.replace(/\s/ig, ' ') }}></a> : null} |
| | | </div> |
| | | {/* 编辑状态登录 */} |
| | | <Modal |
| | |
| | | <LoginCloudForm handleSubmit={() => this.syncSubmit()} wrappedComponentRef={(inst) => this.logincloudRef = inst}/> |
| | | </Modal> |
| | | {/* 修改密码 */} |
| | | <Modal |
| | | title="修改密码" |
| | | okText={this.state.dict['login.ok']} |
| | | cancelText={this.state.dict['login.cancel']} |
| | | visible={this.state.visible} |
| | | onOk={this.resetPwdSubmit} |
| | | confirmLoading={this.state.resetLoading} |
| | | onCancel={() => this.setState({visible: false, resetLoading: false})} |
| | | destroyOnClose |
| | | > |
| | | <Resetpwd wrappedComponentRef={(inst) => this.formRef = inst} resetPwdSubmit={this.resetPwdSubmit}/> |
| | | </Modal> |
| | | <Resetpwd /> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | const mapStateToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | modifyMemberLevel: (memberLevel) => dispatch(modifyMemberLevel(memberLevel)) |
| | | } |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(Login) |
| | | export default Login |