Browse Source

静态页面

xcx 4 years ago
parent
commit
36018cd350

+ 1
- 1
src/components/AddYeZhuRenZheng/index.jsx View File

@@ -62,7 +62,7 @@ export default function AddYeZhuRenZheng (props) {
62 62
   }, [CodeTimerNum])
63 63
 
64 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 68
   const ToGetPhoneCode = () => {

+ 1
- 1
src/components/WuYeBaoXiu/index.jsx View File

@@ -19,7 +19,7 @@ export default function WuYeBaoXiu () {
19 19
   }, [])
20 20
 
21 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 23
       setBannerList([...(res || [])])
24 24
       done()
25 25
     }).catch(() => {

+ 1
- 1
src/components/WuYeFuWu/index.jsx View File

@@ -19,7 +19,7 @@ export default function WuYeFuWu () {
19 19
   }, [])
20 20
 
21 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 23
       setBannerList([...(res || [])])
24 24
       done()
25 25
     }).catch(() => {

+ 1
- 1
src/components/WuYeGongGao/index.jsx View File

@@ -19,7 +19,7 @@ export default function WuYeGongGao () {
19 19
   }, [])
20 20
 
21 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 23
       setBannerList([...(res || [])])
24 24
       done()
25 25
     }).catch(() => {

+ 1
- 1
src/components/WuYeJiaoFei/index.jsx View File

@@ -64,7 +64,7 @@ export default function WuYeJiaoFei () {
64 64
   }, [])
65 65
 
66 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 68
       setBannerList([...(res || [])])
69 69
       done()
70 70
     }).catch(() => {

+ 33
- 24
src/layouts/index.jsx View File

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react'
2
-import Taro, { } from '@tarojs/taro'
2
+import Taro, { useDidShow } from '@tarojs/taro'
3 3
 import { useModel } from '@/store'
4 4
 import Spin from '@/components/Spin'
5 5
 import GetUserPhone from '@/components/GetUserPhone/index'
@@ -21,20 +21,38 @@ const showError = err => {
21 21
 }
22 22
 
23 23
 export default function (props) {
24
+  const { user } = useModel('user')
25
+
26
+  const [page, setPage] = useState({})
27
+  const [loading, setLoading] = useState(true)
24 28
   const [showAuthBasic, setShowAuthBasic] = useState(false)
25 29
   const [showAuthYeZhu, setShowAuthYeZhu] = useState(false)
26 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 58
   useMountTrack()
@@ -55,12 +73,10 @@ export default function (props) {
55 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 81
   }, [needAuthYeZhu, isAuthedPhone, page])
66 82
 
@@ -81,13 +97,6 @@ export default function (props) {
81 97
     setShowAuthBasic(needShow)
82 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 100
   return (
92 101
     <Spin loading={loading}>
93 102
 
@@ -95,7 +104,7 @@ export default function (props) {
95 104
       <AdvLayer></AdvLayer>
96 105
       <GetUserIcon visible={showAuthBasic} onError={err => showError(`授权头像失败: ${err}`)} />
97 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 109
         props.children
101 110
       }