|
@ -31,10 +31,19 @@ Page({ |
|
|
const qqmapsdk = new QQMapWX({ |
|
|
const qqmapsdk = new QQMapWX({ |
|
|
key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ' |
|
|
key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ' |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
if (options.currentUserStatus == "4") {//0-打卡
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
clockType: 0 |
|
|
|
|
|
}) |
|
|
|
|
|
}else{//更新打卡
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
clockType: 1 |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
qqmapsdk, |
|
|
qqmapsdk, |
|
|
id: options.id, |
|
|
id: options.id, |
|
|
clockType:1, |
|
|
|
|
|
effectiveFlag:1 |
|
|
effectiveFlag:1 |
|
|
}) |
|
|
}) |
|
|
this.getPhraseList();//常用语列表
|
|
|
this.getPhraseList();//常用语列表
|
|
@ -51,12 +60,12 @@ Page({ |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
toOperationDesc(phrase){//常用于点击事件
|
|
|
toOperationDesc(phrase){//常用于点击事件
|
|
|
console.log(phrase.currentTarget.dataset.phrase) |
|
|
// console.log(phrase.currentTarget.dataset.phrase)
|
|
|
this.setData({ |
|
|
this.setData({ |
|
|
operationDesc: this.data.operationDesc + phrase.currentTarget.dataset.phrase, |
|
|
operationDesc: this.data.operationDesc + phrase.currentTarget.dataset.phrase, |
|
|
phraseId: phrase.currentTarget.dataset.id |
|
|
phraseId: phrase.currentTarget.dataset.id |
|
|
}) |
|
|
}) |
|
|
console.log(phrase.currentTarget.dataset.phrase) |
|
|
// console.log(phrase.currentTarget.dataset.phrase)
|
|
|
}, |
|
|
}, |
|
|
//获取经纬度
|
|
|
//获取经纬度
|
|
|
getPosition() { |
|
|
getPosition() { |
|
@ -124,7 +133,7 @@ Page({ |
|
|
images: images |
|
|
images: images |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
console.log("~~~~~~@@@@@@@@" + JSON.stringify(images)) |
|
|
// console.log("~~~~~~@@@@@@@@" + JSON.stringify(images))
|
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
onSuccess(e) { |
|
|
onSuccess(e) { |
|
@ -174,11 +183,6 @@ Page({ |
|
|
* 数据提交方法 |
|
|
* 数据提交方法 |
|
|
*/ |
|
|
*/ |
|
|
submission() { |
|
|
submission() { |
|
|
// this.setData({
|
|
|
|
|
|
// clockType: 1
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.data.operationDesc === '') { |
|
|
if (this.data.operationDesc === '') { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: '请先输入打卡描述', |
|
|
title: '请先输入打卡描述', |
|
@ -202,23 +206,40 @@ Page({ |
|
|
console.log('常用语言:' + res) |
|
|
console.log('常用语言:' + res) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const signinLongitude = this.data.signin.signinLongitude; |
|
|
|
|
|
const signinLatitude = this.data.signin.signinLatitude; |
|
|
|
|
|
|
|
|
|
|
|
const clockLongitude = this.data.location.locationLongitude; |
|
|
const signinLongitude = this.data.signin.signinLongitude;//经度
|
|
|
const clockLatitude = this.data.location.clockLatitude; |
|
|
const signinLatitude = this.data.signin.signinLatitude;//纬度
|
|
|
|
|
|
|
|
|
|
|
|
const clockLongitude = this.data.location.locationLatitude;//经度
|
|
|
|
|
|
const clockLatitude = this.data.location.locationLongitude;//纬度
|
|
|
|
|
|
|
|
|
|
|
|
// console.log("signinLongitude" + signinLongitude + "signinLatitude" + signinLatitude)
|
|
|
|
|
|
// console.log("clockLongitude" + clockLongitude + "clockLatitude" + clockLatitude)
|
|
|
|
|
|
|
|
|
// Lat1 Lung1 表示A点纬度和经度,Lat2 Lung2 表示B点纬度和经度;
|
|
|
// Lat1 Lung1 表示A点纬度和经度,Lat2 Lung2 表示B点纬度和经度;
|
|
|
// a = Lat1 – Lat2 为两点纬度之差 b = Lung1 - Lung2 为两点经度之差;
|
|
|
// a = Lat1 – Lat2 为两点纬度之差 b = Lung1 - Lung2 为两点经度之差;
|
|
|
// 6378.137为地球半径,单位为公里;计算出来的结果单位为公里;
|
|
|
// 6378.137为地球半径,单位为公里;计算出来的结果单位为公里;
|
|
|
|
|
|
|
|
|
// var a = rad(signinLatitude) - rad(clockLatitude);
|
|
|
|
|
|
// var b = rad(signinLongitude) - rad(clockLongitude);
|
|
|
|
|
|
// var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
|
|
|
|
|
|
// s = s * 6378.137;
|
|
|
|
|
|
// s = Math.round(s * 10000) / 10000;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var radLat1 = this.Rad(signinLatitude); |
|
|
|
|
|
var radLat2 = this.Rad(clockLatitude); |
|
|
|
|
|
var a = radLat1 - radLat2; |
|
|
|
|
|
var b = this.Rad(signinLongitude) - this.Rad(clockLongitude); |
|
|
|
|
|
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + |
|
|
|
|
|
Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2))); |
|
|
|
|
|
s = s * 6378.137;// EARTH_RADIUS;
|
|
|
|
|
|
s = Math.round(s * 10000) / 10000 *1000; |
|
|
|
|
|
//s=s.toFixed(4);
|
|
|
|
|
|
|
|
|
|
|
|
if (s > this.data.signin.clockRadius){ |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
effectiveFlag:0 |
|
|
|
|
|
}) |
|
|
|
|
|
}else{ |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
effectiveFlag: 1 |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
const params={ |
|
|
const params={ |
|
|
actId: this.data.id, |
|
|
actId: this.data.id, |
|
|
clockDesc: this.data.operationDesc, |
|
|
clockDesc: this.data.operationDesc, |
|
@ -229,9 +250,8 @@ Page({ |
|
|
clockType: this.data.clockType,//打卡类型(0-打卡,1-更新打卡)
|
|
|
clockType: this.data.clockType,//打卡类型(0-打卡,1-更新打卡)
|
|
|
effectiveFlag: this.data.effectiveFlag//打卡是否有效(0-否,1-是)
|
|
|
effectiveFlag: this.data.effectiveFlag//打卡是否有效(0-否,1-是)
|
|
|
} |
|
|
} |
|
|
console.log('~~~~~~~":::::' + JSON.stringify(params)) |
|
|
// console.log('~~~~~~~":::::' + JSON.stringify(params))
|
|
|
api.clock(params).then(function (res) { |
|
|
api.clock(params).then(function (res) { |
|
|
console.log('打卡成功' + JSON.stringify(res)) |
|
|
|
|
|
if (res.code == 0) { |
|
|
if (res.code == 0) { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: '打卡成功', |
|
|
title: '打卡成功', |
|
@ -247,12 +267,16 @@ Page({ |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
Rad(d) {//经纬度转换成三角函数中度分表形式。
|
|
|
|
|
|
return d * Math.PI / 180.0; |
|
|
|
|
|
}, |
|
|
clockAddressDetail() {//活动打卡地点详情
|
|
|
clockAddressDetail() {//活动打卡地点详情
|
|
|
const id = this.data.id; |
|
|
let that = this; |
|
|
|
|
|
const id = that.data.id; |
|
|
|
|
|
|
|
|
api.clockAddressDetail(id).then(function (res) { |
|
|
api.clockAddressDetail(id).then(function (res) { |
|
|
if (res.data.code == 0) { |
|
|
if (res.code == 0) { |
|
|
this.setData({ |
|
|
that.setData({ |
|
|
signin: res.data |
|
|
signin: res.data |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|