Baozhangchao 3 yıl önce
ebeveyn
işleme
1b758785c6

BIN
src/assets/icons/UserCenter/laba.png Dosyayı Görüntüle


BIN
src/assets/icons/housemantj/NoteasICO.png Dosyayı Görüntüle


BIN
src/assets/icons/housemantj/TextMentioned.png Dosyayı Görüntüle


+ 9
- 0
src/pages/details/NoteDetails/index.config.js Dosyayı Görüntüle

@@ -0,0 +1,9 @@
1
+export default {
2
+  navigationBarTitleText: '笔记详情',
3
+  disableScroll: true,
4
+  navigationStyle: 'custom',
5
+  usingComponents: {
6
+    // "add-tipsFood": "../../../components/add-tipsFood/index"
7
+
8
+  }
9
+}

+ 199
- 0
src/pages/details/NoteDetails/index.jsx Dosyayı Görüntüle

@@ -0,0 +1,199 @@
1
+import CustomNav from '@/components/CustomNav'
2
+import ax from '@/assets/icons/housemantj/onlove.png'
3
+import dw from '@/assets/icons/housemantj/loc-o.png'
4
+import TextMentioned from '@/assets/icons/housemantj/TextMentioned.png'
5
+import NoteasICO from '@/assets/icons/housemantj/NoteasICO.png'
6
+import { compressImage } from '@/utils'
7
+import MoreGuide from "@/components/MoreGuide";//视频
8
+
9
+import share from '@/assets/icons/housemantj/touristShare.png'
10
+import good from '@/assets/icons/housemantj/touristGood.png'
11
+import baozan from '@/assets/icons/housemantj/bgood.png'
12
+import weibaozan from '@/assets/icons/housemantj/unLike.png'
13
+import zhuandao from "@/assets/icons/housemantj/backTop.png";
14
+import withLayout from '@/layouts'
15
+import SpinBox from "@/components/Spin/SpinBox";
16
+import TabIcon from '@/components/HorTabbar/TabIcon'
17
+import { useState, useEffect } from 'react'
18
+import { getTouristDetail, getExtendContent, getRecommendList } from '@/services/home'
19
+import logo from "@/assets/icons/UserCenter/laba.png"
20
+import { Swiper, SwiperItem, Button, View, Ad } from '@tarojs/components';
21
+import useSave from "@/utils/hooks/useSave"
22
+import useLike from "@/utils/hooks/useLike"
23
+import Cards from '@/components/foodCards/foodCards.jsx'
24
+import Taro, { useShareAppMessage } from '@tarojs/taro'
25
+import Extend from '../components/Extend/extend'
26
+import './index.less'
27
+
28
+
29
+
30
+export default withLayout((props) => {
31
+  const { router, person, location } = props
32
+  const { id } = props.router.params
33
+  const [detail, setDetail] = useState({})
34
+  const [isSaved, toggleSave] = useSave(detail.isSaved, 'tourist', id)
35
+  const [isLike, toggleLike] = useLike(detail.isLike, 'tourist', id)
36
+  const [loading, setLoading] = useState(false)
37
+
38
+  //banner图集数组
39
+  const [imglist, setimglist] = useState([])
40
+  const [index, setIndex] = useState(0)
41
+  const handchange = (e) => {
42
+    setIndex(e.detail.current)
43
+  }
44
+
45
+  //本店指南
46
+  const [extend, setExtend] = useState([])
47
+
48
+  // 推荐套餐列表
49
+  const [recommend, setRecommend] = useState([])
50
+
51
+  const openMap = () => {
52
+    const [lng, lat] = detail.locaton.split(',')
53
+
54
+    Taro.openLocation({
55
+      longitude: lng - 0,
56
+      latitude: lat - 0,
57
+      name: detail.touristName,
58
+      address: detail.address,
59
+      scale: 12,
60
+    })
61
+  }
62
+  //引导显隐
63
+  const [guidance, setGuidance] = useState('shareOff')
64
+  useEffect(() => {
65
+    if (router.params.enterType === "share") {
66
+      setGuidance('shareOn')
67
+    }
68
+  }, [router.params.enterType])
69
+
70
+
71
+  useEffect(() => {
72
+    if (id) {
73
+      setLoading(true)
74
+      getTouristDetail(id, { location }).then((res) => {
75
+        setDetail(res)
76
+        setimglist(res.imageList || [])
77
+        getRecommendList({ location: res.locaton }).then((res2) => {
78
+          setRecommend(res2 || [])
79
+        })
80
+      })
81
+      getExtendContent('tourist', id, { pageSize: 500 }).then((res) => {
82
+        setExtend(res.records || [])
83
+        setLoading(false)
84
+
85
+      })
86
+    } else {
87
+      getRecommendList({ location }).then((res2) => {
88
+        setRecommend(res2 || [])
89
+        setLoading(false)
90
+      }).catch(e => {
91
+        setLoading(false)
92
+      })
93
+    }
94
+  }, [id, location])
95
+  // 分享
96
+  useShareAppMessage(() => {
97
+    return {
98
+      title: detail.touristName,
99
+      path: `/pages/details/mjDetails/sceneryDetails?id=${id}&enterType=share`,
100
+      imageUrl: detail.poster,
101
+    }
102
+
103
+  })
104
+  return (
105
+    <view className='page-index'>
106
+      {
107
+        guidance === 'shareOn' ? <view className='index-navbar'>
108
+          <add-tipsFood logo={logo} custom duration={-1} />
109
+          <CustomNav title='十公里' noback />
110
+        </view> :
111
+          <view className='index-navbar'>
112
+            <CustomNav title='十公里' />
113
+          </view>
114
+      }
115
+
116
+
117
+      <SpinBox loading={loading} className='index-container' style={{ padding: '0 30rpx', background: '#F8F8F8' }}>
118
+        <scroll-view scrollY style={{ height: '100%' }}>
119
+          <view className='storeDetails'>
120
+            <View className='huadong'>
121
+              <Swiper
122
+                className='swiper'
123
+                circular
124
+                onChange={handchange}
125
+              >
126
+                {
127
+                  imglist.map((item, key) => (
128
+                    item.noteType == 'image' ?
129
+                      <SwiperItem key={key}>
130
+                        <image src={compressImage(item.url)} mode='aspectFit' className='storeImage' />
131
+                      </SwiperItem> : <MoreGuide key={key} item={item} />
132
+                  ))}
133
+              </Swiper>
134
+              <view className='tpPage'>
135
+                <text>
136
+                  {index + 1}/{imglist.length}
137
+                </text>
138
+              </view>
139
+            </View>
140
+
141
+            <view className='storeJs'>
142
+              <view className='introduce'>
143
+                <text className='storeName'>{detail.touristName}</text>
144
+              </view>
145
+              <view className='bz'>
146
+                <image src={baozan} style={{ width: '15px', height: '15px', marginRight: '10px', marginBottom: '-2px' }} />
147
+                <text className='bzRight'>爆赞{detail.likeNum}</text>
148
+              </view>
149
+              <view className='wz'>{detail.address}</view>
150
+              <view className='dpPosition' onClick={openMap}>
151
+                <image src={dw} className='dwTip' />
152
+                <view className='distance'>{(detail.distance / 1000).toFixed(2)}公里<image src={zhuandao} className='zhuandao' /></view>
153
+              </view>
154
+            </view>
155
+          </view>
156
+          <view className='jdjs'>
157
+            <view>{detail.description}</view>
158
+            <view className='line'></view>
159
+            <view className='sc' onClick={toggleSave}>
160
+              <image className='scTip' src={isSaved > 0 ? ax : good} /><text>{isSaved > 0 ? '已收藏' : '加入收藏'}</text>
161
+            </view>
162
+          </view>
163
+          <view class='adContainer'>
164
+            <Ad unit-id='adunit-a0f97bb7ec8ec7bb' ad-intervals='30' />
165
+          </view>
166
+          <view style={{ position: 'relative', display: extend == '' ? 'none' : '' }}>
167
+            <view className='title'>
168
+              <image src={NoteasICO} />笔记详情
169
+            </view>
170
+            <View style={{ background: '#FFF' }}>
171
+              {(extend || []).map((item) => <Extend item={item} />)}
172
+            </View>
173
+          </view>
174
+          <view style={{ display: recommend == '' ? 'none' : '' }}>
175
+            <view className='title'>
176
+              <image src={TextMentioned} />文中提及
177
+            </view>
178
+            {(recommend || []).map((item) => <Cards item={item} det={item} st={parseFloat(item.score.toFixed(1))} />)}
179
+          </view>
180
+          <view className='botton'>这是我的底线</view>
181
+        </scroll-view>
182
+      </SpinBox>
183
+
184
+      <view className='index-tabber weui-tabbar' style={{ background: '#fff' }}>
185
+        <view className='weui-tabbar__item'>
186
+          <Button openType='share' className='purebtn'><TabIcon icon={share} text='分享' /></Button>
187
+        </view>
188
+        <view className='weui-tabbar__item' onClick={toggleLike}>
189
+          <TabIcon icon={isLike > 0 ? baozan : weibaozan} text={isLike > 0 ? "已爆赞" : "爆赞"} />
190
+        </view>
191
+        <view className='weui-tabbar__item' onClick={toggleSave}>
192
+          <TabIcon icon={isSaved > 0 ? ax : good} text={isSaved > 0 ? "已收藏" : "加入收藏"} />
193
+        </view>
194
+      </view>
195
+    </view>
196
+  )
197
+})
198
+
199
+

+ 134
- 0
src/pages/details/NoteDetails/index.less Dosyayı Görüntüle

@@ -0,0 +1,134 @@
1
+.storeDetails {
2
+  background-color: #fff;
3
+  border-radius: 12px;
4
+  margin-bottom: 20px;
5
+  .huadong {
6
+    position: relative;
7
+    .swiper {
8
+      height: calc((100vw - 60px) * 0.6);
9
+      .storeImage {
10
+        border-radius: 22px;
11
+        width: 100%;
12
+        height: 100%;
13
+      }
14
+    }
15
+    .tpPage {
16
+      position: absolute;
17
+      right: 20px;
18
+      bottom: 20px;
19
+      background: #000000;
20
+      border-radius: 16px;
21
+      font-size: 24px;
22
+      color: #ffffff;
23
+      padding: 0 7px;
24
+      opacity: 0.4;
25
+      line-height: 32px;
26
+      padding: 7px 8px 8px 7px;
27
+      text {
28
+        opacity: 0.64;
29
+      }
30
+    }
31
+  }
32
+  .storeJs {
33
+    padding: 22px;
34
+    .introduce {
35
+      display: inline-block;
36
+      .storeName {
37
+        font-size: 32px;
38
+        font-weight: bold;
39
+        color: #020200;
40
+      }
41
+    }
42
+    .bz {
43
+      float: right;
44
+      .bzRight {
45
+        font-size: 24px;
46
+        color: #202020;
47
+        line-height: 34px;
48
+        height: 23px;
49
+      }
50
+    }
51
+    .wz {
52
+      font-size: 24px;
53
+      padding: 30rpx 0 32rpx 0;
54
+      font-weight: bold;
55
+      color: #404040;
56
+    }
57
+    .dpPosition {
58
+      position: relative;
59
+      .dwTip {
60
+        width: 48px;
61
+        height: 48px;
62
+        top: -8px;
63
+        left: -8px;
64
+        position: absolute;
65
+      }
66
+      .distance {
67
+        padding-left: 38px;
68
+        font-size: 24px;
69
+        color: #c0c8d3;
70
+        .zhuandao {
71
+          width: 14px;
72
+          height: 24px;
73
+          transform: rotate(180deg);
74
+          position: relative;
75
+          left: 8px;
76
+          top: 5px;
77
+        }
78
+      }
79
+    }
80
+  }
81
+}
82
+.jdjs {
83
+  background: #fff;
84
+  border-radius: 12px 12px 0px 0px;
85
+  padding: 30px 20px 43px 20px;
86
+  text-align: justify;
87
+  font-size: 24px;
88
+  font-weight: bold;
89
+  color: #202020;
90
+  line-height: 54px;
91
+  overflow: hidden;
92
+  margin-bottom: 20px;
93
+  .line {
94
+    height: 1px;
95
+    background: #000;
96
+    opacity: 0.1;
97
+    margin: 57px 0 42px 0;
98
+  }
99
+  .sc {
100
+    font-size: 20px;
101
+    font-weight: bold;
102
+    color: #333;
103
+    float: right;
104
+    line-height: 0;
105
+    margin-right: 4px;
106
+    .scTip {
107
+      width: 20px;
108
+      height: 20px;
109
+      margin-right: 8px;
110
+    }
111
+  }
112
+}
113
+.title {
114
+  margin: 40px 0 40px 0;
115
+  font-size: 34px;
116
+  font-weight: bold;
117
+  color: #202020;
118
+  display: flex;
119
+  align-items: center;
120
+  image {
121
+    width: 35px;
122
+    height: 35px;
123
+    margin-right: 10px;
124
+  }
125
+}
126
+
127
+.botton {
128
+  font-size: 28px;
129
+  color: #c0c8d3;
130
+  line-height: 34px;
131
+  text-align: center;
132
+  padding: 40px 0;
133
+  background-color: #f8f8f8;
134
+}