wjx 1 tahun lalu
induk
melakukan
4ff5c961ea
5 mengubah file dengan 47 tambahan dan 12 penghapusan
  1. 18 0
      src/App.less
  2. 26 9
      src/App.tsx
  3. TEMPAT SAMPAH
      src/assets/image/wllqopen.png
  4. 1 1
      src/models/useConfig.ts
  5. 2 2
      src/pages/bindPhone/index.tsx

+ 18 - 0
src/App.less

@@ -541,4 +541,22 @@
 
 .modal_vertical {
 	transform: rotate(90deg);
+}
+
+.openLlq {
+	position: relative;
+	.zz {
+		width: 100%;
+		height: 100%;
+		background-color: rgba(0, 0, 0, 0.8);
+		position: absolute;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+
+		> img {
+			width: 100%;
+		}
+	}
 }

+ 26 - 9
src/App.tsx

@@ -11,8 +11,8 @@ import PwdPop from './pages/pwdPop'
 import useConfig, { Action, State } from './models/useConfig'
 import LoginSucc from './pages/loginSucc'
 import React from 'react'
-import { getRedirectUrl, isWeChat } from './utils'
-
+import { getRedirectUrl, isOs, isWeChat, isWx } from './utils'
+import wllqopenImg from './assets/image/wllqopen.png'
 
 export const DispatchContext = React.createContext<{ dispatch: React.Dispatch<Action>, state: State, getDetails: () => void } | null>(null);
 
@@ -27,6 +27,8 @@ function App() {
 	const { typeSwitch, token } = state
 	// const [isInit, setIsInit] = useState<boolean>(false)
 	const [isShowLogin, setIsShowLogin] = useState<boolean>(false)
+	const [isPhoneWxShow, setIsPhoneWxShow] = useState<boolean>(true)
+	const [isShow, setIsShow] = useState<boolean>(true)
 
 	const getInitApplet = useAjax(() => getInitAppletApi())
 	const weChatLogin = useAjax((params) => weChatLoginApi(params))
@@ -46,7 +48,7 @@ function App() {
 			dispatch({ type: 'setOrientation', params: { orientation: orientationType } })
 		}
 		handleOrientationChange()
-		function handlePopstate () {
+		function handlePopstate() {
 			window.history.pushState(null, '');
 		}
 		handlePopstate()
@@ -110,6 +112,7 @@ function App() {
 		getInitApplet.run().then(res => {
 			setIsLoding(false)
 			if (res?.data) {
+				let h5WeChatControl = res?.data?.h5GameConfigDTO?.h5WeChatControl || 'UN_CONTROL'
 				dispatch({ type: 'setIsPut', params: { isPut: (res.data.isPut && res.data.appId) || false } })
 				document.title = (res.data?.gameName || '游戏-登录')
 				dispatch({ type: 'setInitData', params: { initData: { ...res.data, ...res.data?.h5GameConfigDTO } } })
@@ -117,6 +120,10 @@ function App() {
 					let iconLink: any = document.querySelector('link[rel="icon"]');
 					iconLink.href = res.data?.h5GameConfigDTO?.h5SignLogo
 				}
+				if (isWx() && ['ios', 'android'].includes(isOs()) && h5WeChatControl === 'UN_WE_CHAT') {
+					setIsPhoneWxShow(false)
+					return
+				}
 				if (!searchParams.get('code') && res.data.isPut && res.data.appId && isWeChat()) {
 					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`)
@@ -151,15 +158,25 @@ function App() {
 
 	return <AntdApp>
 		<DispatchContext.Provider value={{ dispatch, state, getDetails }}>
-			{gameId ? <>
+			{gameId ? isPhoneWxShow ? <>
 				{isLoding ? <div className='loaing'><Spin spinning={true} /></div> : <div style={{ width: '100%', height: '100vh' }}>
 					{token ? <LoginSucc /> : isShowLogin ? Pop : <div className='loaing'><Spin spinning={true} /></div>}
 				</div>}
-			</> : <Result
-				status="404"
-				title="游戏ID为空"
-				subTitle="请在链接上传入游戏ID"
-			/>}
+			</> : <div style={{ width: '100%', height: '100vh', backgroundColor: '#FFF' }} className='openLlq'>
+				{isShow && <div className='zz' onClick={() => { setIsShow(false) }}>
+					<img src={wllqopenImg} />
+				</div>}
+				<Result
+					status="403"
+					title="请用浏览器打开"
+				/>
+			</div> : <div style={{ width: '100%', height: '100vh', backgroundColor: '#FFF' }}>
+				<Result
+					status="404"
+					title="游戏ID为空"
+					subTitle="请在链接上传入游戏ID"
+				/>
+			</div>}
 		</DispatchContext.Provider>
 	</AntdApp>
 }

TEMPAT SAMPAH
src/assets/image/wllqopen.png


+ 1 - 1
src/models/useConfig.ts

@@ -63,7 +63,7 @@ const initialState: State = {
     isBind: false,
     isAuth: false,
     token: getToken() || '',
-    typeSwitch: 'USER_LOGIN',
+    typeSwitch: 'PHONE_LOGIN',
     // 初始化数据
     initData: {},
     // 用户数据

+ 2 - 2
src/pages/bindPhone/index.tsx

@@ -55,8 +55,8 @@ const BindPhone: React.FC<Props> = ({ onChange, open, onClose }) => {
                 autoComplete="off"
                 onFinish={onFinish}
             >
-                <Form.Item name="mobile" style={{ marginBottom: 10 }} rules={[{ required: true, message: '请输入您的真实姓名!' }]}>
-                    <Input prefix={<TabletOutlined />} placeholder="请输入您的真实姓名" size="large" />
+                <Form.Item name="mobile" style={{ marginBottom: 10 }} rules={[{ required: true, message: '请输入手机号码!' }]}>
+                    <Input prefix={<TabletOutlined />} placeholder="请输入手机号码" size="large" />
                 </Form.Item>
                 <Form.Item name="code" rules={[{ required: true, message: '请输入您的身份证号码!' }]}>
                     <CodeInput mobile={mobile} msgType={3} prefix={<QrcodeOutlined />} placeholder="请输入验证码" size="large" />