index.jsx 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import { useEffect, useState } from "react"
  2. import { Map, View, Image, Text } from "@tarojs/components"
  3. import CustomNav from "@/components/CustomNav"
  4. import ButtontWX from "@/components/ButtontWX"
  5. import Taro from "@tarojs/taro"
  6. import locationImage from "@/assets/icons/comm/locationImage.png"
  7. import addresss from '@/assets/mineImgaes/addresss.png'//地址
  8. import './style.less'
  9. export default (props) => {
  10. const $instance = Taro.getCurrentInstance()
  11. const [mapLoca, setMapLoca] = useState('')
  12. Taro.getStorage({
  13. key: 'location',
  14. success: function (res) {
  15. setMapLoca(res.data)
  16. }
  17. })
  18. const LocationMap = mapLoca.split(",")
  19. console.log("🚀 ~ file: index.jsx ~ line 25 ~ LocationMap", LocationMap)
  20. useEffect(() => {
  21. console.log($instance.router.params)
  22. }, [])
  23. const startReserve = () => {
  24. Taro.navigateTo({ url: `/pages/OrderInfo/index?id${1}` })
  25. }
  26. const markers = [{ // 绘制浮标,传入JSON支持多个
  27. iconPath: locationImage,
  28. id: 0,
  29. latitude: LocationMap[0],// 经度
  30. longitude: LocationMap[1],//纬度
  31. width: 50, // 浮标宽度
  32. height: 50 // 浮标高度
  33. }]
  34. return (
  35. <View className='page-index'>
  36. <View className='index-navbar'>
  37. <CustomNav title='查看地图' />
  38. </View>
  39. <scroll-view scrollY style='height: 100%;' >
  40. <View className='MapBox-centent'>
  41. <Map
  42. id='map'
  43. longitude='112.092169'
  44. latitude='32.694883'
  45. scale='12'
  46. markers={markers}
  47. bindmarkertap='markertap'
  48. style='width:100%;height:35vh;'
  49. >
  50. </Map>
  51. <View className='MapBox-centent-BodyArticle'>
  52. <Image style={{ width: '100%', borderRadius: '20px 20px 0px 0px' }} src='http://img3.jc001.cn/img/001/1/1512/15566fd0311736f.jpg' />
  53. <View className='CarsContent-TextBox'>
  54. <View className='CheckDetails-bottom-box-flaxBox-liftText'>
  55. <View className='CheckDetails-bottom-box-flaxBox-liftText-Titles'>不知家收割机</View>
  56. <View className='CheckDetails-bottom-box-flaxBox-liftText-price'>2188/<Text>公顷</Text></View>
  57. </View>
  58. <View className='content-header-box-map-Info'>
  59. <View className='content-header-box-map-Info-liftCentent'>
  60. <Image src={addresss} />
  61. <View>距离当前位置8.8公里&gt;&gt;</View>
  62. </View>
  63. </View>
  64. <View className='content-header-box-map-Info-carsName'>农机手小李的收割机</View>
  65. <View className='startReserve-centent'>
  66. {/* <View className='articleTitle-box-Details'>
  67. <Image src={decorate} />
  68. <View>作业详情</View>
  69. <Image src={decorate} />
  70. </View> */}
  71. <View className='startReserve-Bottom'>
  72. <ButtontWX butText='预约' onClick={startReserve} butWidth={300} butHeight={49} butFontSize={16} butBorderRadius={49} />
  73. </View>
  74. </View>
  75. </View>
  76. </View>
  77. </View>
  78. </scroll-view>
  79. </View>
  80. )
  81. }