Hbuilder给手机发送短信与拨打电话


        前言:业务场景 需要给手机号码拨打电话与发送短信。html5已经提供接口。

        

methods: {
                    Call: function() {
                        var that = this;
                        if(that.ptel == "暂无") {
                            return;
                        }
                        mui.confirm('您确定要给' + that.name + '打电话吗?', ' ', ['确认', '取消'], function(result) {
                            if(result.index == 0) {
                                plus.device.dial(that.phone, false);
                            }
                        },'div')
                    },
                    Message: function() {
                        var that = this;
                        if(that.ptel == "暂无") {
                            return;
                        }
                        mui.confirm('您确定要给' + that.name + '发送短信吗?', ' ', ['确认', '取消'], function(result) {
                            if(result.index == 0) {
                                var msg = plus.messaging.createMessage(plus.messaging.TYPE_SMS);
                                msg.to = [that.phone];
                                msg.body = '';
                                plus.messaging.sendMessage(msg);
                            }
                        },'div')
                    }
                }

        

        结语:Html5+提供许多的接口。官方文档地址: http://www.html5plus.org/doc/h5p.html 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM