- loadProfile() now returns Promise (was missing return) - Avatar upload via COS instead of storing WeChat temp path - Add POST /user/avatar endpoint with multer + COS SDK - Incomplete registration detection: redirect to register if phone is empty
34 行
872 B
JavaScript
34 行
872 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 || !data.user_info || !data.user_info.phone)) {
|
|
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 })
|
|
}
|
|
})
|