景徳镇旅游微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
2.8 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. <template>
  2. <view class="page">
  3. <!-- <map
  4. style="width: 100%;height: 700rpx"
  5. :layer-style='5'
  6. :show-location='true'
  7. :latitude="latitude"
  8. :longitude="longitude"
  9. :markers="markers"
  10. :scale="scale"
  11. @markertap="markertap"
  12. @callouttap='callouttap'>
  13. </map> -->
  14. <locations
  15. :spotGuide="spotGuide"
  16. :spotGuideMarkers="spotGuideMarkers"
  17. :area="area"
  18. />
  19. <tabber select="1"/>
  20. </view>
  21. </template>
  22. <script>
  23. import position from '@/utils/position.js'
  24. import locations from '@/components/tourGuide/locations.vue'
  25. import { mapState, mapGetters } from 'vuex'
  26. export default {
  27. components : {
  28. locations,
  29. },
  30. data() {
  31. return {
  32. // latitude: 23.106574, //纬度
  33. // longitude: 113.324587, //经度
  34. // scale: 12, //缩放级别
  35. // bottomData: false,
  36. // mapCtx: null,
  37. // markers:[
  38. // // { //标记点A 的信息
  39. // // iconPath: "/static/logo.png", //图标
  40. // // id: 0,
  41. // // width: 20, //图标icon 宽度
  42. // // height: 28 ,//图标icon 高度
  43. // // latitude: 26.1272,
  44. // // longitude: 113.11659
  45. // // }
  46. // ],
  47. area : [],
  48. }
  49. },
  50. onLoad(args) {
  51. if(args.areaId){
  52. this.$store.commit('setAreaId', args.areaId)
  53. }else{
  54. this.$store.commit('setAreaId', this.spotList[0].areaId)
  55. }
  56. },
  57. onShow(){
  58. },
  59. computed: {
  60. ...mapGetters(['spotGuide', 'spotGuideMarkers']),
  61. ...mapState(['areaId', 'spotList']),
  62. },
  63. onShow() {
  64. // this.mapCtx = wx.createMapContext('map');
  65. // this.mapCtx && this.mapCtx.addCustomLayer({
  66. // layerId: '66c5a2ad2849',
  67. // success: (res) => {
  68. // console.log('success', res);
  69. // },
  70. // fail: (e) => {
  71. // console.log('fail', e);
  72. // },
  73. // });
  74. this.queryAreaListById()
  75. },
  76. methods: {
  77. queryAreaListById(){
  78. this.$api('queryAreaListById', {
  79. areaId : this.areaId
  80. }, res => {
  81. if(res.code == 200){
  82. this.area = res.result
  83. }
  84. })
  85. },
  86. //地图点击事件
  87. markertap(e) {
  88. console.log("===你点击了标记点===", e)
  89. this.markers.forEach(n => {
  90. if(n.id == e.detail.markerId){
  91. uni.openLocation({
  92. latitude: n.latitude,
  93. longitude: n.longitude,
  94. })
  95. }
  96. })
  97. },
  98. //地图点击事件
  99. callouttap(e) {
  100. console.log('地图点击事件', e)
  101. },
  102. random(){
  103. let list = []
  104. for(let i = 0;i < 10;i++){
  105. let a = uni.$uv.random(1, 4)
  106. let obj = {
  107. latitude: this.latitude + uni.$uv.random(1, 30) / 1000 * (uni.$uv.random(1, 3) - 2),
  108. longitude: this.longitude + uni.$uv.random(1, 30) / 1000 * (uni.$uv.random(1, 3) - 2),
  109. width: 20, //图标icon 宽度
  110. height: 28 ,//图标icon 高度
  111. iconPath: `/static/image/tourGuide/${a}.png`, //图标
  112. id: i,
  113. }
  114. list.push(obj)
  115. }
  116. this.markers = list
  117. },
  118. }
  119. }
  120. </script>
  121. <style scoped lang="scss">
  122. .page{
  123. }
  124. </style>