Browse Source

优化

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

75
pages/complete/components/personalInfo/personalInfo.js

@ -17,7 +17,7 @@ Component({
gridId: '' // 网格id
},
wxInfo: {
encryptedData:'',// 完整信息的加密数据
encryptedData: '', // 完整信息的加密数据
iv: '', // 初始向量
wxCode: '', // 微信cod
},
@ -36,15 +36,15 @@ Component({
},
selectedGrid: {
type: Object,
observer: function (value) {
observer: function(value) {
this.setData({
gridInfo: value
})
}
}
},
lifetimes:{
attached () {
lifetimes: {
attached() {
this.getPersonalInfo().then(res => {
this.getGridList()
})
@ -54,63 +54,63 @@ Component({
},
methods: {
// 身份证号 双向绑定
bindIdentityNoInput (e) {
bindIdentityNoInput(e) {
this.setData({
'personalInfo.identityNo': e.detail.value
})
console.log(this.data.personalInfo)
},
// 姓名 双向绑定
bindRealNameInput (e) {
bindRealNameInput(e) {
this.setData({
'personalInfo.realName': e.detail.value
})
console.log(this.data.personalInfo)
},
// 选择性别回调
bindSexChange (e) {
bindSexChange(e) {
this.setData({
'personalInfo.sex': e.detail.value
})
console.log(this.data.personalInfo)
},
// 手机号 双向绑定
bindMobileInput (e) {
bindMobileInput(e) {
this.setData({
'personalInfo.mobile': e.detail.value
})
console.log(this.data.personalInfo)
},
// 验证码 双向绑定
bindSmsCodeInput (e) {
bindSmsCodeInput(e) {
this.setData({
'personalInfo.smsCode': e.detail.value
})
console.log(this.data.personalInfo)
},
// 路 双向绑定
bindRoadInput (e) {
bindRoadInput(e) {
this.setData({
'personalInfo.road': e.detail.value
})
console.log(this.data.personalInfo)
},
// 小区 双向绑定
bindVillageNameInput (e) {
bindVillageNameInput(e) {
this.setData({
'personalInfo.villageName': e.detail.value
})
console.log(this.data.personalInfo)
},
// 楼栋号-单元室 双向绑定
bindDwellingPlaceInput (e) {
bindDwellingPlaceInput(e) {
this.setData({
'personalInfo.dwellingPlace': e.detail.value
})
console.log(this.data.personalInfo)
},
// 获取验证码
getSmsCode () {
getSmsCode() {
if (!this.data.personalInfo.mobile) {
this.showToast('请先输入手机号')
return false
@ -128,9 +128,9 @@ Component({
const timer = setInterval(() => {
if (num >= 1) {
this.setData({
smsCodeText: `${num}s后重新获取`
})
--num
smsCodeText: `${num}s后重新获取`
})
--num
} else {
clearInterval(timer)
this.setData({
@ -138,7 +138,7 @@ Component({
})
}
}, 1000)
}).catch(err =>{
}).catch(err => {
console.log(err)
this.setData({
smsCodeText: '获取验证码'
@ -146,7 +146,7 @@ Component({
})
},
// 获取手机号
getPhoneNumber (e) {
getPhoneNumber(e) {
if (e.detail.errMsg === 'getPhoneNumber:ok') {
const para = {
wxCode: '',
@ -155,7 +155,7 @@ Component({
}
const that = this
wx.login({
success (res) {
success(res) {
para.wxCode = res.code
api.getWxPhone(para).then(data => {
console.log('获取微信手机号', data)
@ -170,14 +170,14 @@ Component({
}
},
// 获取之前完善的个人信息
getPersonalInfo () {
getPersonalInfo() {
return new Promise((resolve, reject) => {
api.prepareComplete().then(res => {
console.log('获取个人信息', res)
for(const key in this.data.personalInfo) {
for (const key in this.data.personalInfo) {
this.data.personalInfo[key] = res.data[key]
}
for(const key in this.data.gridInfo) {
for (const key in this.data.gridInfo) {
this.data.gridInfo[key] = res.data[key]
}
this.setData({
@ -185,7 +185,10 @@ Component({
gridInfo: this.data.gridInfo
})
if (this.data.personalInfo.partyFlag === '1') {
this.triggerEvent('selectTabChange', {tab: 'partyMember', partyFlag: '1' })
this.triggerEvent('selectTabChange', {
tab: 'partyMember',
partyFlag: '1'
})
}
resolve(true)
}).catch(err => {
@ -238,7 +241,7 @@ Component({
console.log('wxInfo', that.data.wxInfo)
resolve(true)
},
fail (err) {
fail(err) {
reject(false)
}
})
@ -246,14 +249,18 @@ Component({
},
// 切换网格
changeGrid() {
this.triggerEvent('changeGrid', { gridId: this.data.gridInfo.gridId })
this.triggerEvent('changeGrid', {
gridId: this.data.gridInfo.gridId
})
},
// 获取当前用户所有网格
getGridList() {
this.triggerEvent('getGridList', { gridId: this.data.gridInfo.gridId })
this.triggerEvent('getGridList', {
gridId: this.data.gridInfo.gridId
})
},
// 提交完善信息-从微信获取手机号方式
submitPersonalInfoByWx () {
submitPersonalInfoByWx() {
if (!this.data.personalInfo.identityNo) {
if (this.data.type === 'partyMember') {
this.showToast('请输入身份证号')
@ -277,7 +284,11 @@ Component({
// return false
// }
if (!this.data.personalInfo.road) {
this.showToast('请填写所在街道')
this.showToast('请填写所在小区或所在道路')
return false
}
if (this.data.personalInfo.road.length > 100) {
this.showToast('小区或所在道路不能超过100个字')
return false
}
const para = {
@ -406,7 +417,7 @@ Component({
}
},
// 提交完善信息,手机号输入方式
submitPersonalInfoBySelf () {
submitPersonalInfoBySelf() {
if (!this.data.personalInfo.identityNo) {
if (this.data.type === 'partyMember') {
this.showToast('请输入身份证号')
@ -558,7 +569,7 @@ Component({
}
}
},
submitPersonalInfo () {
submitPersonalInfo() {
if (this.data.getMobileType === 'wx') {
this.submitPersonalInfoByWx()
} else if (this.data.getMobileType === 'self') {
@ -566,14 +577,14 @@ Component({
}
},
// 代码简化,弹窗统一封装
showToast (title) {
showToast(title) {
wx.showToast({
title: title,
icon: 'none',
duration: 2000
})
},
changeGetMobileType () {
changeGetMobileType() {
let type = 'wx'
if (this.data.getMobileType === 'wx') {
type = 'self'

8
pages/complete/components/personalInfo/personalInfo.wxml

@ -46,7 +46,7 @@
<text class="must">*</text>
<view class="title">手机号</view>
</view>
<view class="right" >
<view class="right">
<input type="number" bindblur="bindMobileInput" bindinput="bindMobileInput" value="{{personalInfo.mobile}}" placeholder-class="placeholder-style" placeholder="请输入手机号" />
</view>
</view>
@ -69,14 +69,14 @@
<view class="title">居住地址</view>
<view bindtap="changeGrid" class="change-grid" wx:if="{{moreThanOneGrid}}">
<text>切换网格</text>
<image src="../../../../images/mine/ic_qiehuan@2x.png" />
<image src="../../../../images/mine/ic_qiehuan@2x.png" />
</view>
</view>
<view class="list-item">
<view class="grid-name">{{gridInfo.gridName}}</view>
</view>
<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 class="list-item">
<input bindblur="bindVillageNameInput" bindinput="bindVillageNameInput" value="{{personalInfo.villageName}}" placeholder-class="placeholder-style" placeholder="小区名称" />
@ -91,7 +91,7 @@
<view class="submit-button" wx:if="{{unionIdStatus === '1'}}">
<button bindtap="submitPersonalInfo" hover-class="hover-submit">提交</button>
</view>
<view class="submit-button" wx:if="{{unionIdStatus === '0'}}">
<view class="submit-button" wx:if="{{unionIdStatus === '0'}}">
<button hover-class="hover-submit" open-type="getUserInfo" bindgetuserinfo="getUserInfo">提交</button>
</view>

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

@ -5,7 +5,7 @@
</view>
<view class="title">{{title}}</view>
<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 class="note" wx:if="{{tipVisible}}">{{tipValue}}</view>
<view class="footer">

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

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

161
subpages/heart/pages/clockIn/clockIn.js

@ -10,33 +10,33 @@ Page({
*/
data: {
BASEURL: BASEURL(),
qqmapsdk:"",
signin: {},//活动打卡地点详情
actId: "",//活动ID
operationDesc: "",//打卡描述
operationDesc_:"",
locationLongitude: Number,//打卡位置经度
locationLatitude: Number,// 打卡位置纬度
operationAddress:"",//打卡地址
images: [],//图片
clockType: Number,//打卡类型(0-打卡,1-更新打卡)
effectiveFlag: Number,//打卡是否有效(0-否,1-是)
phraseList:[],//常用于列表
phraseId:"",//常用语id
qqmapsdk: "",
signin: {}, //活动打卡地点详情
actId: "", //活动ID
operationDesc: "", //打卡描述
operationDesc_: "",
locationLongitude: Number, //打卡位置经度
locationLatitude: Number, // 打卡位置纬度
operationAddress: "", //打卡地址
images: [], //图片
clockType: Number, //打卡类型(0-打卡,1-更新打卡)
effectiveFlag: Number, //打卡是否有效(0-否,1-是)
phraseList: [], //常用于列表
phraseId: "", //常用语id
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
onLoad: function(options) {
const qqmapsdk = new QQMapWX({
key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ'
})
if (options.currentUserStatus == "4") {//0-打卡
if (options.currentUserStatus == "4") { //0-打卡
this.setData({
clockType: 0
})
}else{//更新打卡
} else { //更新打卡
this.setData({
clockType: 1
})
@ -44,22 +44,22 @@ Page({
this.setData({
qqmapsdk,
id: options.id,
effectiveFlag:1
effectiveFlag: 1
})
this.getPhraseList();//常用语列表
this.getPhraseList(); //常用语列表
this.getPosition();
this.clockAddressDetail();
},
getPhraseList(){
getPhraseList() {
let that = this;
api.getPhraseList().then(function (res) {//常用语列表
api.getPhraseList().then(function(res) { //常用语列表
console.log('常用语列表:' + JSON.stringify(res.data))
that.setData({
phraseList: res.data,
})
})
},
toOperationDesc(phrase){//常用于点击事件
toOperationDesc(phrase) { //常用于点击事件
// console.log(phrase.currentTarget.dataset.phrase)
this.setData({
operationDesc: this.data.operationDesc + phrase.currentTarget.dataset.phrase,
@ -78,8 +78,8 @@ Page({
this.reverseGeocoder(res)
this.setData({
location: {
locationLongitude: res.latitude,
locationLatitude: res.longitude
locationLongitude: res.longitude,
locationLatitude: res.latitude
}
})
},
@ -95,7 +95,10 @@ Page({
})
},
// 逆地址解析
reverseGeocoder({ latitude, longitude }) {
reverseGeocoder({
latitude,
longitude
}) {
var that = this;
that.data.qqmapsdk.reverseGeocoder({
location: {
@ -189,8 +192,8 @@ Page({
})
},
/**
* 数据提交方法
*/
* 数据提交方法
*/
submission() {
if (this.data.operationDesc === '') {
wx.showToast({
@ -201,7 +204,7 @@ Page({
return false
}
if (this.data.images.length==0){
if (this.data.images.length == 0) {
wx.showToast({
title: '请上传打卡图片',
icon: 'none',
@ -211,63 +214,71 @@ Page({
}
if (this.data.phraseId) {
api.sagenumAddOne(this.data.phraseId).then(function (res) {
api.sagenumAddOne(this.data.phraseId).then(function(res) {
console.log('常用语言:' + res)
})
}
const signinLongitude = this.data.signin.signinLongitude;//经度
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)
const signinLongitude = this.data.signin.signinLongitude; //经度
const signinLatitude = this.data.signin.signinLatitude; //纬度
var clockLongitudeMy = 0;
var clockLatitudeMy = 0;
if (this.data.location && this.data.location.locationLatitude && this.data.location.locationLongitude) {
clockLongitudeMy = this.data.location.locationLongitude; //经度
clockLatitudeMy = this.data.location.locationLatitude; //纬度
// Lat1 Lung1 表示A点纬度和经度,Lat2 Lung2 表示B点纬度和经度;
// a = Lat1 – Lat2 为两点纬度之差 b = Lung1 - Lung2 为两点经度之差;
// 6378.137为地球半径,单位为公里;计算出来的结果单位为公里;
var radLat1 = this.Rad(signinLatitude);
var radLat2 = this.Rad(clockLatitudeMy);
var a = radLat1 - radLat2;
var b = this.Rad(signinLongitude) - this.Rad(clockLongitudeMy);
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
})
}
} else {
this.setData({
clockLongitudeMy: 0,
clockLatitudeMy: 0,
effectiveFlag: 0
})
}
// Lat1 Lung1 表示A点纬度和经度,Lat2 Lung2 表示B点纬度和经度;
// a = Lat1 – Lat2 为两点纬度之差 b = Lung1 - Lung2 为两点经度之差;
// 6378.137为地球半径,单位为公里;计算出来的结果单位为公里;
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,
clockDesc: this.data.operationDesc.substring(0, 500),
clockLongitude: this.data.location.locationLongitude,
clockLatitude: this.data.location.locationLatitude,
clockLongitude: clockLongitudeMy, //打卡位置经度
clockLatitude: clockLatitudeMy, //打卡位置纬度
clockAddress: this.data.operationAddress,
images: this.data.images,
clockType: this.data.clockType,//打卡类型(0-打卡,1-更新打卡)
effectiveFlag: this.data.effectiveFlag//打卡是否有效(0-否,1-是)
clockType: this.data.clockType, //打卡类型(0-打卡,1-更新打卡)
effectiveFlag: this.data.effectiveFlag //打卡是否有效(0-否,1-是)
}
// console.log('~~~~~~~":::::' + JSON.stringify(params))
api.clock(params).then(function (res) {
api.clock(params).then(function(res) {
if (res.code == 0) {
wx.showToast({
title: '打卡成功',
icon: 'none',
duration: 3000,
complete: function () {
setTimeout(function () {
complete: function() {
setTimeout(function() {
wx.navigateBack()
}, 1000);
}
@ -276,14 +287,14 @@ Page({
})
},
Rad(d) {//经纬度转换成三角函数中度分表形式。
Rad(d) { //经纬度转换成三角函数中度分表形式。
return d * Math.PI / 180.0;
},
clockAddressDetail() {//活动打卡地点详情
clockAddressDetail() { //活动打卡地点详情
let that = this;
const id = that.data.id;
api.clockAddressDetail(id).then(function (res) {
api.clockAddressDetail(id).then(function(res) {
if (res.code == 0) {
that.setData({
signin: res.data
@ -295,49 +306,49 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
onShareAppMessage: function() {
}
})

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

@ -46,8 +46,14 @@
<image src="../../images/mdsz.png"></image>
<view class="info-font display-inline">活动名额</view>
</view>
<view class="info-right color" wx:if="{{detail.actQuotaCategory}}">
<!-- <view class="info-right color">
{{ 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 class="clear"></view>
</view>

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

@ -11,7 +11,7 @@
<view class="num">2</view>
</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>
<view class="first order">

80
subpages/heart/pages/volunteer/volunteer.js

@ -1,5 +1,7 @@
const api = require('../../../../utils/api')
import { $wuxDialog } from '../../../../dist/index'
import {
$wuxDialog
} from '../../../../dist/index'
const app = getApp()
Page({
@ -7,18 +9,18 @@ Page({
* 页面的初始数据 全部为必填项
*/
data: {
realName: '',//真实姓名
mobile: '',//手机号
identityNo: '',//身份证号码
road: '',//所在道路
villageName: '',//小区名
dwellingPlace: '',//住处(楼栋-单元-房间)
gridId: Number,//居住网格id
gridName:'',
wxCode: '',//用户unionId为空时 传入
encryptedData: '',//用户unionId为空时 传入
iv: '',//用户unionId为空时 传入
introduce: '',//自我介绍
realName: '', //真实姓名
mobile: '', //手机号
identityNo: '', //身份证号码
road: '', //所在道路
villageName: '', //小区名
dwellingPlace: '', //住处(楼栋-单元-房间)
gridId: Number, //居住网格id
gridName: '',
wxCode: '', //用户unionId为空时 传入
encryptedData: '', //用户unionId为空时 传入
iv: '', //用户unionId为空时 传入
introduce: '', //自我介绍
unionIdStatus: '0',
wait: 60,
smsCode: '',
@ -30,53 +32,53 @@ Page({
getMobileType: 'wx',
smsCodeText: '获取验证码'
},
onLoad: function (options) {
onLoad: function(options) {
this.getPrepareComplete().then(res => {
this.getGridList()
})
this.checkWxUnionId()
this.getWxCode()
},
bindRealNameInput (e) {
bindRealNameInput(e) {
this.setData({
realName: e.detail.value
})
},
bindMobileInput (e) {
bindMobileInput(e) {
this.setData({
mobile: e.detail.value
})
},
bindSmsCodeInput (e) {
bindSmsCodeInput(e) {
this.setData({
smsCode: e.detail.value
})
},
bindIdentityNoInput (e) {
bindIdentityNoInput(e) {
this.setData({
identityNo: e.detail.value
})
},
adInputStreet (e) {
adInputStreet(e) {
this.setData({
road: e.detail.value
})
},
adInputCommunity (e) {
adInputCommunity(e) {
this.setData({
villageName: e.detail.value
})
},
adInputBuilding (e) {
adInputBuilding(e) {
this.setData({
dwellingPlace: e.detail.value
})
},
adInputIntroduce (e) {
adInputIntroduce(e) {
this.setData({
introduce: e.detail.value
})
@ -112,9 +114,9 @@ Page({
encryptedData: e.detail.encryptedData,
iv: e.detail.iv
})
if (e.detail.iv){
if (e.detail.iv) {
this.submission()
}else{
} else {
wx.showToast({
title: '您拒绝了获取信息,无法完成认证',
icon: 'none',
@ -182,7 +184,7 @@ Page({
this.showToast('请输入身份证号')
return false
}
if(this.data.getMobileType === 'wx') {
if (this.data.getMobileType === 'wx') {
if (!this.data.mobile) {
this.showToast('请获取手机号')
return false
@ -198,11 +200,11 @@ Page({
}
}
if (!this.data.road) {
this.showToast('请输入所在道路')
return false
this.showToast('请填写所在小区或所在道路')
return false
}
if (this.data.road.length > 100) {
this.showToast('所在小区不能超过100个字')
this.showToast('小区或所在道路不能超过100个字')
return false
}
if (!this.data.introduce) {
@ -231,7 +233,7 @@ Page({
wx.showLoading({
title: '正在提交',
})
api.authenticate(params).then( res => {
api.authenticate(params).then(res => {
wx.hideLoading()
let state = res.data.userState
@ -248,12 +250,12 @@ Page({
})
})
},
confirmDialog () {
confirmDialog() {
wx.navigateBack({
delta: 1
})
},
changeGetMobileType () {
changeGetMobileType() {
let type = 'wx'
if (this.data.getMobileType === 'wx') {
type = 'self'
@ -265,7 +267,7 @@ Page({
})
},
// 获取验证码
getSmsCode () {
getSmsCode() {
if (!this.data.mobile) {
this.showToast('请先输入手机号')
return false
@ -283,9 +285,9 @@ Page({
const timer = setInterval(() => {
if (num >= 1) {
this.setData({
smsCodeText: `${num}s后重新获取`
})
--num
smsCodeText: `${num}s后重新获取`
})
--num
} else {
clearInterval(timer)
this.setData({
@ -293,7 +295,7 @@ Page({
})
}
}, 1000)
}).catch(err =>{
}).catch(err => {
console.log(err)
this.setData({
smsCodeText: '获取验证码'
@ -301,7 +303,7 @@ Page({
})
},
// 获取手机号
getPhoneNumber (e) {
getPhoneNumber(e) {
if (e.detail.errMsg === 'getPhoneNumber:ok') {
const para = {
wxCode: '',
@ -310,7 +312,7 @@ Page({
}
const that = this
wx.login({
success (res) {
success(res) {
para.wxCode = res.code
api.getWxPhone(para).then(data => {
console.log('获取微信手机号', data)
@ -325,7 +327,7 @@ Page({
}
},
// 代码简化,弹窗统一封装
showToast (title) {
showToast(title) {
wx.showToast({
title: title,
icon: 'none',

47
subpages/heart/pages/volunteer/volunteer.wxml

@ -4,7 +4,7 @@
<image src="../../images/renzheng-bg.png" />
</view>
<view class="position-absolute">
<!-- 基本信息 -->
<!-- 基本信息 -->
<view class="basic-info">
<view class="info-box">
<view class="info-left header">
@ -21,15 +21,15 @@
<input confirm-type="next" bindblur="bindRealNameInput" bindinput="bindRealNameInput" value="{{realName}}" placeholder-class="placeholder-style" placeholder="请输入姓名" />
</view>
</view>
<view class="list-item identity-no">
<view class="left">
<text class="must">*</text>
<view class="title">身份证号</view>
</view>
<view class="right">
<input type="idcard" bindblur="bindIdentityNoInput" bindinput="bindIdentityNoInput" value="{{identityNo}}" placeholder-class="placeholder-style" placeholder="实名认证请输入身份证" />
<view class="list-item identity-no">
<view class="left">
<text class="must">*</text>
<view class="title">身份证号</view>
</view>
<view class="right">
<input type="idcard" bindblur="bindIdentityNoInput" bindinput="bindIdentityNoInput" value="{{identityNo}}" placeholder-class="placeholder-style" placeholder="实名认证请输入身份证" />
</view>
</view>
</view>
<view class="list-item mobile" wx:if="{{getMobileType === 'wx'}}">
<view class="left">
<text class="must">*</text>
@ -45,7 +45,7 @@
<text class="must">*</text>
<view class="title">手机号</view>
</view>
<view class="right" >
<view class="right">
<input type="number" bindblur="bindMobileInput" bindinput="bindMobileInput" value="{{mobile}}" placeholder-class="placeholder-style" placeholder="请输入手机号" />
</view>
</view>
@ -61,7 +61,7 @@
</view>
</view>
<view class="note" bindtap="changeGetMobileType">{{getMobileType === 'wx' ? '*如若获取手机号异常,请点击切换至手机号/验证码注册方式' : '*点击可切回至从微信获取手机号注册方式'}}</view>
<view class="note" bindtap="changeGetMobileType">{{getMobileType === 'wx' ? '*如若获取手机号异常,请点击切换至手机号/验证码注册方式' : '*点击可切回至从微信获取手机号注册方式'}}</view>
<!-- 居住地址 -->
<view class="info magin-top">
<view class="info-box">
@ -79,7 +79,7 @@
<view class="info-box">
<view class="address name">
<input placeholder="请填写您所在的小区" controlled value="{{road}}" bind:change="adInputStreet"></input>
<input placeholder="请输入所在小区或所在道路" controlled value="{{road}}" bind:change="adInputStreet"></input>
</view>
<view class="clear"></view>
</view>
@ -110,28 +110,21 @@
<view class="info-box-last">
<view class="introduce">
<textarea placeholder="请输入自我介绍、是否参加过公益活动、参加了哪些公益活动" bindblur="adInputIntroduce" bindinput="adInputIntroduce" maxlength="500"></textarea>
<textarea placeholder="请输入自我介绍、是否参加过公益活动、参加了哪些公益活动" bindblur="adInputIntroduce" bindinput="adInputIntroduce" maxlength="500"></textarea>
</view>
</view>
</view>
<view class="submit-btn" wx:if="{{unionIdStatus === '1'}}">
<button hover-class="hover-button" bindtap="submission">提交认证</button>
</view>
<view class="submit-btn" wx:if="{{unionIdStatus === '1'}}">
<button hover-class="hover-button" bindtap="submission">提交认证</button>
</view>
<view class="submit-btn" wx:elif="{{unionIdStatus === '0'}}">
<button hover-class="hover-button" open-type="getUserInfo" bindgetuserinfo="getUserInfo">提交认证</button>
</view>
<view class="submit-btn" wx:elif="{{unionIdStatus === '0'}}">
<button hover-class="hover-button" open-type="getUserInfo" bindgetuserinfo="getUserInfo">提交认证</button>
</view>
</view>
</view>
<coverview-dialog
bind:close="confirmDialog"
bind:confirm="confirmDialog"
dialogVisible="{{dialogVisible}}"
title="{{dialogTitle}}"
content="{{dialogContent}}"
confirmText="{{dialogConfirmText}}"
cancelText="{{dialogCancelText}}">
<coverview-dialog bind:close="confirmDialog" bind:confirm="confirmDialog" dialogVisible="{{dialogVisible}}" title="{{dialogTitle}}" content="{{dialogContent}}" confirmText="{{dialogConfirmText}}" cancelText="{{dialogCancelText}}">
</coverview-dialog>

82
subpages/integralCentre/pages/index/index.js

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

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

@ -11,20 +11,34 @@
</view>
<!-- 积分排行 -->
<block wx:if="{{selectTab === 'tab1'}}">
<view class="Top"></view>
<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'}}">
{{item.name}}
</button>
</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-img">
<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 == 2}}" src="../../images/third.png"></image>
<image class="img-bg" wx:else src="../../images/fourth.png"></image>
<view class="list-number">{{index+1}}</view>
<!-- <image class="img-bg" wx:else src="../../images/fourth.png"></image> -->
<view wx:if="{{index < 3}}" class="list-number">{{index+1}}</view>
<view wx:else class="list-number_">{{index+1}}</view>
</view>
<!-- 名字 -->
<view class="list-name">{{item.nickName}}</view>
@ -36,14 +50,14 @@
</block>
<!-- 积分记录 -->
<block wx:else>
<view class="Top"></view>
<view class="jf-title">
<view class="jf-title-item">事件名称</view>
<view class="jf-title-item-two">积分</view>
<view class="jf-title-item-last">时间</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-two color2">
<text wx:if="{{item.operationType == 0}}">-</text>
@ -52,7 +66,6 @@
</view>
<no-data isShow="{{nodatapointsRecord}}"></no-data>
</block>
<!--加载更多提示-->
<load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more>
</view>

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

@ -1,3 +1,6 @@
page{
background: #f7f7f7;
}
.home {
width: 100%;
height: 100%;
@ -78,7 +81,6 @@
/* 积分记录 */
.jf-title {
margin-top: 20rpx;
background: #fff;
height: 80rpx;
width: calc(100% - 40rpx);
@ -157,9 +159,12 @@
}
/* 积分排行 */
.Top{
height: 20rpx;
width: 100%;
background: #fff;
}
.tab-item {
margin-top: 20rpx;
background: #fff;
height: 80rpx;
width: calc(100% - 40rpx);
@ -217,6 +222,11 @@ button::after {
justify-content: space-between;
}
.marginTop {
background: #f7f7f7;
height: 10rpx;
}
.ph-list .left {
display: flex;
align-items: center;
@ -248,6 +258,20 @@ button::after {
font-weight: 500;
color: rgba(255, 255, 255, 1);
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 {

Loading…
Cancel
Save