|
@@ -1,12 +1,5 @@
|
|
<template>
|
|
<template>
|
|
<view class="main-container">
|
|
<view class="main-container">
|
|
- <!-- <view class="navBarBox">
|
|
|
|
- <view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view>
|
|
|
|
- <view class="navBar">
|
|
|
|
- <view class="navBar-title">首页</view>
|
|
|
|
- </view>
|
|
|
|
- </view> -->
|
|
|
|
- <!-- <view class="place"></view> -->
|
|
|
|
<image class="set-bg" src="@/static/home_bg.png"></image>
|
|
<image class="set-bg" src="@/static/home_bg.png"></image>
|
|
<view class="page-content">
|
|
<view class="page-content">
|
|
<view class="page-home-order-container">
|
|
<view class="page-home-order-container">
|
|
@@ -26,7 +19,7 @@
|
|
<view class="page-home-order-item" @click="gotoOrder(0)">
|
|
<view class="page-home-order-item" @click="gotoOrder(0)">
|
|
<image class="page-home-order-img" src="@/static/home-order-second.png" mode=""></image>
|
|
<image class="page-home-order-img" src="@/static/home-order-second.png" mode=""></image>
|
|
<view class="page-home-order-name">
|
|
<view class="page-home-order-name">
|
|
- {{'待处理(' + noDeal + ')'}}
|
|
|
|
|
|
+ {{'待处理(' + pending + ')'}}
|
|
</view>
|
|
</view>
|
|
<view class="page-home-order-remark">
|
|
<view class="page-home-order-remark">
|
|
未完成的事项
|
|
未完成的事项
|
|
@@ -35,7 +28,7 @@
|
|
<view class="page-home-order-item" @click="gotoOrder(2)">
|
|
<view class="page-home-order-item" @click="gotoOrder(2)">
|
|
<image class="page-home-order-img" src="@/static/home-order-third.png" mode=""></image>
|
|
<image class="page-home-order-img" src="@/static/home-order-third.png" mode=""></image>
|
|
<view class="page-home-order-name">
|
|
<view class="page-home-order-name">
|
|
- {{'已处理(' + noDeal + ')'}}
|
|
|
|
|
|
+ {{'已处理(' + closed + ')'}}
|
|
</view>
|
|
</view>
|
|
<view class="page-home-order-remark">
|
|
<view class="page-home-order-remark">
|
|
已完成可查看
|
|
已完成可查看
|
|
@@ -44,7 +37,7 @@
|
|
<view class="page-home-order-item" @click="gotoOrder(1)">
|
|
<view class="page-home-order-item" @click="gotoOrder(1)">
|
|
<image class="page-home-order-img" src="@/static/home-order-four.png" mode=""></image>
|
|
<image class="page-home-order-img" src="@/static/home-order-four.png" mode=""></image>
|
|
<view class="page-home-order-name">
|
|
<view class="page-home-order-name">
|
|
- {{'未处理(' + noDeal + ')'}}
|
|
|
|
|
|
+ {{'未处理(' + notProcessed + ')'}}
|
|
</view>
|
|
</view>
|
|
<view class="page-home-order-remark">
|
|
<view class="page-home-order-remark">
|
|
已生成未处理工单
|
|
已生成未处理工单
|
|
@@ -56,16 +49,16 @@
|
|
<view class="page-home-supplier-title">
|
|
<view class="page-home-supplier-title">
|
|
换电站供应商
|
|
换电站供应商
|
|
</view>
|
|
</view>
|
|
- <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption">
|
|
|
|
- <view class="page-home-supplier-items" v-for="(item,index) in stationDataVoList" :key="index" @click="gotoSupplier">
|
|
|
|
|
|
+ <!-- <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"> -->
|
|
|
|
+ <view class="page-home-supplier-items" v-for="(item,index) in datalist" :key="index" @click="gotoSupplier(item)">
|
|
<view class="page-home-supplier-items-title">
|
|
<view class="page-home-supplier-items-title">
|
|
{{item.stationName}}
|
|
{{item.stationName}}
|
|
</view>
|
|
</view>
|
|
<view class="page-home-supplier-number">
|
|
<view class="page-home-supplier-number">
|
|
- {{item.num}}
|
|
|
|
|
|
+ {{item.supCount}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
- </mescroll-body>
|
|
|
|
|
|
+ <!-- </mescroll-body> -->
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
@@ -80,78 +73,42 @@
|
|
mixins: [MescrollMixin],
|
|
mixins: [MescrollMixin],
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- token: null,
|
|
|
|
- userinfo: null,
|
|
|
|
- // latitude: 29.632675, //纬度参数
|
|
|
|
- // longitude: 106.569374, //经度参数
|
|
|
|
- datalist: [],
|
|
|
|
- current: 0,
|
|
|
|
- params: {
|
|
|
|
- lat: null,
|
|
|
|
- lng: null,
|
|
|
|
- page: 1,
|
|
|
|
- pageSize: 10,
|
|
|
|
- orderByWays: 'desc'
|
|
|
|
- },
|
|
|
|
- noData: null,
|
|
|
|
- stationDataVoList: [
|
|
|
|
- {stationName: '皋兰换电站', num: 2},
|
|
|
|
- {stationName: '西安换电站', num: 3},
|
|
|
|
- {stationName: '唐山换电站', num: 4},
|
|
|
|
- ],
|
|
|
|
- isLoadAll: false,
|
|
|
|
- totalPages: 0, // 总页数
|
|
|
|
- upOption: {
|
|
|
|
- page: {
|
|
|
|
- size: 10,
|
|
|
|
- num: 0,
|
|
|
|
- },
|
|
|
|
- noMoreSize: 1,
|
|
|
|
- textNoMore: '没有更多了',
|
|
|
|
- empty: {
|
|
|
|
- use: true,
|
|
|
|
- tip: "没有更多了",
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- noposition: null,
|
|
|
|
- days: 0,
|
|
|
|
- Authorize: false,
|
|
|
|
- covers: [], //地图坐标数组
|
|
|
|
- scale: 16,
|
|
|
|
- Mapdetail:{},
|
|
|
|
- // 状态栏高度
|
|
|
|
- statusBarHeight: 0,
|
|
|
|
- // 导航栏高度
|
|
|
|
- navBarHeight: 82+11,
|
|
|
|
- //商标名称
|
|
|
|
- title: null,
|
|
|
|
- //电话号码
|
|
|
|
- phoneNum: '18580506017',
|
|
|
|
noDeal: 99,
|
|
noDeal: 99,
|
|
-
|
|
|
|
|
|
+ //工单信息数据对象
|
|
|
|
+ dataInfo: {},
|
|
|
|
+ //站点供应商数据列表
|
|
|
|
+ datalist: [],
|
|
|
|
+ //待处理
|
|
|
|
+ pending: 0,
|
|
|
|
+ //已完结
|
|
|
|
+ closed: 0,
|
|
|
|
+ //未处理
|
|
|
|
+ notProcessed: 0,
|
|
|
|
+ isLogin: '',
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ beforeCreate() {
|
|
|
|
+ let token = uni.getStorageSync('token')
|
|
|
|
+ if(!token) {
|
|
|
|
+ let url = '/pages/ucenter/index'
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages/public/login?topage=' + url
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.isLogin = token;
|
|
|
|
+ this.$http.getInfoData().then(response => {
|
|
|
|
+ this.$storage.setJson("user",response.user)
|
|
|
|
+ })
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onShow() {
|
|
onShow() {
|
|
- this.$store.dispatch("usersStatus").then(() => {
|
|
|
|
- //微信用户第二次登录
|
|
|
|
- this.token = this.$store.state.users.token
|
|
|
|
- this.userinfo = this.$store.state.users
|
|
|
|
- // this.getHomeCar()
|
|
|
|
- // this.getUserDays()
|
|
|
|
- // this.reloadList()
|
|
|
|
- this.noData = null
|
|
|
|
- }).catch(() => {
|
|
|
|
- //微信用户首次登录
|
|
|
|
- this.noData = '请先登录'
|
|
|
|
- });
|
|
|
|
|
|
+ if(uni.getStorageSync('token')) {
|
|
|
|
+ this.getIndexOptionData();
|
|
|
|
+ this.getStationSupData();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
onLoad() {
|
|
onLoad() {
|
|
- this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight'];
|
|
|
|
- let systemInfoSync = uni.getSystemInfoSync();
|
|
|
|
- this.screenHeight = systemInfoSync.screenHeight - 500;
|
|
|
|
- },
|
|
|
|
- mounted() {
|
|
|
|
- // this.mapSelect()
|
|
|
|
|
|
+
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
//跳转工单上报
|
|
//跳转工单上报
|
|
@@ -167,306 +124,326 @@
|
|
})
|
|
})
|
|
},
|
|
},
|
|
//跳转供应商页面
|
|
//跳转供应商页面
|
|
- gotoSupplier() {
|
|
|
|
|
|
+ gotoSupplier(item) {
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
- url: "/pages/index/supplier"
|
|
|
|
|
|
+ url: "/pages/index/supplier?stationCode=" + item.stationCode
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- //重新获取定位
|
|
|
|
- resetPosition() {
|
|
|
|
- this.mapSelect()
|
|
|
|
- },
|
|
|
|
- //点击搜索框
|
|
|
|
- getInputFocus() {
|
|
|
|
- uni.navigateTo({
|
|
|
|
- url: '/pages/index/searchPage',
|
|
|
|
- success: (res) => {
|
|
|
|
|
|
+ //获取首页工单信息数据
|
|
|
|
+ getIndexOptionData() {
|
|
|
|
+ this.dataInfo = {};
|
|
|
|
+ uni.showLoading({
|
|
|
|
+ title: '搜索中...',
|
|
|
|
+ })
|
|
|
|
+ this.$http.getOpsOrderOverview('').then(res => {
|
|
|
|
+ uni.hideLoading();
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
+ let {pending, closed, notProcessed} = res.data
|
|
|
|
+ this.pending = pending;
|
|
|
|
+ this.closed = closed;
|
|
|
|
+ this.notProcessed = notProcessed;
|
|
|
|
+ } else {
|
|
|
|
+ this.$utils.msg(res.msg);
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- //拨打电话
|
|
|
|
- toPhone() {
|
|
|
|
- uni.makePhoneCall({
|
|
|
|
- phoneNumber: this.phoneNum.toString(), //电话号码
|
|
|
|
|
|
+ //获取首页供应商数量信息
|
|
|
|
+ getStationSupData() {
|
|
|
|
+ this.datalist = [];
|
|
|
|
+ uni.showLoading({
|
|
|
|
+ title: '搜索中...',
|
|
})
|
|
})
|
|
- },
|
|
|
|
- //获取加入天数
|
|
|
|
- getUserDays() {
|
|
|
|
- this.$http.getDays().then(res => {
|
|
|
|
- if (res.code === 0) {
|
|
|
|
- this.days = res.data
|
|
|
|
|
|
+ this.$http.getStationOverview().then(res => {
|
|
|
|
+ uni.hideLoading();
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
+ this.datalist = res.data || [];
|
|
} else {
|
|
} else {
|
|
this.$utils.msg(res.msg);
|
|
this.$utils.msg(res.msg);
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //重新获取定位
|
|
|
|
+ // resetPosition() {
|
|
|
|
+ // this.mapSelect()
|
|
|
|
+ // },
|
|
|
|
+ //获取加入天数
|
|
|
|
+ // getUserDays() {
|
|
|
|
+ // this.$http.getDays().then(res => {
|
|
|
|
+ // if (res.code === 0) {
|
|
|
|
+ // this.days = res.data
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$utils.msg(res.msg);
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // },
|
|
//拨打电话
|
|
//拨打电话
|
|
- makePhone(num) {
|
|
|
|
- uni.makePhoneCall({
|
|
|
|
- phoneNumber: num.toString(), //电话号码
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- reloadList() {
|
|
|
|
- this.canReset && this.mescroll.resetUpScroll()
|
|
|
|
- this.canReset && this.mescroll.scrollTo(0, 0)
|
|
|
|
- this.canReset = true
|
|
|
|
- },
|
|
|
|
- //获取换电站信息
|
|
|
|
- upCallback(page) {
|
|
|
|
- if (this.Authorize == true) {
|
|
|
|
- this.params.page = page.num
|
|
|
|
- this.params.pageSize = page.size
|
|
|
|
- this.$http.homeStation(this.params).then(res => {
|
|
|
|
- uni.hideLoading();
|
|
|
|
- if (res.code === 0) {
|
|
|
|
- this.totalPages = res.data.total
|
|
|
|
- if (page.num == 1) this.stationDataVoList = []
|
|
|
|
- this.stationDataVoList = this.stationDataVoList.concat(res.data.list)
|
|
|
|
- this.mescroll.endBySize(res.data.list.length, res.data.total);
|
|
|
|
|
|
+ // makePhone(num) {
|
|
|
|
+ // uni.makePhoneCall({
|
|
|
|
+ // phoneNumber: num.toString(), //电话号码
|
|
|
|
+ // })
|
|
|
|
+ // },
|
|
|
|
+ // reloadList() {
|
|
|
|
+ // this.canReset && this.mescroll.resetUpScroll()
|
|
|
|
+ // this.canReset && this.mescroll.scrollTo(0, 0)
|
|
|
|
+ // this.canReset = true
|
|
|
|
+ // },
|
|
|
|
+ // //获取换电站信息
|
|
|
|
+ // upCallback(page) {
|
|
|
|
+ // if (this.Authorize == true) {
|
|
|
|
+ // this.params.page = page.num
|
|
|
|
+ // this.params.pageSize = page.size
|
|
|
|
+ // this.$http.homeStation(this.params).then(res => {
|
|
|
|
+ // uni.hideLoading();
|
|
|
|
+ // if (res.code === 0) {
|
|
|
|
+ // this.totalPages = res.data.total
|
|
|
|
+ // if (page.num == 1) this.stationDataVoList = []
|
|
|
|
+ // this.stationDataVoList = this.stationDataVoList.concat(res.data.list)
|
|
|
|
+ // this.mescroll.endBySize(res.data.list.length, res.data.total);
|
|
|
|
|
|
- this.scale = this.setMapZoomFunc(this.stationDataVoList[0].distance)
|
|
|
|
- //地图撒点
|
|
|
|
- let listArr = []
|
|
|
|
- this.covers = this.stationDataVoList
|
|
|
|
- this.covers.map(item => {
|
|
|
|
- const obj = {
|
|
|
|
- id: item.id,
|
|
|
|
- width: 34,
|
|
|
|
- height: 34,
|
|
|
|
- callout:{
|
|
|
|
- content: item.stationName,
|
|
|
|
- anchorY: 0,
|
|
|
|
- anchorX: 0,
|
|
|
|
- padding:5,
|
|
|
|
- borderRadius:5,
|
|
|
|
- // borderWidth:1,
|
|
|
|
- // borderColor:'#58be6b',
|
|
|
|
- display: 'BYCLICK',
|
|
|
|
- fontSize:16
|
|
|
|
- },
|
|
|
|
- // title: item.stationName,
|
|
|
|
- //将经纬度进行重新赋值,不覆盖将默认latitude: 39.909,longitude: 116.39742,时地图移动到标点位置
|
|
|
|
- latitude: item.lat,
|
|
|
|
- longitude: item.lng,
|
|
|
|
- iconPath: '/static/staIcon.png' //给每一个坐标添加图片
|
|
|
|
- }
|
|
|
|
- listArr.push(obj)
|
|
|
|
- })
|
|
|
|
|
|
+ // //地图撒点
|
|
|
|
+ // let listArr = []
|
|
|
|
+ // this.covers = this.stationDataVoList
|
|
|
|
+ // this.covers.map(item => {
|
|
|
|
+ // const obj = {
|
|
|
|
+ // id: item.id,
|
|
|
|
+ // width: 34,
|
|
|
|
+ // height: 34,
|
|
|
|
+ // callout:{
|
|
|
|
+ // content: item.stationName,
|
|
|
|
+ // anchorY: 0,
|
|
|
|
+ // anchorX: 0,
|
|
|
|
+ // padding:5,
|
|
|
|
+ // borderRadius:5,
|
|
|
|
+ // // borderWidth:1,
|
|
|
|
+ // // borderColor:'#58be6b',
|
|
|
|
+ // display: 'BYCLICK',
|
|
|
|
+ // fontSize:16
|
|
|
|
+ // },
|
|
|
|
+ // // title: item.stationName,
|
|
|
|
+ // //将经纬度进行重新赋值,不覆盖将默认latitude: 39.909,longitude: 116.39742,时地图移动到标点位置
|
|
|
|
+ // latitude: item.lat,
|
|
|
|
+ // longitude: item.lng,
|
|
|
|
+ // iconPath: '/static/staIcon.png' //给每一个坐标添加图片
|
|
|
|
+ // }
|
|
|
|
+ // listArr.push(obj)
|
|
|
|
+ // })
|
|
|
|
|
|
- let minePotion = {
|
|
|
|
- id: 10000,
|
|
|
|
- width: 20,
|
|
|
|
- height: 31,
|
|
|
|
- latitude: this.params.lat,
|
|
|
|
- longitude: this.params.lng,
|
|
|
|
- iconPath: '/static/mine.png',//给每一个坐标添加图片
|
|
|
|
- // callout:{
|
|
|
|
- // content: '当前位置',
|
|
|
|
- // anchorY: 12,
|
|
|
|
- // anchorX: 20,
|
|
|
|
- // // display: 'ALWAYS',
|
|
|
|
- // display:'BYCLICK',
|
|
|
|
- // padding:5,
|
|
|
|
- // borderRadius:5,
|
|
|
|
- // color:'#FF0000'
|
|
|
|
- // },
|
|
|
|
- }
|
|
|
|
- listArr.push(minePotion)
|
|
|
|
- this.covers = listArr
|
|
|
|
- this.covers[0].callout.display='ALWAYS'
|
|
|
|
- } else {
|
|
|
|
- this.$utils.msg(res.msg)
|
|
|
|
- this.mescroll.endErr();
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- this.mescroll.endErr();
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
|
|
+ // let minePotion = {
|
|
|
|
+ // id: 10000,
|
|
|
|
+ // width: 20,
|
|
|
|
+ // height: 31,
|
|
|
|
+ // latitude: this.params.lat,
|
|
|
|
+ // longitude: this.params.lng,
|
|
|
|
+ // iconPath: '/static/mine.png',//给每一个坐标添加图片
|
|
|
|
+ // // callout:{
|
|
|
|
+ // // content: '当前位置',
|
|
|
|
+ // // anchorY: 12,
|
|
|
|
+ // // anchorX: 20,
|
|
|
|
+ // // // display: 'ALWAYS',
|
|
|
|
+ // // display:'BYCLICK',
|
|
|
|
+ // // padding:5,
|
|
|
|
+ // // borderRadius:5,
|
|
|
|
+ // // color:'#FF0000'
|
|
|
|
+ // // },
|
|
|
|
+ // }
|
|
|
|
+ // listArr.push(minePotion)
|
|
|
|
+ // this.covers = listArr
|
|
|
|
+ // this.covers[0].callout.display='ALWAYS'
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$utils.msg(res.msg)
|
|
|
|
+ // this.mescroll.endErr();
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // } else {
|
|
|
|
+ // this.mescroll.endErr();
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
//获取车辆信息
|
|
//获取车辆信息
|
|
- getHomeCar() {
|
|
|
|
- let params = {
|
|
|
|
- page: 1,
|
|
|
|
- pageSize: 10,
|
|
|
|
- orderByWays: 'desc'
|
|
|
|
- }
|
|
|
|
- this.$http.homeCar(params).then(res => {
|
|
|
|
- if (res.code === 0) {
|
|
|
|
- if (res.data.length == 0) {
|
|
|
|
- this.noData = '暂无记录'
|
|
|
|
- } else {
|
|
|
|
- this.datalist = res.data
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- this.$utils.msg(res.msg)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- change(e) {
|
|
|
|
- this.current = e.detail.current;
|
|
|
|
- },
|
|
|
|
|
|
+ // getHomeCar() {
|
|
|
|
+ // let params = {
|
|
|
|
+ // page: 1,
|
|
|
|
+ // pageSize: 10,
|
|
|
|
+ // orderByWays: 'desc'
|
|
|
|
+ // }
|
|
|
|
+ // this.$http.homeCar(params).then(res => {
|
|
|
|
+ // if (res.code === 0) {
|
|
|
|
+ // if (res.data.length == 0) {
|
|
|
|
+ // this.noData = '暂无记录'
|
|
|
|
+ // } else {
|
|
|
|
+ // this.datalist = res.data
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$utils.msg(res.msg)
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // },
|
|
|
|
+ // change(e) {
|
|
|
|
+ // this.current = e.detail.current;
|
|
|
|
+ // },
|
|
//打开地图导航
|
|
//打开地图导航
|
|
- jumpmaps(lat, lng, address, name) {
|
|
|
|
- if (lat && lng && address && name) {
|
|
|
|
- uni.openLocation({
|
|
|
|
- latitude: lat,
|
|
|
|
- longitude: lng,
|
|
|
|
- name: name,
|
|
|
|
- address: address
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- this.$utils.msg("位置信息丢失");
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
|
|
+ // jumpmaps(lat, lng, address, name) {
|
|
|
|
+ // if (lat && lng && address && name) {
|
|
|
|
+ // uni.openLocation({
|
|
|
|
+ // latitude: lat,
|
|
|
|
+ // longitude: lng,
|
|
|
|
+ // name: name,
|
|
|
|
+ // address: address
|
|
|
|
+ // })
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$utils.msg("位置信息丢失");
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
//获取用户经纬度
|
|
//获取用户经纬度
|
|
- mapSelect() {
|
|
|
|
- uni.showLoading({
|
|
|
|
- title: '加载中'
|
|
|
|
- });
|
|
|
|
- const that = this
|
|
|
|
- uni.getLocation({
|
|
|
|
- type: 'gcj02',
|
|
|
|
- isHighAccuracy: true,
|
|
|
|
- success: function(res) {
|
|
|
|
- that.params.lat = res.latitude
|
|
|
|
- that.params.lng = res.longitude
|
|
|
|
- that.Authorize = true
|
|
|
|
- that.noposition = null
|
|
|
|
- that.mescroll.resetUpScroll()
|
|
|
|
- console.log(res, 'getLocation')
|
|
|
|
- },
|
|
|
|
- fail: () => {
|
|
|
|
- uni.hideLoading();
|
|
|
|
- that.noposition = '定位失败'
|
|
|
|
- that.getMapLocation()
|
|
|
|
- that.$utils.msg("定位失败")
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
|
|
+ // mapSelect() {
|
|
|
|
+ // uni.showLoading({
|
|
|
|
+ // title: '加载中'
|
|
|
|
+ // });
|
|
|
|
+ // const that = this
|
|
|
|
+ // uni.getLocation({
|
|
|
|
+ // type: 'gcj02',
|
|
|
|
+ // isHighAccuracy: true,
|
|
|
|
+ // success: function(res) {
|
|
|
|
+ // that.params.lat = res.latitude
|
|
|
|
+ // that.params.lng = res.longitude
|
|
|
|
+ // that.Authorize = true
|
|
|
|
+ // that.noposition = null
|
|
|
|
+ // that.mescroll.resetUpScroll()
|
|
|
|
+ // console.log(res, 'getLocation')
|
|
|
|
+ // },
|
|
|
|
+ // fail: () => {
|
|
|
|
+ // uni.hideLoading();
|
|
|
|
+ // that.noposition = '定位失败'
|
|
|
|
+ // that.getMapLocation()
|
|
|
|
+ // that.$utils.msg("定位失败")
|
|
|
|
+ // },
|
|
|
|
+ // })
|
|
|
|
+ // },
|
|
//提示用户打开位置信息
|
|
//提示用户打开位置信息
|
|
- getMapLocation() {
|
|
|
|
- uni.getSetting({
|
|
|
|
- success: (res) => {
|
|
|
|
- var status = res.authSetting
|
|
|
|
- if (!status['scope.userLocation']) {
|
|
|
|
- // 如果授权信息中没有地理位置的授权,则需要弹窗提示用户需要授权地理信息
|
|
|
|
- uni.showModal({
|
|
|
|
- title: '是否授权当前位置',
|
|
|
|
- content: '需要获取您的地理位置,请确认授权,否则地图功能将无法使用',
|
|
|
|
- success: (tip) => {
|
|
|
|
- if (tip.confirm) {
|
|
|
|
- // 如果用户同意授权地理信息,则打开授权设置页面,判断用户的操作
|
|
|
|
- uni.openSetting({
|
|
|
|
- success: (data) => {
|
|
|
|
- // 如果用户授权了地理信息在,则提示授权成功
|
|
|
|
- if (data.authSetting[
|
|
|
|
- 'scope.userLocation'] ===
|
|
|
|
- true) {
|
|
|
|
- uni.showToast({
|
|
|
|
- title: '授权成功',
|
|
|
|
- icon: 'success',
|
|
|
|
- duration: 1000,
|
|
|
|
- })
|
|
|
|
- // 授权成功后,然后再次chooseLocation获取信息
|
|
|
|
- this.mapSelect()
|
|
|
|
- } else {
|
|
|
|
- uni.hideLoading();
|
|
|
|
- this.noposition = '授权失败'
|
|
|
|
- this.Authorize = false
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- uni.hideLoading();
|
|
|
|
- this.noposition = '授权失败'
|
|
|
|
- this.Authorize = false
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- if (status['scope.userLocation'] === true && this.params.lat === null && this.params
|
|
|
|
- .lng === null) {
|
|
|
|
- uni.showToast({
|
|
|
|
- title: '请开启您手机的位置信息!',
|
|
|
|
- icon: 'none',
|
|
|
|
- duration: 5000,
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- fail: (res) => {
|
|
|
|
- uni.showToast({
|
|
|
|
- title: '调用授权窗口失败',
|
|
|
|
- icon: 'none',
|
|
|
|
- duration: 1000,
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
|
|
+ // getMapLocation() {
|
|
|
|
+ // uni.getSetting({
|
|
|
|
+ // success: (res) => {
|
|
|
|
+ // var status = res.authSetting
|
|
|
|
+ // if (!status['scope.userLocation']) {
|
|
|
|
+ // // 如果授权信息中没有地理位置的授权,则需要弹窗提示用户需要授权地理信息
|
|
|
|
+ // uni.showModal({
|
|
|
|
+ // title: '是否授权当前位置',
|
|
|
|
+ // content: '需要获取您的地理位置,请确认授权,否则地图功能将无法使用',
|
|
|
|
+ // success: (tip) => {
|
|
|
|
+ // if (tip.confirm) {
|
|
|
|
+ // // 如果用户同意授权地理信息,则打开授权设置页面,判断用户的操作
|
|
|
|
+ // uni.openSetting({
|
|
|
|
+ // success: (data) => {
|
|
|
|
+ // // 如果用户授权了地理信息在,则提示授权成功
|
|
|
|
+ // if (data.authSetting[
|
|
|
|
+ // 'scope.userLocation'] ===
|
|
|
|
+ // true) {
|
|
|
|
+ // uni.showToast({
|
|
|
|
+ // title: '授权成功',
|
|
|
|
+ // icon: 'success',
|
|
|
|
+ // duration: 1000,
|
|
|
|
+ // })
|
|
|
|
+ // // 授权成功后,然后再次chooseLocation获取信息
|
|
|
|
+ // this.mapSelect()
|
|
|
|
+ // } else {
|
|
|
|
+ // uni.hideLoading();
|
|
|
|
+ // this.noposition = '授权失败'
|
|
|
|
+ // this.Authorize = false
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
|
|
+ // })
|
|
|
|
+ // } else {
|
|
|
|
+ // uni.hideLoading();
|
|
|
|
+ // this.noposition = '授权失败'
|
|
|
|
+ // this.Authorize = false
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // if (status['scope.userLocation'] === true && this.params.lat === null && this.params
|
|
|
|
+ // .lng === null) {
|
|
|
|
+ // uni.showToast({
|
|
|
|
+ // title: '请开启您手机的位置信息!',
|
|
|
|
+ // icon: 'none',
|
|
|
|
+ // duration: 5000,
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
|
|
+ // fail: (res) => {
|
|
|
|
+ // uni.showToast({
|
|
|
|
+ // title: '调用授权窗口失败',
|
|
|
|
+ // icon: 'none',
|
|
|
|
+ // duration: 1000,
|
|
|
|
+ // })
|
|
|
|
+ // },
|
|
|
|
+ // })
|
|
|
|
+ // },
|
|
//获取描点的气泡内容
|
|
//获取描点的气泡内容
|
|
- getStationMarker(e) {
|
|
|
|
- console.log(e)
|
|
|
|
- let clickmarkerId=e.detail.markerId
|
|
|
|
- for (var i = 0; i < this.covers.length; i++) {
|
|
|
|
- if(this.covers[i].id<10000){
|
|
|
|
- this.covers[i].callout.display='BYCLICK'
|
|
|
|
- }
|
|
|
|
- if (this.covers[i].id == clickmarkerId && this.covers[i].id<10000) {
|
|
|
|
- this.Mapdetail=this.covers[i]
|
|
|
|
- this.Mapdetail.callout.display='ALWAYS'
|
|
|
|
- console.log(this.Mapdetail,'Mapdetail')
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
|
|
+ // getStationMarker(e) {
|
|
|
|
+ // console.log(e)
|
|
|
|
+ // let clickmarkerId=e.detail.markerId
|
|
|
|
+ // for (var i = 0; i < this.covers.length; i++) {
|
|
|
|
+ // if(this.covers[i].id<10000){
|
|
|
|
+ // this.covers[i].callout.display='BYCLICK'
|
|
|
|
+ // }
|
|
|
|
+ // if (this.covers[i].id == clickmarkerId && this.covers[i].id<10000) {
|
|
|
|
+ // this.Mapdetail=this.covers[i]
|
|
|
|
+ // this.Mapdetail.callout.display='ALWAYS'
|
|
|
|
+ // console.log(this.Mapdetail,'Mapdetail')
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
//计算我的位置到最近换电站的缩放比例
|
|
//计算我的位置到最近换电站的缩放比例
|
|
// 根据距离设置地图缩放级别 zoom是传过来的距离(m为单位)
|
|
// 根据距离设置地图缩放级别 zoom是传过来的距离(m为单位)
|
|
// 返回的num是地图缩放的距离
|
|
// 返回的num是地图缩放的距离
|
|
- setMapZoomFunc(zoom) {
|
|
|
|
- let num = 16
|
|
|
|
- zoom = Number(zoom)
|
|
|
|
- if (0 < zoom && zoom <= 25) {
|
|
|
|
- num = 18
|
|
|
|
- return num;
|
|
|
|
- } else if (25 < zoom && zoom <= 50) {
|
|
|
|
- num = 17
|
|
|
|
- return num;
|
|
|
|
- } else if (50 < zoom && zoom <= 100) {
|
|
|
|
- num = 16
|
|
|
|
- return num;
|
|
|
|
- } else if (100 < zoom && zoom <= 200) {
|
|
|
|
- num = 15
|
|
|
|
- return num;
|
|
|
|
- } else if (200 < zoom && zoom <= 500) {
|
|
|
|
- num = 14
|
|
|
|
- return num;
|
|
|
|
- } else if (500 < zoom && zoom <= 1000) {
|
|
|
|
- num = 13
|
|
|
|
- return num;
|
|
|
|
- } else if (1000 < zoom && zoom <= 2000) {
|
|
|
|
- num = 12
|
|
|
|
- return num;
|
|
|
|
- } else if (2000 < zoom && zoom <= 5000) {
|
|
|
|
- num = 13
|
|
|
|
- return num;
|
|
|
|
- } else if (5000 < zoom && zoom <= 10000) {
|
|
|
|
- num = 10
|
|
|
|
- return num;
|
|
|
|
- } else if (10000 < zoom && zoom <= 20000) {
|
|
|
|
- num = 9
|
|
|
|
- return num;
|
|
|
|
- } else if (20000 < zoom && zoom <= 30000) {
|
|
|
|
- num = 8
|
|
|
|
- return num;
|
|
|
|
- } else if (30000 < zoom && zoom <= 50000) {
|
|
|
|
- num = 7
|
|
|
|
- return num;
|
|
|
|
- } else if (50000 < zoom && zoom <= 100000) {
|
|
|
|
- num = 6
|
|
|
|
- return num;
|
|
|
|
- } else if (100000 < zoom && zoom <= 200000) {
|
|
|
|
- num = 5
|
|
|
|
- return num;
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
|
|
+ // setMapZoomFunc(zoom) {
|
|
|
|
+ // let num = 16
|
|
|
|
+ // zoom = Number(zoom)
|
|
|
|
+ // if (0 < zoom && zoom <= 25) {
|
|
|
|
+ // num = 18
|
|
|
|
+ // return num;
|
|
|
|
+ // } else if (25 < zoom && zoom <= 50) {
|
|
|
|
+ // num = 17
|
|
|
|
+ // return num;
|
|
|
|
+ // } else if (50 < zoom && zoom <= 100) {
|
|
|
|
+ // num = 16
|
|
|
|
+ // return num;
|
|
|
|
+ // } else if (100 < zoom && zoom <= 200) {
|
|
|
|
+ // num = 15
|
|
|
|
+ // return num;
|
|
|
|
+ // } else if (200 < zoom && zoom <= 500) {
|
|
|
|
+ // num = 14
|
|
|
|
+ // return num;
|
|
|
|
+ // } else if (500 < zoom && zoom <= 1000) {
|
|
|
|
+ // num = 13
|
|
|
|
+ // return num;
|
|
|
|
+ // } else if (1000 < zoom && zoom <= 2000) {
|
|
|
|
+ // num = 12
|
|
|
|
+ // return num;
|
|
|
|
+ // } else if (2000 < zoom && zoom <= 5000) {
|
|
|
|
+ // num = 13
|
|
|
|
+ // return num;
|
|
|
|
+ // } else if (5000 < zoom && zoom <= 10000) {
|
|
|
|
+ // num = 10
|
|
|
|
+ // return num;
|
|
|
|
+ // } else if (10000 < zoom && zoom <= 20000) {
|
|
|
|
+ // num = 9
|
|
|
|
+ // return num;
|
|
|
|
+ // } else if (20000 < zoom && zoom <= 30000) {
|
|
|
|
+ // num = 8
|
|
|
|
+ // return num;
|
|
|
|
+ // } else if (30000 < zoom && zoom <= 50000) {
|
|
|
|
+ // num = 7
|
|
|
|
+ // return num;
|
|
|
|
+ // } else if (50000 < zoom && zoom <= 100000) {
|
|
|
|
+ // num = 6
|
|
|
|
+ // return num;
|
|
|
|
+ // } else if (100000 < zoom && zoom <= 200000) {
|
|
|
|
+ // num = 5
|
|
|
|
+ // return num;
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|