下载地址:https://ext.dcloud.net.cn/plugin?id=4773
极光短信sdk,支持短信和语音短信,可用于验证码,系统通知,营销推广,极光推送补充
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-DWAENMgh-1618893531451)(https://doc.youyacao.com/server/index.php?s=/api/attachment/visitFile/sign/4c96c2a48609df62a411f3c5a5ef36ea)]
使用方法:
请直接下载实例文件
<template>
<view>
<view class="uni-padding-wrap uni-common-mt">
<button @tap="initSdk()">initSdk</button>
<button @tap="setIntervalTime()">setIntervalTime</button>
<button @tap="getIntervalTime()">getIntervalTime</button>
<button @tap="getSmsCodeAsyn()">getSmsCodeAsyn</button>
<button @tap="getVoiceCode()">getVoiceCode</button>
<button @tap="checkSmsCodeAsyn()">checkSmsCodeAsyn</button>
</view>
</view>
</template>
<script>
const Jsms = uni.requireNativePlugin(\'youyacao-Jsms\');
export default {
data() {
return {
title: \'Hello\'
}
},
onLoad() {
},
methods: {
initSdk()
{
Jsms.initSdk({ }, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
setIntervalTime()
{
Jsms.setIntervalTime({
IntervalTime:60000 //60秒
}, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
getIntervalTime()
{
Jsms.getIntervalTime({ }, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
getSmsCodeAsyn()
{
Jsms.getSmsCodeAsyn({
phone:"15159292131",
tempId:"1"
}, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
getVoiceCode()
{
Jsms.getVoiceCode({
phone:"15159292131"
}, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
checkSmsCodeAsyn()
{
Jsms.checkSmsCodeAsyn({
phone:"15159292131",
code:"123456"
}, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200upx;
width: 200upx;
margin-top: 200upx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50upx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36upx;
color: #8f8f94;
}
</style>