xxb-ui
Version:
A mobile terminal UI component library based on vue2.x
2 lines • 3.38 kB
JavaScript
/*! xxb-ui v1.0.33 by XuGang (c) 2020 Licensed MIT */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("xxb-ui",[],t):"object"==typeof exports?exports["xxb-ui"]=t():e["xxb-ui"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(i[n])return i[n].exports;var o=i[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var i={};return t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=170)}({170:function(e,t,i){"use strict";var n;!function(o){function r(e){this._initial(e)}r.prototype={constructor:this,identifyStatus:!1,_initial:function(e){e&&e.appid&&e.secret?(console.log("appid 和 secret 校验通过"),this.identifyStatus=!0):(console.warn("暂无参数"),this.identifyStatus=!1)},getBrowser:function(e){if(this.identifyStatus){var t=navigator.userAgent,i=t.indexOf("Android")>-1||t.indexOf("Adr")>-1,n=!!t.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);if(i)return"isAndroid";if(n)return"isiOS"}},getUserTokenFromApp:function(e){if(this.identifyStatus){var t=this.getBrowser();if("isiOS"==t){!function(e){if(window.WebViewJavascriptBridge)return e(WebViewJavascriptBridge);if(window.WVJBCallbacks)return window.WVJBCallbacks.push(e);window.WVJBCallbacks=[e];var t=document.createElement("iframe");t.style.display="none",t.src="wvjbscheme://__BRIDGE_LOADED__",document.documentElement.appendChild(t),setTimeout(function(){document.documentElement.removeChild(t)},0)}(function(t){t.callHandler("getUserTokenFromApp",function(t){if(!e||"function"!=typeof e)return t;e(t)})})}else if("isAndroid"==t){var i=window.AndroidWebView.getUserTokenFromApp();if(!e||"function"!=typeof e)return i;e(i)}}},callTokenLostToApp:function(){var e=this.getBrowser();"isiOS"==e?window.webkit.messageHandlers.tokenExpiredTransmit.postMessage(1):"isAndroid"==e&&window.tokenExpiredTransmit.jsMethod(1)},callAppShare:function(e,t){var i=this.getBrowser(),n=JSON.stringify(e);"isiOS"==i?window.webkit.messageHandlers.shareFromWeb.postMessage(n):"isAndroid"==i&&window.shareFromWeb.jsMethod(n),t&&"function"==typeof t&&t()},getSystemInfoFromApp:function(e){var t=this.getBrowser();if("isiOS"==t){!function(e){if(window.WebViewJavascriptBridge)return e(WebViewJavascriptBridge);if(window.WVJBCallbacks)return window.WVJBCallbacks.push(e);window.WVJBCallbacks=[e];var t=document.createElement("iframe");t.style.display="none",t.src="wvjbscheme://__BRIDGE_LOADED__",document.documentElement.appendChild(t),setTimeout(function(){document.documentElement.removeChild(t)},0)}(function(t){t.callHandler("getSystemInfoFromApp",function(t){if(!e||"function"!=typeof e)return t;e(t)})})}else if("isAndroid"==t){var i=window.AndroidWebView.getSystemInfoFromApp();if(!e||"function"!=typeof e)return i;e(i)}},callClosePageToApp:function(e){var t=this.getBrowser();"isiOS"==t?window.webkit.messageHandlers.closePage.postMessage(1):"isAndroid"==t&&window.AndroidWebView.closePage()}},function(){this||(0,eval)("this")}(),void 0!==e&&e.exports?e.exports=r:void 0!==(n=function(){return r}.call(t,i,t,e))&&(e.exports=n)}()}})});