zwfwMap.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta name=”SiteName” content=”重庆市南岸区人民政府”>
  7. <meta name="SiteDomain" content="http://www.cqna.gov.cn" />
  8. <meta name="SiteIDCode" content="5001080014">
  9. <meta name="ColumnName" content="政务地图">
  10. <meta name="ColumnDescription" content="政务地图" />
  11. <meta name="ColumnKeywords" content="政务地图" />
  12. <meta name="ColumnType" content="政务地图" />
  13. <title>政务地图-重庆市南岸重庆区经开区</title>
  14. <!-- 引入 Vue -->
  15. <script src="https://www.cqna.gov.cn/syygapi/naxsb/js/vue.min.js"></script>
  16. <!-- 引入样式 -->
  17. <link rel="stylesheet" href="https://www.cqna.gov.cn/syygapi/naxsb/css/index.css">
  18. <!-- 引入组件库 -->
  19. <script src="https://www.cqna.gov.cn/syygapi/naxsb/js/index.js"></script>
  20. <link rel="stylesheet" href="https://www.cqna.gov.cn/syygapi/naxsb/swiper/swiper-bundle.css">
  21. <!-- jquery-->
  22. <script src="https://www.cqna.gov.cn/syygapi/naxsb/js/jquery-3.5.1.min.js"></script>
  23. <script type="text/javascript"
  24. src="https://api.map.baidu.com/api?type=webgl&v=3.0&ak=7XivTux4H2e1ifKLjvEhxfuayDYxAluq">
  25. </script>
  26. <script src="https://www.cqna.gov.cn/syygapi/naxsb/js/urljson.js"></script>
  27. <script src="js/mapCity.js"></script>
  28. <!-- <script src="https://www.cqna.gov.cn/syygapi/naxsb/js/mapCity.js"></script> -->
  29. <script src="https://www.cqna.gov.cn/syygapi/naxsb/js/mapPoint.js"></script>
  30. <style>
  31. * {
  32. padding: 0;
  33. margin: 0;
  34. }
  35. ul {
  36. list-style-type: none;
  37. }
  38. li {
  39. list-style: none;
  40. }
  41. ::-webkit-scrollbar {
  42. display: none;
  43. }
  44. @font-face {
  45. font-family: 'DOUYU';
  46. src: url('fonts/DOUYUFONT-2.woff');
  47. font-weight: normal;
  48. font-style: normal;
  49. }
  50. @font-face {
  51. font-family: 'Source Han Sans SC';
  52. src: url('fonts/MSYHL.TTC');
  53. font-weight: normal;
  54. font-style: normal;
  55. }
  56. .backbutton img {
  57. margin-right: 0.625rem;
  58. }
  59. #cytz {
  60. font-family: Microsoft YaHei;
  61. color: #FFFFFF;
  62. box-sizing: border-box;
  63. position: relative;
  64. }
  65. .content {
  66. /* height: calc(100% - 82px); */
  67. display: flex;
  68. background: #EDF5FF;
  69. padding: 0 15px 15px 15px;
  70. }
  71. #map {
  72. width: 60%;
  73. /* height: calc(100% - 10px); */
  74. margin-top: 10px;
  75. margin-right: 10px;
  76. }
  77. .contentR {
  78. width: 40%;
  79. height: 776px;
  80. padding-top: 20px;
  81. background-color: #fff;
  82. }
  83. .more {
  84. font-size: 16px;
  85. cursor: pointer;
  86. }
  87. .nodata {
  88. height: calc(100% - 10px);
  89. width: calc(100% - 40px);
  90. background-size: 100% 100%;
  91. }
  92. .top {
  93. display: flex;
  94. justify-content: space-between;
  95. align-items: center;
  96. border-bottom: 1px solid #B7C7DC;
  97. background: #192E47;
  98. }
  99. .toplogo img {
  100. margin-bottom: 17px;
  101. margin-right: 10px;
  102. }
  103. .toplogo {
  104. padding-left: 10px;
  105. display: flex;
  106. align-items: center;
  107. font-family: DOUYU;
  108. font-weight: normal;
  109. font-size: 30px;
  110. color: #fff;
  111. height: 66px;
  112. cursor: pointer;
  113. }
  114. .backbutton {
  115. width: 117px;
  116. height: 42px;
  117. background: #539EDD;
  118. border-radius: 10px;
  119. font-family: Microsoft YaHei;
  120. font-weight: 400;
  121. font-size: 16px;
  122. color: #fff;
  123. display: flex;
  124. align-items: center;
  125. justify-content: center;
  126. margin-right: 10px;
  127. cursor: pointer;
  128. }
  129. .backbutton img {
  130. margin-right: 10px;
  131. }
  132. .topList {
  133. height: 55px;
  134. background: #2A77B9;
  135. display: flex;
  136. align-items: center;
  137. justify-content: space-between;
  138. padding: 0 10px;
  139. }
  140. .topList .list {
  141. font-size: 20px;
  142. color: #FFFFFF;
  143. line-height: 30px;
  144. cursor: pointer;
  145. }
  146. .topList .active {
  147. font-weight: bold;
  148. border-bottom: 2px solid #fff;
  149. }
  150. .content .con {
  151. background: #FFFFFF;
  152. height: calc(100% - 55px);
  153. padding: 20px;
  154. box-sizing: border-box;
  155. }
  156. .con .title {
  157. font-size: 18px;
  158. color: #333333;
  159. border-bottom: 1px solid #DCDCDC;
  160. padding: 0 5px;
  161. line-height: 30px;
  162. cursor: pointer;
  163. padding-bottom: 10px;
  164. }
  165. .con .opendiv {
  166. background: #E9F5FF;
  167. padding: 0 15px;
  168. margin: 0 5px;
  169. padding-top: 15px;
  170. }
  171. .con .opendiv>div {
  172. display: flex;
  173. align-items: center;
  174. }
  175. .con .opendiv>div img {
  176. margin-right: 10px;
  177. }
  178. .con .btn {
  179. width: 136px;
  180. height: 72px;
  181. background-size: 100% 100%;
  182. font-weight: 400;
  183. font-size: 18px;
  184. color: #FFFFFF;
  185. line-height: 60px;
  186. text-align: center;
  187. cursor: pointer;
  188. }
  189. .con .active .title {
  190. color: #2A77B9;
  191. border-bottom: 1px solid #2A77B9;
  192. }
  193. .el-pagination {
  194. height: 60px;
  195. text-align: center;
  196. }
  197. .mapchoise {
  198. font-size: 18px;
  199. display: flex;
  200. margin-left: 40px;
  201. }
  202. .mapchoise>.mbtn {
  203. height: 39px;
  204. color: #FFFFFF;
  205. background-color: #192E47;
  206. border-radius: 4px;
  207. display: flex;
  208. border: 1px solid #FFFFFF;
  209. }
  210. .mbtn .mbtn1 {
  211. width: 67px;
  212. text-align: center;
  213. height: 39px;
  214. line-height: 39px;
  215. letter-spacing: 5px;
  216. cursor: pointer;
  217. }
  218. .mbtn .active {
  219. background-color: #fff;
  220. color: #192E47;
  221. }
  222. .minput {
  223. display: flex;
  224. width: 490px;
  225. height: 40px;
  226. background: #FFFFFF;
  227. border-radius: 4px;
  228. align-items: center;
  229. margin-left: 10px;
  230. }
  231. .minput input {
  232. border: none;
  233. font-size: 18px;
  234. }
  235. .minput input::placeholder {
  236. font-size: 18px;
  237. }
  238. .sel_n .sel_body_name {
  239. width: 300px;
  240. }
  241. .el-tabs__content {
  242. height: calc(100% - 20px);
  243. overflow-y: scroll;
  244. }
  245. .el-tabs {
  246. height: 100%;
  247. }
  248. ul li {
  249. cursor: pointer;
  250. }
  251. .warp_choice {
  252. display: flex;
  253. align-items: center;
  254. margin: 10px 0 5px;
  255. }
  256. .warp_choice span {
  257. color: #FF780B;
  258. font-size: 14px;
  259. }
  260. #startPanel p {
  261. width: 100%;
  262. margin: 0 auto;
  263. color: #666666;
  264. text-overflow: ellipsis;
  265. overflow: hidden;
  266. white-space: nowrap;
  267. cursor: default;
  268. }
  269. #startPanel p.change_text_color {
  270. color: #2775CC;
  271. }
  272. #startPanel li {
  273. cursor: pointer;
  274. }
  275. #startPanel li:hover {
  276. background-color: #E9F3FF;
  277. cursor: pointer;
  278. }
  279. #endPanel p {
  280. width: 100%;
  281. margin: 0 auto;
  282. color: #666666;
  283. text-overflow: ellipsis;
  284. overflow: hidden;
  285. white-space: nowrap;
  286. cursor: default;
  287. }
  288. #endPanel li {
  289. cursor: pointer;
  290. }
  291. #endPanel li:hover {
  292. background-color: #E9F3FF;
  293. cursor: pointer;
  294. }
  295. .startChoice {
  296. display: inline-block;
  297. width: 83px;
  298. height: 30px;
  299. background: #FFFFFF;
  300. border: 1px solid #ccc;
  301. outline: none;
  302. cursor: pointer;
  303. margin-top: 5px;
  304. line-height: 30px;
  305. text-align: center;
  306. }
  307. .endChoice {
  308. display: inline-block;
  309. width: 83px;
  310. height: 30px;
  311. background: #FFFFFF;
  312. border: 1px solid #ccc;
  313. outline: none;
  314. cursor: pointer;
  315. margin-top: 5px;
  316. line-height: 30px;
  317. text-align: center;
  318. }
  319. .hideEnd {
  320. visibility: hidden;
  321. }
  322. </style>
  323. </head>
  324. <body>
  325. <div style="width:100%;" class="header"></div>
  326. <div class="" id="zwfw">
  327. <div class="top">
  328. <div style="display: flex;align-items: center;">
  329. <div class="toplogo">
  330. <img src="https://www.cqna.gov.cn/syygapi/naxsb/image/gyylogowhite.png" alt="">
  331. <span>政务地图</span>
  332. </div>
  333. <div class="mapchoise" v-show="currentMapType=='bus'||currentMapType=='drive'||currentMapType=='choicePoint'">
  334. <div class="mbtn">
  335. <div class="mbtn1" :class="{active:currentMapType=='bus'||currentMapnow=='bus'}" @click="mapbtnClick('bus')"
  336. style="border-radius: 4px 0px 0px 4px;">公交</div>
  337. <div class="mbtn1" :class="{active:currentMapType=='drive'||currentMapnow=='drive'}"
  338. @click="mapbtnClick('drive')" style="border-radius: 0px 4px 4px 0px;">自驾</div>
  339. </div>
  340. <div class="minput">
  341. <el-input placeholder="请输入起点" v-model="startPlace"></el-input>
  342. <img src="images/right-grey.png" alt="">
  343. <el-input placeholder="请输入终点" v-model="endPlace"></el-input>
  344. <img src="images/serchmap.png" alt="" style="margin-right: 10px;cursor: pointer;" @click="searchRoute">
  345. </div>
  346. </div>
  347. </div>
  348. <div class="backbutton" @click="window.location.href='qjt.html'">
  349. <img src="https://www.cqna.gov.cn/syygapi/naxsb/images/backlogo.png" alt="">
  350. <span>返回</span>
  351. </div>
  352. </div>
  353. <div class="content">
  354. <div id="map"></div>
  355. <div class="contentR">
  356. <div v-show="currentMapType!='bus'&&currentMapType!='drive'&&currentMapType!='choicePoint'"
  357. style="height: 100%;">
  358. <div class="topList">
  359. <div v-for="(item,index) in districtLevelTitle" :key="item.id" @click="getListData(item.id)" class="list"
  360. :class="{active : currentid == item.id}">
  361. {{item.name}}</div>
  362. <img src="images/mapBack.png" alt="" v-if="currentItem==4" @click="mapBac" style="cursor: pointer;">
  363. </div>
  364. <div class="con">
  365. <div style="overflow-y: scroll;height: 100%;">
  366. <!-- 区级中心、分中心 -->
  367. <div v-for="(item,index) in districtLevelLists" style="margin-bottom: 20px;"
  368. :class="{active : currentList == item.id}" @click="openListData(item.id,item)"
  369. v-if="(currentid==998||currentid==999)&&currentItem==1">
  370. <div class="title">{{item.title}}</div>
  371. <div class="opendiv" v-show="currentList == item.id">
  372. <div><img src="images/zw.addr.png" alt="">{{item.address}}</div>
  373. <div style="margin-top: 15px;"><img src="images/zw-tel.png" alt="">{{item.tel}}</div>
  374. <div style="display: flex;">
  375. <div style="background-image: url(images/btn-tyy2.png);" class="btn" @click="getRoute('bus')">公交
  376. </div>
  377. <div style="background-image: url(images/btn-tyy1.png);" class="btn" @click="getRoute('drive')">自驾
  378. </div>
  379. <div style="background-image:url(images/btn-tyy.png);" class="btn" v-if="formData.vrUrl"
  380. @click="goHtmlFun1(item.id,item.vrUrl)">全景地图
  381. </div>
  382. </div>
  383. </div>
  384. </div>
  385. <!-- 镇街便民服务中心 -->
  386. <div v-for="(item,index) in districtLevelList1" style="margin-bottom: 20px;"
  387. :class="{active : currentList == item.id}" @click="openListData1(item.id)"
  388. v-if="currentid==26&&currentItem==2">
  389. <div class="title">{{item.title}}</div>
  390. <div class="opendiv" v-show="currentList == item.id">
  391. <div><img src="images/zw.addr.png" alt="">{{formData.address}}</div>
  392. <div style="margin-top: 15px;"><img src="images/zw-tel.png" alt="">{{formData.tel}}</div>
  393. <div style="display: flex;">
  394. <div style="background-image: url(images/btn-tyy2.png);" class="btn" @click="getRoute('bus')">公交
  395. </div>
  396. <div style="background-image: url(images/btn-tyy1.png);" class="btn" @click="getRoute('drive')">自驾
  397. </div>
  398. <div style="background-image:url(images/btn-tyy.png);" class="btn"
  399. @click="goHtmlFun(formData.vrUrl)" v-if="formData.vrUrl">全景地图
  400. </div>
  401. </div>
  402. </div>
  403. </div>
  404. <!-- 村社便民服务站第一层 -->
  405. <div v-for="(item,index) in districtLevelList1" style="margin-bottom: 20px;"
  406. @click="openListData2(item.id)" v-if="currentid==27&&currentItem==3">
  407. <div class="title">{{item.callout.content}}</div>
  408. </div>
  409. <!-- 村社便民服务站第二层 -->
  410. <div v-for="(item,index) in districtLevelList3" style="margin-bottom: 20px;"
  411. :class="{active : currentList == item.id}" @click="openListData3(item.id)" v-if="currentItem==4">
  412. <div class="title" v-if="index!=0">{{item.title}}</div>
  413. <div class="opendiv" v-show="currentList == item.id">
  414. <div><img src="images/zw.addr.png" alt="">{{formData.address}}</div>
  415. <div style="margin-top: 15px;"><img src="images/zw-tel.png" alt="">{{formData.tel}}</div>
  416. <div style="display: flex;">
  417. <div style="background-image: url(images/btn-tyy2.png);" class="btn" @click="getRoute('bus')">公交
  418. </div>
  419. <div style="background-image: url(images/btn-tyy1.png);" class="btn" @click="getRoute('drive')">自驾
  420. </div>
  421. <div style="background-image:url(images/btn-tyy.png);" class="btn"
  422. @click="goHtmlFun(formData.vrUrl)" v-if="formData.vrUrl">全景地图
  423. </div>
  424. </div>
  425. </div>
  426. </div>
  427. </div>
  428. </div>
  429. </div>
  430. <el-dialog title="路线查询" :visible.sync="dialogVisible" width="400px" :before-close="handleClose">
  431. <div style="display: flex;align-items: center;justify-content: center;">
  432. <span style="white-space: nowrap;color: #333;font-size: 20px;">起点:</span>
  433. <el-input v-model="startPlace" placeholder="请输入起点"
  434. style="width: 300px;border: 1px solid #D7D7D7;border-radius:4px;"></el-input>
  435. </div>
  436. <span slot="footer" class="dialog-footer">
  437. <el-button @click="dialogMesure"
  438. style="width: 298px;height: 50px;background: #2A77B9;border-radius: 10px;color: #fff;font-size: 18px;">确 定
  439. </el-button>
  440. </span>
  441. </el-dialog>
  442. <div
  443. style="padding: 5px 10px;box-sizing:border-box;position: relative;height: calc(100% - 20px);overflow-y: scroll;"
  444. v-show="currentMapType == 'choicePoint'" class="left-map">
  445. <div>请选择起点</div>
  446. <ul v-html="startPanel" id="startPanel"></ul>
  447. </div>
  448. <div v-show="currentMapType=='bus'" style="height: calc(100% - 30px);position: relative;">
  449. <el-button @click="backlast" style="position: absolute;right:10px;top:-6px;z-index: 9999;">返回</el-button>
  450. <el-tabs v-model="activebusName" @tab-click="busClick">
  451. <el-tab-pane label="推荐路线" name="BMAP_TRANSIT_POLICY_LEAST_TIME">
  452. <div id="BMAP_TRANSIT_POLICY_LEAST_TIME"></div>
  453. </el-tab-pane>
  454. <el-tab-pane label="少换成" name="BMAP_TRANSIT_POLICY_LEAST_TRANSFER">
  455. <div id="BMAP_TRANSIT_POLICY_LEAST_TRANSFER"></div>
  456. </el-tab-pane>
  457. <el-tab-pane label="少步行" name="BMAP_TRANSIT_POLICY_LEAST_WALKING">
  458. <div id="BMAP_TRANSIT_POLICY_LEAST_WALKING"></div>
  459. </el-tab-pane>
  460. <el-tab-pane label="不乘地铁" name="BMAP_TRANSIT_POLICY_AVOID_SUBWAYS">
  461. <div id="BMAP_TRANSIT_POLICY_AVOID_SUBWAYS"></div>
  462. </el-tab-pane>
  463. </el-tabs>
  464. </div>
  465. <div v-show="currentMapType=='drive'" style="height: calc(100% - 30px);position: relative;">
  466. <el-button @click="backlast" style="position: absolute;right:10px;top:-6px;z-index: 9999;">返回</el-button>
  467. <el-tabs v-model="activedriveName" @tab-click="driveClick">
  468. <el-tab-pane label="推荐路线" name="BMAP_DRIVING_POLICY_LEAST_TIME">
  469. <div id="BMAP_DRIVING_POLICY_LEAST_TIME"></div>
  470. </el-tab-pane>
  471. <el-tab-pane label="最短路程" name="BMAP_DRIVING_POLICY_LEAST_DISTANCE">
  472. <div id="BMAP_DRIVING_POLICY_LEAST_DISTANCE"></div>
  473. </el-tab-pane>
  474. <el-tab-pane label="不走高速" name="BMAP_DRIVING_POLICY_AVOID_HIGHWAYS">
  475. <div id="BMAP_DRIVING_POLICY_AVOID_HIGHWAYS"></div>
  476. </el-tab-pane>
  477. </el-tabs>
  478. </div>
  479. </div>
  480. </div>
  481. </div>
  482. </div>
  483. <div style="width:100%;" class="footer"></div>
  484. </body>
  485. <script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=7XivTux4H2e1ifKLjvEhxfuayDYxAluq"></script>
  486. <script>
  487. $(function () {
  488. $(".header").load('https://www.cqna.gov.cn/syygapi/naxsb/top/top_style.html');
  489. $(".footer").load('https://www.cqna.gov.cn/syygapi/naxsb/footer/footer.html');
  490. });
  491. </script>
  492. <script>
  493. function isMobileUserAgent() {
  494. return /iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(
  495. window.parent.navigator.userAgent.toLowerCase("")
  496. );
  497. }
  498. if (isMobileUserAgent()) {
  499. window.location = 'https://www.cqna.gov.cn/syygapi/naxsb/mobile/zwfwMapMobile.html'
  500. }
  501. </script>
  502. <script>
  503. new Vue({
  504. el: '#zwfw',
  505. data: function () {
  506. return {
  507. currentid: 1,
  508. currentList: null,
  509. currentItem: 1,
  510. currentMapnow: null,
  511. currentMapType: null,
  512. districtLevelTitle: [
  513. {
  514. id: 998,
  515. name: '区级中心'
  516. },
  517. {
  518. id: 999,
  519. name: '分中心'
  520. },
  521. {
  522. id: 26,
  523. name: '镇街便民服务中心'
  524. },
  525. {
  526. id: 27,
  527. name: '村社便民服务站'
  528. }
  529. ],
  530. districtLevelList: [],
  531. districtLevelLists: [],
  532. districtLevelList1: [],
  533. districtLevelList3: [],
  534. current: 0,
  535. districtLevelTotal: 0,
  536. map: {},
  537. formData: {},
  538. startPlace: '',
  539. endPlace: '',
  540. startPoint1: [],
  541. endPoint: [],
  542. activedriveName: 'BMAP_DRIVING_POLICY_LEAST_TIME',
  543. activebusName: 'BMAP_TRANSIT_POLICY_LEAST_TIME',
  544. dialogVisible: false,
  545. startPanel: '',
  546. endPanel: '',
  547. }
  548. },
  549. created() {
  550. this.qjzxData = qjzxData;
  551. this.fzxData = fzxData;
  552. },
  553. mounted() {
  554. this.loadMap();
  555. this.bindEvents();
  556. },
  557. methods: {
  558. loadMap() {
  559. var that = this;
  560. fetch('https://www.cqna.gov.cn/syygapi/naxsb/js/najson.json')
  561. .then(response => response.json())
  562. .then(data => {
  563. var centerPoint = data.features[0].properties.center;
  564. var map = new BMap.Map("map");
  565. map.enableScrollWheelZoom();
  566. map.enableDragging();
  567. map.centerAndZoom(new BMap.Point(106.662444, 29.53282), 12);
  568. map.setMapType(BMAP_NORMAL_MAP);
  569. var pointList = data.features[0].geometry.coordinates[0][0];
  570. let result = [];
  571. pointList.forEach(function (point) {
  572. result.push(new BMap.Point(point[0], point[1]));
  573. });
  574. let polygon = new BMap.Polygon(result, {
  575. strokeColor: "#226cfb",
  576. strokeWeight: 1.5,
  577. strokeOpacity: 1,
  578. strokeStyle: "dashed",
  579. // fillColor: "#4B98F6",
  580. fillOpacity: 0.2
  581. });
  582. map.addOverlay(polygon);
  583. that.map = map;
  584. that.currentid = that.districtLevelTitle[0].id;
  585. that.getListData(that.districtLevelTitle[0].id, that.districtLevelTitle[0].name)
  586. })
  587. .catch(error => console.error('Error fetching JSON:', error));
  588. },
  589. getListData(id) {
  590. this.currentid = id;
  591. this.currentList = null;
  592. var allOverlay = this.map.getOverlays();
  593. for (var i = 0; i < allOverlay.length; i++) {
  594. if (allOverlay[i].id == "detaiId") {
  595. this.map.removeOverlay(allOverlay[i]);
  596. }
  597. }
  598. this.map.centerAndZoom(new BMap.Point(106.662444, 29.53282), 12);
  599. var _this = this;
  600. if (id == 998) {
  601. this.currentItem = 1;
  602. _this.current = 1
  603. _this.districtLevelTotal = this.qjzxData.length
  604. _this.districtLevelList = this.qjzxData
  605. _this.districtLevelLists = this.qjzxData;
  606. _this.showListPoint(this.districtLevelLists);
  607. } else if (id == 999) {
  608. this.currentItem = 1;
  609. _this.current = 1
  610. _this.districtLevelTotal = this.fzxData.length
  611. _this.districtLevelList = this.fzxData
  612. _this.districtLevelLists = this.fzxData;
  613. _this.showListPoint(this.districtLevelLists);
  614. } else {
  615. if (this.currentid == 26) {
  616. this.currentItem = 2;
  617. } else if (this.currentid == 27) {
  618. this.currentItem = 3;
  619. }
  620. this.districtLevelList1 = marks;
  621. this.showListPoint(this.districtLevelList1);
  622. }
  623. },
  624. getRoute(currentMapType) {
  625. this.currentMapnow = currentMapType;
  626. this.dialogVisible = true;
  627. },
  628. backlast() {
  629. // this.currentMapType = 'choicePoint'
  630. this.loadMap();
  631. this.currentMapType = '';
  632. this.currentList = '';
  633. this.currentid = 1;
  634. this.startPoint1 = [];
  635. this.startPlace = '';
  636. this.getListData(1)
  637. },
  638. searchRoute() {
  639. if (this.currentMapType == 'bus') {
  640. this.busClick();
  641. } else if (this.currentMapType == 'drive') {
  642. this.driveClick();
  643. }
  644. },
  645. mapbtnClick(currentMapType) {
  646. this.currentMapType = currentMapType;
  647. this.currentMapnow = currentMapType;
  648. if (this.currentMapType == 'bus') {
  649. this.busClick();
  650. } else if (this.currentMapType == 'drive') {
  651. this.driveClick();
  652. }
  653. },
  654. busClick(tab, event) {
  655. var discriptHtml = '';
  656. var _this = this;
  657. var transit = new BMap.TransitRoute(_this.map, {
  658. renderOptions: {
  659. map: _this.map,
  660. panel: _this.activebusName
  661. },
  662. policy: 0,
  663. onSearchComplete: function (results) {
  664. if (transit.getStatus() == BMAP_STATUS_SUCCESS) {
  665. discriptHtml = '';
  666. return;
  667. } else {
  668. discriptHtml += '<div>在重庆市 '
  669. discriptHtml += '未能计算出从“'
  670. discriptHtml += _this.startPlace
  671. discriptHtml += '”到“'
  672. discriptHtml += _this.endPlace
  673. discriptHtml += '”公交路线,抱歉。'
  674. discriptHtml += '</div>'
  675. $('#' + _this.activebusName).empty().append(discriptHtml);
  676. _this.map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
  677. }
  678. }
  679. });
  680. this.map.clearOverlays();
  681. transit.clearResults();
  682. transit.setPolicy(this.activebusName);
  683. var p1 = new BMap.Point(this.startPoint1[0], this.startPoint1[1]);
  684. var p2 = new BMap.Point(this.endPoint[0], this.endPoint[1]);
  685. transit.search(p1, p2);
  686. },
  687. driveClick(tab, event) {
  688. var discriptHtml = '';
  689. var _this = this;
  690. var drivingRoute = new BMap.DrivingRoute(_this.map, {
  691. renderOptions: {
  692. map: _this.map,
  693. panel: _this.activedriveName,
  694. autoViewport: true,
  695. enableDragging: true
  696. }
  697. });
  698. this.map.clearOverlays();
  699. drivingRoute.clearResults();
  700. drivingRoute.setPolicy(this.activedriveName);
  701. var p1 = new BMap.Point(this.startPoint1[0], this.startPoint1[1]);
  702. var p2 = new BMap.Point(this.endPoint[0], this.endPoint[1]);
  703. drivingRoute.search(p1, p2);
  704. },
  705. handleClose() {
  706. this.dialogVisible = false;
  707. },
  708. dialogMesure() {
  709. this.dialogVisible = false;
  710. this.endPlace = this.formData.address;
  711. this.endPoint = [this.formData.longitude, this.formData.latitude];
  712. this.currentMapType = 'choicePoint'
  713. this.startLocation(this.startPlace)
  714. },
  715. // 封装起点的地址选择
  716. startLocation(startZD) {
  717. var startResults = null;
  718. var _this = this;
  719. var startOption = {
  720. onSearchComplete: function (results) {
  721. // 判断状态是否正确
  722. if (startSearch.getStatus() == BMAP_STATUS_SUCCESS) {
  723. startResults = results;
  724. var openStartInfoHtml = '';
  725. for (var i = 0; i < results.getCurrentNumPois(); i++) {
  726. var startcount = i + 1;
  727. openStartInfoHtml += "<li data-add='" + results.getPoi(i).address + "' data-text='" + results.getPoi(i).title + "' data-lng='" + results.getPoi(i).point.lng + "' data-lat='" + results.getPoi(i).point.lat + "' class='openstartinfo'>"
  728. openStartInfoHtml += "<div class='warp_choice'>"
  729. openStartInfoHtml += "<span>" + startcount + ".</span>"
  730. openStartInfoHtml += "<p>"
  731. openStartInfoHtml += results.getPoi(i).title
  732. openStartInfoHtml += "</p>"
  733. openStartInfoHtml += "</div>"
  734. openStartInfoHtml += "<p>地址:"
  735. if (results.getPoi(i).address == undefined) {
  736. openStartInfoHtml += results.getPoi(i).title
  737. } else {
  738. openStartInfoHtml += results.getPoi(i).address
  739. }
  740. openStartInfoHtml += "</p></div>"
  741. openStartInfoHtml += "<a class='startChoice hideEnd'>选为起点</a>"
  742. openStartInfoHtml += "</li>"
  743. }
  744. _this.startPanel = openStartInfoHtml
  745. } else {
  746. startResults = null;
  747. }
  748. }
  749. };
  750. var startSearch = new BMap.LocalSearch(this.map, startOption);
  751. startSearch.search(startZD);
  752. },
  753. bindEvents() {
  754. $(document).on('mouseover', '.openstartinfo', function () {
  755. $(this).children('.startChoice').removeClass('hideEnd');
  756. });
  757. $(document).on('mouseleave', '.openstartinfo', function () {
  758. $(this).children('.startChoice').addClass('hideEnd');
  759. });
  760. var _this = this;
  761. $(document).on('click', '.openstartinfo', function () {
  762. _this.map.clearOverlays();
  763. _this.startPoint1 = [$(this).data("lng"), $(this).data("lat")];
  764. startPoint = new BMap.Point($(this).data("lng"), $(this).data("lat"));
  765. _this.startPoint = $(this).data("text");
  766. _this.map.setCenter(startPoint);
  767. _this.map.addOverlay(new BMap.Marker(startPoint));
  768. $(this).find('p').addClass('change_text_color').parents('li').siblings().find('p').removeClass('change_text_color');
  769. _this.currentMapType = _this.currentMapnow;
  770. if (_this.currentMapnow == 'bus') {
  771. _this.busClick();
  772. } else if (_this.currentMapnow == 'drive') {
  773. _this.driveClick();
  774. }
  775. });
  776. },
  777. mapBac() {
  778. this.currentItem = 3;
  779. this.map.centerAndZoom(new BMap.Point(106.662444, 29.53282), 12);
  780. var allOverlay = this.map.getOverlays();
  781. for (var i = 0; i < allOverlay.length; i++) {
  782. if (allOverlay[i].id == "detaiId") {
  783. this.map.removeOverlay(allOverlay[i]);
  784. }
  785. }
  786. },
  787. showDetailPoint(pointLists) {
  788. var that = this;
  789. pointLists.forEach(function (item) {
  790. var x1 = item.longitude;
  791. var y1 = item.latitude;
  792. var name = item.title;
  793. let p = new BMap.Point(x1, y1);
  794. var myIcon = new BMap.Icon("images/zwMapicon.png", new BMap.Size(43, 48), {
  795. offset: new BMap.Size(10, 25),
  796. });
  797. let marker = new BMap.Marker(p, { icon: myIcon });
  798. marker.id = "detaiId";
  799. that.map.addOverlay(marker);
  800. var opts = {
  801. position: new BMap.Point(x1, y1),
  802. offset: new BMap.Size(10, 10)
  803. };
  804. var label = new BMap.Label(name, opts);
  805. label.setStyle({
  806. color: "#333333",
  807. fontSize: "14px",
  808. height: "auto",
  809. lineHeight: "20px",
  810. fontFamily: "微软雅黑",
  811. backgroundColor: '#fff',
  812. border: '1px solid #646464'
  813. });
  814. marker.setLabel(label);
  815. marker.addEventListener('click', function () {
  816. that.openListData3(item.id, item.title);
  817. });
  818. });
  819. },
  820. showListPoint(pointLists) {
  821. var that = this;
  822. var allOverlay = that.map.getOverlays();
  823. for (var i = 0; i < allOverlay.length; i++) {
  824. if (allOverlay[i].id == "zbId") {
  825. that.map.removeOverlay(allOverlay[i]);
  826. }
  827. }
  828. pointLists.forEach(function (item) {
  829. var x1 = item.longitude;
  830. var y1 = item.latitude;
  831. if (that.currentid == 26 || that.currentid == 27) {
  832. var name = item.callout.content;
  833. } else {
  834. var name = item.title;
  835. }
  836. let p = new BMap.Point(x1, y1);
  837. var myIcon = new BMap.Icon("images/zwActiveicon.png", new BMap.Size(43, 48), {
  838. offset: new BMap.Size(10, 25),
  839. });
  840. let marker = new BMap.Marker(p, { icon: myIcon });
  841. marker.id = "zbId";
  842. that.map.addOverlay(marker);
  843. var opts = {
  844. position: new BMap.Point(x1, y1),
  845. offset: new BMap.Size(10, 10)
  846. };
  847. var label = new BMap.Label(name, opts);
  848. label.setStyle({
  849. color: "#333333",
  850. fontSize: "14px",
  851. height: "auto",
  852. lineHeight: "20px",
  853. fontFamily: "微软雅黑",
  854. backgroundColor: '#fff',
  855. border: '1px solid #646464'
  856. });
  857. marker.setLabel(label);
  858. marker.addEventListener('click', function () {
  859. var allOverlay = that.map.getOverlays();
  860. for (var i = 0; i < allOverlay.length; i++) {
  861. if (allOverlay[i].id == "detaiId") {
  862. that.map.removeOverlay(allOverlay[i]);
  863. }
  864. }
  865. if (that.currentid == 26) {
  866. that.openListData1(item.id);
  867. } else if (that.currentid == 27) {
  868. that.openListData2(item.id);
  869. } else {
  870. that.openListData(item.id, item);
  871. }
  872. });
  873. });
  874. },
  875. goHtmlFun1(id, vrUrl) {
  876. window.open(vrUrl)
  877. },
  878. goHtmlFun(vrUrl) {
  879. window.open(vrUrl)
  880. },
  881. openListData(id, item) {
  882. this.currentList = id;
  883. this.formData = item
  884. },
  885. openListData1(id) {
  886. this.currentList = id;
  887. var formData = this.districtLevelList1.find(item => item.id === id);
  888. var url = 'https://www.cqna.gov.cn/vr/jiedao/' + vrUrl[formData.id] + '/tour.html';
  889. this.formData = {
  890. id: formData.id,
  891. title: formData.title,
  892. address: formData.address,
  893. latitude: formData.latitude,
  894. longitude: formData.longitude,
  895. tel: formData.phones,
  896. vrUrl: url,
  897. }
  898. // this.map.centerAndZoom(new BMap.Point(formData.longitude, formData.latitude), 16);
  899. // this.showDetailPoint(cityMark[id].filter((element, index) => index !== 0));
  900. },
  901. openListData2(id) {
  902. var formData = this.districtLevelList1.find(item => item.id === id);
  903. this.districtLevelList3 = cityMark[formData.id]
  904. this.map.centerAndZoom(new BMap.Point(formData.longitude, formData.latitude), 16);
  905. this.showDetailPoint(cityMark[formData.id].filter((element, index) => index !== 0))
  906. this.currentItem = 4;
  907. },
  908. openListData3(id, item) {
  909. this.currentList = id;
  910. var nowformdata = this.districtLevelList3.find(item => item.id === id);
  911. var formData = mapVcAddress[id];
  912. this.formData = {
  913. id: id,
  914. title: formData.name,
  915. address: formData.address,
  916. tel: formData.phone,
  917. latitude: nowformdata.latitude,
  918. longitude: nowformdata.longitude
  919. }
  920. this.map.centerAndZoom(new BMap.Point(this.formData.longitude, this.formData.latitude), 16);
  921. }
  922. }
  923. });
  924. </script>
  925. </html>