|
@@ -11,7 +11,7 @@ import PwdPop from './pages/pwdPop'
|
|
import useConfig, { Action, State } from './models/useConfig'
|
|
import useConfig, { Action, State } from './models/useConfig'
|
|
import LoginSucc from './pages/loginSucc'
|
|
import LoginSucc from './pages/loginSucc'
|
|
import React from 'react'
|
|
import React from 'react'
|
|
-import { getRedirectUrl, isWx } from './utils'
|
|
|
|
|
|
+import { getRedirectUrl, isWeChat } from './utils'
|
|
|
|
|
|
|
|
|
|
export const DispatchContext = React.createContext<{ dispatch: React.Dispatch<Action>, state: State, getDetails: () => void } | null>(null);
|
|
export const DispatchContext = React.createContext<{ dispatch: React.Dispatch<Action>, state: State, getDetails: () => void } | null>(null);
|
|
@@ -89,9 +89,8 @@ function App() {
|
|
} else {
|
|
} else {
|
|
console.log(gameId)
|
|
console.log(gameId)
|
|
if (gameId) {
|
|
if (gameId) {
|
|
- if (searchParams.get('code') && isWx()) {
|
|
|
|
|
|
+ if (searchParams.get('code') && isWeChat()) {
|
|
weChatLogin.run({ code: searchParams.get('code') }).then(res => {
|
|
weChatLogin.run({ code: searchParams.get('code') }).then(res => {
|
|
- console.log('1111', res)
|
|
|
|
if (+res.code === 200) {
|
|
if (+res.code === 200) {
|
|
dispatch({ type: 'setToken', params: { token: res?.data?.token } })
|
|
dispatch({ type: 'setToken', params: { token: res?.data?.token } })
|
|
setToken(res?.data?.token)
|
|
setToken(res?.data?.token)
|
|
@@ -118,7 +117,7 @@ function App() {
|
|
let iconLink: any = document.querySelector('link[rel="icon"]');
|
|
let iconLink: any = document.querySelector('link[rel="icon"]');
|
|
iconLink.href = res.data?.h5GameConfigDTO?.h5SignLogo
|
|
iconLink.href = res.data?.h5GameConfigDTO?.h5SignLogo
|
|
}
|
|
}
|
|
- if (!searchParams.get('code') && res.data.isPut && res.data.appId && isWx()) {
|
|
|
|
|
|
+ if (!searchParams.get('code') && res.data.isPut && res.data.appId && isWeChat()) {
|
|
setIsShowLogin(false)
|
|
setIsShowLogin(false)
|
|
window.location.replace(`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${res.data.appId}&redirect_uri=${encodeURIComponent(location.href)}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`)
|
|
window.location.replace(`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${res.data.appId}&redirect_uri=${encodeURIComponent(location.href)}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`)
|
|
} else {
|
|
} else {
|