Mixin.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. let app = getApp();
  2. import {
  3. distanceCalculate
  4. } from "@/utils/tool.js"
  5. export default {
  6. props: {
  7. DataType: {
  8. type: Number,
  9. default: 0
  10. },
  11. loading: {
  12. type: Boolean,
  13. default: false
  14. },
  15. statusBarHeight: {
  16. type: Number,
  17. default: 0
  18. },
  19. keyWord: {
  20. type: String,
  21. default: ''
  22. },
  23. showMask: {
  24. type: Boolean,
  25. default: false
  26. },
  27. addressList: {
  28. type: Array,
  29. default: () => []
  30. },
  31. classifyList: {
  32. type: Array,
  33. default: () => []
  34. },
  35. hotClassify: {
  36. type: Array,
  37. default: () => []
  38. },
  39. classifyTree: {
  40. type: Array,
  41. default: () => []
  42. },
  43. oneClassifyIndex: {
  44. type: Number,
  45. default: 1
  46. },
  47. labelType: {
  48. type: Number,
  49. default: 0
  50. },
  51. twoClassifyIndex: {
  52. type: Number,
  53. default: null
  54. },
  55. activeClassify: {
  56. type: Object,
  57. default: null
  58. },
  59. activeDistance: {
  60. type: Object,
  61. default: null
  62. },
  63. searchType: {
  64. type: Number,
  65. default: 3
  66. },
  67. },
  68. data() {
  69. return {
  70. TouchHeight: 0,
  71. scrollMaxHeight: 0,
  72. };
  73. },
  74. beforeCreate() {},
  75. created() {
  76. },
  77. onload() {
  78. },
  79. methods: {
  80. getDistance(num) {
  81. return distanceCalculate(num)
  82. },
  83. backMyLocation() {
  84. // console.log('scale = ', this.scale)
  85. this.$refs.mapRef.moveToLocation();
  86. },
  87. setTouchHeight(val) {
  88. // console.log('setScrollHeight = ', val)
  89. // 实时返回的滑动组件高度
  90. this.TouchHeight = val;
  91. },
  92. setScrollMaxHeight(val) {
  93. //最大高度
  94. this.scrollMaxHeight = val;
  95. },
  96. getTypeName(item) {
  97. let val = this.classifyList.find(el => el.id === item.classifyId);
  98. // console.log('----', val, this.keyWord, this.activeClassify?.name)
  99. return val?.name || this.keyWord || this.activeClassify?.name || ''
  100. // return '777'
  101. },
  102. onMore() {
  103. uni.navigateTo({
  104. url: '/pages/government/map-classify',
  105. success: res => {
  106. uni.$emit('onMapNextPage')
  107. },
  108. })
  109. },
  110. // 查看详情
  111. onViewDetails(item, e) {
  112. if (!e || e.target.id !== 'goMap') {
  113. uni.navigateTo({
  114. url: '/pages/government/subNVue/mapLocationInfo',
  115. success: res => {
  116. uni.$emit('onMapNextPage')
  117. res.eventChannel.emit('MapInfo', {
  118. data: {
  119. val: item,
  120. classifyList: this.classifyList,
  121. keyWord: this.keyWord,
  122. activeClassify: this.activeClassify
  123. }
  124. })
  125. },
  126. fail: err => {
  127. console.log('跳转', err)
  128. },
  129. })
  130. }
  131. },
  132. toHere(item) {
  133. uni.openLocation({
  134. latitude: parseFloat(item.latitude), // 要去的地址经度,浮点数
  135. longitude: parseFloat(item.longitude), // 要去的地址纬度,浮点数
  136. name: item.name, // 位置名
  137. address: item.detailedAddress, // 要去的地址详情说明
  138. scale: 16, // 地图缩放级别,整形值,范围从1~28。默认为最大
  139. });
  140. },
  141. // // 搜索
  142. // onSearchFocus() {
  143. // this.DataType = 5;
  144. // setTimeout(() => {
  145. // this.showMask = true;
  146. // this.searchType = 2;
  147. // }, 10);
  148. // },
  149. // onSearchBlur() {
  150. // console.log('shiqijiaodian')
  151. // this.showMask = false;
  152. // setTimeout(() => {
  153. // this.DataType = this.oldDataType
  154. // }, 10);
  155. // console.log('shiqijiaodian', this.DataType)
  156. // }
  157. },
  158. }