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