epmet 工作端 小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
2.6 KiB

2 years ago
// pages/register/register.js
import {userLoginlog} from "../../utils/api"
Page({
/**
* 页面的初始数据
*/
data: {
formData:{
mobile:'',
password:'',
appId:'wxaf87b420b87e2d79'
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
handelBlurMobile(e){
this.setData({
'formData.mobile': e.detail.value
})
console.log(this.data.formData)
},
handelBlurPassword(e){
this.setData({
'formData.password': e.detail.value
})
console.log(this.data.formData)
},
handelClickSubmit(){
if(!this.data.formData.mobile){
wx.showToast({
title: '请填写手机号',
icon:'none',
duration:3000
})
return
}
if(!this.data.formData.password){
wx.showToast({
title: '请输入密码',
icon:'none',
duration:3000
})
return
}
wx.showLoading({
title:"登录中..."
})
const parm = {
wxCode :'',
...this.data.formData
}
wx.login({
success: (res) => {
parm.wxCode = res.code
userLoginlog(parm).then((res)=>{
wx.hideLoading()
console.log(res);
if(res.code == 0){
wx.switchTab({
url: '/pages/work/work',
})
}else{
wx.showToast({
title: res.msg,
icon:'none',
duration:2000
})
}
}).catch(err=>{
wx.hideLoading()
console.log(err);
})
},
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})