From 9b1d9206d258efb155db839782dad203c45d4b5c Mon Sep 17 00:00:00 2001 From: lyp Date: Fri, 18 Apr 2025 18:50:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/head/Head.tsx | 428 ++++++++++++++++++++++---------------- src/route/index/Index.tsx | 53 ++--- src/util/AjaxUtils.ts | 4 +- 3 files changed, 278 insertions(+), 207 deletions(-) diff --git a/src/layout/head/Head.tsx b/src/layout/head/Head.tsx index 5e3eb47..3353bd7 100644 --- a/src/layout/head/Head.tsx +++ b/src/layout/head/Head.tsx @@ -2,9 +2,14 @@ import './head.css' // import { NodeJS } from 'types/node'; import { useDispatch, - useSelector + useSelector, + } from 'react-redux' -import { getCode, checkPhone, updatePhone } from '../../request/api' +import { operatorBaseUrl } from '../../util/AjaxUtils.ts' +import { + getCode, checkPhone, + // updatePhone +} from '../../request/api' import BalanceHead from '../../components/balance/BalanceHead.tsx'; import RechargeHead from '../../components/recharge/RechargeHead.tsx'; import { @@ -110,7 +115,7 @@ interface DataType { // ]; import { DownOutlined, UserOutlined, QuestionCircleOutlined, BellOutlined, KeyOutlined, LogoutOutlined, GiftOutlined, AccountBookOutlined, ContainerOutlined, MenuFoldOutlined, UsergroupAddOutlined, TableOutlined } from "@ant-design/icons"; -import { useContext, useEffect, useState } from "react"; +import { useContext, useEffect, useState, useRef } from "react"; import { put, get, // post, @@ -136,52 +141,102 @@ import NoticeModal from '../../components/NoticeModal/NoticeModal.tsx'; import type { TableColumnsType, } from 'antd'; +// import { log } from 'console'; // import HeadCouponModal from '../../components/CouponModal/HeadCouponModal.tsx' export default function Head() { + // const currentUrl = window.location.href; + const formRef = useRef(null); + // const triggerFormSubmit = () => { + // if (formRef.current) { + // formRef.current.submit(); + // } + // }; // lyp const [form] = Form.useForm(); const [isUpdateWxUsernamePhone, setIsUpdateWxUsernamePhone] = useState(false); // 绑定手机号号弹窗 const [userId, setUserId] = useState(''); // 验证码ID - const submit = async (phone: any, code: any) => { - try { - const formData = new URLSearchParams(); - formData.append('userId', userId); - formData.append('phone', phone); - formData.append('smsCode', code); + // const submit = async (phone: string, code: string) => { + // try { + // const formData = new URLSearchParams(); + // formData.append('userId', userId); + // formData.append('phone', phone); + // formData.append('smsCode', code); - const res = await updatePhone(formData.toString()); - console.log(res); + // // await updatePhone(); + // const res = await updatePhone(formData); + // console.log('表单提交数据', res) + // // console.log(res); - } catch (error: any) { - setPhoneLoading(false) - if (error.response) { - const data = error.response.data; - messageApi.open({ - type: 'error', - content: data.msg ? data.msg : `${data.path}(${data.status})`, - }); - } else { - console.error(error) - } - } - } + // } catch (error: any) { + // setPhoneLoading(false) + // if (error.response) { + // const data = error.response.data; + // messageApi.open({ + // type: 'error', + // content: data.msg ? data.msg : `${data.path}(${data.status})`, + // }); + // } else { + // console.error(error) + // } + // } + // } const [phoneloading, setPhoneLoading] = useState(false) + // const handleFormSubmit = async (e: React.FormEvent) => { + + // e.preventDefault(); // 阻止表单默认提交行为 + // // const form = e.currentTarget; + // // const formData = new FormData(form); + // // const url = operatorBaseUrl + '/operator/oauth/wx/update/phone'; + + // // console.log('嘻嘻',formData); + + // // await fetch(url, { + // // method: 'POST', + // // body: formData + // // }); + // // console.log(response); + + + // // if (!response.ok) { + // // // 响应状态码不是 200-299 时,认为请求失败 + // // const errorData = await response.json(); + // // messageApi.open({ + // // type: 'error', + // // content: errorData.msg ? errorData.msg : `请求失败,状态码: ${response.status}` + // // }); + // // } else { + // // console.log('表单提交成功'); + // // const result = await response.json(); + // // console.log('响应数据:', result); + // // } + + // }; const onFinish = async (values: any) => { // console.log('Success:', values); try { + setPhoneLoading(true) const res = await checkPhone(values.phone) - // console.log(res); + // const formData = new URLSearchParams(); + // formData.append('userId', userId); + // formData.append('phone', values.phone); + // formData.append('smsCode', values.smsCode); + // console.log('结果',res); if (res.data == 'SUCCESS') { - setPhoneLoading(true) - submit(values.phone, values.smsCode) - setPhoneLoading(false) + if (formRef.current) { + + // // 触发表单提交 + formRef.current.submit(); + // console.log(formRef.current); + } + } else { + setPhoneLoading(false) messageApi.open({ type: 'error', content: '手机号已被绑定,请更换手机号', }); } - + // await submit(values.phone, values.smsCode) } catch (error: any) { setPhoneLoading(false) if (error.response) { @@ -269,8 +324,9 @@ export default function Head() { }) } // useEffect(() => { - // getPickList(); - // }, [packPage]); + // console.log('路径',currentUrl); + + // }, []); // const [page, setPage] = useState(1) //邀请码使用人数分页 @@ -1876,166 +1932,176 @@ export default function Head() { justifyContent: 'center', alignItems: 'center', }}> - -
-
-
- -
-
- -
-
- -
+ {/* */} +
+
+
+
-
-
+ +
+
+ +
+
+
+
+
{ + setIsUpdateWxUsernamePhone(false); + dispath({ + type: 'changePhoneModal', + val: false + }) + getUserData() }}> -
{ - setIsUpdateWxUsernamePhone(false); - dispath({ - type: 'changePhoneModal', - val: false - }) - getUserData() - }}> - -
+ +
+ +
+
+
您正在绑定手机号
+
绑定手机号后,您可以通过手机号码登录平台
+
+
+
+ + + + +
+
+ + + + + {countdown === 0 ? ( +
+ 发送验证码 +
+ ) : ( +
+ 倒计时 {countdown} 秒 +
+ )} +
+
+ + + +
+ +
+
{ + setIsUpdateWxUsernamePhone(false); + dispath({ + type: 'changePhoneModal', + val: false + }) + getUserData() + }}>跳过,下次再说
+ + +
-
您正在绑定手机号
-
绑定手机号后,您可以通过手机号码登录平台
-
-
-
- - - - -
-
- - - - - {countdown === 0 ? ( -
- 发送验证码 -
- ) : ( -
- 倒计时 {countdown} 秒 -
- )} -
-
- - - -
- -
-
-
{ - setIsUpdateWxUsernamePhone(false); - dispath({ - type: 'changePhoneModal', - val: false - }) - getUserData() - }}>跳过,下次再说
+
+ + + + {/* */} +
- +
+ {/* */}
diff --git a/src/route/index/Index.tsx b/src/route/index/Index.tsx index 42f724c..1f2b004 100644 --- a/src/route/index/Index.tsx +++ b/src/route/index/Index.tsx @@ -76,7 +76,7 @@ interface DataType { } export default function Index() { - + // const height = window.innerHeight - 180; const columns: TableColumnsType = [ { @@ -1064,7 +1064,7 @@ export default function Index() { } }) } - + // const [languageList, setLanguageList] = useState([]) // 开发者语言列表 // // 获取语言列表 // const getLanguageListDate = async () => { @@ -2669,8 +2669,10 @@ export default function Index() { allowClear /> { // setCouponModal(false) @@ -3113,7 +3117,7 @@ export default function Index() { setGetCouponModal(false) }} zIndex={99} - > + >
{couponArray.map((item: any) => { return ( @@ -3312,25 +3316,26 @@ export default function Index() { centered > {/*
*/} - { - nav('/product-release', { - state: { - sellKeywords: '', - sellBelongType: '', - sellDate: '', - language: '', - sellBoxtype: '', - } - }) - } - } closeModal={() => { setSellModal(false) }} > + { + nav('/product-release', { + state: { + sellKeywords: '', + sellBelongType: '', + sellDate: '', + language: '', + sellBoxtype: '', + } + }) + } + } closeModal={() => { setSellModal(false) }} > {/*
*/}
diff --git a/src/util/AjaxUtils.ts b/src/util/AjaxUtils.ts index ee525af..ae1de3e 100644 --- a/src/util/AjaxUtils.ts +++ b/src/util/AjaxUtils.ts @@ -22,8 +22,8 @@ export const WebSocketBaseUrl: string = `ws://${host}:7025/copyright`; axios.defaults.baseURL = `${copyBaseUrl}/copyright`; -export const DevUserId: string = '80d3365e-0597-4988-979e-18ef1c3ec671'; // 18634604067 -// export const DevUserId: string = 'a2ab4e3a-fd92-4723-9217-f9955ee92911'; +// export const DevUserId: string = '80d3365e-0597-4988-979e-18ef1c3ec671'; // 18634604067 +export const DevUserId: string = 'ccb00bbe-a6cd-468a-a8e2-a6f39f6acccb'; // export const DevUserId: string = '6fb8e783-243c-4eec-8d98-c9b1c8aeaa00'; // 15042810561 密码123456 // export const DevUserId: string = 'c2438eb8-2685-49a9-bf02-5111a5192d96'; // 18647109157 // export const DevUserId: string = '';