UNPKG

expand-test

Version:

ceshi

1,658 lines (1,427 loc) 362 kB
"use weex:vue"; /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /*!*************************************************************************!*\ !*** E:/workspace/expand-test/main.js?{"page":"pages%2Findex%2Findex"} ***! \*************************************************************************/ /*! no exports provided */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _dcloudio_uni_stat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @dcloudio/uni-stat */ 1); /* harmony import */ var _dcloudio_uni_stat__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_dcloudio_uni_stat__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var uni_app_style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uni-app-style */ 6); /* harmony import */ var uni_app_style__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(uni_app_style__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _pages_index_index_nvue_mpType_page__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pages/index/index.nvue?mpType=page */ 9); _pages_index_index_nvue_mpType_page__WEBPACK_IMPORTED_MODULE_2__["default"].mpType = 'page' _pages_index_index_nvue_mpType_page__WEBPACK_IMPORTED_MODULE_2__["default"].route = 'pages/index/index' _pages_index_index_nvue_mpType_page__WEBPACK_IMPORTED_MODULE_2__["default"].el = '#root' new Vue(_pages_index_index_nvue_mpType_page__WEBPACK_IMPORTED_MODULE_2__["default"]) /***/ }), /* 1 */ /*!*******************************************************!*\ !*** ./node_modules/@dcloudio/uni-stat/dist/index.js ***! \*******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(plus, uni) {var _package = __webpack_require__(/*! ../package.json */ 3);function _possibleConstructorReturn(self, call) {if (call && (typeof call === "object" || typeof call === "function")) {return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;} var STAT_VERSION = _package.version; var STAT_URL = 'https://tongji.dcloud.io/uni/stat'; var STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif'; var PAGE_PVER_TIME = 1800; var APP_PVER_TIME = 300; var OPERATING_TIME = 10; var UUID_KEY = '__DC_STAT_UUID'; var UUID_VALUE = '__DC_UUID_VALUE'; function getUuid() { var uuid = ''; if (getPlatformName() === 'n') { try { uuid = plus.runtime.getDCloudId(); } catch (e) { uuid = ''; } return uuid; } try { uuid = uni.getStorageSync(UUID_KEY); } catch (e) { uuid = UUID_VALUE; } if (!uuid) { uuid = Date.now() + '' + Math.floor(Math.random() * 1e7); try { uni.setStorageSync(UUID_KEY, uuid); } catch (e) { uni.setStorageSync(UUID_KEY, UUID_VALUE); } } return uuid; } var getSgin = function getSgin(statData) { var arr = Object.keys(statData); var sortArr = arr.sort(); var sgin = {}; var sginStr = ''; for (var i in sortArr) { sgin[sortArr[i]] = statData[sortArr[i]]; sginStr += sortArr[i] + '=' + statData[sortArr[i]] + '&'; } // const options = sginStr.substr(0, sginStr.length - 1) // sginStr = sginStr.substr(0, sginStr.length - 1) + '&key=' + STAT_KEY; // const si = crypto.createHash('md5').update(sginStr).digest('hex'); return { sign: '', options: sginStr.substr(0, sginStr.length - 1) }; }; var getSplicing = function getSplicing(data) { var str = ''; for (var i in data) { str += i + '=' + data[i] + '&'; } return str.substr(0, str.length - 1); }; var getTime = function getTime() { return parseInt(new Date().getTime() / 1000); }; var getPlatformName = function getPlatformName() { var platformList = { 'app-plus': 'n', 'h5': 'h5', 'mp-weixin': 'wx', 'mp-alipay': 'ali', 'mp-baidu': 'bd', 'mp-toutiao': 'tt', 'mp-qq': 'qq' }; return platformList["app-plus"]; }; var getPackName = function getPackName() { var packName = ''; if (getPlatformName() === 'wx' || getPlatformName() === 'qq') { // 兼容微信小程序低版本基础库 if (uni.canIUse('getAccountInfoSync')) { packName = uni.getAccountInfoSync().miniProgram.appId || ''; } } return packName; }; var getVersion = function getVersion() { return getPlatformName() === 'n' ? plus.runtime.version : ''; }; var getChannel = function getChannel() { var platformName = getPlatformName(); var channel = ''; if (platformName === 'n') { channel = plus.runtime.channel; } return channel; }; var getScene = function getScene(options) { var platformName = getPlatformName(); var scene = ''; if (options) { return options; } if (platformName === 'wx') { scene = uni.getLaunchOptionsSync().scene; } return scene; }; var First__Visit__Time__KEY = 'First__Visit__Time'; var Last__Visit__Time__KEY = 'Last__Visit__Time'; var getFirstVisitTime = function getFirstVisitTime() { var timeStorge = uni.getStorageSync(First__Visit__Time__KEY); var time = 0; if (timeStorge) { time = timeStorge; } else { time = getTime(); uni.setStorageSync(First__Visit__Time__KEY, time); uni.removeStorageSync(Last__Visit__Time__KEY); } return time; }; var getLastVisitTime = function getLastVisitTime() { var timeStorge = uni.getStorageSync(Last__Visit__Time__KEY); var time = 0; if (timeStorge) { time = timeStorge; } else { time = ''; } uni.setStorageSync(Last__Visit__Time__KEY, getTime()); return time; }; var PAGE_RESIDENCE_TIME = '__page__residence__time'; var First_Page_residence_time = 0; var Last_Page_residence_time = 0; var setPageResidenceTime = function setPageResidenceTime() { First_Page_residence_time = getTime(); if (getPlatformName() === 'n') { uni.setStorageSync(PAGE_RESIDENCE_TIME, getTime()); } return First_Page_residence_time; }; var getPageResidenceTime = function getPageResidenceTime() { Last_Page_residence_time = getTime(); if (getPlatformName() === 'n') { First_Page_residence_time = uni.getStorageSync(PAGE_RESIDENCE_TIME); } return Last_Page_residence_time - First_Page_residence_time; }; var TOTAL__VISIT__COUNT = 'Total__Visit__Count'; var getTotalVisitCount = function getTotalVisitCount() { var timeStorge = uni.getStorageSync(TOTAL__VISIT__COUNT); var count = 1; if (timeStorge) { count = timeStorge; count++; } uni.setStorageSync(TOTAL__VISIT__COUNT, count); return count; }; var GetEncodeURIComponentOptions = function GetEncodeURIComponentOptions(statData) { var data = {}; for (var prop in statData) { data[prop] = encodeURIComponent(statData[prop]); } return data; }; var Set__First__Time = 0; var Set__Last__Time = 0; var getFirstTime = function getFirstTime() { var time = new Date().getTime(); Set__First__Time = time; Set__Last__Time = 0; return time; }; var getLastTime = function getLastTime() { var time = new Date().getTime(); Set__Last__Time = time; return time; }; var getResidenceTime = function getResidenceTime(type) { var residenceTime = 0; if (Set__First__Time !== 0) { residenceTime = Set__Last__Time - Set__First__Time; } residenceTime = parseInt(residenceTime / 1000); residenceTime = residenceTime < 1 ? 1 : residenceTime; if (type === 'app') { var overtime = residenceTime > APP_PVER_TIME ? true : false; return { residenceTime: residenceTime, overtime: overtime }; } if (type === 'page') { var _overtime = residenceTime > PAGE_PVER_TIME ? true : false; return { residenceTime: residenceTime, overtime: _overtime }; } return { residenceTime: residenceTime }; }; var getRoute = function getRoute() { var pages = getCurrentPages(); var page = pages[pages.length - 1]; var _self = page.$vm; if (getPlatformName() === 'bd') { return _self.$mp && _self.$mp.page.is; } else { return _self.$scope && _self.$scope.route || _self.$mp && _self.$mp.page.route; } }; var getPageRoute = function getPageRoute(self) { var pages = getCurrentPages(); var page = pages[pages.length - 1]; var _self = page.$vm; var query = self._query; var str = query && JSON.stringify(query) !== '{}' ? '?' + JSON.stringify(query) : ''; // clear self._query = ''; if (getPlatformName() === 'bd') { return _self.$mp && _self.$mp.page.is + str; } else { return _self.$scope && _self.$scope.route + str || _self.$mp && _self.$mp.page.route + str; } }; var getPageTypes = function getPageTypes(self) { if (self.mpType === 'page' || self.$mp && self.$mp.mpType === 'page' || self.$options.mpType === 'page') { return true; } return false; }; var calibration = function calibration(eventName, options) { // login 、 share 、pay_success 、pay_fail 、register 、title if (!eventName) { console.error("uni.report \u7F3A\u5C11 [eventName] \u53C2\u6570"); return true; } if (typeof eventName !== 'string') { console.error("uni.report [eventName] \u53C2\u6570\u7C7B\u578B\u9519\u8BEF,\u53EA\u80FD\u4E3A String \u7C7B\u578B"); return true; } if (eventName.length > 255) { console.error("uni.report [eventName] \u53C2\u6570\u957F\u5EA6\u4E0D\u80FD\u5927\u4E8E 255"); return true; } if (typeof options !== 'string' && typeof options !== 'object') { console.error("uni.report [options] \u53C2\u6570\u7C7B\u578B\u9519\u8BEF,\u53EA\u80FD\u4E3A String \u6216 Object \u7C7B\u578B"); return true; } if (typeof options === 'string' && options.length > 255) { console.error("uni.report [options] \u53C2\u6570\u957F\u5EA6\u4E0D\u80FD\u5927\u4E8E 255"); return true; } if (eventName === 'title' && typeof options !== 'string') { console.error('uni.report [eventName] 参数为 title 时,[options] 参数只能为 String 类型'); return true; } }; var PagesJson = __webpack_require__(/*! uni-pages?{"type":"style"} */ 4).default; var statConfig = __webpack_require__(/*! uni-stat-config */ 5).default || __webpack_require__(/*! uni-stat-config */ 5); var resultOptions = uni.getSystemInfoSync();var Util = /*#__PURE__*/function () { function Util() {_classCallCheck(this, Util); this.self = ''; this._retry = 0; this._platform = ''; this._query = {}; this._navigationBarTitle = { config: '', page: '', report: '', lt: '' }; this._operatingTime = 0; this._reportingRequestData = { '1': [], '11': [] }; this.__prevent_triggering = false; this.__licationHide = false; this.__licationShow = false; this._lastPageRoute = ''; this.statData = { uuid: getUuid(), ut: getPlatformName(), mpn: getPackName(), ak: statConfig.appid, usv: STAT_VERSION, v: getVersion(), ch: getChannel(), cn: '', pn: '', ct: '', t: getTime(), tt: '', p: resultOptions.platform === 'android' ? 'a' : 'i', brand: resultOptions.brand || '', md: resultOptions.model, sv: resultOptions.system.replace(/(Android|iOS)\s/, ''), mpsdk: resultOptions.SDKVersion || '', mpv: resultOptions.version || '', lang: resultOptions.language, pr: resultOptions.pixelRatio, ww: resultOptions.windowWidth, wh: resultOptions.windowHeight, sw: resultOptions.screenWidth, sh: resultOptions.screenHeight }; }_createClass(Util, [{ key: "_applicationShow", value: function _applicationShow() { if (this.__licationHide) { getLastTime(); var time = getResidenceTime('app'); if (time.overtime) { var options = { path: this._lastPageRoute, scene: this.statData.sc }; this._sendReportRequest(options); } this.__licationHide = false; } } }, { key: "_applicationHide", value: function _applicationHide( self, type) { this.__licationHide = true; getLastTime(); var time = getResidenceTime(); getFirstTime(); var route = getPageRoute(this); this._sendHideRequest({ urlref: route, urlref_ts: time.residenceTime }, type); } }, { key: "_pageShow", value: function _pageShow() { var route = getPageRoute(this); var routepath = getRoute(); this._navigationBarTitle.config = PagesJson && PagesJson.pages[routepath] && PagesJson.pages[routepath].titleNView && PagesJson.pages[routepath].titleNView.titleText || PagesJson && PagesJson.pages[routepath] && PagesJson.pages[routepath].navigationBarTitleText || ''; if (this.__licationShow) { getFirstTime(); this.__licationShow = false; // console.log('这是 onLauch 之后执行的第一次 pageShow ,为下次记录时间做准备'); this._lastPageRoute = route; return; } getLastTime(); this._lastPageRoute = route; var time = getResidenceTime('page'); if (time.overtime) { var options = { path: this._lastPageRoute, scene: this.statData.sc }; this._sendReportRequest(options); } getFirstTime(); } }, { key: "_pageHide", value: function _pageHide() { if (!this.__licationHide) { getLastTime(); var time = getResidenceTime('page'); this._sendPageRequest({ url: this._lastPageRoute, urlref: this._lastPageRoute, urlref_ts: time.residenceTime }); this._navigationBarTitle = { config: '', page: '', report: '', lt: '' }; return; } } }, { key: "_login", value: function _login() { this._sendEventRequest({ key: 'login' }, 0); } }, { key: "_share", value: function _share() { this._sendEventRequest({ key: 'share' }, 0); } }, { key: "_payment", value: function _payment( key) { this._sendEventRequest({ key: key }, 0); } }, { key: "_sendReportRequest", value: function _sendReportRequest( options) { this._navigationBarTitle.lt = '1'; var query = options.query && JSON.stringify(options.query) !== '{}' ? '?' + JSON.stringify(options.query) : ''; this.statData.lt = '1'; this.statData.url = options.path + query || ''; this.statData.t = getTime(); this.statData.sc = getScene(options.scene); this.statData.fvts = getFirstVisitTime(); this.statData.lvts = getLastVisitTime(); this.statData.tvc = getTotalVisitCount(); if (getPlatformName() === 'n') { this.getProperty(); } else { this.getNetworkInfo(); } } }, { key: "_sendPageRequest", value: function _sendPageRequest( opt) {var url = opt.url,urlref = opt.urlref,urlref_ts = opt.urlref_ts; this._navigationBarTitle.lt = '11'; var options = { ak: this.statData.ak, uuid: this.statData.uuid, lt: '11', ut: this.statData.ut, url: url, tt: this.statData.tt, urlref: urlref, urlref_ts: urlref_ts, ch: this.statData.ch, usv: this.statData.usv, t: getTime(), p: this.statData.p }; this.request(options); } }, { key: "_sendHideRequest", value: function _sendHideRequest( opt, type) {var urlref = opt.urlref,urlref_ts = opt.urlref_ts; var options = { ak: this.statData.ak, uuid: this.statData.uuid, lt: '3', ut: this.statData.ut, urlref: urlref, urlref_ts: urlref_ts, ch: this.statData.ch, usv: this.statData.usv, t: getTime(), p: this.statData.p }; this.request(options, type); } }, { key: "_sendEventRequest", value: function _sendEventRequest() {var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},_ref$key = _ref.key,key = _ref$key === void 0 ? '' : _ref$key,_ref$value = _ref.value,value = _ref$value === void 0 ? "" : _ref$value; var route = this._lastPageRoute; var options = { ak: this.statData.ak, uuid: this.statData.uuid, lt: '21', ut: this.statData.ut, url: route, ch: this.statData.ch, e_n: key, e_v: typeof value === 'object' ? JSON.stringify(value) : value.toString(), usv: this.statData.usv, t: getTime(), p: this.statData.p }; this.request(options); } }, { key: "getNetworkInfo", value: function getNetworkInfo() {var _this = this; uni.getNetworkType({ success: function success(result) { _this.statData.net = result.networkType; _this.getLocation(); } }); } }, { key: "getProperty", value: function getProperty() {var _this2 = this; plus.runtime.getProperty(plus.runtime.appid, function (wgtinfo) { _this2.statData.v = wgtinfo.version || ''; _this2.getNetworkInfo(); }); } }, { key: "getLocation", value: function getLocation() {var _this3 = this; if (statConfig.getLocation) { uni.getLocation({ type: 'wgs84', geocode: true, success: function success(result) { if (result.address) { _this3.statData.cn = result.address.country; _this3.statData.pn = result.address.province; _this3.statData.ct = result.address.city; } _this3.statData.lat = result.latitude; _this3.statData.lng = result.longitude; _this3.request(_this3.statData); } }); } else { this.statData.lat = 0; this.statData.lng = 0; this.request(this.statData); } } }, { key: "request", value: function request( data, type) {var _this4 = this; var time = getTime(); var title = this._navigationBarTitle; data.ttn = title.page; data.ttpj = title.config; data.ttc = title.report; var requestData = this._reportingRequestData; if (getPlatformName() === 'n') { requestData = uni.getStorageSync('__UNI__STAT__DATA') || {}; } if (!requestData[data.lt]) { requestData[data.lt] = []; } requestData[data.lt].push(data); if (getPlatformName() === 'n') { uni.setStorageSync('__UNI__STAT__DATA', requestData); } if (getPageResidenceTime() < OPERATING_TIME && !type) { return; } var uniStatData = this._reportingRequestData; if (getPlatformName() === 'n') { uniStatData = uni.getStorageSync('__UNI__STAT__DATA'); } // 时间超过,重新获取时间戳 setPageResidenceTime(); var firstArr = []; var contentArr = []; var lastArr = [];var _loop = function _loop( i) { var rd = uniStatData[i]; rd.forEach(function (elm) { var newData = getSplicing(elm); if (i === 0) { firstArr.push(newData); } else if (i === 3) { lastArr.push(newData); } else { contentArr.push(newData); } });};for (var i in uniStatData) {_loop(i); } firstArr.push.apply(firstArr, contentArr.concat(lastArr)); var optionsData = { usv: STAT_VERSION, //统计 SDK 版本号 t: time, //发送请求时的时间戮 requests: JSON.stringify(firstArr) }; this._reportingRequestData = {}; if (getPlatformName() === 'n') { uni.removeStorageSync('__UNI__STAT__DATA'); } if (data.ut === 'h5') { this.imageRequest(optionsData); return; } if (getPlatformName() === 'n' && this.statData.p === 'a') { setTimeout(function () { _this4._sendRequest(optionsData); }, 200); return; } this._sendRequest(optionsData); } }, { key: "_sendRequest", value: function _sendRequest( optionsData) {var _this5 = this; uni.request({ url: STAT_URL, method: 'POST', // header: { // 'content-type': 'application/json' // 默认值 // }, data: optionsData, success: function success() { // if (process.env.NODE_ENV === 'development') { // console.log('stat request success'); // } }, fail: function fail(e) { if (++_this5._retry < 3) { setTimeout(function () { _this5._sendRequest(optionsData); }, 1000); } } }); } /** * h5 请求 */ }, { key: "imageRequest", value: function imageRequest( data) { var image = new Image(); var options = getSgin(GetEncodeURIComponentOptions(data)).options; image.src = STAT_H5_URL + '?' + options; } }, { key: "sendEvent", value: function sendEvent( key, value) { // 校验 type 参数 if (calibration(key, value)) return; if (key === 'title') { this._navigationBarTitle.report = value; return; } this._sendEventRequest({ key: key, value: typeof value === 'object' ? JSON.stringify(value) : value }, 1); } }]);return Util;}();var Stat = /*#__PURE__*/function (_Util) {_inherits(Stat, _Util);_createClass(Stat, null, [{ key: "getInstance", value: function getInstance() { if (!this.instance) { this.instance = new Stat(); } return this.instance; } }]); function Stat() {var _this6;_classCallCheck(this, Stat); _this6 = _possibleConstructorReturn(this, _getPrototypeOf(Stat).call(this)); _this6.instance = null; // 注册拦截器 if (typeof uni.addInterceptor === 'function' && "development" !== 'development') { _this6.addInterceptorInit(); _this6.interceptLogin(); _this6.interceptShare(true); _this6.interceptRequestPayment(); }return _this6; }_createClass(Stat, [{ key: "addInterceptorInit", value: function addInterceptorInit() { var self = this; uni.addInterceptor('setNavigationBarTitle', { invoke: function invoke(args) { self._navigationBarTitle.page = args.title; } }); } }, { key: "interceptLogin", value: function interceptLogin() { var self = this; uni.addInterceptor('login', { complete: function complete() { self._login(); } }); } }, { key: "interceptShare", value: function interceptShare( type) { var self = this; if (!type) { self._share(); return; } uni.addInterceptor('share', { success: function success() { self._share(); }, fail: function fail() { self._share(); } }); } }, { key: "interceptRequestPayment", value: function interceptRequestPayment() { var self = this; uni.addInterceptor('requestPayment', { success: function success() { self._payment('pay_success'); }, fail: function fail() { self._payment('pay_fail'); } }); } }, { key: "report", value: function report( options, self) { this.self = self; // if (process.env.NODE_ENV === 'development') { // console.log('report init'); // } setPageResidenceTime(); this.__licationShow = true; this._sendReportRequest(options, true); } }, { key: "load", value: function load( options, self) { if (!self.$scope && !self.$mp) { var page = getCurrentPages(); self.$scope = page[page.length - 1]; } this.self = self; this._query = options; } }, { key: "show", value: function show( self) { this.self = self; if (getPageTypes(self)) { this._pageShow(self); } else { this._applicationShow(self); } } }, { key: "ready", value: function ready( self) { // this.self = self; // if (getPageTypes(self)) { // this._pageShow(self); // } } }, { key: "hide", value: function hide( self) { this.self = self; if (getPageTypes(self)) { this._pageHide(self); } else { this._applicationHide(self, true); } } }, { key: "error", value: function error( em) { if (this._platform === 'devtools') { if (true) { console.info('当前运行环境为开发者工具,不上报数据。'); } // return; } var emVal = ''; if (!em.message) { emVal = JSON.stringify(em); } else { emVal = em.stack; } var options = { ak: this.statData.ak, uuid: this.statData.uuid, lt: '31', ut: this.statData.ut, ch: this.statData.ch, mpsdk: this.statData.mpsdk, mpv: this.statData.mpv, v: this.statData.v, em: emVal, usv: this.statData.usv, t: getTime(), p: this.statData.p }; this.request(options); } }]);return Stat;}(Util); var stat = Stat.getInstance(); var isHide = false; var lifecycle = { onLaunch: function onLaunch(options) { stat.report(options, this); }, onReady: function onReady() { stat.ready(this); }, onLoad: function onLoad(options) { stat.load(options, this); // 重写分享,获取分享上报事件 if (this.$scope && this.$scope.onShareAppMessage) { var oldShareAppMessage = this.$scope.onShareAppMessage; this.$scope.onShareAppMessage = function (options) { stat.interceptShare(false); return oldShareAppMessage.call(this, options); }; } }, onShow: function onShow() { isHide = false; stat.show(this); }, onHide: function onHide() { isHide = true; stat.hide(this); }, onUnload: function onUnload() { if (isHide) { isHide = false; return; } stat.hide(this); }, onError: function onError(e) { stat.error(e); } }; function main() { if (true) { uni.report = function (type, options) {}; } else { var Vue; } } main(); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/vue-cli-plugin-hbuilderx/packages/uni-app-plus-nvue-v8/dist/index.js */ 2)["weexPlus"], __webpack_require__(/*! ./node_modules/@dcloudio/vue-cli-plugin-hbuilderx/packages/uni-app-plus-nvue-v8/dist/index.js */ 2)["default"])) /***/ }), /* 2 */ /*!*****************************************************************************************************!*\ !*** ./node_modules/@dcloudio/vue-cli-plugin-hbuilderx/packages/uni-app-plus-nvue-v8/dist/index.js ***! \*****************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true });exports.weexPlus = exports.default = void 0;function initUni() { var isFn = function isFn(v) { return typeof v === 'function'; }; var handlePromise = function handlePromise(promise) { return promise.then(function (data) { return [null, data]; }).catch(function (err) { return [err]; }); }; var REGEX = /^\$|^on|^create|Sync$|Manager$|^pause/; var API_NORMAL_LIST = ['os', 'getCurrentSubNVue', 'getSubNVueById', 'stopRecord', 'stopVoice', 'stopBackgroundAudio', 'stopPullDownRefresh', 'hideKeyboard', 'hideToast', 'hideLoading', 'showNavigationBarLoading', 'hideNavigationBarLoading', 'canIUse', 'navigateBack', 'closeSocket', 'pageScrollTo', 'drawCanvas']; var shouldPromise = function shouldPromise(name) { if (REGEX.test(name) && name !== 'createBLEConnection') { return false; } if (~API_NORMAL_LIST.indexOf(name)) { return false; } return true; }; var promisify = function promisify(api) { return function () { for (var _len = arguments.length, params = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { params[_key - 1] = arguments[_key]; } var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) { return api.apply(undefined, [options].concat(params)); } return handlePromise(new Promise(function (resolve, reject) { api.apply(undefined, [Object.assign({}, options, { success: resolve, fail: reject })]. concat(params)); /* eslint-disable no-extend-native */ Promise.prototype.finally = function (callback) { var promise = this.constructor; return this.then(function (value) { return promise.resolve(callback()).then(function () { return value; }); }, function (reason) { return promise.resolve(callback()).then(function () { throw reason; }); }); }; })); }; }; var onMessageCallbacks = []; var origin = void 0; function onSubNVueMessage(data) { onMessageCallbacks.forEach(function (callback) { return callback({ origin: origin, data: data }); }); } var webviewId = weexPlus.webview.currentWebview().id; var channel = new BroadcastChannel('UNI-APP-SUBNVUE'); channel.onmessage = function (event) { if (event.data.to === webviewId) { onSubNVueMessage(event.data.data); } }; function wrapper(webview) { webview.$processed = true; var currentWebviewId = weexPlus.webview.currentWebview().id; var isPopupNVue = currentWebviewId === webview.id; var hostNVueId = webview.__uniapp_origin_type === 'uniNView' && webview.__uniapp_origin_id; var popupNVueId = webview.id; webview.postMessage = function (data) { if (hostNVueId) { channel.postMessage({ data: data, to: isPopupNVue ? hostNVueId : popupNVueId }); } else { postMessage({ type: 'UniAppSubNVue', data: data }); } }; webview.onMessage = function (callback) { onMessageCallbacks.push(callback); }; if (!webview.__uniapp_mask_id) { return; } origin = webview.__uniapp_host; var maskColor = webview.__uniapp_mask; var maskWebview = weexPlus.webview.getWebviewById(webview.__uniapp_mask_id); maskWebview = maskWebview.parent() || maskWebview; //再次检测父 var oldShow = webview.show; var oldHide = webview.hide; var oldClose = webview.close; var showMask = function showMask() { maskWebview.setStyle({ mask: maskColor }); }; var closeMask = function closeMask() { maskWebview.setStyle({ mask: 'none' }); }; webview.show = function () { showMask(); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return oldShow.apply(webview, args); }; webview.hide = function () { closeMask(); for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return oldHide.apply(webview, args); }; webview.close = function () { closeMask(); for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { args[_key3] = arguments[_key3]; } return oldClose.apply(webview, args); }; } function getSubNVueById(id) { var webview = weexPlus.webview.getWebviewById(id); if (webview && !webview.$processed) { wrapper(webview); } return webview; } function getCurrentSubNVue() { return getSubNVueById(weexPlus.webview.currentWebview().id); } var plus = weex.requireModule('plus'); var globalEvent = weex.requireModule('globalEvent'); var id = 0; var callbacks = {}; var UNIAPP_SERVICE_NVUE_ID = '__uniapp__service'; globalEvent.addEventListener('plusMessage', function (e) { if (e.data.type === 'UniAppJsApi') { invoke(e.data.id, e.data.data); } else if (e.data.type === 'UniAppSubNVue') { onSubNVueMessage(e.data.data, e.data.options); } else if (e.data.type === 'onNavigationBarButtonTap') { if (typeof onNavigationBarButtonTapCallback === 'function') { onNavigationBarButtonTapCallback(e.data.data); } } else if (e.data.type === 'onNavigationBarSearchInputChanged') { if (typeof onNavigationBarSearchInputChangedCallback === 'function') { onNavigationBarSearchInputChangedCallback(e.data.data); } } else if (e.data.type === 'onNavigationBarSearchInputConfirmed') { if (typeof onNavigationBarSearchInputConfirmedCallback === 'function') { onNavigationBarSearchInputConfirmedCallback(e.data.data); } } else if (e.data.type === 'onNavigationBarSearchInputClicked') { if (typeof onNavigationBarSearchInputClickedCallback === 'function') { onNavigationBarSearchInputClickedCallback(e.data.data); } } }); var createCallback = function createCallback(args, type) { var callback = function callback(res) { if (isFn(args)) { args(res); } else if (args) { if (~res.errMsg.indexOf(':ok')) { isFn(args.success) && args.success(res); } else if (~res.errMsg.indexOf(':fail')) { isFn(args.fail) && args.fail(res); } isFn(args.complete) && args.complete(res); } }; if (isFn(args) || args && isFn(args.callback)) { callback.keepAlive = true; } return callback; }; var invoke = function invoke(callbackId, data) { var callback = callbacks[callbackId]; if (callback) { callback(data); if (!callback.keepAlive) { delete callbacks[callbackId]; } } else { console.error('callback[' + callbackId + '] is undefined'); } }; var publish = function publish(_ref) { var id = _ref.id, type = _ref.type, params = _ref.params; callbacks[id] = createCallback(params, type); plus.postMessage({ id: id, type: type, params: params }, UNIAPP_SERVICE_NVUE_ID); }; function postMessage(data) { plus.postMessage(data, UNIAPP_SERVICE_NVUE_ID); } var createPublish = function createPublish(name) { return function (args) { publish({ id: id++, type: name, params: args }); }; }; var onNavigationBarButtonTapCallback = void 0; var onNavigationBarSearchInputChangedCallback = void 0; var onNavigationBarSearchInputConfirmedCallback = void 0; var onNavigationBarSearchInputClickedCallback = void 0; function onNavigationBarButtonTap(callback) { onNavigationBarButtonTapCallback = callback; } function onNavigationBarSearchInputChanged(callback) { onNavigationBarSearchInputChangedCallback = callback; } function onNavigationBarSearchInputConfirmed(callback) { onNavigationBarSearchInputConfirmedCallback = callback; } function onNavigationBarSearchInputClicked(callback) { onNavigationBarSearchInputClickedCallback = callback; } function requireNativePlugin(pluginName) { return weex.requireModule(pluginName); } var dom = weex.requireModule('dom'); function loadFontFace(_ref) { var family = _ref.family, source = _ref.source, desc = _ref.desc, success = _ref.success, fail = _ref.fail, complete = _ref.complete; dom.addRule('fontFace', { fontFamily: family, src: source.replace(/"/g, '\'') }); var res = { errMsg: 'loadFontFace:ok', status: 'loaded' }; isFn(success) && success(res); isFn(complete) && complete(res); } var globalEvent$1 = weex.requireModule('globalEvent'); var callbacks$1 = []; globalEvent$1.addEventListener('plusMessage', function (e) { if (e.data.type === 'UniAppReady') { ready.isUniAppReady = true; if (callbacks$1.length) { callbacks$1.forEach(function (callback) { return callback(); }); callbacks$1 = []; } } }); function ready(callback) { if (typeof callback === 'function') { if (this.isUniAppReady) { callback(); } else { callbacks$1.push(callback); } } } var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var stream = weex.requireModule('stream'); // let requestTaskId = 0 var METHOD_GET = 'GET'; var METHOD_POST = 'POST'; var CONTENT_TYPE_JSON = 'application/json'; var CONTENT_TYPE_FORM = 'application/x-www-form-urlencoded'; var serialize = function serialize(data) { var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : METHOD_GET; var contentType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : CONTENT_TYPE_FORM; if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object') { if (method.toUpperCase() === METHOD_POST && contentType.toLowerCase() === CONTENT_TYPE_JSON) { return JSON.stringify(data); } else { return Object.keys(data).map(function (key) { return encodeURIComponent(key) + '=' + encodeURIComponent(data[key]); }).join('&'); } } return data; }; function request(_ref) { var url = _ref.url, data = _ref.data, header = _ref.header, _ref$method = _ref.method, method = _ref$method === undefined ? 'GET' : _ref$method, _ref$dataType = _ref.dataType, dataType = _ref$dataType === undefined ? 'json' : _ref$dataType, responseType = _ref.responseType, success = _ref.success, fail = _ref.fail, complete = _ref.complete; // requestTaskId++ var aborted = false; var hasContentType = false; var headers = {}; if (header) { for (var name in header) { if (!hasContentType && name.toLowerCase() === 'content-type') { hasContentType = true; headers['Content-Type'] = header[name]; } else { headers[name] = header[name]; } } } if (method === METHOD_GET && data) { url = url + (~url.indexOf('?') ? url.substr(-1) === '&' || url.substr(-1) === '?' ? '' : '&' : '?') + serialize(data); } stream.fetch({ url: url, method: method, headers: headers, type: dataType === 'json' ? 'json' : 'text', body: method !== METHOD_GET ? serialize(data, method, headers['Content-Type']) : '' }, function (_ref2) { var status = _ref2.status, ok = _ref2.ok, statusText = _ref2.statusText, data = _ref2.data, headers = _ref2.headers; var ret = {}; if (!status || status === -1 || aborted) { ret.errMsg = 'request:fail'; isFn(fail) && fail(ret); } else { ret.data = data; ret.statusCode = status; ret.header = headers; isFn(success) && success(ret); } isFn(complete) && complete(ret); }); return { abort: function abort() { aborted = true; } }; } var storage = weex.requireModule('plusstorage'); var UNIAPP_STORAGE_DATA_TYPE = '__TYPE'; function getStorage(_ref) { var key = _ref.key, data = _ref.data, success = _ref.success, fail = _ref.fail, complete = _ref.complete; storage.getItem(key + UNIAPP_STORAGE_DATA_TYPE, function (ret) { if (ret.result === 'success') { var dataType = ret.data; storage.getItem(key, function (res) { if (res.result === 'success') { var result = res.data; if (dataType && result) { if (dataType !== 'String') { result = JSON.parse(result); } isFn(success) && success({ errMsg: 'getStorage:ok', data: result }); } else { res.errMsg = 'setStorage:fail'; isFn(fail) && fail(res); } } else { res.errMsg = 'setStorage:fail'; isFn(fail) && fail(res); } isFn(complete) && complete(res); }); } else { ret.errMsg = 'setStorage:fail'; isFn(fail) && fail(ret); isFn(complete) && complete(ret); } }); } function setStorage(_ref2) { var key = _ref2.key, data = _ref2.data, success = _ref2.success, fail = _ref2.fail, complete = _ref2.complete; var dataType = 'String'; if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object') { dataType = 'Object'; data = JSON.stringify(data); } storage.setItem(key, data, function (res) { if (res.result === 'success') { storage.setItem(key + UNIAPP_STORAGE_DATA_TYPE, dataType, function (ret) { if (ret.result === 'success') { isFn(success) && success({ errMsg: 'setStorage:ok' }); } else { ret.errMsg = 'setStorage:fail'; isFn(fail) && fail(ret); } }); } else { res.errMsg = 'setStorage:fail'; isFn(fail) && fail(res); } isFn(complete) && complete(res); }); } function removeStorage(_ref3) { var key = _ref3.key, data = _ref3.data, success = _ref3.success, fail = _ref3.fail, complete = _ref3.complete; storage.removeItem(key, function (res) { if (res.result === 'success') { isFn(success) && success({ errMsg: 'removeStorage:ok' }); } else { res.errMsg = 'removeStorage:fail'; isFn(fail) && fail(res); } isFn(complete) && complete(res); }); storage.removeItem(key + UNIAPP_STORAGE_DATA_TYPE); } function clearStorage(_ref4) { var key = _ref4.key, data = _ref4.data, success = _ref4.success, fail = _ref4.fail, complete = _ref4.complete; } var clipboard = weex.requireModule('clipboard'); function getClipboardData(_ref) { var success = _ref.success, fail = _ref.fail, complete = _ref.complete; clipboard.getString(function (_ref2) { var data = _ref2.data; var res = { errMsg: 'getClipboardData:ok', data: data }; isFn(success) && success(res); isFn(complete) && complete(res); }); } function setClipboardData(_ref3) { var data = _ref3.data, success = _ref3.success, fail = _ref3.fail, complete = _ref3.complete; var res = { errMsg: 'setClipboardData:ok' }; clipboard.setString(data); isFn(success) && success(res); isFn(complete) && complete(res); } var getEmitter = function () { if (typeof getUniEmitter === 'function') { /* eslint-disable no-undef */ return getUniEmitter; } var Emitter = { $on: function $on() { console.warn('uni.$on failed'); }, $off: function $off() { console.warn('uni.$off failed'); }, $once: function $once() { console.warn('uni.$once failed'); }, $emit: function $emit() { console.warn('uni.$emit failed'); } }; return function getUniEmitter() { return Emitter; }; }(); function apply(ctx, method, args) { return ctx[method].apply(ctx, args); } function $on() { return apply(getEmitter(), '$on', [].concat(Array.prototype.slice.call(arguments))); } function $off() { return apply(getEmitter(), '$off', [].concat(Array.prototype.slice.call(arguments))); } function $once() { return apply(getEmitter(), '$once', [].concat(Array.prototype.slice.call(arguments))); } function $emit() { return apply(getEmitter(), '$emit', [].concat(Array.prototype.slice.call(arguments))); } var api = /*#__PURE__*/Object.freeze({ loadFontFace: loadFontFace, ready: ready, request: request, getStorage: getStorage, setStorage: setStorage, removeStorage: removeStorage, clearStorage: clearStorage, getClipboardData: getClipboardData, setClipboardData: setClipboardData, onSubNVueMessage: onSubNVueMessage, getSubNVueById: getSubNVueById, getCurrentSubNVue: getCurrentSubNVue, $on: $on, $off: $off, $once: $once, $emit: $emit }); var wx = { uploadFile: true, downloadFile: true, chooseImage: true, previewImage: true, getImageInfo: true, saveImageToPhotosAlbum: true, chooseVideo: true, saveVideoToPhotosAlbum: true, saveFile: true, getSavedFileList: true, getSavedFileInfo: true, removeSavedFile: true,