ljc 5 лет назад
Родитель
Сommit
a3fec9ac01
3 измененных файлов: 51 добавлений и 9 удалений
  1. +4
    -3
      laomenkuang_project/app.js
  2. +0
    -1
      laomenkuang_project/pages/index/index.js
  3. +47
    -5
      laomenkuang_project/pages/register/register.js

+ 4
- 3
laomenkuang_project/app.js Просмотреть файл

@@ -77,6 +77,9 @@ App({
// }
// })
},
onShow:function(){
this.getUserType();
},
getUserType: function () {//获取用户注册状态
console.log(this.globalData.openId)
this.wxRequest(this.globalData.httpUrl + 'getinfo',{},e=>{
@@ -88,9 +91,7 @@ App({
} else if (e.code == 202){//已注册
this.globalData.userInfo = e.data;
if (this.globalData.present_id){
wx.reLaunch({
url: '/pages/receiveTicket/receiveTicket?shareId=' + this.globalData.present_id + "&number=" + this.globalData.number
})
} else {
wx.switchTab({
url: '/pages/index/index'

+ 0
- 1
laomenkuang_project/pages/index/index.js Просмотреть файл

@@ -13,7 +13,6 @@ Page({
}else{
app.globalData.openidSuccessFuc = this.getDataList;
}
},
getDataList:function(){
app.wxRequest(app.globalData.httpUrl + 'couponsell/list', {}, e => {

+ 47
- 5
laomenkuang_project/pages/register/register.js Просмотреть файл

@@ -83,18 +83,34 @@ Page({
icon: 'success',
duration: 500
})
}else{
wx.showToast({
title: e.message,
icon: 'none',
duration: 500
})
}
}, this)
},
sendTouch:function(){//发送验证码
if (!(/^1[3456789]\d{9}$/.test(this.data.phone))) {
if (this.data.phone){
if (!(/^1[3456789]\d{9}$/.test(this.data.phone))) {
wx.showToast({
title: '手机号错误',
icon: 'none',
duration: 500
})
return;
}
}else{
wx.showToast({
title: '请先输入手机号',
icon: 'none',
duration: 500
})
return;
}
}
this.setData({
yesSend: true,
})
@@ -141,13 +157,37 @@ Page({
if (this.data.yesRegister){
return;
}
this.data.yesRegister = true;
if(this.data.phone){
if (!(/^1[3456789]\d{9}$/.test(this.data.phone))) {
wx.showToast({
title: '手机号错误',
icon: 'none',
duration: 500
})
return;
}
}else{
wx.showToast({
title: '请先输入手机号',
icon: 'none',
duration: 500
})
return;
}
if (!this.data.phoneCode){
wx.showToast({
title: '请先输入验证码',
icon: 'none',
duration: 500
})
return;
}
app.wxRequest(app.globalData.httpUrl + 'register', { user_phone: this.data.phone, code_num: this.data.phoneCode }, e => {
console.log(e)
this.data.yesRegister = true;
if (e.code == 200) {
clearInterval(time);
app.globalData.userInfo = e.data.user_phone
this.data.yesRegister = false;
this.setData({
minter: 60,
num: 60
@@ -168,9 +208,11 @@ Page({
})
}
}, 1000)
}else{
} else {
this.data.yesRegister = false;
wx.showToast({
title: e.message,
icon:"none",
duration:500
})
}

Загрузка…
Отмена
Сохранить