Commit f2bc27ff by TengFengLian

表单提及限制重复点击,我的活动分页加载

parent f3c5f054
...@@ -22,8 +22,8 @@ Page({ ...@@ -22,8 +22,8 @@ Page({
errorPhone: '', errorPhone: '',
errorSession: '', errorSession: '',
errorQuantity: '', errorQuantity: '',
canSubmit: false,
isSubmit: false, isSubmit: false,
// 接口参数 // 接口参数
id: '', id: '',
}, },
...@@ -66,7 +66,6 @@ Page({ ...@@ -66,7 +66,6 @@ Page({
this.setData({ this.setData({
formInto: funcFormInto formInto: funcFormInto
}) })
this.inspectForm()
}, },
onQuantityAdd: function () { onQuantityAdd: function () {
...@@ -101,8 +100,6 @@ Page({ ...@@ -101,8 +100,6 @@ Page({
formInto: funcFormInto formInto: funcFormInto
}) })
this.inspectForm()
}, },
onSelectionDate: function (event) { onSelectionDate: function (event) {
...@@ -116,18 +113,21 @@ Page({ ...@@ -116,18 +113,21 @@ Page({
}) })
let activityTime = this.data.activityTimes[this.data.activityIndex] let activityTime = this.data.activityTimes[this.data.activityIndex]
if (1 == activityTime.enroll*1) { if (1 == activityTime.enroll*1) {
this.setData({ this.setData({
errorQuantity: '该场次已报名过,请选择其他场次', errorQuantity: '该场次已报名过,请选择其他场次',
}) })
} else if (0 == activityTime.residue*1) {
this.setData({
errorQuantity: '该场次人数已满,请选择其他场次',
})
} else { } else {
this.setData({ this.setData({
errorQuantity: '', errorQuantity: '',
}) })
} }
this.inspectForm()
}, },
onServic: function () { onServic: function () {
...@@ -155,6 +155,7 @@ Page({ ...@@ -155,6 +155,7 @@ Page({
}, },
bindNameInput: function (e) { bindNameInput: function (e) {
console.log(e.detail.value)
this.setData({ this.setData({
['formInto.name']: e.detail.value ['formInto.name']: e.detail.value
}) })
...@@ -166,6 +167,42 @@ Page({ ...@@ -166,6 +167,42 @@ Page({
}) })
}, },
onInputBlur: function (e) {
let type = e.target.dataset.type
let value = e.detail.value
if (type == 'name') {
if (value === '') {
this.setData({
canSubmit: false,
errorName: '请输入姓名'
})
return false
} else {
this.setData({
errorName: ''
})
}
} else if (type == 'phone') {
if (value === '') {
this.setData({
canSubmit: false,
errorPhone: '请输入手机号码'
})
complete = false
} else if (value.length != 11) {
this.setData({
canSubmit: false,
errorPhone: '请输入11位手机号码'
})
complete = false
} else {
this.setData({
errorPhone: ''
})
}
}
},
//活动报名页 //活动报名页
getEnrollView(){ getEnrollView(){
var that = this var that = this
...@@ -196,28 +233,14 @@ Page({ ...@@ -196,28 +233,14 @@ Page({
}, },
inspectForm: function () { inspectForm: function () {
let activityTime = this.data.activityTimes[this.data.activityIndex]
if (activityTime.residue*1 == 0) {
this.setData({
isSubmit: false,
errorSession: '',
})
return false
} else {
this.setData({
errorSession: '',
})
}
let complete = true
let formInto = this.data.formInto let formInto = this.data.formInto
if (formInto.name === '') { if (formInto.name === '') {
this.setData({ this.setData({
isSubmit: false,
errorName: '请输入姓名' errorName: '请输入姓名'
}) })
return false complete = false
} else { } else {
this.setData({ this.setData({
errorName: '' errorName: ''
...@@ -226,44 +249,60 @@ Page({ ...@@ -226,44 +249,60 @@ Page({
if (formInto.phone === '') { if (formInto.phone === '') {
this.setData({ this.setData({
isSubmit: false,
errorPhone: '请输入手机号码' errorPhone: '请输入手机号码'
}) })
return false complete = false
} else if (formInto.phone.length != 11) { } else if (formInto.phone.length != 11) {
this.setData({ this.setData({
isSubmit: false,
errorPhone: '请输入11位手机号码' errorPhone: '请输入11位手机号码'
}) })
return false complete = false
} else { } else {
this.setData({ this.setData({
errorPhone: '' errorPhone: ''
}) })
} }
if (formInto.quantity === 0) {
let activityTime = this.data.activityTimes[this.data.activityIndex]
if (1 == activityTime.enroll*1) {
this.setData({
errorQuantity: '该场次已报名过,请选择其他场次',
})
complete = false
} else if (0 == activityTime.residue*1) {
this.setData({
errorQuantity: '该场次人数已满,请选择其他场次',
})
complete = false
} else if (formInto.quantity === 0) {
this.setData({ this.setData({
isSubmit: false,
errorQuantity: '请设置报名人数' errorQuantity: '请设置报名人数'
}) })
return false complete = false
} } else {
this.setData({
errorQuantity: ''
})
}
this.setData({ this.setData({
isSubmit: true canSubmit: complete
}) })
return true return complete
}, },
// 活动报名 // 活动报名
doActivityEnroll() { doActivityEnroll() {
if (!this.inspectForm()) { if (!this.inspectForm() || this.data.isSubmit) {
return return
} }
this.setData({
isSubmit: true,
})
var activityTime = this.data.activityTimes[this.data.activityIndex] var activityTime = this.data.activityTimes[this.data.activityIndex]
let formInto = this.data.formInto let formInto = this.data.formInto
wx.lin.showToast({ wx.lin.showToast({
...@@ -283,11 +322,15 @@ Page({ ...@@ -283,11 +322,15 @@ Page({
}, },
success: function(res) { success: function(res) {
that.setData({ that.setData({
entryComplete: true entryComplete: true,
isSubmit: false,
}) })
wx.lin.hideToast() wx.lin.hideToast()
}, },
fail: function(err) { fail: function(err) {
that.setData({
isSubmit: false,
})
wx.lin.showToast({ wx.lin.showToast({
icon: 'error', icon: 'error',
title: err.msg, title: err.msg,
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<text space="ensp">姓 名</text> <text space="ensp">姓 名</text>
</view> </view>
<view class="input-wrap row align-c"> <view class="input-wrap row align-c">
<input maxlength="16" class="weui-input" placeholder-class="input-tip" placeholder="请输入名字" bindinput="bindNameInput"></input> <input maxlength="16" class="weui-input" placeholder-class="input-tip" placeholder="请输入名字" data-type="name" bindblur="onInputBlur" bindinput="bindNameInput"></input>
</view> </view>
</view> </view>
<view class="form-error row align-c"> <view class="form-error row align-c">
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<text space="ensp">手 机 号</text> <text space="ensp">手 机 号</text>
</view> </view>
<view class="input-wrap row align-c"> <view class="input-wrap row align-c">
<input maxlength="11" type="number" class="weui-input" placeholder-class="input-tip" placeholder="请输入手机号" bindinput="bindPhoneInput"></input> <input maxlength="11" type="number" class="weui-input" placeholder-class="input-tip" placeholder="请输入手机号" data-type="phone" bindblur="onInputBlur" bindinput="bindPhoneInput"></input>
</view> </view>
</view> </view>
<view class="form-error row align-c"> <view class="form-error row align-c">
...@@ -95,6 +95,6 @@ ...@@ -95,6 +95,6 @@
</view> </view>
<view class="entry-operation"> <view class="entry-operation">
<button class="{{isSubmit ? 'button' : 'button-disable'}} button row con-c align-c" bindtap="onSubmit">确认报名</button> <button class="{{canSubmit ? 'button' : 'button-disable'}} button row con-c align-c" bindtap="onSubmit">确认报名</button>
</view> </view>
</view> </view>
\ No newline at end of file
...@@ -17,8 +17,9 @@ Page({ ...@@ -17,8 +17,9 @@ Page({
errorPhone: '', errorPhone: '',
errorQuantity: '', errorQuantity: '',
isSubmit: false, canSubmit: false,
winQuota: false, winQuota: false,
isSubmit: false,
// 预约入园剩余名额 // 预约入园剩余名额
total: 0, total: 0,
...@@ -119,7 +120,7 @@ Page({ ...@@ -119,7 +120,7 @@ Page({
inspectForm: function () { inspectForm: function () {
if (this.data.formName === '') { if (this.data.formName === '') {
this.setData({ this.setData({
isSubmit: false, canSubmit: false,
errorName: '请输入姓名' errorName: '请输入姓名'
}) })
return return
...@@ -131,13 +132,13 @@ Page({ ...@@ -131,13 +132,13 @@ Page({
if (this.data.formPhone === '') { if (this.data.formPhone === '') {
this.setData({ this.setData({
isSubmit: false, canSubmit: false,
errorPhone: '请输入手机号码' errorPhone: '请输入手机号码'
}) })
return return
} else if (this.data.formPhone.length != 11) { } else if (this.data.formPhone.length != 11) {
this.setData({ this.setData({
isSubmit: false, canSubmit: false,
errorPhone: '请输入11位手机号码' errorPhone: '请输入11位手机号码'
}) })
return return
...@@ -149,7 +150,7 @@ Page({ ...@@ -149,7 +150,7 @@ Page({
if (this.data.formQuantity === 0) { if (this.data.formQuantity === 0) {
this.setData({ this.setData({
isSubmit: false, canSubmit: false,
errorQuantity: '预约人数不能为 0' errorQuantity: '预约人数不能为 0'
}) })
return return
...@@ -160,7 +161,7 @@ Page({ ...@@ -160,7 +161,7 @@ Page({
} }
this.setData({ this.setData({
isSubmit: true canSubmit: true
}) })
}, },
...@@ -170,10 +171,14 @@ Page({ ...@@ -170,10 +171,14 @@ Page({
app.login({ app.login({
success: function() { success: function() {
if (!that.data.isSubmit) { if (!that.data.canSubmit || that.data.isSubmit) {
that.inspectForm() // that.inspectForm()
return return
} }
that.setData({
isSubmit: true
})
wx.lin.showToast({ wx.lin.showToast({
icon: 'loading', icon: 'loading',
...@@ -191,7 +196,8 @@ Page({ ...@@ -191,7 +196,8 @@ Page({
}, },
success: function(res) { success: function(res) {
that.setData({ that.setData({
appointmentComplete: true appointmentComplete: true,
isSubmit: false
}) })
wx.lin.hideToast() wx.lin.hideToast()
}, },
...@@ -200,6 +206,9 @@ Page({ ...@@ -200,6 +206,9 @@ Page({
icon: 'error', icon: 'error',
title: err.msg, title: err.msg,
}) })
that.setData({
isSubmit: false
})
} }
}) })
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
</view> </view>
<view class="appointment-operation"> <view class="appointment-operation">
<button class="{{isSubmit ? 'button' : 'button-disable'}} row con-c align-c" bindtap="onSubmit">确认预约</button> <button class="{{canSubmit ? 'button' : 'button-disable'}} row con-c align-c" bindtap="onSubmit">确认预约</button>
<button class="button-plain row con-c align-c" bindtap="onServic">电话咨询</button> <button class="button-plain row con-c align-c" bindtap="onServic">电话咨询</button>
</view> </view>
</view> </view>
...@@ -159,6 +159,6 @@ ...@@ -159,6 +159,6 @@
</view> </view>
<view class="appointment-operation"> <view class="appointment-operation">
<button class="{{isSubmit ? 'button' : 'button-disable'}} row con-c align-c" bindtap="onSubmit">确认预约</button> <button class="{{canSubmit ? 'button' : 'button-disable'}} row con-c align-c" bindtap="onSubmit">确认预约</button>
</view> </view>
</view> </view>
\ No newline at end of file
...@@ -16,13 +16,18 @@ Page({ ...@@ -16,13 +16,18 @@ Page({
height:0, height:0,
data:[], data:[],
active:0, active:0,
pageNo: 1,
pageSize: 10,
loading: false,
moreData: true,
}, },
chageNav(e){ chageNav(e){
let index = e.currentTarget.dataset.index let index = e.currentTarget.dataset.index
this.setData({ this.setData({
active: index active: index,
pageNo: 1,
}) })
this.getMyActivityList(index) this.getMyActivityList()
}, },
activityDetail(e){ activityDetail(e){
wx.navigateTo({ wx.navigateTo({
...@@ -36,7 +41,7 @@ Page({ ...@@ -36,7 +41,7 @@ Page({
this.setData({ this.setData({
height: wx.getSystemInfoSync().windowHeight, //获取屏幕的高度 height: wx.getSystemInfoSync().windowHeight, //获取屏幕的高度
}) })
this.getMyActivityList(this.data.active) this.getMyActivityList()
}, },
/** /**
...@@ -89,9 +94,9 @@ Page({ ...@@ -89,9 +94,9 @@ Page({
}, },
// 我的活动 // 我的活动
getMyActivityList(index) { getMyActivityList() {
let state = '' let state = ''
switch (index) { switch (Number(this.data.active)) {
case 0: state = ''; break; case 0: state = ''; break;
case 1: state = 0; break; case 1: state = 0; break;
case 2: state = 1; break; case 2: state = 1; break;
...@@ -100,9 +105,12 @@ Page({ ...@@ -100,9 +105,12 @@ Page({
var that = this var that = this
app.login({ app.login({
success: function() { success: function() {
that.setData({
loading: true
})
app.wxRequest({ app.wxRequest({
url: '/api/v1/activity/getMyActivityList', url: '/api/v1/activity/getMyActivityList',
data: { activeState: state, pageSize: 10, pageNo: 1 }, data: { activeState: state, pageSize: that.data.pageSize, pageNo: that.data.pageNo },
success: function(res) { success: function(res) {
let list = res.data.list let list = res.data.list
let tmpArr = [] let tmpArr = []
...@@ -124,13 +132,33 @@ Page({ ...@@ -124,13 +132,33 @@ Page({
} }
tmpArr.push(obj) tmpArr.push(obj)
}) })
if (that.data.pageNo != 1) {
tmpArr = that.data.data.concat(tmpArr)
}
that.setData({
data: tmpArr,
loading: false,
})
that.setData({ that.setData({
data: tmpArr moreData: (that.data.data.length >= res.data.count*1) ? false: true
})
},
fail: function(err) {
that.setData({
loading: false
}) })
} }
}) })
} }
}) })
},
},
onReachBottom: function() {
if (this.data.loading || !this.data.moreData) {
return
}
this.data.pageNo += 1
this.getMyActivityList()
},
}) })
\ No newline at end of file
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</l-list> </l-list>
<l-list is-hover="{{false}}" l-content-class="menu-title" title="姓名" is-link="{{false}}"> <l-list is-hover="{{false}}" l-content-class="menu-title" title="姓名" is-link="{{false}}">
<view slot="right-section"> <view slot="right-section">
<input style="text-align:right;" placeholder="请填写姓名" placeholder-class="phone" value="{{nickName}}" data-type="name" bindblur="onInputBlur"/> <input maxlength="10" style="text-align:right;" placeholder="请填写姓名" placeholder-class="phone" value="{{nickName}}" data-type="name" bindblur="onInputBlur"/>
</view> </view>
</l-list> </l-list>
<l-list is-hover="{{false}}" l-content-class="menu-title" title="性别" is-link="{{false}}"> <l-list is-hover="{{false}}" l-content-class="menu-title" title="性别" is-link="{{false}}">
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</l-list> </l-list>
<l-list is-hover="{{false}}" l-content-class="menu-title" title="地址" is-link="{{false}}"> <l-list is-hover="{{false}}" l-content-class="menu-title" title="地址" is-link="{{false}}">
<view slot="right-section"> <view slot="right-section">
<input style="text-align:right;" placeholder="请填写地址" placeholder-class="phone" value="{{address}}" data-type="address" bindblur="onInputBlur"/> <input maxlength="30" style="text-align:right;" placeholder="请填写地址" placeholder-class="phone" value="{{address}}" data-type="address" bindblur="onInputBlur"/>
</view> </view>
</l-list> </l-list>
<l-list is-hover="{{false}}" l-content-class="menu-title" title="手机号" is-link="{{false}}"> <l-list is-hover="{{false}}" l-content-class="menu-title" title="手机号" is-link="{{false}}">
......
...@@ -240,7 +240,7 @@ Page({ ...@@ -240,7 +240,7 @@ Page({
url: '/api/v1/activity/getList', url: '/api/v1/activity/getList',
data: { data: {
listType: type, listType: type,
pageSize: 20, pageSize: 10,
pageNo: 1, pageNo: 1,
tagId: '3c95ab1afb3a4d899ac25242c3d089ea', tagId: '3c95ab1afb3a4d899ac25242c3d089ea',
}, },
......
...@@ -155,6 +155,41 @@ Page({ ...@@ -155,6 +155,41 @@ Page({
}) })
}, },
shopDetail(e) {
let datasetId = e.currentTarget.dataset.id
let id = ''
if (datasetId == '21a0cbbd39604380bc46fba38ac5fb63') {
// 海错图展馆
id = 1
} else if (datasetId == 'b8f04379bf164b7f8bca69be14146a17') {
// 拾光花坊
id = 2
} else if (datasetId == 'd8922a8f759245d4949b62693099edb5') {
// 元养水韵SPA馆
id = 3
} else if (datasetId == 'd0e5ff414f794e15bc33c4e11f5356a8') {
// 原味舒食
id = 4
} else if (datasetId == '81078c007c034d46b7dfe59935d84f7a') {
// 原野MOJITO
id = 5
} else if (datasetId == '29e79743f0f94e5eb726e0ebdfe64248') {
// 星空影院
id = 6
} else if (datasetId == '559d980e9eaf4459883fb3a556d24347') {
// 儿童营地信息
} else if (datasetId == 'c0a2d795a7a54dcd9459dd1b969c1771') {
// 住宿信息
}
if (id != '') {
wx.navigateTo({
url: '/pages/shop-detail/shop-detail?id=' + id
})
}
},
// 攻略详情文中提及 // 攻略详情文中提及
getParksByParkIds(parkIds) { getParksByParkIds(parkIds) {
if (!parkIds) { if (!parkIds) {
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<text>文中提及</text> <text>文中提及</text>
</view> </view>
<block wx:for="{{relation}}" wx:for-index="index" wx:for-item="item" wx:key="index"> <block wx:for="{{relation}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="relation-item row con-b"> <view class="relation-item row con-b" data-id="{{item.id}}" bindtap="shopDetail">
<image mode="widthFix" src="{{item.cover}}"></image> <image mode="widthFix" src="{{item.cover}}"></image>
<view class="relation-item-info col"> <view class="relation-item-info col">
<text>{{item.title}}</text> <text>{{item.title}}</text>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment