Browse Source

优化

master
zhaoyongnian 5 years ago
parent
commit
6c72a48b6e
  1. 14
      subpages/association/utils/api.js
  2. 72
      subpages/heart/pages/clockIn/clockIn.js
  3. 3
      subpages/heart/pages/heartDetail/heartDetail.js
  4. 2
      subpages/heart/pages/heartDetail/heartDetail.wxml
  5. 8
      subpages/heart/pages/volunteer/volunteer.js
  6. 1
      subpages/integralCentre/pages/index/index.wxss

14
subpages/association/utils/api.js

@ -187,23 +187,21 @@ export function remarkOrReply ({ topicId, faCommentId, content }) {
/**
* 话题评论 v2
*/
export function topicCom({ issueId, faCommentId, content, itemId }) {
export function topicCom({ topicId, faCommentId, content }) {
return request.post('group/comment/topicCom', {
issueId,
topicId,
faCommentId,
content,
itemId
content
})
}
/**
* 话题回复 v2
*/
export function topicReply({ issueId, faCommentId, content, itemId }) {
export function topicReply({ topicId, faCommentId, content }) {
return request.post('group/comment/topicReply', {
issueId,
topicId,
faCommentId,
content,
itemId
content
})
}

72
subpages/heart/pages/clockIn/clockIn.js

@ -31,10 +31,19 @@ Page({
const qqmapsdk = new QQMapWX({
key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ'
})
if (options.currentUserStatus == "4") {//0-打卡
this.setData({
clockType: 0
})
}else{//更新打卡
this.setData({
clockType: 1
})
}
this.setData({
qqmapsdk,
id: options.id,
clockType:1,
effectiveFlag:1
})
this.getPhraseList();//常用语列表
@ -51,12 +60,12 @@ Page({
})
},
toOperationDesc(phrase){//常用于点击事件
console.log(phrase.currentTarget.dataset.phrase)
// console.log(phrase.currentTarget.dataset.phrase)
this.setData({
operationDesc: this.data.operationDesc + phrase.currentTarget.dataset.phrase,
phraseId: phrase.currentTarget.dataset.id
})
console.log(phrase.currentTarget.dataset.phrase)
// console.log(phrase.currentTarget.dataset.phrase)
},
//获取经纬度
getPosition() {
@ -124,7 +133,7 @@ Page({
images: images
})
console.log("~~~~~~@@@@@@@@" + JSON.stringify(images))
// console.log("~~~~~~@@@@@@@@" + JSON.stringify(images))
},
onSuccess(e) {
@ -174,11 +183,6 @@ Page({
* 数据提交方法
*/
submission() {
// this.setData({
// clockType: 1
// })
if (this.data.operationDesc === '') {
wx.showToast({
title: '请先输入打卡描述',
@ -203,22 +207,39 @@ Page({
})
}
const signinLongitude = this.data.signin.signinLongitude;
const signinLatitude = this.data.signin.signinLatitude;
const signinLongitude = this.data.signin.signinLongitude;//经度
const signinLatitude = this.data.signin.signinLatitude;//纬度
const clockLongitude = this.data.location.locationLongitude;
const clockLatitude = this.data.location.clockLatitude;
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点纬度和经度;
// a = Lat1 – Lat2 为两点纬度之差 b = Lung1 - Lung2 为两点经度之差;
// 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={
actId: this.data.id,
clockDesc: this.data.operationDesc,
@ -229,9 +250,8 @@ Page({
clockType: this.data.clockType,//打卡类型(0-打卡,1-更新打卡)
effectiveFlag: this.data.effectiveFlag//打卡是否有效(0-否,1-是)
}
console.log('~~~~~~~":::::' + JSON.stringify(params))
// console.log('~~~~~~~":::::' + JSON.stringify(params))
api.clock(params).then(function (res) {
console.log('打卡成功' + JSON.stringify(res))
if (res.code == 0) {
wx.showToast({
title: '打卡成功',
@ -247,12 +267,16 @@ Page({
})
},
Rad(d) {//经纬度转换成三角函数中度分表形式。
return d * Math.PI / 180.0;
},
clockAddressDetail() {//活动打卡地点详情
const id = this.data.id;
let that = this;
const id = that.data.id;
api.clockAddressDetail(id).then(function (res) {
if (res.data.code == 0) {
this.setData({
if (res.code == 0) {
that.setData({
signin: res.data
})
}

3
subpages/heart/pages/heartDetail/heartDetail.js

@ -68,8 +68,9 @@ Page({
},
goClockIn(e) { //前往打卡页面
const id = e.currentTarget.dataset.id
const currentUserStatus = e.currentTarget.dataset.currentuserstatus;//4 我要打卡 5 更新打卡
wx.navigateTo({
url: `../clockIn/clockIn?id=${id}`
url: `../clockIn/clockIn?id=${id}&currentUserStatus=${currentUserStatus}`
})
},
goVolunteer(e) { //我要报名 用户认证志愿者标识(0-未认证,1-已认证)

2
subpages/heart/pages/heartDetail/heartDetail.wxml

@ -251,7 +251,7 @@
<block wx:elif="{{detail.currentUserStatus == 4 || detail.currentUserStatus == 5}}">
<!-- 4-我要打卡 5-更新打卡 6-已结束 bindtap="goClockIn" -->
<view class="button1 button2" bindtap="goClockIn" data-id="{{detail.id}}">
<view class="button1 button2" bindtap="goClockIn" data-id="{{detail.id}}" data-currentUserStatus="{{detail.currentUserStatus}}">
<image class='header-bg' src="../../images/yuanjiao-red.png"></image>
<view wx:if="{{detail.currentUserStatus == 4}}" class="font"> 我要打卡 </view>
<view wx:elif="{{detail.currentUserStatus == 5}}" class="font"> 更新打卡 </view>

8
subpages/heart/pages/volunteer/volunteer.js

@ -166,6 +166,10 @@ Page({
this.showToast('请输入姓名')
return false
}
if (this.data.realName.length > 20) {
this.showToast('姓名不能超过20个字')
return false
}
if (!this.data.identityNo) {
this.showToast('请输入身份证号')
return false
@ -189,6 +193,10 @@ Page({
this.showToast('请输入所在道路')
return false
}
if (this.data.road.length > 100) {
this.showToast('所在道路不能超过100个字')
return false
}
if (!this.data.introduce) {
this.showToast('请输入自我介绍')
return false

1
subpages/integralCentre/pages/index/index.wxss

@ -138,6 +138,7 @@
font-size: 30rpx;
font-weight: 500;
line-height: 80rpx;
color: #B20004;
}
.jf-list .jf-list-li.jf-list-li-last {

Loading…
Cancel
Save