张延森 3 years ago
parent
commit
ef79e8a2bb

+ 2
- 2
config/dev.js View File

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

+ 1
- 3
src/pages/index/buildingDetail/components/HouseTypeIntro/index.jsx View File

@@ -17,10 +17,8 @@ export default function HouseTypeIntro (props) {
17 17
 
18 18
       <view className='Title flex-h'>
19 19
         <view className='flex-item'>
20
-          <text>户型介绍({Info.length})</text>
20
+          <text>户型介绍</text>
21 21
         </view>
22
-        <text>更多</text>
23
-        <text className='iconfont icon-jiantouright'></text>
24 22
       </view>
25 23
 
26 24
       <view className='ProjectList'>

+ 22
- 5
src/pages/index/buildingDetail/components/MarketingActivity/index.jsx View File

@@ -1,19 +1,36 @@
1
-
1
+import { useEffect, useState } from 'react'
2
+import Taro from '@tarojs/taro'
2 3
 import { Swiper, SwiperItem, Image } from '@tarojs/components'
3 4
 import { getImgURL } from '@/utils/image'
5
+import { queryActivityList } from '@/services/activity'
4 6
 import '@/assets/css/iconfont.css'
5 7
 import './index.scss'
6 8
 
7 9
 export default function MarketingActivity (props) {
8
-  const { List = [] } = props
9
-  return (
10
+  const { Info } = props
11
+  const { buildingId } = Info || {}
12
+
13
+  const [dataList, setDataList] = useState([])
14
+
15
+  const goMore = () => Taro.navigateTo({ url: `/pages/index/activityList/index?type=house&buildingId=${buildingId}` })
16
+
17
+  useEffect(() => {
18
+    queryActivityList({ buildingId, pageSize: 3 }).then((res) => {
19
+      const { list } = res || {}
20
+      setDataList(list || [])
21
+    })
22
+  }, [buildingId])
23
+
24
+  console.log('----------->', dataList)
25
+
26
+  return dataList.length > 0 && (
10 27
     <view className='components MarketingActivity'>
11 28
 
12 29
       <view className='Title flex-h'>
13 30
         <view className='flex-item'>
14 31
           <text>营销活动</text>
15 32
         </view>
16
-        <text>更多</text>
33
+        <text onClick={goMore}>更多</text>
17 34
         <text className='iconfont icon-jiantouright'></text>
18 35
       </view>
19 36
 
@@ -21,7 +38,7 @@ export default function MarketingActivity (props) {
21 38
         <view>
22 39
           <Swiper autoplay interval={2000} indicator-dots>
23 40
             {
24
-              List.map((item, index) => (
41
+              dataList.map((item, index) => (
25 42
                 <SwiperItem key={`Banner-${index}`}>
26 43
                   <view className='swiper-item'>
27 44
                     <Image mode='aspectFill' className='centerLabel' src={getImgURL(item.bannerListImg || item.image || item.url || item.img || item.imgUrl || item.detailImg)} />

+ 2
- 11
src/pages/index/buildingDetail/index.jsx View File

@@ -24,7 +24,6 @@ export default withLayout((props) => {
24 24
   const { id } = props.router.params
25 25
 
26 26
   const [DetailInfo, setDetailInfo] = useState({})
27
-  const [ActivityList, setActivityList] = useState([])
28 27
   const [PictureList, setPictureList] = useState([])
29 28
   const [NewsList, setNewsList] = useState([])
30 29
 
@@ -45,19 +44,11 @@ export default withLayout((props) => {
45 44
     })
46 45
 
47 46
     // 获取资讯列表
48
-    fetch({ url: API_NEWS_LIST, params: { buildingId: id, pageSize: 2, pageNum: 1 } }).then((res) => {
47
+    fetch({ url: API_NEWS_LIST, payload: { buildingId: id, pageSize: 2, pageNum: 1 } }).then((res) => {
49 48
       setNewsList(res.records || [])
50 49
     })
51
-    GetActivityList()
52 50
   }, [id])
53 51
 
54
-  const GetActivityList = () => { // 获取活动列表
55
-    fetch({ url: `${API_ACTIVITY_GROUP}?buildingId=${props.router.params.id}`, method: 'get' }).then((res) => {
56
-      const ResArr = res || []
57
-      setActivityList(ResArr.filter((item) => { return item.type !== 'help' && item.type !== 'group' }))
58
-    })
59
-  }
60
-
61 52
   const PageRefresh = () => { // 页面下拉刷新回调
62 53
     setPull(true)
63 54
   }
@@ -122,7 +113,7 @@ export default withLayout((props) => {
122 113
 
123 114
                 {/* 营销活动 */}
124 115
                 <view className='MarketingActivity' style={{minHeight: 0}}>
125
-                  <MarketingActivity List={ActivityList}></MarketingActivity>
116
+                  <MarketingActivity Info={DetailInfo}></MarketingActivity>
126 117
                 </view>
127 118
 
128 119
                 {/* 直播活动 */}

+ 3
- 5
src/utils/request.js View File

@@ -85,16 +85,14 @@ export const uploadFiles = async (files) => {
85 85
 }
86 86
 
87 87
 export function optionBuilder(options) {
88
-  const { url, params = {}, payload = {}, method = 'GET', showToast = true, autoLogin = true, header, spin = false } = options
88
+  const { url, payload = {}, method = 'GET', showToast = true, autoLogin = true, header, spin = false } = options
89 89
   const showMessage = Object.prototype.hasOwnProperty.call(payload, 'showToast') ? payload.showToast : showToast
90 90
   const consultant = Taro.getStorageSync('consultantId') || ''
91 91
   const recommender = Taro.getStorageSync('recommender') || ''
92
-  const queryStr = Object.keys(params).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`).join('&')
93
-  const apiURL = queryStr ? `${url}${url.indexOf('?') > -1 ? '&' : '?'}${queryStr}` : url
94
-
92
+  
95 93
   return [
96 94
     {
97
-      url: apiURL,
95
+      url,
98 96
       method,
99 97
       data: payload,
100 98
       header: {