wx.miniapp.bindPhone(Object object)

iOS >= 1.0.9,Android >= 1.0.5

在系统登录态生效期间,调用接口绑定手机号。

前置准备

使用 buttonopen in new window 组件指定 open-typesms-type 触发接口向用户发送短信验证码。

参数

Object object

属性类型默认值必填说明
phoneNumberstring手机号
verifyCodestring验证码: 6位纯数字组成的字符串
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数
completefunction接口调用结束的回调函数

object.fail 回调函数

参数
Object res
属性类型说明
errCodenumber错误码。0:请求成功
errMsgstring错误提示

res.errCode

errCode说明
-1system error
10001011系统登录态无效
10001006验证码错误
10001023手机号已存在, 绑定失败
-700000前端错误,errMsg 将给出详细提示

示例代码

wx.miniapp.bindPhone({
	phoneNumber: 'xxx', // 手机号
	verifyCode: 'xxx', // 验证码
	success(res) {
		// 绑定成功	
	}
})