|
@@ -1,7 +1,7 @@
|
|
|
import { useEffect, useMemo, useState } from 'react'
|
|
|
import './App.less'
|
|
|
import LoginPop from './pages/loginPop'
|
|
|
-import { getInitAppletApi, tokenExpireTimeCheckApi, weChatLoginApi } from './api'
|
|
|
+import { getInitAppletApi, setVisitLogPushApi, tokenExpireTimeCheckApi, weChatLoginApi } from './api'
|
|
|
import { useAjax } from './hooks/useAjax'
|
|
|
import { removeGameId, removeToken, setGameId, setToken } from './utils/auth'
|
|
|
import { Spin, App as AntdApp, Result } from 'antd'
|
|
@@ -24,6 +24,7 @@ function App() {
|
|
|
const searchParams = new URLSearchParams(new URL(url).search);
|
|
|
const gameId = searchParams.get('game_id')
|
|
|
const isSw = searchParams.get('isSw')
|
|
|
+ const vt = searchParams.get('vt')
|
|
|
const { state, dispatch, getDetails } = useConfig()
|
|
|
const { typeSwitch, token } = state
|
|
|
// const [isInit, setIsInit] = useState<boolean>(false)
|
|
@@ -33,6 +34,7 @@ function App() {
|
|
|
|
|
|
const getInitApplet = useAjax(() => getInitAppletApi())
|
|
|
const weChatLogin = useAjax((params) => weChatLoginApi(params))
|
|
|
+ const setVisitLogPush = useAjax((params) => setVisitLogPushApi(params))
|
|
|
const tokenExpireTimeCheck = useAjax(() => tokenExpireTimeCheckApi())
|
|
|
/**************************************/
|
|
|
|
|
@@ -77,6 +79,12 @@ function App() {
|
|
|
}
|
|
|
}, [gameId])
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ if (vt === '1' && gameId) {
|
|
|
+ setVisitLogPush.run({ url: window.location.href })
|
|
|
+ }
|
|
|
+ }, [vt, gameId])
|
|
|
+
|
|
|
// 监听token 获取用户信息
|
|
|
useEffect(() => {
|
|
|
if (token) {
|