Commit 9ad4dfd5 authored by 尚顺利's avatar 尚顺利

企业微信扫码

parent 204c5515
......@@ -41,13 +41,12 @@ class Login {
const { password } = this.globalConfig;
const loginMode = Cookies.get('loginMode') || null;
if (loginMode && loginMode === 'iotWechat') ddCode = null;
const self = this;
// self.qrcodeLogin(self.globalConfig.qrcodeData.code);
if (token) {
self.getToweb(token);
// eslint-disable-next-line no-empty
} else if (ddCode && loginMode !== 'qywx') {
} else if (ddCode && loginMode === 'dingding') {
self.ddLoginIn(ddCode);
} else if (ddCode && loginMode === 'qywx') {
self.qywxLoginIn(ddCode);
......@@ -392,8 +391,8 @@ class Login {
}
return s;
}
// 企业微信登录
// 企业微信登录
loginByWx() {
window.WwLogin({
id: 'wxlogin_container',
......@@ -406,17 +405,17 @@ class Login {
qywxLoginIn(code) {
// eslint-disable-next-line no-undef
const self = this;
appService
.getInfo({
query: {
code,
},
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) {
// 判断是否存在参数
......@@ -424,13 +423,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; // 已经输错过密码
}
});
}
......
......@@ -2,7 +2,7 @@
/*
* @Author: shangshunli;
* @Date: 2021-08-02 09:39:46;
* @LastEditTime: 2021-08-23 11:07:30
* @LastEditTime: 2021-09-03 14:58:29
* @LastEditors: shangshunli
* @Description:信息化登录页;
*/
......@@ -32,18 +32,23 @@ class InfoLogin extends React.Component{
isRember:false, //记住密码
ddOrWeixin:''
}
componentDidMount(){
let action=new LoginAction(this.props,false,true)
}
// 切换登录方式
changeloginStyle=()=>{
const {ddOrWeixin}=this.state
this.setState({
loginStyle:!this.state.loginStyle,
ddOrWeixin:ddOrWeixin== 'dingding' ? '':'dingding'
ddOrWeixin:ddOrWeixin ? '':'dingding'
},()=>{
Cookies.set('loginMode', 'dingding', {
Cookies.set('loginMode', `${ddOrWeixin ? 'pdw' : 'dingding'}`, {
path: '/',
});
let action=new LoginAction(this.props,false,true)
action.loginByDD()
if (ddOrWeixin==='dingding'){
let action=new LoginAction(this.props,false,true)
action.loginByDD()
}
})
}
// 切换二维码
......@@ -55,15 +60,14 @@ changeQrCode=(item)=>{
path: '/',
});
let action=new LoginAction(this.props,false,true)
if(item=='dingding'){
action.loginByDD()
}else if(item=='qywx'){
if(item==='qywx'){
action.loginByWx()
}else if (item==='dingding'){
action.loginByDD()
}
})
}
// 查看密码
seePassWord=(e)=>{
this.setState({
......
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