import{bb as t,bf as e,be as s,r as i,az as a,bu as o,_ as r,ay as n,aa as c,p as d,w as p,i as l,o as u,f as y,k as h,e as f,y as g,F as m,C as v,t as k,T as C}from"./index-2PZN6pGH.js";function x(t){this.key=t.key,this.requestConfig={key:t.key,s:"rsx",platform:"WXJS",appname:t.key,sdkversion:"1.2.0",logversion:"2.0"}}x.prototype.getWxLocation=function(i,a){t({type:"gcj02",success:function(t){var s=t.longitude+","+t.latitude;e({key:"userLocation",data:s}),a(s)},fail:function(t){s({key:"userLocation",success:function(t){t.data&&a(t.data)}}),i.fail({errCode:"0",errMsg:t.errMsg||""})}})},x.prototype.getRegeo=function(t){function e(e){var a=s.requestConfig;i({url:"https://restapi.amap.com/v3/geocode/regeo",data:{key:s.key,location:e,extensions:"all",s:a.s,platform:a.platform,appname:s.key,sdkversion:a.sdkversion,logversion:a.logversion},method:"GET",header:{"content-type":"application/json"},success:function(s){var i,a,o,r,n,c,d,p,l;s.data.status&&"1"==s.data.status?(a=(i=s.data.regeocode).addressComponent,o=[],r="",i&&i.roads[0]&&i.roads[0].name&&(r=i.roads[0].name+"附近"),n=e.split(",")[0],c=e.split(",")[1],i.pois&&i.pois[0]&&(r=i.pois[0].name+"附近",(d=i.pois[0].location)&&(n=parseFloat(d.split(",")[0]),c=parseFloat(d.split(",")[1]))),a.provice&&o.push(a.provice),a.city&&o.push(a.city),a.district&&o.push(a.district),a.streetNumber&&a.streetNumber.street&&a.streetNumber.number?(o.push(a.streetNumber.street),o.push(a.streetNumber.number)):(p="",i&&i.roads[0]&&i.roads[0].name&&(p=i.roads[0].name),o.push(p)),o=o.join(""),l=[{iconPath:t.iconPath,width:t.iconWidth,height:t.iconHeight,name:o,desc:r,longitude:n,latitude:c,id:0,regeocodeData:i}],t.success(l)):t.fail({errCode:s.data.infocode,errMsg:s.data.info})},fail:function(e){t.fail({errCode:"0",errMsg:e.errMsg||""})}})}var s=this;t.location?e(t.location):s.getWxLocation(t,(function(t){e(t)}))},x.prototype.getWeather=function(t){function e(e){var o="base";t.type&&"forecast"==t.type&&(o="all"),i({url:"https://restapi.amap.com/v3/weather/weatherInfo",data:{key:s.key,city:e,extensions:o,s:a.s,platform:a.platform,appname:s.key,sdkversion:a.sdkversion,logversion:a.logversion},method:"GET",header:{"content-type":"application/json"},success:function(e){var s,i,a;e.data.status&&"1"==e.data.status?e.data.lives?(s=e.data.lives)&&s.length>0&&(s=s[0],(i={city:{text:"城市",data:(a=s).city},weather:{text:"天气",data:a.weather},temperature:{text:"温度",data:a.temperature},winddirection:{text:"风向",data:a.winddirection+"风"},windpower:{text:"风力",data:a.windpower+"级"},humidity:{text:"湿度",data:a.humidity+"%"}}).liveData=s,t.success(i)):e.data.forecasts&&e.data.forecasts[0]&&t.success({forecast:e.data.forecasts[0]}):t.fail({errCode:e.data.infocode,errMsg:e.data.info})},fail:function(e){t.fail({errCode:"0",errMsg:e.errMsg||""})}})}var s=this,a=s.requestConfig;t.city?e(t.city):s.getWxLocation(t,(function(o){var r;r=o,i({url:"https://restapi.amap.com/v3/geocode/regeo",data:{key:s.key,location:r,extensions:"all",s:a.s,platform:a.platform,appname:s.key,sdkversion:a.sdkversion,logversion:a.logversion},method:"GET",header:{"content-type":"application/json"},success:function(s){var i,a;s.data.status&&"1"==s.data.status?((a=s.data.regeocode).addressComponent?i=a.addressComponent.adcode:a.aois&&a.aois.length>0&&(i=a.aois[0].adcode),e(i)):t.fail({errCode:s.data.infocode,errMsg:s.data.info})},fail:function(e){t.fail({errCode:"0",errMsg:e.errMsg||""})}})}))},x.prototype.getPoiAround=function(t){function e(e){var o={key:s.key,location:e,s:a.s,platform:a.platform,appname:s.key,sdkversion:a.sdkversion,logversion:a.logversion};t.querytypes&&(o.types=t.querytypes),t.querykeywords&&(o.keywords=t.querykeywords),i({url:"https://restapi.amap.com/v3/place/around",data:o,method:"GET",header:{"content-type":"application/json"},success:function(e){var s,i,a,o;if(e.data.status&&"1"==e.data.status){if((e=e.data)&&e.pois){for(s=[],i=0;iw[t]?w[t]:"#ccc",serachNmme(t,e){let s=new RegExp(t);return`
\n\t\t ${e.replace(s,""+t+"")}\n\t\t
`.trim()},addressToLine(t,e){let s=t.split(";"),i="";return s.forEach((t=>{let s="#cccccc";e===M[0].id?s=this.lineColor(t):e===M[1].id&&(s="#4075cb"),i+=`
${t}
`})),`
${i}
`},dataHandle:(t,e)=>(t.nameNodes=e?L.serachNmme(e,t.name):`
${t.name}
`,t.typecode===L.typecode[0].id||t.typecode===L.typecode[1].id?(t.addressNodes=L.addressToLine(t.address,t.typecode),t.typecode===L.typecode[0].id?t.icon=L.typecode[0].icon:t.typecode===L.typecode[1].id&&(t.icon=L.typecode[1].icon)):(t.addressNodes=`${t.district}${t.address.length>0?"·"+t.address:""}`.trim(),t.icon="icon-weizhi"),t.location&&0===t.location.length&&(t.icon="icon-sousuo"),t),setHistory(t){let s=a("search:history");s||(s=[]);let i={};i="string"==typeof t?{adcode:[],address:[],city:[],district:[],id:[],location:[],name:t,typecode:[]}:t;for(var o=0;o(o({key:"search:history",success:function(t){console.log("success")}}),[])};const _=r({data:()=>({historyList:[],isHistory:!0,list:[],flng:!0,timer:null}),onLoad(){this.amapPlugin=L.mapInit(),this.historyList=a("search:history")},methods:{listTap(t){t=JSON.parse(JSON.stringify(t)),this.history||(this.isHistory=!0,L.setHistory(t),n())},clearSearch(){c({title:"提示",content:"是否清理全部搜索历史?该操作不可逆。",success:t=>{t.confirm&&(this.historyList=L.removeHistory())}})},getInputtips(t){let e=this;this.amapPlugin.getInputtips({keywords:t,city:"北京",success:s=>{let i=s.tips;i.map((e=>L.dataHandle(e,t))),e.historyList=i},fail:t=>{console.log(t)}})}},onNavigationBarSearchInputChanged(t){let e=t.text;if(!e)return this.isHistory=!0,this.historyList=[],void(this.historyList=a("search:history"));this.isHistory=!1,this.getInputtips(e)},onNavigationBarSearchInputConfirmed(t){let e=t.text;if(!e)return this.isHistory=!0,this.historyList=[],this.historyList=a("search:history"),void c({title:"提示",content:"请输入内容。",success:t=>{t.confirm}});c({title:"提示",content:`您输入的内容为"${e}",如果点击确定,将记录到历史搜索,并返回.如果取消不做操作`,success:t=>{t.confirm&&(L.setHistory(e),n())}})},onNavigationBarButtonTap(){c({title:"提示",content:"点击确定,修改输入框的内容为abc",success:t=>{if(t.confirm){this.$mp.page.$getAppWebview().setTitleNViewSearchInputText("abc")}}})}},[["render",function(t,e,s,i,a,o){const r=v,n=l,c=C;return u(),d(n,{class:"wrapper"},{default:p((()=>[a.isHistory?(u(),d(n,{key:0,class:"history-box"},{default:p((()=>[a.historyList.length>0?(u(),d(n,{key:0},{default:p((()=>[y(n,{class:"history-title"},{default:p((()=>[y(r,null,{default:p((()=>[h("搜索历史")])),_:1}),y(r,{class:"uni-icon uni-icon-trash",onClick:o.clearSearch},null,8,["onClick"])])),_:1}),y(n,{class:"history-content"},{default:p((()=>[(u(!0),f(m,null,g(a.historyList,((t,e)=>(u(),d(n,{class:"history-item",key:e},{default:p((()=>[h(k(t.name),1)])),_:2},1024)))),128))])),_:1})])),_:1})):(u(),d(n,{key:1,class:"no-data"},{default:p((()=>[h("您还没有历史记录")])),_:1}))])),_:1})):(u(),d(n,{key:1,class:"history-box"},{default:p((()=>[a.historyList.length>0?(u(),d(n,{key:0,class:"history-list-box"},{default:p((()=>[(u(!0),f(m,null,g(a.historyList,((t,e)=>(u(),d(n,{class:"history-list-item",key:e,onClick:e=>o.listTap(t)},{default:p((()=>[y(c,{nodes:t.nameNodes},null,8,["nodes"])])),_:2},1032,["onClick"])))),128))])),_:1})):(u(),d(n,{key:1,class:"no-data"},{default:p((()=>[h("没有搜索到相关内容")])),_:1}))])),_:1}))])),_:1})}],["__scopeId","data-v-202dce01"]]);export{_ as default};