ljc 5 lat temu
rodzic
commit
a3fec9ac01
3 zmienionych plików z 51 dodań i 9 usunięć
  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 Wyświetl plik

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

+ 0
- 1
laomenkuang_project/pages/index/index.js Wyświetl plik

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

+ 47
- 5
laomenkuang_project/pages/register/register.js Wyświetl plik

icon: 'success', icon: 'success',
duration: 500 duration: 500
}) })
}else{
wx.showToast({
title: e.message,
icon: 'none',
duration: 500
})
} }
}, this) }, this)
}, },
sendTouch:function(){//发送验证码 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({ wx.showToast({
title: '手机号错误', title: '手机号错误',
icon: 'none', icon: 'none',
duration: 500 duration: 500
}) })
return;
}
}else{
wx.showToast({
title: '请先输入手机号',
icon: 'none',
duration: 500
})
return; return;
}
}
this.setData({ this.setData({
yesSend: true, yesSend: true,
}) })
if (this.data.yesRegister){ if (this.data.yesRegister){
return; 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 => { app.wxRequest(app.globalData.httpUrl + 'register', { user_phone: this.data.phone, code_num: this.data.phoneCode }, e => {
console.log(e) console.log(e)
this.data.yesRegister = true;
if (e.code == 200) { if (e.code == 200) {
clearInterval(time); clearInterval(time);
app.globalData.userInfo = e.data.user_phone app.globalData.userInfo = e.data.user_phone
this.data.yesRegister = false;
this.setData({ this.setData({
minter: 60, minter: 60,
num: 60 num: 60
}) })
} }
}, 1000) }, 1000)
}else{
} else {
this.data.yesRegister = false;
wx.showToast({ wx.showToast({
title: e.message, title: e.message,
icon:"none",
duration:500 duration:500
}) })
} }

Ładowanie…
Anuluj
Zapisz