Selaa lähdekoodia

Merge branch 'main' of http://git.ycjcjy.com/marketing/miniapp into main

张延森 3 vuotta sitten
vanhempi
commit
040e18363f

+ 52
- 0
src/components/search/index.js Näytä tiedosto

@@ -0,0 +1,52 @@
1
+import { Component }  from 'react'
2
+import Taro  from '@tarojs/taro'
3
+import { View ,Text,Input} from '@tarojs/components'
4
+
5
+import './index.scss'
6
+
7
+// export default ()=>{
8
+//   return <View>123</View>
9
+// }
10
+
11
+class Search extends Component {
12
+  // static options = {
13
+  //   addGlobalClass: true
14
+  //   }
15
+  static defaultProps = {
16
+    onSearch: () => { }
17
+  }
18
+  constructor(props) {
19
+    super(props);
20
+    this.state = {
21
+      keyword: ''
22
+    }
23
+  }
24
+  
25
+  handleInput=(e)=> {
26
+    this.setState({ keyword: e.detail.value })
27
+    this.props.onInput(e.detail.value)
28
+  }
29
+  handleSearch() {
30
+    this.props.onSearch(this.state.keyword)
31
+  }
32
+  render() {
33
+    const { placeholder } = this.props
34
+    return (
35
+      <View className='search'>
36
+        <View className='search-wrap'>
37
+          <Text className="iconfont icon-sousuo search-btn" onClick={this.handleSearch} ></Text>
38
+          <Input
39
+            type="text"
40
+            confirm-type="search"
41
+            placeholder={placeholder}
42
+            class="search-input"
43
+            maxlength="30"
44
+            onInput={this.handleInput}
45
+            onConfirm={this.handleSearch}
46
+          />
47
+        </View>
48
+      </View>
49
+    )
50
+  }
51
+}
52
+export default Search

+ 34
- 0
src/components/search/index.scss Näytä tiedosto

@@ -0,0 +1,34 @@
1
+// @import "@/styles/theme.scss";
2
+.search {
3
+  width: 92%;
4
+  padding: 20px 30px;
5
+  margin: 0 auto;
6
+  margin-left: 5%;
7
+
8
+  &-wrap {
9
+    display: flex;
10
+    justify-content: space-between;
11
+    align-items: center;
12
+    border-radius: 22px;
13
+    background: #ffffff;
14
+    padding-left: 20px;
15
+    overflow: hidden;
16
+    width: 650px;
17
+    height: 44px;
18
+    margin: 20px auto 0;
19
+  }
20
+
21
+  &-input {
22
+    width: 100%;
23
+    height: 60px;
24
+    line-height: 60px;
25
+    font-size: 28px;
26
+    padding-left: 15px;
27
+    // color:$text-color-light;
28
+  }
29
+
30
+  &-btn {
31
+    font-size: 36px;
32
+    // color: $text-color-light;
33
+  }
34
+}

+ 111
- 104
src/pages/index/activityDetail/index.jsx Näytä tiedosto

@@ -42,9 +42,8 @@ const activityStatusDict = {
42 42
 };
43 43
 
44 44
 export default withLayout((props) => {
45
-  
46 45
   const { id } = props.router.params;
47
-  const [detail, setDetail] = useState({});
46
+  const [detail, setDetail] = useState();
48 47
   const [canChoose, setCanChoose] = useState("none");
49 48
 
50 49
   const [IsPull, setPull] = useState(false);
@@ -154,123 +153,131 @@ export default withLayout((props) => {
154 153
     });
155 154
   };
156 155
 
157
-  return (
158
-    <view className="Page activityDetail flex-v">
159
-      <view className="flex-item">
160
-        <view>
161
-          <ScrollView
162
-            scroll-y
163
-            refresher-enabled
164
-            refresher-triggered={IsPull}
165
-            onrefresherrefresh={PageRefresh}
166
-            refresher-background="#fff"
167
-          >
168
-            <view className="PageContent">
169
-              <view className="Top">
170
-                <Image
171
-                  mode="aspectFill"
172
-                  src={getImgURL(detail.bannerListImg)}
173
-                  className="centerLabel"
174
-                ></Image>
175
-              </view>
156
+  return <>
157
+  {
158
+ detail && (
159
+  <view className="Page activityDetail flex-v">
160
+    <view className="flex-item">
161
+      <view>
162
+        <ScrollView
163
+          scroll-y
164
+          refresher-enabled
165
+          refresher-triggered={IsPull}
166
+          onrefresherrefresh={PageRefresh}
167
+          refresher-background="#fff"
168
+        >
169
+          <view className="PageContent">
170
+            <view className="Top">
171
+              <Image
172
+                mode="aspectFill"
173
+                src={getImgURL(detail.bannerListImg)}
174
+                className="centerLabel"
175
+              ></Image>
176
+            </view>
176 177
 
177
-              <view className="Info">
178
-                <view>
179
-                  <view className="Title flex-h">
180
-                    <view className="flex-item">
181
-                      <text>{detail.title}</text>
182
-                    </view>
183
-                    <text className="Tips">{detail.enlisted || 0}人已报名</text>
178
+            <view className="Info">
179
+              <view>
180
+                <view className="Title flex-h">
181
+                  <view className="flex-item">
182
+                    <text>{detail.title}</text>
184 183
                   </view>
185
-                  <text className="Time">
186
-                    报名截止时间:
187
-                    {getDateFormat(
188
-                      new Date(detail.enlistEnd).valueOf(),
189
-                      true,
190
-                      "yyyy/M/d"
191
-                    )}
184
+                  <text className="Tips">
185
+                    {detail.enlisted || 0}人已报名
192 186
                   </text>
193
-                  {/* <text className="Name">“香颂 · 蔚澜半岛”</text> */}
194
-                  <view className="flex-h Address">
195
-                    <text>地址:</text>
196
-                    <view className="flex-item">
197
-                      <text>{detail.address}</text>
198
-                    </view>
199
-                  </view>
200
-                  <view className="flex-h Date">
201
-                    <text>时间:</text>
202
-                    <view className="flex-item">
203
-                      <text>
204
-                        {getDateFormat(
205
-                          new Date(detail.startDate).valueOf(),
206
-                          true,
207
-                          "yyyy/M/d"
208
-                        )}{" "}
209
-                        -{" "}
210
-                        {getDateFormat(
211
-                          new Date(detail.endDate).valueOf(),
212
-                          true,
213
-                          "yyyy/M/d"
214
-                        )}
215
-                      </text>
216
-                    </view>
187
+                </view>
188
+                <text className="Time">
189
+                  报名截止时间:
190
+                  {getDateFormat(
191
+                    new Date(detail.enlistEnd).valueOf(),
192
+                    true,
193
+                    "yyyy/M/d"
194
+                  )}
195
+                </text>
196
+                {/* <text className="Name">“香颂 · 蔚澜半岛”</text> */}
197
+                <view className="flex-h Address">
198
+                  <text>地址:</text>
199
+                  <view className="flex-item">
200
+                    <text>{detail.address}</text>
217 201
                   </view>
218
-                  <view className="Btn">
219
-                    <text>分享好友</text>
202
+                </view>
203
+                <view className="flex-h Date">
204
+                  <text>时间:</text>
205
+                  <view className="flex-item">
206
+                    <text>
207
+                      {getDateFormat(
208
+                        new Date(detail.startDate).valueOf(),
209
+                        true,
210
+                        "yyyy/M/d"
211
+                      )}{" "}
212
+                      -{" "}
213
+                      {getDateFormat(
214
+                        new Date(detail.endDate).valueOf(),
215
+                        true,
216
+                        "yyyy/M/d"
217
+                      )}
218
+                    </text>
220 219
                   </view>
221 220
                 </view>
221
+                <view className="Btn">
222
+                  <text>分享好友</text>
223
+                </view>
222 224
               </view>
225
+            </view>
223 226
 
224
-              <view className="ActivityIntro">
225
-                <view className="Title">
226
-                  <text>活动介绍</text>
227
-                </view>
228
-                <Image
229
-                  mode="aspectFill"
230
-                  src={getImgURL(detail.imgUrl)}
231
-                  className="img"
232
-                ></Image>
233
-                <RichText nodes={detail.desc} />
234
-                {/* <richText nodes={detail.desc} ></richText> */}
227
+            <view className="ActivityIntro">
228
+              <view className="Title">
229
+                <text>活动介绍</text>
235 230
               </view>
231
+              <Image
232
+                mode="aspectFill"
233
+                src={getImgURL(detail.imgUrl)}
234
+                className="img"
235
+              ></Image>
236
+              <RichText nodes={detail.desc} />
237
+              {/* <richText nodes={detail.desc} ></richText> */}
238
+            </view>
236 239
 
237
-              <view className="Bottom">
240
+            <view className="Bottom">
241
+              <view>
238 242
                 <view>
239
-                  <view>
240
-                    <text className="iconfont icon-shengming"></text>
241
-                    <text>免责声明</text>
242
-                  </view>
243
-                  <view>
244
-                    <text>
245
-                      &emsp;&emsp;以上价格仅供参考,具体一房一价的信息以售楼处展示为准。房屋位置交通、医疗、教育、商业等配套信息,来源于第三方不作为要约,仅供参考,双方具体权利义务应以法律规定及买卖合同约定为准。本平台对项目周边文化教育的介绍旨在提供相关信息1
246
-                      意味着信息发布方对就学安排作出承诺。相关教育资首页信息存在调整的可能,应以政府教育主管部门门及办学颁布的政策规定为准。详情请仔细阅读
247
-                    </text>
248
-                    <text className="active">《新联家使用免责条款》</text>
249
-                  </view>
243
+                  <text className="iconfont icon-shengming"></text>
244
+                  <text>免责声明</text>
245
+                </view>
246
+                <view>
247
+                  <text>
248
+                    &emsp;&emsp;以上价格仅供参考,具体一房一价的信息以售楼处展示为准。房屋位置交通、医疗、教育、商业等配套信息,来源于第三方不作为要约,仅供参考,双方具体权利义务应以法律规定及买卖合同约定为准。本平台对项目周边文化教育的介绍旨在提供相关信息1
249
+                    意味着信息发布方对就学安排作出承诺。相关教育资首页信息存在调整的可能,应以政府教育主管部门门及办学颁布的政策规定为准。详情请仔细阅读
250
+                  </text>
251
+                  <text className="active">《新联家使用免责条款》</text>
250 252
                 </view>
251 253
               </view>
252 254
             </view>
253
-          </ScrollView>
254
-        </view>
255
+          </view>
256
+        </ScrollView>
255 257
       </view>
256
-      <view className="PageBottom flex-h">
257
-        <view className="Share">
258
-          <text className="iconfont icon-fenxiang"></text>
259
-          <text>分享</text>
260
-        </view>
261
-        <view className="Collect" onClick={handleFavo}>
262
-          <text
263
-            className="iconfont icon-shoucang"
264
-            style={detail.isSaved === 1 ? { color: "red" } : undefined}
265
-          ></text>
266
-          <text>收藏</text>
267
-        </view>
268
-        <view className="flex-item"></view>
269
-
270
-        <text className="Post" onClick={handleSignup}>
271
-          {activityStatusDict[detail.activityStatus]?.text}
272
-        </text>
258
+    </view>
259
+    <view className="PageBottom flex-h">
260
+      <view className="Share">
261
+        <text className="iconfont icon-fenxiang"></text>
262
+        <text>分享</text>
273 263
       </view>
264
+      <view className="Collect" onClick={handleFavo}>
265
+        <text
266
+          className="iconfont icon-shoucang"
267
+          style={detail.isSaved === 1 ? { color: "red" } : undefined}
268
+        ></text>
269
+        <text>收藏</text>
270
+      </view>
271
+      <view className="flex-item"></view>
272
+
273
+      <text className="Post" onClick={handleSignup}>
274
+        {activityStatusDict[detail.activityStatus]?.text}
275
+      </text>
274 276
     </view>
275
-  );
277
+  </view>
278
+)
279
+  }
280
+    </>
281
+   
282
+  
276 283
 });

+ 16
- 9
src/pages/index/activityList/index.jsx Näytä tiedosto

@@ -1,15 +1,17 @@
1 1
 import { useState, useEffect } from 'react'
2 2
 import { useDidShow,useRouter } from '@tarojs/taro'
3 3
 import { ScrollView } from '@tarojs/components'
4
+import { useSelector } from 'react-redux'
4 5
 import { queryActivityList, getActNewList } from '@/services/activity'
5 6
 import './index.scss'
6 7
 import ActivityListItem from '../components/ActivityListItem/index'
7 8
 
8 9
 export default function MyCollectForActivity (props) {
9
- 
10
-  const router=useRouter()
11
-  console.log(router,'MyCollectForActivity')
10
+ const router=useRouter()
11
+
12 12
    const { type } = router.params;
13
+  const city = useSelector(state => state.city)
14
+ 
13 15
   const [PageList, setPageList] = useState([])
14 16
   const [IsPull, setPull] = useState(false)
15 17
   const [PullTimer, setPullTimer] = useState(null)
@@ -27,17 +29,22 @@ export default function MyCollectForActivity (props) {
27 29
     }
28 30
   }, [IsPull])
29 31
 
30
-
32
+  
31 33
 
32 34
  const getList = (params) => {
33
-  queryActivityList({...params,type}).then((res)=>{
34
-    console.log(res,'-----------------')
35
+  queryActivityList({...params,type,cityId: city.curCity.id}).then((res)=>{
35 36
     setPageList(res.list)
36 37
   })
37 38
   }
38
-  useDidShow(() => {
39
-    getList({page :0, pageSize : 10})
40
-  })
39
+  useEffect(()=>{
40
+    if(city?.curCity?.id){
41
+      getList({page :0, pageSize : 10})
42
+    }
43
+   
44
+  },[city])
45
+  // useDidShow(() => {
46
+  //   getList({page :0, pageSize : 10})
47
+  // })
41 48
 
42 49
  
43 50
 

+ 0
- 2
src/pages/index/components/ActivityListItem/index.jsx Näytä tiedosto

@@ -25,7 +25,6 @@ const activityStatusDict={
25 25
 }
26 26
 export default function ActivityListItem (props) {
27 27
   const { data = {} } = props
28
-  console.log(props,'ActivityListItem')
29 28
   return (
30 29
     <view className='components ActivityListItem' onClick={() => { Taro.navigateTo({ url: `/pages/index/activityDetail/index?id=${data.dynamicId}` }) }}>
31 30
       <view className='Img'>
@@ -39,7 +38,6 @@ export default function ActivityListItem (props) {
39 38
           <text className={activityStatusDict[data.activityStatus]?.className}>{activityStatusDict[data.activityStatus]?.text}</text>
40 39
         </view>
41 40
         <view className='Time'>
42
-          {console.log(new Date(data.startDate).valueOf(),'new Date(data.startDate )')}
43 41
           <text>活动时间:{getDateFormat(new Date(data.startDate).valueOf(),true,'yyyy/M/d')} - {getDateFormat(new Date(data.endDate).valueOf(),true,'yyyy/M/d')}</text>
44 42
         </view>
45 43
       </view>

+ 47
- 1
src/pages/index/components/Banner/index.jsx Näytä tiedosto

@@ -1,10 +1,56 @@
1 1
 
2 2
 import { Swiper, SwiperItem, Image } from '@tarojs/components'
3
+import Taro from '@tarojs/taro'
3 4
 import { getImgURL } from '@/utils/image'
4 5
 import './index.scss'
5 6
 
6 7
 export default function Banner (props) {
7 8
   const { List = [] } = props
9
+  
10
+  const redirectTo = ({ targetId, contentType, buildingId } = {})=> {
11
+    switch (contentType) {
12
+      // 项目
13
+      case 'project':
14
+        Taro.navigateTo({
15
+          url: '/pages/index/buildingDetail/index?id=' + buildingId
16
+        })
17
+        return;
18
+
19
+      // 活动
20
+      case 'activity':
21
+        Taro.navigateTo({
22
+          url: '/pages/index/activityDetail/index?id=' + targetId
23
+        })
24
+        return;
25
+
26
+      // 资讯
27
+      case 'news':
28
+        Taro.navigateTo({
29
+          url: '/pages/index/newsDetail/index?id=' + targetId
30
+        })
31
+        return;
32
+
33
+      // live
34
+      case 'live':
35
+        Taro.navigateTo({
36
+          url: '/pages/video/liveDetail/index?id=' + targetId
37
+        })
38
+        return;
39
+
40
+
41
+      // 其他
42
+      case 'others':
43
+      default:
44
+        
45
+        return;
46
+    }
47
+  }
48
+
49
+  const handleBannerClick = (item) => {
50
+    if (item.contentType && item.contentType != "nothing") {
51
+      redirectTo(item)
52
+    } 
53
+  }
8 54
   return (
9 55
     <view className='components Banner'>
10 56
       <Swiper autoplay interval={2000} indicator-dots>
@@ -12,7 +58,7 @@ export default function Banner (props) {
12 58
           List.map((item, index) => (
13 59
             <SwiperItem key={`Banner-${index}`}>
14 60
               <view className='swiper-item'>
15
-                <Image mode='aspectFill' className='centerLabel' src={getImgURL(item.image)} />
61
+                <Image mode='aspectFill' className='centerLabel' onClick={()=>handleBannerClick(item)} src={getImgURL(item.image)} />
16 62
               </view>
17 63
             </SwiperItem>
18 64
           ))

+ 9
- 8
src/pages/index/components/HotRecommend/index.jsx Näytä tiedosto

@@ -13,7 +13,7 @@ export default function HotRecommend () {
13 13
   const [MenuList] = useState([{ name: '热门活动', id: 'dymic' }, { name: '热门团房', id: 'house' }])
14 14
   const [CurrentId, setCurrentId] = useState('dymic')
15 15
   const [list,setList]=useState([])
16
-  const [CurrentContentInfo, setCurrentContentInfo] = useState({ title: '#大运河孔雀城时代', desc: '5月30日六一儿童节表演赛案场展开!' })
16
+  const [CurrentContentInfo, setCurrentContentInfo] = useState({ })
17 17
 
18 18
   useEffect(() => {
19 19
     if(city.curCity.name) {
@@ -23,7 +23,7 @@ export default function HotRecommend () {
23 23
 
24 24
   const GetRecommendActivity = () => {
25 25
     
26
-      queryActivityList({home:1}).then((res)=>{
26
+      queryActivityList({home:1,cityId: city.curCity.id}).then((res)=>{
27 27
         console.log(res,'-----------------')
28 28
         setList(res.list)
29 29
       })
@@ -31,7 +31,7 @@ export default function HotRecommend () {
31 31
 
32 32
   useEffect(() => {
33 33
     if(list.length>0) {
34
-      setCurrentContentInfo(list.filter(x=>x.type==CurrentId)[0])
34
+      setCurrentContentInfo(list.filter(x=>x.type==CurrentId)[0]||{})
35 35
     }
36 36
   }, [CurrentId,list])
37 37
 
@@ -47,7 +47,9 @@ export default function HotRecommend () {
47 47
   }
48 48
 
49 49
   const toDetail = () => {
50
-    Taro.navigateTo({url: `/pages/index/activityDetail/index?id=${CurrentContentInfo.dynamicId}`})
50
+    if(CurrentContentInfo.dynamicId){
51
+      Taro.navigateTo({url: `/pages/index/activityDetail/index?id=${CurrentContentInfo.dynamicId}`})
52
+    }
51 53
   }
52 54
   // url: `/pages/index/activityDetail/index?id=${data.dynamicId}`
53 55
   return (
@@ -60,13 +62,12 @@ export default function HotRecommend () {
60 62
             ))
61 63
           }
62 64
         </view>
63
-        {console.log(CurrentContentInfo,'CurrentContentInfo')}
64
-        <view className='Content' onClick={toDetail}>
65
+      <view className='Content' onClick={toDetail}>
65 66
           <view className='flex-h'>
66
-            <text className='flex-item'>{CurrentContentInfo.title}</text>
67
+            <text className='flex-item'>{CurrentContentInfo.title||'暂无活动'}</text>
67 68
             <text onClick={ToMore}>{CurrentId === 'dymic' ? '更多活动' : '更多团房'}</text>
68 69
           </view>
69
-          <text>{CurrentContentInfo.desc}</text>
70
+          <text>{CurrentContentInfo.halfTitle}</text>
70 71
         </view>
71 72
       </view>
72 73
     </view>

+ 2
- 1
src/pages/index/components/LiveSale/index.jsx Näytä tiedosto

@@ -1,4 +1,5 @@
1 1
 import { useState, useEffect } from 'react'
2
+import Taro from '@tarojs/taro'
2 3
 import { ScrollView, Image } from '@tarojs/components'
3 4
 import { useSelector } from 'react-redux'
4 5
 import { fetch } from '@/utils/request'
@@ -47,7 +48,7 @@ export default function LiveSale () {
47 48
             {
48 49
               PageList.map((item, index) => (
49 50
                 <view className='ListItem' key={`List-${index}`} style={{display: CurrentId === 1 || (CurrentId === 2 && item.kind === 'notice') || (CurrentId === 3 && item.kind === 'live')  || (CurrentId === 4 && item.kind !== 'notice') ? 'inline-block' : 'none'}}>
50
-                  <Image mode='aspectFill' className='centerLabel' onClick={()=>{}} src={`${getImgURL(item.images)}`} />
51
+                  <Image mode='aspectFill' className='centerLabel' onClick={()=>{Taro.navigateTo({ url: `/pages/video/liveDetail/index?id=${item.id}` })}} src={`${getImgURL(item.images)}`} />
51 52
                 </view>
52 53
               ))
53 54
             }

+ 1
- 1
src/pages/index/components/Menu/index.jsx Näytä tiedosto

@@ -15,7 +15,7 @@ export default function Menu (props) {
15 15
     { name: '团房信息', id: 8, icon: require('../../../../assets/index-icon12.png'), router: '/pages/index/activityList/index?type=house' },
16 16
     { name: '特价房', id: 9, icon: require('../../../../assets/index-icon11.png'), router: '/pages/index/specialPriceHouse/index' },
17 17
     { name: '康养', id: 10, icon: require('../../../../assets/index-icon7.png'), router: '/pages/index/recovered/index' },
18
-    { name: '文旅商办', id: 11, icon: require('../../../../assets/index-icon13.png'), router: '/pages/index/culturalAndBusiness/index' },
18
+    { name: '文旅商办', id: 11, icon: require('../../../../assets/index-icon13.png'), router: `/pages/index/buildingList/index?type=3` },
19 19
     { name: '新闻资讯', id: 12, icon: require('../../../../assets/index-icon15.png'), router: '/pages/index/newsList/index' },
20 20
     { name: '购房百科', id: 13, icon: require('../../../../assets/index-icon4.png'), router: '/pages/index/encyclopediasOfBuyHouse/index' },
21 21
     { name: '房贷计算', id: 14, icon: require('../../../../assets/index-icon3.png'), router: '/pages/index/mortgageCalculation/index' }

+ 116
- 34
src/pages/index/location/index.jsx Näytä tiedosto

@@ -1,45 +1,127 @@
1
-import React, { useState, useEffect } from 'react'
2
-import withLayout from '@/layout'
3
-import './index.scss'
4
-import { ScrollView } from '@tarojs/components'
5
-import '../../../assets/css/iconfont.css'
1
+import React, { useState, useEffect } from "react";
2
+import Taro from "@tarojs/taro";
3
+import withLayout from "@/layout";
4
+import "./index.scss";
5
+import { ScrollView, View, Text, Block } from "@tarojs/components";
6
+import "../../../assets/css/iconfont.css";
7
+import { queryCityList } from "@/services/common";
8
+import { dispatchCitySelected } from "@/actions/city";
9
+import { useSelector, useDispatch } from "react-redux";
10
+import Search from "@/components/search";
6 11
 
7 12
 export default withLayout((props) => {
13
+  const city = useSelector((state) => state.city);
14
+  const dispatch = useDispatch();
15
+  const [list, setList] = useState({});
16
+  const [searchList, setSearchList] = useState([]);
17
+  const [keywords, setKeywords] = useState("");
8 18
 
9
-  // const [PageProps] = useState(props)
10
-  const [PageList, setPageList] = useState(['', '', '', '', '', '', '', '', '', '', '', '', ''])
11
-  const [IsPull, setPull] = useState(false)
12
-  const [PullTimer, setPullTimer] = useState(null)
19
+  useEffect(() => {
20
+    initData();
21
+  }, []);
13 22
 
14
-  const PageRefresh = () => { // 页面下拉刷新回调
15
-    setPull(true)
16
-  }
23
+  // componentWillMount() {
17 24
 
18
-  useEffect(() => { // 下拉刷新触发
19
-    if (IsPull) {
20
-      clearTimeout(PullTimer)
21
-      setPullTimer(setTimeout(() => {
22
-        setPull(false)
23
-      }, 2000))
24
-    }
25
-  }, [IsPull])
25
+  //   initData()
26
+  //   console.log(this.props,"this.props.citylist")
27
+  // }
26 28
 
27
-  return (
28
-    <view className='Page Location'>
29
+  function initData() {
30
+    queryCityList().then((cityList) => {
31
+      const t = cityList.reduce((prev, cur) => {
32
+        if (prev[cur.initial]) {
33
+          prev[cur.initial].push(cur);
34
+        } else {
35
+          prev[cur.initial] = [cur];
36
+        }
29 37
 
30
-      <ScrollView scroll-y={true} refresher-enabled={true} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
31
-        <view className='PageContent'>
38
+        return prev;
39
+      }, {});
32 40
 
33
-          定位
41
+      setList(t);
42
+    });
43
+  }
34 44
 
35
-          {/* bottom */}
36
-          <view className='PageBottom'>
37
-            <text>已经到底了~</text>
38
-          </view>
45
+  function handleSelected(item) {
46
+    dispatchCitySelected(item)(dispatch).then((res) => {
47
+      Taro.navigateBack({
48
+        delta: 1,
49
+      });
50
+    });
51
+  }
39 52
 
40
-        </view>
41
-      </ScrollView>
53
+  const handleSearch = (keywords) => {
54
+    let t = [];
55
+    Object.keys(list).forEach((key) => {
56
+      console.log(list[key], "33ss33"); // foo
57
+      t = t.concat(list[key].filter((item) => item.name.includes(keywords)));
58
+    });
59
+    console.log(t, keywords, "3333"); // foo
60
+    setSearchList(t);
61
+    setKeywords(keywords);
62
+  };
42 63
 
43
-    </view>
44
-  )
45
-})
64
+  const { curCity } = city;
65
+  // const { searchList, list, keywords } = this.state
66
+  const keys = Object.keys(list);
67
+  return (
68
+    <View className="city">
69
+      <ScrollView
70
+        style={{
71
+          height: "100vh",
72
+        }}
73
+        scrollY
74
+      >
75
+        <View className="search-wrap">
76
+          <Search
77
+            placeholder="搜索意向城市"
78
+            onInput={handleSearch}
79
+            onSearch={handleSearch}
80
+          ></Search>
81
+        </View>
82
+
83
+        <View className="cur-city">
84
+          <Text>
85
+            <Text className="iconfont icon-dingwei"></Text>当前城市:
86
+          </Text>
87
+          <Text>{curCity?.name}</Text>
88
+        </View>
89
+
90
+        <View className="city-list">
91
+          {keywords && (
92
+            <View className="search-list" style={{ marginTop: "20rpx" }}>
93
+              {searchList.length > 0 ? (
94
+                searchList.map((item) => (
95
+                  <View
96
+                    key={item.id}
97
+                    className="list-item"
98
+                    onClick={() => handleSelected(item)}
99
+                  >
100
+                    {item.name}
101
+                  </View>
102
+                ))
103
+              ) : (
104
+                <View className="empty">暂无结果</View>
105
+              )}
106
+            </View>
107
+          )}
108
+          {!keywords &&
109
+            keys.map((key) => (
110
+              <Block key={key}>
111
+                <View className="city-initial">{key}</View>
112
+                {list[key].map((item) => (
113
+                  <View
114
+                    key={item.id}
115
+                    className="city-item"
116
+                    onClick={() => handleSelected(item)}
117
+                  >
118
+                    {item.shortname}
119
+                  </View>
120
+                ))}
121
+              </Block>
122
+            ))}
123
+        </View>
124
+      </ScrollView>
125
+    </View>
126
+  );
127
+});

+ 52
- 10
src/pages/index/location/index.scss Näytä tiedosto

@@ -1,12 +1,54 @@
1
-.Page.Location {
2
-  background: #fff;
3
-  > scroll-view {
4
-    width: 100%;
5
-    height: 100%;
6
-    .PageContent {
7
-      position: relative;
8
-      overflow: hidden;
9
-      min-height: 100vh;
10
-    }
1
+// @import "@/styles/theme.scss";
2
+
3
+.city {
4
+  background: #f8f8f8;
5
+  height: 100vh;
6
+  &-initial {
7
+    padding: 30px 50px;
8
+    font-size: 24px;
9
+    font-family: DengXian;
10
+    font-weight: 400;
11
+    color: #333333
11 12
   }
13
+
14
+  &-item {
15
+    padding: 30px 50px;
16
+    background: white;
17
+  }
18
+}
19
+
20
+.search-wrap {
21
+  position: relative;
22
+  background: white;
23
+  padding-bottom: 10px;
24
+}
25
+.search-list {
26
+  position: absolute;
27
+  top: 114px;
28
+  width: 100%;
29
+  background: white;
30
+  min-height: 100vh;
31
+
32
+  .list-item {
33
+    padding: 20px 50px;
34
+    border-bottom: solid 1px #F8F8F8;
35
+    color: #333333
36
+  }
37
+  .empty {
38
+    display: flex;
39
+    height: 100px;
40
+    flex-direction: column;
41
+    justify-content: center;
42
+    align-items: center;
43
+    // color: $text-color-lighter;
44
+  }
45
+}
46
+
47
+.cur-city {
48
+  padding: 20px 30px;
49
+  // color: $text-color-lighter;
50
+  font-size: 20px;
51
+  font-family: DengXian;
52
+  font-weight: 400;
53
+  color: #193c83;
12 54
 }

+ 3
- 0
src/pages/video/liveDetail/index.config.js Näytä tiedosto

@@ -0,0 +1,3 @@
1
+export default {
2
+  navigationBarTitleText: '直播活动'
3
+}

+ 49
- 0
src/pages/video/liveDetail/index.jsx Näytä tiedosto

@@ -0,0 +1,49 @@
1
+import { useState, useEffect } from "react";
2
+import Taro, { useDidShow, useReady } from "@tarojs/taro";
3
+import withLayout from "@/layout";
4
+import {
5
+  Text,
6
+  View,
7
+  Picker,
8
+  Input,
9
+  ScrollView,
10
+  Image,
11
+  RichText,
12
+} from "@tarojs/components";
13
+import "@/assets/css/iconfont.css";
14
+import "./index.scss";
15
+import {
16
+  // addActivityShareNum,
17
+  signupActivity,
18
+  favorActivity,
19
+  cancelFavorActivity,
20
+  queryActivityDetail,
21
+} from "@/services/activity";
22
+import {
23
+    queryLiveDetail
24
+  } from "@/services/item";
25
+
26
+import { getImgURL } from "@/utils/image";
27
+
28
+export default withLayout((props) => {
29
+  const { id } = props.router.params;
30
+console.log(id,'queryLiveDetail')
31
+  const getData = () => {
32
+    // queryLiveDetail(id)
33
+  };
34
+
35
+  useEffect(() => {
36
+    if (id) {
37
+      getData(id);
38
+    }
39
+  }, [id]);
40
+//   
41
+  return <view className="liveDetail">
42
+       <Image mode='aspectFill' src={getImgURL('/file/20210708/7b268641-9990-4a62-ba1f-0e02d067d524.jpg')} className='liveImg'></Image>
43
+       <view className='liveDetail-menu'>
44
+           <view><text className="iconfont icon-fenxiang"></text><text>查看楼盘</text></view>
45
+           <view><text className="iconfont icon-camera"></text><text>观看直播</text></view>
46
+           <view><text className="iconfont icon-fenxiang"></text><text>分享好友</text></view>
47
+       </view>
48
+  </view>;
49
+});

+ 31
- 0
src/pages/video/liveDetail/index.scss Näytä tiedosto

@@ -0,0 +1,31 @@
1
+.liveDetail {
2
+  position: absolute;
3
+  width: 100%;
4
+  height: 100%;
5
+
6
+  .liveImg {
7
+    width: 100%;
8
+    height: 100%;
9
+  }
10
+  &-menu {
11
+      margin: auto;
12
+    display: flex;
13
+    justify-content: space-around;
14
+    align-items: center;
15
+    position: relative;
16
+    bottom: 200px;
17
+    width: 690px;
18
+    height: 92px;
19
+    background: rgba(0, 0, 0, 0.7);
20
+    border: 0px solid #000000;
21
+    font-size: 26px;
22
+    font-family: DengXian;
23
+    font-weight: bold;
24
+   
25
+    line-height: 30px;
26
+    letter-spacing: 6px;
27
+    text{
28
+         color: #ffffff;
29
+    }
30
+  }
31
+}

+ 8
- 0
src/routes.js Näytä tiedosto

@@ -176,6 +176,14 @@ const routes = [
176 176
     type: 'building',
177 177
   },
178 178
 
179
+  //视频
180
+  {
181
+    name: '直播活动',
182
+    page: 'pages/video/liveDetail/index',
183
+    pkg: 'main',
184
+    type: 'video',
185
+  },
186
+
179 187
   // 我的
180 188
   {
181 189
     name: '基本信息',