| | |
| | | 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] |
| | |
| | | } |
| | | } |
| | | |
| | | 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.location) return |
| | | // sessionStorage.setItem('city', res.location) |
| | | // this.setState({ |
| | | // ipAddress: res.ip || '', |
| | | // city: res.location |
| | | // }) |
| | | // if (!res || !res.ip) return |
| | | // sessionStorage.setItem('ipAddress', res.ip) |
| | | // }) |
| | | sessionStorage.setItem('city', '') // 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' |
| | | |
| | |
| | | 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({ |
| | |
| | | |
| | | 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 |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | isDisabled={this.state.isDisabled} |
| | | changelang={(value) => this.changelang(value)} |
| | | handleSubmit={() => this.handleSubmit()} |
| | | authLogin={this.authLogin} |
| | | wrappedComponentRef={(inst) => this.loginformRef = inst} |
| | | /> : null} |
| | | </div> |