|
@@ -17,6 +17,7 @@ import "./index.scss";
|
|
import React, { useState , useEffect, useCallback} from 'react'
|
|
import React, { useState , useEffect, useCallback} from 'react'
|
|
import { AtFloatLayout } from "taro-ui"
|
|
import { AtFloatLayout } from "taro-ui"
|
|
import { showToast } from "@tarojs/taro";
|
|
import { showToast } from "@tarojs/taro";
|
|
|
|
+import ctyptoUtil from "@/utils/crypto";
|
|
interface IMineProps {}
|
|
interface IMineProps {}
|
|
|
|
|
|
const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
@@ -38,10 +39,26 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
}
|
|
}
|
|
// 关闭浮动层的函数
|
|
// 关闭浮动层的函数
|
|
const handleClose = () => {
|
|
const handleClose = () => {
|
|
- setIsSHow(false)
|
|
|
|
|
|
+ setIsSHow(false);
|
|
|
|
+ // setIsGetValidate(false);
|
|
|
|
+ // setTime(10); // 重置倒计时
|
|
|
|
+ setPhone('');
|
|
|
|
+ setValidate('');
|
|
|
|
+ setCheckedPhone(false);
|
|
|
|
+ setChecked(false);
|
|
|
|
+ setShowNum(0);
|
|
|
|
+
|
|
}
|
|
}
|
|
const [showNum, setShowNum] = useState(0)
|
|
const [showNum, setShowNum] = useState(0)
|
|
const showNumChange = (val) => {
|
|
const showNumChange = (val) => {
|
|
|
|
+ if(!checked){
|
|
|
|
+ showToast({
|
|
|
|
+ title: "请确定已阅读并同意!",
|
|
|
|
+ icon: "none",
|
|
|
|
+ duration: 2000,
|
|
|
|
+ });
|
|
|
|
+ return
|
|
|
|
+ }
|
|
setShowNum(val)
|
|
setShowNum(val)
|
|
}
|
|
}
|
|
const ApplyButton = ({ isLogin }) => {
|
|
const ApplyButton = ({ isLogin }) => {
|
|
@@ -120,7 +137,26 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
const handleCheckboxChange = () => {
|
|
const handleCheckboxChange = () => {
|
|
setChecked(!checked)
|
|
setChecked(!checked)
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ const quickLogin =async (e) =>{
|
|
|
|
+ if(!checked){
|
|
|
|
+ showToast({
|
|
|
|
+ title: "请确定已阅读并同意!",
|
|
|
|
+ icon: "none",
|
|
|
|
+ duration: 2000,
|
|
|
|
+ });
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if (e.detail.code && await UserHelper.userWxLogin(e.detail.code) === true) {
|
|
|
|
+ handleClose();
|
|
|
|
+ indexInfoResult.data &&
|
|
|
|
+ RouteUtil.toWebViewPage({
|
|
|
|
+ url: indexInfoResult.data.link,
|
|
|
|
+ });
|
|
|
|
+ if (UserHelper.callback) {
|
|
|
|
+ await UserHelper.callback();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
// 打开浮动层的函数
|
|
// 打开浮动层的函数
|
|
const LoginIntroduce = () =>{
|
|
const LoginIntroduce = () =>{
|
|
@@ -166,9 +202,14 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
<Text onClick={goRegPage} className="blue">《注册政策》</Text><Text onClick={goPrivacyPage} className="blue">《隐私政策》</Text>
|
|
<Text onClick={goRegPage} className="blue">《注册政策》</Text><Text onClick={goPrivacyPage} className="blue">《隐私政策》</Text>
|
|
</View>
|
|
</View>
|
|
<View>
|
|
<View>
|
|
- <Button className='index-back-btn fontsize' onClick={() => {
|
|
|
|
- }}
|
|
|
|
|
|
+ {
|
|
|
|
+ checked ? <Button className='index-back-btn fontsize' openType='getPhoneNumber'
|
|
|
|
+ onGetPhoneNumber={quickLogin}
|
|
>一键快捷登录</Button>
|
|
>一键快捷登录</Button>
|
|
|
|
+ :
|
|
|
|
+ <Button className='index-back-btn fontsize' onClick={quickLogin}>一键快捷登录</Button>
|
|
|
|
+ }
|
|
|
|
+
|
|
</View>
|
|
</View>
|
|
<View onClick={showNumChange.bind(null, 1)} className="other-login">输入手机号登录</View>
|
|
<View onClick={showNumChange.bind(null, 1)} className="other-login">输入手机号登录</View>
|
|
</View>
|
|
</View>
|
|
@@ -186,12 +227,16 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
const timeChange = (val) => {
|
|
const timeChange = (val) => {
|
|
setTime(val)
|
|
setTime(val)
|
|
}
|
|
}
|
|
- const phoneNumChange = useCallback((e) => {
|
|
|
|
|
|
+ const phoneNumChange = (e) => {
|
|
setPhone(e.detail.value);
|
|
setPhone(e.detail.value);
|
|
- }, [])
|
|
|
|
- const validateChange = useCallback((e) => {
|
|
|
|
|
|
+ // setFocus1(true);
|
|
|
|
+ // setFocus2(false);
|
|
|
|
+ }
|
|
|
|
+ const validateChange = (e) => {
|
|
setValidate(e.detail.value);
|
|
setValidate(e.detail.value);
|
|
- }, [])
|
|
|
|
|
|
+ // setFocus1(false);
|
|
|
|
+ // setFocus2(true);
|
|
|
|
+ }
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
let intervalId = null;
|
|
let intervalId = null;
|
|
if (isGetValidate && time > 0) {
|
|
if (isGetValidate && time > 0) {
|
|
@@ -205,10 +250,35 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
return () => clearInterval(intervalId);
|
|
return () => clearInterval(intervalId);
|
|
}, [isGetValidate, time]);
|
|
}, [isGetValidate, time]);
|
|
|
|
|
|
- const isGetValidateChange = () => {
|
|
|
|
|
|
+ const isGetValidateChange = async () => {
|
|
|
|
+ if(phone == ""){
|
|
|
|
+ showToast({
|
|
|
|
+ title: "手机号不能为空!",
|
|
|
|
+ icon: "none",
|
|
|
|
+ duration: 2000,
|
|
|
|
+ });
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ // setFocus1(false);
|
|
|
|
+ // setFocus2(false);
|
|
setIsGetValidate(!isGetValidate);
|
|
setIsGetValidate(!isGetValidate);
|
|
setTime(10); // 重置倒计时
|
|
setTime(10); // 重置倒计时
|
|
|
|
+ let obj = {
|
|
|
|
+ "channelCode":"txxcx01",
|
|
|
|
+ "phone":ctyptoUtil.AesEncode(phone),
|
|
|
|
+ "sceneType":"register"
|
|
|
|
+ }
|
|
|
|
+ UserApi.sendCode({
|
|
|
|
+ data: { ...obj },
|
|
|
|
+ }).h5toData().then((res:any) => {
|
|
|
|
+ showToast({
|
|
|
|
+ title: res.msg,
|
|
|
|
+ icon: "none",
|
|
|
|
+ duration: 2000,
|
|
|
|
+ });
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
+
|
|
const submitClick = () =>{
|
|
const submitClick = () =>{
|
|
if(!checkedPhone){
|
|
if(!checkedPhone){
|
|
showToast({
|
|
showToast({
|
|
@@ -216,6 +286,7 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
icon: "none",
|
|
icon: "none",
|
|
duration: 2000,
|
|
duration: 2000,
|
|
});
|
|
});
|
|
|
|
+ return
|
|
}
|
|
}
|
|
if(phone == ""){
|
|
if(phone == ""){
|
|
showToast({
|
|
showToast({
|
|
@@ -223,14 +294,43 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
icon: "none",
|
|
icon: "none",
|
|
duration: 2000,
|
|
duration: 2000,
|
|
});
|
|
});
|
|
|
|
+ return
|
|
}else if(validate == ""){
|
|
}else if(validate == ""){
|
|
showToast({
|
|
showToast({
|
|
title: "验证码不能为空!",
|
|
title: "验证码不能为空!",
|
|
icon: "none",
|
|
icon: "none",
|
|
duration: 2000,
|
|
duration: 2000,
|
|
});
|
|
});
|
|
|
|
+ return
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ let obj = {
|
|
|
|
+ "channelCode":"txxcx01",
|
|
|
|
+ "phone":ctyptoUtil.AesEncode(phone),
|
|
|
|
+ sceneType:"register",
|
|
|
|
+ uctrackid: "",
|
|
|
|
+ verifyCode:validate,
|
|
|
|
+ }
|
|
|
|
+ UserApi.login({
|
|
|
|
+ data: { ...obj },
|
|
|
|
+ }).h5toData().then(async(res:any) => {
|
|
|
|
+ if(res.code == 1){
|
|
|
|
+ showToast({
|
|
|
|
+ title: res.msg,
|
|
|
|
+ icon: "none",
|
|
|
|
+ duration: 2000,
|
|
|
|
+ });
|
|
|
|
+ }else if(res.code == 0){
|
|
|
|
+ indexInfoResult.data &&
|
|
|
|
+ RouteUtil.toWebViewPage({
|
|
|
|
+ url: indexInfoResult.data.link,
|
|
|
|
+ });
|
|
|
|
+ if (UserHelper.callback) {
|
|
|
|
+ await UserHelper.callback();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }).catch((err)=>{
|
|
|
|
+ console.log(err)
|
|
|
|
+ })
|
|
}
|
|
}
|
|
const goRegPage = () =>{
|
|
const goRegPage = () =>{
|
|
RouteUtil.toWebViewPage({
|
|
RouteUtil.toWebViewPage({
|
|
@@ -242,6 +342,8 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
url: "/pages/user/aggrement/index",
|
|
url: "/pages/user/aggrement/index",
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ // const [focus1, setFocus1] = useState(false);
|
|
|
|
+ // const [focus2, setFocus2] = useState(false);
|
|
const PhoneLogin = () =>{
|
|
const PhoneLogin = () =>{
|
|
return(
|
|
return(
|
|
<>
|
|
<>
|
|
@@ -285,13 +387,29 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
<Text onClick={goRegPage} className="blue">《注册政策》</Text><Text onClick={goRegPage} className="blue">《隐私政策》</Text>
|
|
<Text onClick={goRegPage} className="blue">《注册政策》</Text><Text onClick={goRegPage} className="blue">《隐私政策》</Text>
|
|
</View>
|
|
</View>
|
|
<View>
|
|
<View>
|
|
- <Button className='index-back-btn fontsize' onClick={submitClick}
|
|
|
|
|
|
+ <Button className='index-back-btn fontsize36' onClick={submitClick}
|
|
>立即登录</Button>
|
|
>立即登录</Button>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</>
|
|
</>
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ const [isShow2, setIsShow2] = useState(false);
|
|
|
|
+ const [phone2, setPhone2] = useState('');
|
|
|
|
+ const [validate2, setValidate2] = useState('');
|
|
|
|
+ const phoneNumChange2 = (e) => {
|
|
|
|
+ setPhone2(e.detail.value);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ const validateChange2 = (e) => {
|
|
|
|
+ setValidate2(e.detail.value);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<Layout className='mine' bottomBarIndex={1}>
|
|
<Layout className='mine' bottomBarIndex={1}>
|
|
<SizeBox height={statusBarHeight}></SizeBox>
|
|
<SizeBox height={statusBarHeight}></SizeBox>
|