| | |
| | | dict: iszhCN ? zhCN : enUS, |
| | | isDisabled: false, |
| | | auth: false, |
| | | authError: '', |
| | | loginlogo: window.GLOB.loginlogo || '', |
| | | bgImage: window.GLOB.bgImage || '', |
| | | platName: window.GLOB.platName || '', |
| | |
| | | syncApp: false, |
| | | loginWays: null, |
| | | touristLogin: false, |
| | | syncing: false, |
| | | ipAddress: '', |
| | | city: '' |
| | | syncing: false |
| | | } |
| | | |
| | | changelang (item) { |
| | |
| | | * @param {Object} param 用户名密码等信息 |
| | | */ |
| | | async loginsubmit (param) { |
| | | const { ipAddress, city } = this.state |
| | | if (options.sysType === 'local' && !window.GLOB.mainSystemApi) { // 业务系统必须设置单点地址 |
| | | Modal.warning({ |
| | | title: '未设置单点服务器地址,请联系管理员!' |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let city = sessionStorage.getItem('city') || '' |
| | | let ipAddress = sessionStorage.getItem('ipAddress') || '' |
| | | |
| | | // 登录提交 |
| | | let res = await Api.getusermsg(param.username, param.password, false, ipAddress, city) |
| | |
| | | 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 || '') |
| | | |
| | | let _url = window.location.href.split('#')[0] |
| | |
| | | } |
| | | |
| | | async phoneloginsubmit (param) { |
| | | const { ipAddress, city } = this.state |
| | | if (options.sysType === 'local' && !window.GLOB.mainSystemApi) { // 业务系统必须设置单点地址 |
| | | Modal.warning({ |
| | | title: '未设置单点服务器地址,请联系管理员!' |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let city = sessionStorage.getItem('city') || '' |
| | | let ipAddress = sessionStorage.getItem('ipAddress') || '' |
| | | |
| | | // 登录提交 |
| | | let res = await Api.getphoneusermsg(param.phone, param.vercode, false, ipAddress, city) |
| | |
| | | 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 || '') |
| | | |
| | | let _url = window.location.href.split('#')[0] |
| | |
| | | } |
| | | } |
| | | |
| | | componentDidMount () { |
| | | // 获取ip及城市信息 |
| | | let ipurl = window.atob('aHR0cHM6Ly9lcGMubWs5a$mkC5jbi93ZWJhcGkvaXBsb2M='.replace(/\$mk/ig, '')) |
| | | Api.directRequest(ipurl, 'get', null, 'true').then(res => { |
| | | if (!res || !res.location) return |
| | | sessionStorage.setItem('city', res.location) |
| | | this.setState({ |
| | | ipAddress: res.ip || '', |
| | | city: res.location |
| | | authLogin = (appid, openid, memberid, scanId) => { |
| | | if (options.sysType === 'local' && !window.GLOB.mainSystemApi) { // 业务系统必须设置单点地址 |
| | | Modal.warning({ |
| | | title: '未设置单点服务器地址,请联系管理员!' |
| | | }) |
| | | return |
| | | } |
| | | Api.getTouristMsg(appid, openid, memberid, scanId).then(res => { |
| | | 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 || '') |
| | | 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.removeItem('visitorUserID') |
| | | sessionStorage.removeItem('visitorLoginUID') |
| | | |
| | | let _history = sessionStorage.getItem('history') |
| | | if (_history) { |
| | | sessionStorage.removeItem('history') |
| | | // 查看是否为其他页面跳转,路径存在时,跳回原页面 |
| | | this.props.history.replace(_history) |
| | | } 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 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | jsonp(url) { |
| | | return new Promise((resolve, reject) => { |
| | | window.jsonCallBack = (result) => { |
| | | resolve(result) |
| | | } |
| | | |
| | | const JSONP = document.createElement('script') |
| | | JSONP.type = 'text/javascript' |
| | | JSONP.src = url |
| | | |
| | | document.getElementsByTagName('head')[0].appendChild(JSONP) |
| | | |
| | | setTimeout(() => { |
| | | 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) |
| | | // }) |
| | | const _addressUrl = window.location.href.split('#')[0] + 'queryAddress' |
| | | |
| | | if (_addressUrl !== 'true') { |
| | | sessionStorage.setItem('city', '') |
| | | sessionStorage.setItem('ipAddress', '') |
| | | } else { |
| | | window.callbackFunction = (res) => { |
| | | if (res.result && res.result.ad_info) { |
| | | sessionStorage.setItem('city', res.result.ad_info.city) |
| | | sessionStorage.setItem('ipAddress', res.result.ip) |
| | | } |
| | | } |
| | | |
| | | const JSONP = document.createElement('script') |
| | | JSONP.type = 'text/javascript' |
| | | JSONP.src = 'https://apis.map.qq.com/ws/location/v1/ip?callback=callbackFunction&key=BA7BZ-4QB65-LFCIA-QPDA6-4G6O7-MJB4Q&output=jsonp&sig=3e5ebecb324ba266bf80014dcc8380db' |
| | | document.getElementsByTagName('head')[0].appendChild(JSONP) |
| | | |
| | | setTimeout(() => { |
| | | document.getElementsByTagName('head')[0].removeChild(JSONP) |
| | | },500) |
| | | } |
| | | |
| | | const timeStamp = new Date().getTime() |
| | | const _authUrl = window.location.href.split('#')[0] + 'AuthCode' |
| | | |
| | |
| | | authCode = authCode ? authCode.split(',') : [] |
| | | let index = authCode.findIndex(key => key === _s) |
| | | |
| | | if (index > -1) { |
| | | let key = md5(window.GLOB.appId + 'minke_software' + window.GLOB.appkey).toUpperCase().substr(-6) |
| | | |
| | | if (index > -1 || window.GLOB.licenseKey === key) { |
| | | this.setState({ |
| | | auth: true |
| | | }) |
| | | } |
| | | |
| | | if (index === -1 || index > 5) { |
| | | if (window.GLOB.licenseKey !== key && (index === -1 || index > 5)) { |
| | | let _appId = window.GLOB.appId |
| | | |
| | | if (options.sysType === 'cloud') { // 云端使用系统配置appid |
| | |
| | | nonc: Utils.getuuid() |
| | | } |
| | | |
| | | // param = { |
| | | // func: _func, |
| | | // VerificationCode: '授权码', |
| | | // TimeStamp: timeStamp, |
| | | // userid: _id, |
| | | // LoginUID: _id, |
| | | // nonc: Utils.getuuid() |
| | | // } |
| | | |
| | | let keys = Object.keys(param).sort() |
| | | let values = '' |
| | | keys.forEach(key => { |
| | |
| | | param.sign = md5(values) |
| | | param.t = new Date().getTime() |
| | | |
| | | Api.directRequest(_rduri + '/sEmpowerCloud_Get_LinkUrl', 'post', param, 'true').then(res => { |
| | | Api.directRequest(_rduri + '/' + _func, 'post', param, 'true').then(res => { |
| | | if (res.status) { |
| | | if (res.EPC === str) { |
| | | let box = [] |
| | |
| | | auth: false |
| | | }) |
| | | } |
| | | |
| | | if (res.query_address !== 'true') { |
| | | localStorage.setItem(_addressUrl, 'false') |
| | | } else { |
| | | localStorage.setItem(_addressUrl, 'true') |
| | | } |
| | | } else if (res.ErrCode === 'N') { |
| | | localStorage.removeItem(_authUrl) |
| | | this.setState({ |
| | | auth: false |
| | | auth: false, |
| | | authError: res.message |
| | | }) |
| | | } |
| | | }) |
| | |
| | | |
| | | try { |
| | | localStorage.setItem(_url, window.btoa(window.encodeURIComponent(JSON.stringify(systemMsg)))) |
| | | } catch { |
| | | } catch (e) { |
| | | localStorage.removeItem(_url) |
| | | } |
| | | |
| | |
| | | |
| | | try { |
| | | localStorage.setItem(_loginurl, window.btoa(window.encodeURIComponent(JSON.stringify(login_ways)))) |
| | | } catch { |
| | | } catch (e) { |
| | | localStorage.removeItem(_loginurl) |
| | | } |
| | | |
| | |
| | | if (loginWays) { |
| | | try { |
| | | loginWays = JSON.parse(window.decodeURIComponent(window.atob(loginWays))) |
| | | } catch { |
| | | localStorage.removeItem(window.location.href.split('#')[0] + 'loginways') |
| | | } catch (e) { |
| | | loginWays = null |
| | | } |
| | | |
| | | if (loginWays) { |
| | | this.setState({ |
| | | loginWays: loginWays |
| | | }) |
| | | } |
| | | this.setState({ |
| | | loginWays: loginWays |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | platName={this.state.platName} |
| | | dict={this.state.dict} |
| | | auth={this.state.auth} |
| | | authError={this.state.authError} |
| | | touristLogin={touristLogin} |
| | | loginWays={loginWays} |
| | | lang={this.state.selectedlang} |
| | |
| | | isDisabled={this.state.isDisabled} |
| | | changelang={(value) => this.changelang(value)} |
| | | handleSubmit={() => this.handleSubmit()} |
| | | authLogin={this.authLogin} |
| | | wrappedComponentRef={(inst) => this.loginformRef = inst} |
| | | /> : null} |
| | | </div> |
| | |
| | | {/* 编辑状态登录 */} |
| | | <Modal |
| | | title={this.state.dict['login.sync.cloud']} |
| | | okText={this.state.dict['login.auth.ok']} |
| | | cancelText={this.state.dict['login.auth.cancel']} |
| | | okText={this.state.dict['login.ok']} |
| | | cancelText={this.state.dict['login.cancel']} |
| | | visible={this.state.syncApp} |
| | | onOk={this.syncSubmit} |
| | | maskClosable={false} |