|
@@ -16,7 +16,7 @@ import useSave from "@/utils/hooks/useSave"
|
16
|
16
|
import useLike from "@/utils/hooks/useLike"
|
17
|
17
|
import Cards from '@/components/foodCards/foodCards.jsx'
|
18
|
18
|
import Taro,{ useShareAppMessage } from '@tarojs/taro'
|
19
|
|
-import { getResourceList } from '@/services/home'
|
|
19
|
+import { getTouristDistance } from '@/services/home'
|
20
|
20
|
import Extend from '../components/Extend/extend'
|
21
|
21
|
import './sceneryDetails.less'
|
22
|
22
|
|
|
@@ -24,11 +24,12 @@ import './sceneryDetails.less'
|
24
|
24
|
|
25
|
25
|
export default withLayout((props) => {
|
26
|
26
|
const { router, person ,location } = props
|
27
|
|
- const { id, distance, loc } = props.router.params
|
|
27
|
+ const { id} = props.router.params
|
28
|
28
|
const [detail, setDetail] = useState({})
|
29
|
29
|
const [isSaved, toggleSave] = useSave(detail.isSaved, 'tourist', id)
|
30
|
30
|
const [isLike, toggleLike] = useLike(detail.isLike, 'tourist', id)
|
31
|
|
-
|
|
31
|
+ const [distance,setDistance]=useState()
|
|
32
|
+ const [tslocation,setTsLocation]=useState('')
|
32
|
33
|
//banner图集数组
|
33
|
34
|
const [imglist, setimglist] = useState([])
|
34
|
35
|
const [index, setIndex] = useState(0)
|
|
@@ -66,9 +67,6 @@ export default withLayout((props) => {
|
66
|
67
|
}
|
67
|
68
|
const log = useRef('')
|
68
|
69
|
const lat = useRef('')
|
69
|
|
- const [queryParams, setQueryParams] = useState({ location: location, pageNum: 1, pageSize: 10, typeId: '',targetId:id })
|
70
|
|
- const [nloction,setNLoction]=useState()
|
71
|
|
-
|
72
|
70
|
useEffect(() => {
|
73
|
71
|
getTouristDetail(id).then((res) => {
|
74
|
72
|
log.current = (res.locaton).toString().split(',')[0]
|
|
@@ -82,15 +80,14 @@ export default withLayout((props) => {
|
82
|
80
|
setAllextNum(res.total)
|
83
|
81
|
setNewextNum(res.records.length)
|
84
|
82
|
})
|
85
|
|
- getRecommendList({ location: loc }).then((res) => {
|
|
83
|
+ getTouristDistance('tourist',id,{location:location}).then((res)=>{
|
|
84
|
+ setDistance((res.distance / 1000).toFixed(2))
|
|
85
|
+ setTsLocation(res.lng + ',' + res.lat)
|
|
86
|
+ })
|
|
87
|
+ getRecommendList({ location: tslocation }).then((res) => {
|
86
|
88
|
setRecommend(res || [])
|
87
|
89
|
})
|
88
|
|
- getResourceList(queryParams).then((res)=>{
|
89
|
|
- console.log(queryParams)
|
90
|
|
- console.log(res)
|
91
|
|
- })
|
92
|
|
- }, [])
|
93
|
|
-
|
|
90
|
+ }, [])
|
94
|
91
|
// 分享
|
95
|
92
|
useShareAppMessage(()=>{
|
96
|
93
|
return {
|