|
@@ -14,6 +14,7 @@ import RouteUtil from "@/utils/routeUtil";
|
|
import UserHelper from "@/helper/userHelper";
|
|
import UserHelper from "@/helper/userHelper";
|
|
import Button from "@/component/button";
|
|
import Button from "@/component/button";
|
|
import "./index.scss";
|
|
import "./index.scss";
|
|
|
|
+import StorageUtil, { EStorage } from "@/utils/storageUtil";
|
|
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";
|
|
@@ -26,7 +27,7 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
const { statusBarHeight } = appContext.systemInfo!;
|
|
const { statusBarHeight } = appContext.systemInfo!;
|
|
const userInfo = useStore((p) => p.userInfo);
|
|
const userInfo = useStore((p) => p.userInfo);
|
|
const isUserLogin = UserHelper.isLogin()
|
|
const isUserLogin = UserHelper.isLogin()
|
|
- const userName = '小花';
|
|
|
|
|
|
+
|
|
const indexInfoResult = useRequest(() => {
|
|
const indexInfoResult = useRequest(() => {
|
|
return UserApi.getIndexInfoUsingPost({
|
|
return UserApi.getIndexInfoUsingPost({
|
|
params: { appId: APPConfig.APPID },
|
|
params: { appId: APPConfig.APPID },
|
|
@@ -35,6 +36,7 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
const [isSHow, setIsSHow] = useState(false)
|
|
const [isSHow, setIsSHow] = useState(false)
|
|
// 打开浮动层的函数
|
|
// 打开浮动层的函数
|
|
const handleOpen = () => {
|
|
const handleOpen = () => {
|
|
|
|
+ setShowNum(0);
|
|
setIsSHow(true)
|
|
setIsSHow(true)
|
|
}
|
|
}
|
|
// 关闭浮动层的函数
|
|
// 关闭浮动层的函数
|
|
@@ -46,8 +48,6 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
setValidate('');
|
|
setValidate('');
|
|
setCheckedPhone(false);
|
|
setCheckedPhone(false);
|
|
setChecked(false);
|
|
setChecked(false);
|
|
- setShowNum(0);
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
const [showNum, setShowNum] = useState(0)
|
|
const [showNum, setShowNum] = useState(0)
|
|
const showNumChange = (val) => {
|
|
const showNumChange = (val) => {
|
|
@@ -102,10 +102,10 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
<View
|
|
<View
|
|
className="mine-info"
|
|
className="mine-info"
|
|
>
|
|
>
|
|
- <Padding padding={EdgeInsets.symmetric({ horizontal: 32 })}>
|
|
|
|
|
|
+ <Padding padding={EdgeInsets.symmetric({ horizontal: 20 })}>
|
|
<Image
|
|
<Image
|
|
- src={require("../../../assets/icon_mine_avatar.png")}
|
|
|
|
- className='avatar-image'
|
|
|
|
|
|
+ src={require("../../../assets/icon_head.png")}
|
|
|
|
+ className='avatar-image-head'
|
|
/>
|
|
/>
|
|
</Padding>
|
|
</Padding>
|
|
<View className="mine-box">
|
|
<View className="mine-box">
|
|
@@ -117,10 +117,10 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
className="mine-info"
|
|
className="mine-info"
|
|
onClick={handleOpen}
|
|
onClick={handleOpen}
|
|
>
|
|
>
|
|
- <Padding padding={EdgeInsets.symmetric({ horizontal: 32 })}>
|
|
|
|
|
|
+ <Padding padding={EdgeInsets.symmetric({ horizontal: 20 })}>
|
|
<Image
|
|
<Image
|
|
- src={require("../../../assets/icon_mine_avatar.png")}
|
|
|
|
- className='avatar-image'
|
|
|
|
|
|
+ src={require("../../../assets/icon_head.png")}
|
|
|
|
+ className='avatar-image-head'
|
|
/>
|
|
/>
|
|
</Padding>
|
|
</Padding>
|
|
<View className="mine-box">
|
|
<View className="mine-box">
|
|
@@ -152,9 +152,9 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
RouteUtil.toWebViewPage({
|
|
RouteUtil.toWebViewPage({
|
|
url: indexInfoResult.data.link,
|
|
url: indexInfoResult.data.link,
|
|
});
|
|
});
|
|
- if (UserHelper.callback) {
|
|
|
|
- await UserHelper.callback();
|
|
|
|
- }
|
|
|
|
|
|
+ if (UserHelper.callback) {
|
|
|
|
+ await UserHelper.callback();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -163,6 +163,10 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
return(
|
|
return(
|
|
<>
|
|
<>
|
|
<View className="login-introduce">
|
|
<View className="login-introduce">
|
|
|
|
+ <Image
|
|
|
|
+ src={require("../../../assets/box-bg.png")}
|
|
|
|
+ className='avatar-image-bg'
|
|
|
|
+ />
|
|
<View className="title">登录方式选择及隐私政策告知
|
|
<View className="title">登录方式选择及隐私政策告知
|
|
<View onClick={handleClose}>
|
|
<View onClick={handleClose}>
|
|
<Image
|
|
<Image
|
|
@@ -216,7 +220,7 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
</>
|
|
</>
|
|
)
|
|
)
|
|
}
|
|
}
|
|
- const [time, setTime] = useState(10)
|
|
|
|
|
|
+ const [time, setTime] = useState(60)
|
|
const [isGetValidate, setIsGetValidate] = useState(false);
|
|
const [isGetValidate, setIsGetValidate] = useState(false);
|
|
const [validate, setValidate] = useState('');
|
|
const [validate, setValidate] = useState('');
|
|
const [phone, setPhone] = useState('');
|
|
const [phone, setPhone] = useState('');
|
|
@@ -259,26 +263,36 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
});
|
|
});
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- // setFocus1(false);
|
|
|
|
- // setFocus2(false);
|
|
|
|
- setIsGetValidate(!isGetValidate);
|
|
|
|
- setTime(10); // 重置倒计时
|
|
|
|
- let obj = {
|
|
|
|
- "channelCode":"txxcx01",
|
|
|
|
- "phone":ctyptoUtil.AesEncode(phone),
|
|
|
|
- "sceneType":"register"
|
|
|
|
- }
|
|
|
|
- UserApi.sendCode({
|
|
|
|
- data: { ...obj },
|
|
|
|
- }).h5toData().then((res:any) => {
|
|
|
|
|
|
+ if(isPhoneAvailable(phone)){
|
|
|
|
+ setIsGetValidate(!isGetValidate);
|
|
|
|
+ setTime(60); // 重置倒计时
|
|
|
|
+ let obj = {
|
|
|
|
+ "channelCode":"jiheyanfa",
|
|
|
|
+ // "channelCode":"txxcx01",
|
|
|
|
+ "phone":ctyptoUtil.AesEncode(phone),
|
|
|
|
+ "sceneType":"register"
|
|
|
|
+ }
|
|
|
|
+ UserApi.sendCode({
|
|
|
|
+ data: { ...obj },
|
|
|
|
+ }).h5toData().then((res:any) => {
|
|
|
|
+ showToast({
|
|
|
|
+ title: res.msg,
|
|
|
|
+ icon: "none",
|
|
|
|
+ duration: 2000,
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
showToast({
|
|
showToast({
|
|
- title: res.msg,
|
|
|
|
|
|
+ title: "手机号有误!",
|
|
icon: "none",
|
|
icon: "none",
|
|
duration: 2000,
|
|
duration: 2000,
|
|
- });
|
|
|
|
- })
|
|
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ const isPhoneAvailable = value => {
|
|
|
|
+ let phoneReg = /^[1][3,4,5,7,8,9][0-9]{9}$/
|
|
|
|
+ return phoneReg.test(value)
|
|
}
|
|
}
|
|
-
|
|
|
|
const submitClick = () =>{
|
|
const submitClick = () =>{
|
|
if(!checkedPhone){
|
|
if(!checkedPhone){
|
|
showToast({
|
|
showToast({
|
|
@@ -295,7 +309,14 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
duration: 2000,
|
|
duration: 2000,
|
|
});
|
|
});
|
|
return
|
|
return
|
|
- }else if(validate == ""){
|
|
|
|
|
|
+ }else if(!isPhoneAvailable(phone)){
|
|
|
|
+ showToast({
|
|
|
|
+ title: "手机号有误!",
|
|
|
|
+ icon: "none",
|
|
|
|
+ duration: 2000,
|
|
|
|
+ });
|
|
|
|
+ return
|
|
|
|
+ } else if(validate == ""){
|
|
showToast({
|
|
showToast({
|
|
title: "验证码不能为空!",
|
|
title: "验证码不能为空!",
|
|
icon: "none",
|
|
icon: "none",
|
|
@@ -304,7 +325,8 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
let obj = {
|
|
let obj = {
|
|
- "channelCode":"txxcx01",
|
|
|
|
|
|
+ "channelCode":"jiheyanfa",
|
|
|
|
+ // "channelCode":"txxcx01",
|
|
"phone":ctyptoUtil.AesEncode(phone),
|
|
"phone":ctyptoUtil.AesEncode(phone),
|
|
sceneType:"register",
|
|
sceneType:"register",
|
|
uctrackid: "",
|
|
uctrackid: "",
|
|
@@ -320,6 +342,13 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
duration: 2000,
|
|
duration: 2000,
|
|
});
|
|
});
|
|
}else if(res.code == 0){
|
|
}else if(res.code == 0){
|
|
|
|
+ handleClose();
|
|
|
|
+ let obj:any = {
|
|
|
|
+ userId:res.data.userId,
|
|
|
|
+ token:res.data.token,
|
|
|
|
+ userMobile:phone,
|
|
|
|
+ }
|
|
|
|
+ UserHelper.cacheUserInfo(obj);
|
|
indexInfoResult.data &&
|
|
indexInfoResult.data &&
|
|
RouteUtil.toWebViewPage({
|
|
RouteUtil.toWebViewPage({
|
|
url: indexInfoResult.data.link,
|
|
url: indexInfoResult.data.link,
|
|
@@ -332,18 +361,24 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
console.log(err)
|
|
console.log(err)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+ const aggrement = useRequest(() => {
|
|
|
|
+ return UserApi.agreementsUsingPost({ data: { "pageView": "register_privacy" } }).toData();
|
|
|
|
+ })
|
|
const goRegPage = () =>{
|
|
const goRegPage = () =>{
|
|
- RouteUtil.toWebViewPage({
|
|
|
|
- url: "/pages/user/aggrement/index",
|
|
|
|
- });
|
|
|
|
|
|
+ aggrement.data?.map((p, index) => {
|
|
|
|
+ if(p.name == '注册政策'){
|
|
|
|
+ RouteUtil.toWebViewPage({ url: p.url })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
const goPrivacyPage = () =>{
|
|
const goPrivacyPage = () =>{
|
|
- RouteUtil.toWebViewPage({
|
|
|
|
- url: "/pages/user/aggrement/index",
|
|
|
|
- });
|
|
|
|
|
|
+ console.log(aggrement);
|
|
|
|
+ aggrement.data?.map((p, index) => {
|
|
|
|
+ if(p.name == '隐私政策'){
|
|
|
|
+ RouteUtil.toWebViewPage({ url: p.url })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
- // const [focus1, setFocus1] = useState(false);
|
|
|
|
- // const [focus2, setFocus2] = useState(false);
|
|
|
|
const PhoneLogin = () =>{
|
|
const PhoneLogin = () =>{
|
|
return(
|
|
return(
|
|
<>
|
|
<>
|
|
@@ -382,7 +417,7 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
className='avatar-image'
|
|
className='avatar-image'
|
|
/>
|
|
/>
|
|
}
|
|
}
|
|
- <Text onClick={phoneChange}>请确定已阅读并同意</Text>
|
|
|
|
|
|
+ <Text className="agree" onClick={phoneChange}>请确定已阅读并同意</Text>
|
|
</View>
|
|
</View>
|
|
<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>
|
|
@@ -394,34 +429,125 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
|
|
</>
|
|
</>
|
|
)
|
|
)
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
- const [isShow2, setIsShow2] = useState(false);
|
|
|
|
- const [phone2, setPhone2] = useState('');
|
|
|
|
- const [validate2, setValidate2] = useState('');
|
|
|
|
- const phoneNumChange2 = (e) => {
|
|
|
|
- setPhone2(e.detail.value);
|
|
|
|
-
|
|
|
|
|
|
+ const maskPhone = (phone:string) => {
|
|
|
|
+ if (!phone || phone.length !== 11) return phone; // 确保电话号码有效且长度为11位
|
|
|
|
+ return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1***$2');
|
|
}
|
|
}
|
|
- const validateChange2 = (e) => {
|
|
|
|
- setValidate2(e.detail.value);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ const userName = maskPhone(userInfo.userMobile);
|
|
return (
|
|
return (
|
|
<Layout className='mine' bottomBarIndex={1}>
|
|
<Layout className='mine' bottomBarIndex={1}>
|
|
<SizeBox height={statusBarHeight}></SizeBox>
|
|
<SizeBox height={statusBarHeight}></SizeBox>
|
|
<SizeBox height={36}></SizeBox>
|
|
<SizeBox height={36}></SizeBox>
|
|
<LoginBox isLogin={isUserLogin} userName={userName}></LoginBox>
|
|
<LoginBox isLogin={isUserLogin} userName={userName}></LoginBox>
|
|
<AtFloatLayout isOpened={isSHow} onClose={ handleClose }>
|
|
<AtFloatLayout isOpened={isSHow} onClose={ handleClose }>
|
|
|
|
+ {
|
|
|
|
+ showNum == 0 && <Image
|
|
|
|
+ src={require("../../../assets/box-bg.png")}
|
|
|
|
+ className='avatar-image-bg'
|
|
|
|
+ />
|
|
|
|
+ }
|
|
{
|
|
{
|
|
- showNum == 0 ? <LoginIntroduce></LoginIntroduce> : <PhoneLogin></PhoneLogin>
|
|
|
|
|
|
+ showNum == 0 ?
|
|
|
|
+ <View className="login-introduce">
|
|
|
|
+
|
|
|
|
+ <View className="title">登录方式选择及隐私政策告知
|
|
|
|
+ <View onClick={handleClose}>
|
|
|
|
+ <Image
|
|
|
|
+ src={require("../../../assets/close.png")}
|
|
|
|
+ className='avatar-image'
|
|
|
|
+ />
|
|
|
|
+ </View>
|
|
|
|
+ </View>
|
|
|
|
+ <View className="text">
|
|
|
|
+ 为了您正常的使用我们的小程序服务,我们需要处理您的个人信息,具体详见 <Text onClick={goPrivacyPage} className="blue">《隐私政策》</Text>。
|
|
|
|
+ 在您未确认<Text onClick={goPrivacyPage} className="blue">《隐私政策》</Text>前,我们不会搜集您的任何信息。
|
|
|
|
+ 当您勾选协议后即标识您已阅读并同意<Text onClick={goPrivacyPage} className="blue">《隐私政策》</Text>和
|
|
|
|
+ <Text onClick={goRegPage} className="blue">《注册政策》</Text>上的全部内容
|
|
|
|
+ </View>
|
|
|
|
+ <View className="checkd">
|
|
|
|
+ <View className="checkbox">
|
|
|
|
+ {
|
|
|
|
+ checked ?
|
|
|
|
+ <Image onClick={handleCheckboxChange}
|
|
|
|
+ src={require("../../../assets/checkd.png")}
|
|
|
|
+ className='avatar-image'
|
|
|
|
+ />:
|
|
|
|
+ <Image onClick={handleCheckboxChange}
|
|
|
|
+ src={require("../../../assets/check.png")}
|
|
|
|
+ className='avatar-image'
|
|
|
|
+ />
|
|
|
|
+ }
|
|
|
|
+ <Text className="agree" onClick={handleCheckboxChange}>请确定已阅读并同意</Text>
|
|
|
|
+ </View>
|
|
|
|
+ <Text onClick={goRegPage} className="blue">《注册政策》</Text><Text onClick={goPrivacyPage} className="blue">《隐私政策》</Text>
|
|
|
|
+ </View>
|
|
|
|
+ <View>
|
|
|
|
+ {
|
|
|
|
+ checked ? <Button className='index-back-btn fontsize' openType='getPhoneNumber'
|
|
|
|
+ onGetPhoneNumber={quickLogin}
|
|
|
|
+ >一键快捷登录</Button>
|
|
|
|
+ :
|
|
|
|
+ <Button className='index-back-btn fontsize' onClick={quickLogin}>一键快捷登录</Button>
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ </View>
|
|
|
|
+ <View onClick={showNumChange.bind(null, 1)} className="other-login">输入手机号登录</View>
|
|
|
|
+ </View>
|
|
|
|
+ : <View className="login-introduce phone-Login">
|
|
|
|
+ <View className="title">
|
|
|
|
+ <Text className="text-title">登录诚易融</Text>
|
|
|
|
+ <View onClick={handleClose} className="float">
|
|
|
|
+ <Image
|
|
|
|
+ src={require("../../../assets/close.png")}
|
|
|
|
+ className='avatar-image'
|
|
|
|
+ />
|
|
|
|
+ </View>
|
|
|
|
+ </View>
|
|
|
|
+ <View className="input-box">
|
|
|
|
+ <View className="input-phone">
|
|
|
|
+ <Input type='text' placeholderClass="get" onInput={phoneNumChange} value={phone} placeholder='请输入本人实名认证手机号' maxlength={11}/>
|
|
|
|
+ </View>
|
|
|
|
+ <View className="input-password">
|
|
|
|
+ <Input type='text' placeholderClass="get" onInput={validateChange} value={validate} placeholder='请输入验证码' maxlength={10}/>
|
|
|
|
+ {
|
|
|
|
+ isGetValidate ? <View className="get">重新发送 ({time}S)</View> :
|
|
|
|
+ <View className="gettime" onClick={isGetValidateChange}>获取验证码</View>
|
|
|
|
+ }
|
|
|
|
+ </View>
|
|
|
|
+ </View>
|
|
|
|
+ <View className="checkd">
|
|
|
|
+ <View className="checkbox">
|
|
|
|
+ {
|
|
|
|
+ checkedPhone ?
|
|
|
|
+ <Image onClick={phoneChange}
|
|
|
|
+ src={require("../../../assets/checkd.png")}
|
|
|
|
+ className='avatar-image'
|
|
|
|
+ />:
|
|
|
|
+ <Image onClick={phoneChange}
|
|
|
|
+ src={require("../../../assets/check.png")}
|
|
|
|
+ className='avatar-image'
|
|
|
|
+ />
|
|
|
|
+ }
|
|
|
|
+ <Text onClick={phoneChange}>请确定已阅读并同意</Text>
|
|
|
|
+ </View>
|
|
|
|
+ <Text onClick={goRegPage} className="blue">《注册政策》</Text><Text onClick={goRegPage} className="blue">《隐私政策》</Text>
|
|
|
|
+ </View>
|
|
|
|
+ <View>
|
|
|
|
+ <Button className='index-back-btn fontsize36' onClick={submitClick}
|
|
|
|
+ >立即登录</Button>
|
|
|
|
+ </View>
|
|
|
|
+ </View>
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
</AtFloatLayout>
|
|
</AtFloatLayout>
|
|
|
|
+ {/* <AtFloatLayout isOpened={isSHow} onClose={ handleClose }>
|
|
|
|
+ {
|
|
|
|
+ showNum == 0 ? <LoginIntroduce></LoginIntroduce> : <PhoneLogin></PhoneLogin>
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ </AtFloatLayout> */}
|
|
<View
|
|
<View
|
|
className='mine-apply-panel'
|
|
className='mine-apply-panel'
|
|
style={{
|
|
style={{
|