index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <div class="trafficLocation">
  3. <van-cell
  4. @click="()=>openMap(item)"
  5. v-for="item in che_list"
  6. :key="item.title"
  7. :title="item.title"
  8. is-link
  9. />
  10. </div>
  11. </template>
  12. <script setup>
  13. import { ref } from 'vue';
  14. // import { onMounted, reactive } from "vue";
  15. // import { isIpad, isIpod, isIphone } from "../../utils/isTerminal";
  16. /**
  17. * window.$originData.orginParames.title 页面标题
  18. * window.$originData.orginParames.parameters 固定参数值
  19. * window.$originData.urlParames url参数
  20. */
  21. console.log(location.href.split("#")[0]);
  22. const che_list = ref([
  23. {
  24. title: '西安市车辆管理所(东区分所)',
  25. address: '陕西省西安市灞桥区东三环通塬路与金茂四路交汇处',
  26. latitude: 34.300806,
  27. longitude: 109.054953,
  28. },
  29. {
  30. title: '西安市公安局交通警察支队车辆管理所南区分所',
  31. address: '陕西省西安市雁塔区雁环路西姜欣居8号楼',
  32. latitude: 34.183556,
  33. longitude: 108.92422,
  34. },
  35. {
  36. title: '西安市车辆管理所郊县分所',
  37. address: '陕西省西安市未央区西部车城',
  38. latitude: 34.290967,
  39. longitude: 108.813974,
  40. },
  41. {
  42. title: '西安市公安局交警支队车管所郊县分所',
  43. address: '陕西省西安市未央区天台八路4号',
  44. latitude: 34.291088,
  45. longitude: 108.814097,
  46. },
  47. {
  48. title: '西安市公安局交通警察支队车辆管理所',
  49. address: '陕西省西安市雁塔区郭杜街道郭杜北街49号',
  50. latitude: 34.172279,
  51. longitude: 108.881202,
  52. },
  53. {
  54. title: '西安市公安局交警支队车辆管理所(长安分所)',
  55. address: '陕西省西安市长安区新希望产业有限公司旁(樊川路北)',
  56. latitude: 34.129907,
  57. longitude: 108.977174,
  58. },
  59. {
  60. title: '西安市公安局高陵分局交通警察大队车辆管理所',
  61. address: '陕西省西安市高陵区高交路',
  62. latitude: 34.54072,
  63. longitude: 109.098794,
  64. },
  65. {
  66. title: '西安市公安局交警支队车辆管理所西区分所',
  67. address: '陕西省西安市长安区西户路中段8号公诚二手车交易市场内',
  68. latitude: 34.254005,
  69. longitude: 108.790577,
  70. },
  71. {
  72. title: '陕西省公安厅交通警察总队车辆管理所',
  73. address: '陕西省西安市雁塔区长安南路123号',
  74. latitude: 34.190806,
  75. longitude: 108.948015,
  76. },
  77. {
  78. title: '西安市公安局鄠邑分局交通警察大队车辆管理所',
  79. address: '陕西省西安市鄠邑区庞光镇汽车客运站西邻',
  80. latitude: 34.034764,
  81. longitude: 108.673277,
  82. },
  83. {
  84. title: '周至县公安局交通警察大队车辆管理所',
  85. address: '陕西省西安市周至县万联锦绣城7号楼',
  86. latitude: 34.168437,
  87. longitude: 108.204525,
  88. },
  89. ]);
  90. function openMap(item) {
  91. if (!window.wx) return;
  92. window.wx.checkJsApi({
  93. jsApiList: ['getLocation', 'openLocation'],
  94. success: () => {
  95. //打开指定位置
  96. window.wx.openLocation({
  97. latitude: item.latitude, // 纬度,浮点数,范围为90 ~ -90
  98. longitude: item.longitude, // 经度,浮点数,范围为180 ~ -180。
  99. name: item.title, // 位置名
  100. address: item.address, // 地址详情说明
  101. scale: 18, // 地图缩放级别,整型值,范围从1~28。默认为最大
  102. infoUrl: '', // 在查看位置界面底部显示的超链接,可点击跳转
  103. });
  104. },
  105. });
  106. }
  107. </script>
  108. <style>
  109. .trafficLocation {
  110. width: 100vw;
  111. height: 100vh;
  112. }
  113. </style>