|
@@ -7,7 +7,8 @@
|
|
|
<label class="arrow">{{ area }}</label>
|
|
|
<u-icon name="arrow-down-fill" size="13" color="#c0c4cc"></u-icon>
|
|
|
</view>
|
|
|
- <view style="margin-left: 20rpx;margin-right: 20rpx; flex:1"><u-search placeholder="搜索站点名称" v-model="keyword" :showAction="false"></u-search></view>
|
|
|
+ <view style="margin-left: 20rpx;margin-right: 20rpx; flex:1" >
|
|
|
+ <u-search placeholder="搜索站点名称" v-model="keyword" :showAction="false" @focus="navigate"></u-search></view>
|
|
|
<view style="margin-right: 20rpx;" v-show="viewMode" @click="listMode">
|
|
|
<text class="iconfont"></text> <text class="list">列表</text>
|
|
|
<!-- <u-icon name="list-dot" size="26" color="#c0c4cc"></u-icon>
|
|
@@ -46,6 +47,7 @@
|
|
|
<u-tag
|
|
|
class="preference_item"
|
|
|
v-for="(item, index) in info.miles_type"
|
|
|
+ :key="index"
|
|
|
:style="index == preference.miles_index ? 'background-color:#00B962;color:#FFFFFF' : 'background-color:#EFF4F2;color:#926666'"
|
|
|
shape="circle"
|
|
|
:text="item.text"
|
|
@@ -59,6 +61,7 @@
|
|
|
<u-tag
|
|
|
class="preference_item"
|
|
|
v-for="(item, index) in info.obc_type"
|
|
|
+ :key="index"
|
|
|
:style="index == preference.obc_type_index ? 'background-color:#00B962;color:#FFFFFF' : 'background-color:#EFF4F2;color:#926666'"
|
|
|
shape="circle"
|
|
|
:text="item.text"
|
|
@@ -73,6 +76,7 @@
|
|
|
<u-tag
|
|
|
class="preference_item_plus"
|
|
|
v-for="(item, index) in info.obc_status"
|
|
|
+ :key="index"
|
|
|
:style="index == preference.obc_status_index ? 'background-color:#00B962;color:#FFFFFF' : 'background-color:#EFF4F2;color:#926666'"
|
|
|
shape="circle"
|
|
|
:text="item.text"
|
|
@@ -86,6 +90,7 @@
|
|
|
<u-tag
|
|
|
class="preference_item_plus"
|
|
|
v-for="(item, index) in info.obc_voltage"
|
|
|
+ :key="index"
|
|
|
:style="index == preference.obc_voltage_index ? 'background-color:#00B962;color:#FFFFFF' : 'background-color:#EFF4F2;color:#926666'"
|
|
|
shape="circle"
|
|
|
:text="item.text"
|
|
@@ -127,7 +132,7 @@
|
|
|
</view>
|
|
|
<view v-show="!viewMode" >
|
|
|
|
|
|
- <view v-for="(item,index) in stations" :key="item.id" class="charing-slow" >
|
|
|
+ <view v-for="(item,index) in stationslist" :key="item.id" class="charing-slow" >
|
|
|
<text :class="item.type == '快充' ? 'fast-charge':'trickle-charge'">{{item.type}}</text> <text class="station-items">{{item.name}}</text>
|
|
|
<view class="address">
|
|
|
{{item.position}}
|
|
@@ -147,7 +152,7 @@
|
|
|
<text style="color:#009143;">空闲{{item.idleNum}}</text>/总数{{item.total}}
|
|
|
</view>
|
|
|
<view class="distance">
|
|
|
- <text class="iconfont distance-font"></text>{{item.distance}}公里 {{item.time}}分钟
|
|
|
+ <text class="iconfont distance-font"></text>{{item.distance.toFixed(2)}}公里 {{item.time.toFixed(0)}}分钟
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -159,17 +164,17 @@
|
|
|
</view>
|
|
|
<view v-show="viewMode" >
|
|
|
<view>
|
|
|
- <Chargermap @onMoveEnd="moveEnd" ref="amap" @onload="mapdown" @clickMap="clickMap"></Chargermap>
|
|
|
+ <Chargermap @location="location" @onMoveEnd="moveEnd" ref="amap" @onload="mapdown" @clickMap="clickMap"></Chargermap>
|
|
|
</view>
|
|
|
|
|
|
- <view v-if="stations.length>0" class="chargerCard" style="border-radius: 20rpx;" >
|
|
|
+ <view v-if="stationsmap.length>0" class="chargerCard" style="border-radius: 20rpx;" >
|
|
|
<swiper :current="currentIndex" @change="swiperChange" @transition="swiperTransition" style="height: 100%;">
|
|
|
- <swiper-item v-for="(item,index) in stations" style="height: 100%;">
|
|
|
+ <swiper-item v-for="(item,index) in stationsmap" :key="item.id" style="height: 100%;">
|
|
|
|
|
|
<view class="swiper-item" style="height: 100%; background-color: #ffffff;">
|
|
|
<view class="card_item" style="font-size: 35rpx;padding-top: 5rpx;">
|
|
|
<view style="display: flex;flex-direction: row;">
|
|
|
- <view class="round2" style="margin-right: 5rpx;">
|
|
|
+ <view :class="item.type == '快充'? 'fast-charge':'trickle-charge'" >
|
|
|
{{item.type}}
|
|
|
</view>
|
|
|
<view>
|
|
@@ -214,10 +219,10 @@
|
|
|
<view class="round">
|
|
|
<text class="iconfont distance-font"></text>
|
|
|
<view style="margin-right: 10rpx;">
|
|
|
- {{item.distance}}公里
|
|
|
+ {{item.distance.toFixed(2)}}公里
|
|
|
</view>
|
|
|
<view style="margin-right: 10rpx;">
|
|
|
- {{item.time}}分钟
|
|
|
+ {{item.time.toFixed(0)}}分钟
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -225,6 +230,7 @@
|
|
|
</swiper-item>
|
|
|
</swiper>
|
|
|
</view>
|
|
|
+
|
|
|
</view>
|
|
|
</view>
|
|
|
<Tabbar :current="1"></Tabbar>
|
|
@@ -238,7 +244,9 @@ import * as api from '@/apis/site.js';
|
|
|
import Chargermap from '@/components/Chargermap.vue';
|
|
|
import DoubleSlider from '@/components/double-slider/DoubleSlider.vue';
|
|
|
import Tabbar from '@/components/Tabbar.vue';
|
|
|
-
|
|
|
+import * as WxJsApi from '@/utils/wxJsApi.js'
|
|
|
+import MapLoader from '@/utils/AMap'
|
|
|
+//import * as navigation from '@/pages/navigation/index.vue'
|
|
|
let _self;
|
|
|
export default {
|
|
|
components: {
|
|
@@ -256,8 +264,8 @@ export default {
|
|
|
mapopen: false,
|
|
|
isReady: false,
|
|
|
id: '',
|
|
|
- longitude: 112.28468,
|
|
|
- latitude: 30.307094,
|
|
|
+ longitude: 112.28308,
|
|
|
+ latitude: 30.312084,
|
|
|
// longitude: '',
|
|
|
// latitude: '',
|
|
|
nearbyStationInfo: {
|
|
@@ -273,13 +281,16 @@ export default {
|
|
|
save_preference: false,
|
|
|
obc_power: { minValue: 0, maxValue: 500 }
|
|
|
},
|
|
|
- stations:[
|
|
|
+ stationsmap:[
|
|
|
/* {name:'荆鹏软件园充电站',position:'湖北省荆州市沙市区江津东路附155号',price:1.2,idle:10,total:10,distance:0.1,time:1,type:'慢充'},
|
|
|
{name:'荆鹏软件园充电站2',position:'湖北省荆州市沙市区江津东路附156号',price:1.2,idle:10,total:10,distance:0.1,time:1,type:'快充'},
|
|
|
{name:'荆鹏软件园充电站3',position:'湖北省荆州市沙市区江津东路附157号',price:1.2,idle:10,total:10,distance:0.1,time:1,type:'慢充'},
|
|
|
{name:'荆鹏大道求助站充电站',position:'湖北省荆州市沙市区江津东路附158号',price:1.2,idle:10,total:10,distance:0.1,time:1,type:'快充'},
|
|
|
*/
|
|
|
],
|
|
|
+ first:true,
|
|
|
+ timer:null,
|
|
|
+ stationslist:[],
|
|
|
info: {
|
|
|
miles_type: [
|
|
|
{ distance: 1, text: '1公里' },
|
|
@@ -307,44 +318,26 @@ export default {
|
|
|
if (op.latitude != null) this.latitude = op.latitude;
|
|
|
if (op.id != null) this.id = op.id;
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
onReady() {
|
|
|
+
|
|
|
+ WxJsApi.getWxConfig(['getLocation','addEventListener']).then((res)=>{
|
|
|
+
|
|
|
+ // this.message=JSON.stringify(res)
|
|
|
+ // uni.showToast({
|
|
|
+ // title:JSON.stringify(res)
|
|
|
+ // })
|
|
|
+ console.log(res)
|
|
|
+
|
|
|
+ }).catch(error => {
|
|
|
+ console.log(res)
|
|
|
+ })
|
|
|
+
|
|
|
// console.log('longitude2 '+this.longitude)
|
|
|
// console.log('latitude2 '+this.latitude)
|
|
|
- this.getNearbyStationInfo();
|
|
|
- this.isReady = true;
|
|
|
this.$refs.amap.init();
|
|
|
-
|
|
|
- //let state = {};
|
|
|
- uni.getSystemInfo({
|
|
|
- success: (res) => {
|
|
|
- // #ifndef MP
|
|
|
- let navbarH = 0
|
|
|
- // #endif
|
|
|
- // #ifdef MP
|
|
|
- let navbarH = uni.upx2px(90)
|
|
|
- // #endif
|
|
|
- /*state.status_width = res.windowWidth;
|
|
|
- console.log('window width'+state.status_width);*/
|
|
|
-
|
|
|
- let scrollH = res.windowHeight;// - uni.upx2px(88) - navbarH
|
|
|
- console.log('布局结果'+ JSON.stringify(res));
|
|
|
- console.log('scrollH'+scrollH)
|
|
|
- //#ifdef MP-WEIXIN
|
|
|
- const {
|
|
|
- statusBarHeight,
|
|
|
- windowWidth,
|
|
|
- } = uni.getSystemInfoSync();
|
|
|
- console.log('height ' + statusBarHeight);
|
|
|
- //this.status_height = uni.getStatusbarHeight();
|
|
|
- let res1 = uni.getMenuButtonBoundingClientRect()
|
|
|
- console.log('layout selectHeight '+JSON.stringify(res1))
|
|
|
- //state.selectHeight = (res1.top-res.statusBarHeight)*2+ res1.height;
|
|
|
- //#endif
|
|
|
- //console.log('status height'+state.status_height)
|
|
|
- _self.$refs.amap.setMyStyle("height:"+(scrollH-88-50)+ "px;width:100%;");
|
|
|
- }
|
|
|
- })
|
|
|
+
|
|
|
// this.$refs.amap.setMyStyle("height:1500rpx;width:100%;");
|
|
|
// this.$refs.amap.setMyStyle("height:calc(100%-176rpx);width:100%;");
|
|
|
|
|
@@ -352,11 +345,241 @@ export default {
|
|
|
// console.log('latitude3 '+this.latitude)
|
|
|
},
|
|
|
onShow() {
|
|
|
+
|
|
|
+ console.log('onShow')
|
|
|
if (this.isReady) {
|
|
|
- this.getNearbyStationInfo();
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
+ onHide(){
|
|
|
+ this.end();
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ navigate(){
|
|
|
+ console.log('naviage to ')
|
|
|
+ uni.navigateTo({
|
|
|
+ url:'/pages/search/search'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getPoint() {
|
|
|
+
|
|
|
+ console.log('getPoint')
|
|
|
+ WxJsApi.getLocation().then((res) => {
|
|
|
+
|
|
|
+ var latitude = parseFloat(res.latitude);
|
|
|
+ var longitude = parseFloat(res.longitude);
|
|
|
+ let data = {position:{latitude:latitude,longitude:longitude}};
|
|
|
+
|
|
|
+ if(_self.first)
|
|
|
+ {
|
|
|
+ var obj = {
|
|
|
+ longitude: longitude,
|
|
|
+ latitude: latitude
|
|
|
+ };
|
|
|
+ this.$refs.amap.setPerson(obj);
|
|
|
+ _self.first = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.location(data);
|
|
|
+ console.log('当前位置' +JSON.stringify(data))
|
|
|
+
|
|
|
+ //this.latitude2 = latitude;
|
|
|
+ //this.longitude2 = longitude;
|
|
|
+ /*uni.showToast({
|
|
|
+ title:JSON.stringify(res)
|
|
|
+ })*/
|
|
|
+ //this.message=JSON.stringify(res)
|
|
|
+ }).catch(error => {
|
|
|
+ uni.showToast({
|
|
|
+ title:JSON.stringify(error)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ start() {
|
|
|
+ let self = this;
|
|
|
+ // 将定时器名字赋值到变量中
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ //console.log("开始---");
|
|
|
+
|
|
|
+ //self.$refs.amap.getLocation1();
|
|
|
+ //self.$refs.amap.getLocation ();
|
|
|
+ }, 10000);
|
|
|
+ },
|
|
|
+ end() {
|
|
|
+ clearInterval(this.timer);
|
|
|
+ this.timer = null // 这里最好清除一下,回归默认值
|
|
|
+ // 众所周知,定时器返回一个随机整数,用于表示定时器的编号,后面通过名字可以取消这个定时器的执行。
|
|
|
+ console.log(this.timer);
|
|
|
+ },
|
|
|
+ location(e){
|
|
|
+ if(e.position){
|
|
|
+ if(e.position.latitude && e.position.longitude)
|
|
|
+ if(this.latitude != e.position.latitude ||
|
|
|
+ this.longitude != e.position.longitude)
|
|
|
+ {
|
|
|
+ this.longitude = e.position.longitude;
|
|
|
+ this.latitude = e.position.latitude;
|
|
|
+
|
|
|
+ let data = {latitude:this.latitude,longtitude:this.longitude,findType:"1"};
|
|
|
+ this.getChargingStationData(data);
|
|
|
+ console.log('获取定位'+JSON.stringify(e));
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getChargingStationData(pos){
|
|
|
+ //return;
|
|
|
+ if(pos == null)
|
|
|
+ return ;
|
|
|
+ console.log('getChargingStationData'+JSON.stringify(pos))
|
|
|
+ let data1 = { pageIndex:0,pageSize:20};
|
|
|
+ if(this.info.obc_type[this.preference.obc_type_index].text.indexOf('直流快充')>=0)
|
|
|
+ data1.type = "1";
|
|
|
+ else if(this.info.obc_type[this.preference.obc_type_index].text.indexOf('交流慢充')>=0)
|
|
|
+ data1.type = "2";
|
|
|
+ if(pos.longtitude != null)
|
|
|
+ data1.longitude = pos.longtitude.toString();
|
|
|
+ if(pos.latitude != null)
|
|
|
+ data1.latitude = pos.latitude.toString();
|
|
|
+ if(this.info.miles_type[this.preference.miles_index].distance!=null)
|
|
|
+ data1.radius = this.info.miles_type[this.preference.miles_index].distance.toString();
|
|
|
+ data1.online = "0";//在线
|
|
|
+ if(pos.findType != null)
|
|
|
+ data1.findType = pos.findType;
|
|
|
+ else
|
|
|
+ data1.findType = "0";
|
|
|
+
|
|
|
+ if(this.preference.obc_power.minValue!=null)
|
|
|
+ data1.powerStart = this.preference.obc_power.minValue.toString();
|
|
|
+ if(this.preference.obc_power.maxValue!=null)
|
|
|
+ data1.powerEnd = this.preference.obc_power.maxValue.toString();
|
|
|
+
|
|
|
+ console.log('data1'+JSON.stringify(data1))
|
|
|
+ api.geChargingStationData(data1).then(function(res){
|
|
|
+
|
|
|
+ if(!res.result || !res.data || !res.data.data)
|
|
|
+ {
|
|
|
+ console.log('getChargingStationData res nulll')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let items = res.data.data;
|
|
|
+
|
|
|
+
|
|
|
+ if(data1.findType == "0")
|
|
|
+ {
|
|
|
+ console.log('getChargingStationData res1'+JSON.stringify(res));
|
|
|
+ _self.stationsmap = [];
|
|
|
+ for(let i = 0;i<items.length;i++)
|
|
|
+ {
|
|
|
+ let obj = {
|
|
|
+ name:'',
|
|
|
+ position:'',
|
|
|
+ price:1.2,
|
|
|
+ idleNum:10,
|
|
|
+ total:10,
|
|
|
+ type: data1.type == "2" ? '慢充':'快充',
|
|
|
+ id: i,
|
|
|
+ distance:0.9,
|
|
|
+ time:9,
|
|
|
+ park: '以实际费用为准',
|
|
|
+// longitude: 112.28541 + i * 0.001,
|
|
|
+// latitude: 30.308354 + i * 0.01
|
|
|
+ };
|
|
|
+ if(items[i].name!=null)
|
|
|
+ obj.name = items[i].name;
|
|
|
+ if(items[i].address!=null)
|
|
|
+ obj.position = items[i].address;
|
|
|
+ if(items[i].coostPrice!=null)
|
|
|
+ obj.price = items[i].coostPrice;
|
|
|
+ if(items[i].availableNum!=null)
|
|
|
+ obj.idleNum = items[i].availableNum;
|
|
|
+ if(items[i].totalNum!=null)
|
|
|
+ obj.total = items[i].totalNum;
|
|
|
+ if(items[i].longitude!=null)
|
|
|
+ obj.longitude = items[i].longitude;
|
|
|
+ if(items[i].latitude!=null)
|
|
|
+ obj.latitude = items[i].latitude;
|
|
|
+ if(items[i].distance!=null)
|
|
|
+ obj.distance = items[i].distance;
|
|
|
+ if(items[i].time != null){
|
|
|
+ obj.time = items[i].time;
|
|
|
+ }
|
|
|
+ if(items[i].park != null)
|
|
|
+ obj.park = items[i].park;
|
|
|
+ /*
|
|
|
+ let obj = {name:items[i].name,
|
|
|
+ position:items[i].address,
|
|
|
+ price:items[i].coostPrice,
|
|
|
+ idleNum:items[i].availableNum,
|
|
|
+ total:items[i].totalNum,
|
|
|
+ distance:0.1,
|
|
|
+ time:1,
|
|
|
+ type:'慢充',
|
|
|
+ id: items[i].id,
|
|
|
+ park: i%2 == 0? '以实际费用为准':'2小时免费停车',
|
|
|
+ longitude: items[i].longitude,
|
|
|
+ latitude: items[i].latitude
|
|
|
+ };*/
|
|
|
+ _self.stationsmap.push(obj);
|
|
|
+ }
|
|
|
+ _self.$refs.amap.searchBtn([_self.longitude, _self.latitude],_self.stationsmap)
|
|
|
+ _self.$refs.amap.setChargerList(_self.stationsmap);
|
|
|
+ }else if(data1.findType == "1")
|
|
|
+ {
|
|
|
+ _self.stationslist = [];
|
|
|
+ console.log('getChargingStationData res2'+JSON.stringify(res));
|
|
|
+ for(let i = 0;i<items.length;i++)
|
|
|
+ {
|
|
|
+
|
|
|
+ let obj = {
|
|
|
+ name:'',
|
|
|
+ position:'',
|
|
|
+ price:1.2,
|
|
|
+ idleNum:10,
|
|
|
+ total:10,
|
|
|
+ type: data1.type == "2" ? '慢充':'快充',
|
|
|
+ id: i,
|
|
|
+ distance:0.9,
|
|
|
+ time:9,
|
|
|
+ park: '以实际费用为准',
|
|
|
+ // longitude: 112.28541 + i * 0.001,
|
|
|
+ // latitude: 30.308354 + i * 0.01
|
|
|
+ };
|
|
|
+ if(items[i].name!=null)
|
|
|
+ obj.name = items[i].name;
|
|
|
+ if(items[i].address!=null)
|
|
|
+ obj.position = items[i].address;
|
|
|
+ if(items[i].coostPrice!=null)
|
|
|
+ obj.price = items[i].coostPrice;
|
|
|
+ if(items[i].availableNum!=null)
|
|
|
+ obj.idleNum = items[i].availableNum;
|
|
|
+ if(items[i].totalNum!=null)
|
|
|
+ obj.total = items[i].totalNum;
|
|
|
+ if(items[i].longitude!=null)
|
|
|
+ obj.longitude = items[i].longitude;
|
|
|
+ if(items[i].latitude!=null)
|
|
|
+ obj.latitude = items[i].latitude;
|
|
|
+ if(items[i].distance!=null)
|
|
|
+ obj.distance = items[i].distance;
|
|
|
+ if(items[i].time != null){
|
|
|
+ obj.time = items[i].time;
|
|
|
+ }
|
|
|
+ if(items[i].park != null)
|
|
|
+ obj.park = items[i].park;
|
|
|
+ //arr.push(obj);
|
|
|
+ _self.stationslist.push(obj);
|
|
|
+ }
|
|
|
+ _self.$refs.amap.searchBtn([_self.longitude, _self.latitude],_self.stationslist)
|
|
|
+
|
|
|
+ console.log(' getChargingStationData stations'+JSON.stringify(_self.stationslist))
|
|
|
+
|
|
|
+ }
|
|
|
+ },function(err){
|
|
|
+ console.log('getChargingStationData err'+JSON.stringify(err))
|
|
|
+ }
|
|
|
+ )
|
|
|
+ console.log('getChargingStationData end')
|
|
|
+ },
|
|
|
charge(item){
|
|
|
console.log('扫码充电')
|
|
|
//#ifdef MP-WEIXIN
|
|
@@ -376,9 +599,11 @@ export default {
|
|
|
url:'stationAndPile/chargingPileDetails'
|
|
|
})
|
|
|
|
|
|
- },
|
|
|
+ },
|
|
|
moveEnd(e){
|
|
|
- console.log('moveEnd'+JSON.stringify(e))
|
|
|
+ console.log('moveEnd'+JSON.stringify(e))
|
|
|
+ let data = {latitude:e.center.lat,longtitude:e.center.lng};
|
|
|
+ this.getChargingStationData(data);
|
|
|
},
|
|
|
clickTabItem (index) {
|
|
|
|
|
@@ -386,19 +611,23 @@ export default {
|
|
|
},
|
|
|
swiperChange (e) {
|
|
|
this.currentIndex = e.detail.current
|
|
|
- let station = this.stations[this.currentIndex];
|
|
|
+ let station = this.stationsmap[this.currentIndex];
|
|
|
|
|
|
let posCenter= {longitude: station.longitude,latitude: station.latitude};
|
|
|
- console.log('currentIndex'+JSON.stringify(this.currentIndex))
|
|
|
- console.log('currentIndex'+JSON.stringify(posCenter))
|
|
|
- console.log('station'+JSON.stringify(station))
|
|
|
- this.$refs.amap.setCenter(posCenter);
|
|
|
+// console.log('currentIndex'+JSON.stringify(this.currentIndex))
|
|
|
+// console.log('currentIndex'+JSON.stringify(posCenter))
|
|
|
+// console.log('station'+JSON.stringify(station))
|
|
|
+ let bounds = this.$refs.amap.logMapInfo();
|
|
|
+ /*if( (posCenter.latitude<bounds.bounds.northeast.lat && posCenter.latitude>bounds.bounds.sourthwest.lat)
|
|
|
+ && (posCenter.longitude<bounds.bounds.northeast.lng && posCenter.longitude>bounds.bounds.sourthwest.lng)
|
|
|
+ ){
|
|
|
+ console.log('bounds'+JSON.stringify(bounds));
|
|
|
+
|
|
|
+ }else{
|
|
|
+ this.$refs.amap.setCenter(posCenter);
|
|
|
+ }*/
|
|
|
this.$refs.amap.updateCharger(station);
|
|
|
- //console.log('currentIndex'+e.detail.current)
|
|
|
- /*if(e.detail.current>= 2) {
|
|
|
- this.scrollIntoView = 'index' + (e.detail.current-2)
|
|
|
- }
|
|
|
- */
|
|
|
+
|
|
|
},
|
|
|
swiperTransition (e) {
|
|
|
// console.log(e)
|
|
@@ -458,6 +687,8 @@ export default {
|
|
|
close() {
|
|
|
console.log('偏好设置' + JSON.stringify(this.preference));
|
|
|
this.show = false;
|
|
|
+ let data = {latitude:this.latitude,longtitude:this.longitude};
|
|
|
+ this.getChargingStationData(data);
|
|
|
// console.log('close');
|
|
|
},
|
|
|
// 获取当前位置
|
|
@@ -473,7 +704,7 @@ export default {
|
|
|
//obj.obj.price = 2.25;
|
|
|
//obj.obj.idleNum = 12;
|
|
|
_self.$refs.amap.updateCharger(obj.obj);
|
|
|
- let index = _self.stations.findIndex(item => item.id == obj.obj.id);
|
|
|
+ let index = _self.stationsmap.findIndex(item => item.id == obj.obj.id);
|
|
|
_self.currentIndex = index;
|
|
|
console.log('find Index'+index);
|
|
|
}
|
|
@@ -489,45 +720,47 @@ export default {
|
|
|
//console.log('this'+JSON.stringify(this))
|
|
|
// console.log('longitude1 ' + this.longitude);
|
|
|
// console.log('latitude1 ' + this.latitude);
|
|
|
-
|
|
|
- var obj = {
|
|
|
- longitude: _self.longitude,
|
|
|
- latitude: _self.latitude
|
|
|
- };
|
|
|
-// console.log('obj ' + JSON.stringify(obj));
|
|
|
- this.$refs.amap.setPerson(obj);
|
|
|
- /* var obj2 = {
|
|
|
- longitude: this.nearbyStationInfo.longitude,
|
|
|
- latitude: this.nearbyStationInfo.latitude
|
|
|
- };*/
|
|
|
- let arr = [];
|
|
|
- for (let i = 0; i < 10; i++) {
|
|
|
- let obj = {name:'荆鹏软件园充电站'+i.toString(),
|
|
|
- position:'湖北省荆州市沙市区江津东路附155号',
|
|
|
- price:1.2,idleNum:10,total:10,distance:0.1,
|
|
|
- time:1,
|
|
|
- type:'慢充',
|
|
|
- id: i,
|
|
|
- park: i%2 == 0? '以实际费用为准':'2小时免费停车',
|
|
|
- longitude: 112.28541 + i * 0.001,
|
|
|
- latitude: 30.308354 + i * 0.01
|
|
|
- };
|
|
|
- if(i%2 == 0){
|
|
|
- obj.longitude = 112.28571 ;
|
|
|
- obj.latitude = 30.307539;
|
|
|
- }else{
|
|
|
- obj.type = '快充';
|
|
|
+ //this.start();
|
|
|
+ //this.$refs.amap.getLocation1();
|
|
|
+// this.getNearbyStationInfo();
|
|
|
+ this.isReady = true;
|
|
|
+ //this.$refs.amap.getLocation ();
|
|
|
+ //let state = {};
|
|
|
+ uni.getSystemInfo({
|
|
|
+ success: (res) => {
|
|
|
+ // #ifndef MP
|
|
|
+ let navbarH = 0
|
|
|
+ // #endif
|
|
|
+ // #ifdef MP
|
|
|
+ let navbarH = uni.upx2px(90)
|
|
|
+ // #endif
|
|
|
+ /*state.status_width = res.windowWidth;
|
|
|
+ console.log('window width'+state.status_width);*/
|
|
|
+
|
|
|
+ let scrollH = res.windowHeight;// - uni.upx2px(88) - navbarH
|
|
|
+ // console.log('布局结果'+ JSON.stringify(res));
|
|
|
+ // console.log('scrollH'+scrollH)
|
|
|
+ //#ifdef MP-WEIXIN
|
|
|
+ const {
|
|
|
+ statusBarHeight,
|
|
|
+ windowWidth,
|
|
|
+ } = uni.getSystemInfoSync();
|
|
|
+ // console.log('height ' + statusBarHeight);
|
|
|
+ //this.status_height = uni.getStatusbarHeight();
|
|
|
+ let res1 = uni.getMenuButtonBoundingClientRect()
|
|
|
+ // console.log('layout selectHeight '+JSON.stringify(res1))
|
|
|
+ //state.selectHeight = (res1.top-res.statusBarHeight)*2+ res1.height;
|
|
|
+ //#endif
|
|
|
+ //console.log('status height'+state.status_height)
|
|
|
+ _self.$refs.amap.setMyStyle("height:"+(scrollH-88-50)+ "px;width:100%;");
|
|
|
}
|
|
|
-
|
|
|
- //arr.push(obj);
|
|
|
- this.stations.push(obj);
|
|
|
- }
|
|
|
- console.log('stations'+JSON.stringify(this.stations))
|
|
|
-
|
|
|
- this.$refs.amap.setChargerList(this.stations);
|
|
|
- //this.$refs.amap.setPerson(obj);
|
|
|
- //this.$refs.amap.setSite(obj2);
|
|
|
- },
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.getPoint();
|
|
|
+
|
|
|
+ },
|
|
|
gotoLine(item, downid) {
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/route/index?id=' + item.routeId + '&upid=' + item.startStationId + '&downid=' + downid
|
|
@@ -543,22 +776,13 @@ export default {
|
|
|
},
|
|
|
|
|
|
getNearbyStationInfo() {
|
|
|
- var obj = {
|
|
|
- longitude: this.longitude,
|
|
|
- latitude: this.latitude,
|
|
|
- id: this.id
|
|
|
- };
|
|
|
+
|
|
|
+ let data1 = {latitude:this.latitude,longtitude:this.longitude,findType:"1"};
|
|
|
+ this.getChargingStationData(data1);
|
|
|
+ let data2 = {latitude:this.latitude,longtitude:this.longitude,findType:"0"};
|
|
|
+ this.getChargingStationData(data2);
|
|
|
|
|
|
- //this.$refs.common.showLoading();
|
|
|
- /*
|
|
|
- API.nearbyStationInfo(obj).then((res) => {
|
|
|
- this.nearbyStationInfo=res.data;
|
|
|
-
|
|
|
- this.$refs.common.showLoading(false);
|
|
|
- }).catch(error => {
|
|
|
- this.$refs.common.showLoading(false,error);
|
|
|
-
|
|
|
- })*/
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
};
|