sy_mobile.js 188 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407
  1. var is_mobi =
  2. navigator.userAgent
  3. .toLowerCase()
  4. .match(
  5. /(ipod|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i
  6. ) != null;
  7. if (!is_mobi) {
  8. window.location.href = "sy.html";
  9. }
  10. var deptArr = {
  11. "重庆市南岸区政务服务中心(江南新城中心)": [
  12. "重庆市南岸区残联",
  13. "重庆市南岸区财政局",
  14. "重庆市南岸区文化和旅游发展委员会",
  15. "重庆市南岸区档案馆",
  16. "重庆市南岸区卫生健康委员会",
  17. "重庆市南岸区交通局",
  18. "重庆市南岸区规划自然资源局",
  19. "重庆市南岸区住房和城乡建设委员会",
  20. "重庆市南岸区生态环境局",
  21. "重庆市南岸区农业农村委员会",
  22. "重庆市南岸区发展和改革委员会",
  23. "重庆市南岸区消防救援支队",
  24. "重庆市南岸区城市管理局",
  25. "重庆市公安局南岸分局",
  26. ],
  27. "重庆市南岸区政务服务中心(南坪中心)": [
  28. "重庆市南岸区市场监管局",
  29. "重庆市公安局南岸分局",
  30. ],
  31. jnxc: 0,
  32. npzx: 1,
  33. };
  34. layui.use("element", function () {
  35. var element = layui.element;
  36. layer = layui.layer;
  37. });
  38. $(function () {
  39. // 获取高度
  40. var hlHeight =
  41. window.outerHeight -
  42. $(".head").outerHeight() -
  43. $(".bttom-tab").outerHeight() +
  44. 85;
  45. $(".right-map").css("height", hlHeight);
  46. var msHeight =
  47. $(".right-map").outerHeight() - $(".right-search").outerHeight() / 1.3;
  48. $(".right-search").css("top", msHeight);
  49. $(".icon-shq").css("top", msHeight);
  50. $('.icon-shq').on('click', function() {
  51. window.top.location.href = "sy_life.html";
  52. })
  53. // 点击图片,显示弹窗
  54. $(".img_tab").click(function (e) {
  55. $(this).find(".pop").toggle();
  56. $(this).parent("li").siblings().children(".img_tab").find(".pop").hide();
  57. $(this)
  58. .parents("ul")
  59. .siblings()
  60. .children("li")
  61. .children(".img_tab")
  62. .find(".pop")
  63. .hide();
  64. });
  65. // 百度地图API功能
  66. function G(id) {
  67. return document.getElementById(id);
  68. }
  69. var map = new BMap.Map("right-map"); // 创建Map实例
  70. map.centerAndZoom(new BMap.Point(106.563, 29.523), 14); // 初始化地图,设置中心点坐标和地图级别
  71. map.enableDragging();
  72. // 区级部门与街镇解析地址批量解析开始
  73. var myGeo = new BMap.Geocoder();
  74. var xxs = [],
  75. xx = [],
  76. zx = [],
  77. tsjy = [],
  78. dx = [],
  79. zyyx = [],
  80. yey = [],
  81. bmfwzx = [],
  82. ggfwzx = [],
  83. dqfwzx = [],
  84. cyy = [],
  85. byfwjg = [],
  86. cwss = [],
  87. sqwsfwz = [],
  88. ejyljg = [];
  89. var ekzlfwjg = [],
  90. kqbpsfczmz = [],
  91. myghyfjzmz = [],
  92. sjyljg = [],
  93. sqwsfwjg = [],
  94. zybzdjg = [],
  95. gy = [],
  96. tc = [],
  97. zysd = [],
  98. gc = [],
  99. hydjjg = [],
  100. zcyljg = [],
  101. ckmzfwjg = [],
  102. pcs = [],
  103. ldzgw = [];
  104. var crjywbljg = [],
  105. jtxljcdd = [],
  106. jtwfcljg = [],
  107. jtsgcljg = [],
  108. cgs = [],
  109. jdcjccs = [],
  110. jsrtjz = [],
  111. ylfwjg = [],
  112. tsg = [],
  113. whg = [],
  114. wgs = [],
  115. ggty = [],
  116. jq = [];
  117. var bdcdjzxbsdt = [],
  118. cjrfwzx = [],
  119. ddcjrfwjg = [],
  120. fwglzx = [],
  121. gzc = [],
  122. sfjdjg = [],
  123. jcfwfws = [],
  124. flyzzx = [],
  125. bsfwt = [],
  126. scjdglj = [];
  127. var yb = [],
  128. dkbld = [],
  129. cjgshfwz = [],
  130. jykszx = [],
  131. xzfwzx = [],
  132. jzzx = [],
  133. jyhrczx = [],
  134. shbxswzx = [],
  135. sq = [],
  136. gjj = [],
  137. hscyd = [],
  138. gwzx = [],
  139. jd = [];
  140. // 数组接收的是渲染页面的值
  141. var getAllArr = [];
  142. // 参数用来判断进入的页面
  143. var indexList = 0;
  144. // 用来接收对比参数的数组
  145. var contrastArrey = [];
  146. var arraddre = [];
  147. // 接收json内所有数据
  148. var getAllJson = [];
  149. // 受理场所
  150. var qjjz = [];
  151. // 查阅场所
  152. var cycsbms = [];
  153. // 存放点击列表的事件的高度
  154. var scrollListHeight;
  155. var scrollListHeight1;
  156. var discrptAddress;
  157. var gjIndex = 1;
  158. var zjIndex = 1;
  159. // 防抖,清除定时器
  160. var timeout = null;
  161. $.ajax({
  162. type: "GET",
  163. url: PATH + "/mapdata/getMapDataAll",
  164. // url: "http://192.168.1.253:7777/mapdata/getMapDataAll",
  165. async: false,
  166. success: function (res) {
  167. $.each(res.data.xxs, function (i) {
  168. xxs.push(res.data.xxs[i]);
  169. getAllJson.push(res.data.xxs[i]);
  170. contrastArrey.push(res.data.xxs[i]);
  171. if (xxs[i].type == "小学") {
  172. xx.push(xxs[i]);
  173. }
  174. if (xxs[i].type == "中学" || xxs[i].specialtype == "中学") {
  175. zx.push(xxs[i]);
  176. }
  177. if (xxs[i].type == "特殊教育学校") {
  178. tsjy.push(xxs[i]);
  179. }
  180. });
  181. $.each(res.data.dxs, function (i) {
  182. dx.push(res.data.dxs[i]);
  183. getAllJson.push(res.data.dxs[i]);
  184. contrastArrey.push(res.data.dxs[i]);
  185. });
  186. $.each(res.data.zyyxs, function (i) {
  187. zyyx.push(res.data.zyyxs[i]);
  188. getAllJson.push(res.data.zyyxs[i]);
  189. contrastArrey.push(res.data.zyyxs[i]);
  190. });
  191. $.each(res.data.yeys, function (i) {
  192. yey.push(res.data.yeys[i]);
  193. getAllJson.push(res.data.yeys[i]);
  194. contrastArrey.push(res.data.yeys[i]);
  195. });
  196. $.each(res.data.bmfwzxs, function (i) {
  197. bmfwzx.push(res.data.bmfwzxs[i]);
  198. getAllJson.push(res.data.bmfwzxs[i]);
  199. contrastArrey.push(res.data.bmfwzxs[i]);
  200. });
  201. $.each(res.data.ggfwzxs, function (i) {
  202. ggfwzx.push(res.data.ggfwzxs[i]);
  203. getAllJson.push(res.data.ggfwzxs[i]);
  204. contrastArrey.push(res.data.ggfwzxs[i]);
  205. });
  206. $.each(res.data.dqfwzxs, function (i) {
  207. dqfwzx.push(res.data.dqfwzxs[i]);
  208. getAllJson.push(res.data.dqfwzxs[i]);
  209. contrastArrey.push(res.data.dqfwzxs[i]);
  210. });
  211. $.each(res.data.bms, function (i) {
  212. qjjz.push(res.data.bms[i]);
  213. getAllJson.push(res.data.bms[i]);
  214. contrastArrey.push(res.data.bms[i]);
  215. });
  216. $.each(res.data.jzs, function (i) {
  217. qjjz.push(res.data.jzs[i]);
  218. getAllJson.push(res.data.jzs[i]);
  219. contrastArrey.push(res.data.jzs[i]);
  220. });
  221. $.each(res.data.cycsbms, function (i) {
  222. cycsbms.push(res.data.cycsbms[i]);
  223. getAllJson.push(res.data.cycsbms[i]);
  224. contrastArrey.push(res.data.cycsbms[i]);
  225. });
  226. $.each(res.data.slcsjzs, function (i) {
  227. cycsbms.push(res.data.slcsjzs[i]);
  228. getAllJson.push(res.data.slcsjzs[i]);
  229. contrastArrey.push(res.data.slcsjzs[i]);
  230. });
  231. $.each(res.data.cyys, function (i) {
  232. cyy.push(res.data.cyys[i]);
  233. getAllJson.push(res.data.cyys[i]);
  234. contrastArrey.push(res.data.cyys[i]);
  235. });
  236. $.each(res.data.byfwjgs, function (i) {
  237. byfwjg.push(res.data.byfwjgs[i]);
  238. getAllJson.push(res.data.byfwjgs[i]);
  239. contrastArrey.push(res.data.byfwjgs[i]);
  240. });
  241. $.each(res.data.cwsss, function (i) {
  242. cwss.push(res.data.cwsss[i]);
  243. getAllJson.push(res.data.cwsss[i]);
  244. contrastArrey.push(res.data.cwsss[i]);
  245. });
  246. $.each(res.data.sqwsfwzs, function (i) {
  247. sqwsfwz.push(res.data.sqwsfwzs[i]);
  248. getAllJson.push(res.data.sqwsfwzs[i]);
  249. contrastArrey.push(res.data.sqwsfwzs[i]);
  250. });
  251. $.each(res.data.ekzlfwjgs, function (i) {
  252. ekzlfwjg.push(res.data.ekzlfwjgs[i]);
  253. getAllJson.push(res.data.ekzlfwjgs[i]);
  254. contrastArrey.push(res.data.ekzlfwjgs[i]);
  255. });
  256. $.each(res.data.kqbpsfczmzs, function (i) {
  257. kqbpsfczmz.push(res.data.kqbpsfczmzs[i]);
  258. getAllJson.push(res.data.kqbpsfczmzs[i]);
  259. contrastArrey.push(res.data.kqbpsfczmzs[i]);
  260. });
  261. $.each(res.data.myghyfjzmzs, function (i) {
  262. myghyfjzmz.push(res.data.myghyfjzmzs[i]);
  263. getAllJson.push(res.data.myghyfjzmzs[i]);
  264. contrastArrey.push(res.data.myghyfjzmzs[i]);
  265. });
  266. $.each(res.data.ejyljgs, function (i) {
  267. ejyljg.push(res.data.ejyljgs[i]);
  268. getAllJson.push(res.data.ejyljgs[i]);
  269. contrastArrey.push(res.data.ejyljgs[i]);
  270. });
  271. $.each(res.data.sjyljgs, function (i) {
  272. sjyljg.push(res.data.sjyljgs[i]);
  273. getAllJson.push(res.data.sjyljgs[i]);
  274. contrastArrey.push(res.data.sjyljgs[i]);
  275. });
  276. $.each(res.data.sqwsfwjgs, function (i) {
  277. sqwsfwjg.push(res.data.sqwsfwjgs[i]);
  278. getAllJson.push(res.data.sqwsfwjgs[i]);
  279. contrastArrey.push(res.data.sqwsfwjgs[i]);
  280. });
  281. $.each(res.data.zybzdjgs, function (i) {
  282. zybzdjg.push(res.data.zybzdjgs[i]);
  283. getAllJson.push(res.data.zybzdjgs[i]);
  284. contrastArrey.push(res.data.zybzdjgs[i]);
  285. });
  286. $.each(res.data.gys, function (i) {
  287. gy.push(res.data.gys[i]);
  288. getAllJson.push(res.data.gys[i]);
  289. contrastArrey.push(res.data.gys[i]);
  290. });
  291. $.each(res.data.tcs, function (i) {
  292. tc.push(res.data.tcs[i]);
  293. getAllJson.push(res.data.tcs[i]);
  294. contrastArrey.push(res.data.tcs[i]);
  295. });
  296. $.each(res.data.zysd, function (i) {
  297. zysd.push(res.data.zysd[i]);
  298. getAllJson.push(res.data.zysd[i]);
  299. contrastArrey.push(res.data.zysd[i]);
  300. });
  301. $.each(res.data.ldzgw, function (i) {
  302. ldzgw.push(res.data.ldzgw[i]);
  303. getAllJson.push(res.data.ldzgw[i]);
  304. contrastArrey.push(res.data.ldzgw[i]);
  305. });
  306. $.each(res.data.gcs, function (i) {
  307. gc.push(res.data.gcs[i]);
  308. getAllJson.push(res.data.gcs[i]);
  309. contrastArrey.push(res.data.gcs[i]);
  310. });
  311. $.each(res.data.hydjcs, function (i) {
  312. hydjjg.push(res.data.hydjcs[i]);
  313. getAllJson.push(res.data.hydjcs[i]);
  314. contrastArrey.push(res.data.hydjcs[i]);
  315. });
  316. $.each(res.data.zcyljg, function (i) {
  317. zcyljg.push(res.data.zcyljg[i]);
  318. getAllJson.push(res.data.zcyljg[i]);
  319. contrastArrey.push(res.data.zcyljg[i]);
  320. });
  321. $.each(res.data.ckmzfwjgs, function (i) {
  322. ckmzfwjg.push(res.data.ckmzfwjgs[i]);
  323. getAllJson.push(res.data.ckmzfwjgs[i]);
  324. contrastArrey.push(res.data.ckmzfwjgs[i]);
  325. });
  326. $.each(res.data.pcss, function (i) {
  327. pcs.push(res.data.pcss[i]);
  328. getAllJson.push(res.data.pcss[i]);
  329. contrastArrey.push(res.data.pcss[i]);
  330. });
  331. $.each(res.data.crjywbljgs, function (i) {
  332. crjywbljg.push(res.data.crjywbljgs[i]);
  333. getAllJson.push(res.data.crjywbljgs[i]);
  334. contrastArrey.push(res.data.crjywbljgs[i]);
  335. });
  336. $.each(res.data.jtxljcdds, function (i) {
  337. jtxljcdd.push(res.data.jtxljcdds[i]);
  338. getAllJson.push(res.data.jtxljcdds[i]);
  339. contrastArrey.push(res.data.jtxljcdds[i]);
  340. });
  341. $.each(res.data.jtwfcljgs, function (i) {
  342. jtwfcljg.push(res.data.jtwfcljgs[i]);
  343. getAllJson.push(res.data.jtwfcljgs[i]);
  344. contrastArrey.push(res.data.jtwfcljgs[i]);
  345. });
  346. $.each(res.data.jtsgcljgs, function (i) {
  347. jtsgcljg.push(res.data.jtsgcljgs[i]);
  348. getAllJson.push(res.data.jtsgcljgs[i]);
  349. contrastArrey.push(res.data.jtsgcljgs[i]);
  350. });
  351. $.each(res.data.cgss, function (i) {
  352. cgs.push(res.data.cgss[i]);
  353. getAllJson.push(res.data.cgss[i]);
  354. contrastArrey.push(res.data.cgss[i]);
  355. });
  356. $.each(res.data.jdcjccss, function (i) {
  357. jdcjccs.push(res.data.jdcjccss[i]);
  358. getAllJson.push(res.data.jdcjccss[i]);
  359. contrastArrey.push(res.data.jdcjccss[i]);
  360. });
  361. $.each(res.data.jsrtjzs, function (i) {
  362. jsrtjz.push(res.data.jsrtjzs[i]);
  363. getAllJson.push(res.data.jsrtjzs[i]);
  364. contrastArrey.push(res.data.jsrtjzs[i]);
  365. });
  366. $.each(res.data.ylfwjgs, function (i) {
  367. ylfwjg.push(res.data.ylfwjgs[i]);
  368. getAllJson.push(res.data.ylfwjgs[i]);
  369. contrastArrey.push(res.data.ylfwjgs[i]);
  370. });
  371. $.each(res.data.tsgs, function (i) {
  372. tsg.push(res.data.tsgs[i]);
  373. getAllJson.push(res.data.tsgs[i]);
  374. contrastArrey.push(res.data.tsgs[i]);
  375. });
  376. $.each(res.data.whgs, function (i) {
  377. whg.push(res.data.whgs[i]);
  378. getAllJson.push(res.data.whgs[i]);
  379. contrastArrey.push(res.data.whgs[i]);
  380. });
  381. $.each(res.data.wgss, function (i) {
  382. wgs.push(res.data.wgss[i]);
  383. getAllJson.push(res.data.wgss[i]);
  384. contrastArrey.push(res.data.wgss[i]);
  385. });
  386. $.each(res.data.ggtys, function (i) {
  387. ggty.push(res.data.ggtys[i]);
  388. getAllJson.push(res.data.ggtys[i]);
  389. contrastArrey.push(res.data.ggtys[i]);
  390. });
  391. $.each(res.data.jqs, function (i) {
  392. jq.push(res.data.jqs[i]);
  393. getAllJson.push(res.data.jqs[i]);
  394. contrastArrey.push(res.data.jqs[i]);
  395. });
  396. $.each(res.data.bdcdjzxbsdts, function (i) {
  397. bdcdjzxbsdt.push(res.data.bdcdjzxbsdts[i]);
  398. getAllJson.push(res.data.bdcdjzxbsdts[i]);
  399. contrastArrey.push(res.data.bdcdjzxbsdts[i]);
  400. });
  401. $.each(res.data.cjrfwzxs, function (i) {
  402. cjrfwzx.push(res.data.cjrfwzxs[i]);
  403. getAllJson.push(res.data.cjrfwzxs[i]);
  404. contrastArrey.push(res.data.cjrfwzxs[i]);
  405. });
  406. $.each(res.data.qtcjrfwzxs, function (i) {
  407. ddcjrfwjg.push(res.data.qtcjrfwzxs[i]);
  408. getAllJson.push(res.data.qtcjrfwzxs[i]);
  409. contrastArrey.push(res.data.qtcjrfwzxs[i]);
  410. });
  411. $.each(res.data.fwglzxs, function (i) {
  412. fwglzx.push(res.data.fwglzxs[i]);
  413. getAllJson.push(res.data.fwglzxs[i]);
  414. contrastArrey.push(res.data.fwglzxs[i]);
  415. });
  416. $.each(res.data.gzcs, function (i) {
  417. gzc.push(res.data.gzcs[i]);
  418. getAllJson.push(res.data.gzcs[i]);
  419. contrastArrey.push(res.data.gzcs[i]);
  420. });
  421. $.each(res.data.sfjdjgs, function (i) {
  422. sfjdjg.push(res.data.sfjdjgs[i]);
  423. getAllJson.push(res.data.sfjdjgs[i]);
  424. contrastArrey.push(res.data.sfjdjgs[i]);
  425. });
  426. $.each(res.data.jcfwfwss, function (i) {
  427. jcfwfws.push(res.data.jcfwfwss[i]);
  428. getAllJson.push(res.data.jcfwfwss[i]);
  429. contrastArrey.push(res.data.jcfwfwss[i]);
  430. });
  431. $.each(res.data.flyzzxs, function (i) {
  432. flyzzx.push(res.data.flyzzxs[i]);
  433. getAllJson.push(res.data.flyzzxs[i]);
  434. contrastArrey.push(res.data.flyzzxs[i]);
  435. });
  436. $.each(res.data.bsfwts, function (i) {
  437. bsfwt.push(res.data.bsfwts[i]);
  438. getAllJson.push(res.data.bsfwts[i]);
  439. contrastArrey.push(res.data.bsfwts[i]);
  440. });
  441. $.each(res.data.scjdgljs, function (i) {
  442. scjdglj.push(res.data.scjdgljs[i]);
  443. getAllJson.push(res.data.scjdgljs[i]);
  444. contrastArrey.push(res.data.scjdgljs[i]);
  445. });
  446. $.each(res.data.ybs, function (i) {
  447. yb.push(res.data.ybs[i]);
  448. getAllJson.push(res.data.ybs[i]);
  449. contrastArrey.push(res.data.ybs[i]);
  450. });
  451. $.each(res.data.dkblds, function (i) {
  452. dkbld.push(res.data.dkblds[i]);
  453. getAllJson.push(res.data.dkblds[i]);
  454. contrastArrey.push(res.data.dkblds[i]);
  455. });
  456. $.each(res.data.cjgshfwzs, function (i) {
  457. cjgshfwz.push(res.data.cjgshfwzs[i]);
  458. getAllJson.push(res.data.cjgshfwzs[i]);
  459. contrastArrey.push(res.data.cjgshfwzs[i]);
  460. });
  461. $.each(res.data.jykszxs, function (i) {
  462. jykszx.push(res.data.jykszxs[i]);
  463. getAllJson.push(res.data.jykszxs[i]);
  464. contrastArrey.push(res.data.jykszxs[i]);
  465. });
  466. $.each(res.data.xzfwzxs, function (i) {
  467. xzfwzx.push(res.data.xzfwzxs[i]);
  468. getAllJson.push(res.data.xzfwzxs[i]);
  469. contrastArrey.push(res.data.xzfwzxs[i]);
  470. });
  471. $.each(res.data.jzzxs, function (i) {
  472. jzzx.push(res.data.jzzxs[i]);
  473. getAllJson.push(res.data.jzzxs[i]);
  474. contrastArrey.push(res.data.jzzxs[i]);
  475. });
  476. $.each(res.data.jyhrczxs, function (i) {
  477. jyhrczx.push(res.data.jyhrczxs[i]);
  478. getAllJson.push(res.data.jyhrczxs[i]);
  479. contrastArrey.push(res.data.jyhrczxs[i]);
  480. });
  481. $.each(res.data.shbxswzxs, function (i) {
  482. shbxswzx.push(res.data.shbxswzxs[i]);
  483. getAllJson.push(res.data.shbxswzxs[i]);
  484. contrastArrey.push(res.data.shbxswzxs[i]);
  485. });
  486. $.each(res.data.sqs, function (i) {
  487. sq.push(res.data.sqs[i]);
  488. getAllJson.push(res.data.sqs[i]);
  489. contrastArrey.push(res.data.sqs[i]);
  490. });
  491. $.each(res.data.gjjs, function (i) {
  492. gjj.push(res.data.gjjs[i]);
  493. getAllJson.push(res.data.gjjs[i]);
  494. contrastArrey.push(res.data.gjjs[i]);
  495. });
  496. $.each(res.data.hscyds, function (i) {
  497. hscyd.push(res.data.hscyds[i]);
  498. getAllJson.push(res.data.hscyds[i]);
  499. contrastArrey.push(res.data.hscyds[i]);
  500. });
  501. $.each(res.data.gwzxs, function (i) {
  502. gwzx.push(res.data.gwzxs[i]);
  503. getAllJson.push(res.data.gwzxs[i]);
  504. contrastArrey.push(res.data.gwzxs[i]);
  505. });
  506. $.each(res.data.jds, function (i) {
  507. jd.push(res.data.jds[i]);
  508. getAllJson.push(res.data.jds[i]);
  509. contrastArrey.push(res.data.jds[i]);
  510. });
  511. },
  512. error: function (err) {},
  513. });
  514. // 渲染点击小学等的结果页面样式
  515. function applyClickList() {
  516. let ran = navigator.userAgent;
  517. let isIOS = !!ran.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  518. if (isIOS) {
  519. var hBHeight = (window.outerHeight - $(".head").outerHeight()) / 2;
  520. $(".show-fifth").fadeIn(500).siblings().fadeOut(50);
  521. $(".right-map").css("height", hBHeight);
  522. var wsHeight =
  523. window.outerHeight -
  524. $(".right-map").innerHeight() -
  525. $(".head").innerHeight() -
  526. 11;
  527. var windowHeight =
  528. window.outerHeight -
  529. $(".right-map").innerHeight() -
  530. $(".head").innerHeight();
  531. var spWidth =
  532. ($(".show-fifth").innerWidth() - $(".wrap_result").innerWidth()) / 2;
  533. $(".title-second").css({ top: windowHeight, left: spWidth });
  534. $(".show-fifth").css("height", hBHeight);
  535. $(".wrap_result").css("height", wsHeight);
  536. $(".right-search").hide().css("top", "0px");
  537. $(".top_search").fadeIn(500);
  538. $(".wrap_handle").hide();
  539. $("body").css("overflow", "hidden");
  540. } else {
  541. $(".show-fifth").fadeIn(500).siblings().fadeOut(50);
  542. var rmHeight =
  543. window.outerHeight -
  544. $(".right-map").innerHeight() -
  545. $(".head").innerHeight();
  546. var wsHeight =
  547. window.outerHeight -
  548. $(".right-map").innerHeight() -
  549. $(".head").innerHeight() -
  550. 11;
  551. var windowHeight =
  552. $(".right-map").innerHeight() - $(".head").innerHeight() + 45;
  553. var spWidth =
  554. ($(".show-fifth").innerWidth() - $(".wrap_result").innerWidth()) / 2;
  555. $(".title-second").css({ top: windowHeight, left: spWidth });
  556. $(".show-fifth").css("height", rmHeight);
  557. $(".wrap_result").css("height", wsHeight);
  558. $(".right-search").hide().css("top", "0px");
  559. $(".top_search").fadeIn(500);
  560. $(".wrap_handle").hide();
  561. }
  562. }
  563. var str = window.parent.location.search;
  564. console.log(str);
  565. str = decodeURI(str);
  566. let name = "se";
  567. // $("[title='重庆市第十一中学校']").click();
  568. if (str.indexOf(name) != -1) {
  569. var pos_start = str.indexOf(name) + name.length + 1;
  570. var pos_end = str.indexOf("&", pos_start);
  571. if (pos_end == -1) {
  572. let searchVal = str.substring(pos_start);
  573. if (searchVal !== null && searchVal !== "") {
  574. console.log(searchVal);
  575. $(".inp").val(searchVal);
  576. localStorage.setItem("gjIndex", "1");
  577. localStorage.setItem("gjImg", "0");
  578. localStorage.setItem("zjImg", "0");
  579. localStorage.setItem("zjIndex", "0");
  580. setTimeout(function () {
  581. $(".inp-icon1").click();
  582. }, 500);
  583. }
  584. }
  585. }
  586. // 点击弹窗以外的区域隐藏弹窗
  587. $(document).on("click", function (e) {
  588. if (
  589. !$(e.target).is($(".gn_img")) &&
  590. !$(e.target).is($(".gn_img")) &&
  591. $(e.target).parent(".gn_img").length === 0 &&
  592. !$(e.target).is($(".flex_text")) &&
  593. !$(e.target).is($(".flex_text")) &&
  594. $(e.target).parent(".flex_text").length === 0
  595. ) {
  596. $(".img_tab img").parent(".img_tab").find(".pop").css("display", "none");
  597. $(".img_tab img")
  598. .parents(".flex_li")
  599. .siblings()
  600. .find(".pop")
  601. .css("display", "none");
  602. }
  603. });
  604. $(".mapnav").click(function () {
  605. $(this).addClass("choice");
  606. $(this).parent("div").siblings().children(".mapnav").removeClass("choice");
  607. var xxtx = $(this).text();
  608. indexList = 2;
  609. switch (xxtx) {
  610. case "小学":
  611. applyClickList();
  612. xrList(xx);
  613. getPointPostAjax(xx);
  614. break;
  615. case "中学":
  616. applyClickList();
  617. xrList(zx);
  618. getPointPostAjax(zx);
  619. break;
  620. case "特殊教育学校":
  621. applyClickList();
  622. xrList(tsjy);
  623. getPointPostAjax(tsjy);
  624. break;
  625. case "高等院校":
  626. applyClickList();
  627. xrList(dx);
  628. getPointPostAjax(dx);
  629. break;
  630. case "职业教育学校":
  631. applyClickList();
  632. xrList(zyyx);
  633. getPointPostAjax(zyyx);
  634. break;
  635. case "幼儿园":
  636. applyClickList();
  637. xrList(yey);
  638. getPointPostAjax(yey);
  639. break;
  640. case "镇(街道)便民服务中心":
  641. applyClickList();
  642. xrList(ggfwzx);
  643. getPointPostAjax(ggfwzx);
  644. break;
  645. case "村(社区)便民服务站":
  646. applyClickList();
  647. xrList(bmfwzx);
  648. getPointPostAjax(bmfwzx);
  649. break;
  650. case "党群服务中心":
  651. applyClickList();
  652. xrList(dqfwzx);
  653. getPointPostAjax(dqfwzx);
  654. break;
  655. case "受理场所":
  656. applyClickList();
  657. xrList(qjjz);
  658. getPointPostAjax(qjjz);
  659. break;
  660. case "查阅场所":
  661. applyClickList();
  662. xrList(cycsbms);
  663. getPointPostAjax(cycsbms);
  664. break;
  665. case "殡仪服务机构":
  666. applyClickList();
  667. xrList(byfwjg);
  668. getPointPostAjax(byfwjg);
  669. break;
  670. case "村卫生室":
  671. applyClickList();
  672. xrList(cwss);
  673. getPointPostAjax(cwss);
  674. break;
  675. case "社区卫生服务站":
  676. applyClickList();
  677. xrList(sqwsfwz);
  678. getPointPostAjax(sqwsfwz);
  679. break;
  680. case "儿科诊疗服务机构":
  681. applyClickList();
  682. xrList(ekzlfwjg);
  683. getPointPostAjax(ekzlfwjg);
  684. break;
  685. case "狂犬病、破伤风处置门诊":
  686. applyClickList();
  687. xrList(kqbpsfczmz);
  688. getPointPostAjax(kqbpsfczmz);
  689. break;
  690. case "免疫规划预防接种门诊":
  691. applyClickList();
  692. xrList(myghyfjzmz);
  693. getPointPostAjax(myghyfjzmz);
  694. break;
  695. case "二级医疗机构":
  696. applyClickList();
  697. xrList(ejyljg);
  698. getPointPostAjax(ejyljg);
  699. break;
  700. case "三级医疗机构":
  701. applyClickList();
  702. xrList(sjyljg);
  703. getPointPostAjax(sjyljg);
  704. break;
  705. case "社区卫生服务机构":
  706. applyClickList();
  707. xrList(sqwsfwjg);
  708. getPointPostAjax(sqwsfwjg);
  709. break;
  710. case "职业病诊断机构":
  711. applyClickList();
  712. xrList(zybzdjg);
  713. getPointPostAjax(zybzdjg);
  714. break;
  715. case "公园":
  716. applyClickList();
  717. xrList(gy);
  718. getPointPostAjax(gy);
  719. break;
  720. case "婚姻登记机构":
  721. applyClickList();
  722. xrList(hydjjg);
  723. getPointPostAjax(hydjjg);
  724. break;
  725. case "助产医疗机构":
  726. applyClickList();
  727. xrList(zcyljg);
  728. getPointPostAjax(zcyljg);
  729. break;
  730. case "产科门诊服务机构":
  731. applyClickList();
  732. xrList(ckmzfwjg);
  733. getPointPostAjax(ckmzfwjg);
  734. break;
  735. case "派出所":
  736. applyClickList();
  737. xrList(pcs);
  738. getPointPostAjax(pcs);
  739. break;
  740. case "出入境业务办理机构":
  741. applyClickList();
  742. xrList(crjywbljg);
  743. getPointPostAjax(crjywbljg);
  744. break;
  745. case "交通支大队":
  746. applyClickList();
  747. xrList(jtxljcdd);
  748. getPointPostAjax(jtxljcdd);
  749. break;
  750. case "交通违法处理机构":
  751. applyClickList();
  752. xrList(jtwfcljg);
  753. getPointPostAjax(jtwfcljg);
  754. break;
  755. case "交通事故处理机构":
  756. applyClickList();
  757. xrList(jtsgcljg);
  758. getPointPostAjax(jtsgcljg);
  759. break;
  760. case "车管所":
  761. applyClickList();
  762. xrList(cgs);
  763. getPointPostAjax(cgs);
  764. break;
  765. case "机动车检测场所":
  766. applyClickList();
  767. xrList(jdcjccs);
  768. getPointPostAjax(jdcjccs);
  769. break;
  770. case "驾驶人体检医院":
  771. applyClickList();
  772. xrList(jsrtjz);
  773. getPointPostAjax(jsrtjz);
  774. break;
  775. case "养老机构":
  776. applyClickList();
  777. xrList(ylfwjg);
  778. getPointPostAjax(ylfwjg);
  779. break;
  780. case "图书馆":
  781. applyClickList();
  782. xrList(tsg);
  783. getPointPostAjax(tsg);
  784. break;
  785. case "文化馆":
  786. applyClickList();
  787. xrList(whg);
  788. getPointPostAjax(whg);
  789. break;
  790. case "文管所":
  791. applyClickList();
  792. xrList(wgs);
  793. getPointPostAjax(wgs);
  794. break;
  795. case "公共体育馆":
  796. applyClickList();
  797. xrList(ggty);
  798. getPointPostAjax(ggty);
  799. break;
  800. case "旅游景点":
  801. applyClickList();
  802. xrList(jq);
  803. getPointPostAjax(jq);
  804. break;
  805. case "残疾人服务中心":
  806. applyClickList();
  807. xrList(cjrfwzx);
  808. getPointPostAjax(cjrfwzx);
  809. break;
  810. case "定点残疾人服务机构":
  811. applyClickList();
  812. xrList(ddcjrfwjg);
  813. getPointPostAjax(ddcjrfwjg);
  814. break;
  815. case "公证处":
  816. applyClickList();
  817. xrList(gzc);
  818. getPointPostAjax(gzc);
  819. break;
  820. case "司法鉴定机构":
  821. applyClickList();
  822. xrList(sfjdjg);
  823. getPointPostAjax(sfjdjg);
  824. break;
  825. case "基层司法所":
  826. applyClickList();
  827. xrList(jcfwfws);
  828. getPointPostAjax(jcfwfws);
  829. break;
  830. case "法律援助机构":
  831. applyClickList();
  832. xrList(flyzzx);
  833. getPointPostAjax(flyzzx);
  834. break;
  835. case "医疗保障事务中心":
  836. applyClickList();
  837. xrList(yb);
  838. getPointPostAjax(yb);
  839. break;
  840. case "生源地助学贷款办理点":
  841. applyClickList();
  842. xrList(dkbld);
  843. getPointPostAjax(dkbld);
  844. break;
  845. case "车驾管社会服务站":
  846. applyClickList();
  847. xrList(cjgshfwz);
  848. getPointPostAjax(cjgshfwz);
  849. break;
  850. case "教育考试中心":
  851. applyClickList();
  852. xrList(jykszx);
  853. getPointPostAjax(jykszx);
  854. break;
  855. case "区级政务服务中心":
  856. applyClickList();
  857. xrList(xzfwzx);
  858. getPointPostAjax(xzfwzx);
  859. break;
  860. case "矫正中心":
  861. applyClickList();
  862. xrList(jzzx);
  863. getPointPostAjax(jzzx);
  864. break;
  865. case "就业和人才中心":
  866. applyClickList();
  867. xrList(jyhrczx);
  868. getPointPostAjax(jyhrczx);
  869. break;
  870. case "社会保险事务中心":
  871. applyClickList();
  872. xrList(shbxswzx);
  873. getPointPostAjax(shbxswzx);
  874. break;
  875. case "商圈":
  876. applyClickList();
  877. xrList(sq);
  878. getPointPostAjax(sq);
  879. break;
  880. case "核酸采样点":
  881. applyClickList();
  882. xrList(hscyd);
  883. getPointPostAjax(hscyd);
  884. break;
  885. case "购物中心":
  886. applyClickList();
  887. xrList(gwzx);
  888. getPointPostAjax(gwzx);
  889. break;
  890. case "酒店":
  891. applyClickList();
  892. xrList(jd);
  893. getPointPostAjax(jd);
  894. break;
  895. }
  896. var getimgs = $(".pad_box").children(".titleFirst").find(".two_img");
  897. function callback(entries) {
  898. for (let i of entries) {
  899. if (i.isIntersecting) {
  900. let img = i.target;
  901. let trueSrc = img.getAttribute("data-src");
  902. img.setAttribute("src", trueSrc);
  903. observer.unobserve(img);
  904. }
  905. }
  906. }
  907. const observer = new IntersectionObserver(callback);
  908. for (let i of getimgs) {
  909. observer.observe(i);
  910. }
  911. lazyLoad();
  912. });
  913. function lazyLoad() {
  914. var startTime = "";
  915. var startDistanceY = "";
  916. var endTime = "";
  917. var endDistanceY = "";
  918. var moveTime = "";
  919. var moveDistanceY = "";
  920. var divs = document.querySelector(".wrap_result");
  921. divs.addEventListener("touchstart", function (e) {
  922. startTime = new Date().getTime();
  923. startDistanceY = e.touches[0].screenY;
  924. });
  925. divs.addEventListener("touchend", function (e) {
  926. endTime = new Date().getTime();
  927. endDistanceY = e.changedTouches[0].screenY;
  928. moveTime = endTime - startTime;
  929. moveDistanceY = startDistanceY - endDistanceY;
  930. });
  931. var ptHeight = $(".pad_box .titleFirst").outerHeight();
  932. if (Math.abs(moveDistanceY) > 40 && moveTime < 200) {
  933. $(".wrap_result").offset().top = ptHeight;
  934. }
  935. }
  936. $(".flex_box ul li").click(function () {
  937. var cyytext = $(this).find(".flex_text").text();
  938. indexList = 2;
  939. switch (cyytext) {
  940. case "产业园区":
  941. applyClickList();
  942. xrList(cyy);
  943. getPointPostAjax(cyy);
  944. break;
  945. case "停车泊车":
  946. applyClickList();
  947. xrList(tc);
  948. getPointPostAjax(tc);
  949. break;
  950. case "直饮水点":
  951. applyClickList();
  952. xrList(zysd);
  953. getPointPostAjax(zysd);
  954. break;
  955. case "劳动者港湾":
  956. applyClickList();
  957. xrList(ldzgw);
  958. getPointPostAjax(ldzgw);
  959. break;
  960. case "不动产登记":
  961. applyClickList();
  962. xrList(bdcdjzxbsdt);
  963. getPointPostAjax(bdcdjzxbsdt);
  964. break;
  965. case "便民公厕":
  966. applyClickList();
  967. xrList(gc);
  968. getPointPostAjax(gc);
  969. break;
  970. case "住房保障":
  971. applyClickList();
  972. xrList(fwglzx);
  973. getPointPostAjax(fwglzx);
  974. break;
  975. case "住房公积金":
  976. applyClickList();
  977. xrList(gjj);
  978. getPointPostAjax(gjj);
  979. break;
  980. case "办税服务":
  981. applyClickList();
  982. xrList(bsfwt);
  983. getPointPostAjax(bsfwt);
  984. break;
  985. case "核酸检测":
  986. applyClickList();
  987. xrList(hscyd);
  988. getPointPostAjax(hscyd);
  989. break;
  990. case "市场监管":
  991. applyClickList();
  992. xrList(scjdglj);
  993. getPointPostAjax(scjdglj);
  994. break;
  995. }
  996. });
  997. // 渲染列表
  998. function xrList(arr) {
  999. map.clearOverlays();
  1000. var sContnet = "";
  1001. var addFirst;
  1002. getAllArr = arr;
  1003. if (!arr) {
  1004. return;
  1005. } else {
  1006. for (var index = 0; index < arr.length; index++) {
  1007. var arrdep = arr[index].dep;
  1008. arraddre = arr[index].address;
  1009. var arrtype = arr[index].type;
  1010. var arrspecial = arr[index].specialtype;
  1011. var arrtag = arr[index].tag;
  1012. var arrtag2 = arr[index].tag2;
  1013. var arrtag3 = arr[index].tag3;
  1014. var arrcontent = arr[index].content;
  1015. var arrimg = arr[index].img;
  1016. var arrtel = arr[index].tel;
  1017. var arrtime = arr[index].time;
  1018. var arrsptype = arr[index].sptype;
  1019. sContnet +=
  1020. "<ul class='titleFirst'><div class='wrap_apply'><li class='title_flex'>";
  1021. sContnet += "<p style='width:100%'>" + arrdep + "</p>";
  1022. if (arrtype == "" || arrtype == undefined || arrtype == null) {
  1023. sContnet += "";
  1024. } else {
  1025. if (arrspecial == "中学") {
  1026. if (arrtype == "中学") {
  1027. sContnet += "";
  1028. } else {
  1029. sContnet += "<p class='flex_blue'>· " + arrtype + "</p>";
  1030. }
  1031. sContnet += "<p class='flex_blue'>· " + arrspecial + "</p>";
  1032. } else {
  1033. sContnet += "<p class='flex_blue'>· " + arrtype + "</p>";
  1034. }
  1035. }
  1036. sContnet += "</li>";
  1037. if (arrtag == "" || arrtag == undefined || arrtag == null) {
  1038. sContnet += "";
  1039. } else {
  1040. sContnet +=
  1041. "<li class='flex_orange'><div class='three_tag'>" + arrtag;
  1042. if (arrtag2 == undefined || arrtag2 == "" || arrtag2 == null) {
  1043. sContnet += "</div>";
  1044. } else {
  1045. sContnet += "</div><div class='three_tag'>" + arrtag2 + "</div>";
  1046. }
  1047. if (arrtag3 == undefined || arrtag3 == "" || arrtag3 == null) {
  1048. sContnet += "</li>";
  1049. } else {
  1050. sContnet += "<div class='three_tag'>" + arrtag3 + "</div></li>";
  1051. }
  1052. }
  1053. if (arrcontent == undefined || arrcontent == null || arrcontent == "") {
  1054. sContnet += "";
  1055. } else {
  1056. sContnet +=
  1057. "<li><a class='a_blue'><p class='content_p' style='overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;'>";
  1058. sContnet += arrcontent + "</p></a></li>";
  1059. }
  1060. if (arrimg == undefined || arrimg == null || arrimg == "") {
  1061. sContnet += "";
  1062. } else {
  1063. sContnet +=
  1064. "<li class='img_box'><img data-src='" +
  1065. PATH +
  1066. arrimg +
  1067. "' class='two_img' src='" +
  1068. PATH +
  1069. arrimg +
  1070. "'></li>";
  1071. }
  1072. sContnet +=
  1073. "<li class='address_box'><p><span class='flex_address'>地址:</span>" +
  1074. arraddre +
  1075. "</p>";
  1076. if (arrtime == "" || arrtime == undefined || arrtime == null) {
  1077. sContnet += "";
  1078. } else if (arrsptype == "查阅场所") {
  1079. sContnet +=
  1080. "<p><span class='flex_address'>查询时间:</span>" +
  1081. arrtime +
  1082. "</p>";
  1083. } else if (arrsptype == "受理场所") {
  1084. sContnet +=
  1085. "<p><span class='flex_address'>受理时间:</span>" +
  1086. arrtime +
  1087. "</p>";
  1088. } else if (arrsptype == "政务服务" || arrsptype == "办税服务") {
  1089. sContnet +=
  1090. "<p><span class='flex_address'>办理时间:</span>" +
  1091. arrtime +
  1092. "</p>";
  1093. } else {
  1094. sContnet +=
  1095. "<p><span class='flex_address'>办公时间:</span>" +
  1096. arrtime +
  1097. "</p>";
  1098. }
  1099. if (arrtel == "" || arrtel == undefined || arrtel == null) {
  1100. sContnet += "";
  1101. } else {
  1102. sContnet += "<p><span class='flex_address'>办公电话:</span>";
  1103. for (var i = 0; i < arrtel.split(";").length; i++) {
  1104. if (arrtel.split(";").length - i != 1) {
  1105. sContnet +=
  1106. "<a href='tel:" +
  1107. arrtel.split(";")[i] +
  1108. "' style='text-decoration:underline'>" +
  1109. arrtel.split(";")[i] +
  1110. "</a>;";
  1111. } else {
  1112. sContnet +=
  1113. "<a href='tel:" +
  1114. arrtel.split(";")[i] +
  1115. "' style='text-decoration:underline'>" +
  1116. arrtel.split(";")[i] +
  1117. "</a>";
  1118. }
  1119. }
  1120. sContnet += "</p>";
  1121. }
  1122. if (
  1123. arr[index].sptype == "受理场所" ||
  1124. arr[index].dep == "重庆市南岸区政务服务中心(江南新城中心)" ||
  1125. arr[index].dep == "重庆市南岸区政务服务中心(南坪中心)"
  1126. ) {
  1127. sContnet += " <div class='handle_business'>点击查看详情</div>";
  1128. } else if (
  1129. arrdep == "重庆市南岸区民政局婚姻登记处(茶园)" ||
  1130. arrdep == "重庆市南岸区民政局婚姻登记处(南坪)"
  1131. ) {
  1132. sContnet += " <div class='handle_business1'>点击查看详情</div>";
  1133. } else if (arrdep == "重庆市南岸区社会保险事务中心") {
  1134. sContnet += " <div class='handle_business2'>点击查看详情</div>";
  1135. } else {
  1136. sContnet += "<div class='detailCheck'>点击查看详情</div>";
  1137. }
  1138. sContnet += "</li></div><li class='btn_box'>";
  1139. sContnet +=
  1140. "<button class='one_bus'>公交</button><button class='two_car'>自驾</button>";
  1141. sContnet += "</li></ul>";
  1142. }
  1143. $(".show-fifth .pad_box").empty().append(sContnet);
  1144. $(".show-fourth .pad_box").empty().append(sContnet);
  1145. }
  1146. }
  1147. function xrList2(arr) {
  1148. map.clearOverlays();
  1149. var sContnet = "";
  1150. var addFirst;
  1151. if (!arr) {
  1152. return;
  1153. } else {
  1154. for (var index = 0; index < arr.length; index++) {
  1155. var arrdep = arr[index].dep;
  1156. arraddre = arr[index].address;
  1157. var arrtype = arr[index].type;
  1158. var arrspecial = arr[index].specialtype;
  1159. var arrtag = arr[index].tag;
  1160. var arrtag2 = arr[index].tag2;
  1161. var arrtag3 = arr[index].tag3;
  1162. var arrcontent = arr[index].content;
  1163. var arrimg = arr[index].img;
  1164. var arrtel = arr[index].tel;
  1165. var arrtime = arr[index].time;
  1166. var arrsptype = arr[index].sptype;
  1167. sContnet +=
  1168. "<ul class='titleFirst'><div class='wrap_apply'><li class='title_flex'>";
  1169. sContnet += "<p style='width:100%'>" + arrdep + "</p>";
  1170. if (arrtype == "" || arrtype == undefined || arrtype == null) {
  1171. sContnet += "";
  1172. } else {
  1173. if (arrspecial == "中学") {
  1174. if (arrtype == "中学") {
  1175. sContnet += "";
  1176. } else {
  1177. sContnet += "<p class='flex_blue'>· " + arrtype + "</p>";
  1178. }
  1179. sContnet += "<p class='flex_blue'>· " + arrspecial + "</p>";
  1180. } else {
  1181. sContnet += "<p class='flex_blue'>· " + arrtype + "</p>";
  1182. }
  1183. }
  1184. sContnet += "</li>";
  1185. if (arrtag == "" || arrtag == undefined || arrtag == null) {
  1186. sContnet += "";
  1187. } else {
  1188. sContnet +=
  1189. "<li class='flex_orange'><div class='three_tag'>" + arrtag;
  1190. if (arrtag2 == undefined || arrtag2 == "" || arrtag2 == null) {
  1191. sContnet += "</div>";
  1192. } else {
  1193. sContnet += "</div><div class='three_tag'>" + arrtag2 + "</div>";
  1194. }
  1195. if (arrtag3 == undefined || arrtag3 == "" || arrtag3 == null) {
  1196. sContnet += "</li>";
  1197. } else {
  1198. sContnet += "<div class='three_tag'>" + arrtag3 + "</div></li>";
  1199. }
  1200. }
  1201. if (arrcontent == undefined || arrcontent == null || arrcontent == "") {
  1202. sContnet += "";
  1203. } else {
  1204. sContnet +=
  1205. "<li><a class='a_blue'><p class='content_p' style='overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;'>";
  1206. sContnet += arrcontent + "</p></a></li>";
  1207. }
  1208. if (arrimg == undefined || arrimg == null || arrimg == "") {
  1209. sContnet += "";
  1210. } else {
  1211. sContnet +=
  1212. "<li class='img_box'><img data-src='" +
  1213. PATH +
  1214. arrimg +
  1215. "' class='two_img' src='" +
  1216. PATH +
  1217. arrimg +
  1218. "'></li>";
  1219. }
  1220. sContnet +=
  1221. "<li class='address_box'><p><span class='flex_address'>地址:</span>" +
  1222. arraddre +
  1223. "</p>";
  1224. if (arrtime == "" || arrtime == undefined || arrtime == null) {
  1225. sContnet += "";
  1226. } else if (arrsptype == "查阅场所") {
  1227. sContnet +=
  1228. "<p><span class='flex_address'>查询时间:</span>" +
  1229. arrtime +
  1230. "</p>";
  1231. } else if (arrsptype == "受理场所") {
  1232. sContnet +=
  1233. "<p><span class='flex_address'>受理时间:</span>" +
  1234. arrtime +
  1235. "</p>";
  1236. } else if (arrsptype == "政务服务" || arrsptype == "办税服务") {
  1237. sContnet +=
  1238. "<p><span class='flex_address'>办理时间:</span>" +
  1239. arrtime +
  1240. "</p>";
  1241. } else {
  1242. sContnet +=
  1243. "<p><span class='flex_address'>办公时间:</span>" +
  1244. arrtime +
  1245. "</p>";
  1246. }
  1247. if (arrtel == "" || arrtel == undefined || arrtel == null) {
  1248. sContnet += "";
  1249. } else {
  1250. sContnet += "<p><span class='flex_address'>办公电话:</span>";
  1251. for (var i = 0; i < arrtel.split(";").length; i++) {
  1252. if (arrtel.split(";").length - i != 1) {
  1253. sContnet +=
  1254. "<a href='tel:" +
  1255. arrtel.split(";")[i] +
  1256. "' style='text-decoration:underline'>" +
  1257. arrtel.split(";")[i] +
  1258. "</a>;";
  1259. } else {
  1260. sContnet +=
  1261. "<a href='tel:" +
  1262. arrtel.split(";")[i] +
  1263. "' style='text-decoration:underline'>" +
  1264. arrtel.split(";")[i] +
  1265. "</a>";
  1266. }
  1267. }
  1268. sContnet += "</p>";
  1269. }
  1270. if (
  1271. arr[index].sptype == "受理场所" ||
  1272. arr[index].dep == "重庆市南岸区政务服务中心(江南新城中心)" ||
  1273. arr[index].dep == "重庆市南岸区政务服务中心(南坪中心)"
  1274. ) {
  1275. sContnet +=
  1276. " <div class='handle_business' data-sign='isflag'>点击查看详情</div>";
  1277. } else if (
  1278. arrdep == "重庆市南岸区民政局婚姻登记处(茶园)" ||
  1279. arrdep == "重庆市南岸区民政局婚姻登记处(南坪)"
  1280. ) {
  1281. sContnet +=
  1282. " <div class='handle_business1' data-sign='isflag'>点击查看详情</div>";
  1283. } else if (arrdep == "重庆市南岸区社会保险事务中心") {
  1284. sContnet +=
  1285. " <div class='handle_business2' data-sign='isflag'>点击查看详情</div>";
  1286. } else {
  1287. sContnet += "<div class='detailCheck'>点击查看详情</div>";
  1288. }
  1289. sContnet += "</li></div><li class='btn_box'>";
  1290. sContnet +=
  1291. "<button class='one_bus'>公交</button><button class='two_car'>自驾</button>";
  1292. sContnet += "</li></ul>";
  1293. }
  1294. $(".show-fourth .result_form_ajax").empty().append(sContnet);
  1295. }
  1296. }
  1297. async function getPointPostAjax(arr) {
  1298. var dataString;
  1299. var mapList = [];
  1300. if (!arr) {
  1301. return;
  1302. } else {
  1303. for (var index = 0; index < arr.length; index++) {
  1304. arraddre = arr[index].address;
  1305. const tempAdd = arraddre;
  1306. await new Promise((resolve, reject) => {
  1307. myGeo.getPoint(
  1308. tempAdd,
  1309. function (point) {
  1310. if (point) {
  1311. var address = new BMap.Point(point.lng, point.lat);
  1312. var obj = {
  1313. id: arr[index].id,
  1314. longitude: address.lng,
  1315. latitude: address.lat,
  1316. };
  1317. mapList.push(obj);
  1318. resolve();
  1319. }
  1320. },
  1321. "重庆市"
  1322. );
  1323. });
  1324. }
  1325. }
  1326. dataString = JSON.stringify(mapList);
  1327. $.ajax({
  1328. type: "POST",
  1329. url: PATH + "/mapdata/longitudeLatitude",
  1330. // url: "http://192.168.0.230:7777/mapdata/longitudeLatitude",
  1331. async: false,
  1332. dataType: "json",
  1333. data: { dataString: dataString },
  1334. });
  1335. }
  1336. // 封装渲染列表
  1337. function xrResultList(arrey, isSign) {
  1338. $("#deptDiv2").empty();
  1339. $("#deptDiv2").prev().remove();
  1340. $(".wrap_handle").hide();
  1341. var discript = "";
  1342. $.each(arrey, function (i) {
  1343. discrptAddress = arrey[i].address;
  1344. discript += "<ul class='titleFirst'>";
  1345. discript += "<div class='wrap_apply'>";
  1346. discript += "<li class='title_flex'>";
  1347. discript += "<p style='width:100%'>";
  1348. discript += arrey[i].dep;
  1349. discript += "</p>";
  1350. if (
  1351. arrey[i].type == "" ||
  1352. arrey[i].type == undefined ||
  1353. arrey[i].type == null
  1354. ) {
  1355. discript += "";
  1356. } else {
  1357. if (arrey[i].specialtype == "中学") {
  1358. if (arrey[i].type == "中学") {
  1359. discript += "";
  1360. } else {
  1361. discript += "<p class='flex_blue'>· ";
  1362. discript += arrey[i].type;
  1363. discript += "</p>";
  1364. }
  1365. discript += "<p class='flex_blue'>· ";
  1366. discript += arrey[i].specialtype;
  1367. discript += "</p>";
  1368. } else {
  1369. discript += "<p class='flex_blue'>· ";
  1370. discript += arrey[i].type;
  1371. discript += "</p>";
  1372. }
  1373. discript += "</li>";
  1374. }
  1375. if (
  1376. arrey[i].tag == undefined ||
  1377. arrey[i].tag == "" ||
  1378. arrey[i].tag == null
  1379. ) {
  1380. discript += "";
  1381. } else {
  1382. discript += "<li class='flex_orange'>";
  1383. discript += "<div class='three_tag'>";
  1384. discript += arrey[i].tag;
  1385. discript += "</div>";
  1386. if (
  1387. arrey[i].tag2 == undefined ||
  1388. arrey[i].tag2 == "" ||
  1389. arrey[i].tag2 == null
  1390. ) {
  1391. discript += "";
  1392. } else {
  1393. discript += "<div class='three_tag'>";
  1394. discript += arrey[i].tag2;
  1395. discript += "</div>";
  1396. }
  1397. if (
  1398. arrey[i].tag3 == undefined ||
  1399. arrey[i].tag3 == "" ||
  1400. arrey[i].tag3 == null
  1401. ) {
  1402. discript += "";
  1403. } else {
  1404. discript += "<div class='three_tag'>";
  1405. discript += arrey[i].tag3;
  1406. discript += "</div>";
  1407. }
  1408. }
  1409. discript += "<li>";
  1410. if (
  1411. arrey[i].content == "" ||
  1412. arrey[i].content == undefined ||
  1413. arrey[i].content == null
  1414. ) {
  1415. discript += "";
  1416. } else {
  1417. discript += "<a class='a_blue'>";
  1418. discript += "<p class='content_p'>";
  1419. discript += arrey[i].content;
  1420. discript += "</p>";
  1421. discript += "</a>";
  1422. }
  1423. discript += "</li>";
  1424. discript += "<li class='img_box'>";
  1425. if (
  1426. arrey[i].img == "" ||
  1427. arrey[i].img == undefined ||
  1428. arrey[i].img == null
  1429. ) {
  1430. discript += "";
  1431. } else {
  1432. discript +=
  1433. "<img data-src='" +
  1434. PATH +
  1435. arrey[i].img +
  1436. "' class='two_img' src='" +
  1437. PATH +
  1438. arrey[i].img +
  1439. "'>";
  1440. }
  1441. discript += "</li>";
  1442. discript += "<li class='address_box'>";
  1443. discript += "<p><span class='flex_address'>地址:</span>";
  1444. discript += arrey[i].address;
  1445. discript += "</p>";
  1446. if (
  1447. arrey[i].time == "" ||
  1448. arrey[i].time == undefined ||
  1449. arrey[i].time == null
  1450. ) {
  1451. discript += "";
  1452. } else if (arrey[i].sptype == "查阅场所") {
  1453. discript += "<p><span class='flex_address'>查询时间:</span>";
  1454. discript += arrey[i].time;
  1455. discript += "</p>";
  1456. } else if (arrey[i].sptype == "受理场所") {
  1457. discript += "<p><span class='flex_address'>受理时间:</span>";
  1458. discript += arrey[i].time;
  1459. discript += "</p>";
  1460. } else if (
  1461. arrey[i].sptype == "政务服务" ||
  1462. arrey[i].sptype == "办税服务"
  1463. ) {
  1464. discript += "<p><span class='flex_address'>办理时间:</span>";
  1465. discript += arrey[i].time;
  1466. discript += "</p>";
  1467. } else {
  1468. discript += "<p><span class='flex_address'>办公时间:</span>";
  1469. discript += arrey[i].time;
  1470. discript += "</p>";
  1471. }
  1472. if (
  1473. arrey[i].tel == "" ||
  1474. arrey[i].tel == undefined ||
  1475. arrey[i].tel == null
  1476. ) {
  1477. discript += "";
  1478. } else {
  1479. var discriptone_tel = arrey[i].tel.split(";")[0];
  1480. var discripttwo_tel = arrey[i].tel.split(";")[1];
  1481. var discripthree_tel = arrey[i].tel.split(";")[2];
  1482. var discriptfour_tel = arrey[i].tel.split(";")[3];
  1483. discript += "<p><span class='flex_address'>办公电话:</span>";
  1484. discript +=
  1485. "<a href='tel:" +
  1486. discriptone_tel +
  1487. "' style='color: #2775CC;text-decoration:underline'>" +
  1488. discriptone_tel +
  1489. "</a>";
  1490. if (discripttwo_tel == undefined) {
  1491. discript += "";
  1492. } else {
  1493. discript +=
  1494. ";<a href='tel:" +
  1495. discripttwo_tel +
  1496. "' style='color: #2775CC;text-decoration:underline'>" +
  1497. discripttwo_tel +
  1498. "</a>";
  1499. }
  1500. if (discripthree_tel == undefined) {
  1501. discript += "";
  1502. } else {
  1503. discript +=
  1504. ";<a href='tel:" +
  1505. discripthree_tel +
  1506. "' style='color: #2775CC;text-decoration:underline'>" +
  1507. discripthree_tel +
  1508. "</a>";
  1509. }
  1510. if (discriptfour_tel == undefined) {
  1511. discript += "";
  1512. } else {
  1513. discript +=
  1514. ";<a href='tel:" +
  1515. discriptfour_tel +
  1516. "' style='color: #2775CC;text-decoration:underline'>" +
  1517. discriptfour_tel +
  1518. "</a>";
  1519. }
  1520. discript += "</p>";
  1521. }
  1522. discript += "</li>";
  1523. discript += "</div>";
  1524. discript += "<li class='btn_box'>";
  1525. discript += "<button class='one_bus'>公交</button>";
  1526. discript += "<button class='two_car'>自驾</button>";
  1527. discript += "</li>";
  1528. discript += "</ul>";
  1529. });
  1530. $(".pad_box").empty().append(discript);
  1531. if (isSign == "isShowAddress") {
  1532. $(".pad_box").attr("sign", "isShowAddress");
  1533. } else {
  1534. $(".pad_box").attr("sign", "");
  1535. }
  1536. }
  1537. // 点击列表之一,中心重新渲染
  1538. $(document).on("click", ".detailCheck", async function () {
  1539. $(".show-fourth").hide();
  1540. $(".content_from_ajax3").parent().removeClass("layui-hide");
  1541. var addText = $(this).parent(".address_box").find("p:nth-child(1)").text();
  1542. var discriptText = addText.split(":")[1];
  1543. var addFirst;
  1544. scrollListHeight = $(".wrap_result").scrollTop();
  1545. scrollListHeight1 = $(".wrap_result1").scrollTop();
  1546. await new Promise((resolve, reject) => {
  1547. myGeo.getPoint(
  1548. discriptText,
  1549. function (point) {
  1550. if (point) {
  1551. var address = new BMap.Point(point.lng, point.lat);
  1552. addFirst = address;
  1553. let getClick = getAllArr.filter((i) => {
  1554. return i.address == discriptText;
  1555. });
  1556. applyClickList();
  1557. $(".right-search").hide().css("top", "0px");
  1558. $(".top_search").hide();
  1559. for (let i = 0; i < getClick.length; i++) {
  1560. for (let j = i + 1; j < getClick.length; j++) {
  1561. if (getClick[j].dep === getClick[i].dep) {
  1562. getClick.splice(j, 1);
  1563. }
  1564. }
  1565. }
  1566. xrResultList(getClick);
  1567. if (discriptText == discrptAddress) {
  1568. addMarker(getClick, address);
  1569. }
  1570. $(".content_from_ajax3 .layui-tab-title li").eq(0).click();
  1571. indexList = 1;
  1572. ssList = 1;
  1573. map.setCenter(addFirst);
  1574. resolve();
  1575. }
  1576. },
  1577. "重庆市"
  1578. );
  1579. });
  1580. });
  1581. $(document).on("click", "#deptDiv div", function () {
  1582. $("#deptDiv div")
  1583. .removeClass("layui-border-green")
  1584. .addClass("layui-border-blue");
  1585. $(this).removeClass("layui-border-blue").addClass("layui-border-green");
  1586. var firstpage = 1;
  1587. var pagetype = 0;
  1588. let dep = $(this).attr("data-dep");
  1589. if ($(this).text().trim() == "全部") {
  1590. dep = $(this).parent().prev().prev().attr("data-dep");
  1591. }
  1592. page(firstpage, pagetype, dep);
  1593. function page(page, pagetype, dep) {
  1594. $.ajax({
  1595. type: "GET",
  1596. url: PATH + "/mapdata/getHandMatterPage",
  1597. // url: "http://192.168.0.230:7777/mapdata/getHandMatterPage",
  1598. async: false,
  1599. dataType: "json",
  1600. data: {
  1601. page: page,
  1602. limit: 4,
  1603. type: pagetype,
  1604. matterDept: dep,
  1605. },
  1606. success: function (res) {
  1607. if (res.data == null) {
  1608. applyClickList();
  1609. $(".show-sixth").fadeOut(0);
  1610. $(".show-fifth").fadeIn(100);
  1611. indexList = 1;
  1612. } else if (res.data != null) {
  1613. var rmHeight =
  1614. window.outerHeight -
  1615. $(".right-map").innerHeight() -
  1616. $(".head").innerHeight();
  1617. $(".show-sixth").show().css("height", rmHeight).siblings().hide();
  1618. $(".wrap_handle").show();
  1619. count = res.count;
  1620. var html = "";
  1621. $.each(res.data, function (j) {
  1622. if (
  1623. res.data[j].itemName == undefined &&
  1624. res.data[j].matterUrl == undefined &&
  1625. res.data[j].matterDept == undefined
  1626. ) {
  1627. html += "";
  1628. } else {
  1629. html +=
  1630. "<a href='" +
  1631. res.data[j].matterUrl +
  1632. "' target='_blank' class='url_from_ajax'>";
  1633. html += "<h6 class='point_from_ajax'></h6>";
  1634. html +=
  1635. "<p title='" +
  1636. res.data[j].itemName +
  1637. "' class='text_from_ajax'>" +
  1638. res.data[j].itemName +
  1639. "</p>";
  1640. html += "</a>";
  1641. }
  1642. });
  1643. $(".layui-show .result_form_ajax").empty().append(html);
  1644. }
  1645. },
  1646. });
  1647. }
  1648. layui.use(["laypage", "layer"], function () {
  1649. var laypage = layui.laypage,
  1650. layer = layui.layer;
  1651. laypage.render({
  1652. elem: "demo",
  1653. count: count,
  1654. limit: 4,
  1655. layout: ["prev", "next"],
  1656. prev: '<i class="layui-icon layui-icon-left"></i><span>上一页</span>',
  1657. next: '<span>下一页</span><i class="layui-icon layui-icon-right"></i>',
  1658. jump: function (obj, first) {
  1659. pagetype = 0;
  1660. page(obj.curr, pagetype, dep);
  1661. },
  1662. });
  1663. });
  1664. blList = 1;
  1665. });
  1666. $(document).on("click", ".handle_business", async function () {
  1667. var dep = $(this)
  1668. .parents(".address_box")
  1669. .siblings(".title_flex")
  1670. .children("p")
  1671. .text();
  1672. $(".content_from_ajax .layui-tab-title")
  1673. .find(".layui-this")
  1674. .attr("id", dep);
  1675. $(".content_from_ajax").show().siblings(".marrige").hide();
  1676. var addText = $(this).parent(".address_box").find("p:nth-child(1)").text();
  1677. var discriptText = addText.split(":")[1];
  1678. var addFirst, count;
  1679. var firstpage = 1;
  1680. var pagetype = 0;
  1681. scrollListHeight = $(".wrap_result").scrollTop();
  1682. const sign = $(this).attr("data-sign");
  1683. await new Promise((resolve, reject) => {
  1684. myGeo.getPoint(
  1685. discriptText,
  1686. function (point) {
  1687. if (point) {
  1688. var address = new BMap.Point(point.lng, point.lat);
  1689. addFirst = address;
  1690. let getClick = getAllArr.filter((i) => {
  1691. return i.address == discriptText;
  1692. });
  1693. $(".right-search").hide().css("top", "0px");
  1694. $(".top_search").hide();
  1695. for (let i = 0; i < getClick.length; i++) {
  1696. for (let j = i + 1; j < getClick.length; j++) {
  1697. if (getClick[j].dep === getClick[i].dep) {
  1698. getClick.splice(j, 1);
  1699. }
  1700. }
  1701. }
  1702. if ($("#deptDiv").prev().hasClass("isDel")) {
  1703. $("#deptDiv").prev().remove();
  1704. $("#deptDiv").empty();
  1705. }
  1706. if (sign == "isflag") {
  1707. getClick = digitGroupItem.filter((i) => {
  1708. return i.address == discriptText;
  1709. });
  1710. if (getClick[0].searchDept) {
  1711. dep = getClick[0].searchDept.join(",");
  1712. $(".show-sixth .pad_box").attr("data-dep", dep);
  1713. let html =
  1714. '<div class="layui-border-green dept-sty" data-dep="">全部</div>';
  1715. for (let n = 0; n < getClick[0].searchDept.length; n++) {
  1716. html += `<div class="layui-border-blue dept-sty" data-dep="${
  1717. getClick[0].searchDept[n]
  1718. }">
  1719. ${getClick[0].searchDept[n].replace("重庆市", "").replace("南岸", "")}</div>`;
  1720. }
  1721. $("#deptDiv").empty().append(html);
  1722. $("#deptDiv").before(
  1723. `<div class="isDel" style="background: #fff;font-size: 20px;padding-left: 20px;">入驻部门</div>`
  1724. );
  1725. }
  1726. } else {
  1727. if (deptArr[dep]) {
  1728. dep = deptArr[dep].join(",");
  1729. $(".show-sixth .pad_box").attr("data-dep", dep);
  1730. let html =
  1731. '<div class="layui-border-green dept-sty" data-dep="">全部</div>';
  1732. let depArr = dep.split(",");
  1733. for (let n = 0; n < depArr.length; n++) {
  1734. html += `<div class="layui-border-blue dept-sty" data-dep="${
  1735. depArr[n]
  1736. }">
  1737. ${depArr[n].replace("重庆市", "").replace("南岸", "")}</div>`;
  1738. }
  1739. $("#deptDiv").empty().append(html);
  1740. $("#deptDiv").before(
  1741. `<div class="isDel" style="background: #fff;font-size: 20px;padding-left: 20px;">入驻部门</div>`
  1742. );
  1743. }
  1744. }
  1745. page(getClick, firstpage, pagetype, dep);
  1746. function page(getClick, page, pagetype, dep) {
  1747. $.ajax({
  1748. type: "GET",
  1749. url: PATH + "/mapdata/getHandMatterPage",
  1750. // url: "http://192.168.0.230:7777/mapdata/getHandMatterPage",
  1751. async: false,
  1752. dataType: "json",
  1753. data: {
  1754. page: page,
  1755. limit: 4,
  1756. type: pagetype,
  1757. matterDept: dep,
  1758. },
  1759. success: function (res) {
  1760. if (res.data == null) {
  1761. applyClickList();
  1762. $(".show-sixth").fadeOut(0);
  1763. $(".show-fifth").fadeIn(100);
  1764. xrResultList(getClick);
  1765. indexList = 1;
  1766. } else if (res.data != null) {
  1767. var rmHeight =
  1768. window.outerHeight -
  1769. $(".right-map").innerHeight() -
  1770. $(".head").innerHeight();
  1771. $(".show-sixth")
  1772. .show()
  1773. .css("height", rmHeight)
  1774. .siblings()
  1775. .hide();
  1776. $(".wrap_handle").show();
  1777. count = res.count;
  1778. var discript = "";
  1779. var html = "";
  1780. $.each(getClick, function (i) {
  1781. discrptAddress = getClick[i].address;
  1782. discript += "<ul class='titleFirst'>";
  1783. discript += "<div class='wrap_apply'>";
  1784. discript += "<li class='title_flex'>";
  1785. discript += "<p style='width:100%'>";
  1786. discript += getClick[i].dep;
  1787. discript += "</p>";
  1788. if (
  1789. getClick[i].type == "" ||
  1790. getClick[i].type == undefined ||
  1791. getClick[i].type == null
  1792. ) {
  1793. discript += "";
  1794. } else {
  1795. if (getClick[i].specialtype == "中学") {
  1796. if (getClick[i].type == "中学") {
  1797. discript += "";
  1798. } else {
  1799. discript += "<p class='flex_blue'>· ";
  1800. discript += getClick[i].type;
  1801. discript += "</p>";
  1802. }
  1803. discript += "<p class='flex_blue'>· ";
  1804. discript += getClick[i].specialtype;
  1805. discript += "</p>";
  1806. } else {
  1807. discript += "<p class='flex_blue'>· ";
  1808. discript += getClick[i].type;
  1809. discript += "</p>";
  1810. }
  1811. discript += "</li>";
  1812. }
  1813. if (
  1814. getClick[i].tag == undefined ||
  1815. getClick[i].tag == "" ||
  1816. getClick[i].tag == null
  1817. ) {
  1818. discript += "";
  1819. } else {
  1820. discript += "<li class='flex_orange'>";
  1821. discript += "<div class='three_tag'>";
  1822. discript += getClick[i].tag;
  1823. discript += "</div>";
  1824. if (
  1825. getClick[i].tag2 == undefined ||
  1826. getClick[i].tag2 == ""
  1827. ) {
  1828. discript += "";
  1829. } else {
  1830. discript += "<div class='three_tag'>";
  1831. discript += getClick[i].tag2;
  1832. discript += "</div>";
  1833. }
  1834. if (
  1835. getClick[i].tag3 == undefined ||
  1836. getClick[i].tag3 == ""
  1837. ) {
  1838. discript += "";
  1839. } else {
  1840. discript += "<div class='three_tag'>";
  1841. discript += getClick[i].tag3;
  1842. discript += "</div>";
  1843. }
  1844. }
  1845. discript += "<li>";
  1846. if (
  1847. getClick[i].content == undefined ||
  1848. getClick[i].content == null ||
  1849. getClick[i].content == ""
  1850. ) {
  1851. discript += "";
  1852. } else {
  1853. discript += "<a class='a_blue'>";
  1854. discript += "<p class='content_p'>";
  1855. discript += getClick[i].content;
  1856. discript += "</p>";
  1857. discript += "</a>";
  1858. }
  1859. discript += "</li>";
  1860. discript += "<li class='img_box'>";
  1861. if (
  1862. getClick[i].img == undefined ||
  1863. getClick[i].img == null ||
  1864. getClick[i].img == ""
  1865. ) {
  1866. discript += "";
  1867. } else {
  1868. discript +=
  1869. "<img data-src='" +
  1870. PATH +
  1871. getClick[i].img +
  1872. "' class='two_img' src='" +
  1873. PATH +
  1874. getClick[i].img +
  1875. "'>";
  1876. }
  1877. discript += "</li>";
  1878. discript += "<li class='address_box'>";
  1879. discript += "<p><span class='flex_address'>地址:</span>";
  1880. discript += getClick[i].address;
  1881. discript += "</p>";
  1882. if (
  1883. getClick[i].time == "" ||
  1884. getClick[i].time == undefined ||
  1885. getClick[i].time == null
  1886. ) {
  1887. discript += "";
  1888. } else if (getClick[i].sptype == "查阅场所") {
  1889. discript +=
  1890. "<p><span class='flex_address'>查询时间:</span>";
  1891. discript += getClick[i].time;
  1892. discript += "</p>";
  1893. } else if (getClick[i].sptype == "受理场所") {
  1894. discript +=
  1895. "<p><span class='flex_address'>受理时间:</span>";
  1896. discript += getClick[i].time;
  1897. discript += "</p>";
  1898. } else if (
  1899. getClick[i].sptype == "政务服务" ||
  1900. getClick[i].sptype == "办税服务"
  1901. ) {
  1902. discript +=
  1903. "<p><span class='flex_address'>办理时间:</span>";
  1904. discript += getClick[i].time;
  1905. discript += "</p>";
  1906. } else {
  1907. discript +=
  1908. "<p><span class='flex_address'>办公时间:</span>";
  1909. discript += getClick[i].time;
  1910. discript += "</p>";
  1911. }
  1912. if (
  1913. getClick[i].tel == "" ||
  1914. getClick[i].tel == undefined ||
  1915. getClick[i].tel == null
  1916. ) {
  1917. discript += "";
  1918. } else {
  1919. var discriptone_tel = getClick[i].tel.split(";")[0];
  1920. var discripttwo_tel = getClick[i].tel.split(";")[1];
  1921. var discripthree_tel = getClick[i].tel.split(";")[2];
  1922. var discriptfour_tel = getClick[i].tel.split(";")[3];
  1923. discript +=
  1924. "<p><span class='flex_address'>办公电话:</span>";
  1925. discript +=
  1926. "<a href='tel:" +
  1927. discriptone_tel +
  1928. "' style='color: #2775CC;text-decoration:underline'>" +
  1929. discriptone_tel +
  1930. "</a>";
  1931. if (discripttwo_tel == undefined) {
  1932. discript += "";
  1933. } else {
  1934. discript +=
  1935. ";<a href='tel:" +
  1936. discripttwo_tel +
  1937. "' style='color: #2775CC;text-decoration:underline'>" +
  1938. discripttwo_tel +
  1939. "</a>";
  1940. }
  1941. if (discripthree_tel == undefined) {
  1942. discript += "";
  1943. } else {
  1944. discript +=
  1945. ";<a href='tel:" +
  1946. discripthree_tel +
  1947. "' style='color: #2775CC;text-decoration:underline'>" +
  1948. discripthree_tel +
  1949. "</a>";
  1950. }
  1951. if (discriptfour_tel == undefined) {
  1952. discript += "";
  1953. } else {
  1954. discript +=
  1955. ";<a href='tel:" +
  1956. discriptfour_tel +
  1957. "' style='color: #2775CC;text-decoration:underline'>" +
  1958. discriptfour_tel +
  1959. "</a>";
  1960. }
  1961. discript += "</p>";
  1962. }
  1963. discript += "</li>";
  1964. discript += "</div>";
  1965. discript += "<li class='btn_box'>";
  1966. discript += "<button class='one_bus'>公交</button>";
  1967. discript += "<button class='two_car'>自驾</button>";
  1968. discript += "</li>";
  1969. discript += "</ul>";
  1970. $.each(res.data, function (j) {
  1971. if (
  1972. res.data[j].itemName == undefined &&
  1973. res.data[j].matterUrl == undefined &&
  1974. res.data[j].matterDept == undefined
  1975. ) {
  1976. html += "";
  1977. } else {
  1978. html +=
  1979. "<a href='" +
  1980. res.data[j].matterUrl +
  1981. "' target='_blank' class='url_from_ajax'>";
  1982. html += "<h6 class='point_from_ajax'></h6>";
  1983. html +=
  1984. "<p title='" +
  1985. res.data[j].itemName +
  1986. "' class='text_from_ajax'>" +
  1987. res.data[j].itemName +
  1988. "</p>";
  1989. html += "</a>";
  1990. }
  1991. });
  1992. });
  1993. $(".layui-show .result_form_ajax").empty().append(html);
  1994. $(".show-sixth .pad_box").empty().append(discript);
  1995. }
  1996. },
  1997. });
  1998. // if (discriptText == discrptAddress) {
  1999. // }
  2000. }
  2001. layui.use(["laypage", "layer"], function () {
  2002. var laypage = layui.laypage,
  2003. layer = layui.layer;
  2004. laypage.render({
  2005. elem: "demo",
  2006. count: count,
  2007. limit: 4,
  2008. layout: ["prev", "next"],
  2009. prev: '<i class="layui-icon layui-icon-left"></i><span>上一页</span>',
  2010. next: '<span>下一页</span><i class="layui-icon layui-icon-right"></i>',
  2011. jump: function (obj, first) {
  2012. pagetype = 0;
  2013. page(getClick, obj.curr, pagetype, dep);
  2014. },
  2015. });
  2016. });
  2017. blList = 1;
  2018. addMarker(getClick, address);
  2019. map.setCenter(addFirst);
  2020. resolve();
  2021. }
  2022. },
  2023. "重庆市"
  2024. );
  2025. });
  2026. });
  2027. $(document).on("click", ".handle_business1", async function () {
  2028. var rmHeight =
  2029. window.outerHeight -
  2030. $(".right-map").innerHeight() -
  2031. $(".head").innerHeight();
  2032. $(".show-sixth").show().css("height", rmHeight).siblings().hide();
  2033. $(".wrap_handle").show();
  2034. $(".content_from_ajax").hide().siblings(".marrige").show();
  2035. var addText = $(this).parent(".address_box").find("p:nth-child(1)").text();
  2036. var discriptText = addText.split(":")[1];
  2037. var addFirst, count;
  2038. var firstpage = 1;
  2039. var pagetype = 3;
  2040. scrollListHeight = $(".wrap_result").scrollTop();
  2041. const sign = $(this).attr("data-sign");
  2042. await new Promise((resolve, reject) => {
  2043. myGeo.getPoint(
  2044. discriptText,
  2045. function (point) {
  2046. if (point) {
  2047. var address = new BMap.Point(point.lng, point.lat);
  2048. addFirst = address;
  2049. let getClick = getAllArr.filter((i) => {
  2050. return i.address == discriptText;
  2051. });
  2052. $(".right-search").hide().css("top", "0px");
  2053. $(".top_search").hide();
  2054. for (let i = 0; i < getClick.length; i++) {
  2055. for (let j = i + 1; j < getClick.length; j++) {
  2056. if (getClick[j].dep === getClick[i].dep) {
  2057. getClick.splice(j, 1);
  2058. }
  2059. }
  2060. }
  2061. if (sign == "isflag") {
  2062. getClick = digitGroupItem.filter((i) => {
  2063. return i.address == discriptText;
  2064. });
  2065. }
  2066. page(getClick, firstpage, pagetype);
  2067. function page(getClick, page, pagetype) {
  2068. $.ajax({
  2069. type: "GET",
  2070. url: PATH + "/mapdata/getHandMatterPage",
  2071. // url: "http://192.168.0.40:7777/mapdata/getHandMatterPage",
  2072. async: false,
  2073. dataType: "json",
  2074. data: {
  2075. page: page,
  2076. limit: 4,
  2077. type: pagetype,
  2078. },
  2079. success: function (res) {
  2080. if (res.data != null) {
  2081. count = res.count;
  2082. var discript = "";
  2083. var html = "";
  2084. $.each(getClick, function (i) {
  2085. discrptAddress = getClick[i].address;
  2086. discript += "<ul class='titleFirst'>";
  2087. discript += "<div class='wrap_apply'>";
  2088. discript += "<li class='title_flex'>";
  2089. discript += "<p style='width:100%'>";
  2090. discript += getClick[i].dep;
  2091. discript += "</p>";
  2092. if (
  2093. getClick[i].type == "" ||
  2094. getClick[i].type == undefined ||
  2095. getClick[i].type == null
  2096. ) {
  2097. discript += "";
  2098. } else {
  2099. if (getClick[i].specialtype == "中学") {
  2100. if (getClick[i].type == "中学") {
  2101. discript += "";
  2102. } else {
  2103. discript += "<p class='flex_blue'>· ";
  2104. discript += getClick[i].type;
  2105. discript += "</p>";
  2106. }
  2107. discript += "<p class='flex_blue'>· ";
  2108. discript += getClick[i].specialtype;
  2109. discript += "</p>";
  2110. } else {
  2111. discript += "<p class='flex_blue'>· ";
  2112. discript += getClick[i].type;
  2113. discript += "</p>";
  2114. }
  2115. discript += "</li>";
  2116. }
  2117. if (
  2118. getClick[i].tag == undefined ||
  2119. getClick[i].tag == "" ||
  2120. getClick[i].tag == null
  2121. ) {
  2122. discript += "";
  2123. } else {
  2124. discript += "<li class='flex_orange'>";
  2125. discript += "<div class='three_tag'>";
  2126. discript += getClick[i].tag;
  2127. discript += "</div>";
  2128. if (
  2129. getClick[i].tag2 == undefined ||
  2130. getClick[i].tag2 == ""
  2131. ) {
  2132. discript += "";
  2133. } else {
  2134. discript += "<div class='three_tag'>";
  2135. discript += getClick[i].tag2;
  2136. discript += "</div>";
  2137. }
  2138. if (
  2139. getClick[i].tag3 == undefined ||
  2140. getClick[i].tag3 == ""
  2141. ) {
  2142. discript += "";
  2143. } else {
  2144. discript += "<div class='three_tag'>";
  2145. discript += getClick[i].tag3;
  2146. discript += "</div>";
  2147. }
  2148. }
  2149. discript += "<li>";
  2150. if (
  2151. getClick[i].content == "" ||
  2152. getClick[i].content == undefined ||
  2153. getClick[i].content == null
  2154. ) {
  2155. discript += "";
  2156. } else {
  2157. discript += "<a class='a_blue'>";
  2158. discript += "<p class='content_p'>";
  2159. discript += getClick[i].content;
  2160. discript += "</p>";
  2161. discript += "</a>";
  2162. }
  2163. discript += "</li>";
  2164. discript += "<li class='img_box'>";
  2165. if (
  2166. getClick[i].img == "" ||
  2167. getClick[i].img == undefined ||
  2168. getClick[i].img == null
  2169. ) {
  2170. discript += "";
  2171. } else {
  2172. discript +=
  2173. "<img data-src='" +
  2174. PATH +
  2175. getClick[i].img +
  2176. "' class='two_img' src='" +
  2177. PATH +
  2178. getClick[i].img +
  2179. "'>";
  2180. }
  2181. discript += "</li>";
  2182. discript += "<li class='address_box'>";
  2183. discript += "<p><span class='flex_address'>地址:</span>";
  2184. discript += getClick[i].address;
  2185. discript += "</p>";
  2186. if (
  2187. getClick[i].time == "" ||
  2188. getClick[i].time == undefined ||
  2189. getClick[i].time == null
  2190. ) {
  2191. discript += "";
  2192. } else if (getClick[i].sptype == "查阅场所") {
  2193. discript +=
  2194. "<p><span class='flex_address'>查询时间:</span>";
  2195. discript += getClick[i].time;
  2196. discript += "</p>";
  2197. } else if (getClick[i].sptype == "受理场所") {
  2198. discript +=
  2199. "<p><span class='flex_address'>受理时间:</span>";
  2200. discript += getClick[i].time;
  2201. discript += "</p>";
  2202. } else if (
  2203. getClick[i].sptype == "政务服务" ||
  2204. getClick[i].sptype == "办税服务"
  2205. ) {
  2206. discript +=
  2207. "<p><span class='flex_address'>办理时间:</span>";
  2208. discript += getClick[i].time;
  2209. discript += "</p>";
  2210. } else {
  2211. discript +=
  2212. "<p><span class='flex_address'>办公时间:</span>";
  2213. discript += getClick[i].time;
  2214. discript += "</p>";
  2215. }
  2216. if (
  2217. getClick[i].tel == "" ||
  2218. getClick[i].tel == undefined ||
  2219. getClick[i].tel == null
  2220. ) {
  2221. discript += "";
  2222. } else {
  2223. var discriptone_tel = getClick[i].tel.split(";")[0];
  2224. var discripttwo_tel = getClick[i].tel.split(";")[1];
  2225. var discripthree_tel = getClick[i].tel.split(";")[2];
  2226. var discriptfour_tel = getClick[i].tel.split(";")[3];
  2227. discript +=
  2228. "<p><span class='flex_address'>办公电话:</span>";
  2229. discript +=
  2230. "<a href='tel:" +
  2231. discriptone_tel +
  2232. "' style='color: #2775CC;text-decoration:underline'>" +
  2233. discriptone_tel +
  2234. "</a>";
  2235. if (discripttwo_tel == undefined) {
  2236. discript += "";
  2237. } else {
  2238. discript +=
  2239. ";<a href='tel:" +
  2240. discripttwo_tel +
  2241. "' style='color: #2775CC;text-decoration:underline'>" +
  2242. discripttwo_tel +
  2243. "</a>";
  2244. }
  2245. if (discripthree_tel == undefined) {
  2246. discript += "";
  2247. } else {
  2248. discript +=
  2249. ";<a href='tel:" +
  2250. discripthree_tel +
  2251. "' style='color: #2775CC;text-decoration:underline'>" +
  2252. discripthree_tel +
  2253. "</a>";
  2254. }
  2255. if (discriptfour_tel == undefined) {
  2256. discript += "";
  2257. } else {
  2258. discript +=
  2259. ";<a href='tel:" +
  2260. discriptfour_tel +
  2261. "' style='color: #2775CC;text-decoration:underline'>" +
  2262. discriptfour_tel +
  2263. "</a>";
  2264. }
  2265. discript += "</p>";
  2266. }
  2267. discript += "</li>";
  2268. discript += "</div>";
  2269. discript += "<li class='btn_box'>";
  2270. discript += "<button class='one_bus'>公交</button>";
  2271. discript += "<button class='two_car'>自驾</button>";
  2272. discript += "</li>";
  2273. discript += "</ul>";
  2274. $.each(res.data, function (j) {
  2275. if (
  2276. res.data[j].itemName == undefined &&
  2277. res.data[j].matterUrl == undefined &&
  2278. res.data[j].matterDept == undefined
  2279. ) {
  2280. html += "";
  2281. } else {
  2282. html +=
  2283. "<a href='" +
  2284. res.data[j].matterUrl +
  2285. "' target='_blank' class='url_from_ajax'>";
  2286. html += "<h6 class='point_from_ajax'></h6>";
  2287. html +=
  2288. "<p title='" +
  2289. res.data[j].itemName +
  2290. "' class='text_from_ajax'>" +
  2291. res.data[j].itemName +
  2292. "</p>";
  2293. html += "</a>";
  2294. }
  2295. });
  2296. });
  2297. $(".marrige").empty().append(html);
  2298. $(".show-sixth .pad_box").empty().append(discript);
  2299. }
  2300. },
  2301. });
  2302. }
  2303. // if (discriptText == discrptAddress) {
  2304. addMarker(getClick, address);
  2305. // }
  2306. blList = 1;
  2307. map.setCenter(addFirst);
  2308. resolve();
  2309. }
  2310. },
  2311. "重庆市"
  2312. );
  2313. });
  2314. });
  2315. $(document).on("click", ".handle_business2", async function () {
  2316. var rmHeight =
  2317. window.outerHeight -
  2318. $(".right-map").innerHeight() -
  2319. $(".head").innerHeight();
  2320. $(".show-sixth").show().css("height", rmHeight).siblings().hide();
  2321. $(".wrap_handle").show();
  2322. $(".content_from_ajax").hide().siblings(".marrige").show();
  2323. var addText = $(this).parent(".address_box").find("p:nth-child(1)").text();
  2324. var discriptText = addText.split(":")[1];
  2325. var addFirst, count;
  2326. var firstpage = 1;
  2327. var pagetype = 5;
  2328. scrollListHeight = $(".wrap_result").scrollTop();
  2329. const sign = $(this).attr("data-sign");
  2330. await new Promise((resolve, reject) => {
  2331. myGeo.getPoint(
  2332. discriptText,
  2333. function (point) {
  2334. if (point) {
  2335. var address = new BMap.Point(point.lng, point.lat);
  2336. addFirst = address;
  2337. let getClick = getAllArr.filter((i) => {
  2338. return i.address == discriptText;
  2339. });
  2340. $(".right-search").hide().css("top", "0px");
  2341. $(".top_search").hide();
  2342. for (let i = 0; i < getClick.length; i++) {
  2343. for (let j = i + 1; j < getClick.length; j++) {
  2344. if (getClick[j].dep === getClick[i].dep) {
  2345. getClick.splice(j, 1);
  2346. }
  2347. }
  2348. }
  2349. if (sign == "isflag") {
  2350. getClick = digitGroupItem.filter((i) => {
  2351. return i.address == discriptText;
  2352. });
  2353. }
  2354. page(getClick, firstpage, pagetype);
  2355. function page(getClick, page, pagetype) {
  2356. $.ajax({
  2357. type: "GET",
  2358. url: PATH + "/mapdata/getHandMatterPage",
  2359. // url: "http://192.168.0.40:7777/mapdata/getHandMatterPage",
  2360. async: false,
  2361. dataType: "json",
  2362. data: {
  2363. page: page,
  2364. limit: 4,
  2365. type: pagetype,
  2366. },
  2367. success: function (res) {
  2368. if (res.data != null) {
  2369. count = res.count;
  2370. var discript = "";
  2371. var html = "";
  2372. $.each(getClick, function (i) {
  2373. discrptAddress = getClick[i].address;
  2374. discript += "<ul class='titleFirst'>";
  2375. discript += "<div class='wrap_apply'>";
  2376. discript += "<li class='title_flex'>";
  2377. discript += "<p style='width:100%'>";
  2378. discript += getClick[i].dep;
  2379. discript += "</p>";
  2380. if (
  2381. getClick[i].type == "" ||
  2382. getClick[i].type == undefined ||
  2383. getClick[i].type == null
  2384. ) {
  2385. discript += "";
  2386. } else {
  2387. if (getClick[i].specialtype == "中学") {
  2388. if (getClick[i].type == "中学") {
  2389. discript += "";
  2390. } else {
  2391. discript += "<p class='flex_blue'>· ";
  2392. discript += getClick[i].type;
  2393. discript += "</p>";
  2394. }
  2395. discript += "<p class='flex_blue'>· ";
  2396. discript += getClick[i].specialtype;
  2397. discript += "</p>";
  2398. } else {
  2399. discript += "<p class='flex_blue'>· ";
  2400. discript += getClick[i].type;
  2401. discript += "</p>";
  2402. }
  2403. discript += "</li>";
  2404. }
  2405. if (
  2406. getClick[i].tag == undefined ||
  2407. getClick[i].tag == "" ||
  2408. getClick[i].tag == null
  2409. ) {
  2410. discript += "";
  2411. } else {
  2412. discript += "<li class='flex_orange'>";
  2413. discript += "<div class='three_tag'>";
  2414. discript += getClick[i].tag;
  2415. discript += "</div>";
  2416. if (
  2417. getClick[i].tag2 == undefined ||
  2418. getClick[i].tag2 == ""
  2419. ) {
  2420. discript += "";
  2421. } else {
  2422. discript += "<div class='three_tag'>";
  2423. discript += getClick[i].tag2;
  2424. discript += "</div>";
  2425. }
  2426. if (
  2427. getClick[i].tag3 == undefined ||
  2428. getClick[i].tag3 == ""
  2429. ) {
  2430. discript += "";
  2431. } else {
  2432. discript += "<div class='three_tag'>";
  2433. discript += getClick[i].tag3;
  2434. discript += "</div>";
  2435. }
  2436. }
  2437. discript += "<li>";
  2438. if (
  2439. getClick[i].content == "" ||
  2440. getClick[i].content == undefined ||
  2441. getClick[i].content == null
  2442. ) {
  2443. discript += "";
  2444. } else {
  2445. discript += "<a class='a_blue'>";
  2446. discript += "<p class='content_p'>";
  2447. discript += getClick[i].content;
  2448. discript += "</p>";
  2449. discript += "</a>";
  2450. }
  2451. discript += "</li>";
  2452. discript += "<li class='img_box'>";
  2453. if (
  2454. getClick[i].img == "" ||
  2455. getClick[i].img == undefined ||
  2456. getClick[i].img == null
  2457. ) {
  2458. discript += "";
  2459. } else {
  2460. discript +=
  2461. "<img data-src='" +
  2462. PATH +
  2463. getClick[i].img +
  2464. "' class='two_img' src='" +
  2465. PATH +
  2466. getClick[i].img +
  2467. "'>";
  2468. }
  2469. discript += "</li>";
  2470. discript += "<li class='address_box'>";
  2471. discript += "<p><span class='flex_address'>地址:</span>";
  2472. discript += getClick[i].address;
  2473. discript += "</p>";
  2474. if (
  2475. getClick[i].time == "" ||
  2476. getClick[i].time == undefined ||
  2477. getClick[i].time == null
  2478. ) {
  2479. discript += "";
  2480. } else if (getClick[i].sptype == "查阅场所") {
  2481. discript +=
  2482. "<p><span class='flex_address'>查询时间:</span>";
  2483. discript += getClick[i].time;
  2484. discript += "</p>";
  2485. } else if (getClick[i].sptype == "受理场所") {
  2486. discript +=
  2487. "<p><span class='flex_address'>受理时间:</span>";
  2488. discript += getClick[i].time;
  2489. discript += "</p>";
  2490. } else if (
  2491. getClick[i].sptype == "政务服务" ||
  2492. getClick[i].sptype == "办税服务"
  2493. ) {
  2494. discript +=
  2495. "<p><span class='flex_address'>办理时间:</span>";
  2496. discript += getClick[i].time;
  2497. discript += "</p>";
  2498. } else {
  2499. discript +=
  2500. "<p><span class='flex_address'>办公时间:</span>";
  2501. discript += getClick[i].time;
  2502. discript += "</p>";
  2503. }
  2504. if (
  2505. getClick[i].tel == "" ||
  2506. getClick[i].tel == undefined ||
  2507. getClick[i].tel == null
  2508. ) {
  2509. discript += "";
  2510. } else {
  2511. var discriptone_tel = getClick[i].tel.split(";")[0];
  2512. var discripttwo_tel = getClick[i].tel.split(";")[1];
  2513. var discripthree_tel = getClick[i].tel.split(";")[2];
  2514. var discriptfour_tel = getClick[i].tel.split(";")[3];
  2515. discript +=
  2516. "<p><span class='flex_address'>办公电话:</span>";
  2517. discript +=
  2518. "<a href='tel:" +
  2519. discriptone_tel +
  2520. "' style='color: #2775CC;text-decoration:underline'>" +
  2521. discriptone_tel +
  2522. "</a>";
  2523. if (discripttwo_tel == undefined) {
  2524. discript += "";
  2525. } else {
  2526. discript +=
  2527. ";<a href='tel:" +
  2528. discripttwo_tel +
  2529. "' style='color: #2775CC;text-decoration:underline'>" +
  2530. discripttwo_tel +
  2531. "</a>";
  2532. }
  2533. if (discripthree_tel == undefined) {
  2534. discript += "";
  2535. } else {
  2536. discript +=
  2537. ";<a href='tel:" +
  2538. discripthree_tel +
  2539. "' style='color: #2775CC;text-decoration:underline'>" +
  2540. discripthree_tel +
  2541. "</a>";
  2542. }
  2543. if (discriptfour_tel == undefined) {
  2544. discript += "";
  2545. } else {
  2546. discript +=
  2547. ";<a href='tel:" +
  2548. discriptfour_tel +
  2549. "' style='color: #2775CC;text-decoration:underline'>" +
  2550. discriptfour_tel +
  2551. "</a>";
  2552. }
  2553. discript += "</p>";
  2554. }
  2555. discript += "</li>";
  2556. discript += "</div>";
  2557. discript += "<li class='btn_box'>";
  2558. discript += "<button class='one_bus'>公交</button>";
  2559. discript += "<button class='two_car'>自驾</button>";
  2560. discript += "</li>";
  2561. discript += "</ul>";
  2562. $.each(res.data, function (j) {
  2563. if (
  2564. res.data[j].itemName == undefined &&
  2565. res.data[j].matterUrl == undefined &&
  2566. res.data[j].matterDept == undefined
  2567. ) {
  2568. html += "";
  2569. } else {
  2570. html +=
  2571. "<a href='" +
  2572. res.data[j].matterUrl +
  2573. "' target='_blank' class='url_from_ajax'>";
  2574. html += "<h6 class='point_from_ajax'></h6>";
  2575. html +=
  2576. "<p title='" +
  2577. res.data[j].itemName +
  2578. "' class='text_from_ajax'>" +
  2579. res.data[j].itemName +
  2580. "</p>";
  2581. html += "</a>";
  2582. }
  2583. });
  2584. });
  2585. $(".marrige").empty().append(html);
  2586. $(".show-sixth .pad_box").empty().append(discript);
  2587. }
  2588. },
  2589. });
  2590. }
  2591. // if (discriptText == discrptAddress) {
  2592. addMarker(getClick, address);
  2593. // }
  2594. blList = 1;
  2595. map.setCenter(addFirst);
  2596. resolve();
  2597. }
  2598. },
  2599. "重庆市"
  2600. );
  2601. });
  2602. });
  2603. $(document).on(
  2604. "click",
  2605. ".content_from_ajax .layui-tab-title li",
  2606. function () {
  2607. var rmHeight =
  2608. window.outerHeight -
  2609. $(".right-map").innerHeight() -
  2610. $(".head").innerHeight();
  2611. $(".show-sixth").show().css("height", rmHeight).siblings().hide();
  2612. $(".right-map").css("height", hlHeight);
  2613. var windowHeight =
  2614. $(".right-map").innerHeight() - $(".head").innerHeight() + 45;
  2615. var spWidth =
  2616. ($(".show-sixth").innerWidth() - $(".wrap_handle").innerWidth()) / 2;
  2617. $(".wrap_handle").css({ top: spWidth, left: spWidth });
  2618. $(".title-second").css({ top: windowHeight, left: spWidth });
  2619. $(".right-search").hide().css("top", "0px");
  2620. var getdep = $(this)
  2621. .parents(".layui-tab-title")
  2622. .find("li:nth-child(1)")
  2623. .attr("id");
  2624. if (
  2625. $(this).parent().parent().prev().prev().prev().attr("data-dep") &&
  2626. deptArr[getdep]
  2627. ) {
  2628. if ($("#deptDiv .layui-border-green").text().trim() == "全部") {
  2629. getdep = $(this)
  2630. .parent()
  2631. .parent()
  2632. .prev()
  2633. .prev()
  2634. .prev()
  2635. .attr("data-dep");
  2636. } else {
  2637. getdep = $("#deptDiv .layui-border-green").attr("data-dep");
  2638. }
  2639. }
  2640. var getText = $(this).text();
  2641. if (getText == "个人办事") {
  2642. var count;
  2643. var firstpage = 1;
  2644. var pagetype = 0;
  2645. page(firstpage, pagetype, getdep);
  2646. function page(page, pagetype, dep) {
  2647. $.ajax({
  2648. type: "GET",
  2649. url: PATH + "/mapdata/getHandMatterPage",
  2650. // url: "http://192.168.0.40:7777/mapdata/getHandMatterPage",
  2651. async: false,
  2652. dataType: "json",
  2653. data: {
  2654. page: page,
  2655. limit: 6,
  2656. type: pagetype,
  2657. matterDept: dep,
  2658. },
  2659. success: function (res) {
  2660. if (res.data != null) {
  2661. count = res.count;
  2662. var sContnet = "";
  2663. $.each(res.data, function (j) {
  2664. if (
  2665. res.data[j].itemName == undefined &&
  2666. res.data[j].matterUrl == undefined &&
  2667. res.data[j].matterDept == undefined
  2668. ) {
  2669. sContnet += "";
  2670. } else {
  2671. sContnet +=
  2672. "<a href='" +
  2673. res.data[j].matterUrl +
  2674. "' target='_blank' class='url_from_ajax'>";
  2675. sContnet += "<h6 class='point_from_ajax'></h6>";
  2676. sContnet +=
  2677. "<p title='" +
  2678. res.data[j].itemName +
  2679. "' class='text_from_ajax'>" +
  2680. res.data[j].itemName +
  2681. "</p>";
  2682. sContnet += "</a>";
  2683. }
  2684. });
  2685. $(".result_form_ajax").empty().append(sContnet);
  2686. }
  2687. },
  2688. });
  2689. }
  2690. layui.use(["laypage", "layer"], function () {
  2691. var laypage = layui.laypage,
  2692. layer = layui.layer;
  2693. laypage.render({
  2694. elem: "demo",
  2695. count: count,
  2696. limit: 4,
  2697. layout: ["prev", "next"],
  2698. prev: '<i class="layui-icon layui-icon-left"></i><span>上一页</span>',
  2699. next: '<span>下一页</span><i class="layui-icon layui-icon-right"></i>',
  2700. jump: function (obj, first) {
  2701. pagetype = 0;
  2702. page(obj.curr, pagetype, getdep);
  2703. },
  2704. });
  2705. });
  2706. blList = 1;
  2707. } else if (getText == "法人办事") {
  2708. var count;
  2709. var firstpage = 1;
  2710. var pagetype = 1;
  2711. page(firstpage, pagetype, getdep);
  2712. function page(page, pagetype, dep) {
  2713. $.ajax({
  2714. type: "GET",
  2715. url: PATH + "/mapdata/getHandMatterPage",
  2716. // url: "http://192.168.0.40:7777/mapdata/getHandMatterPage",
  2717. async: false,
  2718. dataType: "json",
  2719. data: {
  2720. page: page,
  2721. limit: 4,
  2722. type: pagetype,
  2723. matterDept: dep,
  2724. },
  2725. success: function (res) {
  2726. if (res.data != null) {
  2727. count = res.count;
  2728. var sContnet = "";
  2729. $.each(res.data, function (j) {
  2730. if (
  2731. res.data[j].itemName == undefined &&
  2732. res.data[j].matterUrl == undefined &&
  2733. res.data[j].matterDept == undefined
  2734. ) {
  2735. sContnet += "";
  2736. } else {
  2737. sContnet +=
  2738. "<a href='" +
  2739. res.data[j].matterUrl +
  2740. "' target='_blank' class='url_from_ajax'>";
  2741. sContnet += "<h6 class='point_from_ajax'></h6>";
  2742. sContnet +=
  2743. "<p title='" +
  2744. res.data[j].itemName +
  2745. "' class='text_from_ajax'>" +
  2746. res.data[j].itemName +
  2747. "</p>";
  2748. sContnet += "</a>";
  2749. }
  2750. });
  2751. $(".result_form_ajax").empty().append(sContnet);
  2752. }
  2753. },
  2754. });
  2755. }
  2756. layui.use(["laypage", "layer"], function () {
  2757. var laypage = layui.laypage,
  2758. layer = layui.layer;
  2759. laypage.render({
  2760. elem: "demo",
  2761. count: count,
  2762. limit: 4,
  2763. layout: ["prev", "next"],
  2764. prev: '<i class="layui-icon layui-icon-left"></i><span>上一页</span>',
  2765. next: '<span>下一页</span><i class="layui-icon layui-icon-right"></i>',
  2766. jump: function (obj, first) {
  2767. pagetype = 1;
  2768. page(obj.curr, pagetype, getdep);
  2769. },
  2770. });
  2771. });
  2772. blList = 1;
  2773. }
  2774. }
  2775. );
  2776. function addMarker(arrey, point) {
  2777. var myIcon = new BMap.Icon("./img/location.png", new BMap.Size(40, 40));
  2778. var marker = new BMap.Marker(point, {
  2779. icon: myIcon,
  2780. });
  2781. map.addOverlay(marker);
  2782. }
  2783. // 点击按钮公交实现路线规划
  2784. $(document).on("click", ".one_bus", async function () {
  2785. var address_text = $(this)
  2786. .parent(".btn_box")
  2787. .siblings(".wrap_apply")
  2788. .find("p:nth-child(1)")
  2789. .text();
  2790. var discript_text = address_text.split(":")[1];
  2791. $("#gj-two").val(discript_text);
  2792. $(".content-input .layui-tab-item:nth-child(1)")
  2793. .addClass("layui-show")
  2794. .siblings()
  2795. .removeClass("layui-show");
  2796. $(".search-change li:nth-child(1)")
  2797. .addClass("layui-this")
  2798. .siblings()
  2799. .removeClass("layui-this");
  2800. $(".right-search").show();
  2801. $(".right-search").animate({ top: "3.06666vw" }, 400);
  2802. $(".top_search").fadeOut(50);
  2803. var addFirst;
  2804. await new Promise((resolve, reject) => {
  2805. myGeo.getPoint(
  2806. discript_text,
  2807. function (point) {
  2808. if (point) {
  2809. var address = new BMap.Point(point.lng, point.lat);
  2810. addFirst = address;
  2811. let getClick = getAllArr.filter((i) => {
  2812. return i.address == discript_text;
  2813. });
  2814. for (let i = 0; i < getClick.length; i++) {
  2815. for (let j = i + 1; j < getClick.length; j++) {
  2816. if (getClick[j].dep === getClick[i].dep) {
  2817. getClick.splice(j, 1);
  2818. }
  2819. }
  2820. }
  2821. xrResultList(getClick);
  2822. if (discript_text == discrptAddress) {
  2823. addMarker(getClick, address);
  2824. }
  2825. indexList = 1;
  2826. ssList = 1;
  2827. map.setCenter(addFirst);
  2828. resolve();
  2829. }
  2830. },
  2831. "重庆市"
  2832. );
  2833. });
  2834. });
  2835. // 点击按钮自驾实现路线规划
  2836. $(document).on("click", ".two_car", async function () {
  2837. var address_text = $(this)
  2838. .parent(".btn_box")
  2839. .siblings(".wrap_apply")
  2840. .find("p:nth-child(1)")
  2841. .text();
  2842. var discript_text = address_text.split(":")[1];
  2843. $("#zj-two").val(discript_text);
  2844. $(".content-input .layui-tab-item:nth-child(2)")
  2845. .addClass("layui-show")
  2846. .siblings()
  2847. .removeClass("layui-show");
  2848. $(".search-change li:nth-child(2)")
  2849. .addClass("layui-this")
  2850. .siblings()
  2851. .removeClass("layui-this");
  2852. $(".right-search").show();
  2853. $(".right-search").animate({ top: "3.06666vw" }, 400);
  2854. $(".top_search").fadeOut(50);
  2855. var addFirst;
  2856. await new Promise((resolve, reject) => {
  2857. myGeo.getPoint(
  2858. discript_text,
  2859. function (point) {
  2860. if (point) {
  2861. var address = new BMap.Point(point.lng, point.lat);
  2862. addFirst = address;
  2863. let getClick = getAllArr.filter((i) => {
  2864. return i.address == discript_text;
  2865. });
  2866. for (let i = 0; i < getClick.length; i++) {
  2867. for (let j = i + 1; j < getClick.length; j++) {
  2868. if (getClick[j].dep === getClick[i].dep) {
  2869. getClick.splice(j, 1);
  2870. }
  2871. }
  2872. }
  2873. xrResultList(getClick);
  2874. if (discript_text == discrptAddress) {
  2875. addMarker(getClick, address);
  2876. }
  2877. indexList = 1;
  2878. ssList = 1;
  2879. map.setCenter(addFirst);
  2880. resolve();
  2881. }
  2882. },
  2883. "重庆市"
  2884. );
  2885. });
  2886. });
  2887. // 触发输入框时,地图不被拖动
  2888. $("input").focus(function () {
  2889. map.disableDragging(); // 禁用地图拖拽
  2890. map.disableContinuousZoom(); // 关闭双击平滑缩放效果
  2891. map.disablePinchToZoom(); // 禁用双指缩放地图
  2892. var rsTop = $(".right-search").css("top");
  2893. var ksHeight =
  2894. window.outerHeight -
  2895. $(".right-map").outerHeight() -
  2896. $(".head").outerHeight;
  2897. if (rsTop > "60px") {
  2898. $(".right-search").css("top", "20.0667vw");
  2899. $(".icon-shq").css("top", "20.0667vw");
  2900. } else if (rsTop < ksHeight) {
  2901. $(".right-search").css("top", "3.06666vw");
  2902. $(".icon-shq").css("top", "3.06666vw");
  2903. } else {
  2904. $(".right-search").css("top", ksHeight);
  2905. $(".icon-shq").css("top", ksHeight);
  2906. }
  2907. $(".back_top").hide();
  2908. });
  2909. // 输入框失焦时,地图恢复拖动
  2910. $("input").blur(function () {
  2911. setTimeout(function () {
  2912. var rsTop = $(".right-search").css("top");
  2913. var ksHeight =
  2914. window.outerHeight -
  2915. $(".right-map").outerHeight() -
  2916. $(".head").outerHeight;
  2917. map.enableInertialDragging();
  2918. map.enableDragging();
  2919. map.enableContinuousZoom();
  2920. map.enablePinchToZoom();
  2921. if (rsTop > "60px") {
  2922. $(".right-search").css("top", "20.0667vw");
  2923. $(".icon-shq").css("top", "20.0667vw");
  2924. } else if (rsTop < ksHeight) {
  2925. $(".right-search").css("top", "3.06666vw");
  2926. $(".icon-shq").css("top", "3.06666vw");
  2927. } else {
  2928. $(".right-search").css("top", ksHeight);
  2929. $(".icon-shq").css("top", ksHeight);
  2930. }
  2931. var topHeight = $(".wrap_result")
  2932. .children(".pad_box")
  2933. .find(".titleFirst")
  2934. .outerHeight();
  2935. var topHeight1 = $(".wrap_result1")
  2936. .find(".pad_box")
  2937. .find(".titleFirst")
  2938. .outerHeight();
  2939. console.log(topHeight1);
  2940. var top = $(".wrap_result").scrollTop();
  2941. var top1 = $(".wrap_result1").scrollTop();
  2942. if (top > topHeight) {
  2943. $(".show-fourth .back_top").css("display", "block");
  2944. } else if (top < topHeight) {
  2945. $(".show-fourth .back_top").hide();
  2946. }
  2947. if (top1 > topHeight1) {
  2948. $(".show-fifth .back_top").css("display", "block");
  2949. } else if (top1 < topHeight1) {
  2950. $(".show-fifth .back_top").hide();
  2951. }
  2952. }, 1000);
  2953. });
  2954. // 点击头部的公交和自驾时切换
  2955. $(".search-change li").click(function () {
  2956. var gjzjtext = $(this).text();
  2957. var startGJ = $("#gj-one").val();
  2958. var endGJ = $("#gj-two").val();
  2959. var startZJ = $("#zj-one").val();
  2960. var endZJ = $("#zj-two").val();
  2961. if (gjzjtext == "公交") {
  2962. console.log("1:", startZJ, endZJ);
  2963. $(".show-first").show().siblings().hide();
  2964. $(".top_search").show().siblings(".right-map").show();
  2965. $(".right-search")
  2966. .css("top", msHeight)
  2967. .siblings(".right-map")
  2968. .css("top", "0px");
  2969. map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
  2970. $("#gj-one").val(startZJ);
  2971. $("#gj-two").val(endZJ);
  2972. }
  2973. if (gjzjtext == "自驾") {
  2974. console.log("2:", startGJ, endGJ);
  2975. $(".show-first").show().siblings().hide();
  2976. $(".top_search").show().siblings(".right-map").show();
  2977. $(".right-search")
  2978. .css("top", msHeight)
  2979. .siblings(".right-map")
  2980. .css("top", "0px");
  2981. map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
  2982. $("#zj-one").val(startGJ);
  2983. $("#zj-two").val(endGJ);
  2984. }
  2985. });
  2986. var obj = JSON.stringify(["", ""]);
  2987. localStorage.setItem("line", obj);
  2988. var resultObject = JSON.stringify(["", ""]);
  2989. localStorage.setItem("lineText", resultObject);
  2990. localStorage.setItem("discern", 0);
  2991. // 点击头部的公交的搜索按钮在左边出现结果
  2992. $(".inp-icon2").click(async function () {
  2993. var startZD = $("#gj-one").val();
  2994. var endZD = $("#gj-two").val();
  2995. var startPoint, endPoint;
  2996. if (startZD == "" || endZD == "") {
  2997. $(".top_search")
  2998. .show()
  2999. .siblings(".right-map")
  3000. .show()
  3001. .css("top", "0px")
  3002. .siblings(".right-search")
  3003. .css("top", msHeight);
  3004. $(".show-first").show().siblings().hide();
  3005. $("#result").empty();
  3006. localStorage.setItem("discern", "0");
  3007. map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
  3008. localStorage.setItem("discern", "0");
  3009. layer.msg("请输入起点或终点!");
  3010. } else {
  3011. await new Promise((resolve, reject) => {
  3012. myGeo.getPoint(
  3013. startZD,
  3014. function (point) {
  3015. if (point) {
  3016. startPoint = new BMap.Point(point.lng, point.lat);
  3017. resolve();
  3018. }
  3019. },
  3020. "重庆市"
  3021. );
  3022. });
  3023. await new Promise((resolve, reject) => {
  3024. myGeo.getPoint(
  3025. endZD,
  3026. function (point) {
  3027. if (point) {
  3028. endPoint = new BMap.Point(point.lng, point.lat);
  3029. resolve();
  3030. }
  3031. },
  3032. "重庆市"
  3033. );
  3034. });
  3035. layui.use("layer", function () {
  3036. var $ = layui.jquery,
  3037. layer = layui.layer;
  3038. layer.open({
  3039. title: false,
  3040. content: false,
  3041. id: "layerchoicebaidugaode",
  3042. btn: ["百度地图导航", "高德地图导航"],
  3043. btnAlign: "c",
  3044. yes: function () {
  3045. var baiduConfig = {
  3046. scheme_Android:
  3047. "bdapp://map/direction?origin=" +
  3048. startZD +
  3049. "&destination=" +
  3050. endZD +
  3051. "&mode=transit&region=重庆&output=html&src=webapp.baidu.openAPIdemo",
  3052. scheme_IOS:
  3053. "baidumap://map/direction?origin=" +
  3054. startZD +
  3055. "&destination=" +
  3056. endZD +
  3057. "&mode=transit&region=重庆&output=html&src=webapp.baidu.openAPIdemo",
  3058. scheme_web:
  3059. "http://api.map.baidu.com/direction?origin=" +
  3060. startZD +
  3061. "&destination=" +
  3062. endZD +
  3063. "&mode=transit&region=重庆&output=html&src=webapp.baidu.openAPIdemo",
  3064. };
  3065. var timeout = 600;
  3066. // 判断操作系统,返回百度的不同操作系统下的接口
  3067. function adjustOS() {
  3068. var ua = window.navigator.userAgent.toLowerCase();
  3069. return ua.indexOf("os") > 0
  3070. ? baiduConfig.scheme_IOS
  3071. : baiduConfig.scheme_Android;
  3072. }
  3073. var startTime = Date.now();
  3074. var ifr = document.createElement("iframe");
  3075. ifr.src = adjustOS();
  3076. ifr.style.display = "none";
  3077. document.body.appendChild(ifr);
  3078. var t = setTimeout(function () {
  3079. var endTime = Date.now();
  3080. if (!startTime || endTime - startTime < timeout + 200) {
  3081. window.location.href = baiduConfig.scheme_web;
  3082. }
  3083. }, timeout);
  3084. window.onblur = function () {
  3085. clearTimeout(t);
  3086. };
  3087. },
  3088. btn2: function () {
  3089. var baiduConfig = {
  3090. scheme_Android:
  3091. "androidamap://route/plan/?sourceApplication=appname&sid=&slat=" +
  3092. startPoint.lat +
  3093. "&slon=" +
  3094. startPoint.lng +
  3095. "&sname=" +
  3096. startZD +
  3097. "&did=&dlat=" +
  3098. endPoint.lat +
  3099. "&dlon=" +
  3100. endPoint.lng +
  3101. "&dname=" +
  3102. endZD +
  3103. "&dev=0&t=1",
  3104. scheme_IOS:
  3105. "iosamap://path?sourceApplication=applicationName&sid=&slat=" +
  3106. startPoint.lat +
  3107. "&slon=" +
  3108. startPoint.lng +
  3109. "&sname=" +
  3110. startZD +
  3111. "&did=&dlat=" +
  3112. endPoint.lat +
  3113. "&dlon=" +
  3114. endPoint.lng +
  3115. "&dname=" +
  3116. endZD +
  3117. "&dev=0&t=1",
  3118. scheme_web:
  3119. "https://uri.amap.com/navigation?from=" +
  3120. startPoint.lng +
  3121. "," +
  3122. startPoint.lat +
  3123. "," +
  3124. startZD +
  3125. "&to=" +
  3126. endPoint.lng +
  3127. "," +
  3128. endPoint.lat +
  3129. "," +
  3130. endZD +
  3131. "&mode=bus&callnative=1&coordinate=wgs84&src=mypage",
  3132. };
  3133. var timeout = 600;
  3134. // 判断操作系统,返回百度的不同操作系统下的接口
  3135. function adjustOS() {
  3136. var ua = window.navigator.userAgent.toLowerCase();
  3137. return ua.indexOf("os") > 0
  3138. ? baiduConfig.scheme_IOS
  3139. : baiduConfig.scheme_Android;
  3140. }
  3141. var startTime = Date.now();
  3142. var ifr = document.createElement("iframe");
  3143. ifr.src = adjustOS();
  3144. ifr.style.display = "none";
  3145. document.body.appendChild(ifr);
  3146. var t = setTimeout(function () {
  3147. var endTime = Date.now();
  3148. if (!startTime || endTime - startTime < timeout + 200) {
  3149. window.location.href = baiduConfig.scheme_web;
  3150. }
  3151. }, timeout);
  3152. window.onblur = function () {
  3153. clearTimeout(t);
  3154. };
  3155. return false;
  3156. },
  3157. });
  3158. });
  3159. }
  3160. });
  3161. $("#gj-one").bind("keyup", function (event) {
  3162. var startZD = $("#gj-one").val();
  3163. map.clearOverlays();
  3164. if (event.keyCode == 13) {
  3165. if (startZD == "") {
  3166. $(".top_search").show().siblings(".right-map").show();
  3167. $(".show-first").show().siblings().hide();
  3168. $(".right-search").css("top", msHeight);
  3169. $(".icon-shq").css("top", msHeight);
  3170. localStorage.setItem("discern", "0");
  3171. map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
  3172. layer.msg("请输入起点!");
  3173. } else {
  3174. $("#gj-two").focus();
  3175. }
  3176. }
  3177. });
  3178. $("#gj-two").bind("keyup", async function (event) {
  3179. var startZD = $("#gj-one").val();
  3180. var endZD = $("#gj-two").val();
  3181. if (event.keyCode == 13) {
  3182. if (startZD == "") {
  3183. $(".top_search").show().siblings(".right-map").show();
  3184. $(".show-first").show().siblings().hide();
  3185. $(".right-search").css("top", msHeight);
  3186. $(".icon-shq").css("top", msHeight);
  3187. localStorage.setItem("discern", "0");
  3188. map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
  3189. layer.msg("请输入起点!");
  3190. } else if (endZD == "") {
  3191. $(".top_search").show().siblings(".right-map").show();
  3192. $(".show-first").show().siblings().hide();
  3193. $(".right-search").css("top", msHeight);
  3194. $(".icon-shq").css("top", msHeight);
  3195. localStorage.setItem("discern", "0");
  3196. map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
  3197. layer.msg("请输入终点!");
  3198. } else {
  3199. await new Promise((resolve, reject) => {
  3200. myGeo.getPoint(
  3201. startZD,
  3202. function (point) {
  3203. if (point) {
  3204. startPoint = new BMap.Point(point.lng, point.lat);
  3205. resolve();
  3206. }
  3207. },
  3208. "重庆市"
  3209. );
  3210. });
  3211. await new Promise((resolve, reject) => {
  3212. myGeo.getPoint(
  3213. endZD,
  3214. function (point) {
  3215. if (point) {
  3216. endPoint = new BMap.Point(point.lng, point.lat);
  3217. resolve();
  3218. }
  3219. },
  3220. "重庆市"
  3221. );
  3222. });
  3223. layui.use("layer", function () {
  3224. var $ = layui.jquery,
  3225. layer = layui.layer;
  3226. layer.open({
  3227. title: false,
  3228. content: false,
  3229. id: "layerchoicebaidugaode",
  3230. btn: ["百度地图导航", "高德地图导航"],
  3231. btnAlign: "c",
  3232. yes: function () {
  3233. var baiduConfig = {
  3234. scheme_Android:
  3235. "bdapp://map/direction?origin=" +
  3236. startZD +
  3237. "&destination=" +
  3238. endZD +
  3239. "&mode=transit&region=重庆&output=html&src=webapp.baidu.openAPIdemo",
  3240. scheme_IOS:
  3241. "baidumap://map/direction?origin=" +
  3242. startZD +
  3243. "&destination=" +
  3244. endZD +
  3245. "&mode=transit&region=重庆&output=html&src=webapp.baidu.openAPIdemo",
  3246. scheme_web:
  3247. "http://api.map.baidu.com/direction?origin=" +
  3248. startZD +
  3249. "&destination=" +
  3250. endZD +
  3251. "&mode=transit&region=重庆&output=html&src=webapp.baidu.openAPIdemo",
  3252. };
  3253. var timeout = 600;
  3254. // 判断操作系统,返回百度的不同操作系统下的接口
  3255. function adjustOS() {
  3256. var ua = window.navigator.userAgent.toLowerCase();
  3257. return ua.indexOf("os") > 0
  3258. ? baiduConfig.scheme_IOS
  3259. : baiduConfig.scheme_Android;
  3260. }
  3261. var startTime = Date.now();
  3262. var ifr = document.createElement("iframe");
  3263. ifr.src = adjustOS();
  3264. ifr.style.display = "none";
  3265. document.body.appendChild(ifr);
  3266. var t = setTimeout(function () {
  3267. var endTime = Date.now();
  3268. if (!startTime || endTime - startTime < timeout + 200) {
  3269. window.location.href = baiduConfig.scheme_web;
  3270. }
  3271. }, timeout);
  3272. window.onblur = function () {
  3273. clearTimeout(t);
  3274. };
  3275. },
  3276. btn2: function () {
  3277. var baiduConfig = {
  3278. scheme_Android:
  3279. "androidamap://route/plan/?sourceApplication=appname&sid=&slat=" +
  3280. startPoint.lat +
  3281. "&slon=" +
  3282. startPoint.lng +
  3283. "&sname=" +
  3284. startZD +
  3285. "&did=&dlat=" +
  3286. endPoint.lat +
  3287. "&dlon=" +
  3288. endPoint.lng +
  3289. "&dname=" +
  3290. endZD +
  3291. "&dev=0&t=1",
  3292. scheme_IOS:
  3293. "iosamap://path?sourceApplication=applicationName&sid=&slat=" +
  3294. startPoint.lat +
  3295. "&slon=" +
  3296. startPoint.lng +
  3297. "&sname=" +
  3298. startZD +
  3299. "&did=&dlat=" +
  3300. endPoint.lat +
  3301. "&dlon=" +
  3302. endPoint.lng +
  3303. "&dname=" +
  3304. endZD +
  3305. "&dev=0&t=1",
  3306. scheme_web:
  3307. "https://uri.amap.com/navigation?from=" +
  3308. startPoint.lng +
  3309. "," +
  3310. startPoint.lat +
  3311. "," +
  3312. startZD +
  3313. "&to=" +
  3314. endPoint.lng +
  3315. "," +
  3316. endPoint.lat +
  3317. "," +
  3318. endZD +
  3319. "&mode=bus&callnative=1&coordinate=wgs84&src=mypage",
  3320. };
  3321. var timeout = 600;
  3322. // 判断操作系统,返回百度的不同操作系统下的接口
  3323. function adjustOS() {
  3324. var ua = window.navigator.userAgent.toLowerCase();
  3325. return ua.indexOf("os") > 0
  3326. ? baiduConfig.scheme_IOS
  3327. : baiduConfig.scheme_Android;
  3328. }
  3329. var startTime = Date.now();
  3330. var ifr = document.createElement("iframe");
  3331. ifr.src = adjustOS();
  3332. ifr.style.display = "none";
  3333. document.body.appendChild(ifr);
  3334. var t = setTimeout(function () {
  3335. var endTime = Date.now();
  3336. if (!startTime || endTime - startTime < timeout + 200) {
  3337. window.location.href = baiduConfig.scheme_web;
  3338. }
  3339. }, timeout);
  3340. window.onblur = function () {
  3341. clearTimeout(t);
  3342. };
  3343. return false;
  3344. },
  3345. });
  3346. });
  3347. }
  3348. document.activeElement.blur(); // 关闭软键盘
  3349. }
  3350. });
  3351. // 公交的渲染结果
  3352. function busResultLine(startZD, endZD) {
  3353. var resPoint = null;
  3354. var startPoint, endPoint, startText, endText, startAddress, endAddress;
  3355. $(".show-second").show().siblings().hide();
  3356. $(".top_search")
  3357. .hide()
  3358. .siblings(".right-map")
  3359. .hide()
  3360. .css("top", "20.06666vw");
  3361. $(".right-search").css("top", "20.06666vw");
  3362. $(".icon-shq").css("top", "20.06666vw");
  3363. $(".title-second")
  3364. .css("margin", "2.93333vw auto 44vw")
  3365. .siblings(".show-second .content-third")
  3366. .hide();
  3367. $(".zjboxpanel").show();
  3368. $(".boxpanel").hide();
  3369. let GJstart = contrastArrey.filter(function (i) {
  3370. return i.address == startZD;
  3371. });
  3372. let GJend = contrastArrey.filter(function (i) {
  3373. return i.address == endZD;
  3374. });
  3375. if (GJstart.length == 0 && GJend.length == 0) {
  3376. $(".show-second .content-third").hide();
  3377. $("#startbus").show().siblings().show();
  3378. $("#result").empty();
  3379. busStartSearch(startZD);
  3380. busEndSearch(endZD);
  3381. $(document)
  3382. .off("click")
  3383. .on("click", ".openstartinfo", function () {
  3384. map.clearOverlays();
  3385. startPoint = new BMap.Point($(this).data("lng"), $(this).data("lat"));
  3386. startText = $(this).data("text");
  3387. startAddress = $(this).data("add");
  3388. $(this)
  3389. .find("p")
  3390. .addClass("change_text_color")
  3391. .parents("li")
  3392. .siblings()
  3393. .find("p")
  3394. .removeClass("change_text_color");
  3395. $(".zjboxpanel").show().siblings(".content-third").hide();
  3396. });
  3397. $(document).on("click", ".openendinfo", function () {
  3398. if (startPoint == null) {
  3399. layer.msg("请先选择起点!");
  3400. } else {
  3401. $(this)
  3402. .find("p")
  3403. .addClass("change_text_color")
  3404. .parents("li")
  3405. .siblings()
  3406. .find("p")
  3407. .removeClass("change_text_color");
  3408. $(".show-second .content-third").show();
  3409. $(".zjboxpanel").hide();
  3410. endText = $(this).data("text");
  3411. endAddress = $(this).data("add");
  3412. endPoint = new BMap.Point($(this).data("lng"), $(this).data("lat"));
  3413. $("#gj-one").val(startText);
  3414. $("#gj-two").val(endText);
  3415. var res = JSON.stringify([startText, endText]);
  3416. localStorage.setItem("line", res);
  3417. resPoint = JSON.stringify([startPoint, endPoint]);
  3418. localStorage.setItem("Point", resPoint);
  3419. busResultContLine();
  3420. drivingResultContLine();
  3421. var result = JSON.stringify([startText, endText]);
  3422. localStorage.setItem("lineText", result);
  3423. localStorage.setItem("discern", "2");
  3424. }
  3425. });
  3426. } else if (GJstart.length > 0) {
  3427. $(".zjboxpanel").show();
  3428. $("#startbus")
  3429. .hide()
  3430. .siblings("#busstartPanel")
  3431. .empty()
  3432. .hide()
  3433. .siblings("#endBus")
  3434. .show()
  3435. .siblings("#busendPanel")
  3436. .show();
  3437. $("#result").empty();
  3438. busEndSearch(endZD);
  3439. $(document)
  3440. .off("click")
  3441. .on("click", ".openendinfo", async function () {
  3442. endAddress = $(this).data("add");
  3443. endPoint = new BMap.Point($(this).data("lng"), $(this).data("lat"));
  3444. endText = $(this).data("text");
  3445. $(this)
  3446. .find("p")
  3447. .addClass("change_text_color")
  3448. .parents("li")
  3449. .siblings()
  3450. .find("p")
  3451. .removeClass("change_text_color");
  3452. $(".show-second .content-third")
  3453. .show()
  3454. .siblings(".zjboxpanel")
  3455. .hide();
  3456. $("#gj-one").val(startZD);
  3457. $("#gj-two").val(endText);
  3458. await new Promise((resolve, reject) => {
  3459. myGeo.getPoint(
  3460. startZD,
  3461. function (point) {
  3462. if (point) {
  3463. startData = new BMap.Point(point.lng, point.lat);
  3464. resolve();
  3465. }
  3466. },
  3467. "重庆市"
  3468. );
  3469. });
  3470. var start = new BMap.Point(startData.lng, startData.lat);
  3471. var res = JSON.stringify([startZD, endText]);
  3472. localStorage.setItem("line", res);
  3473. resPoint = JSON.stringify([start, endPoint]);
  3474. localStorage.setItem("Point", resPoint);
  3475. busResultContLine();
  3476. drivingResultContLine();
  3477. var result = JSON.stringify([startZD, endText]);
  3478. localStorage.setItem("lineText", result);
  3479. localStorage.setItem("discern", "2");
  3480. });
  3481. } else if (GJend.length > 0) {
  3482. $("#startbus").show().siblings("#busstartPanel").show();
  3483. $("#endBus").hide().siblings("#busendPanel").hide();
  3484. $(".show-second .content-third").hide();
  3485. busStartSearch(startZD);
  3486. $(document)
  3487. .off("click")
  3488. .on("click", ".openstartinfo", async function () {
  3489. $(".zjboxpanel").hide();
  3490. $(".show-second .content-third").show();
  3491. map.clearOverlays();
  3492. startPoint = new BMap.Point($(this).data("lng"), $(this).data("lat"));
  3493. startText = $(this).data("text");
  3494. startAddress = $(this).data("add");
  3495. $(this)
  3496. .find("p")
  3497. .addClass("change_text_color")
  3498. .parents("li")
  3499. .siblings()
  3500. .find("p")
  3501. .removeClass("change_text_color");
  3502. $("#gj-one").val(startText);
  3503. await new Promise((resolve, reject) => {
  3504. myGeo.getPoint(
  3505. endZD,
  3506. function (point) {
  3507. if (point) {
  3508. endData = new BMap.Point(point.lng, point.lat);
  3509. resolve();
  3510. }
  3511. },
  3512. "重庆市"
  3513. );
  3514. });
  3515. var end = new BMap.Point(endData.lng, endData.lat);
  3516. var res = JSON.stringify([startText, endZD]);
  3517. localStorage.setItem("line", res);
  3518. resPoint = JSON.stringify([startPoint, end]);
  3519. localStorage.setItem("Point", resPoint);
  3520. busResultContLine();
  3521. drivingResultContLine();
  3522. var result = JSON.stringify([startText, endZD]);
  3523. localStorage.setItem("lineText", result);
  3524. localStorage.setItem("discern", "2");
  3525. });
  3526. }
  3527. // 封装起点选择
  3528. function busStartSearch(startZD) {
  3529. var startResults = null;
  3530. var startOption = {
  3531. onSearchComplete: function (results) {
  3532. // 判断状态是否正确
  3533. if (startSearch.getStatus() == BMAP_STATUS_SUCCESS) {
  3534. startResults = results;
  3535. var openStartInfoWindowHtml = "";
  3536. for (var i = 0; i < results.getCurrentNumPois(); i++) {
  3537. var startcount = i + 1;
  3538. openStartInfoWindowHtml +=
  3539. "<li data-add='" +
  3540. results.getPoi(i).address +
  3541. "' data-text='" +
  3542. results.getPoi(i).title +
  3543. "' data-lng='" +
  3544. results.getPoi(i).point.lng +
  3545. "' data-lat='" +
  3546. results.getPoi(i).point.lat +
  3547. "' class='openstartinfo'>";
  3548. openStartInfoWindowHtml += "<a href='#endBus'>";
  3549. openStartInfoWindowHtml += "<div class='warp_choice'>";
  3550. openStartInfoWindowHtml += "<span>" + startcount + ".</span>";
  3551. openStartInfoWindowHtml += "<p>";
  3552. openStartInfoWindowHtml += results.getPoi(i).title;
  3553. openStartInfoWindowHtml += "</p>";
  3554. openStartInfoWindowHtml += "</div>";
  3555. openStartInfoWindowHtml += "<p>地址:";
  3556. if (results.getPoi(i).address == undefined) {
  3557. openStartInfoWindowHtml += results.getPoi(i).title;
  3558. } else {
  3559. openStartInfoWindowHtml += results.getPoi(i).address;
  3560. }
  3561. openStartInfoWindowHtml += "</p></div>";
  3562. openStartInfoWindowHtml += "</a>";
  3563. openStartInfoWindowHtml += "</li>";
  3564. }
  3565. $("#busstartPanel").empty().append(openStartInfoWindowHtml);
  3566. } else {
  3567. startResults = null;
  3568. }
  3569. },
  3570. };
  3571. var startSearch = new BMap.LocalSearch(map, startOption);
  3572. startSearch.search(startZD);
  3573. }
  3574. // 封装终点选择
  3575. function busEndSearch(endZD) {
  3576. var endResults = null;
  3577. var endOption = {
  3578. onSearchComplete: function (results) {
  3579. // 判断状态是否正确
  3580. // openEndInfoWindowHtml += "<button class='endChoice hideEnd'>选为终点</button>"
  3581. if (endSearch.getStatus() == BMAP_STATUS_SUCCESS) {
  3582. endResults = results;
  3583. var openEndInfoWindowHtml = "";
  3584. for (var i = 0; i < results.getCurrentNumPois(); i++) {
  3585. var endcount = i + 1;
  3586. openEndInfoWindowHtml +=
  3587. "<li data-add='" +
  3588. results.getPoi(i).address +
  3589. "' data-text='" +
  3590. results.getPoi(i).title +
  3591. "' data-lng='" +
  3592. results.getPoi(i).point.lng +
  3593. "' data-lat='" +
  3594. results.getPoi(i).point.lat +
  3595. "' class='openendinfo'>";
  3596. openEndInfoWindowHtml += "<div class='warp_choice'>";
  3597. openEndInfoWindowHtml += "<span>" + endcount + ".</span>";
  3598. openEndInfoWindowHtml += "<p>";
  3599. openEndInfoWindowHtml += results.getPoi(i).title;
  3600. openEndInfoWindowHtml += "</p>";
  3601. openEndInfoWindowHtml += "</div>";
  3602. openEndInfoWindowHtml += "<p>地址:";
  3603. if (results.getPoi(i).address == undefined) {
  3604. openEndInfoWindowHtml += results.getPoi(i).title;
  3605. } else {
  3606. openEndInfoWindowHtml += results.getPoi(i).address;
  3607. }
  3608. openEndInfoWindowHtml += "</p></div>";
  3609. openEndInfoWindowHtml += "</li>";
  3610. }
  3611. $("#busendPanel").empty().append(openEndInfoWindowHtml);
  3612. } else {
  3613. endResults = null;
  3614. }
  3615. },
  3616. };
  3617. var endSearch = new BMap.LocalSearch(map, endOption);
  3618. endSearch.search(endZD);
  3619. }
  3620. }
  3621. // 点击头部的自驾的搜索按钮在左边出现结果
  3622. $(".inp-icon3").click(async function () {
  3623. var startZD = $("#zj-one").val();
  3624. var endZD = $("#zj-two").val();
  3625. if (startZD == "" || endZD == "") {
  3626. $(".top_search").show().siblings(".right-map").show();
  3627. $(".show-first").show().siblings().hide();
  3628. $(".right-search").css("top", msHeight);
  3629. $(".icon-shq").css("top", msHeight);
  3630. $("#result1").empty();
  3631. localStorage.setItem("discern", "0");
  3632. map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
  3633. layer.msg("请输入起点或终点!");
  3634. } else {
  3635. await new Promise((resolve, reject) => {
  3636. myGeo.getPoint(
  3637. startZD,
  3638. function (point) {
  3639. if (point) {
  3640. startPoint = new BMap.Point(point.lng, point.lat);
  3641. resolve();
  3642. }
  3643. },
  3644. "重庆市"
  3645. );
  3646. });
  3647. await new Promise((resolve, reject) => {
  3648. myGeo.getPoint(
  3649. endZD,
  3650. function (point) {
  3651. if (point) {
  3652. endPoint = new BMap.Point(point.lng, point.lat);
  3653. resolve();
  3654. }
  3655. },
  3656. "重庆市"
  3657. );
  3658. });
  3659. layui.use("layer", function () {
  3660. var $ = layui.jquery,
  3661. layer = layui.layer;
  3662. layer.open({
  3663. title: false,
  3664. content: false,
  3665. id: "layerchoicebaidugaode",
  3666. btn: ["百度地图导航", "高德地图导航"],
  3667. btnAlign: "c",
  3668. yes: function () {
  3669. var baiduConfig = {
  3670. scheme_Android:
  3671. "bdapp://map/direction?origin=" +
  3672. startZD +
  3673. "&destination=" +
  3674. endZD +
  3675. "&mode=driving&region=重庆&output=html&src=webapp.baidu.openAPIdemo",
  3676. scheme_IOS:
  3677. "baidumap://map/direction?origin=" +
  3678. startZD +
  3679. "&destination=" +
  3680. endZD +
  3681. "&mode=driving&region=重庆&output=html&src=webapp.baidu.openAPIdemo",
  3682. scheme_web:
  3683. "http://api.map.baidu.com/direction?origin=" +
  3684. startZD +
  3685. "&destination=" +
  3686. endZD +
  3687. "&mode=driving&region=重庆&output=html&src=webapp.baidu.openAPIdemo",
  3688. };
  3689. var timeout = 600;
  3690. // 判断操作系统,返回百度的不同操作系统下的接口
  3691. function adjustOS() {
  3692. var ua = window.navigator.userAgent.toLowerCase();
  3693. return ua.indexOf("os") > 0
  3694. ? baiduConfig.scheme_IOS
  3695. : baiduConfig.scheme_Android;
  3696. }
  3697. var startTime = Date.now();
  3698. var ifr = document.createElement("iframe");
  3699. ifr.src = adjustOS();
  3700. ifr.style.display = "none";
  3701. document.body.appendChild(ifr);
  3702. var t = setTimeout(function () {
  3703. var endTime = Date.now();
  3704. if (!startTime || endTime - startTime < timeout + 200) {
  3705. window.location.href = baiduConfig.scheme_web;
  3706. }
  3707. }, timeout);
  3708. window.onblur = function () {
  3709. clearTimeout(t);
  3710. };
  3711. },
  3712. btn2: function () {
  3713. var baiduConfig = {
  3714. scheme_Android:
  3715. "androidamap://route/plan/?sourceApplication=appname&sid=&slat=" +
  3716. startPoint.lat +
  3717. "&slon=" +
  3718. startPoint.lng +
  3719. "&sname=" +
  3720. startZD +
  3721. "&did=&dlat=" +
  3722. endPoint.lat +
  3723. "&dlon=" +
  3724. endPoint.lng +
  3725. "&dname=" +
  3726. endZD +
  3727. "&dev=0&t=0",
  3728. scheme_IOS:
  3729. "iosamap://path?sourceApplication=applicationName&sid=&slat=" +
  3730. startPoint.lat +
  3731. "&slon=" +
  3732. startPoint.lng +
  3733. "&sname=" +
  3734. startZD +
  3735. "&did=&dlat=" +
  3736. endPoint.lat +
  3737. "&dlon=" +
  3738. endPoint.lng +
  3739. "&dname=" +
  3740. endZD +
  3741. "&dev=0&t=0",
  3742. scheme_web:
  3743. "https://uri.amap.com/navigation?from=" +
  3744. startPoint.lng +
  3745. "," +
  3746. startPoint.lat +
  3747. "," +
  3748. startZD +
  3749. "&to=" +
  3750. endPoint.lng +
  3751. "," +
  3752. endPoint.lat +
  3753. "," +
  3754. endZD +
  3755. "&mode=car&callnative=1&coordinate=wgs84&src=mypage",
  3756. };
  3757. var timeout = 600;
  3758. // 判断操作系统,返回百度的不同操作系统下的接口
  3759. function adjustOS() {
  3760. var ua = window.navigator.userAgent.toLowerCase();
  3761. return ua.indexOf("os") > 0
  3762. ? baiduConfig.scheme_IOS
  3763. : baiduConfig.scheme_Android;
  3764. }
  3765. var startTime = Date.now();
  3766. var ifr = document.createElement("iframe");
  3767. ifr.src = adjustOS();
  3768. ifr.style.display = "none";
  3769. document.body.appendChild(ifr);
  3770. var t = setTimeout(function () {
  3771. var endTime = Date.now();
  3772. if (!startTime || endTime - startTime < timeout + 200) {
  3773. window.location.href = baiduConfig.scheme_web;
  3774. }
  3775. }, timeout);
  3776. window.onblur = function () {
  3777. clearTimeout(t);
  3778. };
  3779. return false;
  3780. },
  3781. });
  3782. });
  3783. }
  3784. });
  3785. $("#zj-one").bind("keyup", function (event) {
  3786. var startZD = $("#zj-one").val();
  3787. if (event.keyCode == 13) {
  3788. if (startZD == "") {
  3789. $(".top_search").show().siblings(".right-map").show();
  3790. $(".show-first").show().siblings().hide();
  3791. $(".right-search").css("top", msHeight);
  3792. $(".icon-shq").css("top", msHeight);
  3793. localStorage.setItem("discern", "0");
  3794. layer.msg("请输入起点!");
  3795. map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
  3796. } else {
  3797. $("#zj-two").focus();
  3798. }
  3799. }
  3800. });
  3801. $("#zj-two").bind("keyup", async function (event) {
  3802. var startZD = $("#zj-one").val();
  3803. var endZD = $("#zj-two").val();
  3804. if (event.keyCode == 13) {
  3805. if (startZD == "") {
  3806. $(".top_search").show().siblings(".right-map").show();
  3807. $(".show-first").show().siblings().hide();
  3808. $(".right-search").css("top", msHeight);
  3809. $(".icon-shq").css("top", msHeight);
  3810. localStorage.setItem("discern", "0");
  3811. layer.msg("请输入起点!");
  3812. map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
  3813. } else if (endZD == "") {
  3814. $(".top_search").show().siblings(".right-map").show();
  3815. $(".show-first").show().siblings().hide();
  3816. $(".right-search").css("top", msHeight);
  3817. $(".icon-shq").css("top", msHeight);
  3818. localStorage.setItem("discern", "0");
  3819. layer.msg("请输入终点!");
  3820. map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
  3821. } else {
  3822. await new Promise((resolve, reject) => {
  3823. myGeo.getPoint(
  3824. startZD,
  3825. function (point) {
  3826. if (point) {
  3827. startPoint = new BMap.Point(point.lng, point.lat);
  3828. resolve();
  3829. }
  3830. },
  3831. "重庆市"
  3832. );
  3833. });
  3834. await new Promise((resolve, reject) => {
  3835. myGeo.getPoint(
  3836. endZD,
  3837. function (point) {
  3838. if (point) {
  3839. endPoint = new BMap.Point(point.lng, point.lat);
  3840. resolve();
  3841. }
  3842. },
  3843. "重庆市"
  3844. );
  3845. });
  3846. layui.use("layer", function () {
  3847. var $ = layui.jquery,
  3848. layer = layui.layer;
  3849. layer.open({
  3850. title: false,
  3851. content: false,
  3852. id: "layerchoicebaidugaode",
  3853. btn: ["百度地图导航", "高德地图导航"],
  3854. btnAlign: "c",
  3855. yes: function () {
  3856. var baiduConfig = {
  3857. scheme_Android:
  3858. "bdapp://map/direction?origin=" +
  3859. startZD +
  3860. "&destination=" +
  3861. endZD +
  3862. "&mode=driving&region=重庆&output=html&src=webapp.baidu.openAPIdemo",
  3863. scheme_IOS:
  3864. "baidumap://map/direction?origin=" +
  3865. startZD +
  3866. "&destination=" +
  3867. endZD +
  3868. "&mode=driving&region=重庆&output=html&src=webapp.baidu.openAPIdemo",
  3869. scheme_web:
  3870. "http://api.map.baidu.com/direction?origin=" +
  3871. startZD +
  3872. "&destination=" +
  3873. endZD +
  3874. "&mode=driving&region=重庆&output=html&src=webapp.baidu.openAPIdemo",
  3875. };
  3876. var timeout = 600;
  3877. // 判断操作系统,返回百度的不同操作系统下的接口
  3878. function adjustOS() {
  3879. var ua = window.navigator.userAgent.toLowerCase();
  3880. return ua.indexOf("os") > 0
  3881. ? baiduConfig.scheme_IOS
  3882. : baiduConfig.scheme_Android;
  3883. }
  3884. var startTime = Date.now();
  3885. var ifr = document.createElement("iframe");
  3886. ifr.src = adjustOS();
  3887. ifr.style.display = "none";
  3888. document.body.appendChild(ifr);
  3889. var t = setTimeout(function () {
  3890. var endTime = Date.now();
  3891. if (!startTime || endTime - startTime < timeout + 200) {
  3892. window.location.href = baiduConfig.scheme_web;
  3893. }
  3894. }, timeout);
  3895. window.onblur = function () {
  3896. clearTimeout(t);
  3897. };
  3898. },
  3899. btn2: function () {
  3900. var baiduConfig = {
  3901. scheme_Android:
  3902. "androidamap://route/plan/?sourceApplication=appname&sid=&slat=" +
  3903. startPoint.lat +
  3904. "&slon=" +
  3905. startPoint.lng +
  3906. "&sname=" +
  3907. startZD +
  3908. "&did=&dlat=" +
  3909. endPoint.lat +
  3910. "&dlon=" +
  3911. endPoint.lng +
  3912. "&dname=" +
  3913. endZD +
  3914. "&dev=0&t=0",
  3915. scheme_IOS:
  3916. "iosamap://path?sourceApplication=applicationName&sid=&slat=" +
  3917. startPoint.lat +
  3918. "&slon=" +
  3919. startPoint.lng +
  3920. "&sname=" +
  3921. startZD +
  3922. "&did=&dlat=" +
  3923. endPoint.lat +
  3924. "&dlon=" +
  3925. endPoint.lng +
  3926. "&dname=" +
  3927. endZD +
  3928. "&dev=0&t=0",
  3929. scheme_web:
  3930. "https://uri.amap.com/navigation?from=" +
  3931. startPoint.lng +
  3932. "," +
  3933. startPoint.lat +
  3934. "," +
  3935. startZD +
  3936. "&to=" +
  3937. endPoint.lng +
  3938. "," +
  3939. endPoint.lat +
  3940. "," +
  3941. endZD +
  3942. "&mode=car&callnative=1&coordinate=wgs84&src=mypage",
  3943. };
  3944. var timeout = 600;
  3945. // 判断操作系统,返回百度的不同操作系统下的接口
  3946. function adjustOS() {
  3947. var ua = window.navigator.userAgent.toLowerCase();
  3948. return ua.indexOf("os") > 0
  3949. ? baiduConfig.scheme_IOS
  3950. : baiduConfig.scheme_Android;
  3951. }
  3952. var startTime = Date.now();
  3953. var ifr = document.createElement("iframe");
  3954. ifr.src = adjustOS();
  3955. ifr.style.display = "none";
  3956. document.body.appendChild(ifr);
  3957. var t = setTimeout(function () {
  3958. var endTime = Date.now();
  3959. if (!startTime || endTime - startTime < timeout + 200) {
  3960. window.location.href = baiduConfig.scheme_web;
  3961. }
  3962. }, timeout);
  3963. window.onblur = function () {
  3964. clearTimeout(t);
  3965. };
  3966. return false;
  3967. },
  3968. });
  3969. });
  3970. }
  3971. document.activeElement.blur(); // 关闭软键盘
  3972. }
  3973. });
  3974. // 自驾的渲染结果
  3975. function drivingResultLine(startZD, endZD) {
  3976. var resPoint = null;
  3977. var startPoint, endPoint, startText, endText, startAddress, endAddress;
  3978. $(".show-third").show().siblings().hide();
  3979. $(".right-map").hide().siblings(".top_search").hide();
  3980. $(".right-search").css("top", "20.06666vw");
  3981. $(".icon-shq").css("top", "20.06666vw");
  3982. $(".title-second")
  3983. .css("margin", "2.93333vw auto 44vw")
  3984. .siblings(".show-third .content-third")
  3985. .hide();
  3986. $(".boxpanel").show();
  3987. $(".zjboxpanel").hide();
  3988. let ZJstart = contrastArrey.filter(function (i) {
  3989. return i.address == startZD;
  3990. });
  3991. let ZJend = contrastArrey.filter(function (i) {
  3992. return i.address == endZD;
  3993. });
  3994. if (ZJstart.length == 0 && ZJend.length == 0) {
  3995. $("#startDrving").show().siblings().show();
  3996. drivingStartSearch(startZD);
  3997. drivingEndSearch(endZD);
  3998. $(document)
  3999. .off("click")
  4000. .on("click", ".openstartinfo", function () {
  4001. map.clearOverlays();
  4002. startPoint = new BMap.Point($(this).data("lng"), $(this).data("lat"));
  4003. startText = $(this).data("text");
  4004. startAddress = $(this).data("add");
  4005. $(this)
  4006. .find("p")
  4007. .addClass("change_text_color")
  4008. .parents("li")
  4009. .siblings()
  4010. .find("p")
  4011. .removeClass("change_text_color");
  4012. $(".boxpanel").show().siblings(".content-third").show();
  4013. });
  4014. $(document).on("click", ".openendinfo", async function () {
  4015. if (startPoint == null) {
  4016. layer.msg("请先选择起点!");
  4017. } else {
  4018. endPoint = new BMap.Point($(this).data("lng"), $(this).data("lat"));
  4019. endText = $(this).data("text");
  4020. endAddress = $(this).data("add");
  4021. $(this)
  4022. .find("p")
  4023. .addClass("change_text_color")
  4024. .parents("li")
  4025. .siblings()
  4026. .find("p")
  4027. .removeClass("change_text_color");
  4028. $(".show-third .content-third").show();
  4029. $(".boxpanel").hide();
  4030. $("#zj-one").val(startText);
  4031. $("#zj-two").val(endText);
  4032. var res = JSON.stringify([startText, endText]);
  4033. localStorage.setItem("line", res);
  4034. resPoint = JSON.stringify([startPoint, endPoint]);
  4035. localStorage.setItem("Point", resPoint);
  4036. busResultContLine();
  4037. drivingResultContLine();
  4038. var result = JSON.stringify([startText, endText]);
  4039. localStorage.setItem("lineText", result);
  4040. localStorage.setItem("discern", "4");
  4041. startZD = "";
  4042. endZD = "";
  4043. }
  4044. });
  4045. } else if (ZJstart.length > 0) {
  4046. $(".boxpanel").show();
  4047. $("#startDrving")
  4048. .hide()
  4049. .siblings("#startPanel")
  4050. .empty()
  4051. .hide()
  4052. .siblings("#endDrving")
  4053. .show()
  4054. .siblings("#endPanel")
  4055. .show();
  4056. $("#result1").empty();
  4057. drivingEndSearch(endZD);
  4058. $(document)
  4059. .off("click")
  4060. .on("click", ".openendinfo", async function () {
  4061. endText = $(this).data("text");
  4062. endPoint = new BMap.Point($(this).data("lng"), $(this).data("lat"));
  4063. $(this)
  4064. .find("p")
  4065. .addClass("change_text_color")
  4066. .parents("li")
  4067. .siblings()
  4068. .find("p")
  4069. .removeClass("change_text_color");
  4070. $(".show-third .content-third").show().siblings(".boxpanel").hide();
  4071. $("#zj-one").val(startZD);
  4072. $("#zj-two").val(endText);
  4073. await new Promise((resolve, reject) => {
  4074. myGeo.getPoint(
  4075. startZD,
  4076. function (point) {
  4077. if (point) {
  4078. startData = new BMap.Point(point.lng, point.lat);
  4079. resolve();
  4080. }
  4081. },
  4082. "重庆市"
  4083. );
  4084. });
  4085. var start = new BMap.Point(startData.lng, startData.lat);
  4086. var res = JSON.stringify([startZD, endText]);
  4087. localStorage.setItem("line", res);
  4088. resPoint = JSON.stringify([start, endPoint]);
  4089. localStorage.setItem("Point", resPoint);
  4090. busResultContLine();
  4091. drivingResultContLine();
  4092. var result = JSON.stringify([startZD, endText]);
  4093. localStorage.setItem("lineText", result);
  4094. localStorage.setItem("discern", "4");
  4095. startZD = "";
  4096. endZD = "";
  4097. });
  4098. } else if (ZJend.length > 0) {
  4099. $(".show-third .content-third").hide();
  4100. $(".boxpanel").show();
  4101. $("#endDrving").hide().siblings("#endPanel").hide();
  4102. $("#startDrving").show().siblings("#startPanel").show();
  4103. drivingStartSearch(startZD);
  4104. $(document)
  4105. .off("click")
  4106. .on("click", ".openstartinfo", async function () {
  4107. $(".boxpanel").hide();
  4108. $(".show-third .content-third").show();
  4109. map.clearOverlays();
  4110. startPoint = new BMap.Point($(this).data("lng"), $(this).data("lat"));
  4111. startText = $(this).data("text");
  4112. $(this)
  4113. .find("p")
  4114. .addClass("change_text_color")
  4115. .parents("li")
  4116. .siblings()
  4117. .find("p")
  4118. .removeClass("change_text_color");
  4119. $("#zj-one").val(startText);
  4120. $("#zj-two").val(endZD);
  4121. await new Promise((resolve, reject) => {
  4122. myGeo.getPoint(
  4123. endZD,
  4124. function (point) {
  4125. if (point) {
  4126. endData = new BMap.Point(point.lng, point.lat);
  4127. resolve();
  4128. }
  4129. },
  4130. "重庆市"
  4131. );
  4132. });
  4133. var end = new BMap.Point(endData.lng, endData.lat);
  4134. var res = JSON.stringify([startText, endZD]);
  4135. localStorage.setItem("line", res);
  4136. resPoint = JSON.stringify([startPoint, end]);
  4137. localStorage.setItem("Point", resPoint);
  4138. busResultContLine();
  4139. drivingResultContLine();
  4140. var result = JSON.stringify([startText, endZD]);
  4141. localStorage.setItem("lineText", result);
  4142. localStorage.setItem("discern", "4");
  4143. startZD = "";
  4144. endZD = "";
  4145. });
  4146. }
  4147. function drivingStartSearch(startZD) {
  4148. var startResults = null;
  4149. var startOption = {
  4150. onSearchComplete: function (results) {
  4151. // 判断状态是否正确
  4152. if (startSearch.getStatus() == BMAP_STATUS_SUCCESS) {
  4153. startResults = results;
  4154. var openStartInfoWindowHtml = "";
  4155. for (var i = 0; i < results.getCurrentNumPois(); i++) {
  4156. var startcount = i + 1;
  4157. openStartInfoWindowHtml +=
  4158. "<li data-add='" +
  4159. results.getPoi(i).address +
  4160. "' data-text='" +
  4161. results.getPoi(i).title +
  4162. "' data-lng='" +
  4163. results.getPoi(i).point.lng +
  4164. "' data-lat='" +
  4165. results.getPoi(i).point.lat +
  4166. "' class='openstartinfo'>";
  4167. openStartInfoWindowHtml += "<a href='#endDrving'>";
  4168. openStartInfoWindowHtml += "<div class='warp_choice'>";
  4169. openStartInfoWindowHtml += "<span>" + startcount + ".</span>";
  4170. openStartInfoWindowHtml += "<p>";
  4171. openStartInfoWindowHtml += results.getPoi(i).title;
  4172. openStartInfoWindowHtml += "</p>";
  4173. openStartInfoWindowHtml += "</div>";
  4174. openStartInfoWindowHtml += "<p>地址:";
  4175. openStartInfoWindowHtml += results.getPoi(i).address;
  4176. openStartInfoWindowHtml += "</p></div>";
  4177. openStartInfoWindowHtml += "</a>";
  4178. openStartInfoWindowHtml += "</li>";
  4179. }
  4180. $("#startPanel").empty().append(openStartInfoWindowHtml);
  4181. } else {
  4182. startResults = null;
  4183. }
  4184. },
  4185. };
  4186. var startSearch = new BMap.LocalSearch(map, startOption);
  4187. startSearch.search(startZD);
  4188. }
  4189. function drivingEndSearch(endZD) {
  4190. var endResults = null;
  4191. var endOption = {
  4192. onSearchComplete: function (results) {
  4193. // 判断状态是否正确
  4194. if (endSearch.getStatus() == BMAP_STATUS_SUCCESS) {
  4195. endResults = results;
  4196. var openEndInfoWindowHtml = "";
  4197. for (var i = 0; i < results.getCurrentNumPois(); i++) {
  4198. var endcount = i + 1;
  4199. openEndInfoWindowHtml +=
  4200. "<li data-add='" +
  4201. results.getPoi(i).address +
  4202. "' data-text='" +
  4203. results.getPoi(i).title +
  4204. "' data-lng='" +
  4205. results.getPoi(i).point.lng +
  4206. "' data-lat='" +
  4207. results.getPoi(i).point.lat +
  4208. "' class='openendinfo'>";
  4209. openEndInfoWindowHtml += "<div class='warp_choice'>";
  4210. openEndInfoWindowHtml += "<span>" + endcount + ".</span>";
  4211. openEndInfoWindowHtml += "<p>";
  4212. openEndInfoWindowHtml += results.getPoi(i).title;
  4213. openEndInfoWindowHtml += "</p>";
  4214. openEndInfoWindowHtml += "</div>";
  4215. openEndInfoWindowHtml += "<p>地址:";
  4216. openEndInfoWindowHtml += results.getPoi(i).address;
  4217. openEndInfoWindowHtml += "</p></div>";
  4218. openEndInfoWindowHtml += "</li>";
  4219. }
  4220. $("#endPanel").empty().append(openEndInfoWindowHtml);
  4221. } else {
  4222. endResults = null;
  4223. }
  4224. },
  4225. };
  4226. var endSearch = new BMap.LocalSearch(map, endOption);
  4227. endSearch.search(endZD);
  4228. }
  4229. }
  4230. // 封装公交的路线
  4231. function busResultContLine() {
  4232. var routePolicy = [
  4233. BMAP_TRANSIT_POLICY_LEAST_TIME,
  4234. BMAP_TRANSIT_POLICY_LEAST_TRANSFER,
  4235. BMAP_TRANSIT_POLICY_LEAST_WALKING,
  4236. BMAP_TRANSIT_POLICY_AVOID_SUBWAYS,
  4237. ];
  4238. var discriptHtml = "";
  4239. var line = JSON.parse(localStorage.getItem("line"));
  4240. var resultPoint = JSON.parse(localStorage.getItem("Point"));
  4241. var start = new BMap.Point(resultPoint[0].lng, resultPoint[0].lat);
  4242. var end = new BMap.Point(resultPoint[1].lng, resultPoint[1].lat);
  4243. $("#result").empty();
  4244. $(".content-title>li:nth-child(1)")
  4245. .addClass("layui-this")
  4246. .siblings()
  4247. .removeClass("layui-this");
  4248. var transit = new BMap.TransitRoute(map, {
  4249. renderOptions: {
  4250. map: map,
  4251. panel: "result",
  4252. },
  4253. policy: 0,
  4254. onSearchComplete: function (results) {
  4255. if (transit.getStatus() == BMAP_STATUS_SUCCESS) {
  4256. discriptHtml = "";
  4257. $(".show-second .content-title").show();
  4258. return;
  4259. } else {
  4260. $(".show-second .content-title").hide();
  4261. discriptHtml += "<div class='no_results'>在重庆市 ";
  4262. discriptHtml += "未能计算出从“";
  4263. discriptHtml += line[0];
  4264. discriptHtml += "”到“";
  4265. discriptHtml += line[1];
  4266. discriptHtml += "”公交路线,抱歉。";
  4267. discriptHtml += "</div>";
  4268. $("#result").empty().append(discriptHtml);
  4269. map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
  4270. }
  4271. },
  4272. });
  4273. map.clearOverlays();
  4274. transit.clearResults();
  4275. transit.setPolicy(routePolicy[0]);
  4276. transit.search(start, end);
  4277. }
  4278. // 公交选择其他方案
  4279. $(".show-second .content-title>li").click(function () {
  4280. const liIndex = $(this).index();
  4281. var routePolicy = [
  4282. BMAP_TRANSIT_POLICY_LEAST_TIME,
  4283. BMAP_TRANSIT_POLICY_LEAST_TRANSFER,
  4284. BMAP_TRANSIT_POLICY_LEAST_WALKING,
  4285. BMAP_TRANSIT_POLICY_AVOID_SUBWAYS,
  4286. ];
  4287. var discriptHtml = "";
  4288. var line = JSON.parse(localStorage.getItem("line"));
  4289. var resultPoint = JSON.parse(localStorage.getItem("Point"));
  4290. var start = new BMap.Point(resultPoint[0].lng, resultPoint[0].lat);
  4291. var end = new BMap.Point(resultPoint[1].lng, resultPoint[1].lat);
  4292. var transit = new BMap.TransitRoute(map, {
  4293. renderOptions: {
  4294. map: map,
  4295. panel: "result",
  4296. },
  4297. policy: 0,
  4298. onSearchComplete: function (results) {
  4299. if (transit.getStatus() == BMAP_STATUS_SUCCESS) {
  4300. discriptHtml = "";
  4301. $(".show-second .content-title").show();
  4302. return;
  4303. } else {
  4304. $(".show-second .content-title").hide();
  4305. discriptHtml += "<div class='no_results'>在重庆市 ";
  4306. discriptHtml += "未能计算出从“";
  4307. discriptHtml += line[0];
  4308. discriptHtml += "”到“";
  4309. discriptHtml += line[1];
  4310. discriptHtml += "”公交路线,抱歉。";
  4311. discriptHtml += "</div>";
  4312. $("#result").empty().append(discriptHtml);
  4313. map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
  4314. }
  4315. },
  4316. });
  4317. transit.clearResults();
  4318. map.clearOverlays();
  4319. transit.setPolicy(routePolicy[liIndex]);
  4320. transit.search(start, end);
  4321. });
  4322. // 封装自驾的路线
  4323. function drivingResultContLine() {
  4324. var drivingRoutePolicy = [
  4325. BMAP_DRIVING_POLICY_LEAST_TIME,
  4326. BMAP_DRIVING_POLICY_LEAST_DISTANCE,
  4327. BMAP_DRIVING_POLICY_AVOID_HIGHWAYS,
  4328. ];
  4329. var resultPoint = JSON.parse(localStorage.getItem("Point"));
  4330. var start = new BMap.Point(resultPoint[0].lng, resultPoint[0].lat);
  4331. var end = new BMap.Point(resultPoint[1].lng, resultPoint[1].lat);
  4332. $("#result1").empty();
  4333. $(".main-third>li:nth-child(1)")
  4334. .addClass("layui-this")
  4335. .siblings()
  4336. .removeClass("layui-this");
  4337. var drivingRoute = new BMap.DrivingRoute(map, {
  4338. renderOptions: {
  4339. map: map,
  4340. panel: "result1",
  4341. autoViewport: true,
  4342. enableDragging: true,
  4343. },
  4344. });
  4345. map.clearOverlays();
  4346. drivingRoute.clearResults();
  4347. drivingRoute.setPolicy(drivingRoutePolicy[0]);
  4348. drivingRoute.search(start, end);
  4349. }
  4350. // 自驾选择其他方案
  4351. $("#zjxz>li").click(function () {
  4352. const liIndex = $(this).index();
  4353. var drivingRoutePolicy = [
  4354. BMAP_DRIVING_POLICY_LEAST_TIME,
  4355. BMAP_DRIVING_POLICY_LEAST_DISTANCE,
  4356. BMAP_DRIVING_POLICY_AVOID_HIGHWAYS,
  4357. ];
  4358. var resultPoint = JSON.parse(localStorage.getItem("Point"));
  4359. var start = new BMap.Point(resultPoint[0].lng, resultPoint[0].lat);
  4360. var end = new BMap.Point(resultPoint[1].lng, resultPoint[1].lat);
  4361. $("#result1").empty();
  4362. var drivingRoute = new BMap.DrivingRoute(map, {
  4363. renderOptions: {
  4364. map: map,
  4365. panel: "result1",
  4366. autoViewport: true,
  4367. enableDragging: true,
  4368. },
  4369. });
  4370. map.clearOverlays();
  4371. drivingRoute.clearResults();
  4372. drivingRoute.setPolicy(drivingRoutePolicy[liIndex]);
  4373. drivingRoute.search(start, end);
  4374. });
  4375. // 点击搜索的图标,显示
  4376. $(".inp-icon1").click(function () {
  4377. searchClick();
  4378. });
  4379. function searchClick() {
  4380. indexList = 0;
  4381. ssList = 2;
  4382. map.clearOverlays();
  4383. var searchInp = $(".inp").val();
  4384. if (searchInp == "" || searchInp == null) {
  4385. layer.msg("输入的值不能为空!");
  4386. } else {
  4387. document.activeElement.blur();
  4388. setTimeout(function () {
  4389. var wsHeight =
  4390. window.outerHeight -
  4391. $(".right-map").innerHeight() -
  4392. $(".head").innerHeight() -
  4393. 11;
  4394. var rmHeight =
  4395. window.outerHeight -
  4396. $(".right-map").innerHeight() -
  4397. $(".head").innerHeight();
  4398. $(".wrap_result1").css("height", wsHeight);
  4399. $(".show-fourth").css("height", rmHeight);
  4400. searchEvent(searchInp);
  4401. searchJSON(searchInp);
  4402. }, 800);
  4403. }
  4404. }
  4405. $(".inp").bind("keyup", function (event) {
  4406. indexList = 0;
  4407. ssList = 2;
  4408. var searchInp = $(".inp").val();
  4409. map.clearOverlays();
  4410. if (event.keyCode == 13) {
  4411. if (searchInp == "" || searchInp == null) {
  4412. layer.msg("输入的值不能为空!");
  4413. } else {
  4414. document.activeElement.blur();
  4415. setTimeout(function () {
  4416. var wsHeight =
  4417. window.outerHeight -
  4418. $(".right-map").innerHeight() -
  4419. $(".head").innerHeight() -
  4420. 11;
  4421. var rmHeight =
  4422. window.outerHeight -
  4423. $(".right-map").innerHeight() -
  4424. $(".head").innerHeight();
  4425. $(".wrap_result1").css("height", wsHeight);
  4426. $(".show-fourth").css("height", rmHeight);
  4427. searchEvent(searchInp);
  4428. searchJSON(searchInp);
  4429. }, 800);
  4430. }
  4431. // document.activeElement.blur(); // 关闭软键盘
  4432. }
  4433. });
  4434. function searchJSON(searchInp) {
  4435. $(".show-fourth").show().siblings().hide();
  4436. $(".right-search").hide();
  4437. $(".top_search").show();
  4438. var digitGroup = [];
  4439. $.each(getAllJson, function (j) {
  4440. $.each(getAllJson[j], function (k) {
  4441. var stringText = "" + getAllJson[j][k];
  4442. if (stringText.indexOf(searchInp) > -1) {
  4443. var getArrey = [];
  4444. if (
  4445. getAllJson[j].dep == getAllJson[j][k] ||
  4446. getAllJson[j].type == getAllJson[j][k] ||
  4447. getAllJson[j].sptype == getAllJson[j][k]
  4448. ) {
  4449. getArrey = getAllJson[j];
  4450. }
  4451. digitGroup.push(getArrey);
  4452. }
  4453. });
  4454. });
  4455. let removeZero = digitGroup.filter((item) => item.length != 0);
  4456. // let newDigitGroup = [...new Set(removeZero)]
  4457. for (let i = 0; i < removeZero.length; i++) {
  4458. for (let j = i + 1; j < removeZero.length; j++) {
  4459. if (removeZero[j].dep === removeZero[i].dep) {
  4460. removeZero.splice(j, 1);
  4461. }
  4462. }
  4463. }
  4464. for (let i = 0; i < removeZero.length; i++) {
  4465. for (let j = i + 1; j < removeZero.length; j++) {
  4466. if (removeZero[j].dep === removeZero[i].dep) {
  4467. removeZero.splice(j, 1);
  4468. }
  4469. }
  4470. }
  4471. for (let i = 0; i < removeZero.length; i++) {
  4472. for (let j = i + 1; j < removeZero.length; j++) {
  4473. if (removeZero[j].dep === removeZero[i].dep) {
  4474. removeZero.splice(j, 1);
  4475. }
  4476. }
  4477. }
  4478. for (let i = 0; i < removeZero.length; i++) {
  4479. for (let j = i + 1; j < removeZero.length; j++) {
  4480. if (removeZero[j].dep === removeZero[i].dep) {
  4481. removeZero.splice(j, 1);
  4482. }
  4483. }
  4484. }
  4485. // console.log(removeZero)
  4486. if (removeZero == "") {
  4487. var html = "";
  4488. html +=
  4489. '<div style="width: 85.5%;margin: 0 auto 0;color: #2775CC;font-size:14px;text-align:center;">暂无数据</div>';
  4490. $(".show-fourth .pad_box").empty().append(html);
  4491. $(".show-first").hide();
  4492. $(".show-fourth").show();
  4493. $(".right-map").css("height", hlHeight);
  4494. var rmHeight =
  4495. window.outerHeight -
  4496. $(".right-map").innerHeight() -
  4497. $(".head").innerHeight();
  4498. var windowHeight =
  4499. $(".right-map").innerHeight() - $(".head").innerHeight() + 45;
  4500. var spWidth =
  4501. ($(".show-fourth").innerWidth() - $(".wrap_result1").innerWidth()) / 2;
  4502. // $('.wrap_result1').css({'top': spWidth,'left': spWidth});
  4503. $(".title-second").css({ top: windowHeight, left: spWidth });
  4504. } else {
  4505. $(".show-fourth").show().siblings().hide();
  4506. $(".right-map").css("height", hlHeight);
  4507. var windowHeight =
  4508. $(".right-map").innerHeight() - $(".head").innerHeight() + 45;
  4509. var spWidth =
  4510. ($(".show-fourth").innerWidth() - $(".wrap_result1").innerWidth()) / 2;
  4511. // $('.wrap_result1').css({'top': spWidth,'left': spWidth});
  4512. $(".title-second").css({ top: windowHeight, left: spWidth });
  4513. $(".right-search").hide();
  4514. $(".top_search").show();
  4515. var loading = layer.msg("加载中..", {
  4516. icon: 16,
  4517. shade: 0.3,
  4518. time: false,
  4519. });
  4520. setTimeout(function (data) {
  4521. //最后数据加载完 让 loading层消失
  4522. xrList(removeZero);
  4523. layer.close(loading);
  4524. }, 500);
  4525. }
  4526. }
  4527. // 上下移动的内容框
  4528. $(".arrowss").click(function () {
  4529. var height = $(".left-map").height();
  4530. if ($(this).hasClass("layui-icon-up")) {
  4531. $(".left-map").height(70 + "%");
  4532. $(this).removeClass("layui-icon-up").addClass("layui-icon-down");
  4533. } else {
  4534. $(".left-map").height(355);
  4535. $(this).removeClass("layui-icon-down").addClass("layui-icon-up");
  4536. }
  4537. });
  4538. $(".btn_back").click(function () {
  4539. map.clearOverlays();
  4540. map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
  4541. let ran = navigator.userAgent;
  4542. let isIOS = !!ran.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  4543. if (blList == 1) {
  4544. if (isIOS) {
  4545. $(".show-fourth").show().siblings().hide();
  4546. var hBHeight = (window.outerHeight - $(".head").outerHeight()) / 2;
  4547. var windowHeight =
  4548. window.outerHeight -
  4549. $(".right-map").innerHeight() -
  4550. $(".head").innerHeight();
  4551. var spWidth =
  4552. ($(".show-fourth").innerWidth() - $(".wrap_result1").innerWidth()) /
  4553. 2;
  4554. $(".title-second").css({ top: windowHeight, left: spWidth });
  4555. $(".right-search").hide();
  4556. $(".right-map").show().siblings(".top_search").show();
  4557. $(".right-map").css("height", hBHeight);
  4558. $(".content_from_ajax .layui-tab-title>li:nth-child(1)")
  4559. .addClass("layui-this")
  4560. .siblings()
  4561. .removeClass("layui-this");
  4562. $(".content_from_ajax .layui-tab-content .layui-tab-item:nth-child(1)")
  4563. .addClass("layui-show")
  4564. .siblings()
  4565. .removeClass("layui-show");
  4566. $(".result_form_ajax").empty();
  4567. xrList(getAllArr);
  4568. initSearchEventPage();
  4569. blList = 2;
  4570. ssList = 2;
  4571. $(".wrap_result1").scrollTop(scrollListHeight1);
  4572. } else {
  4573. $(".show-fourth").show().siblings().hide();
  4574. var windowHeight =
  4575. $(".right-map").innerHeight() - $(".head").innerHeight() + 45;
  4576. var spWidth =
  4577. ($(".show-fourth").innerWidth() - $(".wrap_result1").innerWidth()) /
  4578. 2;
  4579. // $('.wrap_result1').css({'top': spWidth,'left': spWidth});
  4580. $(".title-second").css({ top: windowHeight, left: spWidth });
  4581. $(".right-search").hide();
  4582. $(".right-map").show().siblings(".top_search").show();
  4583. $(".right-map").css("height", hlHeight);
  4584. // $('.show-fifth .back_top').show();
  4585. $(".content_from_ajax .layui-tab-title>li:nth-child(1)")
  4586. .addClass("layui-this")
  4587. .siblings()
  4588. .removeClass("layui-this");
  4589. $(".content_from_ajax .layui-tab-content .layui-tab-item:nth-child(1)")
  4590. .addClass("layui-show")
  4591. .siblings()
  4592. .removeClass("layui-show");
  4593. $(".result_form_ajax").empty();
  4594. xrList(getAllArr);
  4595. initSearchEventPage();
  4596. blList = 2;
  4597. ssList = 2;
  4598. $(".wrap_result1").scrollTop(scrollListHeight1);
  4599. }
  4600. } else if (blList == 2) {
  4601. window.location.reload();
  4602. }
  4603. });
  4604. // 点击搜索的出现结果部分的返回到首页
  4605. $(".backBtn").click(function () {
  4606. // if (gjIndex == 1){
  4607. // window.location.reload();
  4608. // localStorage.setItem('discern','0');
  4609. // } else if(gjIndex == 2){
  4610. // const startGJ = $("#gj-one").val();
  4611. // const endGJ = $("#gj-two").val();
  4612. // busResultLine(startGJ,endGJ);
  4613. // gjIndex = 1;
  4614. // }
  4615. // if (zjIndex == 1){
  4616. // window.location.reload();
  4617. // localStorage.setItem('discern','0');
  4618. // } else if(zjIndex == 2){
  4619. // const startZJ = $("#zj-one").val();
  4620. // const endZJ = $("#zj-two").val();
  4621. // drivingResultLine(startZJ,endZJ);
  4622. // zjIndex = 1;
  4623. // }
  4624. var discern = localStorage.getItem("discern");
  4625. if (discern == 1) {
  4626. window.location.reload();
  4627. localStorage.setItem("discern", "0");
  4628. var object = JSON.stringify(["", ""]);
  4629. localStorage.setItem("lineText", object);
  4630. } else if (discern == 3) {
  4631. window.location.reload();
  4632. localStorage.setItem("discern", "0");
  4633. var object = JSON.stringify(["", ""]);
  4634. localStorage.setItem("lineText", object);
  4635. } else if (discern == 2) {
  4636. const startGJ = $("#gj-one").val();
  4637. const endGJ = $("#gj-two").val();
  4638. busResultLine(startGJ, endGJ);
  4639. localStorage.setItem("discern", "1");
  4640. } else if (discern == 4) {
  4641. const startZJ = $("#zj-one").val();
  4642. const endZJ = $("#zj-two").val();
  4643. drivingResultLine(startZJ, endZJ);
  4644. localStorage.setItem("discern", "3");
  4645. }
  4646. });
  4647. $(".back_btn").click(function () {
  4648. map.clearOverlays();
  4649. map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
  4650. if ($(this).parent().next().attr("sign") == "isShowAddress") {
  4651. window.location.reload();
  4652. return;
  4653. }
  4654. if (indexList == 1) {
  4655. applyClickList();
  4656. xrList(getAllArr);
  4657. indexList = 2;
  4658. $(".show-fifth .back_top").show();
  4659. $(".wrap_result").scrollTop(scrollListHeight);
  4660. $(".content_from_ajax3").parent().addClass("layui-hide");
  4661. } else if (indexList == 2) {
  4662. window.location.reload();
  4663. }
  4664. });
  4665. $(".back_Btn").click(function () {
  4666. // 清空url中携带的参数
  4667. // 获取当前页面的url
  4668. var url = window.location.href;
  4669. // 判断是否存在参数
  4670. if (url.indexOf("?") != -1) {
  4671. // 去除参数
  4672. url = url.replace(/(\?|#)[^'"]*/, "");
  4673. window.history.pushState({}, 0, url);
  4674. }
  4675. if (ssList == 1) {
  4676. map.clearOverlays();
  4677. $(".show-first").hide();
  4678. $(".show-fourth").show();
  4679. $(".right-map").css("height", hlHeight);
  4680. var windowHeight =
  4681. $(".right-map").innerHeight() - $(".head").innerHeight() + 45;
  4682. var spWidth =
  4683. ($(".show-fourth").innerWidth() - $(".wrap_result1").innerWidth()) / 2;
  4684. // $('.wrap_result1').css({'top': spWidth,'left': spWidth});
  4685. $(".title-second").css({ top: windowHeight, left: spWidth });
  4686. $(".right-search").hide();
  4687. $(".top_search").show();
  4688. $(".show-fifth .back_top").show();
  4689. xrList(getAllArr);
  4690. ssList = 2;
  4691. indexList = 0;
  4692. $(".wrap_result1").scrollTop(scrollListHeight1);
  4693. } else if (ssList == 2) {
  4694. window.location.reload();
  4695. } else if (ssList == 3) {
  4696. searchClick()
  4697. }
  4698. });
  4699. $(".wrap_result").scroll(function () {
  4700. var topHeight = $(this)
  4701. .children(".pad_box")
  4702. .find(".titleFirst")
  4703. .outerHeight();
  4704. var top = $(this).scrollTop();
  4705. if (top > topHeight) {
  4706. $(".show-fifth .back_top").css("display", "block");
  4707. } else if (top < topHeight) {
  4708. $(".show-fifth .back_top").hide();
  4709. }
  4710. });
  4711. $(".wrap_result1").scroll(function () {
  4712. var topHeight = $(this)
  4713. .children(".pad_box")
  4714. .find(".titleFirst")
  4715. .outerHeight();
  4716. var top = $(this).scrollTop();
  4717. if (top > topHeight) {
  4718. $(".show-fourth .back_top").css("display", "block");
  4719. } else if (top < topHeight) {
  4720. $(".show-fourth .back_top").hide();
  4721. }
  4722. });
  4723. $(".show-fourth .back_top").click(function () {
  4724. $(".wrap_result1").scrollTop(0);
  4725. });
  4726. $(".show-fifth .back_top").click(function () {
  4727. $(".wrap_result").scrollTop(0);
  4728. });
  4729. var markerInfo = {
  4730. markers: [],
  4731. data: [],
  4732. myMark: null,
  4733. };
  4734. var geolocation = new BMap.Geolocation();
  4735. geolocation.getCurrentPosition(function (r) {
  4736. if (this.getStatus() == BMAP_STATUS_SUCCESS) {
  4737. var mk = new BMap.Marker(r.point);
  4738. markerInfo.myMark = r.point;
  4739. let ccount = 0;
  4740. let sta = false,
  4741. sta2 = false;
  4742. for (let i = 0; i < ggfwzx.length; i++) {
  4743. myGeo.getPoint(
  4744. ggfwzx[i].address,
  4745. function (point) {
  4746. if (point) {
  4747. const addr = map.getDistance(r.point, point);
  4748. if (addr <= 1000) {
  4749. if (i == ggfwzx.length - 1) {
  4750. sta = true;
  4751. }
  4752. markerInfo.data.push(ggfwzx[i]);
  4753. markerInfo.markers.push(point);
  4754. ccount++;
  4755. var myIcon = new BMap.Icon(
  4756. "./img/location.png",
  4757. new BMap.Size(40, 40)
  4758. );
  4759. var marker = new BMap.Marker(point, {
  4760. icon: myIcon,
  4761. });
  4762. map.addOverlay(marker);
  4763. marker.addEventListener("click", function (e) {
  4764. showAddressDetail(ggfwzx[i], point);
  4765. });
  4766. }
  4767. }
  4768. },
  4769. "重庆市"
  4770. );
  4771. }
  4772. for (let i = 0; i < xzfwzx.length; i++) {
  4773. myGeo.getPoint(
  4774. xzfwzx[i].address,
  4775. function (point) {
  4776. if (point) {
  4777. const addr = map.getDistance(r.point, point);
  4778. if (addr <= 1000) {
  4779. if (i == xzfwzx.length - 1) {
  4780. sta2 = true;
  4781. }
  4782. markerInfo.data.push(xzfwzx[i]);
  4783. markerInfo.markers.push(point);
  4784. ccount++;
  4785. var myIcon = new BMap.Icon(
  4786. "./img/location.png",
  4787. new BMap.Size(40, 40)
  4788. );
  4789. var marker = new BMap.Marker(point, {
  4790. icon: myIcon,
  4791. });
  4792. map.addOverlay(marker);
  4793. marker.addEventListener("click", function (e) {
  4794. showAddressDetail(xzfwzx[i], point);
  4795. });
  4796. }
  4797. }
  4798. },
  4799. "重庆市"
  4800. );
  4801. }
  4802. var myTask = setInterval(function () {
  4803. if (sta && sta2) {
  4804. $("#bsddNum").text(ccount);
  4805. clearInterval(myTask);
  4806. }
  4807. }, 500);
  4808. map.addOverlay(mk);
  4809. map.panTo(r.point);
  4810. myGeo.getLocation(r.point, function (rs) {
  4811. var addComp = rs.surroundingPois[0].title;
  4812. $("#gj-one").val(addComp);
  4813. $("#zj-one").val(addComp);
  4814. });
  4815. } else {
  4816. // alert('未能获得您的定位,请手动输入起点');
  4817. }
  4818. });
  4819. function showAddressDetail(getClick, point) {
  4820. $(".show-fourth").hide();
  4821. var addFirst;
  4822. scrollListHeight = $(".wrap_result").scrollTop();
  4823. scrollListHeight1 = $(".wrap_result1").scrollTop();
  4824. var address = new BMap.Point(point.lng, point.lat);
  4825. addFirst = address;
  4826. applyClickList();
  4827. $(".right-search").hide().css("top", "0px");
  4828. $(".top_search").hide();
  4829. let arr = [];
  4830. arr.push(getClick);
  4831. xrResultList(arr, "isShowAddress");
  4832. indexList = 1;
  4833. ssList = 1;
  4834. map.setCenter(addFirst);
  4835. $("#deptDiv div")
  4836. .removeClass("layui-border-green")
  4837. .addClass("layui-border-blue");
  4838. $(this).removeClass("layui-border-blue").addClass("layui-border-green");
  4839. var firstpage = 1;
  4840. var pagetype = 0;
  4841. setTimeout(function () {
  4842. if (deptArr[getClick.dep]) {
  4843. initmarkDetail(getClick);
  4844. } else {
  4845. initmarkDetail2(getClick);
  4846. }
  4847. }, 200);
  4848. }
  4849. var digitGroupItem = [];
  4850. function searchEvent(val) {
  4851. getDeptList(val);
  4852. }
  4853. function getDeptList(val) {
  4854. $.ajax({
  4855. url: PATH + "/mapdata/searchHandMatterByVal",
  4856. type: "GET",
  4857. data: {
  4858. queryVal: val,
  4859. },
  4860. success: function (res) {
  4861. let sContnet = "";
  4862. if (res && res.data && res.data.length) {
  4863. $.each(res.data, function (j) {
  4864. if (res.data[j].itemName == undefined) {
  4865. sContnet += "";
  4866. } else {
  4867. let filterArr = res.data[j].depts.split(",");
  4868. let bool = filterArr.every((item) =>
  4869. deptArr["重庆市南岸区政务服务中心(南坪中心)"].includes(item)
  4870. );
  4871. let bool1 = filterArr.every((item) =>
  4872. deptArr["重庆市南岸区政务服务中心(江南新城中心)"].includes(
  4873. item
  4874. )
  4875. );
  4876. if (bool) {
  4877. res.data[j].fomartDept += ",区政务服务中心(南坪中心)";
  4878. }
  4879. if (bool1) {
  4880. res.data[j].fomartDept += ",区政务服务中心(江南新城中心)";
  4881. }
  4882. if (res.data[j].type === 0) {
  4883. sContnet +=
  4884. "<div ><p title='" +
  4885. res.data[j].itemName +
  4886. "' class='text_from_ajax'>" +
  4887. res.data[j].itemName +
  4888. "<span style='padding-left:15px'><span style='padding-right:20px'>(" +
  4889. res.data[j].fomartDept +
  4890. ")</span>(<span class='type'>个人</span>)</span></p></div>";
  4891. } else {
  4892. sContnet +=
  4893. "<div><p title='" +
  4894. res.data[j].itemName +
  4895. "' class='text_from_ajax'>" +
  4896. res.data[j].itemName +
  4897. "<span style='padding-left:15px'><span style='padding-right:20px'>(" +
  4898. res.data[j].fomartDept +
  4899. ")</span>(<span class='type'>法人</span>)</span></p></div>";
  4900. }
  4901. }
  4902. });
  4903. $(".result_form_ajax").empty().append(sContnet);
  4904. }
  4905. },
  4906. });
  4907. }
  4908. function getDetail(val) {
  4909. ssList = 3;
  4910. $.ajax({
  4911. url: PATH + "/mapdata/getHandMatterBySearch",
  4912. type: "GET",
  4913. data: {
  4914. queryVal: val,
  4915. },
  4916. success: function (json) {
  4917. if (json && json.data && json.data.length) {
  4918. digitGroupItem = [];
  4919. let st1 = true,
  4920. st2 = true;
  4921. let dept1 = [],
  4922. dept2 = [];
  4923. $.each(json.data, function (j) {
  4924. if (
  4925. deptArr["重庆市南岸区政务服务中心(江南新城中心)"].indexOf(
  4926. json.data[j]
  4927. ) >= 0
  4928. ) {
  4929. dept1.push(json.data[j]);
  4930. st1 = false;
  4931. }
  4932. if (
  4933. deptArr["重庆市南岸区政务服务中心(南坪中心)"].indexOf(
  4934. json.data[j]
  4935. ) >= 0
  4936. ) {
  4937. dept2.push(json.data[j]);
  4938. st2 = false;
  4939. }
  4940. });
  4941. if (!st1) {
  4942. let d = xzfwzx[deptArr.jnxc];
  4943. d.searchDept = dept1;
  4944. digitGroupItem.push(d);
  4945. }
  4946. if (!st2) {
  4947. let d = xzfwzx[deptArr.npzx];
  4948. d.searchDept = dept2;
  4949. digitGroupItem.push(d);
  4950. }
  4951. $.each(getAllJson, function (j) {
  4952. if (json.data.indexOf(getAllJson[j].dep) >= 0) {
  4953. digitGroupItem.push(getAllJson[j]);
  4954. }
  4955. });
  4956. setTimeout(function () {
  4957. initSearchEventPage();
  4958. }, 500);
  4959. }
  4960. },
  4961. error: function (err) {
  4962. var html = "";
  4963. html +=
  4964. '<div style="width: 85.5%;margin: 0 auto 0;color: #2775CC;font-size:14px;text-align:center;">暂无数据</div>';
  4965. $(".show-fourth .result_form_ajax").empty().append(html);
  4966. },
  4967. });
  4968. }
  4969. $(document).on("click", ".result_form_ajax div .text_from_ajax", function () {
  4970. getDetail($(this).attr("title"));
  4971. });
  4972. function initSearchEventPage() {
  4973. if (digitGroupItem.length) {
  4974. xrList2(digitGroupItem);
  4975. } else {
  4976. var html = "";
  4977. html +=
  4978. '<div style="width: 85.5%;margin: 0 auto 0;color: #2775CC;font-size:14px;text-align:center;">暂无数据</div>';
  4979. $(".show-fourth .result_form_ajax").empty().append(html);
  4980. }
  4981. }
  4982. function initmarkDetail(getClick) {
  4983. var dep = getClick.dep;
  4984. $(".content_from_ajax .layui-tab-title")
  4985. .find(".layui-this")
  4986. .attr("id", dep);
  4987. $(".content_from_ajax").show().siblings(".marrige").hide();
  4988. var count;
  4989. var firstpage = 1;
  4990. var pagetype = 0;
  4991. scrollListHeight = $(".wrap_result").scrollTop();
  4992. const sign = $(this).attr("data-sign");
  4993. $(".right-search").hide().css("top", "0px");
  4994. $(".top_search").hide();
  4995. if ($("#deptDiv").prev().hasClass("isDel")) {
  4996. $("#deptDiv").prev().remove();
  4997. $("#deptDiv").empty();
  4998. }
  4999. if (deptArr[getClick.dep]) {
  5000. dep = deptArr[getClick.dep].join(",");
  5001. $(".show-sixth .pad_box").attr("data-dep", dep);
  5002. let html =
  5003. '<div class="layui-border-green dept-sty" data-dep="">全部</div>';
  5004. for (let n = 0; n < deptArr[getClick.dep].length; n++) {
  5005. html += `<div class="layui-border-blue dept-sty" data-dep="${
  5006. deptArr[getClick.dep][n]
  5007. }">
  5008. ${deptArr[getClick.dep][n].replace("重庆市", "").replace("南岸", "")}</div>`;
  5009. }
  5010. $("#deptDiv").empty().append(html);
  5011. $("#deptDiv").before(
  5012. `<div class="isDel" style="background: #fff;font-size: 20px;padding-left: 20px;">入驻部门</div>`
  5013. );
  5014. }
  5015. page(firstpage, pagetype, dep);
  5016. function page(page, pagetype, dep) {
  5017. $.ajax({
  5018. type: "GET",
  5019. url: PATH + "/mapdata/getHandMatterPage",
  5020. // url: "http://192.168.0.230:7777/mapdata/getHandMatterPage",
  5021. async: false,
  5022. dataType: "json",
  5023. data: {
  5024. page: page,
  5025. limit: 4,
  5026. type: pagetype,
  5027. matterDept: dep,
  5028. },
  5029. success: function (res) {
  5030. if (res.data == null) {
  5031. applyClickList();
  5032. $(".show-sixth").fadeOut(0);
  5033. $(".show-fifth").fadeIn(100);
  5034. indexList = 1;
  5035. } else if (res.data != null) {
  5036. var rmHeight =
  5037. window.outerHeight -
  5038. $(".right-map").innerHeight() -
  5039. $(".head").innerHeight();
  5040. $(".show-sixth").show().css("height", rmHeight).siblings().hide();
  5041. $(".wrap_handle").show();
  5042. count = res.count;
  5043. var html = "";
  5044. $.each(res.data, function (j) {
  5045. if (
  5046. res.data[j].itemName == undefined &&
  5047. res.data[j].matterUrl == undefined &&
  5048. res.data[j].matterDept == undefined
  5049. ) {
  5050. html += "";
  5051. } else {
  5052. html +=
  5053. "<a href='" +
  5054. res.data[j].matterUrl +
  5055. "' target='_blank' class='url_from_ajax'>";
  5056. html += "<h6 class='point_from_ajax'></h6>";
  5057. html +=
  5058. "<p title='" +
  5059. res.data[j].itemName +
  5060. "' class='text_from_ajax'>" +
  5061. res.data[j].itemName +
  5062. "</p>";
  5063. html += "</a>";
  5064. }
  5065. });
  5066. $(".layui-show .result_form_ajax").empty().append(html);
  5067. }
  5068. },
  5069. });
  5070. // if (discriptText == discrptAddress) {
  5071. // }
  5072. }
  5073. layui.use(["laypage", "layer"], function () {
  5074. var laypage = layui.laypage,
  5075. layer = layui.layer;
  5076. laypage.render({
  5077. elem: "demo",
  5078. count: count,
  5079. limit: 4,
  5080. layout: ["prev", "next"],
  5081. prev: '<i class="layui-icon layui-icon-left"></i><span>上一页</span>',
  5082. next: '<span>下一页</span><i class="layui-icon layui-icon-right"></i>',
  5083. jump: function (obj, first) {
  5084. pagetype = 0;
  5085. page(obj.curr, pagetype, dep);
  5086. },
  5087. });
  5088. });
  5089. blList = 2;
  5090. }
  5091. function initmarkDetail2(getClick) {
  5092. var dep = getClick.dep.replace("便民服务中心", "").replace("政府", "");
  5093. console.log(dep);
  5094. $(".content_from_ajax .layui-tab-title")
  5095. .find(".layui-this")
  5096. .attr("id", dep);
  5097. $(".content_from_ajax").show().siblings(".marrige").hide();
  5098. var count;
  5099. var firstpage = 1;
  5100. var pagetype = 0;
  5101. scrollListHeight = $(".wrap_result").scrollTop();
  5102. const sign = $(this).attr("data-sign");
  5103. $(".right-search").hide().css("top", "0px");
  5104. $(".top_search").hide();
  5105. page(firstpage, pagetype, dep);
  5106. function page(page, pagetype, dep) {
  5107. $.ajax({
  5108. type: "GET",
  5109. url: PATH + "/mapdata/getHandMatterPage",
  5110. // url: "http://192.168.0.230:7777/mapdata/getHandMatterPage",
  5111. async: false,
  5112. dataType: "json",
  5113. data: {
  5114. page: page,
  5115. limit: 4,
  5116. type: pagetype,
  5117. matterDept: dep,
  5118. },
  5119. success: function (res) {
  5120. if (res.data == null) {
  5121. applyClickList();
  5122. $(".show-sixth").fadeOut(0);
  5123. $(".show-fifth").fadeIn(100);
  5124. indexList = 1;
  5125. } else if (res.data != null) {
  5126. var rmHeight =
  5127. window.outerHeight -
  5128. $(".right-map").innerHeight() -
  5129. $(".head").innerHeight();
  5130. $(".show-fifth").show().css("height", rmHeight).siblings().hide();
  5131. $(".wrap_handle").show();
  5132. count = res.count;
  5133. var html = "";
  5134. $.each(res.data, function (j) {
  5135. if (
  5136. res.data[j].itemName == undefined &&
  5137. res.data[j].matterUrl == undefined &&
  5138. res.data[j].matterDept == undefined
  5139. ) {
  5140. html += "";
  5141. } else {
  5142. html +=
  5143. "<a href='" +
  5144. res.data[j].matterUrl +
  5145. "' target='_blank' class='url_from_ajax'>";
  5146. html += "<h6 class='point_from_ajax'></h6>";
  5147. html +=
  5148. "<p title='" +
  5149. res.data[j].itemName +
  5150. "' class='text_from_ajax'>" +
  5151. res.data[j].itemName +
  5152. "</p>";
  5153. html += "</a>";
  5154. }
  5155. });
  5156. $(".layui-show .result_form_ajax2").empty().append(html);
  5157. }
  5158. },
  5159. });
  5160. // if (discriptText == discrptAddress) {
  5161. // }
  5162. }
  5163. layui.use(["laypage", "layer"], function () {
  5164. var laypage = layui.laypage,
  5165. layer = layui.layer;
  5166. laypage.render({
  5167. elem: "demo2",
  5168. count: count,
  5169. limit: 4,
  5170. layout: ["prev", "next"],
  5171. prev: '<i class="layui-icon layui-icon-left"></i><span>上一页</span>',
  5172. next: '<span>下一页</span><i class="layui-icon layui-icon-right"></i>',
  5173. jump: function (obj, first) {
  5174. pagetype = 0;
  5175. page(obj.curr, pagetype, dep);
  5176. },
  5177. });
  5178. });
  5179. blList = 2;
  5180. }
  5181. $(document).on(
  5182. "click",
  5183. ".content_from_ajax3 .layui-tab-title li",
  5184. function () {
  5185. var getdep = $(this)
  5186. .parent()
  5187. .parent()
  5188. .parent()
  5189. .prev()
  5190. .find(".title_flex")
  5191. .text()
  5192. .trim();
  5193. getdep = getdep.replace("便民服务中心", "").replace("政府", "");
  5194. var getText = $(this).text();
  5195. if (getText == "个人办事") {
  5196. var count;
  5197. var firstpage = 1;
  5198. var pagetype = 0;
  5199. page(firstpage, pagetype, getdep);
  5200. function page(page, pagetype, dep) {
  5201. $.ajax({
  5202. type: "GET",
  5203. url: PATH + "/mapdata/getHandMatterPage",
  5204. // url: "http://192.168.0.40:7777/mapdata/getHandMatterPage",
  5205. async: false,
  5206. dataType: "json",
  5207. data: {
  5208. page: page,
  5209. limit: 4,
  5210. type: pagetype,
  5211. matterDept: dep,
  5212. },
  5213. success: function (res) {
  5214. if (res.data != null) {
  5215. $(".content_from_ajax3").parent().removeClass("layui-hide");
  5216. count = res.count;
  5217. var sContnet = "";
  5218. $.each(res.data, function (j) {
  5219. if (
  5220. res.data[j].itemName == undefined &&
  5221. res.data[j].matterUrl == undefined &&
  5222. res.data[j].matterDept == undefined
  5223. ) {
  5224. sContnet += "";
  5225. } else {
  5226. sContnet +=
  5227. "<a href='" +
  5228. res.data[j].matterUrl +
  5229. "' target='_blank' class='url_from_ajax'>";
  5230. sContnet += "<h6 class='point_from_ajax'></h6>";
  5231. sContnet +=
  5232. "<p title='" +
  5233. res.data[j].itemName +
  5234. "' class='text_from_ajax'>" +
  5235. res.data[j].itemName +
  5236. "</p>";
  5237. sContnet += "</a>";
  5238. }
  5239. });
  5240. $(".result_form_ajax2").empty().append(sContnet);
  5241. } else {
  5242. $(".content_from_ajax3").parent().addClass("layui-hide");
  5243. }
  5244. },
  5245. });
  5246. }
  5247. layui.use(["laypage", "layer"], function () {
  5248. var laypage = layui.laypage,
  5249. layer = layui.layer;
  5250. laypage.render({
  5251. elem: "demo2",
  5252. count: count,
  5253. limit: 4,
  5254. layout: ["prev", "next"],
  5255. prev: '<i class="layui-icon layui-icon-left"></i><span>上一页</span>',
  5256. next: '<span>下一页</span><i class="layui-icon layui-icon-right"></i>',
  5257. jump: function (obj, first) {
  5258. pagetype = 0;
  5259. page(obj.curr, pagetype, getdep);
  5260. },
  5261. });
  5262. });
  5263. blList = 1;
  5264. } else if (getText == "法人办事") {
  5265. var count;
  5266. var firstpage = 1;
  5267. var pagetype = 1;
  5268. page(firstpage, pagetype, getdep);
  5269. function page(page, pagetype, dep) {
  5270. $.ajax({
  5271. type: "GET",
  5272. url: PATH + "/mapdata/getHandMatterPage",
  5273. // url: "http://192.168.0.40:7777/mapdata/getHandMatterPage",
  5274. async: false,
  5275. dataType: "json",
  5276. data: {
  5277. page: page,
  5278. limit: 4,
  5279. type: pagetype,
  5280. matterDept: dep,
  5281. },
  5282. success: function (res) {
  5283. if (res.data != null) {
  5284. $(".content_from_ajax3").parent().removeClass("layui-hide");
  5285. count = res.count;
  5286. var sContnet = "";
  5287. $.each(res.data, function (j) {
  5288. if (
  5289. res.data[j].itemName == undefined &&
  5290. res.data[j].matterUrl == undefined &&
  5291. res.data[j].matterDept == undefined
  5292. ) {
  5293. sContnet += "";
  5294. } else {
  5295. sContnet +=
  5296. "<a href='" +
  5297. res.data[j].matterUrl +
  5298. "' target='_blank' class='url_from_ajax'>";
  5299. sContnet += "<h6 class='point_from_ajax'></h6>";
  5300. sContnet +=
  5301. "<p title='" +
  5302. res.data[j].itemName +
  5303. "' class='text_from_ajax'>" +
  5304. res.data[j].itemName +
  5305. "</p>";
  5306. sContnet += "</a>";
  5307. }
  5308. });
  5309. $(".result_form_ajax2").empty().append(sContnet);
  5310. } else {
  5311. $(".content_from_ajax3").parent().addClass("layui-hide");
  5312. }
  5313. },
  5314. });
  5315. }
  5316. layui.use(["laypage", "layer"], function () {
  5317. var laypage = layui.laypage,
  5318. layer = layui.layer;
  5319. laypage.render({
  5320. elem: "demo2",
  5321. count: count,
  5322. limit: 4,
  5323. layout: ["prev", "next"],
  5324. prev: '<i class="layui-icon layui-icon-left"></i><span>上一页</span>',
  5325. next: '<span>下一页</span><i class="layui-icon layui-icon-right"></i>',
  5326. jump: function (obj, first) {
  5327. pagetype = 1;
  5328. page(obj.curr, pagetype, getdep);
  5329. },
  5330. });
  5331. });
  5332. blList = 1;
  5333. }
  5334. }
  5335. );
  5336. $(document).on("click", "#aroundEvent", function () {
  5337. if (!markerInfo.myMark) {
  5338. layer.msg("初始定位还未完成,请稍后再试");
  5339. return;
  5340. }
  5341. if (!markerInfo.data || !markerInfo.data.length) {
  5342. layer.msg("附近一公里没有办事地点");
  5343. return;
  5344. }
  5345. indexList = 2;
  5346. applyClickList();
  5347. xrList(markerInfo.data);
  5348. getPointPostAjax(markerInfo.data);
  5349. });
  5350. });