Commit 142a3a2b authored by jiangjiantao's avatar jiangjiantao

错误监控&优化扫码枪

parent ce98259c
App({
var fundebug = require('./utils/fundebug.0.2.0.min.js');
import monitor from '/utils/alipayLogger';
var originRequest = my.request;
// my.request = function(options) {
// originRequest.call(null, {
// })
// }
// fundebug.init(
// {
// apikey : 'c0c5937571f82aecab3f7578bea5d8163455cd2407863f94829bee12324f57b4'
// })
App(monitor.hookApp({
globalData: {
version: "1.0.1.20200311",
//是否使用测试支付数据
......@@ -19,7 +34,21 @@ App({
isLoginOk : false
},
onLaunch(options) {
monitor.init({
pid: "giuwgqptxargdzeksonika==",
options: options,
sample: 1,
autoReportApi: true,
autoReportPage: true,
// Http请求返回数据中状态码字段名称
code: ["success"],
// Http返回数据中的error message字段名称
msg: ["errorMsg"]
});
// 第一次打开
// options.query == {number:1}
console.info('App onLaunch');
......@@ -114,4 +143,13 @@ App({
}
});
},
});
// onError(err)
// {
// // debugger;
// monitor.error('gggggggg')
// console.log("草泥马");
// // fundebug.onError(err);
// },
}));
......@@ -19,6 +19,7 @@ Page({
}
},
onLoad() {
//首先获取下sn
var serialno = my.ix.getSysPropSync({ key: 'ro.serialno' });
console.log("getSN success==>" + JSON.stringify(serialno));
......
This diff is collapsed.
var _0x11f3=["name","Module","exports","appVersion","silent","captureBreadcrumb","length","locationInfo","error","isFiltered","headers","request","httpRequest","constructor","fundebug.notify()的option参数类型必须为object!"];(function(t,e){var r=function(e){while(--e){t["push"](t["shift"]())}};r(++e)})(_0x11f3,211);var _0x1c24=function(e,t){e=e-0;var r=_0x11f3[e];return r};module["exports"]=function(r){var n={};function o(e){if(n[e])return n[e]["exports"];var t=n[e]={i:e,l:!1,exports:{}};return r[e]["call"](t["exports"],t,t["exports"],o),t["l"]=!0,t["exports"]}return o["m"]=r,o["c"]=n,o["d"]=function(e,t,r){o["o"](e,t)||Object["defineProperty"](e,t,{enumerable:!0,get:r})},o["r"]=function(e){"undefined"!=typeof Symbol&&Symbol["toStringTag"]&&Object["defineProperty"](e,Symbol["toStringTag"],{value:_0x1c24("0x0")}),Object["defineProperty"](e,"__esModule",{value:!0})},o["t"]=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t["__esModule"])return t;var r=Object["create"](null);if(o["r"](r),Object["defineProperty"](r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o["d"](r,n,function(e){return t[e]}["bind"](null,n));return r},o["n"]=function(e){var t=e&&e["__esModule"]?function(){return e["default"]}:function(){return e};return o["d"](t,"a",t),t},o["o"]=function(e,t){return Object["prototype"]["hasOwnProperty"]["call"](e,t)},o["p"]="",o(o["s"]=0)}([function(e,t,r){"use strict";var n=r(1),o=r(5),i=r(8),u=r(9),c=r(10),f={},s=[],a={};f["init"]=n(a,s),f["onError"]=o(a,s,f),f["test"]=u(a,s,f),f["notify"]=i(a,s,f),f["notifyError"]=c(a,s,f),e[_0x1c24("0x1")]=f},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol["iterator"]?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e["constructor"]===Symbol&&e!==Symbol["prototype"]?"symbol":typeof e},o=r(2),i=r(4);e[_0x1c24("0x1")]=function(r,e){return function(t){if(t&&"object"===(void 0===t?"undefined":n(t))){["apikey",_0x1c24("0x2"),"releaseStage","metaData","filters",_0x1c24("0x3"),"silentPage"]["forEach"](function(e){r[e]=t[e]}),o(e),i["getNetworkType"](),t["setSystemInfo"]&&i["getSystemInfo"](),t["setLocation"]&&i["getLocation"]()}}}},function(e,t,r){"use strict";var o=r(3);e[_0x1c24("0x1")]=function(n){["log","error","info","warn"]["forEach"](function(e){var t,r;t=e,r=console[t],console[t]=function(){try{var e={};e["type"]="console";e["time"]=(new Date).getTime();e["method"]=t;e["args"]=arguments;o[_0x1c24("0x4")](n,e)}catch(e){console["error"](e)}r&&r["apply"](this,arguments)}})}},function(e,t,r){"use strict";t["captureBreadcrumb"]=function(e,t){e["push"](t),20<e["length"]&&e["shift"]()},t["getCurrentPage"]=function(){var e=getCurrentPages();if(e[_0x1c24("0x5")]){var t=e[e["length"]-1];if(t)return t["route"]=t["route"],t}}},function(e,t,r){"use strict";var o=r(3),i=void 0,u=void 0,c=void 0;t["getEvent"]=function(e,t,r){var n={};n["notifierVersion"]="0.2.0";n["systemInfo"]=i;n[_0x1c24("0x6")]=u;n["networkType"]=c;return n["scene"]=e["scene"],n["apikey"]=e["apikey"],n["appVersion"]=e["appVersion"],n["releaseStage"]=e["releaseStage"],n["metaData"]=r["metaData"]||e["metaData"],n["breadcrumbs"]=t,n["time"]=(new Date)["getTime"](),e["silentPage"]||(n["Page"]=o["getCurrentPage"]()),n},t["getNetworkType"]=function(){my["getNetworkType"]({success:function(e){c=e["networkType"]}})},t["getSystemInfo"]=function(){my["getSystemInfo"]({success:function(e){i=e}})},t["getLocation"]=function(){my["getLocation"]({type:1,success:function(e){u=e}})}},function(e,t,r){"use strict";var o=r(6);e["exports"]=function(t,r,n){return function(e){try{if(t["silent"])return;if(!e)return void console["error"]("fundebug.onError()必须指定error参数!");if("string"!=typeof e)return void console["error"]("fundebug.onError()的error参数类型必须为string!");o({type:"uncaught",error:e},t,r,n)}catch(e){console[_0x1c24("0x7")](e)}}}},function(e,t,r){"use strict";var u=r(7),c=r(4),f=5;e[_0x1c24("0x1")]=function(e,t,r,n){var o=c["getEvent"](t,r,n);if(e=Object["assign"](o,e),JSON["stringify"](e,null,4),!u[_0x1c24("0x8")](e,t["filters"])&&function(e){if(!e["apikey"])return void console["error"]("请使用fundebug.init(https://docs.fundebug.com/notifier/aliapp/api/init.html)配置apikey!");return!!f&&(f--,!0)}(e)){var i={};i["url"]="https://aliapp.fundebug.net/event/";i["method"]="POST";i[_0x1c24("0x9")]={};i["data"]=JSON.stringify(e);i[_0x1c24("0x9")]["Content-Type"]="application/json";my["canIUse"]("request")?my[_0x1c24("0xa")](i):my[_0x1c24("0xb")](i)}}},function(e,t,r){"use strict";function n(e,t){if(!e)return!1;if(!t)return!1;if(Object["keys"]&&!Object["keys"](t)["length"])return!1;for(var r in t)if(t["hasOwnProperty"](r))if(t[r]["constructor"]===RegExp){if(!t[r]["test"](e[r]))return!1}else if(t[r]["constructor"]===Object){if(!n(e[r],t[r]))return!1}else{if(t[r]["constructor"]!==String||"inexistence"!==t[r])return!1;if(e["hasOwnProperty"](r))return!1}return!0}t["isFiltered"]=function(e,t){if(!t||!t["length"])return!1;for(var r=0;r<t["length"];r++)if(n(e,t[r]))return!0;return!1}},function(e,t,r){"use strict";var c="function"==typeof Symbol&&"symbol"==typeof Symbol["iterator"]?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e[_0x1c24("0xc")]===Symbol&&e!==Symbol["prototype"]?"symbol":typeof e},f=r(6);e["exports"]=function(o,i,u){return function(e,t,r){try{if(o["silent"])return;if(!e)return void console[_0x1c24("0x7")]("fundebug.notify()必须指定name参数!");if("string"!=typeof e)return void console["error"]("fundebug.notify()的name参数类型必须为string!");if(t&&"string"!=typeof t)return void console["error"]("fundebug.notify()的message参数类型必须为string!");if(r&&"object"!==(void 0===r?"undefined":c(r)))return void console["error"](_0x1c24("0xd"));var n={};n["type"]="notification";n[_0x1c24("0xe")]=e;n["message"]=t;r&&r["metaData"]&&(n["metaData"]=r["metaData"]),f(n,o,i,u)}catch(e){console["error"](e)}}}},function(e,t,r){"use strict";var i=r(6);e["exports"]=function(r,n,o){return function(e,t){try{if(r["silent"])return;if(e&&"string"!=typeof e)return void console["error"]("fundebug.test()的name参数类型必须为string!");if(t&&"string"!=typeof t)return void console["error"]("fundebug.test()的message参数类型必须为string!");i({type:"test",name:e||"Test",message:t||"Hello, Fundebug!"},r,n,o)}catch(e){console["error"](e)}}}},function(e,t,r){"use strict";var u="function"==typeof Symbol&&"symbol"==typeof Symbol["iterator"]?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e["constructor"]===Symbol&&e!==Symbol["prototype"]?"symbol":typeof e},c=r(6);e["exports"]=function(n,o,i){return function(e,t){try{if(n["silent"])return;if(!e)return void console["error"]("fundebug.notifyError()必须指定error参数!");if(!(e instanceof Error))return void console["error"]("fundebug.notifyError()的error参数类型必须为Error实例!");if(t&&"object"!==(void 0===t?"undefined":u(t)))return void console[_0x1c24("0x7")]("fundebug.notifyError()的option参数类型必须为object!");var r={};r["type"]="caught";r["error"]={};r["error"]["name"]=e.name;r["error"]["message"]=e.message;r["error"]["stack"]=e.stack;t&&(t["name"]&&(r["name"]=t["name"]),t["metaData"]&&(r["metaData"]=t["metaData"])),c(r,n,o,i)}catch(e){console["error"](e)}}}}]);
\ No newline at end of file
......@@ -3,7 +3,8 @@ export default class scan {
['onShow', 'onHide', 'onUnload'].forEach((f) => {
const raw = page[f];
var code = '';
var isScaning = false;
var timer = null;
page[f] = (...args) => {
if (f === 'onShow') {
if (!page._keyEventListener) {
......@@ -13,27 +14,26 @@ export default class scan {
let cur = getCurrentPages().slice(-1)[0];
cur.onKeyPress.call(cur, code);
}
console.log('code: ' + r.code);
console.log('前置摄像头内容: ' + r.code);
});
//物理扫码枪
my.ix.onKeyEventChange(page._keyEventListener = (r) => {
let cur = getCurrentPages().slice(-1)[0];
if (cur && cur.onKeyPress) {
if (isScaning == false) {
isScaning = true
code = (r.keyCode - 7) + ''
setTimeout(() => {
//兼容扫描枪
cur.onKeyPress.call(cur, code);
isScaning = false
}, 2000);
} else {
//特殊处理 keycode需要减7
if (r.keyCode >= 7 && r.keyCode <= 16) {
code = code + (r.keyCode - 7)
}
//特殊处理 keycode需要减7
if (r.keyCode >= 7 && r.keyCode <= 16) {
code = code + (r.keyCode - 7)
}
if(timer != null){
clearTimeout(timer);
}
timer = setTimeout(() => {
//兼容扫描枪
cur.onKeyPress.call(cur, code);
console.log('物理扫码枪内容: ' + code);
code = '';
}, 500);
}
});
}
......@@ -43,6 +43,7 @@ export default class scan {
page._keyEventListener = null;
//摄像头资源释放
my.ix.offCodeScan();
}
}
if (raw instanceof Function) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment