瀏覽代碼

静态页面

1002884655 4 年之前
父節點
當前提交
9b30cda75c

+ 14
- 11
src/components/ScrollPageRefresh/index.jsx 查看文件

@@ -7,7 +7,7 @@ import './index.less'
7 7
 
8 8
 export default function ScrollPageRefresh (props) {
9 9
 
10
-  const { IsEmpty = false, ApiName = '', ListRefresh = true, ListName = 'records', RequestParams = {}, RequestData = null, RequestUrlData = null, PageSize = 10, Refresh = () => { }, Push = () => { }, RefreshBg = 'none' } = props
10
+  const { KeepChildren = null, SearchKey = null, IsEmpty = false, ApiName = '', ListRefresh = true, ListName = 'records', RequestParams = {}, RequestData = null, RequestUrlData = null, PageSize = 10, Refresh = () => { }, Push = () => { }, RefreshBg = 'none' } = props
11 11
   const [IsPullUp, setIsPullUp] = useState(false)
12 12
   const [IsPullDown, setIsPullDown] = useState(false)
13 13
   const [HasNextPage, setHasNextPage] = useState(true)
@@ -22,6 +22,16 @@ export default function ScrollPageRefresh (props) {
22 22
     }
23 23
   }, [PageNum])
24 24
 
25
+  useEffect(() => {
26
+    console.log(props.children)
27
+  }, [])
28
+
29
+  useEffect(() => {
30
+    if (SearchKey !== null) {
31
+      OnRefresh()
32
+    }
33
+  }, [SearchKey])
34
+
25 35
   const GetPageList = (done = () => { }) => { // 获取列表
26 36
     let RequestBody = {
27 37
       ...apis[ApiName],
@@ -79,8 +89,6 @@ export default function ScrollPageRefresh (props) {
79 89
       })
80 90
     }
81 91
   }
82
-  
83
-  const [Reset] = useState(OnRefresh)
84 92
 
85 93
   const OnPullUp = () => {
86 94
     if (HasNextPage) {
@@ -89,17 +97,12 @@ export default function ScrollPageRefresh (props) {
89 97
     }
90 98
   }
91 99
 
92
-  useEffect(() => {
93
-    if (props.onEmit) {
94
-      props.onEmit(
95
-        // something
96
-      )
97
-    }
98
-  }, [])
99
-
100 100
   return (
101 101
     <view className='ScrollPageRefresh'>
102 102
       <ScrollPage IsEmpty={IsEmpty} ListRefresh={ListRefresh} OnRefresh={OnRefresh} IsPullUp={IsPullUp} IsPullDown={IsPullDown} OnPullUp={OnPullUp} HasMore={HasNextPage} RefreshBg={RefreshBg}>
103
+        {
104
+          KeepChildren
105
+        }
103 106
         {
104 107
           props.children
105 108
         }

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

@@ -44,24 +44,34 @@ export default function WuYeBaoXiu () {
44 44
 
45 45
   return (
46 46
     <view className='WuYeBaoXiu'>
47
-      <ScrollPageRefresh IsEmpty={IsEmpty} ApiName={`getGongDanList`} ListName={`pagelist`} RequestUrlData={{ orgId: user.orgId }} RequestParams={{ type: 2 }} Refresh={Refresh} Push={Push}>
47
+      <ScrollPageRefresh
48
+        IsEmpty={IsEmpty}
49
+        ApiName={`getGongDanList`}
50
+        ListName={`pagelist`}
51
+        RequestUrlData={{ orgId: user.orgId }}
52
+        RequestParams={{ type: 2 }}
53
+        Refresh={Refresh}
54
+        Push={Push}
55
+        KeepChildren={
56
+          <view>
57
+            {/* 大图 */}
58
+            <view className='BigImg'>
59
+              {
60
+                BannerList.length > 0 &&
61
+                <image mode='aspectFill' src={BannerList[0].image} className='centerLabel' onClick={() => nav2detail({ type: BannerList[0].contentType, id: BannerList[0].targetId })}></image>
62
+              }
63
+            </view>
48 64
 
49
-        {/* 大图 */}
50
-        <view className='BigImg'>
51
-          {
52
-            BannerList.length > 0 &&
53
-            <image mode='aspectFill' src={BannerList[0].image} className='centerLabel' onClick={() => nav2detail({type: BannerList[0].contentType, id: BannerList[0].targetId})}></image>
54
-          }
55
-        </view>
56
-
57
-        {/* 我要报修 */}
58
-        <view className='WoYaoBaoXiu'>
59
-          <view onClick={() => { Taro.navigateTo({ url: `/pages/WuYe/TianJiaBaoXiu/index` }) }}>
60
-            <text className='iconfont iconjia'></text>
61
-            <text>我要报修</text>
65
+            {/* 我要报修 */}
66
+            <view className='WoYaoBaoXiu'>
67
+              <view onClick={() => { Taro.navigateTo({ url: `/pages/WuYe/TianJiaBaoXiu/index` }) }}>
68
+                <text className='iconfont iconjia'></text>
69
+                <text>我要报修</text>
70
+              </view>
71
+            </view>
62 72
           </view>
63
-        </view>
64
-
73
+        }
74
+      >
65 75
         {/* 报修列表 */}
66 76
         <view className='List'>
67 77
           {
@@ -72,7 +82,6 @@ export default function WuYeBaoXiu () {
72 82
             ))
73 83
           }
74 84
         </view>
75
-
76 85
       </ScrollPageRefresh>
77 86
     </view>
78 87
   )

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

@@ -42,14 +42,14 @@ export default function WuYeFuWu () {
42 42
     setPageList(PageList.concat(e))
43 43
   }
44 44
 
45
-  return (
46
-    <view className='WuYeFuWu'>
47
-      <ScrollPageRefresh IsEmpty={IsEmpty} ApiName={`getWuYeFuWuList`} Refresh={Refresh} Push={Push}>
45
+  const KeepChildren = () => {
46
+    return (
47
+      <view>
48 48
         {/* 大图 */}
49 49
         <view className='BigImg'>
50 50
           {
51 51
             BannerList.length > 0 &&
52
-            <image mode='aspectFill' src={BannerList[0].image} className='centerLabel' onClick={() => nav2detail({type: BannerList[0].contentType, id: BannerList[0].targetId})}></image>
52
+            <image mode='aspectFill' src={BannerList[0].image} className='centerLabel' onClick={() => nav2detail({ type: BannerList[0].contentType, id: BannerList[0].targetId })}></image>
53 53
           }
54 54
         </view>
55 55
 
@@ -65,7 +65,43 @@ export default function WuYeFuWu () {
65 65
             </view>
66 66
           </view>
67 67
         </view>
68
+      </view>
69
+    )
70
+  }
71
+
72
+  return (
73
+    <view className='WuYeFuWu'>
74
+      <ScrollPageRefresh
75
+        KeepChildren
76
+        IsEmpty={IsEmpty}
77
+        ApiName={`getWuYeFuWuList`}
78
+        Refresh={Refresh}
79
+        Push={Push}
80
+        KeepChildren={
81
+          <view>
82
+            {/* 大图 */}
83
+            <view className='BigImg'>
84
+              {
85
+                BannerList.length > 0 &&
86
+                <image mode='aspectFill' src={BannerList[0].image} className='centerLabel' onClick={() => nav2detail({ type: BannerList[0].contentType, id: BannerList[0].targetId })}></image>
87
+              }
88
+            </view>
68 89
 
90
+            {/* 物业办事指南 */}
91
+            <view className='BanShiZhiNan'>
92
+              <text>物业办事指南</text>
93
+              <view className='flex-h'>
94
+                <view className='Line'><view></view></view>
95
+                <view className='flex-item'>
96
+                  <text>1、业主收楼手续办理</text>
97
+                  <text>2、物业转名手续办理</text>
98
+                  <text>3、业主卡、住户卡办理</text>
99
+                </view>
100
+              </view>
101
+            </view>
102
+          </view>
103
+        }
104
+      >
69 105
         {/* 服务列表 */}
70 106
         <view className='List'>
71 107
           {

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

@@ -44,16 +44,24 @@ export default function WuYeGongGao () {
44 44
 
45 45
   return (
46 46
     <view className='WuYeGongGao'>
47
-      <ScrollPageRefresh IsEmpty={IsEmpty} ApiName={`getGongGaoList`} RequestUrlData={{ orgId: user.orgId }} Refresh={Refresh} Push={Push}>
48
-
49
-        {/* 大图 */}
50
-        <view className='BigImg'>
51
-          {
52
-            BannerList.length > 0 &&
53
-            <image mode='aspectFill' src={BannerList[0].image} className='centerLabel' onClick={() => nav2detail({type: BannerList[0].contentType, id: BannerList[0].targetId})}></image>
54
-          }
55
-        </view>
56
-
47
+      <ScrollPageRefresh
48
+        IsEmpty={IsEmpty}
49
+        ApiName={`getGongGaoList`}
50
+        RequestUrlData={{ orgId: user.orgId }}
51
+        Refresh={Refresh}
52
+        Push={Push}
53
+        KeepChildren={
54
+          <view>
55
+            {/* 大图 */}
56
+            <view className='BigImg'>
57
+              {
58
+                BannerList.length > 0 &&
59
+                <image mode='aspectFill' src={BannerList[0].image} className='centerLabel' onClick={() => nav2detail({ type: BannerList[0].contentType, id: BannerList[0].targetId })}></image>
60
+              }
61
+            </view>
62
+          </view>
63
+        }
64
+      >
57 65
         {/* 列表 */}
58 66
         <view className='List'>
59 67
           {
@@ -64,7 +72,6 @@ export default function WuYeGongGao () {
64 72
             ))
65 73
           }
66 74
         </view>
67
-
68 75
       </ScrollPageRefresh>
69 76
     </view>
70 77
   )

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

@@ -128,16 +128,25 @@ export default function WuYeJiaoFei () {
128 128
     <view className='WuYeJiaoFei flex-v'>
129 129
       <view className='flex-item'>
130 130
         <view>
131
-          <ScrollPageRefresh IsEmpty={IsEmpty} ApiName={`getJiaoFeiList`} ListName={`list`} RequestUrlData={{ type: 0 }} Refresh={Refresh} Push={Push}>
132
-
133
-            {/* 大图 */}
134
-            <view className='BigImg'>
135
-              {
136
-                BannerList.length > 0 &&
137
-                <image mode='aspectFill' src={BannerList[0].image} className='centerLabel' onClick={() => nav2detail({ type: BannerList[0].contentType, id: BannerList[0].targetId })}></image>
138
-              }
139
-            </view>
140
-
131
+          <ScrollPageRefresh
132
+            IsEmpty={IsEmpty}
133
+            ApiName={`getJiaoFeiList`}
134
+            ListName={`list`}
135
+            RequestUrlData={{ type: 0 }}
136
+            Refresh={Refresh}
137
+            Push={Push}
138
+            KeepChildren={
139
+              <view>
140
+                {/* 大图 */}
141
+                <view className='BigImg'>
142
+                  {
143
+                    BannerList.length > 0 &&
144
+                    <image mode='aspectFill' src={BannerList[0].image} className='centerLabel' onClick={() => nav2detail({ type: BannerList[0].contentType, id: BannerList[0].targetId })}></image>
145
+                  }
146
+                </view>
147
+              </view>
148
+            }
149
+          >
141 150
             {/* 缴费列表 */}
142 151
             <view className='List'>
143 152
               <CheckboxGroup onChange={handleGroupChange}>
@@ -154,7 +163,6 @@ export default function WuYeJiaoFei () {
154 163
                 }
155 164
               </CheckboxGroup>
156 165
             </view>
157
-
158 166
           </ScrollPageRefresh>
159 167
         </view>
160 168
       </view>

+ 3
- 7
src/pages/FuLi/ShangPinFilter/index.jsx 查看文件

@@ -14,7 +14,7 @@ export default function ShangPinFilter () {
14 14
   const { user } = useModel('user')
15 15
   const [Key, setKey] = useState('')
16 16
   const [PageList, setPageList] = useState([])
17
-  const [Child, setChild] = useState(null)
17
+  const [SearchKey, setSearchKey] = useState('')
18 18
 
19 19
   const Refresh = (e) => { // 下拉刷新
20 20
     setPageList(e)
@@ -29,11 +29,7 @@ export default function ShangPinFilter () {
29 29
   }
30 30
 
31 31
   const SearchConfirm = () => {
32
-    console.log(Key)
33
-  }
34
-
35
-  const handleEvt = (...evts) => {
36
-    // 这里可以接受 evts
32
+    setSearchKey(Key)
37 33
   }
38 34
 
39 35
   return (
@@ -48,7 +44,7 @@ export default function ShangPinFilter () {
48 44
           </view>
49 45
         </view>
50 46
         <view className='flex-item'>
51
-          <ScrollPageRefresh ApiName={`getGoodsList`} Refresh={Refresh} Push={Push} onEmit={handleEvt}>
47
+          <ScrollPageRefresh SearchKey={SearchKey} RequestParams={{key: SearchKey}} ApiName={`getGoodsList`} Refresh={Refresh} Push={Push}>
52 48
             <view className='PirzeList'>
53 49
               {
54 50
                 PageList.map((item, index) => (

+ 40
- 35
src/pages/FuLi/index.jsx 查看文件

@@ -60,49 +60,55 @@ export default function FuLi () {
60 60
         {/* 正文 */}
61 61
         <view className='flex-item'>
62 62
           <view>
63
-            <ScrollPageRefresh ApiName={`getGoodsList`} Refresh={Refresh} Push={Push}>
64
-              <view className='FuLiContent'>
65
-
66
-                {/* 用户面板 */}
67
-                <view className='UserTab'>
68
-                  <view>
69
-                    <view className='Info flex-h'>
70
-                      <view className='Icon'>
63
+            <ScrollPageRefresh
64
+              ApiName={`getGoodsList`}
65
+              Refresh={Refresh}
66
+              Push={Push}
67
+              KeepChildren={
68
+                <view className='FuLiContent'>
69
+                  {/* 用户面板 */}
70
+                  <view className='UserTab'>
71
+                    <view>
72
+                      <view className='Info flex-h'>
73
+                        <view className='Icon'>
74
+                          {
75
+                            user !== null &&
76
+                            <image mode='aspectFill' src={user.avatarurl} class='centerLabel'></image>
77
+                          }
78
+                        </view>
79
+                        <view className='flex-item'>
80
+                          <text>{user === null ? '未登录' : user.nickname || '未授权用户信息'}</text>
81
+                          <text>积分{user === null ? '-' : user.points || 0}</text>
82
+                        </view>
71 83
                         {
72
-                          user !== null &&
73
-                          <image mode='aspectFill' src={user.avatarurl} class='centerLabel'></image>
84
+                          user.havaSigned !== undefined &&
85
+                          <text className={user.havaSigned - 0 === 1 ? '' : 'active'} onClick={ToSign}>{user.havaSigned - 0 === 1 ? '已签到' : '签到'}</text>
74 86
                         }
75 87
                       </view>
76
-                      <view className='flex-item'>
77
-                        <text>{user === null ? '未登录' : user.nickname || '未授权用户信息'}</text>
78
-                        <text>积分{user === null ? '-' : user.points || 0}</text>
79
-                      </view>
80
-                      {
81
-                        user.havaSigned !== undefined &&
82
-                        <text className={user.havaSigned - 0 === 1 ? '' : 'active'} onClick={ToSign}>{user.havaSigned - 0 === 1 ? '已签到' : '签到'}</text>
83
-                      }
84
-                    </view>
85
-                    <view className='Rule flex-h'>
86
-                      <view className='flex-item' onClick={() => { Taro.navigateTo({ url: '/pages/FuLi/JiFenGuiZe/index' }) }}>
87
-                        <text className='iconfont iconjifen'></text>
88
-                        <text>积分规则</text>
89
-                      </view>
90
-                      <view className='flex-item' onClick={() => { Taro.navigateTo({ url: '/pages/FuLi/JiFenMingXi/index' }) }}>
91
-                        <text className='iconfont iconjifenguize'></text>
92
-                        <text>积分明细</text>
88
+                      <view className='Rule flex-h'>
89
+                        <view className='flex-item' onClick={() => { Taro.navigateTo({ url: '/pages/FuLi/JiFenGuiZe/index' }) }}>
90
+                          <text className='iconfont iconjifen'></text>
91
+                          <text>积分规则</text>
92
+                        </view>
93
+                        <view className='flex-item' onClick={() => { Taro.navigateTo({ url: '/pages/FuLi/JiFenMingXi/index' }) }}>
94
+                          <text className='iconfont iconjifenguize'></text>
95
+                          <text>积分明细</text>
96
+                        </view>
93 97
                       </view>
94 98
                     </view>
95 99
                   </view>
96
-                </view>
97 100
 
98
-                {/* 搜索框 */}
99
-                <view className='SearchContainer'>
100
-                  <view onClick={() => { Taro.navigateTo({ url: `/pages/FuLi/ShangPinFilter/index` }) }}>
101
-                    <text className='iconfont iconsousuo'></text>
102
-                    <text>附近热搜:火锅</text>
101
+                  {/* 搜索框 */}
102
+                  <view className='SearchContainer'>
103
+                    <view onClick={() => { Taro.navigateTo({ url: `/pages/FuLi/ShangPinFilter/index` }) }}>
104
+                      <text className='iconfont iconsousuo'></text>
105
+                      <text>附近热搜:火锅</text>
106
+                    </view>
103 107
                   </view>
104 108
                 </view>
105
-
109
+              }
110
+            >
111
+              <view className='FuLiContent'>
106 112
                 {/* 积分礼品列表 */}
107 113
                 <view className='PirzeList'>
108 114
                   {
@@ -115,7 +121,6 @@ export default function FuLi () {
115 121
                     ))
116 122
                   }
117 123
                 </view>
118
-
119 124
               </view>
120 125
             </ScrollPageRefresh>
121 126
           </view>