Commit 2f0d9525 by wufan

Merge branch 'hotfix/zhangleyuan/20210426/qrcode' into 'master'

Hotfix/zhangleyuan/20210426/qrcode

See merge request !16
parents 2f055add 3bad30ec
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-08-31 09:34:31 * @Date: 2020-08-31 09:34:31
* @LastEditors: zhangleyuan * @LastEditors: zhangleyuan
* @LastEditTime: 2021-01-09 14:39:46 * @LastEditTime: 2021-04-27 16:59:07
* @Description: * @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -96,7 +96,6 @@ class Axios { ...@@ -96,7 +96,6 @@ class Axios {
case 401: case 401:
User.removeUserId(); User.removeUserId();
User.removeToken(); User.removeToken();
message.error('请登录');
window.RCHistory.replace('/login'); window.RCHistory.replace('/login');
break; break;
case 403: case 403:
......
...@@ -34,7 +34,7 @@ function Login(props) { ...@@ -34,7 +34,7 @@ function Login(props) {
User.setCustomerStoreId(storeId); User.setCustomerStoreId(storeId);
} }
if (from === 'customer' && enterpriseId && userId) { if (from === 'customer' && enterpriseId && userId) {
if (!user.getToken() || enterpriseId !== user.getEnterpriseId()) { if (!user.getToken() || enterpriseId !== user.getEnterpriseId() || userId !== User.getUserId()) {
getWXWorkLoginNoCheck(enterpriseId, userId); getWXWorkLoginNoCheck(enterpriseId, userId);
} else { } else {
window.RCHistory.push({ window.RCHistory.push({
......
import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef, useEffect } from 'react';
import qrcode from '@/core/qrcode/qrcode.js' import qrcode from "@/libs/qrcode/qrcode.js";
import Service from "@/common/js/service"; import Service from "@/common/js/service";
import User from '@/common/js/user'; import User from '@/common/js/user';
import { PATH } from '@/domains/basic-domain/constants'; import { PATH } from '@/domains/basic-domain/constants';
...@@ -7,6 +7,7 @@ import './WechatLogin.less' ...@@ -7,6 +7,7 @@ import './WechatLogin.less'
const Logo = require("@/common/images/logo.png") const Logo = require("@/common/images/logo.png")
declare var location: any; declare var location: any;
export default function WechatLogin(props: any) { export default function WechatLogin(props: any) {
const freshTime = 60; const freshTime = 60;
const init: any = null; const init: any = null;
...@@ -31,15 +32,18 @@ export default function WechatLogin(props: any) { ...@@ -31,15 +32,18 @@ export default function WechatLogin(props: any) {
// console.log(redirect) // console.log(redirect)
// const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww409ccf9c6e31f19e&redirect_uri=${encodeURIComponent(redirect)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect` // const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww409ccf9c6e31f19e&redirect_uri=${encodeURIComponent(redirect)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
// console.log(url) // console.log(url)
const qrcodeWrapDom:any = document.querySelector('#qrcode');
let qrnode = new qrcode({ let qrnode = new qrcode({
text: redirect, text: redirect,
correctLevel: 2, correctLevel: 2,
size: 160, size: 160,
image: Logo, image: Logo,
imageSize: 50 imageSize: 50
}); });
QRCode.current.innerHTML = '' qrcodeWrapDom.innerHTML = '';
QRCode.current.prepend(qrnode); qrcodeWrapDom && qrcodeWrapDom.appendChild(qrnode);
// QRCode.current.innerHTML = ''
// QRCode.current.prepend(qrnode);
setLeftTime(freshTime); setLeftTime(freshTime);
timer.current = setInterval(() => { timer.current = setInterval(() => {
if (leftTimeRef.current == 0) { if (leftTimeRef.current == 0) {
...@@ -85,9 +89,7 @@ export default function WechatLogin(props: any) { ...@@ -85,9 +89,7 @@ export default function WechatLogin(props: any) {
return <div className='wechatLoginBox'> return <div className='wechatLoginBox'>
<div className="rwm"> <div className="rwm">
<div id="qrcode" ref={(dom) => { <div id="qrcode"></div>
QRCode.current = dom
}}></div>
{ {
status === 1 && <div className="error"> status === 1 && <div className="error">
......
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