my-popup-map.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <uni-popup ref="popup" type="bottom" :mask-click="false" maskBackgroundColor="rgba(0, 0, 0, 0.6)">
  3. <view class="uni-popup-share">
  4. <view class="uni-share-title"><text class="uni-share-title-text">{{shareTitleText}}</text></view>
  5. <view class="uni-share-content">
  6. <view class="uni-share-content-box">
  7. <view class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index"
  8. @click.stop="select(item,index)">
  9. <image class="uni-share-image" :src="item.icon" mode="aspectFill"></image>
  10. <text class="uni-share-text">{{item.text}}</text>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="uni-share-button-box">
  15. <button class="uni-share-button" @click="popupClose">{{cancelText}}</button>
  16. </view>
  17. </view>
  18. </uni-popup>
  19. </template>
  20. <script>
  21. import { openNavigation } from '../../common/openmap';
  22. export default {
  23. name: 'UniPopupShare',
  24. emits: ['select'],
  25. props: {
  26. title: {
  27. type: String,
  28. default: ""
  29. },
  30. point: {
  31. longitude: "",
  32. latitude: "",
  33. name: "",
  34. }
  35. },
  36. data() {
  37. return {
  38. bottomData: [{
  39. id: 1,
  40. text: '高德地图',
  41. icon: '/static/logo/map_gaode.png',
  42. },
  43. {
  44. id: 2,
  45. text: '百度地图',
  46. icon: '/static/logo/map_baidu.png',
  47. },
  48. {
  49. id: 3,
  50. text: '腾讯地图',
  51. icon: '/static/logo/map_tengxun.png',
  52. },
  53. ]
  54. }
  55. },
  56. created() {},
  57. computed: {
  58. cancelText() {
  59. return "取消"
  60. },
  61. shareTitleText() {
  62. return this.title || "请选择"
  63. }
  64. },
  65. methods: {
  66. popupOpen() {
  67. this.$refs.popup.open()
  68. },
  69. popupClose() {
  70. this.$refs.popup.close()
  71. // this.$emit('popup-close');
  72. },
  73. /**
  74. * 选择内容
  75. */
  76. select(item, index) {
  77. // this.$emit('select', {
  78. // item,
  79. // index
  80. // })
  81. openNavigation(item.id, this.point.longitude, this.point.latitude, this.point.name);
  82. this.popupClose()
  83. },
  84. }
  85. }
  86. </script>
  87. <style lang="scss" scoped>
  88. .uni-popup-share {
  89. background-color: #fff;
  90. border-top-left-radius: 11px;
  91. border-top-right-radius: 11px;
  92. }
  93. .uni-share-title {
  94. /* #ifndef APP-NVUE */
  95. display: flex;
  96. /* #endif */
  97. flex-direction: row;
  98. align-items: flex-end;
  99. justify-content: center;
  100. height: 40px;
  101. }
  102. .uni-share-title-text {
  103. font-size: 14px;
  104. color: #666;
  105. }
  106. .uni-share-content {
  107. /* #ifndef APP-NVUE */
  108. display: flex;
  109. /* #endif */
  110. flex-direction: row;
  111. justify-content: center;
  112. // align-items: center;
  113. padding-top: 10px;
  114. }
  115. .uni-share-content-box {
  116. /* #ifndef APP-NVUE */
  117. display: flex;
  118. /* #endif */
  119. flex-direction: row;
  120. flex-wrap: wrap;
  121. justify-content: center;
  122. width: 90vw;
  123. }
  124. .uni-share-content-item {
  125. width: 90px;
  126. /* #ifndef APP-NVUE */
  127. display: flex;
  128. /* #endif */
  129. flex-direction: column;
  130. justify-content: center;
  131. padding: 10px 0;
  132. align-items: center;
  133. }
  134. .uni-share-content-item:active {
  135. background-color: #f5f5f5;
  136. }
  137. .uni-share-image {
  138. width: 50px;
  139. height: 50px;
  140. border: 1px solid;
  141. border-color: darkgray;
  142. border-radius: 5px
  143. }
  144. .uni-share-text {
  145. margin-top: 10px;
  146. font-size: 14px;
  147. color: #3B4144;
  148. }
  149. .uni-share-button-box {
  150. /* #ifndef APP-NVUE */
  151. display: flex;
  152. /* #endif */
  153. flex-direction: row;
  154. padding: 10px 25px;
  155. }
  156. .uni-share-button {
  157. flex: 1;
  158. border-radius: 50px;
  159. color: #666;
  160. font-size: 16px;
  161. }
  162. .uni-share-button::after {
  163. border-radius: 50px;
  164. }
  165. </style>