| | |
| | | import axios from 'axios' |
| | | import qs from 'qs' |
| | | import { notification } from 'antd' |
| | | import { notification, Modal } from 'antd' |
| | | import md5 from 'md5' |
| | | import CryptoJS from 'crypto-js' |
| | | import jsSHA from 'jssha' |
| | |
| | | |
| | | window.GLOB.IndexDB = null |
| | | window.GLOB.OuterToken = {} |
| | | window.GLOB.$error = false |
| | | |
| | | let service = window.GLOB.service ? '-' + window.GLOB.service.replace('/', '') : '' |
| | | let db = `mkdb${service}` |
| | |
| | | axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' |
| | | axios.defaults.withCredentials = false |
| | | |
| | | // Modal.destroyAll() |
| | | // Modal.error({ |
| | | // title: response.data.message, |
| | | // onOk: () => { |
| | | // sessionStorage.clear() |
| | | // } |
| | | // }) |
| | | |
| | | const setCurrentUrl = (res) => { |
| | | if (!!(window.history && window.history.pushState)) { |
| | | sessionStorage.clear() |
| | | sessionStorage.setItem('loginError', JSON.stringify({url: res.config ? res.config.url : '', request: res.config ? res.config.data : '', response: JSON.stringify(res.data)})) |
| | | window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') |
| | | window.location.reload() |
| | | } |
| | | } |
| | | |
| | | axios.interceptors.response.use((response) => { |
| | | if (response.data.ErrCode === 'LoginError') { |
| | | if (window.debugger === true) { |
| | | response.data.ErrCode = 'E' |
| | | return Promise.resolve(response.data) |
| | | } else if (window.GLOB.developing) { |
| | | if (window.GLOB.developing) { |
| | | sessionStorage.setItem('devError', 'true') |
| | | response.data.ErrCode = 'E' |
| | | return Promise.resolve(response.data) |
| | | } else if (!sessionStorage.getItem('loginError')) { |
| | | setCurrentUrl(response) |
| | | } else if (response.config.url.indexOf('https://sso.mk9h.cn/webapi/dostars') > -1) { |
| | | return Promise.reject(response.data) |
| | | } else if (response.config.url.indexOf('https://epc.mk9h.cn/webapi/dostars') > -1) { |
| | | return Promise.reject(response.data) |
| | | } |
| | | |
| | | if (!window.GLOB.$error) { |
| | | window.GLOB.$error = true |
| | | |
| | | Modal.destroyAll() |
| | | Modal.error({ |
| | | title: response.data.message, |
| | | onOk: () => { |
| | | window.GLOB.$error = false |
| | | sessionStorage.clear() |
| | | if (!!(window.history && window.history.pushState)) { |
| | | window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') |
| | | window.location.reload() |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | return Promise.reject(response.data) |
| | | } else { |
| | | return Promise.resolve(response.data) |
| | | } |
| | | }, (error) => { |
| | | let response = error.response |
| | | let response = error.response || '' |
| | | |
| | | if (response) { |
| | | if (!response.data || !response.data.errors) { // 过滤旷视报错信息 |
| | | notification.error({ |
| | | className: 'notification-custom-error', |
| | | bottom: 0, |
| | | message: '状态码-' + response.status + ',请联系管理员', |
| | | placement: 'bottomRight', |
| | | duration: 15 |
| | | }) |
| | | } |
| | | return Promise.reject(response) |
| | | } else { |
| | | return Promise.reject() |
| | | if (response && (!response.data || !response.data.errors)) { // 过滤旷视报错信息 |
| | | notification.error({ |
| | | className: 'notification-custom-error', |
| | | bottom: 0, |
| | | message: '状态码-' + response.status + ',请联系管理员', |
| | | placement: 'bottomRight', |
| | | duration: 15 |
| | | }) |
| | | } |
| | | |
| | | return Promise.reject(response) |
| | | }) |
| | | |
| | | class Api { |
| | |
| | | }) |
| | | message.warning(res.message) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') { |
| | | let param = { |
| | | func: 's_visitor_login', |
| | | timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), |
| | | SessionUid: 'bh0bapabtd45epsgra79segbch6c1ibk', |
| | | TypeCharOne: 'pc', |
| | | appkey: '202004041613277377A6A2456D34A4948AE84' |
| | | } |
| | | |
| | | param.LText = md5(window.btoa('bh0bapabtd45epsgra79segbch6c1ibk' + param.timestamp)) |
| | | param.secretkey = md5(param.LText + 'mingke' + param.timestamp) |
| | | |
| | | let params = { |
| | | url: 'https://sso.mk9h.cn/webapi/dologon', |
| | | method: 'post', |
| | | data: JSON.stringify(param) |
| | | } |
| | | |
| | | Api.directRequest(params) |
| | | |
| | | return |
| | | } |
| | | |
| | | clearTimeout(this.LoginTimer) |
| | | this.setState({ |
| | | verdisabled: false, |
| | |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | |
| | | this.execError({}) |
| | | }) |
| | | } else if (submit.intertype === 'inner' && submit.innerFunc) { // 自定义存储过程 |
| | |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | |
| | | this.execError({}) |
| | | }) |
| | | } |
| | |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } else { |
| | |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } |
| | |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } else if (btn.intertype === 'outer') { // 外部接口 |
| | |
| | | this.execError(res) |
| | | resolve(false) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } else { |
| | |
| | | |
| | | return Api.genericInterface(res) |
| | | }).then(response => { |
| | | if (!response) return |
| | | if (!response || response.ErrCode === 'LoginError') return |
| | | // 回调请求 |
| | | if (ver_token && response.ErrMesg === 'token_error') { |
| | | this.execError(response) |
| | |
| | | } |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | if (!res || res.ErrCode === 'LoginError') return |
| | | |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } else if (btn.intertype === 'inner') { // 使用内部函数 |
| | |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } else if (btn.intertype === 'outer' && !btn.innerFunc) { // 使用外部函数 |
| | |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } else if (btn.intertype === 'outer' && btn.innerFunc) { |
| | |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } else { |
| | |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } |
| | |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } |
| | |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.updateStatus('over') |
| | | }) |
| | | } |
| | |
| | | import qs from 'qs' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Button, Modal, notification, message, Drawer, Switch, Checkbox, Progress } from 'antd' |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import Utils, { getSysDefaultSql } from '@/utils/utils.js' |
| | |
| | | this.execError(res) |
| | | } |
| | | _resolve() |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.updateStatus() |
| | | _resolve() |
| | | }) |
| | |
| | | this.triggerNote(res) // 消息 |
| | | } |
| | | resolve(res) |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.updateStatus() |
| | | _resolve() |
| | | }) |
| | |
| | | this.execError(res) |
| | | _resolve() |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.updateStatus() |
| | | _resolve() |
| | | }) |
| | |
| | | this.execError(res) |
| | | _resolve() |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.updateStatus() |
| | | _resolve() |
| | | }) |
| | |
| | | this.execError(res) |
| | | _resolve() |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.updateStatus() |
| | | _resolve() |
| | | }) |
| | |
| | | this.execError(res) |
| | | _resolve() |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.updateStatus() |
| | | _resolve() |
| | | }) |
| | |
| | | this.execError(res) |
| | | _resolve() |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.updateStatus() |
| | | _resolve() |
| | | }) |
| | |
| | | return |
| | | } |
| | | this.outerCallbackRequest(params, res, record, outParam, _resolve) |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.outerCallbackRequest(params, {status: false, message: 500, ErrCode: 'E', ErrMesg: 500}, record, outParam, _resolve) |
| | | }) |
| | | } |
| | |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') { |
| | | let param = { |
| | | func: 's_visitor_login', |
| | | timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), |
| | | SessionUid: 'bh0bapabtd45epsgra79segbch6c1ibk', |
| | | TypeCharOne: 'pc', |
| | | appkey: '202004041613277377A6A2456D34A4948AE84' |
| | | } |
| | | |
| | | param.LText = md5(window.btoa('bh0bapabtd45epsgra79segbch6c1ibk' + param.timestamp)) |
| | | param.secretkey = md5(param.LText + 'mingke' + param.timestamp) |
| | | |
| | | let params = { |
| | | url: 'https://sso.mk9h.cn/webapi/dologon', |
| | | method: 'post', |
| | | data: JSON.stringify(param) |
| | | } |
| | | |
| | | Api.directRequest(params) |
| | | |
| | | return |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | |
| | | |
| | | return Api.getSystemCacheConfig(param) |
| | | }).then(result => { |
| | | if (!result) { |
| | | if (!result || result.ErrCode === 'LoginError') { |
| | | this.setState({ loading: false }) |
| | | return |
| | | } |
| | |
| | | |
| | | return Api.genericInterface(res) |
| | | }).then(response => { |
| | | if (!response) return |
| | | if (!response || response.ErrCode === 'LoginError') return |
| | | |
| | | if (ver_token && response.ErrMesg === 'token_error') { |
| | | this.execError(response) |
| | |
| | | _resolve({next: false, list: []}) |
| | | } |
| | | }).then(response => { |
| | | if (!response) return |
| | | if (!response || response.ErrCode === 'LoginError') return |
| | | |
| | | if (response.status) { |
| | | _list.push(response) |
| | |
| | | } else { |
| | | this.props.onSend(send_type, timestamp, n_id) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') { |
| | | let param = { |
| | | func: 's_visitor_login', |
| | | timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), |
| | | SessionUid: 'bh0bapabtd45epsgra79segbch6c1ibk', |
| | | TypeCharOne: 'pc', |
| | | appkey: '202004041613277377A6A2456D34A4948AE84' |
| | | } |
| | | |
| | | param.LText = md5(window.btoa('bh0bapabtd45epsgra79segbch6c1ibk' + param.timestamp)) |
| | | param.secretkey = md5(param.LText + 'mingke' + param.timestamp) |
| | | |
| | | let params = { |
| | | url: 'https://sso.mk9h.cn/webapi/dologon', |
| | | method: 'post', |
| | | data: JSON.stringify(param) |
| | | } |
| | | |
| | | Api.directRequest(params) |
| | | |
| | | return |
| | | } |
| | | |
| | | clearTimeout(this.timer) |
| | | this.setState({ |
| | | verdisabled: false, |
| | |
| | | } else { |
| | | this.props.onSend(send_type, timestamp, n_id) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') { |
| | | let param = { |
| | | func: 's_visitor_login', |
| | | timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), |
| | | SessionUid: 'bh0bapabtd45epsgra79segbch6c1ibk', |
| | | TypeCharOne: 'pc', |
| | | appkey: '202004041613277377A6A2456D34A4948AE84' |
| | | } |
| | | |
| | | param.LText = md5(window.btoa('bh0bapabtd45epsgra79segbch6c1ibk' + param.timestamp)) |
| | | param.secretkey = md5(param.LText + 'mingke' + param.timestamp) |
| | | |
| | | let params = { |
| | | url: 'https://sso.mk9h.cn/webapi/dologon', |
| | | method: 'post', |
| | | data: JSON.stringify(param) |
| | | } |
| | | |
| | | Api.directRequest(params) |
| | | |
| | | return |
| | | } |
| | | |
| | | clearTimeout(this.timer) |
| | | this.setState({ |
| | | verdisabled: false, |
| | |
| | | forbid = false |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | if (sessionStorage.getItem('devError') === 'true') { |
| | | sessionStorage.clear() |
| | | window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') |
| | | window.location.reload() |
| | | return |
| | | } |
| | | |
| | | if (!sessionStorage.getItem('UserID')) { |
| | | sessionStorage.removeItem('isEditState') |
| | | this.props.history.replace('/login') |
| | | return |
| | | } |
| | | |
| | | window.GLOB.developing = true |
| | | |
| | | document.body.className = '' |
| | | this.getAppList() |
| | | this.getSmStemp() |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | if (sessionStorage.getItem('devError') === 'true') { |
| | | sessionStorage.clear() |
| | | window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') |
| | | window.location.reload() |
| | | return |
| | | } |
| | | |
| | | if (!sessionStorage.getItem('UserID')) { |
| | | sessionStorage.removeItem('isEditState') |
| | | this.props.history.replace('/login') |
| | | return |
| | | } |
| | | |
| | | window.GLOB.developing = true |
| | | |
| | | try { |
| | | let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) |
| | | |
| | |
| | | import React, { Component } from 'react' |
| | | import { message, Modal, notification } from 'antd' |
| | | import { message, Modal } from 'antd' |
| | | import md5 from 'md5' |
| | | import moment from 'moment' |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | if (sessionStorage.getItem('loginError')) { |
| | | try { |
| | | let res = JSON.parse(sessionStorage.getItem('loginError')) |
| | | console.info(res.url) |
| | | console.info(res.request) |
| | | console.info(res.response) |
| | | |
| | | let result = JSON.parse(res.response) |
| | | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | } catch (e) {} |
| | | |
| | | setTimeout(() => { |
| | | sessionStorage.removeItem('loginError') |
| | | }, 2000) |
| | | } |
| | | |
| | | const _addressUrl = _href + 'queryAddress' |
| | | |
| | | if (localStorage.getItem(_addressUrl) === 'true') { |
| | |
| | | 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, |
| | |
| | | }) |
| | | message.warning(res.message) |
| | | } |
| | | }, () => { |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') { |
| | | let param = { |
| | | func: 's_visitor_login', |
| | | timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), |
| | | SessionUid: 'bh0bapabtd45epsgra79segbch6c1ibk', |
| | | TypeCharOne: 'pc', |
| | | appkey: '202004041613277377A6A2456D34A4948AE84' |
| | | } |
| | | |
| | | param.LText = md5(window.btoa('bh0bapabtd45epsgra79segbch6c1ibk' + param.timestamp)) |
| | | param.secretkey = md5(param.LText + 'mingke' + param.timestamp) |
| | | |
| | | let params = { |
| | | url: 'https://sso.mk9h.cn/webapi/dologon', |
| | | method: 'post', |
| | | data: JSON.stringify(param) |
| | | } |
| | | |
| | | Api.directRequest(params) |
| | | |
| | | return |
| | | } |
| | | |
| | | if (LoginVerCodeTimer) { |
| | | clearTimeout(LoginVerCodeTimer) |
| | | } |