map.js 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566
  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. },
  473. onLoad: function (options) {
  474. this.setData({
  475. height: wx.getSystemInfoSync().windowHeight
  476. })
  477. // console.log(options);
  478. if (options.se) {
  479. this.setData({
  480. loadValue: options.se,
  481. showTraffic: false
  482. });
  483. } else {
  484. this.setData({
  485. showTraffic: true
  486. })
  487. }
  488. // searchVal
  489. },
  490. onReady: function () {
  491. // debugger
  492. const that = this
  493. this.loadItem();
  494. getMapDataAll().then((res) => {
  495. let arr = []
  496. console.log(res.data);
  497. for (const key in res.data) {
  498. // console.log(res.data[key]);
  499. Array.prototype.push.apply(arr, res.data[key])
  500. }
  501. // Array.prototype.push.apply(arr, res.data.xzfwzxs);
  502. // Array.prototype.push.apply(arr, res.data.ggfwzxs);
  503. for (let j = 0; j < arr.length; j++) {
  504. if (arr[j].tel && !(arr[j].tel instanceof Array)) {
  505. arr[j].tel = arr[j].tel.split(";")
  506. }
  507. }
  508. that.setData({
  509. xzfwzxs: res.data.xzfwzxs,
  510. marksInfo: arr
  511. })
  512. this.setMap();
  513. });
  514. // this.setMap();
  515. },
  516. async setMap() {
  517. var that = this;
  518. BMap = await new QQMapWX({
  519. key: 'KN3BZ-KUDND-PGH4Y-POVRP-43KF3-RNF4K'
  520. });
  521. wx.getLocation({
  522. type: 'gcj02', //返回可以用于wx.openLocation的经纬度
  523. success(res) {
  524. console.log(res)
  525. const latitude = res.latitude
  526. const longitude = res.longitude
  527. initMapDataAll(that, latitude, longitude)
  528. that.setData({
  529. latitude: latitude,
  530. longitude: longitude,
  531. trafficStart: "我的位置",
  532. circle: [{
  533. latitude: res.latitude,
  534. longitude: res.longitude,
  535. radius: that.data.custGap + 500,
  536. fillColor: '#c4d2ec6a',
  537. color: '#c4d2ec'
  538. }],
  539. markers: [{
  540. latitude: latitude,
  541. longitude: longitude,
  542. iconPath: imgUrl + "/location.png",
  543. width: '30px',
  544. height: '30px',
  545. rotate: 0,
  546. alpha: 1
  547. }]
  548. });
  549. }
  550. });
  551. },
  552. popview(e) {
  553. let x = e.currentTarget.dataset.index;
  554. let y = e.currentTarget.dataset.id;
  555. let pop = popType[x][y - 1]
  556. if (pop.length > 0) {
  557. // this.setTypeDateToPop2(pop)
  558. this.setData({
  559. popData: pop,
  560. showIndex: true
  561. });
  562. } else {
  563. let pop = this.data.type[x][y - 1]
  564. // console.log(pop);
  565. this.setDateToPop(pop)
  566. this.setData({
  567. showTraffic: false,
  568. showIndex: false
  569. })
  570. }
  571. },
  572. setTypeDateToPop2: function (pop) {
  573. let arr = [];
  574. pop.forEach(e => {
  575. arr.push({
  576. "popName": e.name
  577. })
  578. })
  579. this.setData({
  580. popData: arr
  581. })
  582. },
  583. setDateToPop: function (pop) {
  584. let arr = [];
  585. let params = {
  586. "dictType": pop.dictType,
  587. "type": "",
  588. "title": "",
  589. };
  590. wx.showToast({
  591. title: '加载中...',
  592. icon: 'loading'
  593. });
  594. getMapDataType(params).then((res) => {
  595. console.log(res.data[0].tel);
  596. let data = []
  597. res.data.forEach((item) => {
  598. if (item.tel != null && item.tel != "" && !(item.tel instanceof Array)) {
  599. item.tel = item.tel.split(";")
  600. }
  601. data.push(item)
  602. });
  603. this.setData({
  604. popData: data,
  605. })
  606. wx.hideToast({
  607. success: (res) => {},
  608. });
  609. });
  610. },
  611. closePopup() {
  612. this.setData({
  613. showIndex: false
  614. })
  615. },
  616. changeInfo(e) {
  617. // console.log(e.currentTarget.dataset.data);
  618. let searchInfo = this.data.searchInfo
  619. searchInfo.isShow = false
  620. this.setData({
  621. searchInfo: searchInfo
  622. })
  623. let dataitem = e.currentTarget.dataset.data;
  624. console.log(dataitem);
  625. let params = {
  626. "dictType": dataitem.dictType,
  627. "type": "",
  628. "title": "",
  629. };
  630. wx.showToast({
  631. title: '加载中...',
  632. icon: 'loading'
  633. });
  634. getMapDataType(params).then((res) => {
  635. let data = []
  636. switch (dataitem.name) {
  637. case "小学":
  638. case "特殊教育学校":
  639. res.data.forEach((item) => {
  640. if (item.type == dataitem.name) {
  641. data.push(item)
  642. }
  643. });
  644. break;
  645. case "中学":
  646. res.data.forEach((item) => {
  647. if (item.type == dataitem.name || item.specialtype == dataitem.name) {
  648. data.push(item)
  649. }
  650. });
  651. break;
  652. default:
  653. data = res.data;
  654. break;
  655. }
  656. let renderData = []
  657. data.forEach((item) => {
  658. if (item.tel != null && item.tel != "" && !(item.tel instanceof Array)) {
  659. item.tel = item.tel.split(";")
  660. }
  661. renderData.push(item)
  662. });
  663. this.setData({
  664. popData: renderData,
  665. showTraffic: false,
  666. showIndex: false
  667. })
  668. wx.hideToast({
  669. success: (res) => {},
  670. });
  671. });
  672. },
  673. /**
  674. * 拨打电话
  675. * @param {*} e
  676. */
  677. callNumber(e) {
  678. let phoneNumber = e.currentTarget.dataset.value;
  679. wx.makePhoneCall({
  680. phoneNumber: phoneNumber,
  681. });
  682. },
  683. /**
  684. * list跳转info
  685. *
  686. */
  687. changeItem(e) {
  688. let that = this;
  689. console.info(e)
  690. let value = e.currentTarget.dataset.value;
  691. if (value === "none") {
  692. let searchInfo = that.data.searchInfo
  693. searchInfo.isShow = false
  694. that.setData({
  695. isList: false,
  696. showSearch: false,
  697. showSet: false,
  698. searchInfo: searchInfo
  699. });
  700. } else {
  701. // 控制公交自驾选中状态
  702. let type = e.currentTarget.dataset.type;
  703. if (type == 0) {
  704. if (e.detail.value == 0) {
  705. changeValue = "transit";
  706. } else {
  707. changeValue = "driving";
  708. }
  709. }
  710. that.setData({
  711. trafficType: type,
  712. showSet: false
  713. });
  714. that.setData({
  715. isList: false,
  716. showSearch: false,
  717. showSet: true
  718. });
  719. }
  720. // 详情赋值
  721. let index = e.currentTarget.dataset.index;
  722. let item = that.data.popData[index];
  723. console.info(item);
  724. let address = '';
  725. if (item.address.search("重庆") == -1) {
  726. address = "重庆" + item.address;
  727. } else {
  728. address = item.address;
  729. }
  730. console.log(item.time);
  731. let itemInfo = that.data.itemInfo
  732. if (itemInfo[item.dep]) {
  733. let arr = []
  734. for (let i = 0; i < itemInfo[item.dep].length; i++) {
  735. arr.push(itemInfo[item.dep][i].replace('重庆市', '').replace('南岸', ''))
  736. }
  737. itemInfo.deptList = arr
  738. itemInfo.oldDeptList = itemInfo[item.dep]
  739. }
  740. itemInfo.deptShow = itemInfo[item.dep] ? true : false
  741. itemInfo.navType = 0
  742. itemInfo.page = 1
  743. itemInfo.deptNow = ''
  744. let params = {
  745. page: 1,
  746. limit: itemInfo.limit,
  747. type: itemInfo.navType,
  748. }
  749. if (itemInfo.deptShow) {
  750. params.matterDept = itemInfo.oldDeptList.join(',')
  751. } else {
  752. params.matterDept = item.dep.replace('政府', '').replace('便民服务中心', '')
  753. }
  754. const _this = this
  755. getHandMatterPage(params).then((res) => {
  756. if (!(res && res.count > 0)) {
  757. itemInfo.matterStatus = false
  758. _this.setData({
  759. itemInfo: itemInfo
  760. })
  761. return
  762. }
  763. itemInfo.matterStatus = true
  764. itemInfo.pagePrev = itemInfo.page == 1
  765. itemInfo.pageNext = itemInfo.page * itemInfo.limit >= res.count
  766. itemInfo.matterList = res.data
  767. _this.setData({
  768. itemInfo: itemInfo
  769. })
  770. });
  771. that.setData({
  772. detail_dep: item.dep,
  773. detail_content: item.content,
  774. detail_img: item.img,
  775. detail_address: item.address,
  776. detail_time: item.time,
  777. detail_tel: item.tel,
  778. detail_index: index,
  779. trafficEnd: address,
  780. itemInfo: itemInfo
  781. });
  782. BMap.geocoder({
  783. address: address,
  784. success: function (data) {
  785. var res = data.result
  786. that.setData({
  787. latitude: res.location.lat,
  788. longitude: res.location.lng,
  789. markers: [{
  790. latitude: res.location.lat,
  791. longitude: res.location.lng,
  792. iconPath: imgUrl + "/location.png",
  793. width: '30px',
  794. height: '30px',
  795. rotate: 0,
  796. alpha: 1
  797. }]
  798. });
  799. }
  800. });
  801. },
  802. /**
  803. * 打开全景地图
  804. * @param {*} e
  805. */
  806. openVR(e) {
  807. wx.navigateTo({
  808. url: '../map-vr/map-vr',
  809. });
  810. },
  811. getSearchVal(e) {
  812. this.setData({
  813. searchVal: e.detail.value
  814. });
  815. },
  816. loadItem() {
  817. let searchVal = this.data.loadValue;
  818. let datatype = this.data.type;
  819. if (!searchVal) {
  820. return;
  821. }
  822. wx.showToast({
  823. title: '加载中...',
  824. icon: 'loading'
  825. });
  826. let x = -1
  827. let y = -1
  828. for (let i = 0; i < datatype.length; i++) {
  829. for (let j = 0; j < datatype[i].length; j++) {
  830. if (datatype[i][j].name == searchVal) {
  831. x = i
  832. y = j
  833. break;
  834. }
  835. }
  836. if (x != -1) {
  837. break;
  838. }
  839. }
  840. let searcharr = ""
  841. if (datatype[x][y].dictType != "") {
  842. searcharr = datatype[x][y].dictType
  843. } else {
  844. let arr = popType[x][y]
  845. arr.forEach((item) => {
  846. searcharr += item.dictType + ","
  847. })
  848. searcharr = searcharr.substring(0, searcharr.length - 1)
  849. }
  850. let params = {
  851. "dictType": searcharr,
  852. "type": "",
  853. "title": "",
  854. };
  855. getMapDataType(params).then((res) => {
  856. let data = []
  857. res.data.forEach((item) => {
  858. if (item.tel != null && item.tel != "" && !(item.tel instanceof Array)) {
  859. item.tel = item.tel.split(";")
  860. }
  861. data.push(item)
  862. });
  863. this.setData({
  864. // showTraffic: false,
  865. popData: data,
  866. })
  867. wx.hideToast({
  868. success: (res) => {},
  869. });
  870. });
  871. // 搜索结果
  872. },
  873. /**
  874. * 顶部搜索点击事件
  875. * @param {*} e
  876. */
  877. searchTap(e) {
  878. let searchInfo = this.data.searchInfo
  879. searchInfo.isShow = true
  880. searchInfo.navType = 0
  881. this.setData({
  882. searchInfo: searchInfo
  883. })
  884. let searchVal = this.data.searchVal;
  885. wx.showToast({
  886. title: '加载中...',
  887. icon: 'loading'
  888. });
  889. let params = {
  890. "dictType": "",
  891. "type": "",
  892. "title": searchVal,
  893. };
  894. this.setData({
  895. showTraffic: false
  896. })
  897. getMapDataType(params).then((res) => {
  898. let data = []
  899. res.data.forEach((item) => {
  900. if (item.tel != null && item.tel != "" && !(item.tel instanceof Array)) {
  901. item.tel = item.tel.split(";")
  902. }
  903. data.push(item)
  904. });
  905. this.setData({
  906. showTraffic: false,
  907. popData: data,
  908. })
  909. wx.hideToast({
  910. success: (res) => {},
  911. });
  912. });
  913. // 搜索结果
  914. wx.hideToast({
  915. success: (res) => {},
  916. });
  917. },
  918. getTrafficStart(e) {
  919. this.setData({
  920. trafficStart: e.detail.value
  921. });
  922. },
  923. getTrafficEnd(e) {
  924. this.setData({
  925. trafficEnd: e.detail.value
  926. });
  927. },
  928. /**
  929. * 搜索进行交通路线规划
  930. * @param {*} e
  931. */
  932. searchTrafficTap(e) {
  933. const that = this;
  934. // console.log(that.data.trafficType);
  935. let trafficType = that.data.trafficType;
  936. if (trafficType == 0) {
  937. changeValue = "transit";
  938. } else {
  939. changeValue = "driving";
  940. }
  941. let trafficStart = that.data.trafficStart;
  942. let trafficEnd = that.data.trafficEnd;
  943. if (!trafficStart || !trafficEnd) {
  944. wx.showToast({
  945. title: '请输入起点和终点',
  946. icon: 'none'
  947. });
  948. return;
  949. }
  950. console.info(trafficStart, trafficEnd);
  951. BMap.geocoder({
  952. address: trafficEnd,
  953. success: function (data) {
  954. console.log(data);
  955. var res = data.result
  956. // console.log(res);
  957. let key = 'KN3BZ-KUDND-PGH4Y-POVRP-43KF3-RNF4K'; //使用在腾讯位置服务申请的key
  958. let referer = '掌上南岸'; //调用插件的app的名称
  959. // 终点
  960. let endPoint = JSON.stringify({
  961. 'name': trafficEnd,
  962. 'latitude': res.location.lat,
  963. 'longitude': res.location.lng
  964. });
  965. wx.navigateTo({
  966. url: 'plugin://routePlan/index?key=' + key + '&referer=' + referer + '&endPoint=' + endPoint + "&mode=" + changeValue
  967. });
  968. },
  969. });
  970. },
  971. backSearch() {
  972. let that = this
  973. let searchInfo = that.data.searchInfo
  974. searchInfo.isShow = that.data.searchVal ? true : false
  975. that.setData({
  976. searchInfo: searchInfo
  977. })
  978. let matterEventInfo = that.data.matterEventInfo
  979. console.log(matterEventInfo)
  980. if (!that.data.isList) {
  981. if (that.data.issy) {
  982. that.setData({
  983. showTraffic: true,
  984. showSearch: true,
  985. searchVal: ''
  986. });
  987. this.setMap();
  988. return
  989. }
  990. matterEventInfo.isShow = searchInfo.navType != 1
  991. this.setData({
  992. isList: true,
  993. showSearch: true,
  994. showSet: false,
  995. matterEventInfo: matterEventInfo
  996. });
  997. } else if (!matterEventInfo.isShow && matterEventInfo.search) {
  998. matterEventInfo.isShow = true
  999. this.setData({
  1000. isList: true,
  1001. showSearch: true,
  1002. showSet: false,
  1003. matterEventInfo: matterEventInfo
  1004. });
  1005. // this.setMap();
  1006. } else {
  1007. matterEventInfo.isShow = false
  1008. matterEventInfo.search = false
  1009. that.setData({
  1010. matterEventInfo: matterEventInfo
  1011. })
  1012. if (!that.data.showTraffic) {
  1013. that.setData({
  1014. showTraffic: true,
  1015. showSearch: true,
  1016. searchVal: ''
  1017. });
  1018. }
  1019. this.setMap();
  1020. }
  1021. wx.getLocation({
  1022. type: 'gcj02', //返回可以用于wx.openLocation的经纬度
  1023. success(res) {
  1024. const latitude = res.latitude
  1025. const longitude = res.longitude
  1026. that.setData({
  1027. latitude: latitude,
  1028. longitude: longitude,
  1029. trafficStart: "我的位置",
  1030. markers: [{
  1031. latitude: latitude,
  1032. longitude: longitude,
  1033. iconPath: imgUrl + "/location.png",
  1034. width: '34px',
  1035. height: '34px',
  1036. rotate: 0,
  1037. alpha: 1
  1038. }]
  1039. });
  1040. }
  1041. })
  1042. changeValue = "transit";
  1043. },
  1044. matterTab(e) {
  1045. let itemInfo = this.data.itemInfo
  1046. itemInfo.navType = e.currentTarget.dataset?.type
  1047. let params = {
  1048. page: 1,
  1049. limit: itemInfo.limit,
  1050. type: itemInfo.navType,
  1051. }
  1052. if (itemInfo.deptShow) {
  1053. if (itemInfo.deptList && itemInfo.deptList.indexOf(itemInfo.deptNow) > -1) {
  1054. params.matterDept = itemInfo.deptNow.replace('政府', '').replace('便民服务中心', '')
  1055. } else {
  1056. params.matterDept = itemInfo.oldDeptList.join(',')
  1057. }
  1058. } else {
  1059. params.matterDept = this.data.detail_dep.replace('政府', '').replace('便民服务中心', '')
  1060. }
  1061. const _this = this
  1062. getHandMatterPage(params).then((res) => {
  1063. if (!(res && res.count > 0)) {
  1064. itemInfo.matterStatus = false
  1065. _this.setData({
  1066. itemInfo: itemInfo
  1067. })
  1068. return
  1069. }
  1070. itemInfo.matterStatus = true
  1071. itemInfo.page = 1
  1072. itemInfo.pagePrev = itemInfo.page == 1
  1073. itemInfo.pageNext = itemInfo.page * itemInfo.limit >= res.count
  1074. itemInfo.matterList = res.data
  1075. _this.setData({
  1076. itemInfo: itemInfo
  1077. })
  1078. });
  1079. },
  1080. clickDept(e) {
  1081. console.log(e)
  1082. let itemInfo = this.data.itemInfo
  1083. itemInfo.deptNow = e.currentTarget.dataset.dept
  1084. itemInfo.page = 1
  1085. this.setData({
  1086. itemInfo: itemInfo
  1087. })
  1088. let params = {
  1089. page: itemInfo.page,
  1090. limit: itemInfo.limit,
  1091. type: itemInfo.navType,
  1092. }
  1093. if (itemInfo.deptShow) {
  1094. if (itemInfo.deptList && itemInfo.deptList.indexOf(itemInfo.deptNow) > -1) {
  1095. params.matterDept = itemInfo.deptNow
  1096. } else {
  1097. params.matterDept = itemInfo.oldDeptList.join(',')
  1098. }
  1099. } else {
  1100. params.matterDept = this.data.detail_dep
  1101. }
  1102. const _this = this
  1103. getHandMatterPage(params).then((res) => {
  1104. if (!(res && res.count > 0)) {
  1105. itemInfo.matterStatus = false
  1106. _this.setData({
  1107. itemInfo: itemInfo
  1108. })
  1109. return
  1110. }
  1111. itemInfo.pagePrev = itemInfo.page == 1
  1112. itemInfo.pageNext = itemInfo.page * itemInfo.limit >= res.count
  1113. itemInfo.matterList = res.data
  1114. _this.setData({
  1115. itemInfo: itemInfo
  1116. })
  1117. });
  1118. },
  1119. clickPageTo(e) {
  1120. let itemInfo = this.data.itemInfo
  1121. let page = 1
  1122. if (e.currentTarget.dataset.type == 0) {
  1123. // 上一页
  1124. if (itemInfo.pagePrev) return
  1125. page = itemInfo.page - 1
  1126. } else {
  1127. if (itemInfo.pageNext) return
  1128. page = itemInfo.page + 1
  1129. }
  1130. let params = {
  1131. page: page,
  1132. limit: itemInfo.limit,
  1133. type: itemInfo.navType,
  1134. }
  1135. if (itemInfo.deptShow) {
  1136. if (itemInfo.deptList && itemInfo.deptList.indexOf(itemInfo.deptNow) > -1) {
  1137. params.matterDept = itemInfo.deptNow.replace('政府', '').replace('便民服务中心', '')
  1138. } else {
  1139. params.matterDept = itemInfo.oldDeptList.join(',')
  1140. }
  1141. } else {
  1142. params.matterDept = this.data.detail_dep.replace('政府', '').replace('便民服务中心', '')
  1143. }
  1144. const _this = this
  1145. getHandMatterPage(params).then((res) => {
  1146. if (!(res && res.count > 0)) {
  1147. itemInfo.matterStatus = false
  1148. _this.setData({
  1149. itemInfo: itemInfo
  1150. })
  1151. return
  1152. }
  1153. itemInfo.matterStatus = true
  1154. itemInfo.page = page
  1155. itemInfo.pagePrev = itemInfo.page == 1
  1156. itemInfo.pageNext = itemInfo.page * itemInfo.limit >= res.count
  1157. itemInfo.matterList = res.data
  1158. _this.setData({
  1159. itemInfo: itemInfo
  1160. })
  1161. });
  1162. },
  1163. searchTab(e) {
  1164. let searchInfo = this.data.searchInfo
  1165. searchInfo.navType = e.currentTarget.dataset.type
  1166. this.setData({
  1167. searchInfo: searchInfo
  1168. })
  1169. const _this = this
  1170. if (searchInfo.navType == 0) {
  1171. let params = {
  1172. "title": _this.data.searchVal,
  1173. };
  1174. getMapDataType(params).then((res) => {
  1175. let data = []
  1176. res.data.forEach((item) => {
  1177. if (item.tel != null && item.tel != "" && !(item.tel instanceof Array)) {
  1178. item.tel = item.tel.split(";")
  1179. }
  1180. data.push(item)
  1181. });
  1182. this.setData({
  1183. showTraffic: false,
  1184. popData: data,
  1185. })
  1186. });
  1187. } else {
  1188. let matterEventInfo = _this.data.matterEventInfo
  1189. matterEventInfo.search = true
  1190. _this.setData({
  1191. matterEventInfo: matterEventInfo
  1192. })
  1193. searchHandMatterByValFun(_this)
  1194. // searchHandMatter(_this)
  1195. }
  1196. },
  1197. clickMatterEvent(e) {
  1198. const _this = this
  1199. let matterEventInfo = _this.data.matterEventInfo
  1200. matterEventInfo.isShow = false
  1201. _this.setData({
  1202. matterEventInfo: matterEventInfo
  1203. })
  1204. console.log(_this.data)
  1205. searchHandMatter(_this, e.currentTarget.dataset.depts)
  1206. },
  1207. markClick(e) {
  1208. if (!e.markerId) {
  1209. return
  1210. }
  1211. const arr = this.data.marksInfo
  1212. const that = this
  1213. this.setData({
  1214. popData: arr
  1215. })
  1216. for (let i = 0; i < arr.length; i++) {
  1217. if (arr[i].id == e.markerId) {
  1218. let searchInfo = that.data.searchInfo
  1219. searchInfo.isShow = false
  1220. that.setData({
  1221. isList: false,
  1222. showSearch: false,
  1223. showSet: false,
  1224. showTraffic: false,
  1225. searchInfo: searchInfo,
  1226. issy:true
  1227. });
  1228. let item = arr[i];
  1229. console.info(item);
  1230. if (item.tel && !(item.tel instanceof Array)) {
  1231. item.tel = item.tel.split(";")
  1232. }
  1233. let address = item.address
  1234. console.log(item.time);
  1235. let itemInfo = that.data.itemInfo
  1236. if (itemInfo[item.dep]) {
  1237. let arr = []
  1238. for (let i = 0; i < itemInfo[item.dep].length; i++) {
  1239. arr.push(itemInfo[item.dep][i].replace('重庆市', '').replace('南岸', ''))
  1240. }
  1241. itemInfo.deptList = arr
  1242. itemInfo.oldDeptList = itemInfo[item.dep]
  1243. }
  1244. itemInfo.deptShow = itemInfo[item.dep] ? true : false
  1245. itemInfo.navType = 0
  1246. itemInfo.page = 1
  1247. itemInfo.deptNow = ''
  1248. let params = {
  1249. page: 1,
  1250. limit: itemInfo.limit,
  1251. type: itemInfo.navType,
  1252. }
  1253. if (itemInfo.deptShow) {
  1254. params.matterDept = itemInfo.oldDeptList.join(',')
  1255. } else {
  1256. params.matterDept = item.dep.replace('政府', '').replace('便民服务中心', '')
  1257. }
  1258. console.log(params)
  1259. const _this = this
  1260. getHandMatterPage(params).then((res) => {
  1261. if (!(res && res.count > 0)) {
  1262. itemInfo.matterStatus = false
  1263. _this.setData({
  1264. itemInfo: itemInfo
  1265. })
  1266. return
  1267. }
  1268. itemInfo.matterStatus = true
  1269. itemInfo.pagePrev = itemInfo.page == 1
  1270. itemInfo.pageNext = itemInfo.page * itemInfo.limit >= res.count
  1271. itemInfo.matterList = res.data
  1272. _this.setData({
  1273. itemInfo: itemInfo
  1274. })
  1275. });
  1276. that.setData({
  1277. detail_dep: item.dep,
  1278. detail_content: item.content,
  1279. detail_img: item.img,
  1280. detail_address: item.address,
  1281. detail_time: item.time,
  1282. detail_tel: item.tel,
  1283. detail_index: i,
  1284. trafficEnd: address,
  1285. itemInfo: itemInfo
  1286. });
  1287. break;
  1288. }
  1289. }
  1290. },
  1291. aroundEvent(e) {
  1292. const _this = this
  1293. this.setData({
  1294. isList: true,
  1295. showSearch: false,
  1296. showSet: false,
  1297. showTraffic: false,
  1298. popData: _this.data.marksView
  1299. })
  1300. },
  1301. toDetailWeb(e) {
  1302. console.log(e.currentTarget.dataset.url)
  1303. // wx.navigateTo({
  1304. // url: '/pages/web/web?gzUrl=' + e.currentTarget.dataset.url,
  1305. // })
  1306. },
  1307. onchange(e) {
  1308. let that = this;
  1309. if (e.detail.value == 0) {
  1310. that.setData({
  1311. trafficType: 0
  1312. });
  1313. changeValue = "transit";
  1314. } else {
  1315. that.setData({
  1316. trafficType: 1
  1317. });
  1318. changeValue = "driving";
  1319. }
  1320. },
  1321. /**
  1322. * 用户点击右上角分享
  1323. */
  1324. onShareAppMessage() {
  1325. return {
  1326. title: '地图服务'
  1327. }
  1328. },
  1329. onShareTimeline() {
  1330. return {
  1331. title: '地图服务'
  1332. }
  1333. },
  1334. openShq() {
  1335. wx.navigateTo({
  1336. url: '/pages/map-shq/map-shq',
  1337. })
  1338. }
  1339. });
  1340. let changeValue = "transit";
  1341. function searchHandMatter(that, queryVal) {
  1342. // getHandMatterBySearch(queryVal).then((res) => {
  1343. // if (res.data && res.data.length) {
  1344. // searchDepVal(that, res.data.join(','), res.data)
  1345. // }
  1346. // });
  1347. searchDepVal(that, queryVal, queryVal.split(","))
  1348. }
  1349. function searchDepVal(that, queryVal, deptArr) {
  1350. let params = {
  1351. title: queryVal
  1352. }
  1353. wx.showToast({
  1354. title: '加载中...',
  1355. icon: 'loading'
  1356. });
  1357. getMapDataType(params).then((res) => {
  1358. let data = []
  1359. let st = true,
  1360. st2 = true
  1361. deptArr.forEach((item) => {
  1362. if (that.data.jnxc.indexOf(item) > -1 && st) {
  1363. st = false
  1364. let ite = that.data.xzfwzxs[0]
  1365. if (ite.tel && !(ite.tel instanceof Array)) {
  1366. ite.tel = ite.tel.split(";")
  1367. }
  1368. data.push(ite)
  1369. }
  1370. if (that.data.npzx.indexOf(item) > -1 && st2) {
  1371. st2 = false
  1372. let ite = that.data.xzfwzxs[1]
  1373. if (ite.tel && !(ite.tel instanceof Array)) {
  1374. ite.tel = ite.tel.split(";")
  1375. }
  1376. data.push(ite)
  1377. }
  1378. })
  1379. res.data.forEach((item) => {
  1380. if (item.tel != null && item.tel != "" && !(item.tel instanceof Array)) {
  1381. item.tel = item.tel.split(";")
  1382. }
  1383. data.push(item)
  1384. });
  1385. that.setData({
  1386. showTraffic: false,
  1387. popData: data,
  1388. })
  1389. wx.hideLoading()
  1390. });
  1391. wx.hideLoading()
  1392. }
  1393. function initMapDataAll(that, lat, lng) {
  1394. let arr = that.data.marksInfo
  1395. console.log(arr)
  1396. let index = 0;
  1397. let addrArr = []
  1398. let marksView = []
  1399. let task = setInterval(function () {
  1400. if (index >= arr.length) {
  1401. addrArr.push({
  1402. latitude: lat,
  1403. longitude: lng,
  1404. iconPath: imgUrl + "/location.png",
  1405. width: '30px',
  1406. height: '30px',
  1407. rotate: 0,
  1408. alpha: 1,
  1409. label: {
  1410. anchorX: 10,
  1411. anchorY: -22,
  1412. bgColor: '#fff',
  1413. borderRadius: 5,
  1414. padding: 5,
  1415. content: "我的位置",
  1416. color: '#333'
  1417. }
  1418. })
  1419. console.log(addrArr)
  1420. that.setData({
  1421. markers: addrArr,
  1422. marksView: marksView,
  1423. marksNum: addrArr.length - 1
  1424. })
  1425. clearInterval(task)
  1426. return
  1427. }
  1428. const address = arr[index]
  1429. index++
  1430. const jl = getDistances(lat, lng, address.latitude, address.longitude)
  1431. if (jl.m <= that.data.custGap) {
  1432. marksView.push(address)
  1433. addrArr.push({
  1434. id: address.id,
  1435. latitude: address.latitude,
  1436. longitude: address.longitude,
  1437. iconPath: imgUrl + "/location.png",
  1438. width: '34px',
  1439. height: '34px',
  1440. rotate: 0,
  1441. alpha: 1,
  1442. label: {
  1443. anchorX: 10,
  1444. anchorY: -22,
  1445. bgColor: '#fff',
  1446. borderRadius: 5,
  1447. padding: 5,
  1448. content: address.dep,
  1449. color: '#333'
  1450. }
  1451. })
  1452. }
  1453. // BMap.geocoder({
  1454. // address: address.address,
  1455. // success: (addr) => {
  1456. // BMap.calculateDistance({
  1457. // mode: 'straight',
  1458. // from: {
  1459. // latitude: lat,
  1460. // longitude: lng
  1461. // },
  1462. // to: [{
  1463. // latitude: addr.result.location.lat,
  1464. // longitude: addr.result.location.lng
  1465. // }],
  1466. // success: (json) => {
  1467. // console.log(getDistances(lat, lng, addr.result.location.lat, addr.result.location.lng))
  1468. // console.log(json)
  1469. // const jl = parseInt(json.result.elements[0].distance)
  1470. // if (jl <= 1000) {
  1471. // marksView.push(address)
  1472. // addrArr.push({
  1473. // id: address.id,
  1474. // latitude: json.result.elements[0].to.lat,
  1475. // longitude: json.result.elements[0].to.lng,
  1476. // iconPath: imgUrl+"/location.png",
  1477. // width: '34px',
  1478. // height: '34px',
  1479. // rotate: 0,
  1480. // alpha: 1
  1481. // })
  1482. // }
  1483. // }
  1484. // })
  1485. // }
  1486. // })
  1487. }, 10);
  1488. }
  1489. function searchHandMatterByValFun(that) {
  1490. searchHandMatterByVal(that.data.searchVal).then((res) => {
  1491. res.data.forEach((item) => {
  1492. const dept = item.depts.split(',')
  1493. let formtDept = item.fomartDept
  1494. const arr = dept.filter(value => that.data.jnxc.includes(value));
  1495. if (arr && arr.length) {
  1496. formtDept += ",区政务服务中心(江南新城中心)"
  1497. }
  1498. const arr2 = dept.filter(value => that.data.npzx.includes(value));
  1499. if (arr2 && arr2.length) {
  1500. formtDept += ",区政务服务中心(南坪中心)"
  1501. }
  1502. item.fomartDept = formtDept
  1503. })
  1504. let matterEventInfo = that.data.matterEventInfo
  1505. matterEventInfo.isShow = true
  1506. matterEventInfo.data = res.data
  1507. that.setData({
  1508. matterEventInfo: matterEventInfo
  1509. })
  1510. });
  1511. }
  1512. // 根据经纬度计算距离,参数分别为第一点的纬度,经度;第二点的纬度,经度
  1513. function getDistances(lat1, lng1, lat2, lng2) {
  1514. let EARTH_RADIUS = 6378.137; // 地球半径
  1515. let radLat1 = lat1 * Math.PI / 180.0; //lat1 * Math.PI / 180.0=>弧度计算
  1516. let radLat2 = lat2 * Math.PI / 180.0;
  1517. let a = radLat1 - radLat2;
  1518. let b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
  1519. 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)));
  1520. s = s * EARTH_RADIUS;
  1521. s = Math.round(s * 10000) / 10000; // 输出为公里
  1522. return {
  1523. m: s * 1000,
  1524. km: Number(s.toFixed(2))
  1525. }
  1526. }