Bläddra i källkod

防止重复点击

guessPrice
zhanghaojie 5 år sedan
förälder
incheckning
5de2163203
6 ändrade filer med 63 tillägg och 15 borttagningar
  1. +18
    -2
      496_dongfengqichen/pages/scout/register/register.js
  2. +3
    -2
      496_dongfengqichen/pages/scout/register/register.wxml
  3. +15
    -1
      496_dongfengqichen/pages/scout/scout.js
  4. +1
    -3
      496_dongfengqichen/pages/scout/scout.wxml
  5. +3
    -3
      496_dongfengqichen/pages/scout/scout.wxss
  6. +23
    -4
      496_dongfengqichen/pages/star/star.js

+ 18
- 2
496_dongfengqichen/pages/scout/register/register.js Visa fil

@@ -23,6 +23,7 @@ Page({
getphone:"",//手机号
maskShow: false,
mydata:[],//我的数据
isbtn:true,//防重复点击
},
/**
* 切换车主非车主
@@ -52,15 +53,23 @@ Page({
}else if (!res) {
wx.showToast({icon:'none',title: '图形验证码错误'})
}else{
if(this.data.isbtn){
this.setData({isbtn: false})
}else{
return;
}
app.wxRequest(app.globalData.urlRoot + "userInfo/certificationCar", {carInfo:e.detail.value.VIN}, res => {
console.log(res)
if (res.code == 200) {
if(res.data!=null){
app.globalData.certificationState=res.data.certificationState;
wx.navigateTo({url: '../scout/scout'})
}else{
this.setData({isbtn: true})
wx.showToast({icon:'none',title: '认证失败'})
}
}else{
this.setData({isbtn: true})
wx.showToast({icon:'none',title: ''+res.msg})
}
}, this,"POST");
@@ -82,6 +91,11 @@ Page({
}else if(!this.data.agree){
wx.showToast({icon:'none',title: '请阅读并同意协议内容'})
}else{
if(this.data.isbtn){
this.setData({isbtn: false})
}else{
return;
}
app.wxRequest(app.globalData.urlRoot + "userInfo/submitCertificationNoCarInfo", {
mobile:e.detail.value.phone,
captcha:e.detail.value.code,
@@ -95,6 +109,7 @@ Page({
if (res.code == 200) {
this.setData({maskShow:true})
}else{
this.setData({isbtn: true})
wx.showToast({icon:'none',title: ''+res.msg})
}
}, this,"POST");
@@ -312,6 +327,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.setData({isbtn: true})
this.getshow();
},
getshow(){
@@ -319,7 +335,7 @@ Page({
console.log(res)
if(res.code=200 && res.data){
if(res.data.adminState==1){//审核通过
wx.navigateTo({url: '../../star/star'})
wx.navigateTo({url: '../../scout/scout'})
}else if(res.data.adminState==0 || res.data.adminState==-1){//审核中&审核失败
if(res.data.adminState==0){
this.setData({maskShow:true})
@@ -390,6 +406,6 @@ Page({
* 用户点击右上角分享
*/
onShareAppMessage: function() {
return app.sharePack();
}
})

+ 3
- 2
496_dongfengqichen/pages/scout/register/register.wxml Visa fil

@@ -2,8 +2,9 @@
<view class="showView">
<view class="registerContainer">
<view class="tabsBox">
<view class="item {{type==1?'select':''}}" data-type="1" bindtap="changeType">车主</view>
<view class="item {{type==0?'select':''}}" data-type="0" bindtap="changeType">非车主</view>
<view class="item {{type==1?'select':''}}" data-type="1" bindtap="changeType" style="border-top-left-radius: 8rpx;border-bottom-left-radius: 8rpx;">车主</view>
<view class="item {{type==0?'select':''}}" data-type="0" bindtap="changeType"
style="border-top-right-radius: 8rpx;border-bottom-right-radius: 8rpx;">非车主</view>
</view>
<view class="welcome">欢迎加入星探计划</view>
<form bindsubmit="formSubmit1" wx:if="{{type==1}}">

+ 15
- 1
496_dongfengqichen/pages/scout/scout.js Visa fil

@@ -16,6 +16,7 @@ Page({
nickName: null,
userLevel: 0
},
isbtn:true,//防重复点击
},
/**
* 关闭提示弹窗
@@ -28,6 +29,11 @@ Page({
},
getUserWxMsg:function(e){//通过微信获取用户信息
if (e.detail.errMsg == "getUserInfo:ok") {
if(this.data.isbtn){
this.setData({isbtn: false})
}else{
return;
}
this.data.userData.avatarUrl = e.detail.userInfo.avatarUrl;
this.data.userData.nickName = e.detail.userInfo.nickName;
this.data.userData.userLevel = 0;
@@ -45,6 +51,11 @@ Page({
}
},
getUserInfo:function(e){//获取个人信息
if(this.data.isbtn){
this.setData({isbtn: false})
}else{
return;
}
app.wxRequest(app.globalData.urlRoot + 'userInfo/getUserInfo', {}, res => {
if(res.code==200){
// res.data.userLevel = 3;
@@ -62,6 +73,8 @@ Page({
url:'../poster/poster'
})
}
}else{
this.setData({isbtn: true})
}
},this)
},
@@ -104,6 +117,7 @@ Page({
}else{
this.setData({iconShow:false})
}
this.setData({isbtn: true})
// wx.navigateTo({
// url: './share/share'
// })
@@ -141,6 +155,6 @@ Page({
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return app.sharePack();
}
})

+ 1
- 3
496_dongfengqichen/pages/scout/scout.wxml Visa fil

@@ -3,10 +3,8 @@
<view class="content">
<image class="bg" src="{{imgUrl+'/star/scout/bg.jpg'}}"></image>
<image class="reward" src="{{imgUrl+'/star/scout/reward.png'}}"></image>
<view class="btn" bindtap="getPoster">立即分享,赚取奖励
<view class="btn" bindtap="getPoster">立即分享,赚取奖励</view>
<button class="btn2" wx:if="{{iconShow}}" open-type="getUserInfo" bindgetuserinfo="getUserWxMsg"></button>
</view>
</view>
<view class="mask" wx:if="{{maskShow}}">
<view class="tipContent" wx:if="{{tipShow}}">

+ 3
- 3
496_dongfengqichen/pages/scout/scout.wxss Visa fil

@@ -30,10 +30,10 @@
}
.btn2{
text-align: center;
width: 100%;
height: 100%;
width: 654rpx;
height: 58rpx;
background-color: #2a558d;
margin: -58rpx auto 0rpx auto;
margin: -110rpx auto 35rpx auto;
opacity:0;
}
.mask {

+ 23
- 4
496_dongfengqichen/pages/star/star.js Visa fil

@@ -14,6 +14,7 @@ Page({
starNumber:4000,//开始人数
stopNumber:0,//结束人数
numList:[4,0,0,0],
isbtn:true,//防重复点击
},
/**
* 显示规则页
@@ -37,14 +38,22 @@ Page({
* 每日任务
*/
everyDay:function(){
wx.navigateTo({
url:'../everyday/everyday'
})
if(this.data.isbtn){
this.setData({isbtn: false})
}else{
return;
}
wx.navigateTo({url:'../everyday/everyday'})
},
/**
* 星探任务
*/
scout:function(){
if(this.data.isbtn){
this.setData({isbtn: false})
}else{
return;
}
this.phonebolb(app.globalData.userMobile);
},
phonebolb:function(_phone){
@@ -61,6 +70,8 @@ Page({
url: '../scout/register/register'
})
}
}else{
this.setData({isbtn: true})
}
}, this);
},
@@ -132,6 +143,11 @@ Page({
getPhone (e) {
console.log(e.detail)
if (e.detail.errMsg=='getPhoneNumber:ok'){
if(this.data.isbtn){
this.setData({isbtn: false})
}else{
return;
}
app.wxRequest(app.globalData.urlRoot + "userInfo/getUserPhoneNumber", { encryptedData: e.detail.encryptedData, iv: e.detail.iv }, res => {
console.log(res)
if (res.code == 200) {
@@ -139,9 +155,11 @@ Page({
this.phonebolb(res.data.decodeData.phoneNumber);
app.globalData.userMobile=res.data.decodeData.phoneNumber;
}else{
this.setData({isbtn: true})
wx.showToast({title: '获取失败',icon: "none"})
}
} else {
this.setData({isbtn: true})
wx.showToast({title: res.msg,icon: "none"})
}
}, this,"POST");
@@ -158,6 +176,7 @@ Page({
}else{
this.setData({phonebol: false})
}
this.setData({isbtn: true})
},

/**
@@ -192,6 +211,6 @@ Page({
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return app.sharePack();
}
})

Laddar…
Avbryt
Spara