style="'height:'+windowHeight*3.3+'rpx;width: 100%;'">
<cover-view class="my_add">
<cover-image class="img_add" src="../../static/image/add_danger.png" @click="toAddDanger"></cover-image>
</cover-view>
<cover-view class="my_location">
<cover-image class="img" src="../../static/image/locator.png" @click="pitch"></cover-image>
</cover-view>
</map>
<view style="background: #fff;height:200px;">
<view style="align-items:center;margin-top: 20px;">
<view v-if="flag" class="mbuttonA" @click="startBt">
<text style="font-size: 30px;color: #fff;">开始巡查</text>
</view>
<view v-if="flag===false" class="mbuttonB" @click="end">
<text style="font-size: 30px;color: #fff;">结束巡查</text>
</view>
</view>
</view>
</view>
</template>
//地标 转 国测 常量
var x_PI = (3.14159265358979324 * 3000.0) / 180.0;
var PI = 3.1415926535897932384626;
var a = 6378245.0; //卫星椭球坐标投影到平面地图坐标系的投影因子。
var ee = 0.00669342162296594323; //椭球的偏心率。
var mLocatinService = uni.requireNativePlugin("Wwei-LocationService")
import http from '../../common/http.js'
import params from '../../common/params.js'
import utils from '../../common/util.js'
onShow() {
//创建map实例
this.mapContext = uni.createMapContext("myMap", this);
this.windowHeight = uni.getSystemInfoSync().screenHeight;
this.scale = 16
},
onLoad(options) {
let that = this
if (options.item != null) {
let item = JSON.parse(decodeURIComponent(options.item));
console.log(item)
that.id = item.id
that.status = item.status.toString()
if (that.status == '1') {
that.flag = false
that.timer = setInterval(() => {
//自身定位
that.pitch()
mLocatinService.getLocation({}, (res) => {
console.log('获取插件信息:' + JSON.stringify(res))
console.log('当前位置的经度:' + JSON.stringify(res.longti));
console.log('当前位置的纬度:' + JSON.stringify(res.lat));
let longti = JSON.stringify(res.longti)
let lat = JSON.stringify(res.lat)
if (lat != '5e-324' && lat > 0) {
http.uploadTrack({
taskId: that.id,
lng: longti,
lat: lat,
// createTime: time
}, that.token).then(res => {
console.log(res)
})
}
})
}, 5000);
}
}
},
0 个回复