开发者社区> 问答> 正文

扫码功能无反应

求助,写了个简单的调用扫描组件的例子,很奇怪能够扫描但是不能到达onSuccess方法,然后用开发版钉钉就一直在扫描界面,无法扫出二维码。有没有前辈碰到过这种情况?
代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="JsAPI.aspx.cs" Inherits="Enterprise_JsAPI" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">

    <title>Ding</title>
    <script type="text/javascript" src="http://g.alicdn.com/ilw/ding/0.5.1/scripts/dingtalk.js"></script>
    <script src="http://g.alicdn.com/ilw/cdnjs/zepto/1.1.6/zepto.min.js"></script>

    <script type="text/javascript">

        var _config = {
            agentId: '<%=agentId%>',
            corpId: '<%=corpId%>',
            timeStamp: '<%=timestamp%>',
            nonce: '<%=nonceStr%>',
            signature: '<%=signature%>'
        };

        dd.config({
            agentId: _config.agentId,
            corpId: _config.corpId,
            timeStamp: _config.timeStamp,
            nonceStr: _config.nonce,
            signature: _config.signature,
            jsApiList: [
            'runtime.info',
            'device.notification.prompt',
            'biz.chat.pickConversation',
            'device.notification.confirm',
            'device.notification.alert',
            'device.notification.prompt',
            'biz.chat.open',
            'biz.util.open',
            'biz.user.get',
            'biz.contact.choose',
            'biz.telephone.call',
            'biz.ding.post',
            'biz.util.scan'
            ]
        });



        dd.ready(function () {
            $('#scanCode').on('click', function () {
                alert("start scan");
                dd.biz.util.scan({
                    type: "qrCode",//type为qrCode或者barCode
                    onSuccess: function (data) {
                        alert(JSON.stringify(data));
                        //alert("条形码内容为:"+data.text);
                        $("#scanCodeResult").val(data.text);
                    },
                    onFail: function (err) {
                        alert(err);
                    }
                });
            });
        });
    </script>


</head>
<body>
    <form id="form1" runat="server">
        <div>
          
            <button id="scanCode">扫一扫</button>
            <input id="scanCodeResult" name ="scanCodeResult"/>
            

        </div>
    </form>
</body>
</html>



展开
收起
zsp13 2016-06-24 12:10:07 5144 0
1 条回答
写回答
取消 提交回答
  • Re扫码功能无反应
    为什么没人回?是没碰到问题吗?
    2016-06-26 01:55:34
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
钉钉连接平台速成手册 立即下载
微信PaxosStore简介 立即下载
支付宝小程序教程 立即下载