吃个甘蔗嚼一年 3 年之前
父節點
當前提交
5f1113d31b
共有 1 個文件被更改,包括 34 次插入42 次删除
  1. 34
    42
      src/pages/index/tabs/Guide.jsx

+ 34
- 42
src/pages/index/tabs/Guide.jsx 查看文件

@@ -45,18 +45,10 @@ export default (props) => {
45 45
   const [wifiButtonStyle, setWifiButtonStyle] = useState('')
46 46
   const [parkingButtonStyle, setParkingButtonStyle] = useState('')
47 47
   const [guideStyle, setGuideStyle] = useState('')
48
+  const parkingGps = taRoomContent?.parkingLocation
49
+  const roomGps = taRoomContent?.location
50
+
48 51
 
49
-  //当前指南总数
50
-  const [newextNum, setNewextNum] = useState(0)
51
-  //全部指南个数
52
-  const [AllextNum, setAllextNum] = useState(0)
53
-  //指南当前页数
54
-  const extendMore = () => {
55
-    getExtendContent('room', roomId, { pageNum: 99999 }).then((res) => {
56
-      setExtend([...extend, ...res.records])
57
-      setNewextNum(newextNum + res.records.length)
58
-    })
59
-  }
60 52
 
61 53
   const goContent = () => {
62 54
     if (roomOrderId) {
@@ -81,10 +73,10 @@ export default (props) => {
81 73
       // 点击’去这里‘跳转导航
82 74
       setLoading(true)
83 75
       getTaRoom(roomId).then((res) => {
84
-        Roomlog.current = (res.location).toString().split(',')[0]
85
-        Roomlat.current = (res.location).toString().split(',')[1]
86
-        Parklog.current = (res.parkingLocation).toString().split(',')[0]
87
-        Parklat.current = (res.parkingLocation).toString().split(',')[1]
76
+        Roomlog.current = (!res.location).toString().split(',')[0]
77
+        Roomlat.current = (!res.location).toString().split(',')[1]
78
+        Parklog.current = (!res.parkingLocation).toString().split(',')[0]
79
+        Parklat.current = (!res.parkingLocation).toString().split(',')[1]
88 80
         setTaRoomContent(res || [])
89 81
         setLoading(false)
90 82
 
@@ -92,11 +84,16 @@ export default (props) => {
92 84
       //更多指引
93 85
       setLoading(true)
94 86
 
95
-      getExtendContent('room', roomId).then((res) => {
96
-        setExtend(res.records || [])
87
+      getExtendContent('room', roomId, {
88
+        pageNum: 99,
89
+        pageSize: 999,
90
+
91
+      }).then((res) => {
92
+        // setExtend(res.records || [])
93
+        setExtend(res.records)
94
+
97 95
         setIfroomId('reality')
98
-        setAllextNum(res.total)
99
-        setNewextNum(res.records.length)
96
+
100 97
         setLoading(false)
101 98
 
102 99
       })
@@ -125,34 +122,34 @@ export default (props) => {
125 122
       setParkingButtonStyle('none')
126 123
     }
127 124
   })
125
+  const geiZy = () => {
126
+    setLoading(true)
127
+    getExtendContent('room', roomId, {
128 128
 
129
-  const parkingGps = taRoomContent?.parkingLocation
130
-  const roomGps = taRoomContent?.location
131
-  useEffect(() => {
129
+    }).then((res) => {
130
+      // setExtend(res.records || [])
131
+      setExtend(res.records)
132
+      setIfroomId('reality')
133
+      setLoading(false)
132 134
 
135
+    })
136
+    setLoading(true)
137
+  }
138
+
139
+  useEffect(() => {
133 140
     if (roomId) {
134 141
       setLoading(true)
135 142
       // 点击’去这里‘跳转导航
136 143
       getTaRoom(roomId).then((res) => {
137
-        Roomlog.current = (res.location).toString().split(',')[0]
138
-        Roomlat.current = (res.location).toString().split(',')[1]
139
-        Parklog.current = (res.parkingLocation).toString().split(',')[0]
140
-        Parklat.current = (res.parkingLocation).toString().split(',')[1]
144
+        Roomlog.current = (!res.location).toString().split(',')[0]
145
+        Roomlat.current = (!res.location).toString().split(',')[1]
146
+        Parklog.current = (!res.parkingLocation).toString().split(',')[0]
147
+        Parklat.current = (!res.parkingLocation).toString().split(',')[1]
141 148
         setTaRoomContent(res || [])
142 149
         setLoading(false)
143 150
       })
144 151
       //更多指引
145
-      setLoading(true)
146
-
147
-      getExtendContent('room', roomId).then((res) => {
148
-        setExtend(res.records || [])
149
-        setIfroomId('reality')
150
-        setAllextNum(res.total)
151
-        setNewextNum(res.records.length)
152
-        setLoading(false)
153
-
154
-      })
155
-      setLoading(true)
152
+      geiZy()
156 153
 
157 154
       getRecommendList({ location: location }).then((res) => {
158 155
         setPackage(res || [])
@@ -305,11 +302,6 @@ export default (props) => {
305 302
                     <text className='title-title-boss' >更多指引</text>
306 303
                   </view>
307 304
                   {(extend || []).map((item, index) => <MoreGuide key={(index)} item={item} />)}
308
-                  {/* 
309
-                <view className='showMore' style={{ display: newextNum == AllextNum ? 'none' : '' }} onClick={extendMore}>
310
-                  <view>点击查看更多</view>
311
-                  <image src={showMore} className='moreTip' />
312
-                </view> */}
313 305
                 </view>
314 306
               </view>
315 307
             )