Your Name 3 years ago
parent
commit
9b71da79c5

+ 2
- 2
config/dev.js View File

3
     NODE_ENV: '"development"'
3
     NODE_ENV: '"development"'
4
   },
4
   },
5
   defineConstants: {
5
   defineConstants: {
6
-    HOST: '"https://xlk.njyz.tech"',
7
-    // HOST: '"http://127.0.0.1:8081"',
6
+    // HOST: '"https://xlk.njyz.tech"',
7
+    HOST: '"http://127.0.0.1:8081"',
8
     WSS_HOST: '"wss://xlk.njyz.tech"',
8
     WSS_HOST: '"wss://xlk.njyz.tech"',
9
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
9
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',

+ 105
- 0
src/components/AreaPickerView/index.jsx View File

1
+import { useState, useEffect } from 'react'
2
+import { PickerView, PickerViewColumn } from '@tarojs/components'
3
+import { fetch } from '@/utils/request'
4
+import { API_AREA_LIST } from '@/constants/api'
5
+import './style.scss'
6
+
7
+export default (props) => {
8
+
9
+  const { show = false, Change = () => {}, Cancel = () => {} } = props
10
+  const [Value, setValue] = useState([0, 0, 0])
11
+  const [StateList, setStateList] = useState([])
12
+  const [CurrentState, setCurrentState] = useState({})
13
+  const [CityList, setCityList] = useState([])
14
+  const [CurrentCity, setCurrentCity] = useState({})
15
+  const [IntentAreaList, setIntentAreaList] = useState([])
16
+  const [CurrentIntentArea, setCurrentIntentArea] = useState({})
17
+
18
+  useEffect(() => {
19
+    GetAreaList()
20
+  }, [])
21
+
22
+  useEffect(() => {
23
+    if (StateList.length) {
24
+      if (StateList[Value[0]].id !== CurrentState.id) { // 省份更新
25
+        setCurrentState(StateList[Value[0]])
26
+      } else if (CityList[Value[1]].id !== CurrentCity.id) { // 城市更新
27
+        setCurrentCity(CityList[Value[1]])
28
+      } else if (IntentAreaList[Value[2]].id !== CurrentIntentArea.id) { // 区县更新
29
+        setCurrentIntentArea(IntentAreaList[Value[2]])
30
+      }
31
+    }
32
+  }, [Value])
33
+
34
+  useEffect(() => {
35
+    if (CurrentState.id) {
36
+      GetAreaList(CurrentState.id, 2)
37
+    }
38
+  }, [CurrentState])
39
+
40
+  useEffect(() => {
41
+    if (CurrentCity.id) {
42
+      GetAreaList(CurrentCity.id, 3)
43
+    }
44
+  }, [CurrentCity])
45
+
46
+  const Sure = () => {
47
+    Change([CurrentState, CurrentCity, CurrentIntentArea])
48
+  }
49
+
50
+  const PickerChange = (e) => {
51
+    setValue(e.detail.value)
52
+  }
53
+
54
+  const GetAreaList = (parentCity = 100000, levelType = 1) => {
55
+    fetch({ url: API_AREA_LIST, method: 'get', payload: { parentCity, levelType } }).then((res) => {
56
+      if (levelType === 1) { // 省份
57
+        setStateList(res || [])
58
+        setValue([0, 0, 0])
59
+      } else if (levelType === 2) { // 城市
60
+        setCityList(res || [])
61
+        setValue([Value[0], 0, 0])
62
+      } else { // 区县
63
+        setIntentAreaList(res || [])
64
+        setValue([Value[0], Value[1], 0])
65
+      }
66
+    })
67
+  }
68
+
69
+  return (
70
+    <view className='components AreaPickerView' style={{ display: show ? 'block' : 'none' }}>
71
+      <view className='flex-v'>
72
+        <view className='flex-h'>
73
+          <text onClick={Cancel}>取消</text>
74
+          <view className='flex-item'></view>
75
+          <text onClick={Sure}>确认</text>
76
+        </view>
77
+        <view className='flex-item'>
78
+          <PickerView value={Value} indicator-style='height: 50px;' style='width: 100%; height: 300px;' onChange={PickerChange}>
79
+            <PickerViewColumn>
80
+              {
81
+                StateList.map((item, index) => (
82
+                  <view key={index} style='line-height: 50px; text-align: center;'>{item.name}</view>
83
+                ))
84
+              }
85
+            </PickerViewColumn>
86
+            <PickerViewColumn>
87
+              {
88
+                CityList.map((item, index) => (
89
+                  <view key={index} style='line-height: 50px; text-align: center;'>{item.name}</view>
90
+                ))
91
+              }
92
+            </PickerViewColumn>
93
+            <PickerViewColumn>
94
+              {
95
+                IntentAreaList.map((item, index) => (
96
+                  <view key={index} style='line-height: 50px; text-align: center;'>{item.name}</view>
97
+                ))
98
+              }
99
+            </PickerViewColumn>
100
+          </PickerView>
101
+        </view>
102
+      </view>
103
+    </view>
104
+  )
105
+}

+ 30
- 0
src/components/AreaPickerView/style.scss View File

1
+.components.AreaPickerView {
2
+  width: 100%;
3
+  position: fixed;
4
+  left: 0;
5
+  top: 0;
6
+  bottom: 0;
7
+  z-index: 100;
8
+  background: rgba(0, 0, 0, 0.6);
9
+  > view {
10
+    width: 100%;
11
+    position: absolute;
12
+    left: 0;
13
+    bottom: 0;
14
+    height: 600px;
15
+    background: #fff;
16
+    >.flex-h {
17
+      align-items: center;
18
+      padding: 0 30px;
19
+      border-bottom: 2px solid rgba(0, 0, 0, 0.08);
20
+      >text {
21
+        font-size: 28px;
22
+        line-height: 80px;
23
+        color: #193C83;
24
+        &:first-child {
25
+          color: #ccc;
26
+        }
27
+      }
28
+    }
29
+  }
30
+}

+ 1
- 0
src/constants/api.js View File

33
 export const API_QRCODE = resolvePath('qrcode')
33
 export const API_QRCODE = resolvePath('qrcode')
34
 export const API_BANNER_LIST = resolvePath('extendContent')
34
 export const API_BANNER_LIST = resolvePath('extendContent')
35
 export const API_QUERY_CODE_SCENE = resolvePath('qrcode/scene')
35
 export const API_QUERY_CODE_SCENE = resolvePath('qrcode/scene')
36
+export const API_AREA_LIST = resolvePath('city/cascade')
36
 
37
 
37
 // user
38
 // user
38
 export const API_USER_LOGIN = resolvePath('login')
39
 export const API_USER_LOGIN = resolvePath('login')

+ 144
- 73
src/pages/index/activityDetail/index.jsx View File

1
 import { useState, useEffect } from "react";
1
 import { useState, useEffect } from "react";
2
 import Taro from "@tarojs/taro";
2
 import Taro from "@tarojs/taro";
3
 import withLayout from "@/layout";
3
 import withLayout from "@/layout";
4
-import { ScrollView, Image, RichText, Button } from "@tarojs/components";
4
+import {
5
+  ScrollView,
6
+  Image,
7
+  RichText,
8
+  View,
9
+  Text,
10
+  Input,
11
+  Picker,
12
+} from "@tarojs/components";
5
 import Disclaimer from "@/components/Disclaimer";
13
 import Disclaimer from "@/components/Disclaimer";
6
-
14
+import { useSelector } from "react-redux";
7
 import {
15
 import {
8
   // addActivityShareNum,
16
   // addActivityShareNum,
9
   signupActivity,
17
   signupActivity,
16
 import useFavor from "@/utils/hooks/useFavor";
24
 import useFavor from "@/utils/hooks/useFavor";
17
 import useStatus from './useStatus'
25
 import useStatus from './useStatus'
18
 
26
 
27
+import { getDownloadURL, times, transferImage } from "@/utils/tools";
19
 import "./index.scss";
28
 import "./index.scss";
20
 
29
 
21
 export default withLayout((props) => {
30
 export default withLayout((props) => {
22
   const { router, shareContent, trackData, person, page } = props;
31
   const { router, shareContent, trackData, person, page } = props;
23
   const { id } = router.params;
32
   const { id } = router.params;
33
+
34
+  const user = useSelector((state) => state.user);
35
+
24
   const [detail, setDetail] = useState();
36
   const [detail, setDetail] = useState();
37
+  const [canChoose, setCanChoose] = useState("none");
38
+  const [inputName, setInputName] = useState("");
39
+  const [selectorChecked, setSelectorChecked] = useState("1");
40
+  const [selector, setSelector] = useState("");
41
+
25
   const buildingId = detail?.buildingId;
42
   const buildingId = detail?.buildingId;
26
 
43
 
27
   const [btnText, btnDisabled] = useStatus(detail)
44
   const [btnText, btnDisabled] = useStatus(detail)
30
     Taro.showLoading();
47
     Taro.showLoading();
31
 
48
 
32
     queryActivityDetail(params).then((res) => {
49
     queryActivityDetail(params).then((res) => {
33
-      console.log(res, "queryActivityDetail");
34
-      setDetail(res);
50
+      // const maxperson =
51
+      //   res.maxEnlistByPerson < 100 ? res.maxEnlistByPerson : 100;
52
+
53
+      const maxperson = 10
35
 
54
 
55
+      setSelector(times(maxperson).map((_, i) => `${i + 1}`));
56
+
57
+      setDetail(res);
36
       Taro.hideLoading();
58
       Taro.hideLoading();
37
     });
59
     });
38
   };
60
   };
69
   }, [id]);
91
   }, [id]);
70
 
92
 
71
   const handleSignup = () => {
93
   const handleSignup = () => {
72
-    const {
73
-      detail: { buildingId, dynamicId, isSign },
74
-    } = this.state;
75
-    const {
76
-      userInfo: {
77
-        person: { phone, name, nickname },
78
-      },
79
-    } = this.props;
94
+    setCanChoose("block");
95
+  };
80
 
96
 
81
-    if (isSign) {
97
+  const comfire = (e) => {
98
+    const { dynamicId } =detail;
99
+    // console.log(user, "user");
100
+    const { userInfo: { person: { phone,  tel } } } = user
101
+    if (inputName == "") {
82
       Taro.showToast({
102
       Taro.showToast({
103
+        title: "请输入姓名",
83
         icon: "none",
104
         icon: "none",
84
-        title: "你已报名成功",
85
       });
105
       });
86
       return;
106
       return;
87
     }
107
     }
88
 
108
 
89
-    this.setState({
90
-      canChoose: "block",
109
+    const payload = {
110
+      buildingId,
111
+      dynamicId,
112
+      name: inputName,
113
+      phone: phone ? phone : tel,
114
+      attendNum: selectorChecked,
115
+    };
116
+
117
+    signupActivity(payload).then((res) => {
118
+      Taro.showToast({
119
+        title: "报名成功",
120
+      });
121
+      setCanChoose('none')
122
+      setTimeout(() => {
123
+        getDetail(id);
124
+      }, 500);
91
     });
125
     });
92
   };
126
   };
93
 
127
 
128
+  function hideModal() {
129
+    setCanChoose("none");
130
+  }
131
+
132
+  const onInputText = (e) => {
133
+    setInputName(e.detail.value);
134
+  };
135
+
94
   const dymic = () => (
136
   const dymic = () => (
95
-    <view className="Info">
137
+    <view className='Info'>
96
       <view>
138
       <view>
97
-        <view className="Title flex-h">
98
-          <view className="flex-item">
139
+        <view className='Title flex-h'>
140
+          <view className='flex-item'>
99
             <text>{detail.halfTitle}</text>
141
             <text>{detail.halfTitle}</text>
100
           </view>
142
           </view>
101
-          <text className="Tips">{detail.enlisted || 0}人已报名</text>
143
+          <text className='Tips'>{detail.enlisted || 0}人已报名</text>
102
         </view>
144
         </view>
103
-        <text className="Time">
145
+        <text className='Time'>
104
           报名截止时间:
146
           报名截止时间:
105
           {getDateFormat(
147
           {getDateFormat(
106
             new Date(detail.enlistEnd).valueOf(),
148
             new Date(detail.enlistEnd).valueOf(),
108
             "yyyy/M/d"
150
             "yyyy/M/d"
109
           )}
151
           )}
110
         </text>
152
         </text>
111
-        <text className="Name">{detail.title}</text>
112
-        <view className="flex-h Address">
153
+        <text className='Name'>{detail.title}</text>
154
+        <view className='flex-h Address'>
113
           <text>地址:</text>
155
           <text>地址:</text>
114
-          <view className="flex-item">
156
+          <view className='flex-item'>
115
             <text>{detail.address}</text>
157
             <text>{detail.address}</text>
116
           </view>
158
           </view>
117
         </view>
159
         </view>
118
-        <view className="flex-h Date">
160
+        <view className='flex-h Date'>
119
           <text>时间:</text>
161
           <text>时间:</text>
120
-          <view className="flex-item">
162
+          <view className='flex-item'>
121
             <text>
163
             <text>
122
               {getDateFormat(
164
               {getDateFormat(
123
                 new Date(detail.startDate).valueOf(),
165
                 new Date(detail.startDate).valueOf(),
133
             </text>
175
             </text>
134
           </view>
176
           </view>
135
         </view>
177
         </view>
136
-        <view className="Btn">
137
-          <button open-type="share">
178
+        <view className='Btn'>
179
+          <button open-type='share'>
138
             <text>分享好友</text>
180
             <text>分享好友</text>
139
           </button>
181
           </button>
140
         </view>
182
         </view>
143
   );
185
   );
144
 
186
 
145
   const house = () => (
187
   const house = () => (
146
-    <view className="houseInfo">
188
+    <view className='houseInfo'>
147
       {/* <view> */}
189
       {/* <view> */}
148
-      <view className="flex-h">
149
-        <view className="left">
150
-          <view className="Title">
151
-            <view className="flex-item">
190
+      <view className='flex-h'>
191
+        <view className='left'>
192
+          <view className='Title'>
193
+            <view className='flex-item'>
152
               <text>{detail.title}</text>
194
               <text>{detail.title}</text>
153
             </view>
195
             </view>
154
           </view>
196
           </view>
155
-          <view className="flex-h Address">
156
-            <text className="iconfont icon-dingwei"></text>
157
-            <view className="flex-item">
197
+          <view className='flex-h Address'>
198
+            <text className='iconfont icon-dingwei'></text>
199
+            <view className='flex-item'>
158
               <text>{detail.address}</text>
200
               <text>{detail.address}</text>
159
             </view>
201
             </view>
160
-            <text className="price">价格待定</text>
202
+            <text className='price'>价格待定</text>
161
           </view>
203
           </view>
162
-          <text className="flex-h Time">
204
+          <text className='flex-h Time'>
163
             时间:
205
             时间:
164
             {getDateFormat(
206
             {getDateFormat(
165
               new Date(detail.startDate).valueOf(),
207
               new Date(detail.startDate).valueOf(),
174
             )}
216
             )}
175
           </text>
217
           </text>
176
         </view>
218
         </view>
177
-        <view className="right">
219
+        <view className='right'>
178
           <view>
220
           <view>
179
-            <button  open-type="share">
180
-              <text className="iconfont icon-fenxiang"></text>
221
+            <button open-type='share'>
222
+              <text className='iconfont icon-fenxiang'></text>
181
               <text>分享</text>
223
               <text>分享</text>
182
             </button>
224
             </button>
183
             {/* <text className="iconfont icon-dingwei"></text>
225
             {/* <text className="iconfont icon-dingwei"></text>
184
             <text>分享</text> */}
226
             <text>分享</text> */}
185
           </view>
227
           </view>
186
           <view>
228
           <view>
187
-            <text className="iconfont icon-dingwei"></text>
229
+            <text className='iconfont icon-dingwei'></text>
188
             <text>海报</text>
230
             <text>海报</text>
189
           </view>
231
           </view>
190
         </view>
232
         </view>
191
       </view>
233
       </view>
192
 
234
 
193
-      <view className="lastdate">
194
-        <text className="text">距离结束还有</text>
195
-        <text className="text day">7</text>
196
-        <text className="text">天</text>
197
-        <text className="text time">2</text>
198
-        <text className="text">时</text>
199
-        <text className="text time">4</text>
200
-        <text className="text">分</text>
201
-        <text className="text time">5</text>
202
-        <text className="text">秒</text>
235
+      <view className='lastdate'>
236
+        <text className='text'>距离结束还有</text>
237
+        <text className='text day'>7</text>
238
+        <text className='text'>天</text>
239
+        <text className='text time'>2</text>
240
+        <text className='text'>时</text>
241
+        <text className='text time'>4</text>
242
+        <text className='text'>分</text>
243
+        <text className='text time'>5</text>
244
+        <text className='text'>秒</text>
203
         {/* <view>距离结束还有</view> */}
245
         {/* <view>距离结束还有</view> */}
204
       </view>
246
       </view>
205
 
247
 
206
-      <view className="flex-h join">
207
-        <view className="Collect" onClick={handleFavor}>
248
+      <view className='flex-h join'>
249
+        <view className='Collect' onClick={handleFavor}>
208
           <text
250
           <text
209
-            className="iconfont icon-shoucang"
251
+            className='iconfont icon-shoucang'
210
             style={isSaved ? { color: "red" } : undefined}
252
             style={isSaved ? { color: "red" } : undefined}
211
           ></text>
253
           ></text>
212
           <text>{isSaved ? "已收藏" : "收藏"}</text>
254
           <text>{isSaved ? "已收藏" : "收藏"}</text>
213
         </view>
255
         </view>
214
-        <view className="enlisted">
256
+        <view className='enlisted'>
215
           <view>
257
           <view>
216
-            <text className="iconfont icon-shoucang"></text>
258
+            <text className='iconfont icon-shoucang'></text>
217
             <text>{detail.enlisted || 0}人已报名</text>
259
             <text>{detail.enlisted || 0}人已报名</text>
218
           </view>
260
           </view>
219
         </view>
261
         </view>
220
-        <button className="btn" disabled={btnDisabled} onClick={handleSignup}>
262
+        <button className='btn' disabled={btnDisabled} onClick={handleSignup}>
221
           <text>{btnText}</text>
263
           <text>{btnText}</text>
222
         </button>
264
         </button>
223
       </view>
265
       </view>
228
   return (
270
   return (
229
     <>
271
     <>
230
       {detail && (
272
       {detail && (
231
-        <view className="Page activityDetail flex-v">
232
-          <view className="flex-item">
273
+        <view className='Page activityDetail flex-v'>
274
+          <view className='flex-item'>
233
             <view>
275
             <view>
234
               <ScrollView scroll-y>
276
               <ScrollView scroll-y>
235
-                <view className="PageContent">
236
-                  <view className="Top">
277
+                <view className='PageContent'>
278
+                  <view className='Top'>
237
                     <Image
279
                     <Image
238
-                      mode="aspectFill"
280
+                      mode='aspectFill'
239
                       src={getImgURL(detail.bannerListImg)}
281
                       src={getImgURL(detail.bannerListImg)}
240
-                      className="centerLabel"
282
+                      className='centerLabel'
241
                     ></Image>
283
                     ></Image>
242
                   </view>
284
                   </view>
243
 
285
 
244
                   {detail.type == "dymic" && dymic()}
286
                   {detail.type == "dymic" && dymic()}
245
                   {detail.type == "house" && house()}
287
                   {detail.type == "house" && house()}
246
-                  <view className="ActivityIntro">
247
-                    <view className="Title">
288
+                  <view className='ActivityIntro'>
289
+                    <view className='Title'>
248
                       <text>活动介绍</text>
290
                       <text>活动介绍</text>
249
                     </view>
291
                     </view>
250
                     <RichText nodes={detail.desc} />
292
                     <RichText nodes={detail.desc} />
256
             </view>
298
             </view>
257
           </view>
299
           </view>
258
           {detail.type == "dymic" && (
300
           {detail.type == "dymic" && (
259
-            <view className="PageBottom flex-h">
260
-              <button className="Share" open-type="share">
261
-                <text className="iconfont icon-fenxiang"></text>
301
+            <view className='PageBottom flex-h'>
302
+              <button className='Share' open-type='share'>
303
+                <text className='iconfont icon-fenxiang'></text>
262
                 <text>分享</text>
304
                 <text>分享</text>
263
               </button>
305
               </button>
264
-              <view className="Collect" onClick={handleFavor}>
306
+              <view className='Collect' onClick={handleFavor}>
265
                 <text
307
                 <text
266
-                  className="iconfont icon-shoucang"
308
+                  className='iconfont icon-shoucang'
267
                   style={isSaved ? { color: "red" } : undefined}
309
                   style={isSaved ? { color: "red" } : undefined}
268
                 ></text>
310
                 ></text>
269
                 <text>{isSaved ? "已收藏" : "收藏"}</text>
311
                 <text>{isSaved ? "已收藏" : "收藏"}</text>
270
               </view>
312
               </view>
271
-              <view className="flex-item"></view>
313
+              <view className='flex-item'></view>
272
 
314
 
273
-              <button disabled={btnDisabled} className="Post" onClick={handleSignup}>
315
+              <button disabled={btnDisabled} className='Post' onClick={handleSignup}>
274
                 {btnText}
316
                 {btnText}
275
               </button>
317
               </button>
276
             </view>
318
             </view>
277
           )}
319
           )}
278
         </view>
320
         </view>
279
       )}
321
       )}
322
+
323
+      <View className='page-body' style={{ display: canChoose }}>
324
+        <View className='mask' onClick={() => hideModal()}></View>
325
+        <View className='page-section'>
326
+          <Text className='page-section__title'>报名信息</Text>
327
+          <View className='page-content'>
328
+            <Input
329
+              className='inputName'
330
+              onInput={onInputText}
331
+              type='text'
332
+              placeholder='请输入姓名'
333
+            />
334
+            <Picker
335
+              mode='selector'
336
+              range={selector}
337
+              onChange={(e) => setSelectorChecked(selector[e.detail.value])}
338
+            >
339
+              <View className='picker'>
340
+                <Text>参加人数</Text>
341
+                <Text className='content'>{selectorChecked}</Text>
342
+                <Text>人</Text>
343
+              </View>
344
+            </Picker>
345
+            <View onClick={comfire} className='comfire'>
346
+              确认
347
+            </View>
348
+          </View>
349
+        </View>
350
+      </View>
280
     </>
351
     </>
281
   );
352
   );
282
 });
353
 });

+ 85
- 0
src/pages/index/activityDetail/index.scss View File

223
     }
223
     }
224
   }
224
   }
225
 }
225
 }
226
+
227
+.page-body {
228
+  z-index: 99;
229
+  position: fixed;
230
+  top: 0;
231
+  left: 0;
232
+  width: 100vw;
233
+  height: 100vh;
234
+
235
+  .mask {
236
+    background: rgba(0, 0, 0, 0.7);
237
+    width: 100%;
238
+    height: 100%;
239
+    left: 0;
240
+    top: 0;
241
+  }
242
+
243
+  .page-section {
244
+    position: absolute;
245
+    width: 600px;
246
+    top: 24%;
247
+    left: 75px;
248
+    border-radius: 10px;
249
+    background: white;
250
+    height: 500px;
251
+
252
+    &__title {
253
+      font-size: 36px;
254
+      text-align: center;
255
+      width: 100%;
256
+      line-height: 120px;
257
+      display: block;
258
+      color: black;
259
+    }
260
+
261
+    .page-content {
262
+      width: 490px;
263
+      margin: 0 auto;
264
+
265
+      .inputName {
266
+        width: 100%;
267
+        height: 80px;
268
+        line-height: 80px;
269
+        border: 1px solid #CCCCCC;
270
+        border-radius: 10px;
271
+        text-align: center;
272
+      }
273
+
274
+      .picker {
275
+        width: 100%;
276
+        margin-top: 30px;
277
+        display: flex;
278
+        justify-content: center;
279
+        border: 1px solid #CCCCCC;
280
+
281
+        Text {
282
+          display: block;
283
+          color: black;
284
+          height: 80px;
285
+          line-height: 80px;
286
+          width: auto;
287
+        }
288
+
289
+        .content {
290
+          text-align: center;
291
+          margin-right: 20px;
292
+          margin-left: 20px;
293
+        }
294
+      }
295
+
296
+      .comfire {
297
+        width: 490px;
298
+        height: 96px;
299
+        background: #BB9C79;;
300
+        border-radius: 7px;
301
+        line-height: 96px;
302
+        color: white;
303
+        text-align: center;
304
+        margin-top: 60px;
305
+        font-size: 36px;
306
+      }
307
+    }
308
+  }
309
+
310
+}

+ 18
- 2
src/pages/index/activityDetail/useStatus.js View File

5
 const ACT_SIGNED = 1
5
 const ACT_SIGNED = 1
6
 
6
 
7
 export default function useStatus(info) {
7
 export default function useStatus(info) {
8
-  const { dynamicId, isSign, activityStatus, isEnlist } = info || {}
8
+  const { dynamicId, isSign, activityStatus, isEnlist, enlistStart, enlistEnd } = info || {}
9
 
9
 
10
   const [disabled, setDisabled] = useState(false)
10
   const [disabled, setDisabled] = useState(false)
11
   const [btnText, setBtnText] = useState('立即报名')
11
   const [btnText, setBtnText] = useState('立即报名')
15
 
15
 
16
     // 活动结束
16
     // 活动结束
17
     if (activityStatus === ACT_GAMEOVER) {
17
     if (activityStatus === ACT_GAMEOVER) {
18
-      setBtnText('已结束')
18
+      setBtnText('活动已结束')
19
       setDisabled(true)
19
       setDisabled(true)
20
       return;
20
       return;
21
     }
21
     }
34
       return;
34
       return;
35
     }
35
     }
36
 
36
 
37
+    // 报名时间
38
+    const now = new Date()
39
+    const start = new Date(enlistStart)
40
+    const end = new Date(enlistEnd)
41
+    if (now < start) {
42
+      setBtnText('报名未开始')
43
+      setDisabled(true)
44
+      return;
45
+    }
46
+
47
+    if (now > end) {
48
+      setBtnText('报名已结束')
49
+      setDisabled(true)
50
+      return;
51
+    }
52
+
37
     setBtnText('立即报名')
53
     setBtnText('立即报名')
38
     setDisabled(false)
54
     setDisabled(false)
39
   },[dynamicId])
55
   },[dynamicId])

+ 5
- 1
src/pages/index/addedValueService/index.jsx View File

44
       }
44
       }
45
     })
45
     })
46
     params.push({question: '创建人小程序人员', result: user?.userInfo?.person?.personId, key: 'personId' })
46
     params.push({question: '创建人小程序人员', result: user?.userInfo?.person?.personId, key: 'personId' })
47
-    fetch({ url: API_HELP_FIND_HOUSE_SUBMIT, method: 'post', payload: params }).then((res) => {
47
+    let payload = {}
48
+    params.map((item) => {
49
+      payload[item.key] = item.result || item.resultId
50
+    })
51
+    fetch({ url: API_HELP_FIND_HOUSE_SUBMIT, method: 'post', payload: { ...payload, questionnaire: JSON.stringify(params), type: 4 } }).then((res) => {
48
       setResultList(res.taBuildingList || [])
52
       setResultList(res.taBuildingList || [])
49
       setShowPopup(true)
53
       setShowPopup(true)
50
     })
54
     })

+ 6
- 18
src/pages/index/helpToFindHouse/components/BuyHouse/index.jsx View File

1
 import { useState, useEffect } from 'react'
1
 import { useState, useEffect } from 'react'
2
 import '@/assets/css/iconfont.css'
2
 import '@/assets/css/iconfont.css'
3
-import { Image, Slider, Textarea, Picker } from '@tarojs/components'
3
+import { Image, Slider, Textarea } from '@tarojs/components'
4
 import './index.scss'
4
 import './index.scss'
5
 import questions from './formData'
5
 import questions from './formData'
6
 
6
 
7
 export default function BuyHouse (props) {
7
 export default function BuyHouse (props) {
8
-  const { change = () => { }, toSubmit = () => { }, CityList = [] } = props
8
+  const { change = () => { }, toSubmit = () => { }, AreaInfo = {}, selectArea = () => {} } = props
9
 
9
 
10
   const [FormData, setFormData] = useState(questions)
10
   const [FormData, setFormData] = useState(questions)
11
 
11
 
12
   const [StepId, setStepId] = useState(1)
12
   const [StepId, setStepId] = useState(1)
13
   const [StepRange, setStepRange] = useState([0, 4])
13
   const [StepRange, setStepRange] = useState([0, 4])
14
 
14
 
15
-  const [CityName, setCityName] = useState(null)
16
-  const [CityId, setCityId] = useState(null)
17
-
18
   useEffect(() => {
15
   useEffect(() => {
19
     if (StepId === 1) {
16
     if (StepId === 1) {
20
       setStepRange([0, 4])
17
       setStepRange([0, 4])
59
     if (StepId < 4) {
56
     if (StepId < 4) {
60
       setStepId(StepId + 1)
57
       setStepId(StepId + 1)
61
     } else {
58
     } else {
62
-      toSubmit(FormData.concat([{result: CityId, key: 'intentArea', question: '意向区域'}]))
59
+      toSubmit(FormData)
63
     }
60
     }
64
   }
61
   }
65
 
62
 
69
     }
66
     }
70
   }
67
   }
71
 
68
 
72
-  const PickerChange = (e) => {
73
-    setCityName(CityList[e.detail.value - 0].name)
74
-    setCityId(CityList[e.detail.value - 0].id)
75
-  }
76
-
77
   return (
69
   return (
78
     <view className='components BuyHouse'>
70
     <view className='components BuyHouse'>
79
       {
71
       {
114
                 {
106
                 {
115
                   item.type === 'select' &&
107
                   item.type === 'select' &&
116
                   <view className='Area'>
108
                   <view className='Area'>
117
-                    <view className='flex-h'>
109
+                    <view className='flex-h' onClick={selectArea}>
118
                       {
110
                       {
119
                         item.key === 'intentArea' &&
111
                         item.key === 'intentArea' &&
120
                         <text className='iconfont icon-dingwei'></text>
112
                         <text className='iconfont icon-dingwei'></text>
121
                       }
113
                       }
122
-                      {/* <text>不限</text> */}
123
-                      <view className='flex-item'>
124
-                        <Picker range-key='name' onChange={PickerChange} value={0} range={CityList}>
125
-                          <text>{CityName || '请选择'}</text>
126
-                        </Picker>
127
-                      </view>
114
+                      <text>{AreaInfo.name || '不限'}</text>
115
+                      <view className='flex-item'></view>
128
                       <text className='iconfont icon-jiantoudown'></text>
116
                       <text className='iconfont icon-jiantoudown'></text>
129
                     </view>
117
                     </view>
130
                   </view>
118
                   </view>

+ 6
- 18
src/pages/index/helpToFindHouse/components/HousePurchasing/index.jsx View File

1
 import { useState, useEffect } from 'react'
1
 import { useState, useEffect } from 'react'
2
 import '@/assets/css/iconfont.css'
2
 import '@/assets/css/iconfont.css'
3
-import { Image, Slider, Textarea, Picker } from '@tarojs/components'
3
+import { Image, Slider, Textarea } from '@tarojs/components'
4
 import './index.scss'
4
 import './index.scss'
5
 import questions from './formData'
5
 import questions from './formData'
6
 
6
 
7
 export default function HousePurchasing (props) {
7
 export default function HousePurchasing (props) {
8
-  const { change = () => { }, toSubmit = () => {}, CityList = [] } = props
8
+  const { change = () => { }, toSubmit = () => {}, AreaInfo = {}, selectArea = () => {} } = props
9
 
9
 
10
   const [FormData, setFormData] = useState(questions)
10
   const [FormData, setFormData] = useState(questions)
11
 
11
 
12
   const [StepId, setStepId] = useState(1)
12
   const [StepId, setStepId] = useState(1)
13
   const [StepRange, setStepRange] = useState([0, 5])
13
   const [StepRange, setStepRange] = useState([0, 5])
14
 
14
 
15
-  const [CityName, setCityName] = useState(null)
16
-  const [CityId, setCityId] = useState(null)
17
-
18
   useEffect(() => {
15
   useEffect(() => {
19
     if(StepId === 1) {
16
     if(StepId === 1) {
20
       setStepRange([0, 5])
17
       setStepRange([0, 5])
53
     if (StepId < 1) {
50
     if (StepId < 1) {
54
       setStepId(StepId + 1)
51
       setStepId(StepId + 1)
55
     } else {
52
     } else {
56
-      toSubmit(FormData.concat([{result: CityId, key: 'intentArea', question: '意向区域'}]))
53
+      toSubmit(FormData)
57
     }
54
     }
58
   }
55
   }
59
 
56
 
63
     }
60
     }
64
   }
61
   }
65
 
62
 
66
-  const PickerChange = (e) => {
67
-    setCityName(CityList[e.detail.value - 0].name)
68
-    setCityId(CityList[e.detail.value - 0].id)
69
-  }
70
-
71
   return (
63
   return (
72
     <view className='components BuyHouse'>
64
     <view className='components BuyHouse'>
73
       {
65
       {
108
                 {
100
                 {
109
                   item.type === 'select' &&
101
                   item.type === 'select' &&
110
                   <view className='Area'>
102
                   <view className='Area'>
111
-                    <view className='flex-h'>
103
+                    <view className='flex-h' onClick={selectArea}>
112
                       {
104
                       {
113
                         item.key === 'district' &&
105
                         item.key === 'district' &&
114
                         <text className='iconfont icon-dingwei'></text>
106
                         <text className='iconfont icon-dingwei'></text>
115
                       }
107
                       }
116
-                      {/* <text>不限</text> */}
117
-                      <view className='flex-item'>
118
-                        <Picker range-key='name' onChange={PickerChange} value={0} range={CityList}>
119
-                          <text>{CityName || '请选择'}</text>
120
-                        </Picker>
121
-                      </view>
108
+                      <text>{AreaInfo.name || '不限'}</text>
109
+                      <view className='flex-item'></view>
122
                       <text className='iconfont icon-jiantoudown'></text>
110
                       <text className='iconfont icon-jiantoudown'></text>
123
                     </view>
111
                     </view>
124
                   </view>
112
                   </view>

+ 6
- 18
src/pages/index/helpToFindHouse/components/RentingHouse/index.jsx View File

1
 import { useState, useEffect } from 'react'
1
 import { useState, useEffect } from 'react'
2
 import '@/assets/css/iconfont.css'
2
 import '@/assets/css/iconfont.css'
3
-import { Image, Slider, Textarea, Picker } from '@tarojs/components'
3
+import { Image, Slider, Textarea } from '@tarojs/components'
4
 import './index.scss'
4
 import './index.scss'
5
 import questions from './formData'
5
 import questions from './formData'
6
 
6
 
7
 export default function RentingHouse (props) {
7
 export default function RentingHouse (props) {
8
-  const { change = () => { }, toSubmit = () => {}, CityList = [] } = props
8
+  const { change = () => { }, toSubmit = () => {}, AreaInfo = {}, selectArea = () => {} } = props
9
 
9
 
10
   const [FormData, setFormData] = useState(questions)
10
   const [FormData, setFormData] = useState(questions)
11
 
11
 
12
   const [StepId, setStepId] = useState(1)
12
   const [StepId, setStepId] = useState(1)
13
   const [StepRange, setStepRange] = useState([0, 4])
13
   const [StepRange, setStepRange] = useState([0, 4])
14
 
14
 
15
-  const [CityName, setCityName] = useState(null)
16
-  const [CityId, setCityId] = useState(null)
17
-
18
   useEffect(() => {
15
   useEffect(() => {
19
     if(StepId === 1) {
16
     if(StepId === 1) {
20
       setStepRange([0, 4])
17
       setStepRange([0, 4])
55
     if (StepId < 2) {
52
     if (StepId < 2) {
56
       setStepId(StepId + 1)
53
       setStepId(StepId + 1)
57
     } else {
54
     } else {
58
-      toSubmit(FormData.concat([{result: CityId, key: 'intentArea', question: '意向区域'}]))
55
+      toSubmit(FormData)
59
     }
56
     }
60
   }
57
   }
61
 
58
 
65
     }
62
     }
66
   }
63
   }
67
 
64
 
68
-  const PickerChange = (e) => {
69
-    setCityName(CityList[e.detail.value - 0].name)
70
-    setCityId(CityList[e.detail.value - 0].id)
71
-  }
72
-
73
   return (
65
   return (
74
     <view className='components BuyHouse'>
66
     <view className='components BuyHouse'>
75
       {
67
       {
110
                 {
102
                 {
111
                   item.type === 'select' &&
103
                   item.type === 'select' &&
112
                   <view className='Area'>
104
                   <view className='Area'>
113
-                    <view className='flex-h'>
105
+                    <view className='flex-h' onClick={selectArea}>
114
                       {
106
                       {
115
                         item.key === 'district' &&
107
                         item.key === 'district' &&
116
                         <text className='iconfont icon-dingwei'></text>
108
                         <text className='iconfont icon-dingwei'></text>
117
                       }
109
                       }
118
-                      {/* <text>不限</text> */}
119
-                      <view className='flex-item'>
120
-                        <Picker range-key='name' onChange={PickerChange} value={0} range={CityList}>
121
-                          <text>{CityName || '请选择'}</text>
122
-                        </Picker>
123
-                      </view>
110
+                      <text>{AreaInfo.name || '不限'}</text>
111
+                      <view className='flex-item'></view>
124
                       <text className='iconfont icon-jiantoudown'></text>
112
                       <text className='iconfont icon-jiantoudown'></text>
125
                     </view>
113
                     </view>
126
                   </view>
114
                   </view>

+ 2
- 1
src/pages/index/helpToFindHouse/components/SubmitBuyHouseResult/index.jsx View File

1
 
1
 
2
 import '@/assets/css/iconfont.css'
2
 import '@/assets/css/iconfont.css'
3
 import { Image, Block } from '@tarojs/components'
3
 import { Image, Block } from '@tarojs/components'
4
+import { getImgURL } from '@/utils/image'
4
 import Taro from '@tarojs/taro'
5
 import Taro from '@tarojs/taro'
5
 import './index.scss'
6
 import './index.scss'
6
 
7
 
44
                       <view className='RecommendBuildingItem' onClick={() => {Taro.navigateTo({ url: `/pages/index/buildingDetail/index?id=${item.buildingId}` })}}>
45
                       <view className='RecommendBuildingItem' onClick={() => {Taro.navigateTo({ url: `/pages/index/buildingDetail/index?id=${item.buildingId}` })}}>
45
                         <view>
46
                         <view>
46
                           <view className='Img'>
47
                           <view className='Img'>
47
-                            <Image mode='aspectFill' src={item.poster} className='centerLabel'></Image>
48
+                            <Image mode='aspectFill' src={getImgURL(item.poster || item.preSalePermit)} className='centerLabel'></Image>
48
                           </view>
49
                           </view>
49
                           <view className='Title flex-h'>
50
                           <view className='Title flex-h'>
50
                             <view className='flex-item'>
51
                             <view className='flex-item'>

+ 27
- 23
src/pages/index/helpToFindHouse/index.jsx View File

1
-import { useState, useEffect } from 'react'
1
+import { useState } from 'react'
2
 import withLayout from '@/layout'
2
 import withLayout from '@/layout'
3
 import { ScrollView, Image } from '@tarojs/components'
3
 import { ScrollView, Image } from '@tarojs/components'
4
 import { fetch } from '@/utils/request'
4
 import { fetch } from '@/utils/request'
5
-import { API_HELP_FIND_HOUSE_SUBMIT, API_CITY_AREA } from '@/constants/api'
5
+import { API_HELP_FIND_HOUSE_SUBMIT } from '@/constants/api'
6
 import '@/assets/css/iconfont.css'
6
 import '@/assets/css/iconfont.css'
7
 import { useSelector } from 'react-redux'
7
 import { useSelector } from 'react-redux'
8
+import AreaPickerView from '@/components/AreaPickerView/index'
8
 import './index.scss'
9
 import './index.scss'
9
 import BuyHouse from './components/BuyHouse/index'
10
 import BuyHouse from './components/BuyHouse/index'
10
 import RentingHouse from './components/RentingHouse/index'
11
 import RentingHouse from './components/RentingHouse/index'
14
 export default withLayout(() => {
15
 export default withLayout(() => {
15
 
16
 
16
   const user = useSelector(state => state.user)
17
   const user = useSelector(state => state.user)
17
-  const city = useSelector(state => state.city)
18
   const [DemandList] = useState([
18
   const [DemandList] = useState([
19
     { name: '我要买房', id: 1, icon: '', spell: 'MAI FANG' },
19
     { name: '我要买房', id: 1, icon: '', spell: 'MAI FANG' },
20
     { name: '我要租房', id: 2, icon: '', spell: 'ZU FANG' },
20
     { name: '我要租房', id: 2, icon: '', spell: 'ZU FANG' },
22
   ])
22
   ])
23
   const [CurrentDemandId, setCurrentDemandId] = useState(1)
23
   const [CurrentDemandId, setCurrentDemandId] = useState(1)
24
   const [ShowDemand, setShowDemand] = useState(true)
24
   const [ShowDemand, setShowDemand] = useState(true)
25
-  const [CityAreaList, setCityAreaList] = useState([])
26
   const [ResultList, setResultList] = useState([])
25
   const [ResultList, setResultList] = useState([])
27
   const [ShowPopup, setShowPopup] = useState(false)
26
   const [ShowPopup, setShowPopup] = useState(false)
28
-
29
-  useEffect(() => {
30
-    CityArea()
31
-  }, [])
32
-
33
-  const CityArea = () => {
34
-    fetch({ url: API_CITY_AREA, method: 'get', payload: { cityId: city.curCity.id, leveltype: 3 } }).then((res) => {
35
-      setCityAreaList(res || [])
36
-    })
37
-  }
27
+  const [ShowCitysPopup, setShowCitysPopup] = useState(false)
28
+  const [AreaInfo, setAreaInfo] = useState({})
38
 
29
 
39
   const CutDemandId = (id) => {
30
   const CutDemandId = (id) => {
40
     return () => {
31
     return () => {
46
     setShowDemand(id === 1)
37
     setShowDemand(id === 1)
47
   }
38
   }
48
 
39
 
40
+  const AreaChange = (e) => {
41
+    setAreaInfo(e[2])
42
+    setShowCitysPopup(false)
43
+  }
44
+
49
   const submitForm = (data) => {
45
   const submitForm = (data) => {
50
     data = data || []
46
     data = data || []
51
     let params = []
47
     let params = []
52
     data.map((item) => {
48
     data.map((item) => {
53
-      if(item.key === 'budget') {
54
-        params.push({...item, key: 'minPrice', result: CurrentDemandId === 2 ? item.options[0] : item.options[0] * 10000})
55
-        params.push({...item, key: 'maxPrice', result: CurrentDemandId === 2 ? item.result : item.result * 10000})
49
+      if (item.key === 'budget') {
50
+        params.push({ ...item, key: 'minPrice', result: CurrentDemandId === 2 ? item.options[0] : item.options[0] * 10000 })
51
+        params.push({ ...item, key: 'maxPrice', result: CurrentDemandId === 2 ? item.result : item.result * 10000 })
56
       } else {
52
       } else {
57
-        if(item.result !== '' || item.resultId !== null) {
53
+        if (item.result !== '' || item.resultId !== null) {
58
           params.push(item)
54
           params.push(item)
59
         }
55
         }
60
       }
56
       }
61
     })
57
     })
62
-    params.push({question: '创建人小程序人员', result: user?.userInfo?.person?.personId, key: 'personId' })
63
-    fetch({ url: API_HELP_FIND_HOUSE_SUBMIT, method: 'post', payload: params }).then((res) => {
58
+    params.push({ question: '创建人小程序人员', result: user?.userInfo?.person?.personId, key: 'personId' })
59
+    params.push({ question: '意向区域', result: AreaInfo.id, key: 'intentArea' })
60
+    let payload = {}
61
+    params.map((item) => {
62
+      payload[item.key] = item.result || item.resultId
63
+    })
64
+    fetch({ url: API_HELP_FIND_HOUSE_SUBMIT, method: 'post', payload: { ...payload, questionnaire: JSON.stringify(params), type: CurrentDemandId } }).then((res) => {
64
       setResultList(res.taBuildingList || [])
65
       setResultList(res.taBuildingList || [])
65
       setShowPopup(true)
66
       setShowPopup(true)
66
     })
67
     })
68
 
69
 
69
   return (
70
   return (
70
     <view className='Page helpToFindHouse'>
71
     <view className='Page helpToFindHouse'>
72
+
73
+      <AreaPickerView show={ShowCitysPopup} Change={AreaChange} Cancel={() => { setShowCitysPopup(false) }}></AreaPickerView>
74
+
71
       {
75
       {
72
         ShowPopup &&
76
         ShowPopup &&
73
         <SubmitBuyHouseResult List={ResultList}></SubmitBuyHouseResult>
77
         <SubmitBuyHouseResult List={ResultList}></SubmitBuyHouseResult>
97
           {/* 买房 */}
101
           {/* 买房 */}
98
           {
102
           {
99
             CurrentDemandId === 1 &&
103
             CurrentDemandId === 1 &&
100
-            <BuyHouse change={StepChange} toSubmit={submitForm} CityList={CityAreaList}></BuyHouse>
104
+            <BuyHouse change={StepChange} toSubmit={submitForm} AreaInfo={AreaInfo} selectArea={() => { setShowCitysPopup(true) }}></BuyHouse>
101
           }
105
           }
102
 
106
 
103
           {/* 租房 */}
107
           {/* 租房 */}
104
           {
108
           {
105
             CurrentDemandId === 2 &&
109
             CurrentDemandId === 2 &&
106
-            <RentingHouse change={StepChange} toSubmit={submitForm} CityList={CityAreaList}></RentingHouse>
110
+            <RentingHouse change={StepChange} toSubmit={submitForm} AreaInfo={AreaInfo} selectArea={() => { setShowCitysPopup(true) }}></RentingHouse>
107
           }
111
           }
108
 
112
 
109
           {/* 置业 */}
113
           {/* 置业 */}
110
           {
114
           {
111
             CurrentDemandId === 3 &&
115
             CurrentDemandId === 3 &&
112
-            <HousePurchasing change={StepChange} toSubmit={submitForm} CityList={CityAreaList}></HousePurchasing>
116
+            <HousePurchasing change={StepChange} toSubmit={submitForm} AreaInfo={AreaInfo} selectArea={() => { setShowCitysPopup(true) }}></HousePurchasing>
113
           }
117
           }
114
 
118
 
115
         </view>
119
         </view>

+ 6
- 0
src/pages/index/helpToFindHouse/index.scss View File

1
 .Page.helpToFindHouse {
1
 .Page.helpToFindHouse {
2
   background: #fff;
2
   background: #fff;
3
+  width: 100%;
4
+  height: 100%;
5
+  position: relative;
6
+  overflow: hidden;
3
   > scroll-view {
7
   > scroll-view {
4
     width: 100%;
8
     width: 100%;
5
     height: 100%;
9
     height: 100%;
10
+    position: relative;
11
+    z-index: 1;
6
     .PageContent {
12
     .PageContent {
7
       position: relative;
13
       position: relative;
8
       overflow: hidden;
14
       overflow: hidden;