短信发送确认通用组件
针对一信通平台短信发送确认的通用组件
安装
npm i --save flag-ui-sendconfirm
依赖
1. vue
2. element-ui
3. vue的prototype上需要注入$http(axios)提供接口调用
使用说明
引入
import sendConfirm from 'flag-ui-sendconfirm'
组件概况
组件参数说明
传入参数 | 类型 | 是否必填 | 默认 | 说明 |
---|---|---|---|---|
urls |
Object | 是 | null | 发送接口的地址。详见下述样例。 |
params |
Object | 是 | null | 发送参数,包含发送信息,接收者 |
详细参数说明
{
//接口url地址
urls: {
trySend: '/try-send', //获取发送反馈信息
send: '/send', //发送
noticeSubExt: '/notice/sub-extend/get', //通知子扩展接入号获取
noticeAdd: '/notice/add' //通知新增
},
//输入的发送参数
params: {
appId: SMS_APP_ID,//业务应用ID
productId:1, //产品ID
mediaId: '',//素材ID
mediaType: '',
scheduleTime: '',//预约发送时间
sendObject: { //发送对象
contactsExcludeList: [], //排除的通讯录组列表
contactsGroupList: [], //要发送的通讯录组列表
mdn: '',//手机号码
mdnFile: '',//号码文件地址
rmRepeat: 1 //是否去处重复发送对象:1 是 0 否
},
sendSource: '', //1 平台 2 接口
sendType: '1', //发送类型:1 立即发送 2 预约发送
signPosition: '1', //0 签名前置 1 签名后置
text: 'test msg content', //短信文本
textTemplateId: "0", //模板ID
"effectTime": "", //生效时间
"expireTime": "", //失效时间
"name": "", //通知名称
"allSubmitMdn": "", //总提交人数
"allSubmitNum": "" //总提交条数
"subExtend": "", //子扩展号
"isResend": false //是否一键重发
}
}
传出参数说明
无
组件事件说明
事件 | 说明 |
---|---|
back | 用户点击上一步时,触发此事件 |
success | 用户发送成功之后,触发此事件 |
示例
<template>
<send-confirm :urls="urls" :params="params" @success="onSuccess"
@back="onBack"></send-confirm>
</template>
<script type="text/ecmascript-6">
import sendConfirm from './sendConfirm.vue';
//短信appid
const SMS_APP_ID = "16011210241410005432";
export default {
data() {
return {
urls: {
trySend: '/try-send',
send: '/send',
noticeSubExt: '/notice/sub-extend/get',
noticeAdd: '/notice/add'
},
params: {} /*{
appId: SMS_APP_ID,
mediaId: '',
mediaType: '',
scheduleTime: '',
sendObject: {
contactsExcludeList: [],
contactsGroupList: [],
mdn: '',
mdnFile: '',
rmRepeat: 1
},
sendSource: '',
sendType: '1',
signPosition: '1',
text: 'test msg content',
textTemplateId: "0",
subExtend: "",
isResend: false
}*/
}
},
components: {sendConfirm},
methods: {
onSuccess() {
this.$router.push('/')
},
onBack() {
history.back();
}
},
beforeRouteEnter(to, from, next) {
next(vm => {
if (to.meta.data) {
//keep-alive时,替换params属性,以触发子组件的重新加载
vm.params = JSON.parse(JSON.stringify(to.meta.data));
}
})
}
}
</script>
组件变更记录
- 2017-09-25 success事件回调参数:{trySendRes,sendRes}