You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
5.7 KiB
1 lines
5.7 KiB
import{x as t,y as s,h as e,f as i,z as l,d as a,w as c,c as o,m as n,p as r,I as d,i as u,S as y,o as h,e as p,t as g,F as _,g as f,v as m,j as k}from"./index-DkGewvWo.js";import{a as w,o as C}from"./index.esm.mx2S9eBV.js";import{c as I}from"./car.CcI8AEaV.js";import{_ as v}from"./_plugin-vue_export-helper.BCo6x5W8.js";let N=[{py:"hzs",code:330100,cityInitial:"H",cityName:"杭州市",pinYin:"hang zhou shi"},{py:"lys",code:410300,cityInitial:"L",cityName:"洛阳市",pinYin:"luo yang shi"}];let j=I(),{mapKey:L}=r;const V=v({data:()=>({letter:[],selectLetter:"",searchValue:"",scrollIntoId:"",list:[],tId:null,searchList:[],showMask:!1,disdingwei:!0,Visit:[],currentCity:" ",longitude:"",latitude:"",seconds:3,po_tips:"重新定位",citys:[],hotCity:N}),created(){console.log(j),this.initcity();var s=this;t({key:"Visit_key",success:function(t){s.Visit=t.data}}),s.getWarpweft();for(var e=["a","b","c","d","e","f","g","h","j","k","l","m","n","p","q","r","s","t","w","x","y","z"],i=[],l=0;l<e.length;l++)for(var a=e[l],c=0;c<this.citys.length;c++){this.citys[c].py.substring(0,1)==a&&(-1==i.indexOf(a)?(this.list[l]=[this.citys[c]],i.push(a),this.letter.push(a.toUpperCase())):this.list[l].push(this.citys[c]))}},methods:{initcity(){let t=w.map((t=>t.cityInfoList.map((t=>({cityName:t.cityName,pinYin:t.cityPinyin,py:t.cityAcronym.toLocaleLowerCase(),code:t.cityCode,cityInitial:t.cityInitial})))));this.citys=t.flat(),console.log(this.citys)},getId(t){return this.letter[t]},scrollTo(t){this.showMask=!0,this.selectLetter="hot"==t?"最":t,setTimeout((()=>{this.showMask=!1}),300),this.scrollIntoId=t},query(t,s){console.log(t,s);let e=[];var i=this;return e=t.filter((t=>{const e=[];let l=!1;return Object.keys(t).forEach((s=>{const l=t[s];i.isString(l)&&l.split(",").forEach((t=>{e.push(t)}))})),e.some((t=>(l=new RegExp("^"+s).test(t),l))),l})),console.log(JSON.stringify(e)),e},isString:t=>"string"==typeof t,onInput(t){const s=t.detail.value;if(console.log(s),""!==s&&this.citys&&this.citys.length>0){const t=this.query(this.citys,String(s).trim());this.searchList=t,this.disdingwei=!1}else this.searchList=[],this.disdingwei=!0},back_city(t){if(t)return console.log(t),j.setCar("city",t.code),j.setCar("cityName",t.cityName),void s();this.$emit("back_city","no")},getWarpweft(){var t=this;t.po_tips="定位中...";let s=setInterval((()=>{t.seconds--,e({type:"wgs84",success:function(s){console.log("当前位置的经度:"+s.longitude),console.log("当前位置的纬度:"+s.latitude),t.longitude=s.longitude,t.latitude=s.latitude;C("https://apis.map.qq.com/ws/geocoder/v1/",{key:L,location:s.latitude+","+s.longitude,output:"jsonp"}).then((s=>{console.log("jsonp",s.result.address_component);let{province:e,city:i,district:l}=s.result.address_component;t.province=e,t.city=i,t.area=l,console.log(e,i,l),t.currentCity=t.citys.find((t=>t.cityName==i)),t.currentCity||uni.$u.toast("获取定位失败,请手动选择城市"),console.log(t.currentCity,"当前城市")})).catch((()=>{uni.$u.toast("获取定位失败,请手动选择城市")}))},fail(){uni.$u.toast("获取定位失败,请手动选择城市")}}),t.seconds<=0&&(t.seconds=3,t.po_tips="重新定位",clearInterval(s))}),1e3)}}},[["render",function(t,s,e,r,w,C){const I=d,v=u,N=m,j=k,L=y;return h(),i("div",{class:"wrapper"},[l("div",{class:"header"},[a(I,{class:"input",onInput:C.onInput,placeholder:"搜索 中文/拼音/首字母",modelValue:w.searchValue,"onUpdate:modelValue":s[0]||(s[0]=t=>w.searchValue=t)},null,8,["onInput","modelValue"])]),a(L,{class:"calendar-list","scroll-y":"true","scroll-into-view":w.scrollIntoId},{default:c((()=>[w.disdingwei?(h(),o(v,{key:0,id:"hot"},{default:c((()=>[a(v,{class:"dingwei"},{default:c((()=>[a(v,{class:"dingwei_Tips"},{default:c((()=>[p(" 当前定位 ")])),_:1}),a(v,{class:"dingwei_city"},{default:c((()=>[a(v,{style:{"min-width":"100rpx"}},{default:c((()=>[w.currentCity.cityName?(h(),o(v,{key:0,class:"dingwei_city_one",onClick:s[1]||(s[1]=t=>C.back_city(w.currentCity))},{default:c((()=>[p(g(w.currentCity.cityName),1)])),_:1})):n("",!0)])),_:1}),a(v,{class:"dingweis_div",onClick:C.getWarpweft},{default:c((()=>[a(N,{class:"dingweis",src:"/h5/assets/dingweis-DjoB4S4R.png",mode:""}),a(j,null,{default:c((()=>[p(g(w.po_tips),1)])),_:1})])),_:1},8,["onClick"])])),_:1})])),_:1}),a(v,{class:"dingwei"},{default:c((()=>[a(v,{class:"dingwei_Tips"},{default:c((()=>[p(" 热门城市 ")])),_:1}),a(v,{class:"dingwei_city dingwei_city_zuijin"},{default:c((()=>[(h(!0),i(_,null,f(w.hotCity,((t,s)=>(h(),o(v,{class:"dingwei_city_one toright",onClick:s=>C.back_city(t)},{default:c((()=>[p(g(t.cityName),1)])),_:2},1032,["onClick"])))),256))])),_:1})])),_:1})])),_:1})):n("",!0),""==w.searchValue?(h(!0),i(_,{key:1},f(w.list,((t,s)=>(h(),o(v,{id:C.getId(s),key:s},{default:c((()=>[a(v,{class:"letter-header"},{default:c((()=>[p(g(C.getId(s)),1)])),_:2},1024),(h(!0),i(_,null,f(t,((t,s)=>(h(),o(v,{class:"city-div",key:s,onClick:s=>C.back_city(t)},{default:c((()=>[a(j,{class:"city"},{default:c((()=>[p(g(t.cityName),1)])),_:2},1024)])),_:2},1032,["onClick"])))),128))])),_:2},1032,["id"])))),128)):n("",!0),(h(!0),i(_,null,f(w.searchList,((t,s)=>(h(),o(v,{class:"city-div",onClick:s=>C.back_city(t)},{default:c((()=>[a(j,{class:"city"},{default:c((()=>[p(g(t.cityName),1)])),_:2},1024)])),_:2},1032,["onClick"])))),256))])),_:1},8,["scroll-into-view"]),""==w.searchValue?(h(),o(v,{key:0,class:"letters"},{default:c((()=>[(h(!0),i(_,null,f(w.letter,(t=>(h(),o(v,{class:"letters-item",key:t,onClick:s=>C.scrollTo(t)},{default:c((()=>[p(g(t),1)])),_:2},1032,["onClick"])))),128))])),_:1})):n("",!0),w.showMask?(h(),o(v,{key:1,class:"mask"},{default:c((()=>[a(v,{class:"mask-r"},{default:c((()=>[p(g(w.selectLetter),1)])),_:1})])),_:1})):n("",!0)])}],["__scopeId","data-v-b2685116"]]);export{V as default};
|