| | |
| | | export default { |
| | | |
| | | httpBaseUri: 'https://www.hmyxianhua.com/flower', |
| | | // httpBaseUri: 'https://www.hmyxianhua.com/flower', |
| | | // httpBaseUri: 'http://47.99.58.211/flower', |
| | | // httpBaseUri: 'http://192.168.1.198:8080/flower', |
| | | // httpBaseUri: 'http://192.168.1.213:8080/flower', |
| | | // httpBaseUri: 'http://localhost:8080/flower', |
| | | httpBaseUri: 'http://192.168.1.7:8080/flower', |
| | | clientId: '', |
| | | secret: '', |
| | | tenantId: '', |
| | | type: 'dev' |
| | | } |
| | | |
对比新文件 |
| | |
| | | function AMapWX(a){this.key=a.key;this.requestConfig={key:a.key,s:"rsx",platform:"WXJS",appname:a.key,sdkversion:"1.2.0",logversion:"2.0"};this.MeRequestConfig={key:a.key,serviceName:"https://restapi.amap.com/rest/me"}} |
| | | AMapWX.prototype.getWxLocation=function(a,b){wx.getLocation({type:"gcj02",success:function(c){c=c.longitude+","+c.latitude;wx.setStorage({key:"userLocation",data:c});b(c)},fail:function(c){wx.getStorage({key:"userLocation",success:function(d){d.data&&b(d.data)}});a.fail({errCode:"0",errMsg:c.errMsg||""})}})}; |
| | | AMapWX.prototype.getMEKeywordsSearch=function(a){if(!a.options)return a.fail({errCode:"0",errMsg:"\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570"});var b=a.options,c=this.MeRequestConfig,d={key:c.key,s:"rsx",platform:"WXJS",appname:a.key,sdkversion:"1.2.0",logversion:"2.0"};b.layerId&&(d.layerId=b.layerId);b.keywords&&(d.keywords=b.keywords);b.city&&(d.city=b.city);b.filter&&(d.filter=b.filter);b.sortrule&&(d.sortrule=b.sortrule);b.pageNum&&(d.pageNum=b.pageNum);b.pageSize&&(d.pageSize=b.pageSize);b.sig&&(d.sig= |
| | | b.sig);wx.request({url:c.serviceName+"/cpoint/datasearch/local",data:d,method:"GET",header:{"content-type":"application/json"},success:function(e){(e=e.data)&&e.status&&"1"===e.status&&0===e.code?a.success(e.data):a.fail({errCode:"0",errMsg:e})},fail:function(e){a.fail({errCode:"0",errMsg:e.errMsg||""})}})}; |
| | | AMapWX.prototype.getMEIdSearch=function(a){if(!a.options)return a.fail({errCode:"0",errMsg:"\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570"});var b=a.options,c=this.MeRequestConfig,d={key:c.key,s:"rsx",platform:"WXJS",appname:a.key,sdkversion:"1.2.0",logversion:"2.0"};b.layerId&&(d.layerId=b.layerId);b.id&&(d.id=b.id);b.sig&&(d.sig=b.sig);wx.request({url:c.serviceName+"/cpoint/datasearch/id",data:d,method:"GET",header:{"content-type":"application/json"},success:function(e){(e=e.data)&&e.status&&"1"===e.status&& |
| | | 0===e.code?a.success(e.data):a.fail({errCode:"0",errMsg:e})},fail:function(e){a.fail({errCode:"0",errMsg:e.errMsg||""})}})}; |
| | | AMapWX.prototype.getMEPolygonSearch=function(a){if(!a.options)return a.fail({errCode:"0",errMsg:"\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570"});var b=a.options,c=this.MeRequestConfig,d={key:c.key,s:"rsx",platform:"WXJS",appname:a.key,sdkversion:"1.2.0",logversion:"2.0"};b.layerId&&(d.layerId=b.layerId);b.keywords&&(d.keywords=b.keywords);b.polygon&&(d.polygon=b.polygon);b.filter&&(d.filter=b.filter);b.sortrule&&(d.sortrule=b.sortrule);b.pageNum&&(d.pageNum=b.pageNum);b.pageSize&&(d.pageSize=b.pageSize); |
| | | b.sig&&(d.sig=b.sig);wx.request({url:c.serviceName+"/cpoint/datasearch/polygon",data:d,method:"GET",header:{"content-type":"application/json"},success:function(e){(e=e.data)&&e.status&&"1"===e.status&&0===e.code?a.success(e.data):a.fail({errCode:"0",errMsg:e})},fail:function(e){a.fail({errCode:"0",errMsg:e.errMsg||""})}})}; |
| | | AMapWX.prototype.getMEaroundSearch=function(a){if(!a.options)return a.fail({errCode:"0",errMsg:"\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570"});var b=a.options,c=this.MeRequestConfig,d={key:c.key,s:"rsx",platform:"WXJS",appname:a.key,sdkversion:"1.2.0",logversion:"2.0"};b.layerId&&(d.layerId=b.layerId);b.keywords&&(d.keywords=b.keywords);b.center&&(d.center=b.center);b.radius&&(d.radius=b.radius);b.filter&&(d.filter=b.filter);b.sortrule&&(d.sortrule=b.sortrule);b.pageNum&&(d.pageNum=b.pageNum);b.pageSize&& |
| | | (d.pageSize=b.pageSize);b.sig&&(d.sig=b.sig);wx.request({url:c.serviceName+"/cpoint/datasearch/around",data:d,method:"GET",header:{"content-type":"application/json"},success:function(e){(e=e.data)&&e.status&&"1"===e.status&&0===e.code?a.success(e.data):a.fail({errCode:"0",errMsg:e})},fail:function(e){a.fail({errCode:"0",errMsg:e.errMsg||""})}})}; |
| | | AMapWX.prototype.getGeo=function(a){var b=this.requestConfig,c=a.options;b={key:this.key,extensions:"all",s:b.s,platform:b.platform,appname:this.key,sdkversion:b.sdkversion,logversion:b.logversion};c.address&&(b.address=c.address);c.city&&(b.city=c.city);c.batch&&(b.batch=c.batch);c.sig&&(b.sig=c.sig);wx.request({url:"https://restapi.amap.com/v3/geocode/geo",data:b,method:"GET",header:{"content-type":"application/json"},success:function(d){(d=d.data)&&d.status&&"1"===d.status?a.success(d):a.fail({errCode:"0", |
| | | errMsg:d})},fail:function(d){a.fail({errCode:"0",errMsg:d.errMsg||""})}})}; |
| | | AMapWX.prototype.getRegeo=function(a){function b(d){var e=c.requestConfig;wx.request({url:"https://restapi.amap.com/v3/geocode/regeo",data:{key:c.key,location:d,extensions:"all",s:e.s,platform:e.platform,appname:c.key,sdkversion:e.sdkversion,logversion:e.logversion},method:"GET",header:{"content-type":"application/json"},success:function(g){if(g.data.status&&"1"==g.data.status){g=g.data.regeocode;var h=g.addressComponent,f=[],k=g.roads[0].name+"\u9644\u8fd1",m=d.split(",")[0],n=d.split(",")[1];if(g.pois&& |
| | | g.pois[0]){k=g.pois[0].name+"\u9644\u8fd1";var l=g.pois[0].location;l&&(m=parseFloat(l.split(",")[0]),n=parseFloat(l.split(",")[1]))}h.provice&&f.push(h.provice);h.city&&f.push(h.city);h.district&&f.push(h.district);h.streetNumber&&h.streetNumber.street&&h.streetNumber.number?(f.push(h.streetNumber.street),f.push(h.streetNumber.number)):f.push(g.roads[0].name);f=f.join("");a.success([{iconPath:a.iconPath,width:a.iconWidth,height:a.iconHeight,name:f,desc:k,longitude:m,latitude:n,id:0,regeocodeData:g}])}else a.fail({errCode:g.data.infocode, |
| | | errMsg:g.data.info})},fail:function(g){a.fail({errCode:"0",errMsg:g.errMsg||""})}})}var c=this;a.location?b(a.location):c.getWxLocation(a,function(d){b(d)})}; |
| | | AMapWX.prototype.getWeather=function(a){function b(g){var h="base";a.type&&"forecast"==a.type&&(h="all");wx.request({url:"https://restapi.amap.com/v3/weather/weatherInfo",data:{key:d.key,city:g,extensions:h,s:e.s,platform:e.platform,appname:d.key,sdkversion:e.sdkversion,logversion:e.logversion},method:"GET",header:{"content-type":"application/json"},success:function(f){if(f.data.status&&"1"==f.data.status)if(f.data.lives){if((f=f.data.lives)&&0<f.length){f=f[0];var k={city:{text:"\u57ce\u5e02",data:f.city}, |
| | | weather:{text:"\u5929\u6c14",data:f.weather},temperature:{text:"\u6e29\u5ea6",data:f.temperature},winddirection:{text:"\u98ce\u5411",data:f.winddirection+"\u98ce"},windpower:{text:"\u98ce\u529b",data:f.windpower+"\u7ea7"},humidity:{text:"\u6e7f\u5ea6",data:f.humidity+"%"}};k.liveData=f;a.success(k)}}else f.data.forecasts&&f.data.forecasts[0]&&a.success({forecast:f.data.forecasts[0]});else a.fail({errCode:f.data.infocode,errMsg:f.data.info})},fail:function(f){a.fail({errCode:"0",errMsg:f.errMsg||""})}})} |
| | | function c(g){wx.request({url:"https://restapi.amap.com/v3/geocode/regeo",data:{key:d.key,location:g,extensions:"all",s:e.s,platform:e.platform,appname:d.key,sdkversion:e.sdkversion,logversion:e.logversion},method:"GET",header:{"content-type":"application/json"},success:function(h){if(h.data.status&&"1"==h.data.status){h=h.data.regeocode;if(h.addressComponent)var f=h.addressComponent.adcode;else h.aois&&0<h.aois.length&&(f=h.aois[0].adcode);b(f)}else a.fail({errCode:h.data.infocode,errMsg:h.data.info})}, |
| | | fail:function(h){a.fail({errCode:"0",errMsg:h.errMsg||""})}})}var d=this,e=d.requestConfig;a.city?b(a.city):d.getWxLocation(a,function(g){c(g)})}; |
| | | AMapWX.prototype.getPoiAround=function(a){function b(e){e={key:c.key,location:e,s:d.s,platform:d.platform,appname:c.key,sdkversion:d.sdkversion,logversion:d.logversion};a.querytypes&&(e.types=a.querytypes);a.querykeywords&&(e.keywords=a.querykeywords);wx.request({url:"https://restapi.amap.com/v3/place/around",data:e,method:"GET",header:{"content-type":"application/json"},success:function(g){if(g.data.status&&"1"==g.data.status){if((g=g.data)&&g.pois){for(var h=[],f=0;f<g.pois.length;f++){var k=0== |
| | | f?a.iconPathSelected:a.iconPath;h.push({latitude:parseFloat(g.pois[f].location.split(",")[1]),longitude:parseFloat(g.pois[f].location.split(",")[0]),iconPath:k,width:22,height:32,id:f,name:g.pois[f].name,address:g.pois[f].address})}a.success({markers:h,poisData:g.pois})}}else a.fail({errCode:g.data.infocode,errMsg:g.data.info})},fail:function(g){a.fail({errCode:"0",errMsg:g.errMsg||""})}})}var c=this,d=c.requestConfig;a.location?b(a.location):c.getWxLocation(a,function(e){b(e)})}; |
| | | AMapWX.prototype.getStaticmap=function(a){function b(e){c.push("location="+e);a.zoom&&c.push("zoom="+a.zoom);a.size&&c.push("size="+a.size);a.scale&&c.push("scale="+a.scale);a.markers&&c.push("markers="+a.markers);a.labels&&c.push("labels="+a.labels);a.paths&&c.push("paths="+a.paths);a.traffic&&c.push("traffic="+a.traffic);e="https://restapi.amap.com/v3/staticmap?"+c.join("&");a.success({url:e})}var c=[];c.push("key="+this.key);var d=this.requestConfig;c.push("s="+d.s);c.push("platform="+d.platform); |
| | | c.push("appname="+d.appname);c.push("sdkversion="+d.sdkversion);c.push("logversion="+d.logversion);a.location?b(a.location):this.getWxLocation(a,function(e){b(e)})}; |
| | | AMapWX.prototype.getInputtips=function(a){var b=Object.assign({},this.requestConfig);a.location&&(b.location=a.location);a.keywords&&(b.keywords=a.keywords);a.type&&(b.type=a.type);a.city&&(b.city=a.city);a.citylimit&&(b.citylimit=a.citylimit);wx.request({url:"https://restapi.amap.com/v3/assistant/inputtips",data:b,method:"GET",header:{"content-type":"application/json"},success:function(c){c&&c.data&&c.data.tips&&a.success({tips:c.data.tips})},fail:function(c){a.fail({errCode:"0",errMsg:c.errMsg|| |
| | | ""})}})}; |
| | | AMapWX.prototype.getDrivingRoute=function(a){var b=Object.assign({},this.requestConfig);a.origin&&(b.origin=a.origin);a.destination&&(b.destination=a.destination);a.strategy&&(b.strategy=a.strategy);a.waypoints&&(b.waypoints=a.waypoints);a.avoidpolygons&&(b.avoidpolygons=a.avoidpolygons);a.avoidroad&&(b.avoidroad=a.avoidroad);wx.request({url:"https://restapi.amap.com/v3/direction/driving",data:b,method:"GET",header:{"content-type":"application/json"},success:function(c){c&&c.data&&c.data.route&&a.success({paths:c.data.route.paths, |
| | | taxi_cost:c.data.route.taxi_cost||""})},fail:function(c){a.fail({errCode:"0",errMsg:c.errMsg||""})}})}; |
| | | AMapWX.prototype.getWalkingRoute=function(a){var b=Object.assign({},this.requestConfig);a.origin&&(b.origin=a.origin);a.destination&&(b.destination=a.destination);wx.request({url:"https://restapi.amap.com/v3/direction/walking",data:b,method:"GET",header:{"content-type":"application/json"},success:function(c){c&&c.data&&c.data.route&&a.success({paths:c.data.route.paths})},fail:function(c){a.fail({errCode:"0",errMsg:c.errMsg||""})}})}; |
| | | AMapWX.prototype.getTransitRoute=function(a){var b=Object.assign({},this.requestConfig);a.origin&&(b.origin=a.origin);a.destination&&(b.destination=a.destination);a.strategy&&(b.strategy=a.strategy);a.city&&(b.city=a.city);a.cityd&&(b.cityd=a.cityd);wx.request({url:"https://restapi.amap.com/v3/direction/transit/integrated",data:b,method:"GET",header:{"content-type":"application/json"},success:function(c){c&&c.data&&c.data.route&&(c=c.data.route,a.success({distance:c.distance||"",taxi_cost:c.taxi_cost|| |
| | | "",transits:c.transits}))},fail:function(c){a.fail({errCode:"0",errMsg:c.errMsg||""})}})}; |
| | | AMapWX.prototype.getRidingRoute=function(a){var b=Object.assign({},this.requestConfig);a.origin&&(b.origin=a.origin);a.destination&&(b.destination=a.destination);wx.request({url:"https://restapi.amap.com/v3/direction/riding",data:b,method:"GET",header:{"content-type":"application/json"},success:function(c){c&&c.data&&c.data.route&&a.success({paths:c.data.route.paths})},fail:function(c){a.fail({errCode:"0",errMsg:c.errMsg||""})}})};module.exports.AMapWX=AMapWX; |
| | |
| | | "navigationBarTitleText": "收货地址"
|
| | | }
|
| | | },
|
| | | {
|
| | | "path": "pages/user/address/gaode-address",
|
| | | "style": {
|
| | | "navigationBarTitleText": "高德地图"
|
| | | }
|
| | | },
|
| | | // #endif
|
| | | {
|
| | | "path": "pages/login/supplier-login",
|
| | |
| | | <!-- 收货地址列表 --> |
| | | <view class="p15 container-address"> |
| | | <view class="search-container m-t-12 flex"> |
| | | <view class="flex1 input" @click="selectWxAddress('input')"> |
| | | <!-- <view class="flex1 input" @click="selectWxAddress('input')"> --> |
| | | <view class="flex1 input" @click="selectGaodeAddress('input')"> |
| | | <u-input placeholder="小区名/店铺名/写字楼/街道名等" disabled v-model="search_flow"> |
| | | <template slot="suffix"> |
| | | <uni-icons color="#20613D" type="search" size="24"></uni-icons> |
| | |
| | | <view class="m-l-a m-r-0 flex " :class="[!dto['province']?'desc-gray':'']"> |
| | | <uni-data-picker :area="true" @change="(e)=>{PickArea(submitForm,e)}" placeholder="" |
| | | :localdata="regionDataPlus"> |
| | | {{ submitForm['province'] || '请选择' }}{{ submitForm['city'] && ('/' + submitForm['city']) || '' }}{{ |
| | | {{ submitForm['province'] || '请选择' }}{{ submitForm['city'] && ('/' + submitForm['city']) |
| | | || '' |
| | | }}{{ |
| | | submitForm['region'] && ('/' + submitForm['region']) || '' |
| | | }} |
| | | </uni-data-picker> |
| | |
| | | // const chooseLocation = requirePlugin('chooseLocation'); |
| | | // #endif |
| | | |
| | | import amapFile from '@/map/amap-wx.130.js'; |
| | | |
| | | import { |
| | | mapState |
| | | } from 'vuex' |
| | |
| | | uni.stopPullDownRefresh() |
| | | }, |
| | | async onLoad(options) { |
| | | // debugger; |
| | | // 引入高德地图的组件 |
| | | const myAmapFun = new amapFile.AMapWX({ key: '75d7da3feb329cd5ae997975b953abb6' }); |
| | | myAmapFun.getRegeo({ |
| | | success: (data) => { |
| | | console.log('当前位置:', data[0]); |
| | | console.log(data) |
| | | // this.setData({ |
| | | // longitude: data[0].longitude, |
| | | // latitude: data[0].latitude, |
| | | // locationName: data[0].name, |
| | | // }); |
| | | }, |
| | | fail(err) { |
| | | console.error(err); |
| | | }, |
| | | }); |
| | | |
| | | // this.list = [{}, {}] |
| | | this.source = options.source || '' |
| | | this.listApi = '/api/address/list' |
| | |
| | | |
| | | }, |
| | | onShow() { |
| | | // const location = chooseLocation.getLocation(); // 如果点击确认选点按钮,则返回选点结果对象,否则返回null |
| | | // // console.log('onshow location', location, this.tmp_picker_lock_index, this.formcodes["LOC_ONE"]) |
| | | // // address: "江苏省苏州市吴中区太湖东路280号" |
| | | // // city: "苏州市" |
| | | // // district: "吴中区" |
| | | // // latitude: 31.262438 |
| | | // // longitude: 120.633985 |
| | | // // name: "太湖东路280号小区" |
| | | // // province: "江苏省" |
| | | // if (location && location.address) { |
| | | // this.submitForm.address = location.address |
| | | // this.submitForm.latitude = location.latitude |
| | | // this.submitForm.longitude = location.longitude |
| | | // if (!this.submitForm.province && location.province) { |
| | | // this.submitForm.province = location.province |
| | | // if (!this.submitForm.city && location.city) { |
| | | // this.submitForm.city = location.city |
| | | // } |
| | | // if (!this.submitForm.region && location.district) { |
| | | // this.submitForm.region = location.district |
| | | // } |
| | | // if (!this.submitForm.region && location.city) { |
| | | // this.submitForm.region = location.city |
| | | // } |
| | | // } |
| | | // this.$forceUpdate() |
| | | // } |
| | | |
| | | }, |
| | | computed: { |
| | | ...mapState({ |
| | |
| | | }; |
| | | }, |
| | | methods: { |
| | | selectGaodeAddress(){ |
| | | uni.navigateTo({ |
| | | url: '/pages/user/address/gaode-address' |
| | | }) |
| | | }, |
| | | selectWxAddress(source) { |
| | | let that = this |
| | | |
| | |
| | | wx.chooseLocation({ |
| | | success: location => { |
| | | console.log('success loc', location,source) |
| | | console.log(location) |
| | | // address: "江苏省苏州市吴中区太湖东路288号" |
| | | // errMsg: "chooseLocation:ok" |
| | | // latitude: 31.26249 |
对比新文件 |
| | |
| | | <template> |
| | | <view class="content"> |
| | | <!-- <view class="btns"> |
| | | <view @click="back">取 消</view> |
| | | <view @click="getCurrentLocation">获取当前地址</view> |
| | | </view> --> |
| | | <view class="inputCon"> |
| | | <view class="searchView"> |
| | | <text class="iconfont icon-sousuo" @click="searchFn"></text> |
| | | <input type="text" placeholder="搜索地点" v-model="searchWords" confirm-type="search" @confirm="searchFn" /> |
| | | <text @click="cancel">取消</text> |
| | | </view> |
| | | </view> |
| | | <!-- 地图部分 --> |
| | | <view class="content-map"> |
| | | <map style="width: 100%;height: 100%;" v-if="mapFlafg" :latitude="latitude" :longitude="longitude" :markers="markers" |
| | | @tap="tap" :scale="16" :title="title"/> |
| | | </view> |
| | | <!-- <view id="container"></view> --> |
| | | <!-- 搜索框 --> |
| | | |
| | | <!-- 地点列表部分 --> |
| | | <view class="list"> |
| | | <view class="item" v-for="(add,index) in dataTips" :key="add.id" @click="select(add,index)" |
| | | :class="selectIndex==index?'active':''"> |
| | | <view class="name">{{add.name}}</view> |
| | | <view class="address">{{add.district || ''}}{{add.address || ''}}</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | // 引入高德地图api提供的微信小程序的接口 |
| | | import amapFile from '@/map/amap-wx.130.js'; |
| | | // 创建地图 |
| | | var myAmapFun = new amapFile.AMapWX({ |
| | | key: '75d7da3feb329cd5ae997975b953abb6' |
| | | }); //key值要申请为 去高德地图申请微信小程序的key |
| | | // var myAmapFun = new amapFile.AMapWX({key: ''}); //key我的 |
| | | export default { |
| | | data() { |
| | | return { |
| | | mapFlafg:false, |
| | | selectIndex: undefined, |
| | | selectAddr: {}, |
| | | searchWords: "", |
| | | id: 1, // 使用 marker点击事件 需要填写id |
| | | title: 'map', |
| | | latitude: 39.91667, // 纬度 |
| | | longitude: 116.41667, // 经度 |
| | | |
| | | markers: [{ |
| | | latitude: 39.91667, // 纬度 |
| | | longitude: 116.41667, // 经度 |
| | | width: 30, |
| | | height: 30, |
| | | iconPath: '' |
| | | // iconPath: '../../static/ditu.png' |
| | | }], |
| | | dataTips: [] |
| | | } |
| | | }, |
| | | onLoad() { |
| | | var self = this; |
| | | uni.getLocation({ |
| | | type: 'gcj02', |
| | | success: function(res) { |
| | | console.log(res, '当前地址定位'); |
| | | if (res.errMsg == "getLocation:ok") { |
| | | console.log(self.mark, 'onload里面看看'); |
| | | self.longitude = res.longitude; |
| | | self.latitude = res.latitude; |
| | | self.$set(self.markers[0],"longitude",res.longitude); |
| | | self.$set(self.markers[0],"latitude",res.latitude); |
| | | self.mapFlafg=true; |
| | | console.log(self.markers,"markers") |
| | | // self.markers[0].longitude = res.longitude; |
| | | // self.markers[0].latitude = res.latitude; |
| | | } |
| | | }, |
| | | complete: () => { |
| | | // 获取当前位置的地点列表 |
| | | myAmapFun.getPoiAround({ |
| | | location: self.longitude + ',' + self.latitude, |
| | | success: (data) => { |
| | | console.log("获取当前的列表", data); |
| | | this.dataTips = data.poisData; |
| | | }, |
| | | fail: (info) => { |
| | | console.log(info, '点击地图错误信息1') |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | |
| | | }, |
| | | methods: { |
| | | cancel() { |
| | | if (this.searchWords) { |
| | | this.searchWords = ""; |
| | | myAmapFun.getPoiAround({ |
| | | location: this.markers[0].longitude + ',' + this.markers[0].latitude, |
| | | success: (data) => { |
| | | console.log("获取当前的列表", data); |
| | | this.$nextTick(() => { |
| | | this.dataTips = data.poisData; |
| | | }) |
| | | }, |
| | | fail: (info) => { |
| | | console.log(info) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | reserGeo() { |
| | | myAmapFun.getRegeo({ |
| | | success: (data) => { |
| | | console.log("getRegeo", data); |
| | | }, |
| | | fail: (info) => { |
| | | console.log(info) |
| | | } |
| | | }) |
| | | }, |
| | | // 根据地址列表中选择某一个地点 |
| | | select(add, index) { |
| | | if (!add) { |
| | | return; |
| | | } |
| | | this.selectIndex = index; |
| | | var location = add.location.split(","); |
| | | console.log(location, add, '列表地点的经纬度'); |
| | | this.selectAddr = { |
| | | address: add.pname ? (add.pname + add.cityname + add.adname) : (add.district + add |
| | | .address), |
| | | detailAddress: add.address, |
| | | latitude: location[1], |
| | | longitude: location[0] |
| | | }; |
| | | this.markers[0].latitude = +location[1]; |
| | | this.markers[0].longitude = +location[0]; |
| | | uni.setStorageSync("address", this.selectAddr.address); |
| | | // 选择地点后,将选取的地点传递到前一个页面中 |
| | | // var pages = getCurrentPages(); // 获取所有的页面栈 |
| | | // var prevPage = pages[pages.length - 2]; // 找到上一个页面,注意是页面,如果是页面中有组件,则需要通过页面接受到数据后,再次往组件中传递 |
| | | // prevPage.$vm.userAddress.locationAddress = this.selectAddr.address; //在上一个页面中就可以用userAddress进行接收 |
| | | // prevPage.$vm.userAddress.detail = this.selectAddr.detailAddress; //在上一个页面中就可以用userAddress进行接收 |
| | | // prevPage.$vm.selectAddr = this.selectAddr; |
| | | // prevPage.$vm.address = { |
| | | // province: add.pname, |
| | | // city: add.cityname, |
| | | // district: add.adname, |
| | | // } |
| | | uni.navigateBack({ |
| | | delta: 1 |
| | | }); |
| | | |
| | | }, |
| | | // 在地图上点击进行选点,这个选点在地图缩放比例较大时无效,因为精读的问题。 |
| | | tap(e) { |
| | | console.log(e, '点击了地图'); |
| | | var location = e.detail.longitude + ',' + e.detail.latitude |
| | | myAmapFun.getRegeo({ |
| | | location: location, |
| | | success: (data) => { |
| | | console.log("获取指定定位信息", data); |
| | | this.selectAddr = { |
| | | address: data[0].regeocodeData.formatted_address, |
| | | latitude: e.detail.latitude, |
| | | longitude: e.detail.longitude |
| | | }; |
| | | this.markers[0].latitude = data[0].latitude; |
| | | this.markers[0].longitude = data[0].longitude; |
| | | myAmapFun.getPoiAround({ |
| | | location: data[0].longitude + ',' + data[0].latitude, |
| | | success: (data) => { |
| | | console.log("获取当前的列表", data); |
| | | this.dataTips = data.poisData; |
| | | }, |
| | | fail: (info) => { |
| | | console.log(info, '点击地图错误信息1') |
| | | } |
| | | }) |
| | | }, |
| | | fail: (info) => { |
| | | console.log(info, '点击地图错误信息2'); |
| | | } |
| | | }) |
| | | }, |
| | | // 根据内容进行检索 |
| | | searchFn() { |
| | | console.log("根据地址检索", this.searchWords); |
| | | myAmapFun.getInputtips({ |
| | | keywords: this.searchWords, |
| | | location: '', |
| | | success: (data) => { |
| | | console.log(111, data); |
| | | if (data && data.tips) { |
| | | this.dataTips = data.tips; |
| | | } |
| | | }, |
| | | fail: data => { |
| | | console.log(222, data); |
| | | } |
| | | }) |
| | | }, |
| | | // getCurrentLocation() { |
| | | // let that = this |
| | | // uni.getLocation({ |
| | | // type: 'wgs84', |
| | | // success: function(res) { |
| | | // console.log(res, '当前地址定位'); |
| | | // if (res.errMsg == "getLocation:ok") { |
| | | // console.log(that.mark, 'onload里面看看'); |
| | | // this.longitude = res.longitude; |
| | | // this.latitude = res.latitude; |
| | | // this.markers[0].longitude = res.longitude; |
| | | // this.markers[0].latitude = res.latitude; |
| | | // } |
| | | // } |
| | | // }); |
| | | // }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .btns { |
| | | |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | height: 260upx; |
| | | width: 100%; |
| | | background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0)); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | z-index: 10 !important; |
| | | |
| | | view { |
| | | border-radius: 10%; |
| | | margin: 100upx 24upx 0; |
| | | font-size: 30upx; |
| | | |
| | | &:first-child { |
| | | color: #fff; |
| | | } |
| | | |
| | | &:last-child { |
| | | width: 100upx; |
| | | height: 60upx; |
| | | line-height: 60upx; |
| | | text-align: center; |
| | | border-radius: 10upx; |
| | | background: #20c295; |
| | | color: #fff; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .content { |
| | | // position: relative; |
| | | height: 100vh; |
| | | display: flex; |
| | | flex-direction: column; |
| | | |
| | | .content-map { |
| | | width: 100%; |
| | | height: 50vh; |
| | | } |
| | | |
| | | .list { |
| | | // flex: 0 1 calc(50vh - 10upx); |
| | | border-radius: 30rpx; |
| | | background-color: #fff; |
| | | // position: absolute; |
| | | // bottom:-660rpx; |
| | | height: calc(50vh - 10upx); |
| | | overflow-y: auto; |
| | | width: 100%; |
| | | margin: 0upx auto 0; |
| | | padding-bottom: 20upx; |
| | | |
| | | .item { |
| | | border-bottom: 2upx solid #f3f3f3; |
| | | padding: 0 30rpx; |
| | | |
| | | &:last-child { |
| | | border: none; |
| | | } |
| | | |
| | | .address { |
| | | font-size: 22upx; |
| | | color: #666; |
| | | margin: 10upx 0; |
| | | } |
| | | |
| | | .name { |
| | | font-size: 30upx; |
| | | color: #333; |
| | | margin-top: 10upx; |
| | | } |
| | | |
| | | &.active { |
| | | .name { |
| | | font-weight: bold; |
| | | color: #E13500; |
| | | } |
| | | |
| | | .address { |
| | | color: #E13500; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .inputCon { |
| | | flex: 0 1 108rpx; |
| | | width: 100%; |
| | | background: #fff; |
| | | // top: -60upx; |
| | | // position: relative; |
| | | z-index: 20; |
| | | // height: 100upx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | |
| | | .searchView { |
| | | width: 702upx; |
| | | height: 60upx; |
| | | display: flex; |
| | | align-items: center; |
| | | line-height: 60upx; |
| | | border-radius: 40upx; |
| | | padding: 0 30upx; |
| | | box-sizing: border-box; |
| | | background: #f3f3f3; |
| | | font-size: 26upx; |
| | | |
| | | .iconfont { |
| | | color: #666; |
| | | margin-right: 20upx; |
| | | } |
| | | |
| | | input { |
| | | flex: 1; |
| | | } |
| | | |
| | | view { |
| | | flex-shrink: 0; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | </style> |