我已经使用cordova插件为条形码扫描仪创建了一个SAPUI5应用程序。当我将它部署到FIORI Launchpad上并尝试运行该应用程序时。然后相机打开以读取条形码,但它不会给出扫描代码的结果。有什么帮助吗?下面是我在Eclipse上的项目的屏幕截图和代码。项目结构
Index.html
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<script src="resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m"
data-sap-ui-theme="sap_bluecrystal">
</script>
<script>
sap.ui.localResources("barcodenew");
var app = new sap.m.App({initialPage:"idMain1"});
var page = sap.ui.view({id:"idMain1",
viewName:"barcodenew.Main",
type:sap.ui.core.mvc.ViewType.XML});
app.addPage(page);
app.placeAt("content");
</script>
<script type="text/javascript" src="cordova.js"> </script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>View.xml
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m" controllerName="barcodenew.Main"
xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="ISPC Asset BarCode">
<content>
<Label text="BarCode" class="sapUiSmallMargin" />
<Input id="BCID" width="150px" value="12345"/>
<Button id="BC" text=""
icon="sap-icon://camera"
press="handleCamera" type="Accept" />
</content>
</Page>
</core:View> Controller.js
sap.ui.controller("barcodenew.Main", {
handleCamera: function(evt){
var bc = this.getView().byId("BCID");
cordova.plugins.barcodeScanner.scan(
function(result){
bc.setValue(result.text);
},
function(error){
alert("Sorry, Camera Error!!"+error);
}
);
},
}); 你好,菲罗兹。
发布于 2017-05-16 15:30:31
在Fiori客户端内部的Fiori Launchpad -使用cordova/Kapsel插件中他们提到
“在科多瓦之前添加windows.parent以达到发射台级别。”也许吧
window.parent.cordova.plugins.barcodeScanner.scan而不是
cordova.plugins.barcodeScanner.scan能帮到你。我没有FLP来尝试它。所以我不知道,它是否真的有效。
https://stackoverflow.com/questions/41981443
复制相似问题