景徳镇旅游微信小程序
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.

129 lines
2.9 KiB

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