You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
4.1 KiB
38 lines
4.1 KiB
"use strict";
|
|
const common_vendor = require("../common/vendor.js");
|
|
const mp_ecard_sdk_utils_validate = require("./utils/validate.js");
|
|
const mp_ecard_sdk_constants_log = require("./constants/log.js");
|
|
const mp_ecard_sdk_globalConfig = require("./globalConfig.js");
|
|
const mp_ecard_sdk_utils_index = require("./utils/index.js");
|
|
const EIDAppID = "wx0e2cb0b052a91c92";
|
|
function initEid(e = "https://eid.faceid.qq.com", o = "release", n = "https://eid-enhance.faceid.qq.com") {
|
|
common_vendor.index.eidBaseUrl = e, common_vendor.index.eidEnvVersion = o, common_vendor.index.eidBackUpUrl = n;
|
|
common_vendor.index.onAppShow((e2) => {
|
|
console.log("!!!!!!监听onshow事件", e2, common_vendor.index.eidTokenToCallback);
|
|
var { scene: e2, referrerInfo: o2 } = e2, { appId: o2, extraData: n2 } = o2 || {}, { token: i, verifyDone: t } = n2 || {};
|
|
1038 === e2 && o2 === EIDAppID && n2 && (t && common_vendor.index.handleEidVerifyDone ? common_vendor.index.eidTokenToCallback && common_vendor.index.eidTokenToCallback === i && (common_vendor.index.eidTokenToCallback = "", common_vendor.index.reportLogToEid({ token: i, event: mp_ecard_sdk_constants_log.Log.navigateBackFromEid, errMsg: `从EID核身完成返回,token:${i},verifyDone:` + t }), console.log("!!!!!!执行回调"), common_vendor.index.handleEidVerifyDone(n2)) : common_vendor.index.reportLogToEid({ token: i, event: mp_ecard_sdk_constants_log.Log.navigateBackFromEidFail, errMsg: `核验未完成或者没有处理核验完成的函数,token:${i},verifyDone:` + t }));
|
|
});
|
|
e = common_vendor.index.getSystemInfoSync();
|
|
const d = e["version"];
|
|
common_vendor.index.reportLogToEid = function(e2) {
|
|
var { token: e2 = "", event: o2 = "", errCode: n2 = "", errMsg: i = "", data: t = {} } = e2, r = new Date();
|
|
const a = { Token: e2, SourceType: mp_ecard_sdk_constants_log.Log.SourceType, SourceVersion: mp_ecard_sdk_constants_log.Log.version, EnvVersion: d, Timestamp: r.getTime(), Event: o2, ErrorCode: "number" == typeof n2 ? n2.toString() : n2, ErrorMsg: i, Data: JSON.stringify(t) };
|
|
console.log("开始上报日志:", a), common_vendor.index.request({ url: common_vendor.index.eidBaseUrl + "/api/common/ReportEvent", method: "POST", data: a, success(e3) {
|
|
console.log("上报日志完成:", "payload:", a, "res:", e3);
|
|
} });
|
|
};
|
|
}
|
|
function startEid(e) {
|
|
const { data: o, verifyDoneCallback: n } = e;
|
|
if (!o || !n)
|
|
return common_vendor.index.reportLogToEid({ token: i, event: mp_ecard_sdk_constants_log.Log.startEidFail, errMsg: "传入的参数有误" }), void common_vendor.index.showModal({ title: "提示", content: "传入的参数有误", showCancel: false });
|
|
const { token: i, needJumpPage: t = false, enableEmbedded: r = false, allowFullScreen: a = true } = o;
|
|
mp_ecard_sdk_utils_validate.validate.isValidateToken(i) ? (common_vendor.index.enableEmbedded = r, common_vendor.index.allowFullScreen = a, common_vendor.index.VerifyEid_TOKEN = i, mp_ecard_sdk_utils_index.reportStat({ module: "EidStart", action: "enter" }), common_vendor.index.handleEidVerifyDone = (e2) => {
|
|
const o2 = e2["token"];
|
|
mp_ecard_sdk_utils_index.reportStat({ module: "EidEnd", action: "leave" }), t ? common_vendor.index.navigateBack({ success() {
|
|
common_vendor.index.reportLogToEid({ token: o2, event: mp_ecard_sdk_constants_log.Log.EidVerifyDone, errMsg: "验证完成,token:" + o2 }), n({ token: o2, verifyDone: true });
|
|
} }) : (common_vendor.index.reportLogToEid({ token: o2, event: mp_ecard_sdk_constants_log.Log.EidVerifyDone, errMsg: "验证完成,token:" + o2 }), n({ token: o2, verifyDone: true }));
|
|
}, t ? common_vendor.index.navigateTo({ url: `${mp_ecard_sdk_globalConfig.globalConfig.normalPath}/mp_ecard_sdk/index/index?token=${i}&needJumpPage=` + t }) : mp_ecard_sdk_utils_index.navigateToEid(i)) : (common_vendor.index.reportLogToEid({ token: i, event: mp_ecard_sdk_constants_log.Log.startEidFail, errMsg: "传入的token有误,token:" + i }), common_vendor.index.showModal({ title: "提示", content: "传入的token有误", showCancel: false }));
|
|
}
|
|
exports.initEid = initEid;
|
|
exports.startEid = startEid;
|