求助,写了个简单的调用扫描组件的例子,很奇怪能够扫描但是不能到达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>
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。