SelectMapNavigation.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <uni-popup ref="SelectMap" :isMaskClick='true' type="bottom" border-radius="10px 10px 0 0"
  3. maskBackgroundColor='rgba(0, 0, 0, 0.1)'>
  4. <view class="map-list">
  5. <view class="title">请选择地图</view>
  6. <view class="map-item" @click.stop="goNavigation(item.value)" v-for="item in MapTypeList">
  7. {{item.label}}
  8. </view>
  9. <view class="map-item cancel">
  10. 取消
  11. </view>
  12. </view>
  13. </uni-popup>
  14. </template>
  15. <script>
  16. import { MapTypeList } from "@/utils/openApp.js"
  17. import { openMap } from "@/utils/openApp.js"
  18. export default {
  19. data() {
  20. return {
  21. MapTypeList,
  22. siteInfo: undefined
  23. };
  24. },
  25. mounted() {
  26. // setTimeout(() => {
  27. // this.open()
  28. // }, 1000)
  29. },
  30. methods: {
  31. open(info) {
  32. this.siteInfo = info;
  33. this.$refs.SelectMap.open()
  34. },
  35. goNavigation(type) {
  36. const { areaCode, cityCode, provinceCode, provinceName, cityName, areaName, address } = this.siteInfo
  37. const name = `${provinceName}${cityName}${areaName}${address}`;
  38. const code = areaCode || cityCode || provinceCode
  39. openMap({ name, code, type, info: this.siteInfo })
  40. this.$refs.SelectMap.close()
  41. }
  42. }
  43. }
  44. </script>
  45. <style lang="scss" scoped>
  46. .map-list {
  47. width: 100%;
  48. // height: 30vh;
  49. background-color: #fff;
  50. border-radius: 20rpx 20rpx 0 0;
  51. text-align: center;
  52. .title {
  53. width: 100%;
  54. text-align: center;
  55. padding: 30rpx 20rpx 50rpx 20rpx;
  56. font-size: 28rpx;
  57. }
  58. .map-item {
  59. width: 100%;
  60. padding: 30rpx 20rpx;
  61. }
  62. .cancel {
  63. padding: 50rpx 30rpx;
  64. }
  65. }
  66. </style>