1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- var app = getApp()
- Page({
- data: {
- scan: [],
- longitude: '',
- latitude: '',
- markers: [],
- not:false,
- },
- onLoad: function(options) {
- wx.showLoading({
- title: '加载中...',
- })
- let data = {
- bike_id: options.id
- }
- app.request('bike/sweepCodeLocation', data, 'POST').then(res => {
- wx.hideLoading();
- if (res.statusCode == 200) {
- if (res.data.length == 0) {
- this.setData({
- not:true
- })
- } else {
- let self = this;
- let arr = res.data;
- for (var i = 0; i < arr.length; i++) {
- arr[i].iconPath = 'http://resource.weilaigo.l4j.cn/common/start-location-mark-old.png';
- arr[i].width = 30;
- arr[i].height = 30;
- arr[i].zIndex = 1111;
- arr[i].latitude = arr[i].location[1];
- arr[i].longitude = arr[i].location[0];
- }
- self.setData({
- markers: arr,
- scan: res.data,
- longitude: arr[0].location[0],
- latitude: arr[0].location[1]
- })
- }
- }
- })
- },
- //获取当前扫码位置
- current(e) {
- let self = this;
- let nowPosition = self.data.markers
- let idx = e.currentTarget.dataset.idx;
- for (var i = 0; i < nowPosition.length; i++) {
- nowPosition[i].iconPath =
- "http://resource.weilaigo.l4j.cn/common/start-location-mark-old.png";
- }
- nowPosition[idx].iconPath = "http://resource.weilaigo.l4j.cn/common/end-location-mark-old.png";
- self.setData({
- markers:nowPosition
- })
- },
- })
|