瀏覽代碼

静态页面

xcx 4 年之前
父節點
當前提交
36018cd350

+ 1
- 1
src/components/AddYeZhuRenZheng/index.jsx 查看文件

62
   }, [CodeTimerNum])
62
   }, [CodeTimerNum])
63
 
63
 
64
   const CheckPhone = () => { // 校验手机号
64
   const CheckPhone = () => { // 校验手机号
65
-    return /^1(3\d|4\d|5\d|6\d|7\d|8\d|9\d)\d{8}$/g.test(FormData.Phone)
65
+    return FormData.Phone && FormData.Phone.indexOf('1') === 0 && FormData.Phone.length === 11
66
   }
66
   }
67
 
67
 
68
   const ToGetPhoneCode = () => {
68
   const ToGetPhoneCode = () => {

+ 1
- 1
src/components/WuYeBaoXiu/index.jsx 查看文件

19
   }, [])
19
   }, [])
20
 
20
 
21
   const GetBanner = (done = () => { }) => { // 获取轮播图
21
   const GetBanner = (done = () => { }) => { // 获取轮播图
22
-    request({ ...apis.getBanner, params: { contentType: `news`, pageNum: 1, pageSize: 1 } }).then((res) => {
22
+    request({ ...apis.getBanner, params: { showPosition: `property`, showType: 'banner', pageSize: 1 } }).then((res) => {
23
       setBannerList([...(res || [])])
23
       setBannerList([...(res || [])])
24
       done()
24
       done()
25
     }).catch(() => {
25
     }).catch(() => {

+ 1
- 1
src/components/WuYeFuWu/index.jsx 查看文件

19
   }, [])
19
   }, [])
20
 
20
 
21
   const GetBanner = (done = () => { }) => { // 获取轮播图
21
   const GetBanner = (done = () => { }) => { // 获取轮播图
22
-    request({ ...apis.getBanner, params: { contentType: `news`, pageNum: 1, pageSize: 1 } }).then((res) => {
22
+    request({ ...apis.getBanner, params: { showPosition: `property`, showType: 'banner', pageNum: 1, pageSize: 1 } }).then((res) => {
23
       setBannerList([...(res || [])])
23
       setBannerList([...(res || [])])
24
       done()
24
       done()
25
     }).catch(() => {
25
     }).catch(() => {

+ 1
- 1
src/components/WuYeGongGao/index.jsx 查看文件

19
   }, [])
19
   }, [])
20
 
20
 
21
   const GetBanner = (done = () => { }) => { // 获取轮播图
21
   const GetBanner = (done = () => { }) => { // 获取轮播图
22
-    request({ ...apis.getBanner, params: { contentType: `news`, pageNum: 1, pageSize: 1 } }).then((res) => {
22
+    request({ ...apis.getBanner, params: { showPosition: `property`, showType: 'banner', pageNum: 1, pageSize: 1 } }).then((res) => {
23
       setBannerList([...(res || [])])
23
       setBannerList([...(res || [])])
24
       done()
24
       done()
25
     }).catch(() => {
25
     }).catch(() => {

+ 1
- 1
src/components/WuYeJiaoFei/index.jsx 查看文件

64
   }, [])
64
   }, [])
65
 
65
 
66
   const GetBanner = (done = () => { }) => { // 获取轮播图
66
   const GetBanner = (done = () => { }) => { // 获取轮播图
67
-    request({ ...apis.getBanner, params: { contentType: `news`, pageNum: 1, pageSize: 1 } }).then((res) => {
67
+    request({ ...apis.getBanner, params: { showPosition: `property`, showType: 'banner', pageNum: 1, pageSize: 1 } }).then((res) => {
68
       setBannerList([...(res || [])])
68
       setBannerList([...(res || [])])
69
       done()
69
       done()
70
     }).catch(() => {
70
     }).catch(() => {

+ 33
- 24
src/layouts/index.jsx 查看文件

1
 import React, { useState, useEffect } from 'react'
1
 import React, { useState, useEffect } from 'react'
2
-import Taro, { } from '@tarojs/taro'
2
+import Taro, { useDidShow } from '@tarojs/taro'
3
 import { useModel } from '@/store'
3
 import { useModel } from '@/store'
4
 import Spin from '@/components/Spin'
4
 import Spin from '@/components/Spin'
5
 import GetUserPhone from '@/components/GetUserPhone/index'
5
 import GetUserPhone from '@/components/GetUserPhone/index'
21
 }
21
 }
22
 
22
 
23
 export default function (props) {
23
 export default function (props) {
24
+  const { user } = useModel('user')
25
+
26
+  const [page, setPage] = useState({})
27
+  const [loading, setLoading] = useState(true)
24
   const [showAuthBasic, setShowAuthBasic] = useState(false)
28
   const [showAuthBasic, setShowAuthBasic] = useState(false)
25
   const [showAuthYeZhu, setShowAuthYeZhu] = useState(false)
29
   const [showAuthYeZhu, setShowAuthYeZhu] = useState(false)
26
   const [showAuthPhone, setShowAuthPhone] = useState(false)
30
   const [showAuthPhone, setShowAuthPhone] = useState(false)
27
-  const { user } = useModel('user')
28
 
31
 
29
-  const loading = !user || !user.personId
30
-  const isAuthedBasic = user && user.avatarurl && user.nickname
31
-  const isAuthedPhone = user && user.phone
32
-  const isAuthedYeZhu = user && user.verifyStatus === 'certified'
32
+  const [isAuthedBasic, setIsAuthedBasic] = useState(false)
33
+  const [isAuthedPhone, setIsAuthedPhone] = useState(false)
34
+  const [isAuthedYeZhu, setIsAuthedYeZhu] = useState(false)
33
 
35
 
34
-  const page = getPage()
35
-  const needAuthBasic = (page.auth || []).indexOf('avatar') > -1
36
-  const needAuthYeZhu = (page.auth || []).indexOf('yezhu') > -1
37
-  const needAuthPhone = (page.auth || []).indexOf('phone') > -1
36
+  const [needAuthBasic, setNeedAuthBasic] = useState(false)
37
+  const [needAuthPhone, setNeedAuthPhone] = useState(false)
38
+  const [needAuthYeZhu, setNeedAuthYeZhu] = useState(false)
39
+
40
+  useDidShow(() => {
41
+    setPage(getPage())
42
+  })
43
+
44
+  useEffect(() => {
45
+    setLoading(!user || !user.personId)
46
+    setIsAuthedBasic(user && user.avatarurl && user.nickname)
47
+    setIsAuthedPhone(user && user.phone)
48
+    setIsAuthedYeZhu(user && user.verifyStatus === 'certified')
49
+  }, [user])
50
+  
51
+  useEffect(() => {
52
+    setNeedAuthBasic((page.auth || []).indexOf('avatar') > -1)
53
+    setNeedAuthPhone((page.auth || []).indexOf('phone') > -1)
54
+    setNeedAuthYeZhu((page.auth || []).indexOf('yezhu') > -1)
55
+  }, [page])
38
 
56
 
39
   // 埋点
57
   // 埋点
40
   useMountTrack()
58
   useMountTrack()
55
       return
73
       return
56
     }
74
     }
57
 
75
 
58
-    if (isAuthedPhone && !isAuthedYeZhu) {
59
-      const renZhengPage = pages.filter(x => x.isYeZhuRenZheng)[0]
60
-      if (renZhengPage) {
61
-        // 跳转到业主认证页面
62
-        // to = renZhengPage.page
63
-      }
76
+    if (isAuthedPhone && !isAuthedYeZhu && needAuthYeZhu) {
77
+      setShowAuthYeZhu(true)
78
+    } else {
79
+      setShowAuthYeZhu(false)
64
     }
80
     }
65
   }, [needAuthYeZhu, isAuthedPhone, page])
81
   }, [needAuthYeZhu, isAuthedPhone, page])
66
 
82
 
81
     setShowAuthBasic(needShow)
97
     setShowAuthBasic(needShow)
82
   }, [isAuthedBasic, needAuthBasic, isAuthedPhone, isAuthedYeZhu, needAuthYeZhu])
98
   }, [isAuthedBasic, needAuthBasic, isAuthedPhone, isAuthedYeZhu, needAuthYeZhu])
83
 
99
 
84
-  // 业主认证状态
85
-  useEffect(() => {
86
-    if (user !== null && user.verifyStatus !== 'certified') {
87
-      setShowAuthYeZhu(true)
88
-    }
89
-  }, [user])
90
-
91
   return (
100
   return (
92
     <Spin loading={loading}>
101
     <Spin loading={loading}>
93
 
102
 
95
       <AdvLayer></AdvLayer>
104
       <AdvLayer></AdvLayer>
96
       <GetUserIcon visible={showAuthBasic} onError={err => showError(`授权头像失败: ${err}`)} />
105
       <GetUserIcon visible={showAuthBasic} onError={err => showError(`授权头像失败: ${err}`)} />
97
       <GetUserPhone visible={showAuthPhone} onError={err => showError(`授权手机失败: ${err}`)} />
106
       <GetUserPhone visible={showAuthPhone} onError={err => showError(`授权手机失败: ${err}`)} />
98
-      <YeZhuRenZhengPopup Show={user !== null && user.verifyStatus !== 'certified' && page.track.event !== 'index'} Close={() => { }}></YeZhuRenZhengPopup>
107
+      <YeZhuRenZhengPopup Show={showAuthYeZhu} Close={() => { }}></YeZhuRenZhengPopup>
99
       {
108
       {
100
         props.children
109
         props.children
101
       }
110
       }