Commit 9028e768 authored by 邓晓峰's avatar 邓晓峰

Merge branch 'dev_info'

parents 2840a7b2 b16e7c8d
Pipeline #34034 passed with stages
in 55 minutes 46 seconds
......@@ -449,7 +449,7 @@ class Login {
const handleMessage = function(event) {
const { origin } = event;
Logger.log('origin', event.origin);
// Logger.log('origin', event.origin);
if (origin === 'https://login.dingtalk.com') {
// 判断是否来自ddLogin扫码事件。
const loginTmpCode = event.data;
......@@ -469,17 +469,17 @@ class Login {
ddLoginIn(code) {
// eslint-disable-next-line no-undef
const self = this;
appService
.getOA({
query: {
TmpAuthCode: code,
},
TmpAuthCode: code,
cacheBust: true,
})
.then(response => {
if (response && response.data && response.data.getMe) {
const tk = response.data.getMe[0].token;
this.globalConfig.token = tk;
if (response && response.getMe && response.getMe.length) {
const tk = response.getMe[0].token;
self.globalConfig.token = tk;
Cookies.set('token', tk);
let url = window.location.href; // 获取当前页面的url
if (url.indexOf('&code') !== -1) {
// 判断是否存在参数
......@@ -487,13 +487,13 @@ class Login {
url = url.replace(/(\&code|#)[^'"]*/, ''); // 去除参数
window.history.pushState({}, 0, url);
}
this.isSignIn = true;
this.getUserInfoAndConfig();
self.isSignIn = true;
self.getUserInfoAndConfig();
} else {
this.handleLoginError();
self.handleLoginError();
// msgUtils.fault("登录失败,请检查用户名或密码");
// msgUtils.fault("登录失败," + error.message);
this.hasTry = true; // 已经输错过密码
self.hasTry = true; // 已经输错过密码
}
});
}
......@@ -601,7 +601,7 @@ class Login {
getUserInfoAndConfig(failCallback, flag, industry) {
const { token: tk } = this.globalConfig;
const token = tk || Cookies.get('token')
const token = tk || Cookies.get('token');
const site = Cookies.get('site');
const self = this;
/* eslint-disable */
......
......@@ -2,7 +2,7 @@
/*
* @Author: shangshunli;
* @Date: 2021-08-02 09:39:46;
* @LastEditTime: 2021-09-03 14:58:29
* @LastEditTime: 2021-09-06 09:35:36
* @LastEditors: shangshunli
* @Description:信息化登录页;
*/
......@@ -34,6 +34,7 @@ class InfoLogin extends React.Component{
}
componentDidMount(){
let action=new LoginAction(this.props,false,true)
this.loginEvent(action)
}
// 切换登录方式
changeloginStyle=()=>{
......@@ -42,10 +43,10 @@ class InfoLogin extends React.Component{
loginStyle:!this.state.loginStyle,
ddOrWeixin:ddOrWeixin ? '':'dingding'
},()=>{
Cookies.set('loginMode', `${ddOrWeixin ? 'pdw' : 'dingding'}`, {
Cookies.set('loginMode', `${this.state.ddOrWeixin ? 'dingding' : 'pdw'}`, {
path: '/',
});
if (ddOrWeixin==='dingding'){
if (this.state.ddOrWeixin==='dingding'){
let action=new LoginAction(this.props,false,true)
action.loginByDD()
}
......@@ -95,21 +96,25 @@ changeQrCode=(item)=>{
loginToWeb5=()=>{
const {loginName,passWord,isRember}=this.state
let action=new LoginAction(this.props,false,true)
action.globalConfig = this.props.global;
action.loginHandler(loginName,passWord,null,isRember,false)
this.props.updateCurrentIndex && this.props.updateCurrentIndex(-1);
action && action.events.on('loginSuccess', event => {
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
this.props.history.push(`/?client=${this.props.global.client}`);
window.share.event.emit('triggerMicro', this.props.global);
});
action && action.events.on('loginError', event => {
});
action && action.events.on('loginVisible', status => {
this.loginEvent(action)
}
// 登录成功事件
loginEvent(action){
action.globalConfig = this.props.global;
this.props.updateCurrentIndex && this.props.updateCurrentIndex(-1);
action && action.events.on('loginSuccess', event => {
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
this.props.history.push(`/?client=${this.props.global.client}`);
window.share.event.emit('triggerMicro', this.props.global);
});
action && action.events.on('loginError', event => {
});
});
action && action.events.on('loginVisible', status => {
});
}
render(){
const {loginStyle,isOpen,isRember,loginName,passWord,ddOrWeixin}=this.state
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment