v3.0.6
This commit is contained in:
47
source/wx/xzs-student/pages/user/bind/index.js
Normal file
47
source/wx/xzs-student/pages/user/bind/index.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const app = getApp()
|
||||
Page({
|
||||
data: {
|
||||
spinShow: false,
|
||||
userName: '',
|
||||
password: '',
|
||||
},
|
||||
formSubmit: function(e) {
|
||||
let _this = this
|
||||
_this.setData({
|
||||
spinShow: true
|
||||
});
|
||||
wx.login({
|
||||
success(wxres) {
|
||||
if (wxres.code) {
|
||||
e.detail.value.code = wxres.code
|
||||
app.formPost('/api/wx/student/auth/bind', e.detail.value)
|
||||
.then(res => {
|
||||
_this.setData({
|
||||
spinShow: false
|
||||
});
|
||||
if (res.code == 1) {
|
||||
wx.setStorageSync('token', res.response)
|
||||
wx.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
});
|
||||
} else {
|
||||
app.message(res.message, 'error')
|
||||
}
|
||||
}).catch(e => {
|
||||
_this.setData({
|
||||
spinShow: false
|
||||
});
|
||||
app.message(e, 'error')
|
||||
})
|
||||
} else {
|
||||
app.message(res.errMsg, 'error')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
register: function(e) {
|
||||
wx.navigateTo({
|
||||
url: "../register/index"
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user