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.
63 lines
1.4 KiB
63 lines
1.4 KiB
import { HTTP, Method, HTTPConst } from '../utils/http.js'
|
|
|
|
const AuthConst = {
|
|
check_register_url: '/api/miniuser/isRegister',
|
|
mobile_code_url: '/api/miniuser/getSmsCode', // 获取验证码
|
|
verify_update_phone_url: '/api/miniuser/updateMiniUser' // mobile 验证
|
|
}
|
|
class AuthModel extends HTTP {
|
|
constructor() {
|
|
super()
|
|
}
|
|
// 获取短信验证码
|
|
getMsgCode (phone, success) {
|
|
let params = {
|
|
url: AuthConst.mobile_code_url,
|
|
method: Method.GET,
|
|
data: {
|
|
phone: phone,
|
|
},
|
|
success: (data)=> {
|
|
wx.showToast({
|
|
title: '短信验证码已发送!',
|
|
icon: 'none'
|
|
})
|
|
success(data)
|
|
}
|
|
}
|
|
this.request(params)
|
|
}
|
|
checkRegister (success) {
|
|
let params = {
|
|
url: AuthConst.check_register_url,
|
|
method: Method.POST,
|
|
success: success,
|
|
}
|
|
this.request(params)
|
|
}
|
|
// 提交验证和注册
|
|
mobileRegister (phone, name, vscode, success) {
|
|
let params = {
|
|
url: AuthConst.verify_update_phone_url,
|
|
method: Method.POST,
|
|
data: {
|
|
code: res
|
|
},
|
|
success: (data) => {
|
|
console.log(data)
|
|
if (data) {
|
|
success(data)
|
|
} else {
|
|
wx.showToast({
|
|
title: '注册失败',
|
|
icon: 'none'
|
|
})
|
|
console.log('注册失败')
|
|
}
|
|
}
|
|
}
|
|
this.request(params)
|
|
}
|
|
}
|
|
|
|
export { AuthModel }
|