map.js 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603
  1. import {
  2. imgUrl,
  3. newImgUrl
  4. } from "../api/request"
  5. import {
  6. getMapDataType,
  7. getHandMatterPage,
  8. getHandMatterBySearch,
  9. getMapDataAll,
  10. searchHandMatterByVal
  11. } from "../api/yxna-api"
  12. var QQMapWX = require('../../libs/qqmap-wx-jssdk.min.js');
  13. const popType = [
  14. [
  15. [{
  16. "name": "受理场所",
  17. "dictType": "jzs,bms",
  18. "type": ""
  19. }, {
  20. "name": "查阅场所",
  21. "dictType": "cycsbms,slcsjzs",
  22. "type": ""
  23. }, ],
  24. [{
  25. "name": "区级政务服务中心",
  26. "dictType": "xzfwzxs",
  27. "type": ""
  28. }, {
  29. "name": "镇(街道)便民服务中心",
  30. "dictType": "ggfwzxs",
  31. "type": ""
  32. }, {
  33. "name": "村(社区)便民服务站",
  34. "dictType": "bmfwzxs",
  35. "type": ""
  36. }, {
  37. "name": "生源地助学贷款办理点",
  38. "dictType": "dkblds",
  39. "type": ""
  40. }],
  41. [{
  42. "name": "党群服务中心",
  43. "dictType": "dqfwzxs",
  44. "type": ""
  45. }],
  46. [{
  47. "name": "职业教育学校",
  48. "dictType": "zyyxs",
  49. "type": ""
  50. }, {
  51. "name": "特殊教育学校",
  52. "dictType": "xxs",
  53. "type": ""
  54. }, {
  55. "name": "高等院校",
  56. "dictType": "dxs",
  57. "type": ""
  58. }, {
  59. "name": "小学",
  60. "dictType": "xxs",
  61. "type": "小学"
  62. }, {
  63. "name": "中学",
  64. "dictType": "xxs",
  65. "type": ""
  66. }, {
  67. "name": "幼儿园",
  68. "dictType": "yeys",
  69. "type": ""
  70. }, {
  71. "name": "教育考试中心",
  72. "dictType": "",
  73. "type": "jykszxs"
  74. }]
  75. ],
  76. [
  77. [{
  78. "name": "村卫生室",
  79. "dictType": "",
  80. "type": "cwsss"
  81. }, {
  82. "name": "社区卫生服务站",
  83. "dictType": "",
  84. "type": "sqwsfwzs"
  85. }, {
  86. "name": "儿科诊疗服务机构",
  87. "dictType": "ekzlfwjgs",
  88. "type": ""
  89. }, {
  90. "name": "狂犬病,破伤风处置门诊",
  91. "dictType": "kqbpsfczmzs",
  92. "type": ""
  93. }, {
  94. "name": "免疫规划预防接种门诊",
  95. "dictType": "myghyfjzmzs",
  96. "type": ""
  97. }, {
  98. "name": "二级医疗机构",
  99. "dictType": "ejyljgs",
  100. "type": ""
  101. }, {
  102. "name": "三级医疗机构",
  103. "dictType": "sjyljgs",
  104. "type": ""
  105. }, {
  106. "name": "社区卫生服务机构",
  107. "dictType": "sqwsfwjgs",
  108. "type": ""
  109. }, {
  110. "name": "职业病诊断机构",
  111. "dictType": "zybzdjgs",
  112. "type": ""
  113. }, {
  114. "name": "助产医疗机构",
  115. "dictType": "zcyljg",
  116. "type": ""
  117. }, {
  118. "name": "产科门诊服务机构",
  119. "dictType": "ckmzfwjgs",
  120. "type": ""
  121. }, {
  122. "name": "医疗保障事务中心",
  123. "dictType": "ybs",
  124. "type": ""
  125. }],
  126. [{
  127. "name": "派出所",
  128. "dictType": "pcss",
  129. "type": ""
  130. }, {
  131. "name": "出入境业务办理机构",
  132. "dictType": "crjywbljgs",
  133. "type": ""
  134. }],
  135. [{
  136. "name": "交通支大队",
  137. "dictType": "jtxljcdds",
  138. "type": ""
  139. }, {
  140. "name": "交通违法处理机构",
  141. "dictType": "jtwfcljgs",
  142. "type": ""
  143. }, {
  144. "name": "交通事故处理机构",
  145. "dictType": "jtsgcljgs",
  146. "type": ""
  147. }, {
  148. "name": "车管所",
  149. "dictType": "cgss",
  150. "type": ""
  151. }, {
  152. "name": "机动车检测场所",
  153. "dictType": "jdcjccss",
  154. "type": ""
  155. }, {
  156. "name": "驾驶人体检医院",
  157. "dictType": "jsrtjzs",
  158. "type": ""
  159. }, {
  160. "name": "车驾管社会服务站",
  161. "dictType": "cjgshfwzs",
  162. "type": ""
  163. }],
  164. [{
  165. "name": "就业和人才中心",
  166. "dictType": "jyhrczxs",
  167. "type": ""
  168. }, {
  169. "name": "社会保险事务中心",
  170. "dictType": "shbxswzxs",
  171. "type": ""
  172. }]
  173. ],
  174. [
  175. [{
  176. "name": "养老机构",
  177. "dictType": "ylfwjgs",
  178. "type": ""
  179. }],
  180. [{
  181. "name": "婚姻登记机构",
  182. "dictType": "hydjcs",
  183. "type": ""
  184. }, {
  185. "name": "殡仪服务机构",
  186. "dictType": "byfwjgs",
  187. "type": ""
  188. }],
  189. [],
  190. []
  191. ],
  192. [
  193. [],
  194. [],
  195. [],
  196. [{
  197. "name": "图书馆",
  198. "dictType": "tsgs",
  199. "type": ""
  200. }, {
  201. "name": "文化馆",
  202. "dictType": "whgs",
  203. "type": ""
  204. }, {
  205. "name": "文管所",
  206. "dictType": "wgss",
  207. "type": ""
  208. }, {
  209. "name": "公共体育馆",
  210. "dictType": "ggtys",
  211. "type": ""
  212. }, {
  213. "name": "旅游景点",
  214. "dictType": "jqs",
  215. "type": ""
  216. }, {
  217. "name": "公园",
  218. "dictType": "gys",
  219. "type": ""
  220. }]
  221. ],
  222. [
  223. [{
  224. "name": "公证处",
  225. "dictType": "gzcs",
  226. "type": ""
  227. }, {
  228. "name": "司法鉴定机构",
  229. "dictType": "sfjdjgs",
  230. "type": ""
  231. }, {
  232. "name": "基层司法所",
  233. "dictType": "jcfwfwss",
  234. "type": ""
  235. }, {
  236. "name": "法律援助机构",
  237. "dictType": "flyzzxs",
  238. "type": ""
  239. }, {
  240. "name": "矫正中心",
  241. "dictType": "jzzxs",
  242. "type": ""
  243. }],
  244. [{
  245. "name": "残疾人服务中心",
  246. "dictType": "cjrfwzxs",
  247. "type": ""
  248. }, {
  249. "name": "定点残疾人服务机构",
  250. "dictType": "qtcjrfwzxs",
  251. "type": ""
  252. }],
  253. [],
  254. [{
  255. "name": "商圈",
  256. "dictType": "sqs",
  257. "type": ""
  258. }, {
  259. "name": "购物中心",
  260. "dictType": "gwzxs",
  261. "type": ""
  262. }, {
  263. "name": "酒店",
  264. "dictType": "jds",
  265. "type": ""
  266. }]
  267. ],
  268. [
  269. [],
  270. [],
  271. [],
  272. []
  273. ]
  274. ]
  275. let BMap = {};
  276. let x = null;
  277. let y = null;
  278. const INIT_MARKER = {
  279. latitude: 0,
  280. longitude: 0,
  281. iconPath: imgUrl + "/location.png",
  282. width: '34px',
  283. height: '34px',
  284. rotate: 0,
  285. alpha: 1
  286. };
  287. Page({
  288. data: {
  289. issy:false,
  290. imgUrl: imgUrl,
  291. newImgUrl: newImgUrl,
  292. markers: [INIT_MARKER],
  293. latitude: '',
  294. longitude: '',
  295. custGap: 1000,
  296. type: [
  297. [{
  298. "id": 1,
  299. "name": "政务公开",
  300. "image": "fgk.png",
  301. "dictType": ""
  302. }, {
  303. "id": 2,
  304. "name": "政务服务",
  305. "image": "fzwfw.png",
  306. "dictType": ""
  307. }, {
  308. "id": 3,
  309. "name": "党群服务",
  310. "image": "fdqfwzx.png",
  311. "dictType": ""
  312. }, {
  313. "id": 4,
  314. "name": "教育资源",
  315. "image": "fjy.png",
  316. "dictType": ""
  317. }],
  318. [{
  319. "id": 1,
  320. "name": "医疗卫生",
  321. "image": "fyl.png",
  322. "dictType": ""
  323. }, {
  324. "id": 2,
  325. "name": "户籍管理",
  326. "image": "fhjgl.png",
  327. "dictType": ""
  328. }, {
  329. "id": 3,
  330. "name": "交通服务",
  331. "image": "fjtfw.png",
  332. "dictType": ""
  333. }, {
  334. "id": 4,
  335. "name": "社会保障",
  336. "image": "fshbz.png",
  337. "dictType": ""
  338. }],
  339. [{
  340. "id": 1,
  341. "name": "养老服务",
  342. "image": "fylfw.png",
  343. "dictType": ""
  344. }, {
  345. "id": 2,
  346. "name": "民政服务",
  347. "image": "fmzfw.png",
  348. "dictType": ""
  349. }, {
  350. "id": 3,
  351. "name": "办税服务",
  352. "image": "fbsfwt.png",
  353. "dictType": "bsfwts"
  354. }, {
  355. "id": 4,
  356. "name": "市场监管",
  357. "image": "fscjd.png",
  358. "dictType": "scjdgljs"
  359. }],
  360. [{
  361. "id": 1,
  362. "name": "住房保障",
  363. "image": "fgzf.png",
  364. "dictType": "fwglzxs"
  365. }, {
  366. "id": 2,
  367. "name": "不动产登记",
  368. "image": "fbdcdj.png",
  369. "dictType": "bdcdjzxbsdts"
  370. }, {
  371. "id": 3,
  372. "name": "住房公积金",
  373. "image": "fgjj.png",
  374. "dictType": "gjjs"
  375. }, {
  376. "id": 4,
  377. "name": "文体旅游",
  378. "image": "fwtly.png",
  379. "dictType": ""
  380. }],
  381. [{
  382. "id": 1,
  383. "name": "司法服务",
  384. "image": "fsffw.png",
  385. "dictType": ""
  386. }, {
  387. "id": 2,
  388. "name": "助疾服务",
  389. "image": "fcjr.png",
  390. "dictType": ""
  391. }, {
  392. "id": 3,
  393. "name": "产业园区",
  394. "image": "fcyy.png",
  395. "dictType": "cyys"
  396. }, {
  397. "id": 4,
  398. "name": "商业服务",
  399. "image": "fbmfw.png",
  400. "dictType": ""
  401. }],
  402. [{
  403. "id": 1,
  404. "name": "便民公厕",
  405. "image": "fgc.png",
  406. "dictType": "gcs"
  407. }, {
  408. "id": 2,
  409. "name": "停车泊车",
  410. "image": "ftc.png",
  411. "dictType": "tcs"
  412. }, {
  413. "id": 3,
  414. "name": "直饮水点",
  415. "image": "zysd.png",
  416. "dictType": "zysd"
  417. }, {
  418. "id": 4,
  419. "name": "劳动者港湾",
  420. "image": "ldzgw.png",
  421. "dictType": "ldzgw"
  422. }]
  423. ],
  424. circle: [],
  425. popData: [{
  426. "popName": "",
  427. "data": []
  428. }],
  429. showIndex: false,
  430. showSearch: true,
  431. showTraffic: true,
  432. height: 0,
  433. searchVal: '',
  434. loadValue: '',
  435. trafficStart: '',
  436. trafficEnd: '',
  437. index: 0,
  438. isList: true,
  439. showSet: false,
  440. trafficType: 0,
  441. page: 0,
  442. limit: 15,
  443. marksInfo: [],
  444. marksView: [],
  445. marksNum: 0,
  446. searchInfo: {
  447. navType: 0,
  448. isShow: false
  449. },
  450. matterEventInfo: {
  451. data: [],
  452. isShow: false,
  453. search: false
  454. },
  455. itemInfo: {
  456. page: 1,
  457. limit: 6,
  458. navType: 0,
  459. deptNow: '',
  460. pageNext: true,
  461. pagePrev: false,
  462. matterStatus: true,
  463. matterList: [{
  464. itemName: '',
  465. matterUrl: ''
  466. }],
  467. '重庆市南岸区政务服务中心(江南新城中心)': ['重庆市南岸区残联', '重庆市南岸区财政局', '重庆市南岸区文化和旅游发展委员会', '重庆市南岸区档案馆', '重庆市南岸区卫生健康委员会', '重庆市南岸区交通局', '重庆市南岸区规划自然资源局', '重庆市南岸区住房和城乡建设委员会', '重庆市南岸区生态环境局', '重庆市南岸区农业农村委员会', '重庆市南岸区发展和改革委员会', '重庆市南岸区消防救援支队', '重庆市南岸区城市管理局', '重庆市公安局南岸分局'],
  468. '重庆市南岸区政务服务中心(南坪中心)': ['重庆市南岸区市场监管局', '重庆市公安局南岸分局'],
  469. },
  470. jnxc: ['重庆市南岸区残联', '重庆市南岸区财政局', '重庆市南岸区文化和旅游发展委员会', '重庆市南岸区档案馆', '重庆市南岸区卫生健康委员会', '重庆市南岸区交通局', '重庆市南岸区规划自然资源局', '重庆市南岸区住房和城乡建设委员会', '重庆市南岸区生态环境局', '重庆市南岸区农业农村委员会', '重庆市南岸区发展和改革委员会', '重庆市南岸区消防救援支队', '重庆市南岸区城市管理局', '重庆市公安局南岸分局'],
  471. npzx: ['重庆市南岸区市场监管局', '重庆市公安局南岸分局'],
  472. toType: ''
  473. },
  474. onLoad: function (options) {
  475. this.setData({
  476. height: wx.getSystemInfoSync().windowHeight,
  477. })
  478. if (options.type && options.type == 'tdcr') {
  479. this.setData({
  480. toType: options.type,
  481. dataIndex: options.dataIndex
  482. })
  483. }
  484. // console.log(options);
  485. if (options.se) {
  486. this.setData({
  487. loadValue: options.se,
  488. showTraffic: false
  489. });
  490. } else {
  491. this.setData({
  492. showTraffic: true
  493. })
  494. }
  495. // searchVal
  496. },
  497. onReady: function () {
  498. // debugger
  499. const that = this
  500. this.loadItem();
  501. getMapDataAll().then((res) => {
  502. let arr = []
  503. console.log(res.data);
  504. for (const key in res.data) {
  505. // console.log(res.data[key]);
  506. Array.prototype.push.apply(arr, res.data[key])
  507. }
  508. // Array.prototype.push.apply(arr, res.data.xzfwzxs);
  509. // Array.prototype.push.apply(arr, res.data.ggfwzxs);
  510. for (let j = 0; j < arr.length; j++) {
  511. if (arr[j].tel && !(arr[j].tel instanceof Array)) {
  512. arr[j].tel = arr[j].tel.split(";")
  513. }
  514. }
  515. that.setData({
  516. xzfwzxs: res.data.xzfwzxs,
  517. marksInfo: arr
  518. })
  519. this.setMap();
  520. });
  521. // this.setMap();
  522. },
  523. async setMap() {
  524. var that = this;
  525. BMap = await new QQMapWX({
  526. key: 'KN3BZ-KUDND-PGH4Y-POVRP-43KF3-RNF4K'
  527. });
  528. wx.getLocation({
  529. type: 'gcj02', //返回可以用于wx.openLocation的经纬度
  530. success(res) {
  531. console.log(res)
  532. const latitude = res.latitude
  533. const longitude = res.longitude
  534. initMapDataAll(that, latitude, longitude)
  535. if (!(that.data.toType && that.data.toType == 'tdcr')) {
  536. that.setData({
  537. latitude: latitude,
  538. longitude: longitude,
  539. })
  540. } else {
  541. wx.request({
  542. url: imgUrl + 'tdcr/details/data.json',
  543. success: (res) => {
  544. let polygons = []
  545. res.data[that.data.dataIndex].polygon.forEach(item => {
  546. polygons.push({
  547. dashArray: [10, 10],
  548. strokeColor: '#ffe20063',
  549. fillColor: '#ffe20063',
  550. points: item
  551. })
  552. })
  553. that.setData({
  554. polygons,
  555. longitude: res.data[that.data.dataIndex].longitude,
  556. latitude: res.data[that.data.dataIndex].latitude,
  557. })
  558. }
  559. })
  560. }
  561. that.setData({
  562. trafficStart: "我的位置",
  563. circle: [{
  564. latitude: res.latitude,
  565. longitude: res.longitude,
  566. radius: that.data.custGap + 500,
  567. fillColor: '#c4d2ec6a',
  568. color: '#c4d2ec'
  569. }],
  570. markers: [{
  571. latitude: latitude,
  572. longitude: longitude,
  573. iconPath: imgUrl + "/location.png",
  574. width: '30px',
  575. height: '30px',
  576. rotate: 0,
  577. alpha: 1
  578. }]
  579. });
  580. }
  581. });
  582. },
  583. popview(e) {
  584. let x = e.currentTarget.dataset.index;
  585. let y = e.currentTarget.dataset.id;
  586. let pop = popType[x][y - 1]
  587. if (pop.length > 0) {
  588. // this.setTypeDateToPop2(pop)
  589. this.setData({
  590. popData: pop,
  591. showIndex: true
  592. });
  593. } else {
  594. let pop = this.data.type[x][y - 1]
  595. // console.log(pop);
  596. this.setDateToPop(pop)
  597. this.setData({
  598. showTraffic: false,
  599. showIndex: false
  600. })
  601. }
  602. },
  603. setTypeDateToPop2: function (pop) {
  604. let arr = [];
  605. pop.forEach(e => {
  606. arr.push({
  607. "popName": e.name
  608. })
  609. })
  610. this.setData({
  611. popData: arr
  612. })
  613. },
  614. setDateToPop: function (pop) {
  615. let arr = [];
  616. let params = {
  617. "dictType": pop.dictType,
  618. "type": "",
  619. "title": "",
  620. };
  621. wx.showToast({
  622. title: '加载中...',
  623. icon: 'loading'
  624. });
  625. getMapDataType(params).then((res) => {
  626. console.log(res.data[0].tel);
  627. let data = []
  628. res.data.forEach((item) => {
  629. if (item.tel != null && item.tel != "" && !(item.tel instanceof Array)) {
  630. item.tel = item.tel.split(";")
  631. }
  632. data.push(item)
  633. });
  634. this.setData({
  635. popData: data,
  636. })
  637. wx.hideToast({
  638. success: (res) => {},
  639. });
  640. });
  641. },
  642. closePopup() {
  643. this.setData({
  644. showIndex: false
  645. })
  646. },
  647. changeInfo(e) {
  648. // console.log(e.currentTarget.dataset.data);
  649. let searchInfo = this.data.searchInfo
  650. searchInfo.isShow = false
  651. this.setData({
  652. searchInfo: searchInfo
  653. })
  654. let dataitem = e.currentTarget.dataset.data;
  655. console.log(dataitem);
  656. let params = {
  657. "dictType": dataitem.dictType,
  658. "type": "",
  659. "title": "",
  660. };
  661. wx.showToast({
  662. title: '加载中...',
  663. icon: 'loading'
  664. });
  665. getMapDataType(params).then((res) => {
  666. let data = []
  667. switch (dataitem.name) {
  668. case "小学":
  669. case "特殊教育学校":
  670. res.data.forEach((item) => {
  671. if (item.type == dataitem.name) {
  672. data.push(item)
  673. }
  674. });
  675. break;
  676. case "中学":
  677. res.data.forEach((item) => {
  678. if (item.type == dataitem.name || item.specialtype == dataitem.name) {
  679. data.push(item)
  680. }
  681. });
  682. break;
  683. default:
  684. data = res.data;
  685. break;
  686. }
  687. let renderData = []
  688. data.forEach((item) => {
  689. if (item.tel != null && item.tel != "" && !(item.tel instanceof Array)) {
  690. item.tel = item.tel.split(";")
  691. }
  692. renderData.push(item)
  693. });
  694. this.setData({
  695. popData: renderData,
  696. showTraffic: false,
  697. showIndex: false
  698. })
  699. wx.hideToast({
  700. success: (res) => {},
  701. });
  702. });
  703. },
  704. /**
  705. * 拨打电话
  706. * @param {*} e
  707. */
  708. callNumber(e) {
  709. let phoneNumber = e.currentTarget.dataset.value;
  710. wx.makePhoneCall({
  711. phoneNumber: phoneNumber,
  712. });
  713. },
  714. /**
  715. * list跳转info
  716. *
  717. */
  718. changeItem(e) {
  719. let that = this;
  720. console.info(e)
  721. let value = e.currentTarget.dataset.value;
  722. if (value === "none") {
  723. let searchInfo = that.data.searchInfo
  724. searchInfo.isShow = false
  725. that.setData({
  726. isList: false,
  727. showSearch: false,
  728. showSet: false,
  729. searchInfo: searchInfo
  730. });
  731. } else {
  732. // 控制公交自驾选中状态
  733. let type = e.currentTarget.dataset.type;
  734. if (type == 0) {
  735. if (e.detail.value == 0) {
  736. changeValue = "transit";
  737. } else {
  738. changeValue = "driving";
  739. }
  740. }
  741. that.setData({
  742. trafficType: type,
  743. showSet: false
  744. });
  745. that.setData({
  746. isList: false,
  747. showSearch: false,
  748. showSet: true
  749. });
  750. }
  751. // 详情赋值
  752. let index = e.currentTarget.dataset.index;
  753. let item = that.data.popData[index];
  754. console.info(item);
  755. let address = '';
  756. if (item.address.search("重庆") == -1) {
  757. address = "重庆" + item.address;
  758. } else {
  759. address = item.address;
  760. }
  761. console.log(item.time);
  762. let itemInfo = that.data.itemInfo
  763. if (itemInfo[item.dep]) {
  764. let arr = []
  765. for (let i = 0; i < itemInfo[item.dep].length; i++) {
  766. arr.push(itemInfo[item.dep][i].replace('重庆市', '').replace('南岸', ''))
  767. }
  768. itemInfo.deptList = arr
  769. itemInfo.oldDeptList = itemInfo[item.dep]
  770. }
  771. itemInfo.deptShow = itemInfo[item.dep] ? true : false
  772. itemInfo.navType = 0
  773. itemInfo.page = 1
  774. itemInfo.deptNow = ''
  775. let params = {
  776. page: 1,
  777. limit: itemInfo.limit,
  778. type: itemInfo.navType,
  779. }
  780. if (itemInfo.deptShow) {
  781. params.matterDept = itemInfo.oldDeptList.join(',')
  782. } else {
  783. params.matterDept = item.dep.replace('政府', '').replace('便民服务中心', '')
  784. }
  785. const _this = this
  786. getHandMatterPage(params).then((res) => {
  787. if (!(res && res.count > 0)) {
  788. itemInfo.matterStatus = false
  789. _this.setData({
  790. itemInfo: itemInfo
  791. })
  792. return
  793. }
  794. itemInfo.matterStatus = true
  795. itemInfo.pagePrev = itemInfo.page == 1
  796. itemInfo.pageNext = itemInfo.page * itemInfo.limit >= res.count
  797. itemInfo.matterList = res.data
  798. _this.setData({
  799. itemInfo: itemInfo
  800. })
  801. });
  802. that.setData({
  803. detail_dep: item.dep,
  804. detail_content: item.content,
  805. detail_img: item.img,
  806. detail_address: item.address,
  807. detail_time: item.time,
  808. detail_tel: item.tel,
  809. detail_index: index,
  810. trafficEnd: address,
  811. itemInfo: itemInfo
  812. });
  813. BMap.geocoder({
  814. address: address,
  815. success: function (data) {
  816. var res = data.result
  817. that.setData({
  818. latitude: res.location.lat,
  819. longitude: res.location.lng,
  820. markers: [{
  821. latitude: res.location.lat,
  822. longitude: res.location.lng,
  823. iconPath: imgUrl + "/location.png",
  824. width: '30px',
  825. height: '30px',
  826. rotate: 0,
  827. alpha: 1
  828. }]
  829. });
  830. }
  831. });
  832. },
  833. /**
  834. * 打开全景地图
  835. * @param {*} e
  836. */
  837. openVR(e) {
  838. wx.navigateTo({
  839. url: '../map-vr/map-vr',
  840. });
  841. },
  842. getSearchVal(e) {
  843. this.setData({
  844. searchVal: e.detail.value
  845. });
  846. },
  847. loadItem() {
  848. let searchVal = this.data.loadValue;
  849. let datatype = this.data.type;
  850. if (!searchVal) {
  851. return;
  852. }
  853. wx.showToast({
  854. title: '加载中...',
  855. icon: 'loading'
  856. });
  857. let x = -1
  858. let y = -1
  859. for (let i = 0; i < datatype.length; i++) {
  860. for (let j = 0; j < datatype[i].length; j++) {
  861. if (datatype[i][j].name == searchVal) {
  862. x = i
  863. y = j
  864. break;
  865. }
  866. }
  867. if (x != -1) {
  868. break;
  869. }
  870. }
  871. let searcharr = ""
  872. if (datatype[x][y].dictType != "") {
  873. searcharr = datatype[x][y].dictType
  874. } else {
  875. let arr = popType[x][y]
  876. arr.forEach((item) => {
  877. searcharr += item.dictType + ","
  878. })
  879. searcharr = searcharr.substring(0, searcharr.length - 1)
  880. }
  881. let params = {
  882. "dictType": searcharr,
  883. "type": "",
  884. "title": "",
  885. };
  886. getMapDataType(params).then((res) => {
  887. let data = []
  888. res.data.forEach((item) => {
  889. if (item.tel != null && item.tel != "" && !(item.tel instanceof Array)) {
  890. item.tel = item.tel.split(";")
  891. }
  892. data.push(item)
  893. });
  894. this.setData({
  895. // showTraffic: false,
  896. popData: data,
  897. })
  898. wx.hideToast({
  899. success: (res) => {},
  900. });
  901. });
  902. // 搜索结果
  903. },
  904. /**
  905. * 顶部搜索点击事件
  906. * @param {*} e
  907. */
  908. searchTap(e) {
  909. let searchInfo = this.data.searchInfo
  910. searchInfo.isShow = true
  911. searchInfo.navType = 0
  912. this.setData({
  913. searchInfo: searchInfo
  914. })
  915. let searchVal = this.data.searchVal;
  916. wx.showToast({
  917. title: '加载中...',
  918. icon: 'loading'
  919. });
  920. let params = {
  921. "dictType": "",
  922. "type": "",
  923. "title": searchVal,
  924. };
  925. this.setData({
  926. showTraffic: false
  927. })
  928. getMapDataType(params).then((res) => {
  929. let data = []
  930. res.data.forEach((item) => {
  931. if (item.tel != null && item.tel != "" && !(item.tel instanceof Array)) {
  932. item.tel = item.tel.split(";")
  933. }
  934. data.push(item)
  935. });
  936. this.setData({
  937. showTraffic: false,
  938. popData: data,
  939. })
  940. wx.hideToast({
  941. success: (res) => {},
  942. });
  943. });
  944. // 搜索结果
  945. wx.hideToast({
  946. success: (res) => {},
  947. });
  948. },
  949. getTrafficStart(e) {
  950. this.setData({
  951. trafficStart: e.detail.value
  952. });
  953. },
  954. getTrafficEnd(e) {
  955. this.setData({
  956. trafficEnd: e.detail.value
  957. });
  958. },
  959. /**
  960. * 搜索进行交通路线规划
  961. * @param {*} e
  962. */
  963. searchTrafficTap(e) {
  964. const that = this;
  965. // console.log(that.data.trafficType);
  966. let trafficType = that.data.trafficType;
  967. if (trafficType == 0) {
  968. changeValue = "transit";
  969. } else {
  970. changeValue = "driving";
  971. }
  972. let trafficStart = that.data.trafficStart;
  973. let trafficEnd = that.data.trafficEnd;
  974. if (!trafficStart || !trafficEnd) {
  975. wx.showToast({
  976. title: '请输入起点和终点',
  977. icon: 'none'
  978. });
  979. return;
  980. }
  981. console.info(trafficStart, trafficEnd);
  982. BMap.geocoder({
  983. address: trafficEnd,
  984. success: function (data) {
  985. console.log(data);
  986. var res = data.result
  987. // console.log(res);
  988. let key = 'KN3BZ-KUDND-PGH4Y-POVRP-43KF3-RNF4K'; //使用在腾讯位置服务申请的key
  989. let referer = '掌上南岸'; //调用插件的app的名称
  990. // 终点
  991. let endPoint = JSON.stringify({
  992. 'name': trafficEnd,
  993. 'latitude': res.location.lat,
  994. 'longitude': res.location.lng
  995. });
  996. wx.openLocation({
  997. name: trafficEnd,
  998. latitude: res.location.lat,
  999. longitude: res.location.lng
  1000. })
  1001. // wx.navigateTo({
  1002. // url: 'plugin://routePlan/index?key=' + key + '&referer=' + referer + '&endPoint=' + endPoint + "&mode=" + changeValue
  1003. // });
  1004. },
  1005. });
  1006. },
  1007. backSearch() {
  1008. let that = this
  1009. let searchInfo = that.data.searchInfo
  1010. searchInfo.isShow = that.data.searchVal ? true : false
  1011. that.setData({
  1012. searchInfo: searchInfo
  1013. })
  1014. let matterEventInfo = that.data.matterEventInfo
  1015. console.log(matterEventInfo)
  1016. if (!that.data.isList) {
  1017. if (that.data.issy) {
  1018. that.setData({
  1019. showTraffic: true,
  1020. showSearch: true,
  1021. searchVal: ''
  1022. });
  1023. this.setMap();
  1024. return
  1025. }
  1026. matterEventInfo.isShow = searchInfo.navType != 1
  1027. this.setData({
  1028. isList: true,
  1029. showSearch: true,
  1030. showSet: false,
  1031. matterEventInfo: matterEventInfo
  1032. });
  1033. } else if (!matterEventInfo.isShow && matterEventInfo.search) {
  1034. matterEventInfo.isShow = true
  1035. this.setData({
  1036. isList: true,
  1037. showSearch: true,
  1038. showSet: false,
  1039. matterEventInfo: matterEventInfo
  1040. });
  1041. // this.setMap();
  1042. } else {
  1043. matterEventInfo.isShow = false
  1044. matterEventInfo.search = false
  1045. that.setData({
  1046. matterEventInfo: matterEventInfo
  1047. })
  1048. if (!that.data.showTraffic) {
  1049. that.setData({
  1050. showTraffic: true,
  1051. showSearch: true,
  1052. searchVal: ''
  1053. });
  1054. }
  1055. this.setMap();
  1056. }
  1057. wx.getLocation({
  1058. type: 'gcj02', //返回可以用于wx.openLocation的经纬度
  1059. success(res) {
  1060. const latitude = res.latitude
  1061. const longitude = res.longitude
  1062. that.setData({
  1063. latitude: latitude,
  1064. longitude: longitude,
  1065. trafficStart: "我的位置",
  1066. markers: [{
  1067. latitude: latitude,
  1068. longitude: longitude,
  1069. iconPath: imgUrl + "/location.png",
  1070. width: '34px',
  1071. height: '34px',
  1072. rotate: 0,
  1073. alpha: 1
  1074. }]
  1075. });
  1076. }
  1077. })
  1078. changeValue = "transit";
  1079. },
  1080. matterTab(e) {
  1081. let itemInfo = this.data.itemInfo
  1082. itemInfo.navType = e.currentTarget.dataset?.type
  1083. let params = {
  1084. page: 1,
  1085. limit: itemInfo.limit,
  1086. type: itemInfo.navType,
  1087. }
  1088. if (itemInfo.deptShow) {
  1089. if (itemInfo.deptList && itemInfo.deptList.indexOf(itemInfo.deptNow) > -1) {
  1090. params.matterDept = itemInfo.deptNow.replace('政府', '').replace('便民服务中心', '')
  1091. } else {
  1092. params.matterDept = itemInfo.oldDeptList.join(',')
  1093. }
  1094. } else {
  1095. params.matterDept = this.data.detail_dep.replace('政府', '').replace('便民服务中心', '')
  1096. }
  1097. const _this = this
  1098. getHandMatterPage(params).then((res) => {
  1099. if (!(res && res.count > 0)) {
  1100. itemInfo.matterStatus = false
  1101. _this.setData({
  1102. itemInfo: itemInfo
  1103. })
  1104. return
  1105. }
  1106. itemInfo.matterStatus = true
  1107. itemInfo.page = 1
  1108. itemInfo.pagePrev = itemInfo.page == 1
  1109. itemInfo.pageNext = itemInfo.page * itemInfo.limit >= res.count
  1110. itemInfo.matterList = res.data
  1111. _this.setData({
  1112. itemInfo: itemInfo
  1113. })
  1114. });
  1115. },
  1116. clickDept(e) {
  1117. console.log(e)
  1118. let itemInfo = this.data.itemInfo
  1119. itemInfo.deptNow = e.currentTarget.dataset.dept
  1120. itemInfo.page = 1
  1121. this.setData({
  1122. itemInfo: itemInfo
  1123. })
  1124. let params = {
  1125. page: itemInfo.page,
  1126. limit: itemInfo.limit,
  1127. type: itemInfo.navType,
  1128. }
  1129. if (itemInfo.deptShow) {
  1130. if (itemInfo.deptList && itemInfo.deptList.indexOf(itemInfo.deptNow) > -1) {
  1131. params.matterDept = itemInfo.deptNow
  1132. } else {
  1133. params.matterDept = itemInfo.oldDeptList.join(',')
  1134. }
  1135. } else {
  1136. params.matterDept = this.data.detail_dep
  1137. }
  1138. const _this = this
  1139. getHandMatterPage(params).then((res) => {
  1140. if (!(res && res.count > 0)) {
  1141. itemInfo.matterStatus = false
  1142. _this.setData({
  1143. itemInfo: itemInfo
  1144. })
  1145. return
  1146. }
  1147. itemInfo.pagePrev = itemInfo.page == 1
  1148. itemInfo.pageNext = itemInfo.page * itemInfo.limit >= res.count
  1149. itemInfo.matterList = res.data
  1150. _this.setData({
  1151. itemInfo: itemInfo
  1152. })
  1153. });
  1154. },
  1155. clickPageTo(e) {
  1156. let itemInfo = this.data.itemInfo
  1157. let page = 1
  1158. if (e.currentTarget.dataset.type == 0) {
  1159. // 上一页
  1160. if (itemInfo.pagePrev) return
  1161. page = itemInfo.page - 1
  1162. } else {
  1163. if (itemInfo.pageNext) return
  1164. page = itemInfo.page + 1
  1165. }
  1166. let params = {
  1167. page: page,
  1168. limit: itemInfo.limit,
  1169. type: itemInfo.navType,
  1170. }
  1171. if (itemInfo.deptShow) {
  1172. if (itemInfo.deptList && itemInfo.deptList.indexOf(itemInfo.deptNow) > -1) {
  1173. params.matterDept = itemInfo.deptNow.replace('政府', '').replace('便民服务中心', '')
  1174. } else {
  1175. params.matterDept = itemInfo.oldDeptList.join(',')
  1176. }
  1177. } else {
  1178. params.matterDept = this.data.detail_dep.replace('政府', '').replace('便民服务中心', '')
  1179. }
  1180. const _this = this
  1181. getHandMatterPage(params).then((res) => {
  1182. if (!(res && res.count > 0)) {
  1183. itemInfo.matterStatus = false
  1184. _this.setData({
  1185. itemInfo: itemInfo
  1186. })
  1187. return
  1188. }
  1189. itemInfo.matterStatus = true
  1190. itemInfo.page = page
  1191. itemInfo.pagePrev = itemInfo.page == 1
  1192. itemInfo.pageNext = itemInfo.page * itemInfo.limit >= res.count
  1193. itemInfo.matterList = res.data
  1194. _this.setData({
  1195. itemInfo: itemInfo
  1196. })
  1197. });
  1198. },
  1199. searchTab(e) {
  1200. let searchInfo = this.data.searchInfo
  1201. searchInfo.navType = e.currentTarget.dataset.type
  1202. this.setData({
  1203. searchInfo: searchInfo
  1204. })
  1205. const _this = this
  1206. if (searchInfo.navType == 0) {
  1207. let params = {
  1208. "title": _this.data.searchVal,
  1209. };
  1210. getMapDataType(params).then((res) => {
  1211. let data = []
  1212. res.data.forEach((item) => {
  1213. if (item.tel != null && item.tel != "" && !(item.tel instanceof Array)) {
  1214. item.tel = item.tel.split(";")
  1215. }
  1216. data.push(item)
  1217. });
  1218. this.setData({
  1219. showTraffic: false,
  1220. popData: data,
  1221. })
  1222. });
  1223. } else {
  1224. let matterEventInfo = _this.data.matterEventInfo
  1225. matterEventInfo.search = true
  1226. _this.setData({
  1227. matterEventInfo: matterEventInfo
  1228. })
  1229. searchHandMatterByValFun(_this)
  1230. // searchHandMatter(_this)
  1231. }
  1232. },
  1233. clickMatterEvent(e) {
  1234. const _this = this
  1235. let matterEventInfo = _this.data.matterEventInfo
  1236. matterEventInfo.isShow = false
  1237. _this.setData({
  1238. matterEventInfo: matterEventInfo
  1239. })
  1240. console.log(_this.data)
  1241. searchHandMatter(_this, e.currentTarget.dataset.depts)
  1242. },
  1243. markClick(e) {
  1244. if (!e.markerId) {
  1245. return
  1246. }
  1247. const arr = this.data.marksInfo
  1248. const that = this
  1249. this.setData({
  1250. popData: arr
  1251. })
  1252. for (let i = 0; i < arr.length; i++) {
  1253. if (arr[i].id == e.markerId) {
  1254. let searchInfo = that.data.searchInfo
  1255. searchInfo.isShow = false
  1256. that.setData({
  1257. isList: false,
  1258. showSearch: false,
  1259. showSet: false,
  1260. showTraffic: false,
  1261. searchInfo: searchInfo,
  1262. issy:true
  1263. });
  1264. let item = arr[i];
  1265. console.info(item);
  1266. if (item.tel && !(item.tel instanceof Array)) {
  1267. item.tel = item.tel.split(";")
  1268. }
  1269. let address = item.address
  1270. console.log(item.time);
  1271. let itemInfo = that.data.itemInfo
  1272. if (itemInfo[item.dep]) {
  1273. let arr = []
  1274. for (let i = 0; i < itemInfo[item.dep].length; i++) {
  1275. arr.push(itemInfo[item.dep][i].replace('重庆市', '').replace('南岸', ''))
  1276. }
  1277. itemInfo.deptList = arr
  1278. itemInfo.oldDeptList = itemInfo[item.dep]
  1279. }
  1280. itemInfo.deptShow = itemInfo[item.dep] ? true : false
  1281. itemInfo.navType = 0
  1282. itemInfo.page = 1
  1283. itemInfo.deptNow = ''
  1284. let params = {
  1285. page: 1,
  1286. limit: itemInfo.limit,
  1287. type: itemInfo.navType,
  1288. }
  1289. if (itemInfo.deptShow) {
  1290. params.matterDept = itemInfo.oldDeptList.join(',')
  1291. } else {
  1292. params.matterDept = item.dep.replace('政府', '').replace('便民服务中心', '')
  1293. }
  1294. console.log(params)
  1295. const _this = this
  1296. getHandMatterPage(params).then((res) => {
  1297. if (!(res && res.count > 0)) {
  1298. itemInfo.matterStatus = false
  1299. _this.setData({
  1300. itemInfo: itemInfo
  1301. })
  1302. return
  1303. }
  1304. itemInfo.matterStatus = true
  1305. itemInfo.pagePrev = itemInfo.page == 1
  1306. itemInfo.pageNext = itemInfo.page * itemInfo.limit >= res.count
  1307. itemInfo.matterList = res.data
  1308. _this.setData({
  1309. itemInfo: itemInfo
  1310. })
  1311. });
  1312. that.setData({
  1313. detail_dep: item.dep,
  1314. detail_content: item.content,
  1315. detail_img: item.img,
  1316. detail_address: item.address,
  1317. detail_time: item.time,
  1318. detail_tel: item.tel,
  1319. detail_index: i,
  1320. trafficEnd: address,
  1321. itemInfo: itemInfo
  1322. });
  1323. break;
  1324. }
  1325. }
  1326. },
  1327. aroundEvent(e) {
  1328. const _this = this
  1329. this.setData({
  1330. isList: true,
  1331. showSearch: false,
  1332. showSet: false,
  1333. showTraffic: false,
  1334. popData: _this.data.marksView
  1335. })
  1336. },
  1337. toDetailWeb(e) {
  1338. console.log(e.currentTarget.dataset.url)
  1339. // wx.navigateTo({
  1340. // url: '/pages/web/web?gzUrl=' + e.currentTarget.dataset.url,
  1341. // })
  1342. },
  1343. onchange(e) {
  1344. let that = this;
  1345. if (e.detail.value == 0) {
  1346. that.setData({
  1347. trafficType: 0
  1348. });
  1349. changeValue = "transit";
  1350. } else {
  1351. that.setData({
  1352. trafficType: 1
  1353. });
  1354. changeValue = "driving";
  1355. }
  1356. },
  1357. /**
  1358. * 用户点击右上角分享
  1359. */
  1360. onShareAppMessage() {
  1361. return {
  1362. title: '地图服务'
  1363. }
  1364. },
  1365. onShareTimeline() {
  1366. return {
  1367. title: '地图服务'
  1368. }
  1369. },
  1370. openShq() {
  1371. wx.navigateTo({
  1372. url: '/pages/map-shq/map-shq',
  1373. })
  1374. }
  1375. });
  1376. let changeValue = "transit";
  1377. function searchHandMatter(that, queryVal) {
  1378. // getHandMatterBySearch(queryVal).then((res) => {
  1379. // if (res.data && res.data.length) {
  1380. // searchDepVal(that, res.data.join(','), res.data)
  1381. // }
  1382. // });
  1383. searchDepVal(that, queryVal, queryVal.split(","))
  1384. }
  1385. function searchDepVal(that, queryVal, deptArr) {
  1386. let params = {
  1387. title: queryVal
  1388. }
  1389. wx.showToast({
  1390. title: '加载中...',
  1391. icon: 'loading'
  1392. });
  1393. getMapDataType(params).then((res) => {
  1394. let data = []
  1395. let st = true,
  1396. st2 = true
  1397. deptArr.forEach((item) => {
  1398. if (that.data.jnxc.indexOf(item) > -1 && st) {
  1399. st = false
  1400. let ite = that.data.xzfwzxs[0]
  1401. if (ite.tel && !(ite.tel instanceof Array)) {
  1402. ite.tel = ite.tel.split(";")
  1403. }
  1404. data.push(ite)
  1405. }
  1406. if (that.data.npzx.indexOf(item) > -1 && st2) {
  1407. st2 = false
  1408. let ite = that.data.xzfwzxs[1]
  1409. if (ite.tel && !(ite.tel instanceof Array)) {
  1410. ite.tel = ite.tel.split(";")
  1411. }
  1412. data.push(ite)
  1413. }
  1414. })
  1415. res.data.forEach((item) => {
  1416. if (item.tel != null && item.tel != "" && !(item.tel instanceof Array)) {
  1417. item.tel = item.tel.split(";")
  1418. }
  1419. data.push(item)
  1420. });
  1421. that.setData({
  1422. showTraffic: false,
  1423. popData: data,
  1424. })
  1425. wx.hideLoading()
  1426. });
  1427. wx.hideLoading()
  1428. }
  1429. function initMapDataAll(that, lat, lng) {
  1430. let arr = that.data.marksInfo
  1431. console.log(arr)
  1432. let index = 0;
  1433. let addrArr = []
  1434. let marksView = []
  1435. let task = setInterval(function () {
  1436. if (index >= arr.length) {
  1437. addrArr.push({
  1438. latitude: lat,
  1439. longitude: lng,
  1440. iconPath: imgUrl + "/location.png",
  1441. width: '30px',
  1442. height: '30px',
  1443. rotate: 0,
  1444. alpha: 1,
  1445. label: {
  1446. anchorX: 10,
  1447. anchorY: -22,
  1448. bgColor: '#fff',
  1449. borderRadius: 5,
  1450. padding: 5,
  1451. content: "我的位置",
  1452. color: '#333'
  1453. }
  1454. })
  1455. console.log(addrArr)
  1456. that.setData({
  1457. markers: addrArr,
  1458. marksView: marksView,
  1459. marksNum: addrArr.length - 1
  1460. })
  1461. clearInterval(task)
  1462. return
  1463. }
  1464. const address = arr[index]
  1465. index++
  1466. const jl = getDistances(lat, lng, address.latitude, address.longitude)
  1467. if (jl.m <= that.data.custGap) {
  1468. marksView.push(address)
  1469. addrArr.push({
  1470. id: address.id,
  1471. latitude: address.latitude,
  1472. longitude: address.longitude,
  1473. iconPath: imgUrl + "/location.png",
  1474. width: '34px',
  1475. height: '34px',
  1476. rotate: 0,
  1477. alpha: 1,
  1478. label: {
  1479. anchorX: 10,
  1480. anchorY: -22,
  1481. bgColor: '#fff',
  1482. borderRadius: 5,
  1483. padding: 5,
  1484. content: address.dep,
  1485. color: '#333'
  1486. }
  1487. })
  1488. }
  1489. // BMap.geocoder({
  1490. // address: address.address,
  1491. // success: (addr) => {
  1492. // BMap.calculateDistance({
  1493. // mode: 'straight',
  1494. // from: {
  1495. // latitude: lat,
  1496. // longitude: lng
  1497. // },
  1498. // to: [{
  1499. // latitude: addr.result.location.lat,
  1500. // longitude: addr.result.location.lng
  1501. // }],
  1502. // success: (json) => {
  1503. // console.log(getDistances(lat, lng, addr.result.location.lat, addr.result.location.lng))
  1504. // console.log(json)
  1505. // const jl = parseInt(json.result.elements[0].distance)
  1506. // if (jl <= 1000) {
  1507. // marksView.push(address)
  1508. // addrArr.push({
  1509. // id: address.id,
  1510. // latitude: json.result.elements[0].to.lat,
  1511. // longitude: json.result.elements[0].to.lng,
  1512. // iconPath: imgUrl+"/location.png",
  1513. // width: '34px',
  1514. // height: '34px',
  1515. // rotate: 0,
  1516. // alpha: 1
  1517. // })
  1518. // }
  1519. // }
  1520. // })
  1521. // }
  1522. // })
  1523. }, 10);
  1524. }
  1525. function searchHandMatterByValFun(that) {
  1526. searchHandMatterByVal(that.data.searchVal).then((res) => {
  1527. res.data.forEach((item) => {
  1528. const dept = item.depts.split(',')
  1529. let formtDept = item.fomartDept
  1530. const arr = dept.filter(value => that.data.jnxc.includes(value));
  1531. if (arr && arr.length) {
  1532. formtDept += ",区政务服务中心(江南新城中心)"
  1533. }
  1534. const arr2 = dept.filter(value => that.data.npzx.includes(value));
  1535. if (arr2 && arr2.length) {
  1536. formtDept += ",区政务服务中心(南坪中心)"
  1537. }
  1538. item.fomartDept = formtDept
  1539. })
  1540. let matterEventInfo = that.data.matterEventInfo
  1541. matterEventInfo.isShow = true
  1542. matterEventInfo.data = res.data
  1543. that.setData({
  1544. matterEventInfo: matterEventInfo
  1545. })
  1546. });
  1547. }
  1548. // 根据经纬度计算距离,参数分别为第一点的纬度,经度;第二点的纬度,经度
  1549. function getDistances(lat1, lng1, lat2, lng2) {
  1550. let EARTH_RADIUS = 6378.137; // 地球半径
  1551. let radLat1 = lat1 * Math.PI / 180.0; //lat1 * Math.PI / 180.0=>弧度计算
  1552. let radLat2 = lat2 * Math.PI / 180.0;
  1553. let a = radLat1 - radLat2;
  1554. let b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
  1555. let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
  1556. s = s * EARTH_RADIUS;
  1557. s = Math.round(s * 10000) / 10000; // 输出为公里
  1558. return {
  1559. m: s * 1000,
  1560. km: Number(s.toFixed(2))
  1561. }
  1562. }