Commit b16e7c8d authored by 尚顺利's avatar 尚顺利

钉钉扫码

parent 30861356
......@@ -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 15:37:12
* @LastEditTime: 2021-09-06 09:35:36
* @LastEditors: shangshunli
* @Description:信息化登录页;
*/
......@@ -43,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()
}
......@@ -100,6 +100,7 @@ changeQrCode=(item)=>{
this.loginEvent(action)
}
// 登录成功事件
loginEvent(action){
action.globalConfig = this.props.global;
this.props.updateCurrentIndex && this.props.updateCurrentIndex(-1);
......
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