getPhoneNumber requires verified enterprise miniprogram account. Allow users to skip phone auth and complete registration without it.
34 行
826 B
JavaScript
34 行
826 B
JavaScript
var app = getApp()
|
|
|
|
Page({
|
|
data: {
|
|
statusBarHeight: 44,
|
|
loading: false
|
|
},
|
|
|
|
onLoad: function () {
|
|
this.setData({ statusBarHeight: app.globalData.statusBarHeight })
|
|
},
|
|
|
|
onLogin: function () {
|
|
var self = this
|
|
self.setData({ loading: true })
|
|
|
|
app.doLogin().then(function (data) {
|
|
self.setData({ loading: false })
|
|
if (data && data.is_new_user) {
|
|
wx.redirectTo({ url: '/pages/register/register' })
|
|
} else {
|
|
wx.switchTab({ url: '/pages/index/index' })
|
|
}
|
|
}).catch(function (err) {
|
|
self.setData({ loading: false })
|
|
wx.showToast({ title: err.message || '登录失败', icon: 'none' })
|
|
})
|
|
},
|
|
|
|
onAgreement: function () {
|
|
wx.showModal({ title: '提示', content: '用户协议和隐私政策内容建设中', showCancel: false })
|
|
}
|
|
})
|