fastman2 2.8.9 → 3.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actionsheetman.js +96 -1
- package/alertman.js +79 -1
- package/annotationman.js +2912 -17
- package/baseman.js +115 -1
- package/blankpageman.js +171 -1
- package/bootstrap/index.d.ts +1 -0
- package/cascadepickerman.js +322 -1
- package/confirmman.js +87 -1
- package/coreman.js +2182 -3
- package/cryptoman.js +8931 -2
- package/datetimepickerman.js +181 -1
- package/domman.js +2759 -1
- package/eventemitterman.js +112 -1
- package/fileuploadman.js +2970 -1
- package/formvalidateman.js +335 -1
- package/jsbridgeman.js +992 -1
- package/lazyloadman.js +133 -1
- package/loadingman.js +81 -1
- package/modalman.js +264 -1
- package/mutationobserverman.js +356 -1
- package/package.json +1 -1
- package/passguardman.js +1722 -1
- package/persistman.js +60 -1
- package/pickerman.js +680 -1
- package/popupman.js +61 -1
- package/postman.js +1649 -1
- package/preloadman.js +8760 -2
- package/resultpageman.js +153 -1
- package/routerman.js +1201 -1
- package/scrollman-infiniteRefresh.js +117 -1
- package/scrollman-pullDownRefresh.js +302 -1
- package/scrollman.js +2567 -2
- package/storeman.js +585 -1
- package/swiperman.js +4702 -1
- package/swiperoldman.js +3005 -1
- package/tabman.js +145 -1
- package/tipman.js +110 -1
- package/toastman.js +78 -1
- package/toolman.js +22 -1
- package/whenman.js +774 -1
- package/wsman.js +7624 -1
package/jsbridgeman.js
CHANGED
|
@@ -1 +1,992 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.fastman=t():e.fastman=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var o={};return t.m=e,t.c=o,t.i=function(e){return e},t.d=function(e,o,n){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=19)}({1:function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){var t=document.createElement("a");t.setAttribute("href",e);var o=t.href;return t=null,o},r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},i=function(e){return!(null!=e&&(e.length||e.length>0))},a=function(e){if(e){if(1==e.length)return e;var t=e.substring(e.length-1,e.length);return(e.length>=3?"**":"*")+t}return e};t.getAbsoluteUrl=n,t._extends=r,t.isEmpty=i,t.maskName=a},10:function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){for(var o=e.split(".").length;o<t;)e+=".0",o++;return e},r=function(e){var t=navigator.userAgent.toLowerCase().match(/DFYJ\/([\d.]+)/i);return t?t[1]:void 0},i=function(e,t){var o=e.split("."),r=t.split("."),i=Math.max(o.length,r.length);e=n(e,i),t=n(t,i);var a=e.split("."),c=t.split(".");if(e===t)return 0;for(var l=0;l<a.length;l++){var s=parseInt(a[l]);if(!c[l])return 1;var f=parseInt(c[l]);if(s<f)return-1;if(s>f)return 1}return-1},a=function(e){var t=r();return t?i(t,e):1};t.getVersion=r,t.compareVersion=a,t._compareVersion=i},19:function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.onApiRequest=t.pageWillAppear=t.onRequest=t.onDynamicLink=t.subscribeNotify=t.onNotify=t.onPushView=t.onNavigationBar=t.onRefresh=t.onBack=t.ready=t.wrapNotOkPayload=t.wrapOkPayload=void 0;var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},r=o(1),i=o(9),a=o(10),c=navigator.userAgent,l=c.match(/(Android);?[\s\/]+([\d.]+)?/),s=c.match(/(iPad).*OS\s([\d_]+)/),f=c.match(/(iPod)(.*OS\s([\d_]+))?/),p=!s&&c.match(/(iPhone\sOS)\s([\d_]+)/),u=!!c.toLowerCase().match(/DFYJ/i),d=!!c.toLowerCase().match(/ArkWeb/i),y=function(e){return e.init(function(e,t){t&&t(data)}),e},g=function(e){var t=function(t){(0,i.log)("[ready] <-"),e(t)};if((0,i.log)("[ready] ->"),u)if(s||p||f){if(window.WebViewJavascriptBridge)return t(WebViewJavascriptBridge);if(window.WVJBCallbacks)return window.WVJBCallbacks.push(t);window.WVJBCallbacks=[t];var o=document.createElement("iframe");o.style.display="none",o.src="https://__bridge_loaded__",document.documentElement.appendChild(o),setTimeout(function(){document.documentElement.removeChild(o)},0)}else l?window.WebViewJavascriptBridge?t(y(WebViewJavascriptBridge)):document.addEventListener("WebViewJavascriptBridgeReady",function(){t(y(WebViewJavascriptBridge))},!1):t();else t()},v=function(){},b=function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}},k=function(){return{code:arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,info:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"error"}},m=function(e){var t={complete:v};t=(0,r._extends)({},t,e),(0,i.log)("onBack->"+JSON.stringify(t)),d?HmJsBridge.back&&HmJsBridge.back(t):WebViewJavascriptBridge.callHandler("back",t,function(e){(0,i.log)("onBack<-"+JSON.stringify(e)),t.complete(e)})},J=function(e){var t={complete:v};t=(0,r._extends)({},t,e),(0,i.log)("onRefresh->"+JSON.stringify(t)),d?HmJsBridge.refresh&&HmJsBridge.refresh(t):WebViewJavascriptBridge.callHandler("refresh",t,function(e){(0,i.log)("onRefresh<-"+JSON.stringify(e)),t.complete(e)})},h=function(e){var t={complete:v};t=(0,r._extends)({},t,e),(0,i.log)("onNavigationBar->"+JSON.stringify(t)),d?HmJsBridge.navigationBar&&HmJsBridge.navigationBar(t):WebViewJavascriptBridge.callHandler("navigationBar",t,function(e){(0,i.log)("onNavigationBar<-"+JSON.stringify(e)),t.complete(e)})},w=function(e){var t={title:"",isFullScreen:!1,isStatusBarLight:!0,ver:"v1"};t=(0,r._extends)({},t,e),t.uri&&(-1!=t.uri.indexOf("http")||-1!=t.uri.indexOf("https")||(t.uri=(0,r.getAbsoluteUrl)(t.uri))),(0,i.log)("onPushView->"+JSON.stringify(t)),d?HmJsBridge.go&&HmJsBridge.go(t):WebViewJavascriptBridge.callHandler("pushView",t,function(e){(0,i.log)("onPushView<-"+JSON.stringify(e))})},O=function(e){"function"==typeof e&&(d?HmJsBridge.willAppear&&HmJsBridge.willAppear(e):WebViewJavascriptBridge.registerHandler("pageWillAppear",e))},B=function(e){var t={type:"javascriptNotify"};t=(0,r._extends)({},t,e),(0,i.log)("onNotify->"+JSON.stringify(t)),d?HmJsBridge.willAppear&&HmJsBridge.notify(t):WebViewJavascriptBridge.callHandler("notify",t,function(e){(0,i.log)("onNotify<-"+JSON.stringify(e))})},_={},N=function(e,t){if("function"==typeof t){var o=e;"sae_video"!=o&&"result_video"!=o||(o="notify"),_[o]=t,(0,i.log)("subscribeNotify->"+e),d?HmJsBridge.subscribeNotify&&HmJsBridge.subscribeNotify(o,function(e){(0,i.log)("subscribeNotify<-"+JSON.stringify(e)),Object.prototype.toString.call(e).toLocaleLowerCase()=="[object String]".toLocaleLowerCase()&&(e=JSON.parse(e)),_[o]&&_[o](e)}):WebViewJavascriptBridge.registerHandler(o,function(t){if((0,i.log)("subscribeNotify<-"+JSON.stringify(t)),Object.prototype.toString.call(t).toLocaleLowerCase()=="[object String]".toLocaleLowerCase()&&(t=JSON.parse(t)),"result_video"==e&&t.payload){Object.prototype.toString.call(t.payload).toLocaleLowerCase()=="[object String]".toLocaleLowerCase()&&(t.payload=JSON.parse(t.payload)),(s||p||f)&&(t.payload=n({},t.payload.params));var r=[];if(t.payload.result&&t.payload.result.length){t.payload.result.forEach(function(e){e.reasons&&"[object Array]"==Object.prototype.toString.call(e.reasons)&&(r=r.concat(e.reasons))})}t.payload.reject_reasons=r.reduce(function(e,t){return e.concat(t.split(";"))},[])}_[o]&&(l?"sae_video"==t.type||"result_video"==t.type?((0,i.log)("安卓notify被调用."),_.notify(t)):t.type==o&&((0,i.log)("安卓"+t.type+"被调用!"),_[o](t)):((0,i.log)("iOS notify被调用;"),_[o](t)))})}},S=function(e){var t={url:""};if(t=(0,r._extends)({},t,e),(0,i.log)("onDynamicLink->"+JSON.stringify(t)),d)HmJsBridge.dynamicLink&&HmJsBridge.dynamicLink(t);else{if((0,a.compareVersion)("5.22.2")<0&&-1!=t.url.indexOf("dl/videoreview"))return void alert("您当前的APP版本过低,请升级至V5.22.2以上版本后,再进行使用");WebViewJavascriptBridge.callHandler("dynamicLink",t,function(e){(0,i.log)("onDynamicLink<-"+JSON.stringify(e))})}},H={},V=!1,I=function(e,t){switch(arguments.length){case 1:return parseInt(Math.random()*e+1,10);case 2:return parseInt(Math.random()*(t-e+1)+e,10);default:return 0}},L=[],W=function e(){var t=I(1e3,9999);return-1!==L.indexOf(t)?e(t):(L.push(t),t)},j=function(e,t,o,n){var r={type:e||"1",payload:t||{},callbackId:W()};if(H[e+"-ok"]="function"==typeof o?o:v,H[e+"-notok"]="function"==typeof n?n:v,H[e+"_"+r.callbackId+"-ok"]="function"==typeof o?o:v,H[e+"_"+r.callbackId+"-notok"]="function"==typeof n?n:v,d)return void(HmJsBridge.request&&HmJsBridge.request(r,function(e){"string"==typeof e&&(e=JSON.parse(e)),e.error||"true"===e.error?e.callbackId&&"function"==typeof H[e.type+"_"+e.callbackId+"-notok"]?H[e.type+"_"+e.callbackId+"-notok"](k(-1,e.info)):"function"==typeof H[e.type+"-notok"]&&H[e.type+"-notok"](k(-1,e.info)):e.callbackId&&"function"==typeof H[e.type+"_"+e.callbackId+"-ok"]?(s||p||f||e.payload)&&H[e.type+"_"+e.callbackId+"-ok"](b(e.payload)):"function"==typeof H[e.type+"-ok"]&&(s||p||f||e.payload)&&H[e.type+"-ok"](b(e.payload))}));WebViewJavascriptBridge.callHandler("request",r,function(e){"string"==typeof e&&(e=JSON.parse(e)),e.error||"true"===e.error?e.callbackId&&"function"==typeof H[e.type+"_"+e.callbackId+"-notok"]?H[e.type+"_"+e.callbackId+"-notok"](k(-1,e.info)):"function"==typeof H[e.type+"-notok"]&&H[e.type+"-notok"](k(-1,e.info)):e.callbackId&&"function"==typeof H[e.type+"_"+e.callbackId+"-ok"]?(s||p||f||e.payload)&&H[e.type+"_"+e.callbackId+"-ok"](b(e.payload)):"function"==typeof H[e.type+"-ok"]&&(s||p||f||e.payload)&&H[e.type+"-ok"](b(e.payload))}),V||(WebViewJavascriptBridge.registerHandler("request",function(e){"string"==typeof e&&(e=JSON.parse(e)),e.error||"true"===e.error?e.callbackId&&"function"==typeof H[e.type+"_"+e.callbackId+"-notok"]?H[e.type+"_"+e.callbackId+"-notok"](k(-1,e.info)):"function"==typeof H[e.type+"-notok"]&&H[e.type+"-notok"](k(-1,e.info)):e.callbackId&&"function"==typeof H[e.type+"_"+e.callbackId+"-ok"]?H[e.type+"_"+e.callbackId+"-ok"](b(e.payload)):"function"==typeof H[e.type+"-ok"]&&H[e.type+"-ok"](b(e.payload))}),V=!0)},x=function(e,t,o,n){if((0,r.isEmpty)(e))throw new Error("functionNo is required ...");var a={funcId:e,payload:t||{}};(0,i.log)("onApiRequest->"+JSON.stringify(a)),d||WebViewJavascriptBridge.callHandler("apiRequest",a,function(e){if((0,i.log)("onApiRequest<-"+JSON.stringify(e)),"string"==typeof e&&(e=JSON.parse(e)),s||p||f){if(e.error||"true"===e.error)e.payload?"function"==typeof n&&n(k(e.payload.code,e.payload.info)):"function"==typeof n&&n(k(-1,e.info));else if("function"==typeof o){var t={};e.payload&&(t="string"==typeof e.payload.data?JSON.parse(e.payload.data):e.payload.data),o(b(t))}}else if(e.error||"true"===e.error)"function"==typeof n&&n(k(-1,e.info));else{var r={};r="string"==typeof e.payload.data?JSON.parse(e.payload.data):e.payload.data?e.payload.data:{},"0"!=e.payload.code?"function"==typeof n&&n(k(e.payload.code,e.payload.info)):"function"==typeof o&&o(b(r))}})};t.wrapOkPayload=b,t.wrapNotOkPayload=k,t.ready=g,t.onBack=m,t.onRefresh=J,t.onNavigationBar=h,t.onPushView=w,t.onNotify=B,t.subscribeNotify=N,t.onDynamicLink=S,t.onRequest=j,t.pageWillAppear=O,t.onApiRequest=x},9:function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){var e=new Date;e.getDate();return(e.getHours()<10?"0"+e.getHours():e.getHours())+":"+(e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes())+":"+(e.getSeconds()<10?"0"+e.getSeconds():e.getSeconds())+"."+e.getMilliseconds()},r=function(e){e&&(e=n()+"[赢家]: "+e)},i=function(e){e&&(e=n()+"[赢家]: "+e)};t.log=r,t.errorlog=i}})});
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory();
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define([], factory);
|
|
6
|
+
else if(typeof exports === 'object')
|
|
7
|
+
exports["fastman"] = factory();
|
|
8
|
+
else
|
|
9
|
+
root["fastman"] = factory();
|
|
10
|
+
})(this, function() {
|
|
11
|
+
return /******/ (function(modules) { // webpackBootstrap
|
|
12
|
+
/******/ // The module cache
|
|
13
|
+
/******/ var installedModules = {};
|
|
14
|
+
/******/
|
|
15
|
+
/******/ // The require function
|
|
16
|
+
/******/ function __webpack_require__(moduleId) {
|
|
17
|
+
/******/
|
|
18
|
+
/******/ // Check if module is in cache
|
|
19
|
+
/******/ if(installedModules[moduleId]) {
|
|
20
|
+
/******/ return installedModules[moduleId].exports;
|
|
21
|
+
/******/ }
|
|
22
|
+
/******/ // Create a new module (and put it into the cache)
|
|
23
|
+
/******/ var module = installedModules[moduleId] = {
|
|
24
|
+
/******/ i: moduleId,
|
|
25
|
+
/******/ l: false,
|
|
26
|
+
/******/ exports: {}
|
|
27
|
+
/******/ };
|
|
28
|
+
/******/
|
|
29
|
+
/******/ // Execute the module function
|
|
30
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
31
|
+
/******/
|
|
32
|
+
/******/ // Flag the module as loaded
|
|
33
|
+
/******/ module.l = true;
|
|
34
|
+
/******/
|
|
35
|
+
/******/ // Return the exports of the module
|
|
36
|
+
/******/ return module.exports;
|
|
37
|
+
/******/ }
|
|
38
|
+
/******/
|
|
39
|
+
/******/
|
|
40
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
41
|
+
/******/ __webpack_require__.m = modules;
|
|
42
|
+
/******/
|
|
43
|
+
/******/ // expose the module cache
|
|
44
|
+
/******/ __webpack_require__.c = installedModules;
|
|
45
|
+
/******/
|
|
46
|
+
/******/ // identity function for calling harmony imports with the correct context
|
|
47
|
+
/******/ __webpack_require__.i = function(value) { return value; };
|
|
48
|
+
/******/
|
|
49
|
+
/******/ // define getter function for harmony exports
|
|
50
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
51
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
52
|
+
/******/ Object.defineProperty(exports, name, {
|
|
53
|
+
/******/ configurable: false,
|
|
54
|
+
/******/ enumerable: true,
|
|
55
|
+
/******/ get: getter
|
|
56
|
+
/******/ });
|
|
57
|
+
/******/ }
|
|
58
|
+
/******/ };
|
|
59
|
+
/******/
|
|
60
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
61
|
+
/******/ __webpack_require__.n = function(module) {
|
|
62
|
+
/******/ var getter = module && module.__esModule ?
|
|
63
|
+
/******/ function getDefault() { return module['default']; } :
|
|
64
|
+
/******/ function getModuleExports() { return module; };
|
|
65
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
66
|
+
/******/ return getter;
|
|
67
|
+
/******/ };
|
|
68
|
+
/******/
|
|
69
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
|
70
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
71
|
+
/******/
|
|
72
|
+
/******/ // __webpack_public_path__
|
|
73
|
+
/******/ __webpack_require__.p = "";
|
|
74
|
+
/******/
|
|
75
|
+
/******/ // Load entry module and return exports
|
|
76
|
+
/******/ return __webpack_require__(__webpack_require__.s = 19);
|
|
77
|
+
/******/ })
|
|
78
|
+
/************************************************************************/
|
|
79
|
+
/******/ ({
|
|
80
|
+
|
|
81
|
+
/***/ 1:
|
|
82
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
83
|
+
|
|
84
|
+
"use strict";
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
Object.defineProperty(exports, "__esModule", {
|
|
88
|
+
value: true
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* Created by dfzq on 2017/4/13.
|
|
92
|
+
*/
|
|
93
|
+
/**
|
|
94
|
+
* 获取绝对路径
|
|
95
|
+
* @param url
|
|
96
|
+
*/
|
|
97
|
+
var getAbsoluteUrl = function getAbsoluteUrl(url) {
|
|
98
|
+
var link = document.createElement('a');
|
|
99
|
+
link.setAttribute('href', url);
|
|
100
|
+
var absoluteUrl = link.href;
|
|
101
|
+
link = null;
|
|
102
|
+
return absoluteUrl;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 属性继承
|
|
107
|
+
* @type {*}
|
|
108
|
+
* @private
|
|
109
|
+
*/
|
|
110
|
+
var _extends = Object.assign || function (target) {
|
|
111
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
112
|
+
var source = arguments[i];
|
|
113
|
+
for (var key in source) {
|
|
114
|
+
// 源对象中是否存在对象键值
|
|
115
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
116
|
+
target[key] = source[key];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return target;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 判断是否为空
|
|
125
|
+
* @param str {string} 需要判断的值
|
|
126
|
+
* @returns {boolean}
|
|
127
|
+
*/
|
|
128
|
+
var isEmpty = function isEmpty(str) {
|
|
129
|
+
return !(str != null && (!!str.length ? true : str.length > 0));
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// 真实姓名掩码
|
|
133
|
+
var maskName = function maskName(params) {
|
|
134
|
+
if (!params) {
|
|
135
|
+
return params;
|
|
136
|
+
} else if (params.length == 1) {
|
|
137
|
+
return params;
|
|
138
|
+
} else {
|
|
139
|
+
var endName = params.substring(params.length - 1, params.length);
|
|
140
|
+
return (params.length >= 3 ? "**" : "*") + endName;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
exports.getAbsoluteUrl = getAbsoluteUrl;
|
|
145
|
+
exports._extends = _extends;
|
|
146
|
+
exports.isEmpty = isEmpty;
|
|
147
|
+
exports.maskName = maskName;
|
|
148
|
+
|
|
149
|
+
/***/ }),
|
|
150
|
+
|
|
151
|
+
/***/ 10:
|
|
152
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
153
|
+
|
|
154
|
+
"use strict";
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
Object.defineProperty(exports, "__esModule", {
|
|
158
|
+
value: true
|
|
159
|
+
});
|
|
160
|
+
/**
|
|
161
|
+
* Created by dfzq on 2017/7/31.
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* 末尾补.0
|
|
166
|
+
* @param num 原始值
|
|
167
|
+
* @param n 位数最大的值
|
|
168
|
+
* @returns {*}
|
|
169
|
+
*/
|
|
170
|
+
var padZero = function padZero(num, n) {
|
|
171
|
+
var len = num.split('.').length;
|
|
172
|
+
while (len < n) {
|
|
173
|
+
num = num + '.0';
|
|
174
|
+
len++;
|
|
175
|
+
}
|
|
176
|
+
return num;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* 获取APP版本号
|
|
181
|
+
* @param _
|
|
182
|
+
* @returns {*}
|
|
183
|
+
*/
|
|
184
|
+
var getVersion = function getVersion(_) {
|
|
185
|
+
var groups = navigator.userAgent.toLowerCase().match(/DFYJ\/([\d.]+)/i);
|
|
186
|
+
if (!groups) {
|
|
187
|
+
return undefined;
|
|
188
|
+
} else {
|
|
189
|
+
return groups[1];
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* 比较手机系统版本,arg1 > arg2, return 1; arg1 == arg2, return 0; arg1 < arg2, return -1
|
|
195
|
+
* @param compareVersion
|
|
196
|
+
* @returns {number}
|
|
197
|
+
*/
|
|
198
|
+
var _compareVersion = function _compareVersion(a, b) {
|
|
199
|
+
// 补.0操作
|
|
200
|
+
var _as = a.split('.');
|
|
201
|
+
var _bs = b.split('.');
|
|
202
|
+
var max = Math.max(_as.length, _bs.length);
|
|
203
|
+
a = padZero(a, max);
|
|
204
|
+
b = padZero(b, max);
|
|
205
|
+
|
|
206
|
+
var as = a.split('.');
|
|
207
|
+
var bs = b.split('.');
|
|
208
|
+
if (a === b) return 0;
|
|
209
|
+
|
|
210
|
+
for (var i = 0; i < as.length; i++) {
|
|
211
|
+
var x = parseInt(as[i]);
|
|
212
|
+
if (!bs[i]) return 1;
|
|
213
|
+
var y = parseInt(bs[i]);
|
|
214
|
+
if (x < y) return -1;
|
|
215
|
+
if (x > y) return 1;
|
|
216
|
+
}
|
|
217
|
+
return -1;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* 比较APP版本,比compareVersion大则返回1,否则返回-1;相等返回0;
|
|
222
|
+
* @param compareVersion
|
|
223
|
+
* @returns {number}
|
|
224
|
+
*/
|
|
225
|
+
var compareVersion = function compareVersion(_compareVersion2) {
|
|
226
|
+
// 获取当前版本号
|
|
227
|
+
var currentVersion = getVersion();
|
|
228
|
+
if (!currentVersion) {
|
|
229
|
+
return 1;
|
|
230
|
+
} else {
|
|
231
|
+
return _compareVersion(currentVersion, _compareVersion2);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
exports.getVersion = getVersion;
|
|
236
|
+
exports.compareVersion = compareVersion;
|
|
237
|
+
exports._compareVersion = _compareVersion;
|
|
238
|
+
|
|
239
|
+
/***/ }),
|
|
240
|
+
|
|
241
|
+
/***/ 19:
|
|
242
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
243
|
+
|
|
244
|
+
"use strict";
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
Object.defineProperty(exports, "__esModule", {
|
|
248
|
+
value: true
|
|
249
|
+
});
|
|
250
|
+
exports.onApiRequest = exports.pageWillAppear = exports.onRequest = exports.onDynamicLink = exports.subscribeNotify = exports.onNotify = exports.onPushView = exports.onNavigationBar = exports.onRefresh = exports.onBack = exports.ready = exports.wrapNotOkPayload = exports.wrapOkPayload = undefined;
|
|
251
|
+
|
|
252
|
+
var _extends2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /**
|
|
253
|
+
* Created by dfzq on 2017/4/13.
|
|
254
|
+
* 修改历史 - 2020-5-2:
|
|
255
|
+
* 1. onRequest指令增加回调函数的时间戳以防止重患问题的发生
|
|
256
|
+
* 2. 使用客户端返回的 type 作为回调事件
|
|
257
|
+
*
|
|
258
|
+
*/
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
var _util = __webpack_require__(1);
|
|
262
|
+
|
|
263
|
+
var _log = __webpack_require__(9);
|
|
264
|
+
|
|
265
|
+
var _version = __webpack_require__(10);
|
|
266
|
+
|
|
267
|
+
// 区分设备系统
|
|
268
|
+
var ua = navigator.userAgent;
|
|
269
|
+
var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
|
|
270
|
+
var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
|
|
271
|
+
var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
|
|
272
|
+
var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
|
|
273
|
+
var isFromApp = !!ua.toLowerCase().match(/DFYJ/i);
|
|
274
|
+
|
|
275
|
+
// 是否来自于鸿蒙
|
|
276
|
+
var isFromHarmonyOS = !!ua.toLowerCase().match(/ArkWeb/i);
|
|
277
|
+
|
|
278
|
+
// 初始化桥接对象
|
|
279
|
+
var init = function init(bridge) {
|
|
280
|
+
bridge.init(function (message, responseCallback) {
|
|
281
|
+
if (responseCallback) responseCallback(data);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
return bridge;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* 初始化桥接对象
|
|
289
|
+
* v2.2.0 - 已兼容鸿蒙
|
|
290
|
+
*
|
|
291
|
+
* connectWebViewJavascriptBridge
|
|
292
|
+
* @param callback
|
|
293
|
+
*/
|
|
294
|
+
var ready = function ready(callback) {
|
|
295
|
+
var __cb___ = function __cb___(__bridge___) {
|
|
296
|
+
(0, _log.log)("[ready] <-");
|
|
297
|
+
callback(__bridge___);
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
(0, _log.log)("[ready] ->");
|
|
301
|
+
if (isFromApp) {
|
|
302
|
+
if (ipad || iphone || ipod) {
|
|
303
|
+
// 新版本兼容IOS
|
|
304
|
+
if (window.WebViewJavascriptBridge) {
|
|
305
|
+
return __cb___(WebViewJavascriptBridge);
|
|
306
|
+
}
|
|
307
|
+
if (window.WVJBCallbacks) {
|
|
308
|
+
return window.WVJBCallbacks.push(__cb___);
|
|
309
|
+
}
|
|
310
|
+
window.WVJBCallbacks = [__cb___];
|
|
311
|
+
var WVJBIframe = document.createElement('iframe');
|
|
312
|
+
WVJBIframe.style.display = 'none';
|
|
313
|
+
WVJBIframe.src = 'https://__bridge_loaded__';
|
|
314
|
+
document.documentElement.appendChild(WVJBIframe);
|
|
315
|
+
setTimeout(function () {
|
|
316
|
+
document.documentElement.removeChild(WVJBIframe);
|
|
317
|
+
}, 0);
|
|
318
|
+
} else if (android) {
|
|
319
|
+
// 旧版本兼容Android
|
|
320
|
+
if (window.WebViewJavascriptBridge) {
|
|
321
|
+
__cb___(init(WebViewJavascriptBridge));
|
|
322
|
+
} else {
|
|
323
|
+
document.addEventListener('WebViewJavascriptBridgeReady', function () {
|
|
324
|
+
// 以异步形式加载
|
|
325
|
+
__cb___(init(WebViewJavascriptBridge));
|
|
326
|
+
}, false);
|
|
327
|
+
}
|
|
328
|
+
} else {
|
|
329
|
+
__cb___();
|
|
330
|
+
}
|
|
331
|
+
} else {
|
|
332
|
+
__cb___();
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
// 空函数
|
|
337
|
+
var noop = function noop() {};
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* 成功消息体的包装
|
|
341
|
+
* @param payload 成功对象
|
|
342
|
+
*/
|
|
343
|
+
// const wrapOkPayload = (payload = {}) => ({
|
|
344
|
+
// error: false,
|
|
345
|
+
// info: 'ok',
|
|
346
|
+
// payload: payload,
|
|
347
|
+
// })
|
|
348
|
+
var wrapOkPayload = function wrapOkPayload() {
|
|
349
|
+
var payload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
350
|
+
return payload;
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* 失败消息体的包装
|
|
355
|
+
* @param info 错误描述
|
|
356
|
+
*/
|
|
357
|
+
var wrapNotOkPayload = function wrapNotOkPayload() {
|
|
358
|
+
var code = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
359
|
+
var info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'error';
|
|
360
|
+
return {
|
|
361
|
+
// error: true,
|
|
362
|
+
code: code,
|
|
363
|
+
info: info
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* APP WebView后退,后退到栈的最外层
|
|
369
|
+
* v2.2.0 - 已兼容鸿蒙
|
|
370
|
+
*
|
|
371
|
+
* @param options
|
|
372
|
+
*/
|
|
373
|
+
var onBack = function onBack(options) {
|
|
374
|
+
// 默认配置
|
|
375
|
+
var _options = {
|
|
376
|
+
complete: noop
|
|
377
|
+
};
|
|
378
|
+
// 复制
|
|
379
|
+
_options = (0, _util._extends)({}, _options, options);
|
|
380
|
+
|
|
381
|
+
(0, _log.log)('onBack->' + JSON.stringify(_options));
|
|
382
|
+
if (isFromHarmonyOS) {
|
|
383
|
+
window.LightSDK.native.back({
|
|
384
|
+
number: _options.step
|
|
385
|
+
}, function (resp) {
|
|
386
|
+
(0, _log.log)('onBack <- ' + JSON.stringify(resp));
|
|
387
|
+
});
|
|
388
|
+
} else {
|
|
389
|
+
WebViewJavascriptBridge.callHandler('back', _options, function (response) {
|
|
390
|
+
(0, _log.log)('onBack <-' + JSON.stringify(response));
|
|
391
|
+
_options.complete(response);
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* APP WebView刷新
|
|
398
|
+
* v2.2.0 - 已兼容鸿蒙
|
|
399
|
+
*
|
|
400
|
+
* @param options
|
|
401
|
+
*/
|
|
402
|
+
var onRefresh = function onRefresh(options) {
|
|
403
|
+
var _options = {
|
|
404
|
+
complete: noop
|
|
405
|
+
};
|
|
406
|
+
_options = (0, _util._extends)({}, _options, options);
|
|
407
|
+
|
|
408
|
+
(0, _log.log)('onRefresh->' + JSON.stringify(_options));
|
|
409
|
+
if (isFromHarmonyOS) {
|
|
410
|
+
location.reload();
|
|
411
|
+
} else {
|
|
412
|
+
WebViewJavascriptBridge.callHandler('refresh', _options, function (response) {
|
|
413
|
+
(0, _log.log)('onRefresh<-' + JSON.stringify(response));
|
|
414
|
+
_options.complete(response);
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* 设置原生导航条
|
|
421
|
+
* v2.2.0 - 已兼容鸿蒙
|
|
422
|
+
*
|
|
423
|
+
* @param options
|
|
424
|
+
* {
|
|
425
|
+
* "title": "xxxxx",
|
|
426
|
+
* "type": "0" // 0-默认 1-切换类
|
|
427
|
+
* }
|
|
428
|
+
*/
|
|
429
|
+
var onNavigationBar = function onNavigationBar(options) {
|
|
430
|
+
var _options = {
|
|
431
|
+
complete: noop
|
|
432
|
+
};
|
|
433
|
+
_options = (0, _util._extends)({}, _options, options);
|
|
434
|
+
|
|
435
|
+
(0, _log.log)('onNavigationBar->' + JSON.stringify(_options));
|
|
436
|
+
if (isFromHarmonyOS) {
|
|
437
|
+
// 设置导航标题
|
|
438
|
+
if (window.LightSDK.native.setTitle && !!_options.title) {
|
|
439
|
+
(0, _log.log)('[Harmony setTitle] -> ' + JSON.stringify(_options));
|
|
440
|
+
window.LightSDK.native.setTitle({
|
|
441
|
+
"title": _options.title
|
|
442
|
+
}, function (resp) {
|
|
443
|
+
(0, _log.log)('[Harmony setTitle] <- ' + JSON.stringify(resp));
|
|
444
|
+
});
|
|
445
|
+
} else {
|
|
446
|
+
console.error("[Harmony setTitle] LightSDK or setTitle is not available");
|
|
447
|
+
}
|
|
448
|
+
// 清空右侧按钮
|
|
449
|
+
if (window.LightSDK.native.removeButton) {
|
|
450
|
+
(0, _log.log)('[Harmony removeButton] -> ');
|
|
451
|
+
window.LightSDK.native.removeButton({
|
|
452
|
+
"position": "right"
|
|
453
|
+
}, function (resp) {
|
|
454
|
+
(0, _log.log)('[Harmony removeButton] <- ' + JSON.stringify(resp));
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
// 设置右侧按钮
|
|
458
|
+
if (window.LightSDK.native.addButton && (!!_options.rightButtonTitle || !!_options.rightButtonIcon)) {
|
|
459
|
+
(0, _log.log)('[Harmony addButton] -> ');
|
|
460
|
+
// 两者不可兼得
|
|
461
|
+
if (!!_options.rightButtonIcon) {
|
|
462
|
+
_options.rightButtonIcon = "base64://" + _options.rightButtonIcon;
|
|
463
|
+
_options.rightButtonTitle = "";
|
|
464
|
+
}
|
|
465
|
+
if (!!_options.rightButtonTitle) {
|
|
466
|
+
_options.rightButtonIcon = "";
|
|
467
|
+
}
|
|
468
|
+
window.LightSDK.native.addButton({
|
|
469
|
+
"title": _options.rightButtonTitle,
|
|
470
|
+
"icon": _options.rightButtonIcon,
|
|
471
|
+
"position": "right",
|
|
472
|
+
"action": _options.onRightButtonPress
|
|
473
|
+
}, function (resp) {
|
|
474
|
+
(0, _log.log)('[Harmony addButton] <- ' + JSON.stringify(resp));
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
} else {
|
|
478
|
+
WebViewJavascriptBridge.callHandler('navigationBar', _options, function (response) {
|
|
479
|
+
(0, _log.log)('onNavigationBar<-' + JSON.stringify(response));
|
|
480
|
+
_options.complete(response);
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* 打开一个新的webview
|
|
487
|
+
* v2.2.0 - 已兼容鸿蒙
|
|
488
|
+
*
|
|
489
|
+
* @param options
|
|
490
|
+
* {
|
|
491
|
+
* "title": "xxxxx", // 导航名称,如果html设置title,以html为主
|
|
492
|
+
* "uri": "xxxxxxx", // webview请求的路由地址,目前只支持http协议,今后可支持shema协议
|
|
493
|
+
* "locktype": 0, // 0-不需要手势密码;1-手势密码锁屏;2-资金账号锁屏;
|
|
494
|
+
* }
|
|
495
|
+
*/
|
|
496
|
+
var onPushView = function onPushView(options) {
|
|
497
|
+
var _options = {
|
|
498
|
+
title: '',
|
|
499
|
+
isFullScreen: false,
|
|
500
|
+
isStatusBarLight: true,
|
|
501
|
+
ver: 'v1'
|
|
502
|
+
};
|
|
503
|
+
_options = (0, _util._extends)({}, _options, options);
|
|
504
|
+
if (_options.isFullScreen == true) {
|
|
505
|
+
_options.ver = 'v2';
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
if (!!_options.uri) {
|
|
509
|
+
if (_options.uri.indexOf('http') != -1 || _options.uri.indexOf('https') != -1) {} else {
|
|
510
|
+
_options.uri = (0, _util.getAbsoluteUrl)(_options.uri);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
if (isFromHarmonyOS) {
|
|
515
|
+
_options.url = _options.uri;
|
|
516
|
+
(0, _log.log)('onPushView->' + JSON.stringify(_options));
|
|
517
|
+
window.LightSDK.native.callNative("winner_base.router", _options, function (response) {
|
|
518
|
+
(0, _log.log)('onPushView <-' + JSON.stringify(response));
|
|
519
|
+
});
|
|
520
|
+
} else {
|
|
521
|
+
(0, _log.log)('onPushView->' + JSON.stringify(_options));
|
|
522
|
+
WebViewJavascriptBridge.callHandler('pushView', _options, function (response) {
|
|
523
|
+
(0, _log.log)('onPushView <-' + JSON.stringify(response));
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* 原生页面将要出现时触发的事件
|
|
530
|
+
* v2.2.0 - 已兼容鸿蒙
|
|
531
|
+
* @param callback
|
|
532
|
+
*/
|
|
533
|
+
var pageWillAppear = function pageWillAppear(callback) {
|
|
534
|
+
if (typeof callback == 'function') if (isFromHarmonyOS) {
|
|
535
|
+
window.LightSDK.event.on("viewappear", function () {
|
|
536
|
+
(0, _log.log)('pageWillAppear 被回调');
|
|
537
|
+
if (typeof callback == 'function') {
|
|
538
|
+
callback();
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
} else {
|
|
542
|
+
WebViewJavascriptBridge.registerHandler("pageWillAppear", callback);
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* H5发送通知给客户端
|
|
548
|
+
* TODO 未兼容鸿蒙
|
|
549
|
+
*
|
|
550
|
+
* @param options
|
|
551
|
+
*/
|
|
552
|
+
var onNotify = function onNotify(options) {
|
|
553
|
+
var _options = {
|
|
554
|
+
type: 'javascriptNotify'
|
|
555
|
+
};
|
|
556
|
+
_options = (0, _util._extends)({}, _options, options);
|
|
557
|
+
|
|
558
|
+
(0, _log.log)('onNotify->' + JSON.stringify(_options));
|
|
559
|
+
if (isFromHarmonyOS) {
|
|
560
|
+
// TODO Harmony 暂未实现
|
|
561
|
+
// if(HmJsBridge.willAppear) {
|
|
562
|
+
// HmJsBridge.notify(_options);
|
|
563
|
+
// }
|
|
564
|
+
console.warn('onNotify Harmony 暂未实现');
|
|
565
|
+
} else {
|
|
566
|
+
WebViewJavascriptBridge.callHandler('notify', _options, function (response) {
|
|
567
|
+
(0, _log.log)('onNotify<-' + JSON.stringify(response));
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* H5注册通知,由客户端进行通知
|
|
574
|
+
* TODO 未兼容鸿蒙
|
|
575
|
+
*
|
|
576
|
+
* @param type 事件类型名称
|
|
577
|
+
* @param callback 回调处理
|
|
578
|
+
*/
|
|
579
|
+
var notifyQueue = {};
|
|
580
|
+
var subscribeNotify = function subscribeNotify(type, callback) {
|
|
581
|
+
if (typeof callback == 'function') {
|
|
582
|
+
//回调函数存在队列中
|
|
583
|
+
var _type = type;
|
|
584
|
+
// sae_video: v3思迪视频见证订阅事件名
|
|
585
|
+
// result_video: v5思迪视频见证订阅事件名(2025-05-30Added)
|
|
586
|
+
if (_type == 'sae_video' || _type == 'result_video') {
|
|
587
|
+
_type = 'notify';
|
|
588
|
+
}
|
|
589
|
+
notifyQueue[_type] = callback;
|
|
590
|
+
|
|
591
|
+
(0, _log.log)('subscribeNotify->' + type);
|
|
592
|
+
if (isFromHarmonyOS) {
|
|
593
|
+
// if(HmJsBridge.subscribeNotify) {
|
|
594
|
+
// HmJsBridge.subscribeNotify(_type, data => {
|
|
595
|
+
// log('subscribeNotify<-' + JSON.stringify(data))
|
|
596
|
+
// // //获取data.type才是H5定义的type
|
|
597
|
+
// if (Object.prototype.toString.call(data).toLocaleLowerCase() == '[object String]'.toLocaleLowerCase()) {
|
|
598
|
+
// data = JSON.parse(data);
|
|
599
|
+
// }
|
|
600
|
+
// if (notifyQueue[_type]) {
|
|
601
|
+
// notifyQueue[_type](data);
|
|
602
|
+
// }
|
|
603
|
+
// });
|
|
604
|
+
// }
|
|
605
|
+
console.warn('subscribeNotify Harmony 暂未实现');
|
|
606
|
+
} else {
|
|
607
|
+
WebViewJavascriptBridge.registerHandler(_type, function (data) {
|
|
608
|
+
(0, _log.log)('subscribeNotify<-' + JSON.stringify(data));
|
|
609
|
+
// 获取data.type才是H5定义的type
|
|
610
|
+
if (Object.prototype.toString.call(data).toLocaleLowerCase() == '[object String]'.toLocaleLowerCase()) {
|
|
611
|
+
data = JSON.parse(data);
|
|
612
|
+
}
|
|
613
|
+
// 2025-05-30Added:针对5.0视频见证的输出对象payload对安卓端进行Object转换的兼容处理
|
|
614
|
+
if (type == 'result_video' && data.payload) {
|
|
615
|
+
if (Object.prototype.toString.call(data.payload).toLocaleLowerCase() == '[object String]'.toLocaleLowerCase()) {
|
|
616
|
+
data.payload = JSON.parse(data.payload);
|
|
617
|
+
}
|
|
618
|
+
// 兼容代码:处理iOS和安卓端返回结构不同的兼容
|
|
619
|
+
if (ipad || iphone || ipod) {
|
|
620
|
+
data.payload = _extends2({}, data.payload.params);
|
|
621
|
+
}
|
|
622
|
+
// 如有驳回样本结果返回,则生成扁平化数组reject_reasons
|
|
623
|
+
var rejectReasons = [];
|
|
624
|
+
if (data.payload.result && data.payload.result.length) {
|
|
625
|
+
// //var rejectReasonSample = [{fields: ["wt_witness_video_reject"], reasons: ["无法接收您的声音或画面,请您确认设备权限后重新连接;目前您的网络环境不太好,请您切换流量和无线网,确定网络环境正常后重新连接"], step: "witness_video", reasontitle: ["无法接收您的声音或画面,请您确认设备权限后重新连接;目前您的网络环境不太好,请您切换流量和无线网,确定网络环境正常后重新连接"]}];
|
|
626
|
+
var rejectReasonSample = data.payload.result;
|
|
627
|
+
rejectReasonSample.forEach(function (fieldElement) {
|
|
628
|
+
if (fieldElement.reasons && Object.prototype.toString.call(fieldElement.reasons) == "[object Array]") {
|
|
629
|
+
rejectReasons = rejectReasons.concat(fieldElement.reasons);
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
data.payload.reject_reasons = rejectReasons.reduce(function (acc, item) {
|
|
634
|
+
return acc.concat(item.split(";"));
|
|
635
|
+
}, []);
|
|
636
|
+
}
|
|
637
|
+
if (notifyQueue[_type]) {
|
|
638
|
+
if (android) {
|
|
639
|
+
// 解决安卓端request=1会调用type=notify的问题
|
|
640
|
+
if (data.type == 'sae_video' || data.type == 'result_video') {
|
|
641
|
+
(0, _log.log)('安卓notify被调用.');
|
|
642
|
+
notifyQueue['notify'](data);
|
|
643
|
+
} else if (data.type == _type) {
|
|
644
|
+
(0, _log.log)('\u5B89\u5353' + data.type + '\u88AB\u8C03\u7528!');
|
|
645
|
+
notifyQueue[_type](data);
|
|
646
|
+
}
|
|
647
|
+
} else {
|
|
648
|
+
(0, _log.log)('iOS notify被调用;');
|
|
649
|
+
notifyQueue[_type](data);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* 调用Schema Url
|
|
659
|
+
* v2.2.0 - 已兼容鸿蒙
|
|
660
|
+
*
|
|
661
|
+
* @param options
|
|
662
|
+
*/
|
|
663
|
+
var onDynamicLink = function onDynamicLink(options) {
|
|
664
|
+
var _options = {
|
|
665
|
+
url: ''
|
|
666
|
+
};
|
|
667
|
+
_options = (0, _util._extends)({}, _options, options);
|
|
668
|
+
|
|
669
|
+
(0, _log.log)('onDynamicLink->' + JSON.stringify(_options));
|
|
670
|
+
if (isFromHarmonyOS) {
|
|
671
|
+
location.href = _options.url;
|
|
672
|
+
} else {
|
|
673
|
+
var $versionCompare = (0, _version.compareVersion)('5.22.2');
|
|
674
|
+
// 小于5.22.2版本不再支持拉起视频见证,提示升级
|
|
675
|
+
if ($versionCompare < 0 && _options.url.indexOf('dl/videoreview') != -1) {
|
|
676
|
+
alert("您当前的APP版本过低,请升级至V5.22.2以上版本后,再进行使用");
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
WebViewJavascriptBridge.callHandler('dynamicLink', _options, function (response) {
|
|
680
|
+
(0, _log.log)('onDynamicLink<-' + JSON.stringify(response));
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
// 存储Request指令订阅Handlers
|
|
686
|
+
var requestHandlerMap = {};
|
|
687
|
+
// 是否注册了Request指令订阅Handlers
|
|
688
|
+
var requestHandlerRegisterFlag = false;
|
|
689
|
+
// 生成从minNum到maxNum的随机数,防 callback 重患
|
|
690
|
+
var randomNum = function randomNum(minNum, maxNum) {
|
|
691
|
+
switch (arguments.length) {
|
|
692
|
+
case 1:
|
|
693
|
+
return parseInt(Math.random() * minNum + 1, 10);
|
|
694
|
+
break;
|
|
695
|
+
case 2:
|
|
696
|
+
return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
|
|
697
|
+
//或者 Math.floor(Math.random()*( maxNum - minNum + 1 ) + minNum );
|
|
698
|
+
break;
|
|
699
|
+
default:
|
|
700
|
+
return 0;
|
|
701
|
+
break;
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
var callbackIds = [];
|
|
705
|
+
var generateCallbackId = function generateCallbackId() {
|
|
706
|
+
var callbackId = randomNum(1000, 9999);
|
|
707
|
+
if (callbackIds.indexOf(callbackId) !== -1) {
|
|
708
|
+
return generateCallbackId(callbackId);
|
|
709
|
+
} else {
|
|
710
|
+
callbackIds.push(callbackId);
|
|
711
|
+
}
|
|
712
|
+
return callbackId;
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* 调用Request指令(通常作用在一些原生和客户端之间比较特殊的操作)
|
|
717
|
+
* 未兼容鸿蒙
|
|
718
|
+
*
|
|
719
|
+
* @param operationType 操作指令(见文档)
|
|
720
|
+
* @param payloadOptions 消息体结构
|
|
721
|
+
*/
|
|
722
|
+
var onRequest = function onRequest(operationType, payloadOptions, okCallBack, notOkCallBack) {
|
|
723
|
+
var _options = {
|
|
724
|
+
type: !operationType ? '1' : operationType,
|
|
725
|
+
payload: !payloadOptions ? {} : payloadOptions,
|
|
726
|
+
callbackId: generateCallbackId()
|
|
727
|
+
// 兼容老方案
|
|
728
|
+
};requestHandlerMap[operationType + '-ok'] = typeof okCallBack === 'function' ? okCallBack : noop;
|
|
729
|
+
requestHandlerMap[operationType + '-notok'] = typeof notOkCallBack === 'function' ? notOkCallBack : noop;
|
|
730
|
+
// 2020-5-2:修复 callback 在队列中重复的致命缺陷
|
|
731
|
+
requestHandlerMap[operationType + '_' + _options.callbackId + '-ok'] = typeof okCallBack === 'function' ? okCallBack : noop;
|
|
732
|
+
requestHandlerMap[operationType + '_' + _options.callbackId + '-notok'] = typeof notOkCallBack === 'function' ? notOkCallBack : noop;
|
|
733
|
+
|
|
734
|
+
// 鸿蒙处理
|
|
735
|
+
if (isFromHarmonyOS) {
|
|
736
|
+
// TODO 待实现鸿蒙
|
|
737
|
+
// if(HmJsBridge.request) {
|
|
738
|
+
// HmJsBridge.request(_options, function(response){
|
|
739
|
+
// if (typeof response == 'string') {
|
|
740
|
+
// response = JSON.parse(response);
|
|
741
|
+
// }
|
|
742
|
+
|
|
743
|
+
// // log('onRequest<-' + JSON.stringify(response))
|
|
744
|
+
// if (response.error || response.error === 'true') {
|
|
745
|
+
// if (response.callbackId && typeof requestHandlerMap[response.type + '_' + response.callbackId + '-notok'] === 'function') {
|
|
746
|
+
// requestHandlerMap[response.type + '_' + response.callbackId + '-notok'](wrapNotOkPayload(-1, response.info))
|
|
747
|
+
// }
|
|
748
|
+
// else if (typeof requestHandlerMap[response.type + '-notok'] === 'function') {
|
|
749
|
+
// requestHandlerMap[response.type + '-notok'](wrapNotOkPayload(-1, response.info))
|
|
750
|
+
// }
|
|
751
|
+
// } else {
|
|
752
|
+
// if (response.callbackId && typeof requestHandlerMap[response.type + '_' + response.callbackId + '-ok'] === 'function') {
|
|
753
|
+
// // 防止安卓指令调用成功同步进入的控制
|
|
754
|
+
// if ((ipad || iphone || ipod) || response.payload) {
|
|
755
|
+
// requestHandlerMap[response.type + '_' + response.callbackId + '-ok'](wrapOkPayload(response.payload))
|
|
756
|
+
// }
|
|
757
|
+
// }
|
|
758
|
+
// else if (typeof requestHandlerMap[response.type + '-ok'] === 'function') {
|
|
759
|
+
// // 防止安卓指令调用成功同步进入的控制
|
|
760
|
+
// if ((ipad || iphone || ipod) || response.payload) {
|
|
761
|
+
// requestHandlerMap[response.type + '-ok'](wrapOkPayload(response.payload))
|
|
762
|
+
// }
|
|
763
|
+
// }
|
|
764
|
+
// }
|
|
765
|
+
// });
|
|
766
|
+
// }
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// IOS同步回调处理
|
|
771
|
+
// log('onRequest->' + JSON.stringify(_options))
|
|
772
|
+
WebViewJavascriptBridge.callHandler('request', _options, function (response) {
|
|
773
|
+
|
|
774
|
+
if (typeof response == 'string') {
|
|
775
|
+
response = JSON.parse(response);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
// log('onRequest<-' + JSON.stringify(response))
|
|
779
|
+
if (response.error || response.error === 'true') {
|
|
780
|
+
if (response.callbackId && typeof requestHandlerMap[response.type + '_' + response.callbackId + '-notok'] === 'function') {
|
|
781
|
+
requestHandlerMap[response.type + '_' + response.callbackId + '-notok'](wrapNotOkPayload(-1, response.info));
|
|
782
|
+
} else if (typeof requestHandlerMap[response.type + '-notok'] === 'function') {
|
|
783
|
+
requestHandlerMap[response.type + '-notok'](wrapNotOkPayload(-1, response.info));
|
|
784
|
+
}
|
|
785
|
+
} else {
|
|
786
|
+
if (response.callbackId && typeof requestHandlerMap[response.type + '_' + response.callbackId + '-ok'] === 'function') {
|
|
787
|
+
// 防止安卓指令调用成功同步进入的控制
|
|
788
|
+
if (ipad || iphone || ipod || response.payload) {
|
|
789
|
+
requestHandlerMap[response.type + '_' + response.callbackId + '-ok'](wrapOkPayload(response.payload));
|
|
790
|
+
}
|
|
791
|
+
} else if (typeof requestHandlerMap[response.type + '-ok'] === 'function') {
|
|
792
|
+
// 防止安卓指令调用成功同步进入的控制
|
|
793
|
+
if (ipad || iphone || ipod || response.payload) {
|
|
794
|
+
requestHandlerMap[response.type + '-ok'](wrapOkPayload(response.payload));
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
if (!requestHandlerRegisterFlag) {
|
|
801
|
+
// Android异步回调处理
|
|
802
|
+
WebViewJavascriptBridge.registerHandler('request', function (response) {
|
|
803
|
+
|
|
804
|
+
if (typeof response == 'string') {
|
|
805
|
+
response = JSON.parse(response);
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
if (response.error || response.error === 'true') {
|
|
809
|
+
if (response.callbackId && typeof requestHandlerMap[response.type + '_' + response.callbackId + '-notok'] === 'function') {
|
|
810
|
+
requestHandlerMap[response.type + '_' + response.callbackId + '-notok'](wrapNotOkPayload(-1, response.info));
|
|
811
|
+
} else if (typeof requestHandlerMap[response.type + '-notok'] === 'function') {
|
|
812
|
+
requestHandlerMap[response.type + '-notok'](wrapNotOkPayload(-1, response.info));
|
|
813
|
+
}
|
|
814
|
+
} else {
|
|
815
|
+
if (response.callbackId && typeof requestHandlerMap[response.type + '_' + response.callbackId + '-ok'] === 'function') {
|
|
816
|
+
requestHandlerMap[response.type + '_' + response.callbackId + '-ok'](wrapOkPayload(response.payload));
|
|
817
|
+
} else if (typeof requestHandlerMap[response.type + '-ok'] === 'function') {
|
|
818
|
+
requestHandlerMap[response.type + '-ok'](wrapOkPayload(response.payload));
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
});
|
|
822
|
+
requestHandlerRegisterFlag = true;
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* 提供给第三方调用中台接口的函数
|
|
828
|
+
* @param functionNo 中台功能号
|
|
829
|
+
* @param payloadOptions 中台消息体
|
|
830
|
+
* @param okCallBack 成功回调函数
|
|
831
|
+
* @param notOkCallBack 失败回调函数
|
|
832
|
+
*/
|
|
833
|
+
var onApiRequest = function onApiRequest(functionNo, payloadOptions, okCallBack, notOkCallBack) {
|
|
834
|
+
|
|
835
|
+
if ((0, _util.isEmpty)(functionNo)) {
|
|
836
|
+
throw new Error('functionNo is required ...');
|
|
837
|
+
} else {
|
|
838
|
+
var _options = {
|
|
839
|
+
funcId: functionNo,
|
|
840
|
+
payload: !payloadOptions ? {} : payloadOptions
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
(0, _log.log)('onApiRequest->' + JSON.stringify(_options));
|
|
845
|
+
if (isFromHarmonyOS) {
|
|
846
|
+
console.warn('onApiRequest Harmony 暂未实现');
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
WebViewJavascriptBridge.callHandler('apiRequest', _options, function (response) {
|
|
850
|
+
(0, _log.log)('onApiRequest<-' + JSON.stringify(response));
|
|
851
|
+
|
|
852
|
+
if (typeof response == 'string') {
|
|
853
|
+
response = JSON.parse(response);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
// 2017-12-26:对脚本逻辑做兼容,IOS认为业务异常和系统异常response.error都是true,ANDROID认为业务异常和业务成功时response.error是false,而系统异常response.error是true
|
|
857
|
+
|
|
858
|
+
// IOS认为业务异常和系统异常response.error都是true,业务成功response.error是false
|
|
859
|
+
if (ipad || iphone || ipod) {
|
|
860
|
+
|
|
861
|
+
if (response.error || response.error === 'true') {
|
|
862
|
+
// 接口业务异常
|
|
863
|
+
if (response.payload) {
|
|
864
|
+
if (typeof notOkCallBack === 'function') {
|
|
865
|
+
notOkCallBack(wrapNotOkPayload(response.payload.code, response.payload.info));
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
// 客户端自身应用级别错误(ios不给payload字段)
|
|
869
|
+
else {
|
|
870
|
+
if (typeof notOkCallBack === 'function') {
|
|
871
|
+
notOkCallBack(wrapNotOkPayload(-1, response.info));
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
} else {
|
|
875
|
+
if (typeof okCallBack === 'function') {
|
|
876
|
+
var re = {};
|
|
877
|
+
if (response.payload) {
|
|
878
|
+
if (typeof response.payload.data == 'string') {
|
|
879
|
+
re = JSON.parse(response.payload.data);
|
|
880
|
+
} else {
|
|
881
|
+
re = response.payload.data;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
okCallBack(wrapOkPayload(re));
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
// ANDROID认为业务异常和业务成功时response.error是false,而系统异常response.error是true
|
|
890
|
+
else {
|
|
891
|
+
|
|
892
|
+
if (response.error || response.error === 'true') {
|
|
893
|
+
if (typeof notOkCallBack === 'function') {
|
|
894
|
+
notOkCallBack(wrapNotOkPayload(-1, response.info));
|
|
895
|
+
}
|
|
896
|
+
} else {
|
|
897
|
+
var _re = {};
|
|
898
|
+
if (typeof response.payload.data == 'string') {
|
|
899
|
+
_re = JSON.parse(response.payload.data);
|
|
900
|
+
} else {
|
|
901
|
+
_re = response.payload.data ? response.payload.data : {};
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
// 业务异常
|
|
905
|
+
if (response.payload.code != '0') {
|
|
906
|
+
if (typeof notOkCallBack === 'function') {
|
|
907
|
+
notOkCallBack(wrapNotOkPayload(response.payload.code, response.payload.info));
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
// 业务成功
|
|
911
|
+
else {
|
|
912
|
+
if (typeof okCallBack === 'function') {
|
|
913
|
+
okCallBack(wrapOkPayload(_re));
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
});
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
exports.wrapOkPayload = wrapOkPayload;
|
|
922
|
+
exports.wrapNotOkPayload = wrapNotOkPayload;
|
|
923
|
+
exports.ready = ready;
|
|
924
|
+
exports.onBack = onBack;
|
|
925
|
+
exports.onRefresh = onRefresh;
|
|
926
|
+
exports.onNavigationBar = onNavigationBar;
|
|
927
|
+
exports.onPushView = onPushView;
|
|
928
|
+
exports.onNotify = onNotify;
|
|
929
|
+
exports.subscribeNotify = subscribeNotify;
|
|
930
|
+
exports.onDynamicLink = onDynamicLink;
|
|
931
|
+
exports.onRequest = onRequest;
|
|
932
|
+
exports.pageWillAppear = pageWillAppear;
|
|
933
|
+
exports.onApiRequest = onApiRequest;
|
|
934
|
+
|
|
935
|
+
/***/ }),
|
|
936
|
+
|
|
937
|
+
/***/ 9:
|
|
938
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
939
|
+
|
|
940
|
+
"use strict";
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
Object.defineProperty(exports, "__esModule", {
|
|
944
|
+
value: true
|
|
945
|
+
});
|
|
946
|
+
/*
|
|
947
|
+
* @Author: shenzhiwei
|
|
948
|
+
* @Date: 2020-07-07 15:24:48
|
|
949
|
+
* @Company: orientsec.com.cn
|
|
950
|
+
* @Description: 日志工具类
|
|
951
|
+
*/
|
|
952
|
+
// 私有函数:日志时间戳
|
|
953
|
+
var _getNowTime = function _getNowTime() {
|
|
954
|
+
var date = new Date();
|
|
955
|
+
var _date = date.getDate();
|
|
956
|
+
var hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
|
957
|
+
var minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
|
958
|
+
var second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
|
959
|
+
var milliSeconds = date.getMilliseconds();
|
|
960
|
+
var currentTime = hour + ":" + minute + ":" + second + "." + milliSeconds;
|
|
961
|
+
return currentTime;
|
|
962
|
+
};
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* 普通日志输出(带醒目样式效果)
|
|
966
|
+
* @param {*} info 日志内容
|
|
967
|
+
*/
|
|
968
|
+
var log = function log(info) {
|
|
969
|
+
if (info) {
|
|
970
|
+
info = _getNowTime() + "[赢家]: " + info;
|
|
971
|
+
console.log("%c " + info, "padding: 0.5px 8px 0.5px 1px; border-radius: 2px; background: black; color: yellow");
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* 错误日志输出(带醒目样式效果)
|
|
977
|
+
* @param {*} info 日志内容
|
|
978
|
+
*/
|
|
979
|
+
var errorlog = function errorlog(info) {
|
|
980
|
+
if (info) {
|
|
981
|
+
info = _getNowTime() + "[赢家]: " + info;
|
|
982
|
+
console.log("%c " + info, "padding: 0.5px 8px 0.5px 1px; border-radius: 2px; background: red; color: white");
|
|
983
|
+
}
|
|
984
|
+
};
|
|
985
|
+
|
|
986
|
+
exports.log = log;
|
|
987
|
+
exports.errorlog = errorlog;
|
|
988
|
+
|
|
989
|
+
/***/ })
|
|
990
|
+
|
|
991
|
+
/******/ });
|
|
992
|
+
});
|