//扫描页面
// 二维码扫描成功
function onmarked(type, result, file){
switch(type){
case plus.barcode.QR:
type = 'QR';
break;
case plus.barcode.EAN13:
type = 'EAN13';
break;
case plus.barcode.EAN8:
type = 'EAN8';
break;
default:
type = '其它'+type;
break;
}
result = result.replace(/\"/g, '');
console.log("res结果----:"+result);
if(result){
Zhhy.showLoading("正在获取数据...");
var res = result.split(":")[0];
//console.log("res121211----:"+res);
var parmal = SettingGlobal[BizConstant.URL] +"/agentSrv?" +
"url="+BizConfig.getHTIpAdress();//测试环境
console.log("parmal----:"+parmal)
mui.ajax(parmal,{
data:{
service : "dzh-business/business/inform/informAction!selectScanLife.action",
method : "GET",
dataSource : "HY",
token : token,
emCode : res
},
dataType : "json",
type : 'GET',
success: function(data) {
Zhhy.hideLoading();
console.log("data--------"+JSON.stringify(data));
var results = data.result;
//console.log("results--------"+JSON.stringify(results));
if(results){
var id = plus.webview.currentWebview().opener();
mui.fire(id,'scanedCallbackPag',{type : type, res : results, file : file}); //监听父页面
mui.back();
}else{
mui.toast("没有数据~");
}
},
error: function(xhr,type,errorThrown) {
//Zhhy.hideLoading();
mui.toast("获取数据失败..."+errorThrown);
console.log(JSON.stringify(xhr)+"=--"+JSON.stringify(type)+"=--"+JSON.stringify(errorThrown))
},
timeout: 1000000
});
}else{
mui.toast("扫描不到数据!");
}
}
//成功后监听跳转数据展示(子)页面
//扫描成功后 的监听
window.addEventListener("scanedCallbackPag", function(e) {
var type = e.detail.type;
var res = e.detail.res;
var file = e.detail.file;
if(res) {
mui.openWindow({
url: "detailed.html",
id: "detailed",
extras: {
res: res,
projectNo: projectNo
}
});
}
//iEvent.getAllJobData();
});
//最后进入展示页面。手机返回上一级(父页面)再次点扫描,出现同一份数据,再扫描一遍该二维码,才是该二维码的数据。(注:第一遍好像没刷新一样)