Browse Source

feat: 调整接口数据

haizemu 3 tháng trước cách đây
mục cha
commit
00e390765c
5 tập tin đã thay đổi với 205 bổ sung86 xóa
  1. 2 2
      config/dev.js
  2. BIN
      src/assets/box-bg.png
  3. BIN
      src/assets/icon_head.png
  4. 21 28
      src/pages/user/mine/index.scss
  5. 182 56
      src/pages/user/mine/index.tsx

+ 2 - 2
config/dev.js

@@ -5,8 +5,8 @@ module.exports = {
   defineConstants: {
     ENV: '"DEVELOPMENT"',
     // "HOST": '"http://192.168.0.168:810"',
-    "HOST": '"http://loan-web-api2.internal.jiebide.xin"',
-    // HOST: '"https://api.hryk.net"',
+    // "HOST": '"http://loan-web-api2.internal.jiebide.xin"',
+    HOST: '"https://api.hryk.net"',
     APPID: '"422"',
   },
   mini: {},

BIN
src/assets/box-bg.png


BIN
src/assets/icon_head.png


+ 21 - 28
src/pages/user/mine/index.scss

@@ -12,6 +12,7 @@
     .mine-login{
       color:#181818;
       font-weight: 500;
+      margin-bottom: 10px;
     }
     .mine-text{
       color:#8d97b6;
@@ -21,9 +22,9 @@
       display: flex;
       flex-direction: column;
     }
-    .avatar-image{
-      width:50px;
-      height: 50px;
+    .avatar-image-head{
+      width:90px;
+      height: 90px;
       margin-right:10px;
     }
   }
@@ -188,7 +189,7 @@
   }
 }
 .login-introduce{
-  padding:20px;
+  padding:40px;
   margin-bottom:20px;
   .title{
     display: flex;
@@ -200,8 +201,8 @@
     margin-top:20px;
   }
   .avatar-image{
-    width:60px;
-    height: 60px;
+    width:50px;
+    height: 50px;
   }
   .text{
     padding:30px 0;
@@ -225,7 +226,7 @@
   }
   .other-login{
     text-align: center;
-    margin:20px 0;
+    margin:30px 0;
     color:#5c6e98;
     font-size: 26px;
     
@@ -241,6 +242,9 @@
     align-items: center;
   }
 }
+.agree{
+  color:#848EB0;
+}
 .phone-Login{
   position: relative;
   display: block;
@@ -250,8 +254,8 @@
   }
   .float{
     position: absolute;
-    top:30px;
-    right: 0px;
+    top:60px;
+    right: 40px;
   }
   .input-box{
     .input-phone{
@@ -284,23 +288,12 @@
 .at-float-layout--active .at-float-layout__container{
   border-radius: 30px 30px 0 0 ; 
 }
-.bg{
-  position: fixed;
-  top:0;
-  z-index: 1000;
-  width: 100vh;
-  height: 100vh;
-  background-color:rgba(0, 0, 0, 0.3);
-  transition: all 0.3s ease;
-  .box-bg{
-    position: absolute;
-    bottom:0;
-    width: 100vh;
-    height: 30vh;
-    background-color: #fff;
-    transition: all 0.3s ease;
-  }
-  .on30{
-    // bottom:30vh;
-  }
+.layout-body{
+  padding: 0 !important;
+}
+.avatar-image-bg{
+  width: 100%;
+  height: 240px;
+  position: absolute;
+  z-index: -1;
 }

+ 182 - 56
src/pages/user/mine/index.tsx

@@ -14,6 +14,7 @@ import RouteUtil from "@/utils/routeUtil";
 import UserHelper from "@/helper/userHelper";
 import Button from "@/component/button";
 import "./index.scss";
+import StorageUtil, { EStorage } from "@/utils/storageUtil";
 import React, { useState , useEffect, useCallback} from 'react'
 import { AtFloatLayout } from "taro-ui"
 import { showToast } from "@tarojs/taro";
@@ -26,7 +27,7 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
   const { statusBarHeight } = appContext.systemInfo!;
   const userInfo = useStore((p) => p.userInfo);
   const isUserLogin = UserHelper.isLogin()
-  const userName = '小花';
+  
   const indexInfoResult = useRequest(() => {
     return UserApi.getIndexInfoUsingPost({
       params: { appId: APPConfig.APPID },
@@ -35,6 +36,7 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
   const [isSHow, setIsSHow] = useState(false)
   // 打开浮动层的函数
   const handleOpen = () => {
+    setShowNum(0);
     setIsSHow(true)
   }
   // 关闭浮动层的函数
@@ -46,8 +48,6 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
     setValidate('');
     setCheckedPhone(false);
     setChecked(false);
-    setShowNum(0);
-
   }
   const [showNum, setShowNum] = useState(0)
   const showNumChange = (val) => {
@@ -102,10 +102,10 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
         <View
           className="mine-info"
           >
-          <Padding padding={EdgeInsets.symmetric({ horizontal: 32 })}>
+          <Padding padding={EdgeInsets.symmetric({ horizontal: 20 })}>
             <Image
-              src={require("../../../assets/icon_mine_avatar.png")}
-              className='avatar-image'
+              src={require("../../../assets/icon_head.png")}
+              className='avatar-image-head'
             />
           </Padding>
           <View className="mine-box">
@@ -117,10 +117,10 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
           className="mine-info"
           onClick={handleOpen}
           >
-          <Padding padding={EdgeInsets.symmetric({ horizontal: 32 })}>
+          <Padding padding={EdgeInsets.symmetric({ horizontal: 20 })}>
             <Image
-              src={require("../../../assets/icon_mine_avatar.png")}
-              className='avatar-image'
+              src={require("../../../assets/icon_head.png")}
+              className='avatar-image-head'
             />
           </Padding>
           <View className="mine-box">
@@ -152,9 +152,9 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
       RouteUtil.toWebViewPage({
         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(
       <>
       <View className="login-introduce">
+        <Image
+          src={require("../../../assets/box-bg.png")}
+          className='avatar-image-bg'
+        />
         <View className="title">登录方式选择及隐私政策告知   
           <View onClick={handleClose}>
           <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 [validate, setValidate] = useState('');
   const [phone, setPhone] = useState('');
@@ -259,26 +263,36 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
       });
       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({
-        title: res.msg,
+        title: "手机号有误!",
         icon: "none",
         duration: 2000,
-    });
-    })
+      });
+    }
+  }
+  const isPhoneAvailable = value => {
+    let phoneReg = /^[1][3,4,5,7,8,9][0-9]{9}$/
+    return phoneReg.test(value)
   }
-
   const submitClick = () =>{
     if(!checkedPhone){
       showToast({
@@ -295,7 +309,14 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
         duration: 2000,
       });
       return
-    }else if(validate == ""){
+    }else if(!isPhoneAvailable(phone)){
+      showToast({
+        title: "手机号有误!",
+        icon: "none",
+        duration: 2000,
+      });
+      return
+    } else if(validate == ""){
       showToast({
         title: "验证码不能为空!",
         icon: "none",
@@ -304,7 +325,8 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
       return
     }
     let obj = {
-      "channelCode":"txxcx01",
+      "channelCode":"jiheyanfa",
+      // "channelCode":"txxcx01",
       "phone":ctyptoUtil.AesEncode(phone),
       sceneType:"register",
       uctrackid: "",
@@ -320,6 +342,13 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
           duration: 2000,
         });
       }else if(res.code == 0){
+        handleClose();
+        let obj:any = {
+          userId:res.data.userId,
+          token:res.data.token,
+          userMobile:phone,
+        }
+        UserHelper.cacheUserInfo(obj);
         indexInfoResult.data &&
           RouteUtil.toWebViewPage({
             url: indexInfoResult.data.link,
@@ -332,18 +361,24 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
       console.log(err)
     })
   }
+  const aggrement = useRequest(() => {
+    return UserApi.agreementsUsingPost({ data: { "pageView": "register_privacy" } }).toData();
+  })
   const goRegPage = () =>{
-    RouteUtil.toWebViewPage({
-      url: "/pages/user/aggrement/index",
-    });
+    aggrement.data?.map((p, index) => {
+    if(p.name == '注册政策'){
+      RouteUtil.toWebViewPage({ url: p.url })
+    }
+  })
   }
   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 = () =>{
     return(
       <>
@@ -382,7 +417,7 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
                   className='avatar-image'
               />
               }
-              <Text onClick={phoneChange}>请确定已阅读并同意</Text>
+              <Text className="agree" onClick={phoneChange}>请确定已阅读并同意</Text>
             </View> 
             <Text onClick={goRegPage} className="blue">《注册政策》</Text><Text onClick={goRegPage} className="blue">《隐私政策》</Text>
           </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 (
     <Layout className='mine' bottomBarIndex={1}>
       <SizeBox height={statusBarHeight}></SizeBox>
       <SizeBox height={36}></SizeBox>
       <LoginBox isLogin={isUserLogin} userName={userName}></LoginBox>
       <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 isOpened={isSHow} onClose={ handleClose }>
+        {
+          showNum == 0 ? <LoginIntroduce></LoginIntroduce> : <PhoneLogin></PhoneLogin>
+        }
+        
+        
+      </AtFloatLayout> */}
       <View
         className='mine-apply-panel'
         style={{