mob android 短信验证,Mob短信验证码插件使用说明

欢迎使用Mob短信验证码插件

插件地址:

https://ext.dcloud.net.cn/plugin?id=399

MobSms实现了注册时短信验证,取回密码手机验证功能,使用此模块之前需要先去http://mob.com/ 注册获取MOBAppKey和MOBAppSecret,mob每天可以有10000条免费的短信,基本上可以算是免费的了

使用注意事项: 1、请在云端打包!请在云端打包!请在云端打包!(重要的事说三遍) 2、短信中的掌淘科技可以去除,具体请咨询mob官方 3、老给一个手机号发短信会导致失败率很高,这个是运营商为了防骚扰做的

使用Mob短信验证码插件

1. 配置插件[^code]

将相应的MOBAppKey和MOBAppSecret填写到APP原生插件配置里

ac6437e45b461a34eaf99b0a35a27eca.png

1. 注册插件[^code]

const mobsms = uni.requireNativePlugin('HY-MobSms');

2. 发送验证码[^code]

// 请求验证码,其中country表示国家代码,如“86”;phone表示手机号码,如“13800138000”

//成功

mobsms.sendSms({country:'86',phone:this.phone},result=>{

console.log(JSON.stringify(result))

if(result.code==1){

uni.showToast({

title: "发送成功",

icon: "success"

})

}else{

uni.showToast({

title: "发送失败",

icon: "none"

})

//失败会返回错误码 //错误码对应查看地址:[http://wiki.mob.com/android-api-%E9%94%99%E8%AF%AF%E7%A0%81%E5%8F%82%E8%80%83/][3]

//const status= result.status

})

1. 验证验证码[^code]

mobsms.verify({country:'86',phone:this.mobile.phone,code:this.mobile.code},result=>{

console.log(JSON.stringify(result))

if(result.code==1){

uni.showToast({

title: "验证成功",

icon: "success"

})

}else{

uni.showToast({

title: "验证失败",

icon: "none"

})

//失败会返回错误码

//错误码对应查看地址:[http://wiki.mob.com/android-api-%E9%94%99%E8%AF%AF%E7%A0%81%E5%8F%82%E8%80%83/][4]

//const status= result.status

}

})

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值