map.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. import {
  2. imgUrl
  3. } from "../api/request"
  4. var bmap = require('../../libs/bmap-wx.min.js');
  5. var wxMarkerData = [];
  6. const popType = [
  7. [
  8. ["受理场所", "查阅场所", ],
  9. ["区级政务服务中心", "镇(街道)便民服务中心", "村(社区)便民服务站", "生源地助学贷款办理点"],
  10. ["党群服务中心"],
  11. []
  12. ],
  13. [
  14. ["职业教育学校", "特殊教育学校", "高等院校", "小学", "中学", "幼儿园", "教育考试中心"],
  15. ["村卫生室", "社区卫生服务站", "儿科诊疗服务机构", "狂犬病、破伤风处置门诊", "免疫规划预防接种门诊", "二级医疗机构", "三级医疗机构", "社区卫生服务机构", "职业病诊断机构", "助产医疗机构", "产科门诊服务机构", "医疗保障事务中心", "核酸采样点"],
  16. ["派出所", "出入境业务办理机构"],
  17. ["交通支大队", "交通违法处理机构", "交通事故处理机构", "车管所", "机动车检测场所", "驾驶人体检医院", "车驾管社会服务站"]
  18. ],
  19. [
  20. ["就业和人才中心", "社会保险事务中心"],
  21. ["养老机构"],
  22. ["婚姻登记机构", "殡仪服务机构"],
  23. [],
  24. []
  25. ],
  26. [
  27. [],
  28. [],
  29. [],
  30. []
  31. ],
  32. [
  33. ["图书馆", "文化馆", "文管所", "公共体育馆", "旅游景点", "公园"],
  34. ["公证处", "司法鉴定机构", "基层司法所", "法律援助机构", "矫正中心"],
  35. ["残疾人服务中心", "定点残疾人服务机构"],
  36. []
  37. ],
  38. [
  39. ["商圈", "购物中心", "酒店"],
  40. [],
  41. []
  42. ]
  43. ]
  44. Page({
  45. data: {
  46. imgUrl: imgUrl,
  47. markers: [],
  48. latitude: '',
  49. longitude: '',
  50. type:[
  51. [{"id":1,"name":"政务公开","image":imgUrl+"fgk.png"},{"id":2,"name":"政务服务","image":imgUrl+"fzwfw.png"},{"id":3,"name":"党群服务","image":imgUrl+"fdqfwzx.png"},{"id":4,"name":"核酸检测","image":imgUrl+"fhsjc.png"}],
  52. [{"id":1,"name":"教育资源","image":imgUrl+"fjy.png"},{"id":2,"name":"医疗卫生","image":imgUrl+"fyl.png"},{"id":3,"name":"户籍管理","image":imgUrl+"fhjgl.png"},{"id":4,"name":"交通服务","image":imgUrl+"fjtfw.png"}],
  53. [{"id":1,"name":"社会保障","image":imgUrl+"fshbz.png"},{"id":2,"name":"养老服务","image":imgUrl+"fylfw.png"},{"id":3,"name":"民政服务","image":imgUrl+"fmzfw.png"},{"id":4,"name":"办税服务","image":imgUrl+"fbsfwt.png"}],
  54. [{"id":1,"name":"市场监管","image":imgUrl+"fscjd.png"},{"id":2,"name":"住房保障","image":imgUrl+"fgzf.png"},{"id":3,"name":"不动产登记","image":imgUrl+"fbdcdj.png"},{"id":4,"name":"住房公积金","image":imgUrl+"fgjj.png"}],
  55. [{"id":1,"name":"文体旅游","image":imgUrl+"fwtly.png"},{"id":2,"name":"司法服务","image":imgUrl+"fsffw.png"},{"id":3,"name":"助疾服务","image":imgUrl+"fcjr.png"},{"id":4,"name":"产业园区","image":imgUrl+"fcyy.png"}],
  56. [{"id":1,"name":"商业服务","image":imgUrl+"fbmfw.png"},{"id":2,"name":"便民公厕","image":imgUrl+"fgc.png"},{"id":3,"name":"停车泊车","image":imgUrl+"ftc.png"}]
  57. ],
  58. popData:[],
  59. showIndex: false,
  60. showTraffic: true,
  61. height: 0,
  62. searchVal: '',
  63. trafficStart: '',
  64. trafficEnd: '',
  65. navigateArr: ['百度地图导航', '高德地图导航'],
  66. showSection: true,
  67. index: 0,
  68. isList:true,
  69. showSet:false
  70. },
  71. onLoad: function () {
  72. var that = this;
  73. var BMap = new bmap.BMapWX({
  74. ak: 'QCc4aj8erQKVSfREHsbOLEDu3htQrNQU'
  75. });
  76. var fail = function (data) {
  77. console.log(data)
  78. };
  79. var success = function (data) {
  80. wxMarkerData = data.wxMarkerData;
  81. that.setData({
  82. markers: wxMarkerData
  83. });
  84. that.setData({
  85. latitude: wxMarkerData[0].latitude
  86. });
  87. that.setData({
  88. longitude: wxMarkerData[0].longitude
  89. });
  90. }
  91. this.setData({
  92. height: wx.getSystemInfoSync().windowHeight
  93. })
  94. BMap.geocoding({
  95. address: '重庆市',
  96. fail: fail,
  97. success: success
  98. });
  99. },
  100. popview(e){
  101. let x = e.currentTarget.dataset.index;
  102. let y = e.currentTarget.dataset.id;
  103. let pop = popType[x][y-1]
  104. if(pop.length>0){
  105. this.setData({
  106. popData:pop,
  107. showIndex:true
  108. });
  109. console.log(this.data.popData);
  110. }else{
  111. // 跳转逻辑
  112. }
  113. },
  114. closePopup(){
  115. this.setData({
  116. showIndex:false
  117. })
  118. },
  119. changeInfo(e){
  120. console.log(e.currentTarget.dataset.name);
  121. },
  122. // 电话拨打
  123. callNumber(e){
  124. },
  125. // list跳转info
  126. changeItem(e){
  127. let value = e.currentTarget.dataset.value;
  128. if (value==="none"){
  129. this.setData({
  130. isList:false
  131. })
  132. }else{
  133. this.setData({
  134. isList:false,
  135. showSet:true
  136. })
  137. }
  138. },
  139. getSearchVal(e) {
  140. this.setData({
  141. searchVal: e.detail.value
  142. });
  143. },
  144. searchTap(e) {
  145. const that = this;
  146. let searchVal = this.data.searchVal;
  147. if (!searchVal) {
  148. wx.showToast({
  149. title: '搜索的内容不能为空',
  150. icon: 'none'
  151. })
  152. return;
  153. }
  154. console.info(searchVal)
  155. // 搜索结果
  156. that.setData({
  157. showTraffic: false
  158. });
  159. },
  160. getTrafficStart(e) {
  161. this.setData({
  162. trafficStart: e.detail.value
  163. });
  164. },
  165. getTrafficEnd(e) {
  166. this.setData({
  167. trafficEnd: e.detail.value
  168. });
  169. },
  170. searchTrafficTap(e) {
  171. const that = this;
  172. let trafficStart = this.data.trafficStart;
  173. let trafficEnd = this.data.trafficEnd;
  174. if (!trafficStart || !trafficEnd) {
  175. that.setData({
  176. showSection: true
  177. });
  178. wx.showToast({
  179. title: '请输入起点和终点',
  180. icon: 'none'
  181. });
  182. return;
  183. } else {
  184. that.setData({
  185. showSection: false
  186. });
  187. }
  188. console.info(trafficStart, trafficEnd);
  189. },
  190. bindPickerChange(e){
  191. console.info(e)
  192. },
  193. backSearch(){
  194. if(!this.data.isList){
  195. this.setData({
  196. isList:true,
  197. showSet:false
  198. })
  199. }else{
  200. if(!this.data.showTraffic){
  201. this.setData({
  202. showTraffic:true
  203. })
  204. }
  205. }
  206. }
  207. })