Baozhangchao 3 年之前
父節點
當前提交
f7ed3021ea
共有 2 個檔案被更改,包括 16 行新增14 行删除
  1. 13
    9
      src/components/foodCards/ShopNoteCard/index.jsx
  2. 3
    5
      src/pages/details/NoteDetails/index.jsx

+ 13
- 9
src/components/foodCards/ShopNoteCard/index.jsx 查看文件

@@ -34,12 +34,12 @@ export default (props) => {
34 34
   const [showCutover, setShowCutover] = useState(false)
35 35
   const [valueList, setValueList] = useState([])
36 36
 
37
+  const [traveCoumun, setTraveCoumun] = useState()
37 38
 
38 39
   useEffect(() => {
39
-    if (item == []) {
40
-    }
41
-    setValueList(travelMine?.records)
42 40
 
41
+    setValueList(travelMine?.records)
42
+    setTraveCoumun(travelMine?.records[0].dayNum)
43 43
 
44 44
   }, [travelMine?.records, item])
45 45
 
@@ -51,7 +51,6 @@ export default (props) => {
51 51
   }
52 52
 
53 53
   //列改变
54
-  const [traveCoumun, setTraveCoumun] = useState()
55 54
 
56 55
 
57 56
   const numberTrave = (new Array(traveCoumun).fill()).map((_, index) => ({ id: index + 1, title: `第 ${index + 1} 天` }))
@@ -62,12 +61,16 @@ export default (props) => {
62 61
   const handleColumn = e => {
63 62
     console.log("🚀 ~ file: index.jsx ~ line 63 ~ e", e)
64 63
     // console.log(e.detail.column);
65
-
66 64
     const { column, value } = e.detail
67 65
 
66
+    if (column == 0) {
67
+
68
+      const firstValue = valueList[value] || ''
69
+      setTraveCoumun(firstValue.dayNum)
70
+
71
+    }
72
+
68 73
 
69
-    const firstValue = valueList[value]
70
-    setTraveCoumun(firstValue.dayNum)
71 74
 
72 75
   }
73 76
 
@@ -77,7 +80,8 @@ export default (props) => {
77 80
   const m = day.getMonth() + 1;
78 81
   const d = day.getDate();
79 82
   let number = 0
80
-  const onChange = (e) => {
83
+
84
+  const hanleChange = (e) => {
81 85
     console.log("🚀 ~ file: index.jsx ~ line 63 ~ e", e)
82 86
 
83 87
     if (travelMine?.records == '') {
@@ -168,7 +172,7 @@ export default (props) => {
168 172
         range={array}
169 173
         range-key='title'
170 174
         onColumnChange={handleColumn}
171
-        onChange={onChange}
175
+        onChange={hanleChange}
172 176
         scrollType='link'
173 177
       // value={}
174 178
       >

+ 3
- 5
src/pages/details/NoteDetails/index.jsx 查看文件

@@ -1,6 +1,5 @@
1 1
 import CustomNav from '@/components/CustomNav'
2 2
 import ax from '@/assets/icons/housemantj/onlove.png'
3
-import dw from '@/assets/icons/housemantj/loc-o.png'
4 3
 import TextMentioned from '@/assets/icons/housemantj/TextMentioned.png'
5 4
 import NoteasICO from '@/assets/icons/housemantj/NoteasICO.png'
6 5
 
@@ -8,17 +7,16 @@ import share from '@/assets/icons/housemantj/touristShare.png'
8 7
 import good from '@/assets/icons/housemantj/touristGood.png'
9 8
 import baozan from '@/assets/icons/housemantj/bgood.png'
10 9
 import weibaozan from '@/assets/icons/housemantj/unLike.png'
11
-import zhuandao from "@/assets/icons/housemantj/backTop.png";
12 10
 import withLayout from '@/layouts'
13 11
 import SpinBox from "@/components/Spin/SpinBox";
14
-import { getNoteList, getNoteID } from '@/services/note'
12
+import { getNoteID } from '@/services/note'
15 13
 import { getTravelMine } from '@/services/travel'
16 14
 
17 15
 import TabIcon from '@/components/HorTabbar/TabIcon'
18 16
 import { useState, useEffect } from 'react'
19
-import { getTouristDetail, getExtendContent, getRecommendList } from '@/services/home'
17
+import { getExtendContent } from '@/services/home'
20 18
 import logo from "@/assets/icons/UserCenter/laba.png"
21
-import { Swiper, SwiperItem, Button, View, Ad, Video } from '@tarojs/components';
19
+import { Button, View, Video } from '@tarojs/components';
22 20
 import useSave from "@/utils/hooks/useSave"
23 21
 import useLike from "@/utils/hooks/useLike"
24 22
 import ShopNoteCard from '@/components/foodCards/ShopNoteCard/index'