Browse Source

优化

master
zhaoyongnian 5 years ago
parent
commit
bdf674c396
  1. 19
      pages/complete/components/personalInfo/personalInfo.js
  2. 2
      pages/complete/components/personalInfo/personalInfo.wxml
  3. 2
      subpages/heart/components/cancelSignupDialog/cancelSignupDialog.wxml
  4. 2
      subpages/heart/components/cancelSignupDialog/cancelSignupDialog.wxss
  5. 41
      subpages/heart/pages/clockIn/clockIn.js
  6. 8
      subpages/heart/pages/heartDetail/heartDetail.wxml
  7. 2
      subpages/heart/pages/leaderboard/leaderboard.wxml
  8. 8
      subpages/heart/pages/volunteer/volunteer.js
  9. 11
      subpages/heart/pages/volunteer/volunteer.wxml
  10. 70
      subpages/integralCentre/pages/index/index.js
  11. 25
      subpages/integralCentre/pages/index/index.wxml
  12. 30
      subpages/integralCentre/pages/index/index.wxss

19
pages/complete/components/personalInfo/personalInfo.js

@ -185,7 +185,10 @@ Component({
gridInfo: this.data.gridInfo gridInfo: this.data.gridInfo
}) })
if (this.data.personalInfo.partyFlag === '1') { if (this.data.personalInfo.partyFlag === '1') {
this.triggerEvent('selectTabChange', {tab: 'partyMember', partyFlag: '1' }) this.triggerEvent('selectTabChange', {
tab: 'partyMember',
partyFlag: '1'
})
} }
resolve(true) resolve(true)
}).catch(err => { }).catch(err => {
@ -246,11 +249,15 @@ Component({
}, },
// 切换网格 // 切换网格
changeGrid() { changeGrid() {
this.triggerEvent('changeGrid', { gridId: this.data.gridInfo.gridId }) this.triggerEvent('changeGrid', {
gridId: this.data.gridInfo.gridId
})
}, },
// 获取当前用户所有网格 // 获取当前用户所有网格
getGridList() { getGridList() {
this.triggerEvent('getGridList', { gridId: this.data.gridInfo.gridId }) this.triggerEvent('getGridList', {
gridId: this.data.gridInfo.gridId
})
}, },
// 提交完善信息-从微信获取手机号方式 // 提交完善信息-从微信获取手机号方式
submitPersonalInfoByWx() { submitPersonalInfoByWx() {
@ -277,7 +284,11 @@ Component({
// return false // return false
// } // }
if (!this.data.personalInfo.road) { if (!this.data.personalInfo.road) {
this.showToast('请填写所在街道') this.showToast('请填写所在小区或所在道路')
return false
}
if (this.data.personalInfo.road.length > 100) {
this.showToast('小区或所在道路不能超过100个字')
return false return false
} }
const para = { const para = {

2
pages/complete/components/personalInfo/personalInfo.wxml

@ -76,7 +76,7 @@
<view class="grid-name">{{gridInfo.gridName}}</view> <view class="grid-name">{{gridInfo.gridName}}</view>
</view> </view>
<view class="list-item"> <view class="list-item">
<input bindblur="bindRoadInput" bindinput="bindRoadInput" value="{{personalInfo.road}}" placeholder-class="placeholder-style" placeholder="请输入所在小区" /> <input bindblur="bindRoadInput" bindinput="bindRoadInput" value="{{personalInfo.road}}" placeholder-class="placeholder-style" placeholder="请输入所在小区或所在道路" />
</view> </view>
<!-- <view class="list-item"> <!-- <view class="list-item">
<input bindblur="bindVillageNameInput" bindinput="bindVillageNameInput" value="{{personalInfo.villageName}}" placeholder-class="placeholder-style" placeholder="小区名称" /> <input bindblur="bindVillageNameInput" bindinput="bindVillageNameInput" value="{{personalInfo.villageName}}" placeholder-class="placeholder-style" placeholder="小区名称" />

2
subpages/heart/components/cancelSignupDialog/cancelSignupDialog.wxml

@ -5,7 +5,7 @@
</view> </view>
<view class="title">{{title}}</view> <view class="title">{{title}}</view>
<view class="textarea"> <view class="textarea">
<textarea value="{{textareaValue}}" bindblur="textareaInput" bindinput="textareaInput" placeholder-class="textarea-placeholder" placeholder="请您填写取消报名的原因,提交后您无法参加本次活动"/> <textarea value="{{textareaValue}}" bindblur="textareaInput" bindinput="textareaInput" placeholder-class="textarea-placeholder" cursor-spacing="70" placeholder="请您填写取消报名的原因,提交后您无法参加本次活动"/>
</view> </view>
<view class="note" wx:if="{{tipVisible}}">{{tipValue}}</view> <view class="note" wx:if="{{tipVisible}}">{{tipValue}}</view>
<view class="footer"> <view class="footer">

2
subpages/heart/components/cancelSignupDialog/cancelSignupDialog.wxss

@ -17,7 +17,7 @@
background: #fff; background: #fff;
box-sizing: border-box; box-sizing: border-box;
padding: 0 30rpx; padding: 0 30rpx;
margin-top: -350rpx; /* margin-top: -350rpx; */
} }
.notice-verify .content .close { .notice-verify .content .close {
width: 100%; width: 100%;

41
subpages/heart/pages/clockIn/clockIn.js

@ -78,8 +78,8 @@ Page({
this.reverseGeocoder(res) this.reverseGeocoder(res)
this.setData({ this.setData({
location: { location: {
locationLongitude: res.latitude, locationLongitude: res.longitude,
locationLatitude: res.longitude locationLatitude: res.latitude
} }
}) })
}, },
@ -95,7 +95,10 @@ Page({
}) })
}, },
// 逆地址解析 // 逆地址解析
reverseGeocoder({ latitude, longitude }) { reverseGeocoder({
latitude,
longitude
}) {
var that = this; var that = this;
that.data.qqmapsdk.reverseGeocoder({ that.data.qqmapsdk.reverseGeocoder({
location: { location: {
@ -218,22 +221,19 @@ Page({
const signinLongitude = this.data.signin.signinLongitude; //经度 const signinLongitude = this.data.signin.signinLongitude; //经度
const signinLatitude = this.data.signin.signinLatitude; //纬度 const signinLatitude = this.data.signin.signinLatitude; //纬度
var clockLongitudeMy = 0;
const clockLongitude = this.data.location.locationLatitude;//经度 var clockLatitudeMy = 0;
const clockLatitude = this.data.location.locationLongitude;//纬度 if (this.data.location && this.data.location.locationLatitude && this.data.location.locationLongitude) {
clockLongitudeMy = this.data.location.locationLongitude; //经度
// console.log("signinLongitude" + signinLongitude + "signinLatitude" + signinLatitude) clockLatitudeMy = this.data.location.locationLatitude; //纬度
// 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 radLat1 = this.Rad(signinLatitude); var radLat1 = this.Rad(signinLatitude);
var radLat2 = this.Rad(clockLatitude); var radLat2 = this.Rad(clockLatitudeMy);
var a = radLat1 - radLat2; var a = radLat1 - radLat2;
var b = this.Rad(signinLongitude) - this.Rad(clockLongitude); var b = this.Rad(signinLongitude) - this.Rad(clockLongitudeMy);
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + 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))); Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
s = s * 6378.137; // EARTH_RADIUS; s = s * 6378.137; // EARTH_RADIUS;
@ -249,11 +249,22 @@ Page({
effectiveFlag: 1 effectiveFlag: 1
}) })
} }
} else {
this.setData({
clockLongitudeMy: 0,
clockLatitudeMy: 0,
effectiveFlag: 0
})
}
const params = { const params = {
actId: this.data.id, actId: this.data.id,
clockDesc: this.data.operationDesc.substring(0, 500), clockDesc: this.data.operationDesc.substring(0, 500),
clockLongitude: this.data.location.locationLongitude, clockLongitude: clockLongitudeMy, //打卡位置经度
clockLatitude: this.data.location.locationLatitude, clockLatitude: clockLatitudeMy, //打卡位置纬度
clockAddress: this.data.operationAddress, clockAddress: this.data.operationAddress,
images: this.data.images, images: this.data.images,
clockType: this.data.clockType, //打卡类型(0-打卡,1-更新打卡) clockType: this.data.clockType, //打卡类型(0-打卡,1-更新打卡)

8
subpages/heart/pages/heartDetail/heartDetail.wxml

@ -46,8 +46,14 @@
<image src="../../images/mdsz.png"></image> <image src="../../images/mdsz.png"></image>
<view class="info-font display-inline">活动名额</view> <view class="info-font display-inline">活动名额</view>
</view> </view>
<view class="info-right color" wx:if="{{detail.actQuotaCategory}}"> <!-- <view class="info-right color">
{{ detail.actQuotaCategory === 0 ? '不限名额' : detail.actQuota + '人'}} {{ detail.actQuotaCategory === 0 ? '不限名额' : detail.actQuota + '人'}}
</view> -->
<view class="info-right color" wx:if="{{detail.actQuotaCategory === 0}}">
不限名额
</view>
<view class="info-right color" wx:else>
{{detail.actQuota}}人
</view> </view>
<view class="clear"></view> <view class="clear"></view>
</view> </view>

2
subpages/heart/pages/leaderboard/leaderboard.wxml

@ -11,7 +11,7 @@
<view class="num">2</view> <view class="num">2</view>
</view> </view>
<view class="name" style="visibility: {{second.nickname ? 'visible' : 'hidden'}}">{{second.nickname}}</view> <view class="name" style="visibility: {{second.nickname ? 'visible' : 'hidden'}}">{{second.nickname}}</view>
<view class="time"style="visibility: {{second.kindnessTime ? 'visible' : 'hidden'}}">爱心时长{{second.kindnessTime}}小时</view> <view class="time"style="visibility: {{second.kindnessTime ? 'visible' : 'hidden'}}">爱心时长{{second.kindnessTime}}分钟</view>
<view class="times" style="visibility: {{second.participationNum ? 'visible' : 'hidden'}}">参加次数{{second.participationNum}}次</view> <view class="times" style="visibility: {{second.participationNum ? 'visible' : 'hidden'}}">参加次数{{second.participationNum}}次</view>
</view> </view>
<view class="first order"> <view class="first order">

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

@ -1,5 +1,7 @@
const api = require('../../../../utils/api') const api = require('../../../../utils/api')
import { $wuxDialog } from '../../../../dist/index' import {
$wuxDialog
} from '../../../../dist/index'
const app = getApp() const app = getApp()
Page({ Page({
@ -198,11 +200,11 @@ Page({
} }
} }
if (!this.data.road) { if (!this.data.road) {
this.showToast('请输入所在道路') this.showToast('请填写所在小区或所在道路')
return false return false
} }
if (this.data.road.length > 100) { if (this.data.road.length > 100) {
this.showToast('所在小区不能超过100个字') this.showToast('小区或所在道路不能超过100个字')
return false return false
} }
if (!this.data.introduce) { if (!this.data.introduce) {

11
subpages/heart/pages/volunteer/volunteer.wxml

@ -79,7 +79,7 @@
<view class="info-box"> <view class="info-box">
<view class="address name"> <view class="address name">
<input placeholder="请填写您所在的小区" controlled value="{{road}}" bind:change="adInputStreet"></input> <input placeholder="请输入所在小区或所在道路" controlled value="{{road}}" bind:change="adInputStreet"></input>
</view> </view>
<view class="clear"></view> <view class="clear"></view>
</view> </view>
@ -126,12 +126,5 @@
</view> </view>
</view> </view>
<coverview-dialog <coverview-dialog bind:close="confirmDialog" bind:confirm="confirmDialog" dialogVisible="{{dialogVisible}}" title="{{dialogTitle}}" content="{{dialogContent}}" confirmText="{{dialogConfirmText}}" cancelText="{{dialogCancelText}}">
bind:close="confirmDialog"
bind:confirm="confirmDialog"
dialogVisible="{{dialogVisible}}"
title="{{dialogTitle}}"
content="{{dialogContent}}"
confirmText="{{dialogConfirmText}}"
cancelText="{{dialogCancelText}}">
</coverview-dialog> </coverview-dialog>

70
subpages/integralCentre/pages/index/index.js

@ -50,10 +50,11 @@ Page({
this.setData({ this.setData({
pageIndex: 1, pageIndex: 1,
pageSize: 15, pageSize: 15,
loadMoreType: 'none', loadMoreType: 'loading',
loadMoreVisible: false, loadMoreVisible: true,
pointsRecordlist: [], pointsRecordlist: [],
pointsRankinglist: [], pointsRankinglist: [],
pointsRankingUser: {},//当前用户排名信息
selectTab: e.currentTarget.dataset.tab, selectTab: e.currentTarget.dataset.tab,
nodatapointsRecord: false, nodatapointsRecord: false,
nodatapointsRanking: false, nodatapointsRanking: false,
@ -81,76 +82,81 @@ Page({
pageIndex: 1, pageIndex: 1,
pageSize: 15, pageSize: 15,
timestamp: this.data.timestamp, timestamp: this.data.timestamp,
loadMoreType: 'none',
loadMoreVisible: false,
pointsRankinglist: [], pointsRankinglist: [],
nodatapointsRanking: false, nodatapointsRanking: false,
loadMoreType: 'loading',
loadMoreVisible: true,
}) })
that.pointsRankinglist() that.pointsRankinglist()
}, },
// 积分记录-积分排行接口
// 获取事件详情 pointsRankinglist() {
pointsRecordlist() {
let that = this let that = this
const para = { const para = {
pageIndex: this.data.pageIndex, pageIndex: 1,
pageSize: this.data.pageSize, pageSize: 10,
timestamp: this.data.timestamp, timestamp: this.data.timestamp,
rankingType: this.data.rankingType, //排名方式:0-周,1-月
} }
pointsRecordlist(para).then(res => { pointsRankinglist(para).then(res => {
that.setData({ that.setData({
pointsRecordlist: that.data.pointsRecordlist.concat(res.data), pointsRankingUser: res.data.pointsRankingUser,
loadMoreType: res.data.length === that.data.pageSize ? 'loading' : 'none', pointsRankinglist: that.data.pointsRankinglist.concat(res.data.pointsRankingTopTen),
}) })
if (that.data.pointsRecordlist.length > 0) { if (that.data.pointsRankinglist.length > 0) {
that.setData({ that.setData({
nodatapointsRecord: false, nodatapointsRanking: false,
loadMoreType: 'none',
}) })
} else { } else {
that.setData({ that.setData({
nodatapointsRecord: true, nodatapointsRanking: true,
loadMoreType: 'none',
loadMoreVisible: false,
}) })
} }
}).catch(err => { }).catch(err => {
that.setData({ that.setData({
pointsRankinglist: [],
nodatapointsRanking: true,
loadMoreType: 'none', loadMoreType: 'none',
pointsRecordlist: [], loadMoreVisible: false,
nodatapointsRecord: false,
}) })
console.log(err) console.log(err)
}) })
}, },
// 积分记录-积分排行接口 // 积分记录-积分记录接口
pointsRankinglist() { pointsRecordlist() {
let that = this let that = this
const para = { const para = {
pageIndex: this.data.pageIndex, pageIndex: this.data.pageIndex,
pageSize: this.data.pageSize, pageSize: this.data.pageSize,
timestamp: this.data.timestamp, timestamp: this.data.timestamp,
rankingType: this.data.rankingType, //排名方式:0-周,1-月
} }
pointsRankinglist(para).then(res => { pointsRecordlist(para).then(res => {
that.setData({ that.setData({
pointsRankinglist: that.data.pointsRankinglist.concat(res.data), pointsRecordlist: that.data.pointsRecordlist.concat(res.data),
loadMoreType: res.data.length === that.data.pageSize ? 'loading' : 'none', loadMoreType: res.data.length === that.data.pageSize ? 'loading' : 'none',
}) })
if (that.data.pointsRankinglist.length > 0) { if (that.data.pointsRecordlist.length > 0) {
that.setData({ that.setData({
nodatapointsRanking: false nodatapointsRecord: false,
}) })
} else { } else {
that.setData({ that.setData({
nodatapointsRanking: true nodatapointsRecord: true,
loadMoreVisible: false,
}) })
} }
}).catch(err => { }).catch(err => {
that.setData({ that.setData({
loadMoreType: 'none', loadMoreType: 'none',
pointsRankinglist: [], loadMoreVisible: false,
nodatapointsRanking: false pointsRecordlist: [],
nodatapointsRecord: true,
}) })
console.log(err) console.log(err)
}) })
@ -158,6 +164,7 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
@ -198,6 +205,11 @@ Page({
this.setData({ this.setData({
loadMoreVisible: true loadMoreVisible: true
}) })
if (this.data.selectTab == 'tab1') {
// this.pointsRankinglist(); //积分排行
} else {
if (this.data.loadMoreType === 'loading') { if (this.data.loadMoreType === 'loading') {
this.setData({ this.setData({
pageIndex: this.data.pageIndex + 1, pageIndex: this.data.pageIndex + 1,
@ -205,10 +217,6 @@ Page({
timestamp: this.data.timestamp, timestamp: this.data.timestamp,
nodatapointsRecord: false, nodatapointsRecord: false,
}) })
if (this.data.selectTab == 'tab1') {
this.pointsRankinglist(); //积分排行
} else {
this.pointsRecordlist(); //初始化加载积分记录列表 this.pointsRecordlist(); //初始化加载积分记录列表
} }
} }

25
subpages/integralCentre/pages/index/index.wxml

@ -11,20 +11,34 @@
</view> </view>
<!-- 积分排行 --> <!-- 积分排行 -->
<block wx:if="{{selectTab === 'tab1'}}"> <block wx:if="{{selectTab === 'tab1'}}">
<view class="Top"></view>
<view class="tab-item"> <view class="tab-item">
<button wx:for="{{typeList}}" wx:key="index" wx:for-index="index" bindtap="onButtonChange" hover-class="hover-btn" data-type="{{item.type}}" id="item-{{ item.type }}" class="{{item.select ? 'font-w' : 'font-b'}}"> <button wx:for="{{typeList}}" wx:key="index" wx:for-index="index" bindtap="onButtonChange" hover-class="hover-btn" data-type="{{item.type}}" id="item-{{ item.type }}" class="{{item.select ? 'font-w' : 'font-b'}}">
{{item.name}} {{item.name}}
</button> </button>
</view> </view>
<view class="ph-list" wx:for-index="index" wx:for-item="item" wx:key="index" wx:for="{{pointsRankinglist}}" data-id="{{item.id}}"> <view class="ph-list">
<view class="left">
<!-- 左边图片 -->
<view class="left-img">
<view class="list-number_">{{pointsRankingUser.rank}}</view>
</view>
<!-- 名字 -->
<view class="list-name">{{pointsRankingUser.nickName}}</view>
</view>
<view class="right">{{pointsRankingUser.points}}</view>
</view>
<view class="marginTop"></view>
<view class="ph-list" wx:for-index="index" wx:for-item="item" wx:key="index" wx:for="{{pointsRankinglist}}">
<view class="left"> <view class="left">
<!-- 左边图片 --> <!-- 左边图片 -->
<view class="left-img"> <view class="left-img">
<image class="img-bg" wx:if="{{index == 0}}" src="../../images/first.png"></image> <image class="img-bg" wx:if="{{index == 0}}" src="../../images/first.png"></image>
<image class="img-bg" wx:elif="{{index == 1}}" src="../../images/second.png"></image> <image class="img-bg" wx:elif="{{index == 1}}" src="../../images/second.png"></image>
<image class="img-bg" wx:elif="{{index == 2}}" src="../../images/third.png"></image> <image class="img-bg" wx:elif="{{index == 2}}" src="../../images/third.png"></image>
<image class="img-bg" wx:else src="../../images/fourth.png"></image> <!-- <image class="img-bg" wx:else src="../../images/fourth.png"></image> -->
<view class="list-number">{{index+1}}</view> <view wx:if="{{index < 3}}" class="list-number">{{index+1}}</view>
<view wx:else class="list-number_">{{index+1}}</view>
</view> </view>
<!-- 名字 --> <!-- 名字 -->
<view class="list-name">{{item.nickName}}</view> <view class="list-name">{{item.nickName}}</view>
@ -36,14 +50,14 @@
</block> </block>
<!-- 积分记录 --> <!-- 积分记录 -->
<block wx:else> <block wx:else>
<view class="Top"></view>
<view class="jf-title"> <view class="jf-title">
<view class="jf-title-item">事件名称</view> <view class="jf-title-item">事件名称</view>
<view class="jf-title-item-two">积分</view> <view class="jf-title-item-two">积分</view>
<view class="jf-title-item-last">时间</view> <view class="jf-title-item-last">时间</view>
</view> </view>
<!-- 积分记录列表 --> <!-- 积分记录列表 -->
<view class="jf-list" wx:for-index="index" wx:for-item="item" wx:key="index" wx:for="{{pointsRecordlist}}" data-id="{{item.id}}"> <view class="jf-list" wx:for-index="index" wx:for-item="item" wx:key="index" wx:for="{{pointsRecordlist}}">
<view class="jf-list-li color1">{{item.ruleDesc}}</view> <view class="jf-list-li color1">{{item.ruleDesc}}</view>
<view class="jf-list-li-two color2"> <view class="jf-list-li-two color2">
<text wx:if="{{item.operationType == 0}}">-</text> <text wx:if="{{item.operationType == 0}}">-</text>
@ -52,7 +66,6 @@
</view> </view>
<no-data isShow="{{nodatapointsRecord}}"></no-data> <no-data isShow="{{nodatapointsRecord}}"></no-data>
</block> </block>
<!--加载更多提示--> <!--加载更多提示-->
<load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more> <load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more>
</view> </view>

30
subpages/integralCentre/pages/index/index.wxss

@ -1,3 +1,6 @@
page{
background: #f7f7f7;
}
.home { .home {
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -78,7 +81,6 @@
/* 积分记录 */ /* 积分记录 */
.jf-title { .jf-title {
margin-top: 20rpx;
background: #fff; background: #fff;
height: 80rpx; height: 80rpx;
width: calc(100% - 40rpx); width: calc(100% - 40rpx);
@ -157,9 +159,12 @@
} }
/* 积分排行 */ /* 积分排行 */
.Top{
height: 20rpx;
width: 100%;
background: #fff;
}
.tab-item { .tab-item {
margin-top: 20rpx;
background: #fff; background: #fff;
height: 80rpx; height: 80rpx;
width: calc(100% - 40rpx); width: calc(100% - 40rpx);
@ -217,6 +222,11 @@ button::after {
justify-content: space-between; justify-content: space-between;
} }
.marginTop {
background: #f7f7f7;
height: 10rpx;
}
.ph-list .left { .ph-list .left {
display: flex; display: flex;
align-items: center; align-items: center;
@ -248,6 +258,20 @@ button::after {
font-weight: 500; font-weight: 500;
color: rgba(255, 255, 255, 1); color: rgba(255, 255, 255, 1);
margin-top: 3rpx; margin-top: 3rpx;
margin-left: 1rpx;
}
.list-number_ {
position: relative;
z-index: 100;
width: 100%;
height: 38rpx;
line-height: 38rpx;
text-align: center;
font-size: 32rpx;
font-weight: bold;
font-style: italic;
color: rgba(51, 51, 51, 1);
} }
.left .list-name { .left .list-name {

Loading…
Cancel
Save