|
@@ -1,8 +1,8 @@
|
|
|
-import React, { useCallback, useEffect } from 'react'
|
|
|
+import React, { useCallback, useEffect, useState } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
|
import TopCom from '@/components/TopCom'
|
|
|
import { Button } from 'antd'
|
|
|
-import history from '@/utils/history'
|
|
|
+import history, { toHomeFu } from '@/utils/history'
|
|
|
import { setTokenInfo } from '@/utils/storage'
|
|
|
import { MessageFu } from '@/utils/message'
|
|
|
function Z1login() {
|
|
@@ -15,6 +15,8 @@ function Z1login() {
|
|
|
// window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(
|
|
|
// url
|
|
|
// )}&response_type=code&scope=SCOPE&state=STATE#wechat_redirect`
|
|
|
+
|
|
|
+ setTime(Date.now())
|
|
|
}, [])
|
|
|
|
|
|
// 获取地址栏参数的方法
|
|
@@ -38,6 +40,8 @@ function Z1login() {
|
|
|
return r[2]
|
|
|
}, [])
|
|
|
|
|
|
+ const [time, setTime] = useState(0)
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
let code = getQueryCode('code')
|
|
|
console.log('-----------', code)
|
|
@@ -47,9 +51,9 @@ function Z1login() {
|
|
|
setTokenInfo({ token: 'xxxxxxxxxxxx' })
|
|
|
// 跳到首页
|
|
|
MessageFu.success('登录成功!')
|
|
|
- history.push('/')
|
|
|
+ toHomeFu()
|
|
|
}
|
|
|
- }, [getQueryCode])
|
|
|
+ }, [getQueryCode, time])
|
|
|
|
|
|
return (
|
|
|
<div className={styles.Z1login}>
|