From 5b4abb66ce7f53973e933334e1b061ba2bffe273 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Mon, 14 Oct 2019 15:04:50 +0800 Subject: [PATCH] feat(v3): navigator --- build/build.js | 4 +- build/rollup.config.app.js | 10 +- lib/apis.js | 3 +- lib/app-plus/view.js | 11 +- package.json | 2 +- packages/uni-app-plus/dist/index.v3.js | 11801 ++--- .../uni-app-plus/dist/service.runtime.esm.js | 2 +- packages/uni-app-plus/dist/view.css | 1395 +- packages/uni-app-plus/dist/view.umd.js | 35530 ++++++++-------- packages/uni-cli-shared/lib/pages.js | 21 +- packages/uni-cli-shared/lib/platform.js | 7 + packages/uni-cli-shared/template/view.css | 1 - packages/uni-cli-shared/template/view.umd.js | 20812 --------- .../__tests__/compiler-app-plus.view.spec.js | 204 +- .../uni-template-compiler/__tests__/demo.js | 2 +- .../lib/app/component-parser.js | 19 + .../lib/app/event-parser.js | 21 + .../lib/app/pre-transform-node.js | 10 +- .../uni-template-compiler/lib/app/service.js | 3 + .../lib/app/tag-parser.js | 11 + .../uni-template-compiler/lib/app/util.js | 5 +- .../uni-template-compiler/lib/app/view.js | 7 + .../build/webpack.nvue.conf.js | 12 +- .../vue-cli-plugin-uni/lib/app-plus/index.js | 10 +- .../packages/postcss/index.js | 458 +- .../packages/postcss/index.v3.js | 39 + .../webpack-uni-view-main-loader/index.js | 114 +- .../webpack-uni-pages-loader/lib/index-new.js | 2 +- .../platforms/app-plus/app-config-service.js | 47 + .../lib/platforms/app-plus/config-parser.js | 22 - .../lib/platforms/app-plus/define-pages.js | 18 + .../lib/platforms/app-plus/index.js | 57 +- src/core/service/bridge/index.js | 3 + src/core/view/bridge/index.js | 3 + src/core/view/plugins/events.js | 26 +- .../app-plus-nvue/service/register-page.js | 4 - src/platforms/app-plus/page-factory.js | 29 + src/platforms/app-plus/service/api/index.js | 3 +- .../service/api/plugin/register-plus.js | 9 + .../service/api/route/navigate-back.js | 4 +- .../app-plus/service/api/route/re-launch.js | 30 +- .../app-plus/service/api/route/redirect-to.js | 27 +- .../app-plus/service/api/route/switch-tab.js | 7 +- .../app-plus/service/api/route/util.js | 30 +- src/platforms/app-plus/service/constants.js | 12 +- .../app-plus/service/framework/app.js | 4 +- .../app-plus/service/framework/config.js | 7 +- .../app-plus/service/framework/navigator.js | 67 +- .../app-plus/service/framework/page.js | 56 +- .../app-plus/service/framework/perf.js | 5 +- .../service/framework/plugins/data.js | 6 +- .../service/framework/plugins/vdom-sync.js | 4 +- .../service/framework/subscribe-handlers.js | 4 +- src/platforms/app-plus/service/index.js | 34 +- .../app-plus/service/register-page.js | 4 - src/platforms/app-plus/view/bridge.js | 6 +- src/platforms/app-plus/view/framework/page.js | 20 +- .../app-plus/view/framework/plugins/data.js | 28 +- .../app-plus/view/framework/plugins/event.js | 12 +- .../app-plus/view/framework/plugins/index.js | 8 +- 60 files changed, 26794 insertions(+), 44318 deletions(-) delete mode 100644 packages/uni-cli-shared/template/view.css delete mode 100644 packages/uni-cli-shared/template/view.umd.js create mode 100644 packages/uni-template-compiler/lib/app/component-parser.js create mode 100644 packages/uni-template-compiler/lib/app/event-parser.js create mode 100644 packages/uni-template-compiler/lib/app/tag-parser.js create mode 100644 packages/vue-cli-plugin-uni/packages/postcss/index.v3.js create mode 100644 packages/webpack-uni-pages-loader/lib/platforms/app-plus/app-config-service.js delete mode 100644 packages/webpack-uni-pages-loader/lib/platforms/app-plus/config-parser.js create mode 100644 packages/webpack-uni-pages-loader/lib/platforms/app-plus/define-pages.js delete mode 100644 src/platforms/app-plus-nvue/service/register-page.js create mode 100644 src/platforms/app-plus/page-factory.js create mode 100644 src/platforms/app-plus/service/api/plugin/register-plus.js delete mode 100644 src/platforms/app-plus/service/register-page.js diff --git a/build/build.js b/build/build.js index 24af9301f..dde324179 100644 --- a/build/build.js +++ b/build/build.js @@ -32,7 +32,6 @@ if (process.env.UNI_PLATFORM === 'app-plus' && process.env.UNI_VIEW === 'true') filename = 'view' entry = './lib/' + process.env.UNI_PLATFORM + '/view.js' } - service.run('build', { name, filename, @@ -40,7 +39,8 @@ service.run('build', { target: 'lib', formats: process.env.UNI_WATCH === 'true' ? 'umd' : 'umd-min', entry, - clean: !process.env.UNI_VIEW + clean: !process.env.UNI_VIEW, + mode: process.env.NODE_ENV }).then(function () { if (process.env.UNI_UI !== 'true' && process.env.UNI_VIEW !== 'true') { generateApiManifest( diff --git a/build/rollup.config.app.js b/build/rollup.config.app.js index 4097fff41..92477c75b 100644 --- a/build/rollup.config.app.js +++ b/build/rollup.config.app.js @@ -34,20 +34,24 @@ if (process.env.UNI_SERVICE === 'legacy') { output.format = 'iife' output.name = 'serviceContext' output.banner = - `export function createServiceContext(Vue, weex, plus, __uniConfig, __uniRoutes, UniServiceJSBridge,instanceContext){ + `export function createServiceContext(Vue, weex, plus, UniServiceJSBridge,instanceContext){ var localStorage = plus.storage var setTimeout = instanceContext.setTimeout var clearTimeout = instanceContext.clearTimeout var setInterval = instanceContext.setInterval -var clearInterval = instanceContext.clearInterval +var clearInterval = instanceContext.clearInterval +var __uniConfig = instanceContext.__uniConfig +var __uniRoutes = instanceContext.__uniRoutes ` output.footer = ` var uni = serviceContext.uni var getApp = serviceContext.getApp var getCurrentPages = serviceContext.getCurrentPages + +var __definePage = serviceContext.__definePage +var __registerPage = serviceContext.__registerPage -var __registerPage = serviceContext.__registerPage return serviceContext \n} ` diff --git a/lib/apis.js b/lib/apis.js index 042a2ec8b..b83f5b61c 100644 --- a/lib/apis.js +++ b/lib/apis.js @@ -191,7 +191,8 @@ const third = [ 'onPush', 'offPush', 'requireNativePlugin', - 'upx2px' + 'upx2px', + 'registerPlus' ] const apis = [ diff --git a/lib/app-plus/view.js b/lib/app-plus/view.js index 4a1203f3c..c65e6d37c 100644 --- a/lib/app-plus/view.js +++ b/lib/app-plus/view.js @@ -4,11 +4,11 @@ import 'uni-core/view/index.css' import { definePage -} from 'uni-platform/view/framework/page' +} from 'uni-platform/page-factory' import { - registerConfig -} from 'uni-platform/view/framework/config' + getCurrentPages +} from 'uni-platform/view/framework/page' import ViewPlugin from 'uni-platform/view/framework/plugins/index' @@ -16,9 +16,10 @@ global.UniViewJSBridge = { publishHandler: UniViewJSBridge.publishHandler, subscribeHandler: UniViewJSBridge.subscribeHandler } + +global.getCurrentPages = getCurrentPages -global.__registerConfig = registerConfig -global.__registerPage = definePage +global.__definePage = definePage global.Vue = Vue diff --git a/package.json b/package.json index 07d9321f3..8e89db02c 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "build:app:v3": "npm run lint && npm run build:app:service && npm run dev:app:view", "build:app:service": "cross-env UNI_PLATFORM=app-plus rollup -c build/rollup.config.app.js", "build:app:view": "cross-env NODE_ENV=production UNI_WATCH=false UNI_PLATFORM=app-plus UNI_VIEW=true node build/build.js", - "dev:app:view": "cross-env NODE_ENV=production UNI_WATCH=true UNI_PLATFORM=app-plus UNI_VIEW=true node build/build.js", + "dev:app:view": "cross-env NODE_ENV=development UNI_WATCH=true UNI_PLATFORM=app-plus UNI_VIEW=true node build/build.js", "build:app:nvue": "cross-env UNI_PLATFORM=app-plus-nvue rollup -c build/rollup.config.app.js", "build:app:legacy": "cross-env UNI_PLATFORM=app-plus-nvue UNI_SERVICE=legacy rollup -c build/rollup.config.app.js", "build:mp-qq": "cross-env UNI_PLATFORM=mp-qq rollup -c build/rollup.config.mp.js", diff --git a/packages/uni-app-plus/dist/index.v3.js b/packages/uni-app-plus/dist/index.v3.js index 272425e48..0c60c8bdf 100644 --- a/packages/uni-app-plus/dist/index.v3.js +++ b/packages/uni-app-plus/dist/index.v3.js @@ -1,1755 +1,15 @@ -export function createServiceContext(Vue, weex, plus, __uniConfig, __uniRoutes, UniServiceJSBridge,instanceContext){ +export function createServiceContext(Vue, weex, plus, UniServiceJSBridge,instanceContext){ var localStorage = plus.storage var setTimeout = instanceContext.setTimeout var clearTimeout = instanceContext.clearTimeout var setInterval = instanceContext.setInterval var clearInterval = instanceContext.clearInterval +var __uniConfig = instanceContext.__uniConfig +var __uniRoutes = instanceContext.__uniRoutes var serviceContext = (function () { 'use strict'; - function callHook (vm, hook, params) { - return (vm.$vm || vm).__call_hook(hook, params) - } - - function callAppHook (vm, hook, params) { - if (hook !== 'onError') { - console.debug(`App:${hook} have been invoked` + (params ? ` ${JSON.stringify(params)}` : '')); - } - return (vm.$vm || vm).__call_hook(hook, params) - } - - function callPageHook (vm, hook, params) { - if (hook !== 'onPageScroll') { - console.debug(`${vm.$page.route}[${vm.$page.id}]:${hook} have been invoked`); - } - return callHook(vm, hook, params) - } - - function createCommonjsModule(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; - } - - var base64Arraybuffer = createCommonjsModule(function (module, exports) { - /* - * base64-arraybuffer - * https://github.com/niklasvh/base64-arraybuffer - * - * Copyright (c) 2012 Niklas von Hertzen - * Licensed under the MIT license. - */ - (function(){ - - var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - - // Use a lookup table to find the index. - var lookup = new Uint8Array(256); - for (var i = 0; i < chars.length; i++) { - lookup[chars.charCodeAt(i)] = i; - } - - exports.encode = function(arraybuffer) { - var bytes = new Uint8Array(arraybuffer), - i, len = bytes.length, base64 = ""; - - for (i = 0; i < len; i+=3) { - base64 += chars[bytes[i] >> 2]; - base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; - base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; - base64 += chars[bytes[i + 2] & 63]; - } - - if ((len % 3) === 2) { - base64 = base64.substring(0, base64.length - 1) + "="; - } else if (len % 3 === 1) { - base64 = base64.substring(0, base64.length - 2) + "=="; - } - - return base64; - }; - - exports.decode = function(base64) { - var bufferLength = base64.length * 0.75, - len = base64.length, i, p = 0, - encoded1, encoded2, encoded3, encoded4; - - if (base64[base64.length - 1] === "=") { - bufferLength--; - if (base64[base64.length - 2] === "=") { - bufferLength--; - } - } - - var arraybuffer = new ArrayBuffer(bufferLength), - bytes = new Uint8Array(arraybuffer); - - for (i = 0; i < len; i+=4) { - encoded1 = lookup[base64.charCodeAt(i)]; - encoded2 = lookup[base64.charCodeAt(i+1)]; - encoded3 = lookup[base64.charCodeAt(i+2)]; - encoded4 = lookup[base64.charCodeAt(i+3)]; - - bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); - bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); - bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); - } - - return arraybuffer; - }; - })(); - }); - var base64Arraybuffer_1 = base64Arraybuffer.encode; - var base64Arraybuffer_2 = base64Arraybuffer.decode; - - function unpack (args) { - return args - } - - function invoke (...args) { - return UniServiceJSBridge.invokeCallbackHandler(...args) - } - - function requireNativePlugin (name) { - return uni.requireNativePlugin(name) - } - - /** - * 触发 service 层,与 onMethod 对应 - */ - function publish (name, res) { - return UniServiceJSBridge.emit('api.' + name, res) - } - - let lastStatusBarStyle; - - function setStatusBarStyle (statusBarStyle) { - if (!statusBarStyle) { - const pages = getCurrentPages(); - if (!pages.length) { - return - } - statusBarStyle = pages[pages.length - 1].$page.meta.statusBarStyle; - if (!statusBarStyle || statusBarStyle === lastStatusBarStyle) { - return - } - } - if (process.env.NODE_ENV !== 'production') { - console.log(`[uni-app] setStatusBarStyle`, statusBarStyle); - } - - lastStatusBarStyle = statusBarStyle; - - plus.navigator.setStatusBarStyle(statusBarStyle); - } - - function isTabBarPage (path = '') { - if (!(__uniConfig.tabBar && Array.isArray(__uniConfig.tabBar.list))) { - return false - } - try { - if (!path) { - const pages = getCurrentPages(); - if (!pages.length) { - return false - } - const page = pages[pages.length - 1]; - if (!page) { - return false - } - return page.$page.meta.isTabBar - } - const route = __uniRoutes.find(route => route.path.slice(1) === path); - return route && route.meta.isTabBar - } catch (e) { - if (process.env.NODE_ENV !== 'production') { - console.log('getCurrentPages is not ready'); - } - } - return false - } - - function base64ToArrayBuffer (data) { - return base64Arraybuffer_2(data) - } - - function arrayBufferToBase64 (data) { - return base64Arraybuffer_1(data) - } - - function callApiSync (api, args, name, alias) { - const ret = api(args); - if (ret && ret.errMsg) { - ret.errMsg = ret.errMsg.replace(name, alias); - } - return ret - } - - function getLastWebview () { - try { - const pages = getCurrentPages(); - if (pages.length) { - return pages[pages.length - 1].$getAppWebview() - } - } catch (e) { - if (process.env.NODE_ENV !== 'production') { - console.log('getCurrentPages is not ready'); - } - } - } - - const getRealRoute = (e, t) => { - if (t.indexOf('./') === 0) return getRealRoute(e, t.substr(2)) - let n; - let i; - let o = t.split('/'); - for (n = 0, i = o.length; n < i && o[n] === '..'; n++); - o.splice(0, n); - t = o.join('/'); - let r = e.length > 0 ? e.split('/') : []; - r.splice(r.length - n - 1, n + 1); - return r.concat(o).join('/') - }; - - // 处理 Android 平台解压与非解压模式下获取的路径不一致的情况 - const _handleLocalPath = filePath => { - let localUrl = plus.io.convertLocalFileSystemURL(filePath); - return localUrl.replace(/^\/?apps\//, '/android_asset/apps/').replace(/\/$/, '') - }; - - function getRealPath (filePath) { - const SCHEME_RE = /^([a-z-]+:)?\/\//i; - const DATA_RE = /^data:.*,.*/; - - // 无协议的情况补全 https - if (filePath.indexOf('//') === 0) { - filePath = 'https:' + filePath; - } - - // 网络资源或base64 - if (SCHEME_RE.test(filePath) || DATA_RE.test(filePath)) { - return filePath - } - - if (filePath.indexOf('_www') === 0 || filePath.indexOf('_doc') === 0 || filePath.indexOf('_documents') === 0 || - filePath.indexOf('_downloads') === 0) { - return 'file://' + _handleLocalPath(filePath) - } - const wwwPath = 'file://' + _handleLocalPath('_www'); - // 绝对路径转换为本地文件系统路径 - if (filePath.indexOf('/') === 0) { - return wwwPath + filePath - } - // 相对资源 - if (filePath.indexOf('../') === 0 || filePath.indexOf('./') === 0) { - if (typeof __id__ === 'string') { - return wwwPath + getRealRoute('/' + __id__, filePath) - } else { - const pages = getCurrentPages(); - if (pages.length) { - return wwwPath + getRealRoute('/' + pages[pages.length - 1].route, filePath) - } - } - } - return filePath - } - - function getStatusBarStyle () { - let style = plus.navigator.getStatusBarStyle(); - if (style === 'UIStatusBarStyleBlackTranslucent' || style === 'UIStatusBarStyleBlackOpaque' || style === 'null') { - style = 'light'; - } else if (style === 'UIStatusBarStyleDefault') { - style = 'dark'; - } - return style - } - - const PI = 3.1415926535897932384626; - const a = 6378245.0; - const ee = 0.00669342162296594323; - - function wgs84togcj02 (lng, lat) { - lat = +lat; - lng = +lng; - if (outOfChina(lng, lat)) { - return [lng, lat] - } - let dlat = _transformlat(lng - 105.0, lat - 35.0); - let dlng = _transformlng(lng - 105.0, lat - 35.0); - const radlat = lat / 180.0 * PI; - let magic = Math.sin(radlat); - magic = 1 - ee * magic * magic; - const sqrtmagic = Math.sqrt(magic); - dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI); - dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI); - const mglat = lat + dlat; - const mglng = lng + dlng; - return [mglng, mglat] - } - - function gcj02towgs84 (lng, lat) { - lat = +lat; - lng = +lng; - if (outOfChina(lng, lat)) { - return [lng, lat] - } - let dlat = _transformlat(lng - 105.0, lat - 35.0); - let dlng = _transformlng(lng - 105.0, lat - 35.0); - const radlat = lat / 180.0 * PI; - let magic = Math.sin(radlat); - magic = 1 - ee * magic * magic; - const sqrtmagic = Math.sqrt(magic); - dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI); - dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI); - const mglat = lat + dlat; - const mglng = lng + dlng; - return [lng * 2 - mglng, lat * 2 - mglat] - } - - const _transformlat = function (lng, lat) { - let ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng)); - ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0; - ret += (20.0 * Math.sin(lat * PI) + 40.0 * Math.sin(lat / 3.0 * PI)) * 2.0 / 3.0; - ret += (160.0 * Math.sin(lat / 12.0 * PI) + 320 * Math.sin(lat * PI / 30.0)) * 2.0 / 3.0; - return ret - }; - const _transformlng = function (lng, lat) { - let ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng)); - ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0; - ret += (20.0 * Math.sin(lng * PI) + 40.0 * Math.sin(lng / 3.0 * PI)) * 2.0 / 3.0; - ret += (150.0 * Math.sin(lng / 12.0 * PI) + 300.0 * Math.sin(lng / 30.0 * PI)) * 2.0 / 3.0; - return ret - }; - - const outOfChina = function (lng, lat) { - return (lng < 72.004 || lng > 137.8347) || ((lat < 0.8293 || lat > 55.8271) || false) - }; - - let webview; - - function setPullDownRefreshPageId (pullDownRefreshWebview) { - if (typeof pullDownRefreshWebview === 'number') { - webview = plus.webview.getWebviewById(String(pullDownRefreshWebview)); - } else { - webview = pullDownRefreshWebview; - } - } - - function startPullDownRefresh () { - if (webview) { - webview.endPullToRefresh(); - } - webview = getLastWebview(); - if (webview) { - webview.beginPullToRefresh(); - return { - errMsg: 'startPullDownRefresh:ok' - } - } - return { - errMsg: 'startPullDownRefresh:fail' - } - } - - function stopPullDownRefresh () { - if (!webview) { - webview = getLastWebview(); - } - if (webview) { - webview.endPullToRefresh(); - webview = null; - return { - errMsg: 'stopPullDownRefresh:ok' - } - } - return { - errMsg: 'stopPullDownRefresh:fail' - } - } - - function initOn (on, { - getApp, - getCurrentPages - }) { - function onError (err) { - callAppHook(getApp(), 'onError', err); - } - - function onPageNotFound (page) { - callAppHook(getApp(), 'onPageNotFound', page); - } - - function onPullDownRefresh (args, pageId) { - const page = getCurrentPages().find(page => page.$page.id === pageId); - if (page) { - setPullDownRefreshPageId(pageId); - callPageHook(page, 'onPullDownRefresh'); - } - } - - function callCurrentPageHook (hook, args) { - const pages = getCurrentPages(); - if (pages.length) { - callPageHook(pages[pages.length - 1], hook, args); - } - } - - function createCallCurrentPageHook (hook) { - return function (args) { - callCurrentPageHook(hook, args); - } - } - - function onAppEnterBackground () { - callAppHook(getApp(), 'onHide'); - callCurrentPageHook('onHide'); - } - - function onAppEnterForeground () { - callAppHook(getApp(), 'onShow'); - callCurrentPageHook('onShow'); - } - - function onWebInvokeAppService ({ - name, - arg - }, pageId) { - if (name === 'postMessage') ; else { - uni[name](arg); - } - } - - const routeHooks = { - navigateTo () { - callCurrentPageHook('onHide'); - }, - navigateBack () { - callCurrentPageHook('onShow'); - } - }; - - function onAppRoute ({ - type - }) { - const routeHook = routeHooks[type]; - routeHook && routeHook(); - } - - on('onError', onError); - on('onPageNotFound', onPageNotFound); - - { // 后续有时间,h5 平台也要迁移到 onAppRoute - on('onAppRoute', onAppRoute); - } - - on('onAppEnterBackground', onAppEnterBackground); - on('onAppEnterForeground', onAppEnterForeground); - - on('onPullDownRefresh', onPullDownRefresh); - - on('onTabItemTap', createCallCurrentPageHook('onTabItemTap')); - on('onNavigationBarButtonTap', createCallCurrentPageHook('onNavigationBarButtonTap')); - - on('onNavigationBarSearchInputChanged', createCallCurrentPageHook('onNavigationBarSearchInputChanged')); - on('onNavigationBarSearchInputConfirmed', createCallCurrentPageHook('onNavigationBarSearchInputConfirmed')); - on('onNavigationBarSearchInputClicked', createCallCurrentPageHook('onNavigationBarSearchInputClicked')); - - on('onWebInvokeAppService', onWebInvokeAppService); - } - - const DEVICE_FREQUENCY = 200; - const NETWORK_TYPES = ['unknown', 'none', 'ethernet', 'wifi', '2g', '3g', '4g']; - - const MAP_ID = '__UNIAPP_MAP'; - - const TEMP_PATH_BASE = '_doc/uniapp_temp'; - const TEMP_PATH = `${TEMP_PATH_BASE}_${Date.now()}`; - - let supportsPassive = false; - try { - const opts = {}; - Object.defineProperty(opts, 'passive', ({ - get () { - /* istanbul ignore next */ - supportsPassive = true; - } - })); // https://github.com/facebook/flow/issues/285 - window.addEventListener('test-passive', null, opts); - } catch (e) {} - - const _toString = Object.prototype.toString; - const hasOwnProperty = Object.prototype.hasOwnProperty; - - function isFn (fn) { - return typeof fn === 'function' - } - - function isPlainObject (obj) { - return _toString.call(obj) === '[object Object]' - } - - function hasOwn (obj, key) { - return hasOwnProperty.call(obj, key) - } - - function toRawType (val) { - return _toString.call(val).slice(8, -1) - } - - function getLen (str = '') { - /* eslint-disable no-control-regex */ - return ('' + str).replace(/[^\x00-\xff]/g, '**').length - } - - function guid () { - return Math.floor(4294967296 * (1 + Math.random())).toString(16).slice(1) - } - - const decode = decodeURIComponent; - - function parseQuery (query) { - const res = {}; - - query = query.trim().replace(/^(\?|#|&)/, ''); - - if (!query) { - return res - } - - query.split('&').forEach(param => { - const parts = param.replace(/\+/g, ' ').split('='); - const key = decode(parts.shift()); - const val = parts.length > 0 - ? decode(parts.join('=')) - : null; - - if (res[key] === undefined) { - res[key] = val; - } else if (Array.isArray(res[key])) { - res[key].push(val); - } else { - res[key] = [res[key], val]; - } - }); - - return res - } - - function parseTitleNView (routeOptions) { - const windowOptions = routeOptions.window; - const titleNView = windowOptions.titleNView; - if ( // 无头 - titleNView === false || - titleNView === 'false' || - ( - windowOptions.navigationStyle === 'custom' && - !isPlainObject(titleNView) - ) - ) { - return false - } - - const titleImage = windowOptions.titleImage || ''; - const transparentTitle = windowOptions.transparentTitle || 'none'; - const titleNViewTypeList = { - 'none': 'default', - 'auto': 'transparent', - 'always': 'float' - }; - - const ret = { - autoBackButton: !routeOptions.meta.isQuit, - titleText: titleImage === '' ? windowOptions.navigationBarTitleText || '' : '', - titleColor: windowOptions.navigationBarTextStyle === 'black' ? '#000000' : '#ffffff', - type: titleNViewTypeList[transparentTitle], - backgroundColor: transparentTitle !== 'always' ? windowOptions.navigationBarBackgroundColor || '#000000' : 'rgba(0,0,0,0)', - tags: titleImage === '' ? [] : [{ - 'tag': 'img', - 'src': titleImage, - 'position': { - 'left': 'auto', - 'top': 'auto', - 'width': 'auto', - 'height': '26px' - } - }] - }; - - routeOptions.meta.statusBarStyle = windowOptions.navigationBarTextStyle === 'black' ? 'dark' : 'light'; - - if (isPlainObject(titleNView)) { - return Object.assign(ret, titleNView) - } - - return ret - } - - function parsePullToRefresh (routeOptions) { - const windowOptions = routeOptions.window; - - if (windowOptions.enablePullDownRefresh) { - const pullToRefreshStyles = Object.create(null); - // 初始化默认值 - if (plus.os.name === 'Android') { - Object.assign(pullToRefreshStyles, { - support: true, - style: 'circle' - }); - } else { - Object.assign(pullToRefreshStyles, { - support: true, - style: 'default', - height: '50px', - range: '200px', - contentdown: { - caption: '' - }, - contentover: { - caption: '' - }, - contentrefresh: { - caption: '' - } - }); - } - - if (windowOptions.backgroundTextStyle) { - pullToRefreshStyles.color = windowOptions.backgroundTextStyle; - pullToRefreshStyles.snowColor = windowOptions.backgroundTextStyle; - } - - Object.assign(pullToRefreshStyles, windowOptions.pullToRefresh || {}); - - return pullToRefreshStyles - } - } - - const WEBVIEW_STYLE_BLACKLIST = [ - 'navigationBarBackgroundColor', - 'navigationBarTextStyle', - 'navigationBarTitleText', - 'navigationBarShadow', - 'navigationStyle', - 'disableScroll', - 'backgroundColor', - 'backgroundTextStyle', - 'enablePullDownRefresh', - 'onReachBottomDistance', - 'usingComponents', - // 需要解析的 - 'titleNView', - 'pullToRefresh' - ]; - - function parseWebviewStyle (id, path, routeOptions = {}) { - const webviewStyle = Object.create(null); - - // 合并 - routeOptions.window = Object.assign( - JSON.parse(JSON.stringify(__uniConfig.window || {})), - routeOptions.window || {} - ); - - Object.keys(routeOptions.window).forEach(name => { - if (WEBVIEW_STYLE_BLACKLIST.indexOf(name) === -1) { - webviewStyle[name] = routeOptions.window[name]; - } - }); - - const titleNView = parseTitleNView(routeOptions); - if (titleNView) { - if (id === 1 && __uniConfig.realEntryPagePath === path) { - titleNView.autoBackButton = true; - } - webviewStyle.titleNView = titleNView; - } - - const pullToRefresh = parsePullToRefresh(routeOptions); - if (pullToRefresh) { - if (pullToRefresh.style === 'circle') { - webviewStyle.bounce = 'none'; - } - webviewStyle.pullToRefresh = pullToRefresh; - } - - // 不支持 hide - if (webviewStyle.popGesture === 'hide') { - delete webviewStyle.popGesture; - } - - // TODO 下拉刷新 - - if (path && routeOptions.meta.isNVue) { - webviewStyle.uniNView = { - path, - defaultFontSize: __uniConfig.defaultFontSize, - viewport: __uniConfig.viewport - }; - } - - return webviewStyle - } - - const ANI_SHOW = 'pop-in'; - const ANI_DURATION = 300; - - const TITLEBAR_HEIGHT = 44; - - const VIEW_WEBVIEW_PATH = '__uniappview.html'; - - let preloadWebview; - - let id = 2; - - const WEBVIEW_LISTENERS = { - 'pullToRefresh': 'onPullDownRefresh', - 'titleNViewSearchInputChanged': 'onNavigationBarSearchInputChanged', - 'titleNViewSearchInputConfirmed': 'onNavigationBarSearchInputConfirmed', - 'titleNViewSearchInputClicked': 'onNavigationBarSearchInputClicked' - }; - - function setPreloadWebview (webview) { - preloadWebview = webview; - } - - function createWebview (path, routeOptions) { - if (routeOptions.meta.isNVue) { - const webviewId = id++; - const webviewStyle = parseWebviewStyle( - webviewId, - path, - routeOptions - ); - if (process.env.NODE_ENV !== 'production') { - console.log(`[uni-app] createWebview`, webviewId, path, webviewStyle); - } - return plus.webview.create('', String(webviewId), webviewStyle, { - nvue: true - }) - } - if (id === 2) { // 如果首页非 nvue,则直接返回 Launch Webview - return plus.webview.getLaunchWebview() - } - const webview = preloadWebview; - return webview - } - - function initWebview (webview, routeOptions) { - // 首页或非 nvue 页面 - if (webview.id === '1' || !routeOptions.meta.isNVue) { - const webviewStyle = parseWebviewStyle( - parseInt(webview.id), - '', - routeOptions - ); - if (process.env.NODE_ENV !== 'production') { - console.log(`[uni-app] updateWebview`, webviewStyle); - } - - webview.setStyle(webviewStyle); - } - - const { - on, - emit - } = UniServiceJSBridge; - - // TODO subNVues - Object.keys(WEBVIEW_LISTENERS).forEach(name => { - webview.addEventListener(name, (e) => { - emit(WEBVIEW_LISTENERS[name], e, parseInt(webview.id)); - }); - }); - - webview.addEventListener('resize', ({ - width, - height - }) => { - const res = { - size: { - windowWidth: Math.ceil(width), - windowHeight: Math.ceil(height) - } - }; - publish('onViewDidResize', res); - emit('onResize', res, parseInt(webview.id)); - }); - - // TODO 应该结束之前未完成的下拉刷新 - on(webview.id + '.startPullDownRefresh', () => { - webview.beginPullToRefresh(); - }); - - on(webview.id + '.stopPullDownRefresh', () => { - webview.endPullToRefresh(); - }); - - return webview - } - - function createPreloadWebview () { - if (!preloadWebview || preloadWebview.__uniapp_route) { // 不存在,或已被使用 - preloadWebview = plus.webview.create(VIEW_WEBVIEW_PATH, String(id++)); - } - return preloadWebview - } - - const webviewReadyCallbacks = {}; - - function registerWebviewReady (pageId, callback) { - (webviewReadyCallbacks[pageId] || (webviewReadyCallbacks[pageId] = [])).push(callback); - } - - function consumeWebviewReady (pageId) { - const callbacks = webviewReadyCallbacks[pageId]; - Array.isArray(callbacks) && callbacks.forEach(callback => callback()); - delete webviewReadyCallbacks[pageId]; - } - - const navigatorStack = []; - - function navigate (path, callback) { - let isReady = true; - if (navigatorStack.length) { // 已存在路由跳转 - isReady = false; - } else { - callback.nvue = __uniConfig.page[path.slice(1)].nvue; // 设置 nvue 标记 - // 非 nvue 且 preloadWebview 未准备好 - if (!callback.nvue && (!preloadWebview || !preloadWebview.loaded)) { - isReady = false; - } - } - isReady ? callback() : navigatorStack.push(callback); - } - - function navigateStack (webview) { - if (!navigatorStack.length) { - return (!webview.nvue && createPreloadWebview()) - } - const navigate = navigatorStack.shift(); - if (navigate.nvue) { - navigate(); - } else { - const preloadWebview = createPreloadWebview(); - preloadWebview.loaded ? navigate() : registerWebviewReady(preloadWebview.id, navigate); - } - } - - function perf (type, startTime) { - /* eslint-disable no-undef */ - startTime = startTime || __UniServiceStartTime__; - console.log(`[PERF] ${type} 耗时[${Date.now() - startTime}]`); - } - - const TABBAR_HEIGHT = 56; - - let config; - - /** - * tabbar显示状态 - */ - let visible = true; - - let tabBar; - - /** - * 设置角标 - * @param {string} type - * @param {number} index - * @param {string} text - */ - function setTabBarBadge (type, index, text) { - if (!tabBar) { - return - } - if (type === 'none') { - tabBar.hideTabBarRedDot({ - index - }); - tabBar.removeTabBarBadge({ - index - }); - } else if (type === 'text') { - tabBar.setTabBarBadge({ - index, - text - }); - } else if (type === 'redDot') { - tabBar.showTabBarRedDot({ - index - }); - } - } - /** - * 动态设置 tabBar 某一项的内容 - */ - function setTabBarItem (index, text, iconPath, selectedIconPath) { - const item = {}; - if (iconPath) { - item.iconPath = getRealPath(iconPath); - } - if (selectedIconPath) { - item.selectedIconPath = getRealPath(selectedIconPath); - } - tabBar && tabBar.setTabBarItem(Object.assign({ - index, - text - }, item)); - } - /** - * 动态设置 tabBar 的整体样式 - * @param {Object} style 样式 - */ - function setTabBarStyle (style) { - tabBar && tabBar.setTabBarStyle(style); - } - /** - * 隐藏 tabBar - * @param {boolean} animation 是否需要动画效果 暂未支持 - */ - function hideTabBar (animation) { - visible = false; - tabBar && tabBar.hideTabBar({ - animation - }); - } - /** - * 显示 tabBar - * @param {boolean} animation 是否需要动画效果 暂未支持 - */ - function showTabBar (animation) { - visible = true; - tabBar && tabBar.showTabBar({ - animation - }); - } - - var tabBar$1 = { - init (options, clickCallback) { - if (options && options.list.length) { - config = options; - } - try { - tabBar = requireNativePlugin('uni-tabview'); - } catch (error) { - console.log(`uni.requireNativePlugin("uni-tabview") error ${error}`); - } - tabBar && tabBar.onClick(({ index }) => { - clickCallback(config.list[index], index, true); - }); - tabBar && tabBar.onMidButtonClick(() => { - publish('onTabBarMidButtonTap', {}); - }); - }, - switchTab (page) { - const itemLength = config.list.length; - if (itemLength) { - for (let i = 0; i < itemLength; i++) { - if ( - config.list[i].pagePath === page || - config.list[i].pagePath === `${page}.html` - ) { - tabBar && tabBar.switchSelect({ - index: i - }); - return true - } - } - } - return false - }, - setTabBarBadge, - setTabBarItem, - setTabBarStyle, - hideTabBar, - showTabBar, - append (webview) { - tabBar && tabBar.append({ - id: webview.id - }, ({ code }) => { - if (code !== 0) { - // console.log('tab append error') - setTimeout(() => { - this.append(webview); - }, 20); - } - }); - }, - get visible () { - return visible - }, - get height () { - return config && config.height ? parseFloat(config.height) : TABBAR_HEIGHT - } - }; - - const pages = []; - - function getCurrentPages$1 (returnAll) { - return returnAll ? pages.slice(0) : pages.filter(page => { - return !page.$page.meta.isTabBar || page.$page.meta.visible - }) - } - - const pageFactory = Object.create(null); - - function definePage (name, createPageVueComponent) { - pageFactory[name] = createPageVueComponent; - } - - function createPage (name, options) { - if (!pageFactory[name]) { - console.error(`${name} not found`); - } - let startTime = Date.now(); - const pageVm = new (pageFactory[name]())(options); - if (process.env.NODE_ENV !== 'production') { - perf(`new ${name}`, startTime); - } - return pageVm - } - - /** - * 首页需要主动registerPage,二级页面路由跳转时registerPage - */ - function registerPage ({ - path, - query, - openType, - webview - }) { - const routeOptions = JSON.parse(JSON.stringify(__uniRoutes.find(route => route.path === path))); - - if (openType === 'reLaunch' || pages.length === 0) { - // pages.length===0 表示首页触发 redirectTo - routeOptions.meta.isQuit = true; - } else if (!routeOptions.meta.isTabBar) { - routeOptions.meta.isQuit = false; - } - - if (!webview) { - webview = createWebview(path, routeOptions); - } else { - webview = plus.webview.getWebviewById(webview.id); - } - - if (routeOptions.meta.isTabBar) { - routeOptions.meta.visible = true; - } - - if (routeOptions.meta.isTabBar && webview.id !== '1') { - tabBar$1.append(webview); - } - - if (process.env.NODE_ENV !== 'production') { - console.log(`[uni-app] registerPage`, path, webview.id); - } - - initWebview(webview, routeOptions); - - const route = path.slice(1); - - webview.__uniapp_route = route; - - const pageInstance = { - route, - options: Object.assign({}, query || {}), - $getAppWebview () { - return webview - }, - $page: { - id: parseInt(webview.id), - meta: routeOptions.meta, - path, - route, - openType - }, - $remove () { - const index = pages.findIndex(page => page === this); - if (index !== -1) { - pages.splice(index, 1); - if (process.env.NODE_ENV !== 'production') { - console.log(`[uni-app] removePage`, path, webview.id); - } - } - } - }; - - pages.push(pageInstance); - - // 首页是 nvue 时,在 registerPage 时,执行路由堆栈 - if (webview.id === '1' && routeOptions.meta.isNVue) { - webview.nvue = true; - setTimeout(function () { - navigateStack(webview); - }); - } - - { - if (!webview.nvue) { - const pagePath = path.slice(1); - pageInstance.$vm = createPage(pagePath, { - mpType: 'page', - pageId: webview.id, - pagePath - }); - pageInstance.$vm.$scope = pageInstance; - pageInstance.$vm.$mount(); - } - } - - return webview - } - - const callbacks = {}; - const WEB_INVOKE_APPSERVICE = 'WEB_INVOKE_APPSERVICE'; - // 简单处理 view 层与 service 层的通知系统 - /** - * 消费 view 层通知 - */ - function consumePlusMessage (type, args) { - // 处理 web-view 组件发送的通知 - if (type === WEB_INVOKE_APPSERVICE) { - publish(WEB_INVOKE_APPSERVICE, args.data, args.webviewIds); - return true - } - const callback = callbacks[type]; - if (callback) { - callback(args); - if (!callback.keepAlive) { - delete callbacks[type]; - } - return true - } - return false - } - /** - * 注册 view 层通知 service 层事件处理 - */ - function registerPlusMessage (type, callback, keepAlive = true) { - if (callbacks[type]) { - return console.warn(`${type} 已注册:` + (callbacks[type].toString())) - } - callback.keepAlive = !!keepAlive; - callbacks[type] = callback; - } - - const PAGE_CREATE = 2; - const MOUNTED_DATA = 4; - const UPDATED_DATA = 6; - const PAGE_CREATED = 10; - - const WEBVIEW_READY = 'webviewReady'; - const WEBVIEW_UI_EVENT = 'webviewUIEvent'; - - function onWebviewReady (data, pageId) { - const isLaunchWebview = pageId === '1'; - if (isLaunchWebview) { // 首页 - setPreloadWebview(plus.webview.getLaunchWebview()); - } - if (preloadWebview.id !== pageId) { - return console.error(`webview[${pageId}] not found`) - } - preloadWebview.loaded = true; // 标记已 ready - - consumeWebviewReady(pageId); - - if (isLaunchWebview) { - const entryPagePath = '/' + __uniConfig.entryPagePath; - const routeOptions = __uniRoutes.find(route => route.path === entryPagePath); - if (!routeOptions.meta.isNVue) { // 非 nvue 首页,需要主动跳转 - const navigateType = routeOptions.meta.isTabBar ? 'switchTab' : 'navigateTo'; - process.env.NODE_ENV !== 'production' && perf(`${entryPagePath} navigateTo`); - return uni[navigateType]({ - url: entryPagePath - }) - } - } - } - - const webviewUIEvents = Object.create(null); - - function registerWebviewUIEvent (pageId, callback) { - (webviewUIEvents[pageId] || (webviewUIEvents[pageId] = [])).push(callback); - } - - function removeWebviewUIEvent (pageId) { - delete webviewUIEvents[pageId]; - } - - function onWebviewUIEvent ({ - data, - options - }, pageId) { - const { - cid, - nid - } = options; - const handlers = webviewUIEvents[pageId]; - if (Array.isArray(handlers)) { - handlers.forEach(handler => { - handler(cid, nid, data); - }); - } else { - console.error(`events[${pageId}] not found`); - } - } - - function initSubscribeHandlers () { - const { - subscribe, - subscribeHandler - } = UniServiceJSBridge; - - registerPlusMessage('subscribeHandler', (data) => { - subscribeHandler(data.type, data.data, data.pageId); - }); - - subscribe(WEBVIEW_READY, onWebviewReady); - subscribe(WEBVIEW_UI_EVENT, onWebviewUIEvent); - } - - let appCtx; - - function getApp () { - return appCtx - } - - function initGlobalListeners () { - const emit = UniServiceJSBridge.emit; - - plus.key.addEventListener('backbutton', () => { - uni.navigateBack({ - from: 'backbutton' - }); - }); - - plus.globalEvent.addEventListener('pause', () => { - emit('onAppEnterBackground'); - }); - - plus.globalEvent.addEventListener('resume', () => { - emit('onAppEnterForeground'); - }); - - plus.globalEvent.addEventListener('netchange', () => { - const networkType = NETWORK_TYPES[plus.networkinfo.getCurrentType()]; - publish('onNetworkStatusChange', { - isConnected: networkType !== 'none', - networkType - }); - }); - - plus.globalEvent.addEventListener('KeyboardHeightChange', function (event) { - publish('onKeyboardHeightChange', { - height: event.height - }); - }); - - plus.globalEvent.addEventListener('plusMessage', function (e) { - if (process.env.NODE_ENV !== 'production') { - console.log('[plusMessage]:[' + Date.now() + ']' + JSON.stringify(e.data)); - } - if (e.data && e.data.type) { - const type = e.data.type; - consumePlusMessage(type, e.data.args || {}); - } - }); - } - - function initAppLaunch (appVm) { - const args = { - path: __uniConfig.entryPagePath, - query: {}, - scene: 1001 - }; - - callAppHook(appVm, 'onLaunch', args); - callAppHook(appVm, 'onShow', args); - } - - function initTabBar () { - if (!__uniConfig.tabBar || !__uniConfig.tabBar.list.length) { - return - } - - __uniConfig.tabBar.selected = 0; - - const selected = __uniConfig.tabBar.list.findIndex(page => page.pagePath === __uniConfig.entryPagePath); - if (selected !== -1) { - // 取当前 tab 索引值 - __uniConfig.tabBar.selected = selected; - } - - __uniConfig.__ready__ = true; - - tabBar$1.init(__uniConfig.tabBar, (item, index) => { - uni.switchTab({ - url: '/' + item.pagePath, - openType: 'switchTab', - from: 'tabBar', - success () { - UniServiceJSBridge.emit('onTabItemTap', { - index, - text: item.text, - pagePath: item.pagePath - }); - } - }); - }); - } - - function registerApp (appVm) { - if (process.env.NODE_ENV !== 'production') { - console.log(`[uni-app] registerApp`); - } - - appCtx = appVm; - - appCtx.globalData = appVm.$options.globalData || {}; - - initOn(UniServiceJSBridge.on, { - getApp, - getCurrentPages: getCurrentPages$1 - }); - - initTabBar(); - - initGlobalListeners(); - - initSubscribeHandlers(); - - initAppLaunch(appVm); - - process.env.NODE_ENV !== 'production' && perf('registerApp'); - } - - var tags = [ - 'uni-app', - 'uni-tabbar', - 'uni-page', - 'uni-page-head', - 'uni-page-wrapper', - 'uni-page-body', - 'uni-page-refresh', - 'uni-actionsheet', - 'uni-modal', - 'uni-picker', - 'uni-toast', - 'uni-resize-sensor', - - 'uni-ad', - 'uni-audio', - 'uni-button', - 'uni-camera', - 'uni-canvas', - 'uni-checkbox', - 'uni-checkbox-group', - 'uni-cover-image', - 'uni-cover-view', - 'uni-form', - 'uni-functional-page-navigator', - 'uni-icon', - 'uni-image', - 'uni-input', - 'uni-label', - 'uni-live-player', - 'uni-live-pusher', - 'uni-map', - 'uni-movable-area', - 'uni-movable-view', - 'uni-navigator', - 'uni-official-account', - 'uni-open-data', - 'uni-picker', - 'uni-picker-view', - 'uni-picker-view-column', - 'uni-progress', - 'uni-radio', - 'uni-radio-group', - 'uni-rich-text', - 'uni-scroll-view', - 'uni-slider', - 'uni-swiper', - 'uni-swiper-item', - 'uni-switch', - 'uni-text', - 'uni-textarea', - 'uni-video', - 'uni-view', - 'uni-web-view' - ]; - - // 使用白名单过滤(前期有一批自定义组件使用了 uni-) - - function initVue (Vue) { - const oldIsReservedTag = Vue.config.isReservedTag; - - Vue.config.isReservedTag = function (tag) { - return tags.indexOf(tag) !== -1 || oldIsReservedTag(tag) - }; - - Vue.config.ignoredElements = tags; - - const oldGetTagNamespace = Vue.config.getTagNamespace; - - const conflictTags = ['switch', 'image', 'text', 'view']; - - Vue.config.getTagNamespace = function (tag) { - if (~conflictTags.indexOf(tag)) { // svg 部分标签名称与 uni 标签冲突 - return false - } - return oldGetTagNamespace(tag) || false - }; - } - - class VDomSync { - constructor (pageId, pagePath) { - this.pageId = pageId; - this.pagePath = pagePath; - this.batchData = []; - this.vms = Object.create(null); - this.initialized = false; - // 事件 - this.handlers = Object.create(null); - - this._init(); - } - - _init () { - registerWebviewUIEvent(this.pageId, (cid, nid, event) => { - console.log(`[EVENT]`, cid, nid, event); - if ( - this.handlers[cid] && - this.handlers[cid][nid] && - this.handlers[cid][nid][event.type] - ) { - this.handlers[cid][nid][event.type].forEach(handler => { - handler(event); - }); - } - }); - } - - getVm (id) { - return this.vms[id] - } - - addVm (vm) { - this.vms[vm._$id] = vm; - } - - removeVm (vm) { - delete this.vms[vm._$id]; - } - - addEvent (cid, nid, name, handler) { - const cHandlers = this.handlers[cid] || (this.handlers[cid] = Object.create(null)); - const nHandlers = cHandlers[nid] || (cHandlers[nid] = Object.create(null)); - (nHandlers[name] || (nHandlers[name] = [])).push(handler); - } - - removeEvent (cid, nid, name, handler) { - const cHandlers = this.handlers[cid] || (this.handlers[cid] = Object.create(null)); - const nHandlers = cHandlers[nid] || (cHandlers[nid] = Object.create(null)); - const eHandlers = nHandlers[name]; - if (Array.isArray(eHandlers)) { - const index = eHandlers.indexOf(handler); - if (index !== -1) { - eHandlers.splice(index, 1); - } - } - } - - push (type, nodeId, data) { - this.batchData.push([type, [nodeId, data]]); - } - - flush () { - if (!this.initialized) { - this.initialized = true; - this.batchData.unshift([PAGE_CREATE, [this.pageId]]); - this.batchData.push([PAGE_CREATED, [this.pagePath]]); - } - if (this.batchData.length) { - UniServiceJSBridge.publishHandler('vdSync', { - data: this.batchData, - options: { - timestamp: Date.now() - } - }, [this.pageId]); - this.batchData.length = 0; - } - } - - destroy () { - this.batchData.length = 0; - this.vms = Object.create(null); - this.initialized = false; - this.handlers = Object.create(null); - removeWebviewUIEvent(this.pageId); - } - } - - function setResult (data, k, v) { - data[k] = v; - } - - function diffObject (id, newObj, oldObj, result) { - let key, cur, old; - for (key in newObj) { - cur = newObj[key]; - old = oldObj[key]; - if (old !== cur) { - setResult(result[id] || (result[id] = {}), key, cur); - } - } - } - - function diff (newData, oldData) { - const result = Object.create(null); - let id, cur, old; - for (id in newData) { - cur = newData[id]; - old = oldData[id]; - if (!old) { - setResult(result, id, cur); - continue - } - diffObject(id, cur, old, result); - } - return result - } - - function initData (Vue) { - Vue.prototype._$s = setData; - Vue.prototype._$i = setIfData; - Vue.prototype._$f = setForData; - Vue.prototype._$e = setElseIfData; - - Vue.prototype._$setData = function setData (type, data) { - this._$vd.push(type, this._$id, data); - this.$nextTick(this._$vd.flush.bind(this._$vd)); - }; - - Object.defineProperty(Vue.prototype, '_$vd', { - get () { - return this.$root._$vdomSync - } - }); - - Vue.mixin({ - beforeCreate () { - if (this.$options.mpType) { - this.mpType = this.$options.mpType; - } - if (this.mpType === 'app') { - return - } - if (this.mpType === 'page') { - this._$vdomSync = new VDomSync(this.$options.pageId, this.$options.pagePath); - } - if (this._$vd) { - this._$id = guid(); - this._$vd.addVm(this); - console.log(`[${this._$id}] beforeCreate ` + Date.now()); - // 目前全量采集做 diff(iOS 需要保留全量状态做 restore),理论上可以差量采集 - this._$data = Object.create(null); - this._$newData = Object.create(null); - } - }, - mounted () { - if (!this._$vd) { - return - } - const diffData = diff(this._$newData, this._$data); - this._$data = JSON.parse(JSON.stringify(this._$newData)); - console.log(`[${this._$id}] mounted ` + Date.now()); - this._$setData(MOUNTED_DATA, diffData); - }, - beforeUpdate () { - if (!this._$vd) { - return - } - console.log(`[${this._$id}] beforeUpdate ` + Date.now()); - this._$newData = Object.create(null); - }, - updated () { - if (!this._$vd) { - return - } - const diffData = diff(this._$newData, this._$data); - this._$data = JSON.parse(JSON.stringify(this._$newData)); - console.log(`[${this._$id}] updated ` + Date.now()); - this._$setData(UPDATED_DATA, diffData); - }, - beforeDestroy () { - if (!this._$vd) { - return - } - this._$vd.removeVm(this); - this._$vdomSync && this._$vdomSync.destory(); - } - }); - } - - function setData (id, name, value) { - const diffData = this._$newData[id] || (this._$newData[id] = {}); - - if (typeof name !== 'string') { - for (let key in name) { - diffData[key] = name[key]; - } - return name - } - - if (name === 'a-_i') { - return value - } - return (diffData[name] = value) - } - - function setForData (id, value) { - const { - forIndex, - key - } = value; - - const diffData = this._$newData[id] || (this._$newData[id] = {}); - const vForData = diffData['v-for'] || (diffData['v-for'] = []); - if (!hasOwn(value, 'keyIndex')) { - vForData[forIndex] = key; - } else { - (vForData[forIndex] || (vForData[forIndex] = {}))['k' + value.keyIndex] = key; - } - return key - } - - function setIfData (id, value) { - return ((this._$newData[id] || (this._$newData[id] = {}))['v-if'] = value) - } - - function setElseIfData (id, value) { - return ((this._$newData[id] || (this._$newData[id] = {}))['v-else-if'] = value) - } - - /* @flow */ - - const LIFECYCLE_HOOKS = [ - // App - 'onLaunch', - 'onShow', - 'onHide', - 'onUniNViewMessage', - 'onError', - // Page - 'onLoad', - // 'onShow', - 'onReady', - // 'onHide', - 'onUnload', - 'onPullDownRefresh', - 'onReachBottom', - 'onTabItemTap', - 'onShareAppMessage', - 'onResize', - 'onPageScroll', - 'onNavigationBarButtonTap', - 'onBackPress', - 'onNavigationBarSearchInputChanged', - 'onNavigationBarSearchInputConfirmed', - 'onNavigationBarSearchInputClicked', - // Component - // 'onReady', // 兼容旧版本,应该移除该事件 - 'onPageShow', - 'onPageHide', - 'onPageResize' - ]; - function lifecycleMixin (Vue) { - // fixed vue-class-component - const oldExtend = Vue.extend; - Vue.extend = function (extendOptions) { - extendOptions = extendOptions || {}; - - const methods = extendOptions.methods; - if (methods) { - Object.keys(methods).forEach(methodName => { - if (LIFECYCLE_HOOKS.indexOf(methodName) !== -1) { - extendOptions[methodName] = methods[methodName]; - delete methods[methodName]; - } - }); - } - - return oldExtend.call(this, extendOptions) - }; - - const strategies = Vue.config.optionMergeStrategies; - const mergeHook = strategies.created; - LIFECYCLE_HOOKS.forEach(hook => { - strategies[hook] = mergeHook; - }); - } - - var plugin = { - install (Vue, options) { - initVue(Vue); - - initData(Vue); - lifecycleMixin(Vue); - - const oldMount = Vue.prototype.$mount; - Vue.prototype.$mount = function mount (el, hydrating) { - if (this.mpType === 'app') { - this.$options.render = function () {}; - registerApp(this); - } - return oldMount.call(this, el, hydrating) - }; - } - }; - - function parseRoutes (config) { - __uniRoutes.length = 0; - /* eslint-disable no-mixed-operators */ - const tabBarList = (config.tabBar && config.tabBar.list || []).map(item => item.pagePath); - - Object.keys(config.page).forEach(function (pagePath) { - const isTabBar = tabBarList.indexOf(pagePath) !== -1; - const isQuit = isTabBar || (config.pages[0] === pagePath); - const isNVue = !!config.page[pagePath].nvue; - __uniRoutes.push({ - path: '/' + pagePath, - meta: { - isQuit, - isTabBar, - isNVue - }, - window: config.page[pagePath].window || {} - }); - }); - } - - function registerConfig (config, Vue) { - { - Vue.use(plugin); - } - Object.assign(__uniConfig, config); - - __uniConfig.viewport = ''; - __uniConfig.defaultFontSize = ''; - - if (__uniConfig.nvueCompiler === 'uni-app') { - __uniConfig.viewport = plus.screen.resolutionWidth; - __uniConfig.defaultFontSize = __uniConfig.viewport / 20; - } - - parseRoutes(__uniConfig); - - if (process.env.NODE_ENV !== 'production') { - console.log(`[uni-app] registerConfig`, __uniConfig); - } - } - const base = [ 'base64ToArrayBuffer', 'arrayBufferToBase64', @@ -1943,7 +203,8 @@ var serviceContext = (function () { 'onPush', 'offPush', 'requireNativePlugin', - 'upx2px' + 'upx2px', + 'registerPlus' ]; const apis = [ @@ -1964,6 +225,87 @@ var serviceContext = (function () { var apis_1 = apis; + let supportsPassive = false; + try { + const opts = {}; + Object.defineProperty(opts, 'passive', ({ + get () { + /* istanbul ignore next */ + supportsPassive = true; + } + })); // https://github.com/facebook/flow/issues/285 + window.addEventListener('test-passive', null, opts); + } catch (e) {} + + const _toString = Object.prototype.toString; + const hasOwnProperty = Object.prototype.hasOwnProperty; + + function isFn (fn) { + return typeof fn === 'function' + } + + function isPlainObject (obj) { + return _toString.call(obj) === '[object Object]' + } + + function hasOwn (obj, key) { + return hasOwnProperty.call(obj, key) + } + + function toRawType (val) { + return _toString.call(val).slice(8, -1) + } + + /** + * Create a cached version of a pure function. + */ + function cached (fn) { + const cache = Object.create(null); + return function cachedFn (str) { + const hit = cache[str]; + return hit || (cache[str] = fn(str)) + } + } + + function getLen (str = '') { + /* eslint-disable no-control-regex */ + return ('' + str).replace(/[^\x00-\xff]/g, '**').length + } + + function guid () { + return Math.floor(4294967296 * (1 + Math.random())).toString(16).slice(1) + } + + const decode = decodeURIComponent; + + function parseQuery (query) { + const res = {}; + + query = query.trim().replace(/^(\?|#|&)/, ''); + + if (!query) { + return res + } + + query.split('&').forEach(param => { + const parts = param.replace(/\+/g, ' ').split('='); + const key = decode(parts.shift()); + const val = parts.length > 0 + ? decode(parts.join('=')) + : null; + + if (res[key] === undefined) { + res[key] = val; + } else if (Array.isArray(res[key])) { + res[key].push(val); + } else { + res[key] = [res[key], val]; + } + }); + + return res + } + /** * 框架内 try-catch */ @@ -2252,21 +594,21 @@ var serviceContext = (function () { } } - const base64ToArrayBuffer$1 = [{ + const base64ToArrayBuffer = [{ name: 'base64', type: String, required: true }]; - const arrayBufferToBase64$1 = [{ + const arrayBufferToBase64 = [{ name: 'arrayBuffer', type: [ArrayBuffer, Uint8Array], required: true }]; var require_context_module_0_0 = /*#__PURE__*/Object.freeze({ - base64ToArrayBuffer: base64ToArrayBuffer$1, - arrayBufferToBase64: arrayBufferToBase64$1 + base64ToArrayBuffer: base64ToArrayBuffer, + arrayBufferToBase64: arrayBufferToBase64 }); const canIUse = [{ @@ -2674,7 +1016,7 @@ var serviceContext = (function () { chooseVideo: chooseVideo }); - function getRealRoute$1 (fromRoute, toRoute) { + function getRealRoute (fromRoute, toRoute) { if (!toRoute) { toRoute = fromRoute; if (toRoute.indexOf('/') === 0) { @@ -2692,7 +1034,7 @@ var serviceContext = (function () { } } if (toRoute.indexOf('./') === 0) { - return getRealRoute$1(fromRoute, toRoute.substr(2)) + return getRealRoute(fromRoute, toRoute.substr(2)) } const toRouteArray = toRoute.split('/'); const toRouteLength = toRouteArray.length; @@ -2714,7 +1056,7 @@ var serviceContext = (function () { return filePath } - function getRealPath$1 (filePath) { + function getRealPath (filePath) { if (filePath.indexOf('/') === 0) { if (filePath.indexOf('//') === 0) { filePath = 'https:' + filePath; @@ -2729,7 +1071,7 @@ var serviceContext = (function () { const pages = getCurrentPages(); if (pages.length) { - return addBase(getRealRoute$1(pages[pages.length - 1].$page.route, filePath).substr(1)) + return addBase(getRealRoute(pages[pages.length - 1].$page.route, filePath).substr(1)) } return filePath @@ -2740,7 +1082,7 @@ var serviceContext = (function () { type: String, required: true, validator (src, params) { - params.src = getRealPath$1(src); + params.src = getRealPath(src); } } }; @@ -2757,7 +1099,7 @@ var serviceContext = (function () { var typeError; params.urls = value.map(url => { if (typeof url === 'string') { - return getRealPath$1(url) + return getRealPath(url) } else { typeError = true; } @@ -2773,7 +1115,7 @@ var serviceContext = (function () { if (typeof value === 'number') { params.current = value > 0 && value < params.urls.length ? value : 0; } else if (typeof value === 'string' && value) { - params.current = getRealPath$1(value); + params.current = getRealPath(value); } }, default: 0 @@ -2967,7 +1309,7 @@ var serviceContext = (function () { type: String, required: true, validator (value, params) { - params.type = getRealPath$1(value); + params.type = getRealPath(value); } }, name: { @@ -3052,7 +1394,7 @@ var serviceContext = (function () { function createValidator (type) { return function validator (url, params) { // 格式化为绝对路径路由 - url = getRealRoute$1(url); + url = getRealRoute(url); const pagePath = url.split('?')[0]; // 匹配路由是否存在 @@ -3326,7 +1668,7 @@ var serviceContext = (function () { default: '', validator (image, params) { if (image) { - params.image = getRealPath$1(image); + params.image = getRealPath(image); } } }, @@ -3398,7 +1740,7 @@ var serviceContext = (function () { required: true }; - const setTabBarItem$1 = { + const setTabBarItem = { index: indexValidator, text: { type: String @@ -3411,7 +1753,7 @@ var serviceContext = (function () { } }; - const setTabBarStyle$1 = { + const setTabBarStyle = { color: { type: String }, @@ -3431,14 +1773,14 @@ var serviceContext = (function () { } }; - const hideTabBar$1 = { + const hideTabBar = { animation: { type: Boolean, default: false } }; - const showTabBar$1 = { + const showTabBar = { animation: { type: Boolean, default: false @@ -3457,7 +1799,7 @@ var serviceContext = (function () { index: indexValidator }; - const setTabBarBadge$1 = { + const setTabBarBadge = { index: indexValidator, text: { type: String, @@ -3471,14 +1813,14 @@ var serviceContext = (function () { }; var require_context_module_0_26 = /*#__PURE__*/Object.freeze({ - setTabBarItem: setTabBarItem$1, - setTabBarStyle: setTabBarStyle$1, - hideTabBar: hideTabBar$1, - showTabBar: showTabBar$1, + setTabBarItem: setTabBarItem, + setTabBarStyle: setTabBarStyle, + hideTabBar: hideTabBar, + showTabBar: showTabBar, hideTabBarRedDot: hideTabBarRedDot, showTabBarRedDot: showTabBarRedDot, removeTabBarBadge: removeTabBarBadge, - setTabBarBadge: setTabBarBadge$1 + setTabBarBadge: setTabBarBadge }); const protocol = Object.create(null); @@ -3946,17 +2288,92 @@ var serviceContext = (function () { } } - function base64ToArrayBuffer$2 (str) { + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + var base64Arraybuffer = createCommonjsModule(function (module, exports) { + /* + * base64-arraybuffer + * https://github.com/niklasvh/base64-arraybuffer + * + * Copyright (c) 2012 Niklas von Hertzen + * Licensed under the MIT license. + */ + (function(){ + + var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + // Use a lookup table to find the index. + var lookup = new Uint8Array(256); + for (var i = 0; i < chars.length; i++) { + lookup[chars.charCodeAt(i)] = i; + } + + exports.encode = function(arraybuffer) { + var bytes = new Uint8Array(arraybuffer), + i, len = bytes.length, base64 = ""; + + for (i = 0; i < len; i+=3) { + base64 += chars[bytes[i] >> 2]; + base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; + base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; + base64 += chars[bytes[i + 2] & 63]; + } + + if ((len % 3) === 2) { + base64 = base64.substring(0, base64.length - 1) + "="; + } else if (len % 3 === 1) { + base64 = base64.substring(0, base64.length - 2) + "=="; + } + + return base64; + }; + + exports.decode = function(base64) { + var bufferLength = base64.length * 0.75, + len = base64.length, i, p = 0, + encoded1, encoded2, encoded3, encoded4; + + if (base64[base64.length - 1] === "=") { + bufferLength--; + if (base64[base64.length - 2] === "=") { + bufferLength--; + } + } + + var arraybuffer = new ArrayBuffer(bufferLength), + bytes = new Uint8Array(arraybuffer); + + for (i = 0; i < len; i+=4) { + encoded1 = lookup[base64.charCodeAt(i)]; + encoded2 = lookup[base64.charCodeAt(i+1)]; + encoded3 = lookup[base64.charCodeAt(i+2)]; + encoded4 = lookup[base64.charCodeAt(i+3)]; + + bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); + bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); + bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); + } + + return arraybuffer; + }; + })(); + }); + var base64Arraybuffer_1 = base64Arraybuffer.encode; + var base64Arraybuffer_2 = base64Arraybuffer.decode; + + function base64ToArrayBuffer$1 (str) { return base64Arraybuffer_2(str) } - function arrayBufferToBase64$2 (buffer) { + function arrayBufferToBase64$1 (buffer) { return base64Arraybuffer_1(buffer) } var require_context_module_1_0 = /*#__PURE__*/Object.freeze({ - base64ToArrayBuffer: base64ToArrayBuffer$2, - arrayBufferToBase64: arrayBufferToBase64$2 + base64ToArrayBuffer: base64ToArrayBuffer$1, + arrayBufferToBase64: arrayBufferToBase64$1 }); var platformSchema = {}; @@ -4002,33 +2419,256 @@ var serviceContext = (function () { isIOS = platform === 'ios'; } - function upx2px$1 (number, newDeviceWidth) { - if (deviceWidth === 0) { - checkDeviceWidth(); + function upx2px$1 (number, newDeviceWidth) { + if (deviceWidth === 0) { + checkDeviceWidth(); + } + + number = Number(number); + if (number === 0) { + return 0 + } + let result = (number / BASE_DEVICE_WIDTH) * (newDeviceWidth || deviceWidth); + if (result < 0) { + result = -result; + } + result = Math.floor(result + EPS); + if (result === 0) { + if (deviceDPR === 1 || !isIOS) { + return 1 + } else { + return 0.5 + } + } + return number < 0 ? -result : result + } + + var require_context_module_1_3 = /*#__PURE__*/Object.freeze({ + upx2px: upx2px$1 + }); + + function unpack (args) { + return args + } + + function invoke (...args) { + return UniServiceJSBridge.invokeCallbackHandler(...args) + } + + function requireNativePlugin (name) { + return uni.requireNativePlugin(name) + } + + /** + * 触发 service 层,与 onMethod 对应 + */ + function publish (name, res) { + return UniServiceJSBridge.emit('api.' + name, res) + } + + let lastStatusBarStyle; + + function setStatusBarStyle (statusBarStyle) { + if (!statusBarStyle) { + const pages = getCurrentPages(); + if (!pages.length) { + return + } + statusBarStyle = pages[pages.length - 1].$page.meta.statusBarStyle; + if (!statusBarStyle || statusBarStyle === lastStatusBarStyle) { + return + } + } + if (process.env.NODE_ENV !== 'production') { + console.log(`[uni-app] setStatusBarStyle`, statusBarStyle); + } + + lastStatusBarStyle = statusBarStyle; + + plus.navigator.setStatusBarStyle(statusBarStyle); + } + + function isTabBarPage (path = '') { + if (!(__uniConfig.tabBar && Array.isArray(__uniConfig.tabBar.list))) { + return false + } + try { + if (!path) { + const pages = getCurrentPages(); + if (!pages.length) { + return false + } + const page = pages[pages.length - 1]; + if (!page) { + return false + } + return page.$page.meta.isTabBar + } + const route = __uniRoutes.find(route => route.path.slice(1) === path); + return route && route.meta.isTabBar + } catch (e) { + if (process.env.NODE_ENV !== 'production') { + console.log('getCurrentPages is not ready'); + } + } + return false + } + + function base64ToArrayBuffer$2 (data) { + return base64Arraybuffer_2(data) + } + + function arrayBufferToBase64$2 (data) { + return base64Arraybuffer_1(data) + } + + function callApiSync (api, args, name, alias) { + const ret = api(args); + if (ret && ret.errMsg) { + ret.errMsg = ret.errMsg.replace(name, alias); + } + return ret + } + + function getLastWebview () { + try { + const pages = getCurrentPages(); + if (pages.length) { + return pages[pages.length - 1].$getAppWebview() + } + } catch (e) { + if (process.env.NODE_ENV !== 'production') { + console.log('getCurrentPages is not ready'); + } + } + } + + const getRealRoute$1 = (e, t) => { + if (t.indexOf('./') === 0) return getRealRoute$1(e, t.substr(2)) + let n; + let i; + let o = t.split('/'); + for (n = 0, i = o.length; n < i && o[n] === '..'; n++); + o.splice(0, n); + t = o.join('/'); + let r = e.length > 0 ? e.split('/') : []; + r.splice(r.length - n - 1, n + 1); + return r.concat(o).join('/') + }; + + // 处理 Android 平台解压与非解压模式下获取的路径不一致的情况 + const _handleLocalPath = filePath => { + let localUrl = plus.io.convertLocalFileSystemURL(filePath); + return localUrl.replace(/^\/?apps\//, '/android_asset/apps/').replace(/\/$/, '') + }; + + function getRealPath$1 (filePath) { + const SCHEME_RE = /^([a-z-]+:)?\/\//i; + const DATA_RE = /^data:.*,.*/; + + // 无协议的情况补全 https + if (filePath.indexOf('//') === 0) { + filePath = 'https:' + filePath; + } + + // 网络资源或base64 + if (SCHEME_RE.test(filePath) || DATA_RE.test(filePath)) { + return filePath + } + + if (filePath.indexOf('_www') === 0 || filePath.indexOf('_doc') === 0 || filePath.indexOf('_documents') === 0 || + filePath.indexOf('_downloads') === 0) { + return 'file://' + _handleLocalPath(filePath) + } + const wwwPath = 'file://' + _handleLocalPath('_www'); + // 绝对路径转换为本地文件系统路径 + if (filePath.indexOf('/') === 0) { + return wwwPath + filePath + } + // 相对资源 + if (filePath.indexOf('../') === 0 || filePath.indexOf('./') === 0) { + if (typeof __id__ === 'string') { + return wwwPath + getRealRoute$1('/' + __id__, filePath) + } else { + const pages = getCurrentPages(); + if (pages.length) { + return wwwPath + getRealRoute$1('/' + pages[pages.length - 1].route, filePath) + } + } + } + return filePath + } + + function getStatusBarStyle () { + let style = plus.navigator.getStatusBarStyle(); + if (style === 'UIStatusBarStyleBlackTranslucent' || style === 'UIStatusBarStyleBlackOpaque' || style === 'null') { + style = 'light'; + } else if (style === 'UIStatusBarStyleDefault') { + style = 'dark'; + } + return style + } + + const PI = 3.1415926535897932384626; + const a = 6378245.0; + const ee = 0.00669342162296594323; + + function wgs84togcj02 (lng, lat) { + lat = +lat; + lng = +lng; + if (outOfChina(lng, lat)) { + return [lng, lat] } + let dlat = _transformlat(lng - 105.0, lat - 35.0); + let dlng = _transformlng(lng - 105.0, lat - 35.0); + const radlat = lat / 180.0 * PI; + let magic = Math.sin(radlat); + magic = 1 - ee * magic * magic; + const sqrtmagic = Math.sqrt(magic); + dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI); + dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI); + const mglat = lat + dlat; + const mglng = lng + dlng; + return [mglng, mglat] + } - number = Number(number); - if (number === 0) { - return 0 - } - let result = (number / BASE_DEVICE_WIDTH) * (newDeviceWidth || deviceWidth); - if (result < 0) { - result = -result; - } - result = Math.floor(result + EPS); - if (result === 0) { - if (deviceDPR === 1 || !isIOS) { - return 1 - } else { - return 0.5 - } + function gcj02towgs84 (lng, lat) { + lat = +lat; + lng = +lng; + if (outOfChina(lng, lat)) { + return [lng, lat] } - return number < 0 ? -result : result - } - - var require_context_module_1_3 = /*#__PURE__*/Object.freeze({ - upx2px: upx2px$1 - }); + let dlat = _transformlat(lng - 105.0, lat - 35.0); + let dlng = _transformlng(lng - 105.0, lat - 35.0); + const radlat = lat / 180.0 * PI; + let magic = Math.sin(radlat); + magic = 1 - ee * magic * magic; + const sqrtmagic = Math.sqrt(magic); + dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI); + dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI); + const mglat = lat + dlat; + const mglng = lng + dlng; + return [lng * 2 - mglng, lat * 2 - mglat] + } + + const _transformlat = function (lng, lat) { + let ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng)); + ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0; + ret += (20.0 * Math.sin(lat * PI) + 40.0 * Math.sin(lat / 3.0 * PI)) * 2.0 / 3.0; + ret += (160.0 * Math.sin(lat / 12.0 * PI) + 320 * Math.sin(lat * PI / 30.0)) * 2.0 / 3.0; + return ret + }; + const _transformlng = function (lng, lat) { + let ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng)); + ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0; + ret += (20.0 * Math.sin(lng * PI) + 40.0 * Math.sin(lng / 3.0 * PI)) * 2.0 / 3.0; + ret += (150.0 * Math.sin(lng / 12.0 * PI) + 300.0 * Math.sin(lng / 30.0 * PI)) * 2.0 / 3.0; + return ret + }; + + const outOfChina = function (lng, lat) { + return (lng < 72.004 || lng > 137.8347) || ((lat < 0.8293 || lat > 55.8271) || false) + }; let audios = {}; @@ -4111,7 +2751,7 @@ var serviceContext = (function () { autoplay }; if (src) { - audio.src = style.src = getRealPath(src); + audio.src = style.src = getRealPath$1(src); } if (startTime) { audio.startTime = style.startTime = startTime; @@ -4235,7 +2875,7 @@ var serviceContext = (function () { if (props.indexOf(key) >= 0) { let val = args[key]; if (key === props[0] && val) { - val = getRealPath(val); + val = getRealPath$1(val); } audio[key] = style[key] = val; } @@ -4345,6 +2985,14 @@ var serviceContext = (function () { return data } + const DEVICE_FREQUENCY = 200; + const NETWORK_TYPES = ['unknown', 'none', 'ethernet', 'wifi', '2g', '3g', '4g']; + + const MAP_ID = '__UNIAPP_MAP'; + + const TEMP_PATH_BASE = '_doc/uniapp_temp'; + const TEMP_PATH = `${TEMP_PATH_BASE}_${Date.now()}`; + let watchAccelerationId = false; let isWatchAcceleration = false; @@ -4437,4745 +3085,6166 @@ var serviceContext = (function () { } contact.name = name; - if (nickName) { - contact.nickname = nickName; + if (nickName) { + contact.nickname = nickName; + } + + if (photoFilePath) { + contact.photos = [{ + type: 'url', + value: photoFilePath + }]; + } + + if (remark) { + contact.note = remark; + } + + const mobilePhone = { + type: 'mobile' + }; + + const workPhone = { + type: 'work' + }; + + const companyPhone = { + type: 'company' + }; + + const homeFax = { + type: 'home fax' + }; + + const workFax = { + type: 'work fax' + }; + + if (mobilePhoneNumber) { + mobilePhone.value = mobilePhoneNumber; + } + + if (workPhoneNumber) { + workPhone.value = workPhoneNumber; + } + + if (hostNumber) { + companyPhone.value = hostNumber; + } + + if (homeFaxNumber) { + homeFax.value = homeFaxNumber; + } + + if (workFaxNumber) { + workFax.value = workFaxNumber; + } + + contact.phoneNumbers = [mobilePhone, workPhone, companyPhone, homeFax, workFax]; + + if (email) { + contact.emails = [{ + type: 'home', + value: email + }]; + } + + if (url) { + contact.urls = [{ + type: 'other', + value: url + }]; + } + + if (weChatNumber) { + contact.ims = [{ + type: 'other', + value: weChatNumber + }]; + } + + const defaultAddress = { + type: 'other', + preferred: true + }; + + const homeAddress = { + type: 'home' + }; + const companyAddress = { + type: 'company' + }; + + if (addressCountry) { + defaultAddress.country = addressCountry; + } + + if (addressState) { + defaultAddress.region = addressState; + } + + if (addressCity) { + defaultAddress.locality = addressCity; + } + + if (addressStreet) { + defaultAddress.streetAddress = addressStreet; + } + + if (addressPostalCode) { + defaultAddress.postalCode = addressPostalCode; + } + + if (homeAddressCountry) { + homeAddress.country = homeAddressCountry; + } + + if (homeAddressState) { + homeAddress.region = homeAddressState; + } + + if (homeAddressCity) { + homeAddress.locality = homeAddressCity; + } + + if (homeAddressStreet) { + homeAddress.streetAddress = homeAddressStreet; + } + + if (homeAddressPostalCode) { + homeAddress.postalCode = homeAddressPostalCode; + } + + if (workAddressCountry) { + companyAddress.country = workAddressCountry; + } + + if (workAddressState) { + companyAddress.region = workAddressState; + } + + if (workAddressCity) { + companyAddress.locality = workAddressCity; + } + + if (workAddressStreet) { + companyAddress.streetAddress = workAddressStreet; + } + + if (workAddressPostalCode) { + companyAddress.postalCode = workAddressPostalCode; + } + + contact.addresses = [defaultAddress, homeAddress, companyAddress]; + + contact.save(() => { + invoke(callbackId, { + errMsg: 'addPhoneContact:ok' + }); + }, (e) => { + invoke(callbackId, { + errMsg: 'addPhoneContact:fail' + }); + }); + }, (e) => { + invoke(callbackId, { + errMsg: 'addPhoneContact:fail' + }); + }); + } + + /** + * 执行蓝牙相关方法 + */ + function bluetoothExec (method, callbackId, data = {}, beforeSuccess) { + var deviceId = data.deviceId; + if (deviceId) { + data.deviceId = deviceId.toUpperCase(); + } + var serviceId = data.serviceId; + if (serviceId) { + data.serviceId = serviceId.toUpperCase(); + } + + plus.bluetooth[method.replace('Changed', 'Change')](Object.assign(data, { + success (data) { + if (typeof beforeSuccess === 'function') { + beforeSuccess(data); + } + invoke(callbackId, Object.assign({}, data, { + errMsg: `${method}:ok`, + code: undefined, + message: undefined + })); + }, + fail (error = {}) { + invoke(callbackId, { + errMsg: `${method}:fail ${error.message || ''}`, + errCode: error.code || 0 + }); } - - if (photoFilePath) { - contact.photos = [{ - type: 'url', - value: photoFilePath - }]; + })); + } + /** + * 监听蓝牙相关事件 + */ + function bluetoothOn (method, beforeSuccess) { + plus.bluetooth[method.replace('Changed', 'Change')](function (data) { + if (typeof beforeSuccess === 'function') { + beforeSuccess(data); } + publish(method, Object.assign({}, data, { + code: undefined, + message: undefined + })); + }); + return true + } - if (remark) { - contact.note = remark; + function checkDevices (data) { + data.devices = data.devices.map(device => { + var advertisData = device.advertisData; + if (advertisData && typeof advertisData !== 'string') { + device.advertisData = arrayBufferToBase64$2(advertisData); } + return device + }); + } - const mobilePhone = { - type: 'mobile' - }; + var onBluetoothAdapterStateChange; + var onBluetoothDeviceFound; + var onBLEConnectionStateChange; + var onBLEConnectionStateChanged; + var onBLECharacteristicValueChange; - const workPhone = { - type: 'work' - }; + function openBluetoothAdapter (data, callbackId) { + onBluetoothAdapterStateChange = onBluetoothAdapterStateChange || bluetoothOn('onBluetoothAdapterStateChange'); + bluetoothExec('openBluetoothAdapter', callbackId); + } - const companyPhone = { - type: 'company' - }; + function closeBluetoothAdapter (data, callbackId) { + bluetoothExec('closeBluetoothAdapter', callbackId); + } - const homeFax = { - type: 'home fax' - }; + function getBluetoothAdapterState (data, callbackId) { + bluetoothExec('getBluetoothAdapterState', callbackId); + } - const workFax = { - type: 'work fax' - }; + function startBluetoothDevicesDiscovery (data, callbackId) { + onBluetoothDeviceFound = onBluetoothDeviceFound || bluetoothOn('onBluetoothDeviceFound', checkDevices); + bluetoothExec('startBluetoothDevicesDiscovery', callbackId, data); + } - if (mobilePhoneNumber) { - mobilePhone.value = mobilePhoneNumber; - } + function stopBluetoothDevicesDiscovery (data, callbackId) { + bluetoothExec('stopBluetoothDevicesDiscovery', callbackId); + } - if (workPhoneNumber) { - workPhone.value = workPhoneNumber; - } + function getBluetoothDevices (data, callbackId) { + bluetoothExec('getBluetoothDevices', callbackId, {}, checkDevices); + } - if (hostNumber) { - companyPhone.value = hostNumber; - } + function getConnectedBluetoothDevices (data, callbackId) { + bluetoothExec('getConnectedBluetoothDevices', callbackId, data); + } - if (homeFaxNumber) { - homeFax.value = homeFaxNumber; - } + function createBLEConnection (data, callbackId) { + onBLEConnectionStateChange = onBLEConnectionStateChange || bluetoothOn('onBLEConnectionStateChange'); + onBLEConnectionStateChanged = onBLEConnectionStateChanged || bluetoothOn('onBLEConnectionStateChanged'); + bluetoothExec('createBLEConnection', callbackId, data); + } - if (workFaxNumber) { - workFax.value = workFaxNumber; - } + function closeBLEConnection (data, callbackId) { + bluetoothExec('closeBLEConnection', callbackId, data); + } - contact.phoneNumbers = [mobilePhone, workPhone, companyPhone, homeFax, workFax]; + function getBLEDeviceServices (data, callbackId) { + bluetoothExec('getBLEDeviceServices', callbackId, data); + } - if (email) { - contact.emails = [{ - type: 'home', - value: email - }]; - } + function getBLEDeviceCharacteristics (data, callbackId) { + bluetoothExec('getBLEDeviceCharacteristics', callbackId, data); + } - if (url) { - contact.urls = [{ - type: 'other', - value: url - }]; - } + function notifyBLECharacteristicValueChange (data, callbackId) { + onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange', + data => { + data.value = arrayBufferToBase64$2(data.value); + }); + bluetoothExec('notifyBLECharacteristicValueChange', callbackId, data); + } - if (weChatNumber) { - contact.ims = [{ - type: 'other', - value: weChatNumber - }]; - } + function notifyBLECharacteristicValueChanged (data, callbackId) { + onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange', + data => { + data.value = arrayBufferToBase64$2(data.value); + }); + bluetoothExec('notifyBLECharacteristicValueChanged', callbackId, data); + } - const defaultAddress = { - type: 'other', - preferred: true - }; + function readBLECharacteristicValue (data, callbackId) { + bluetoothExec('readBLECharacteristicValue', callbackId, data); + } - const homeAddress = { - type: 'home' - }; - const companyAddress = { - type: 'company' - }; + function writeBLECharacteristicValue (data, callbackId) { + data.value = base64ToArrayBuffer$2(data.value); + bluetoothExec('writeBLECharacteristicValue', callbackId, data); + } + + function getScreenBrightness () { + return { + errMsg: 'getScreenBrightness:ok', + value: plus.screen.getBrightness() + } + } - if (addressCountry) { - defaultAddress.country = addressCountry; - } + function setScreenBrightness ({ + value + } = {}) { + plus.screen.setBrightness(value); + return { + errMsg: 'setScreenBrightness:ok' + } + } - if (addressState) { - defaultAddress.region = addressState; + function setKeepScreenOn ({ + keepScreenOn + } = {}) { + plus.device.setWakelock(!!keepScreenOn); + return { + errMsg: 'setKeepScreenOn:ok' + } + } + + function getClipboardData (options, callbackId) { + const clipboard = requireNativePlugin('clipboard'); + clipboard.getString(ret => { + if (ret.result === 'success') { + invoke(callbackId, { + data: ret.data, + errMsg: 'getClipboardData:ok' + }); + } else { + invoke(callbackId, { + data: ret.result, + errMsg: 'getClipboardData:fail' + }); } + }); + } - if (addressCity) { - defaultAddress.locality = addressCity; + function setClipboardData ({ + data + }) { + const clipboard = requireNativePlugin('clipboard'); + clipboard.setString(data); + return { + errMsg: 'setClipboardData:ok' + } + } + + let watchOrientationId = false; + let isWatchOrientation = false; + + const clearWatchOrientation = () => { + if (watchOrientationId) { + plus.orientation.clearWatch(watchOrientationId); + watchOrientationId = false; + } + }; + + function enableCompass ({ + enable + }) { + if (enable) { + clearWatchOrientation(); + watchOrientationId = plus.orientation.watchOrientation((o) => { + publish('onCompassChange', { + direction: o.magneticHeading, + errMsg: 'enableCompass:ok' + }); + }, (e) => { + publish('onCompassChange', { + errMsg: 'enableCompass:fail' + }); + }, { + frequency: DEVICE_FREQUENCY + }); + if (!isWatchOrientation) { + isWatchOrientation = true; + const webview = getLastWebview(); + if (webview) { + webview.addEventListener('close', () => { + plus.orientation.clearWatch(watchOrientationId); + }); + } } + } else { + clearWatchOrientation(); + } + return { + errMsg: 'enableCompass:ok' + } + } + + function getNetworkType () { + return { + errMsg: 'getNetworkType:ok', + networkType: NETWORK_TYPES[plus.networkinfo.getCurrentType()] + } + } + + let beaconUpdateState = false; - if (addressStreet) { - defaultAddress.streetAddress = addressStreet; - } + function onBeaconUpdate () { + if (!beaconUpdateState) { + plus.ibeacon.onBeaconUpdate(function (data) { + publish('onBeaconUpdated', data); + }); + beaconUpdateState = true; + } + } - if (addressPostalCode) { - defaultAddress.postalCode = addressPostalCode; - } + let beaconServiceChangeState = false; - if (homeAddressCountry) { - homeAddress.country = homeAddressCountry; - } + function onBeaconServiceChange () { + if (!beaconServiceChangeState) { + plus.ibeacon.onBeaconServiceChange(function (data) { + publish('onBeaconServiceChange', data); + publish('onBeaconServiceChanged', data); + }); + beaconServiceChangeState = true; + } + } - if (homeAddressState) { - homeAddress.region = homeAddressState; + function getBeacons (params, callbackId) { + plus.ibeacon.getBeacons({ + success: (result) => { + invoke(callbackId, { + errMsg: 'getBeacons:ok', + beacons: result.beacons + }); + }, + fail: (error) => { + invoke(callbackId, { + errMsg: 'getBeacons:fail:' + error.message + }); } + }); + } - if (homeAddressCity) { - homeAddress.locality = homeAddressCity; + function startBeaconDiscovery ({ + uuids, + ignoreBluetoothAvailable = false + }, callbackId) { + plus.ibeacon.startBeaconDiscovery({ + uuids, + ignoreBluetoothAvailable, + success: (result) => { + invoke(callbackId, { + errMsg: 'startBeaconDiscovery:ok', + beacons: result.beacons + }); + }, + fail: (error) => { + invoke(callbackId, { + errMsg: 'startBeaconDiscovery:fail:' + error.message + }); } + }); + } - if (homeAddressStreet) { - homeAddress.streetAddress = homeAddressStreet; + function stopBeaconDiscovery (params, callbackId) { + plus.ibeacon.stopBeaconDiscovery({ + success: (result) => { + invoke(callbackId, Object.assign(result, { + errMsg: 'stopBeaconDiscovery:ok' + })); + }, + fail: (error) => { + invoke(callbackId, { + errMsg: 'stopBeaconDiscovery:fail:' + error.message + }); } + }); + } + + function makePhoneCall$1 ({ + phoneNumber + } = {}) { + plus.device.dial(phoneNumber); + return { + errMsg: 'makePhoneCall:ok' + } + } + + const ANI_SHOW = plus.os.name === 'Android' && parseInt(plus.os.version) < 6 ? 'slide-in-right' : 'pop-in'; + const ANI_DURATION = 300; + + const ANI_CLOSE = 'pop-out'; - if (homeAddressPostalCode) { - homeAddress.postalCode = homeAddressPostalCode; - } + const TITLEBAR_HEIGHT = 44; - if (workAddressCountry) { - companyAddress.country = workAddressCountry; + const VIEW_WEBVIEW_PATH = '_www/__uniappview.html'; + + const callbacks = {}; + const WEB_INVOKE_APPSERVICE = 'WEB_INVOKE_APPSERVICE'; + // 简单处理 view 层与 service 层的通知系统 + /** + * 消费 view 层通知 + */ + function consumePlusMessage (type, args) { + // 处理 web-view 组件发送的通知 + if (type === WEB_INVOKE_APPSERVICE) { + publish(WEB_INVOKE_APPSERVICE, args.data, args.webviewIds); + return true + } + const callback = callbacks[type]; + if (callback) { + callback(args); + if (!callback.keepAlive) { + delete callbacks[type]; } + return true + } + return false + } + /** + * 注册 view 层通知 service 层事件处理 + */ + function registerPlusMessage (type, callback, keepAlive = true) { + if (callbacks[type]) { + return console.warn(`${type} 已注册:` + (callbacks[type].toString())) + } + callback.keepAlive = !!keepAlive; + callbacks[type] = callback; + } + + const SCAN_ID = '__UNIAPP_SCAN'; + const SCAN_PATH = '_www/__uniappscan.html'; - if (workAddressState) { - companyAddress.region = workAddressState; - } + const MESSAGE_TYPE = 'scanCode'; - if (workAddressCity) { - companyAddress.locality = workAddressCity; - } + function scanCode ({ + onlyFromCamera = false, + scanType + }, callbackId) { + const barcode = plus.barcode; + const SCAN_TYPES = { + 'qrCode': [ + barcode.QR, + barcode.AZTEC, + barcode.MAXICODE + ], + 'barCode': [ + barcode.EAN13, + barcode.EAN8, + barcode.UPCA, + barcode.UPCE, + barcode.CODABAR, + barcode.CODE128, + barcode.CODE39, + barcode.CODE93, + barcode.ITF, + barcode.RSS14, + barcode.RSSEXPANDED + ], + 'datamatrix': [barcode.DATAMATRIX], + 'pdf417': [barcode.PDF417] + }; - if (workAddressStreet) { - companyAddress.streetAddress = workAddressStreet; - } + const SCAN_MAPS = { + [barcode.QR]: 'QR_CODE', + [barcode.EAN13]: 'EAN_13', + [barcode.EAN8]: 'EAN_8', + [barcode.DATAMATRIX]: 'DATA_MATRIX', + [barcode.UPCA]: 'UPC_A', + [barcode.UPCE]: 'UPC_E', + [barcode.CODABAR]: 'CODABAR', + [barcode.CODE39]: 'CODE_39', + [barcode.CODE93]: 'CODE_93', + [barcode.CODE128]: 'CODE_128', + [barcode.ITF]: 'CODE_25', + [barcode.PDF417]: 'PDF_417', + [barcode.AZTEC]: 'AZTEC', + [barcode.RSS14]: 'RSS_14', + [barcode.RSSEXPANDED]: 'RSSEXPANDED' + }; - if (workAddressPostalCode) { - companyAddress.postalCode = workAddressPostalCode; - } + const statusBarStyle = getStatusBarStyle(); + const isDark = statusBarStyle !== 'light'; - contact.addresses = [defaultAddress, homeAddress, companyAddress]; + let result; - contact.save(() => { - invoke(callbackId, { - errMsg: 'addPhoneContact:ok' - }); - }, (e) => { - invoke(callbackId, { - errMsg: 'addPhoneContact:fail' - }); - }); - }, (e) => { - invoke(callbackId, { - errMsg: 'addPhoneContact:fail' + let filters = []; + if (Array.isArray(scanType) && scanType.length) { + scanType.forEach(type => { // 暂不考虑去重 + const types = SCAN_TYPES[type]; + if (types) { + filters = filters.concat(types); + } }); - }); - } - - /** - * 执行蓝牙相关方法 - */ - function bluetoothExec (method, callbackId, data = {}, beforeSuccess) { - var deviceId = data.deviceId; - if (deviceId) { - data.deviceId = deviceId.toUpperCase(); } - var serviceId = data.serviceId; - if (serviceId) { - data.serviceId = serviceId.toUpperCase(); + if (!filters.length) { + filters = filters.concat(SCAN_TYPES['qrCode']).concat(SCAN_TYPES['barCode']).concat(SCAN_TYPES['datamatrix']).concat( + SCAN_TYPES['pdf417']); } - plus.bluetooth[method.replace('Changed', 'Change')](Object.assign(data, { - success (data) { - if (typeof beforeSuccess === 'function') { - beforeSuccess(data); + const buttons = []; + if (!onlyFromCamera) { + buttons.push({ + 'float': 'right', + 'text': '相册', + 'fontSize': '17px', + 'width': '60px', + 'onclick': function () { + plus.gallery.pick(file => { + barcode.scan(file, (type, code) => { + if (isDark) { + plus.navigator.setStatusBarStyle('isDark'); + } + result = { + type, + code + }; + webview.close('auto'); + }, () => { + plus.nativeUI.toast('识别失败'); + }, filters); + }, err => { + if (err.code !== 12) { + plus.nativeUI.toast('选择失败'); + } + }, { + multiple: false, + system: false + }); } - invoke(callbackId, Object.assign({}, data, { - errMsg: `${method}:ok`, - code: undefined, - message: undefined - })); + }); + } + + const webview = plus.webview.create(SCAN_PATH, SCAN_ID, { + titleNView: { + autoBackButton: true, + type: 'float', + backgroundColor: 'rgba(0,0,0,0)', + titleColor: '#ffffff', + titleText: '扫码', + titleSize: '17px', + buttons }, - fail (error = {}) { + popGesture: 'close', + backButtonAutoControl: 'close' + }, { + __uniapp_type: 'scan', + __uniapp_dark: isDark, + __uniapp_scan_type: filters, + 'uni-app': 'none' + }); + const waiting = plus.nativeUI.showWaiting(); + webview.addEventListener('titleUpdate', () => { + webview.show(ANI_SHOW, ANI_DURATION, () => { + waiting.close(); + }); + }); + webview.addEventListener('close', () => { + if (result) { invoke(callbackId, { - errMsg: `${method}:fail ${error.message || ''}`, - errCode: error.code || 0 + result: result.code, + scanType: SCAN_MAPS[result.type] || '', + charSet: 'utf8', + path: '', + errMsg: 'scanCode:ok' }); + } else { + invoke(callbackId, { + errMsg: 'scanCode:fail cancel' + }); } - })); - } - /** - * 监听蓝牙相关事件 - */ - function bluetoothOn (method, beforeSuccess) { - plus.bluetooth[method.replace('Changed', 'Change')](function (data) { - if (typeof beforeSuccess === 'function') { - beforeSuccess(data); - } - publish(method, Object.assign({}, data, { - code: undefined, - message: undefined - })); + consumePlusMessage(MESSAGE_TYPE); }); - return true - } + if (isDark) { // 状态栏前景色 + plus.navigator.setStatusBarStyle('light'); + webview.addEventListener('popGesture', ({ + type, + result + }) => { + if (type === 'start') { + plus.navigator.setStatusBarStyle('dark'); + } else if (type === 'end' && !result) { + plus.navigator.setStatusBarStyle('light'); + } + }); + } - function checkDevices (data) { - data.devices = data.devices.map(device => { - var advertisData = device.advertisData; - if (advertisData && typeof advertisData !== 'string') { - device.advertisData = arrayBufferToBase64(advertisData); + registerPlusMessage(MESSAGE_TYPE, function (res) { + if (res && 'code' in res) { + result = res; } - return device - }); - } - - var onBluetoothAdapterStateChange; - var onBluetoothDeviceFound; - var onBLEConnectionStateChange; - var onBLEConnectionStateChanged; - var onBLECharacteristicValueChange; - - function openBluetoothAdapter (data, callbackId) { - onBluetoothAdapterStateChange = onBluetoothAdapterStateChange || bluetoothOn('onBluetoothAdapterStateChange'); - bluetoothExec('openBluetoothAdapter', callbackId); - } - - function closeBluetoothAdapter (data, callbackId) { - bluetoothExec('closeBluetoothAdapter', callbackId); - } - - function getBluetoothAdapterState (data, callbackId) { - bluetoothExec('getBluetoothAdapterState', callbackId); - } - - function startBluetoothDevicesDiscovery (data, callbackId) { - onBluetoothDeviceFound = onBluetoothDeviceFound || bluetoothOn('onBluetoothDeviceFound', checkDevices); - bluetoothExec('startBluetoothDevicesDiscovery', callbackId, data); - } - - function stopBluetoothDevicesDiscovery (data, callbackId) { - bluetoothExec('stopBluetoothDevicesDiscovery', callbackId); - } - - function getBluetoothDevices (data, callbackId) { - bluetoothExec('getBluetoothDevices', callbackId, {}, checkDevices); - } - - function getConnectedBluetoothDevices (data, callbackId) { - bluetoothExec('getConnectedBluetoothDevices', callbackId, data); - } - - function createBLEConnection (data, callbackId) { - onBLEConnectionStateChange = onBLEConnectionStateChange || bluetoothOn('onBLEConnectionStateChange'); - onBLEConnectionStateChanged = onBLEConnectionStateChanged || bluetoothOn('onBLEConnectionStateChanged'); - bluetoothExec('createBLEConnection', callbackId, data); - } + }, false); + } + + const TABBAR_HEIGHT = 56; - function closeBLEConnection (data, callbackId) { - bluetoothExec('closeBLEConnection', callbackId, data); - } + let config; - function getBLEDeviceServices (data, callbackId) { - bluetoothExec('getBLEDeviceServices', callbackId, data); - } + /** + * tabbar显示状态 + */ + let visible = true; - function getBLEDeviceCharacteristics (data, callbackId) { - bluetoothExec('getBLEDeviceCharacteristics', callbackId, data); - } + let tabBar; - function notifyBLECharacteristicValueChange (data, callbackId) { - onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange', - data => { - data.value = arrayBufferToBase64(data.value); + /** + * 设置角标 + * @param {string} type + * @param {number} index + * @param {string} text + */ + function setTabBarBadge$1 (type, index, text) { + if (!tabBar) { + return + } + if (type === 'none') { + tabBar.hideTabBarRedDot({ + index }); - bluetoothExec('notifyBLECharacteristicValueChange', callbackId, data); - } - - function notifyBLECharacteristicValueChanged (data, callbackId) { - onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange', - data => { - data.value = arrayBufferToBase64(data.value); + tabBar.removeTabBarBadge({ + index + }); + } else if (type === 'text') { + tabBar.setTabBarBadge({ + index, + text + }); + } else if (type === 'redDot') { + tabBar.showTabBarRedDot({ + index }); - bluetoothExec('notifyBLECharacteristicValueChanged', callbackId, data); - } - - function readBLECharacteristicValue (data, callbackId) { - bluetoothExec('readBLECharacteristicValue', callbackId, data); - } - - function writeBLECharacteristicValue (data, callbackId) { - data.value = base64ToArrayBuffer(data.value); - bluetoothExec('writeBLECharacteristicValue', callbackId, data); - } - - function getScreenBrightness () { - return { - errMsg: 'getScreenBrightness:ok', - value: plus.screen.getBrightness() } } - - function setScreenBrightness ({ - value - } = {}) { - plus.screen.setBrightness(value); - return { - errMsg: 'setScreenBrightness:ok' + /** + * 动态设置 tabBar 某一项的内容 + */ + function setTabBarItem$1 (index, text, iconPath, selectedIconPath) { + const item = {}; + if (iconPath) { + item.iconPath = getRealPath$1(iconPath); + } + if (selectedIconPath) { + item.selectedIconPath = getRealPath$1(selectedIconPath); } + tabBar && tabBar.setTabBarItem(Object.assign({ + index, + text + }, item)); + } + /** + * 动态设置 tabBar 的整体样式 + * @param {Object} style 样式 + */ + function setTabBarStyle$1 (style) { + tabBar && tabBar.setTabBarStyle(style); + } + /** + * 隐藏 tabBar + * @param {boolean} animation 是否需要动画效果 暂未支持 + */ + function hideTabBar$1 (animation) { + visible = false; + tabBar && tabBar.hideTabBar({ + animation + }); } - - function setKeepScreenOn ({ - keepScreenOn - } = {}) { - plus.device.setWakelock(!!keepScreenOn); - return { - errMsg: 'setKeepScreenOn:ok' - } - } - - function getClipboardData (options, callbackId) { - const clipboard = requireNativePlugin('clipboard'); - clipboard.getString(ret => { - if (ret.result === 'success') { - invoke(callbackId, { - data: ret.data, - errMsg: 'getClipboardData:ok' - }); - } else { - invoke(callbackId, { - data: ret.result, - errMsg: 'getClipboardData:fail' - }); - } + /** + * 显示 tabBar + * @param {boolean} animation 是否需要动画效果 暂未支持 + */ + function showTabBar$1 (animation) { + visible = true; + tabBar && tabBar.showTabBar({ + animation }); } - function setClipboardData ({ - data - }) { - const clipboard = requireNativePlugin('clipboard'); - clipboard.setString(data); - return { - errMsg: 'setClipboardData:ok' + var tabBar$1 = { + init (options, clickCallback) { + if (options && options.list.length) { + config = options; + } + try { + tabBar = requireNativePlugin('uni-tabview'); + } catch (error) { + console.log(`uni.requireNativePlugin("uni-tabview") error ${error}`); + } + tabBar && tabBar.onClick(({ index }) => { + clickCallback(config.list[index], index, true); + }); + tabBar && tabBar.onMidButtonClick(() => { + publish('onTabBarMidButtonTap', {}); + }); + }, + switchTab (page) { + const itemLength = config.list.length; + if (itemLength) { + for (let i = 0; i < itemLength; i++) { + if ( + config.list[i].pagePath === page || + config.list[i].pagePath === `${page}.html` + ) { + tabBar && tabBar.switchSelect({ + index: i + }); + return true + } + } + } + return false + }, + setTabBarBadge: setTabBarBadge$1, + setTabBarItem: setTabBarItem$1, + setTabBarStyle: setTabBarStyle$1, + hideTabBar: hideTabBar$1, + showTabBar: showTabBar$1, + append (webview) { + tabBar && tabBar.append({ + id: webview.id + }, ({ code }) => { + if (code !== 0) { + // console.log('tab append error') + setTimeout(() => { + this.append(webview); + }, 20); + } + }); + }, + get visible () { + return visible + }, + get height () { + return config && config.height ? parseFloat(config.height) : TABBAR_HEIGHT } - } + }; - let watchOrientationId = false; - let isWatchOrientation = false; + function getSystemInfoSync () { + return callApiSync(getSystemInfo, Object.create(null), 'getSystemInfo', 'getSystemInfoSync') + } - const clearWatchOrientation = () => { - if (watchOrientationId) { - plus.orientation.clearWatch(watchOrientationId); - watchOrientationId = false; + function getSystemInfo () { + const platform = plus.os.name.toLowerCase(); + const ios = platform === 'ios'; + // 安卓 plus 接口获取的屏幕大小值不为整数,iOS js 获取的屏幕大小横屏时颠倒 + const screenWidth = plus.screen.resolutionWidth; + const screenHeight = plus.screen.resolutionHeight; + // 横屏时 iOS 获取的状态栏高度错误,进行纠正 + var landscape = Math.abs(plus.navigator.getOrientation()) === 90; + var statusBarHeight = Math.round(plus.navigator.getStatusbarHeight()); + if (ios && landscape) { + statusBarHeight = Math.min(20, statusBarHeight); } - }; - - function enableCompass ({ - enable - }) { - if (enable) { - clearWatchOrientation(); - watchOrientationId = plus.orientation.watchOrientation((o) => { - publish('onCompassChange', { - direction: o.magneticHeading, - errMsg: 'enableCompass:ok' - }); - }, (e) => { - publish('onCompassChange', { - errMsg: 'enableCompass:fail' - }); - }, { - frequency: DEVICE_FREQUENCY - }); - if (!isWatchOrientation) { - isWatchOrientation = true; - const webview = getLastWebview(); - if (webview) { - webview.addEventListener('close', () => { - plus.orientation.clearWatch(watchOrientationId); - }); - } + var safeAreaInsets; + function getSafeAreaInsets () { + return { + left: 0, + right: 0, + top: titleNView ? 0 : statusBarHeight, + bottom: 0 + } + } + // 判断是否存在 titleNView + var titleNView; + var webview = getLastWebview(); + if (webview) { + let style = webview.getStyle(); + if (style) { + titleNView = style && style.titleNView; + titleNView = titleNView && titleNView.type === 'default'; } + safeAreaInsets = ios ? webview.getSafeAreaInsets() : getSafeAreaInsets(); } else { - clearWatchOrientation(); + safeAreaInsets = ios ? plus.navigator.getSafeAreaInsets() : getSafeAreaInsets(); } + var windowHeight = Math.min(screenHeight - (titleNView ? (statusBarHeight + TITLEBAR_HEIGHT) + : 0) - (isTabBarPage() && tabBar$1.visible ? tabBar$1.height : 0), screenHeight); + var windowWidth = screenWidth; + var safeArea = { + left: safeAreaInsets.left, + right: windowWidth - safeAreaInsets.right, + top: safeAreaInsets.top, + bottom: windowHeight - safeAreaInsets.bottom, + width: windowWidth - safeAreaInsets.left - safeAreaInsets.right, + height: windowHeight - safeAreaInsets.top - safeAreaInsets.bottom + }; + return { - errMsg: 'enableCompass:ok' + errMsg: 'getSystemInfo:ok', + brand: plus.device.vendor, + model: plus.device.model, + pixelRatio: plus.screen.scale, + screenWidth, + screenHeight, + windowWidth, + windowHeight, + statusBarHeight, + language: plus.os.language, + system: plus.os.version, + version: plus.runtime.innerVersion, + fontSizeSetting: '', + platform, + SDKVersion: '', + windowTop: 0, + windowBottom: 0, + safeArea } } - function getNetworkType () { + function vibrateLong () { + plus.device.vibrate(400); return { - errMsg: 'getNetworkType:ok', - networkType: NETWORK_TYPES[plus.networkinfo.getCurrentType()] + errMsg: 'vibrateLong:ok' + } + } + function vibrateShort () { + plus.device.vibrate(15); + return { + errMsg: 'vibrateShort:ok' } } - let beaconUpdateState = false; + const SAVED_DIR = 'uniapp_save'; + const SAVE_PATH = `_doc/${SAVED_DIR}`; + const REGEX_FILENAME = /^.*[/]/; - function onBeaconUpdate () { - if (!beaconUpdateState) { - plus.ibeacon.onBeaconUpdate(function (data) { - publish('onBeaconUpdated', data); + function getSavedFileDir (success, fail) { + fail = fail || function () {}; + plus.io.requestFileSystem(plus.io.PRIVATE_DOC, fs => { // 请求_doc fs + fs.root.getDirectory(SAVED_DIR, { // 获取文件保存目录对象 + create: true + }, dir => { + success(dir); + }, err => { + fail('目录[' + SAVED_DIR + ']创建失败' + err.message); + }); + }, err => { + fail('目录[_doc]读取失败' + err.message); + }); + } + + function saveFile ({ + tempFilePath + } = {}, callbackId) { + let fileName = tempFilePath.replace(REGEX_FILENAME, ''); + if (fileName) { + let extName = ''; + if (~fileName.indexOf('.')) { + extName = '.' + fileName.split('.').pop(); + } + + fileName = (+new Date()) + '' + extName; + + plus.io.resolveLocalFileSystemURL(getRealPath$1(tempFilePath), entry => { // 读取临时文件 FileEntry + getSavedFileDir(dir => { + entry.copyTo(dir, fileName, () => { // 复制临时文件 FileEntry,为了避免把相册里的文件删除,使用 copy,微信中是要删除临时文件的 + const savedFilePath = SAVE_PATH + '/' + fileName; + invoke(callbackId, { + errMsg: 'saveFile:ok', + savedFilePath + }); + }, err => { + invoke(callbackId, { + errMsg: 'saveFile:fail 保存文件[' + tempFilePath + + '] copyTo 失败:' + err.message + }); + }); + }, message => { + invoke(callbackId, { + errMsg: 'saveFile:fail ' + message + }); + }); + }, err => { + invoke(callbackId, { + errMsg: 'saveFile:fail 文件[' + tempFilePath + ']读取失败' + err.message + }); }); - beaconUpdateState = true; + } else { + return { + errMsg: 'saveFile:fail 文件名[' + tempFilePath + ']不存在' + } } } - let beaconServiceChangeState = false; + function getSavedFileList (options, callbackId) { + getSavedFileDir(entry => { + var reader = entry.createReader(); - function onBeaconServiceChange () { - if (!beaconServiceChangeState) { - plus.ibeacon.onBeaconServiceChange(function (data) { - publish('onBeaconServiceChange', data); - publish('onBeaconServiceChanged', data); + var fileList = []; + reader.readEntries(entries => { + if (entries && entries.length) { + entries.forEach(entry => { + entry.getMetadata(meta => { + fileList.push({ + filePath: plus.io.convertAbsoluteFileSystem(entry.fullPath), + createTime: meta.modificationTime.getTime(), + size: meta.size + }); + if (fileList.length === entries.length) { + invoke(callbackId, { + errMsg: 'getSavedFileList:ok', + fileList + }); + } + }, error => { + invoke(callbackId, { + errMsg: 'getSavedFileList:fail ' + error.message + }); + }, false); + }); + } else { + invoke(callbackId, { + errMsg: 'getSavedFileList:ok', + fileList + }); + } + }, error => { + invoke(callbackId, { + errMsg: 'getSavedFileList:fail ' + error.message + }); }); - beaconServiceChangeState = true; - } + }, message => { + invoke(callbackId, { + errMsg: 'getSavedFileList:fail ' + message + }); + }); } - function getBeacons (params, callbackId) { - plus.ibeacon.getBeacons({ - success: (result) => { + function getFileInfo ({ + filePath, + digestAlgorithm = 'md5' + } = {}, callbackId) { + // TODO 计算文件摘要 + plus.io.resolveLocalFileSystemURL(getRealPath$1(filePath), entry => { + entry.getMetadata(meta => { invoke(callbackId, { - errMsg: 'getBeacons:ok', - beacons: result.beacons + errMsg: 'getFileInfo:ok', + size: meta.size, + digestAlgorithm: '' }); - }, - fail: (error) => { + }, err => { invoke(callbackId, { - errMsg: 'getBeacons:fail:' + error.message + errMsg: 'getFileInfo:fail 文件[' + + filePath + + '] getMetadata 失败:' + err.message }); - } + }); + }, err => { + invoke(callbackId, { + errMsg: 'getFileInfo:fail 文件[' + filePath + ']读取失败:' + err.message + }); }); } - function startBeaconDiscovery ({ - uuids, - ignoreBluetoothAvailable = false - }, callbackId) { - plus.ibeacon.startBeaconDiscovery({ - uuids, - ignoreBluetoothAvailable, - success: (result) => { + function getSavedFileInfo ({ + filePath + } = {}, callbackId) { + plus.io.resolveLocalFileSystemURL(getRealPath$1(filePath), entry => { + entry.getMetadata(meta => { invoke(callbackId, { - errMsg: 'startBeaconDiscovery:ok', - beacons: result.beacons + createTime: meta.modificationTime.getTime(), + size: meta.size, + errMsg: 'getSavedFileInfo:ok' }); - }, - fail: (error) => { + }, error => { invoke(callbackId, { - errMsg: 'startBeaconDiscovery:fail:' + error.message + errMsg: 'getSavedFileInfo:fail ' + error.message + }); + }, false); + }, () => { + invoke(callbackId, { + errMsg: 'getSavedFileInfo:fail file not find' + }); + }); + } + + function removeSavedFile ({ + filePath + } = {}, callbackId) { + plus.io.resolveLocalFileSystemURL(getRealPath$1(filePath), entry => { + entry.remove(() => { + invoke(callbackId, { + errMsg: 'removeSavedFile:ok' + }); + }, err => { + invoke(callbackId, { + errMsg: 'removeSavedFile:fail 文件[' + filePath + ']删除失败:' + err.message }); + }); + }, () => { + invoke(callbackId, { + errMsg: 'removeSavedFile:fail file not find' + }); + }); + } + + function openDocument$1 ({ + filePath, + fileType + } = {}, callbackId) { + plus.io.resolveLocalFileSystemURL(getRealPath$1(filePath), entry => { + plus.runtime.openFile(getRealPath$1(filePath)); + invoke(callbackId, { + errMsg: 'openDocument:ok' + }); + }, err => { + invoke(callbackId, { + errMsg: 'openDocument:fail 文件[' + filePath + ']读取失败:' + err.message + }); + }); + } + + const CHOOSE_LOCATION_PATH = '_www/__uniappchooselocation.html'; + + const MESSAGE_TYPE$1 = 'chooseLocation'; + + function chooseLocation$1 (params, callbackId) { + const statusBarStyle = plus.navigator.getStatusBarStyle(); + const webview = plus.webview.create( + CHOOSE_LOCATION_PATH, + MAP_ID, { + titleNView: { + autoBackButton: true, + backgroundColor: '#000000', + titleColor: '#ffffff', + titleText: '选择位置', + titleSize: '17px', + buttons: [{ + float: 'right', + text: '完成', + fontSize: '17px', + onclick: function () { + webview.evalJS('__chooseLocationConfirm__()'); + } + }] + }, + popGesture: 'close', + scrollIndicator: 'none' + }, { + __uniapp_type: 'map', + __uniapp_statusbar_style: statusBarStyle, + 'uni-app': 'none' + } + ); + if (statusBarStyle === 'dark') { + plus.navigator.setStatusBarStyle('light'); + webview.addEventListener('popGesture', ({ + type, + result + }) => { + if (type === 'start') { + plus.navigator.setStatusBarStyle('dark'); + } else if (type === 'end' && !result) { + plus.navigator.setStatusBarStyle('light'); + } + }); + } + let index = 0; + let onShow = function () { + index++; + if (index === 2) { + webview.evalJS(`__chooseLocation__(${JSON.stringify(params)})`); + } + }; + webview.addEventListener('loaded', onShow); + webview.show('slide-in-bottom', ANI_DURATION, onShow); + + let result; + + webview.addEventListener('close', () => { + if (result) { + invoke(callbackId, { + name: result.poiname, + address: result.poiaddress, + latitude: result.latlng.lat, + longitude: result.latlng.lng, + errMsg: 'chooseLocation:ok' + }); + } else { + consumePlusMessage(MESSAGE_TYPE$1); + invoke(callbackId, { + errMsg: 'chooseLocation:fail cancel' + }); + } + }); + + registerPlusMessage(MESSAGE_TYPE$1, function (res) { + if (res && 'latlng' in res) { + result = res; + } + }, false); + } + + function getLocationSuccess (type, position, callbackId) { + const coords = position.coords; + if (type !== position.coordsType) { + if (process.env.NODE_ENV !== 'production') { + console.log( + `UNIAPP[location]:before[${position.coordsType}][lng:${ + coords.longitude + },lat:${coords.latitude}]` + ); + } + let coordArray; + if (type === 'wgs84') { + coordArray = gcj02towgs84(coords.longitude, coords.latitude); + } else if (type === 'gcj02') { + coordArray = wgs84togcj02(coords.longitude, coords.latitude); + } + if (coordArray) { + coords.longitude = coordArray[0]; + coords.latitude = coordArray[1]; + if (process.env.NODE_ENV !== 'production') { + console.log( + `UNIAPP[location]:after[${type}][lng:${coords.longitude},lat:${ + coords.latitude + }]` + ); + } } + } + + invoke(callbackId, { + type, + altitude: coords.altitude || 0, + latitude: coords.latitude, + longitude: coords.longitude, + speed: coords.speed, + accuracy: coords.accuracy, + address: position.address, + errMsg: 'getLocation:ok' }); } - function stopBeaconDiscovery (params, callbackId) { - plus.ibeacon.stopBeaconDiscovery({ - success: (result) => { - invoke(callbackId, Object.assign(result, { - errMsg: 'stopBeaconDiscovery:ok' - })); + function getLocation$1 ({ + type = 'wgs84', + geocode = false, + altitude = false + } = {}, callbackId) { + plus.geolocation.getCurrentPosition( + position => { + getLocationSuccess(type, position, callbackId); }, - fail: (error) => { + e => { + // 坐标地址解析失败 + if (e.code === 1501) { + getLocationSuccess(type, e, callbackId); + return + } + invoke(callbackId, { - errMsg: 'stopBeaconDiscovery:fail:' + error.message + errMsg: 'getLocation:fail ' + e.message }); + }, { + geocode: geocode, + enableHighAccuracy: altitude } - }); + ); } - function makePhoneCall$1 ({ - phoneNumber - } = {}) { - plus.device.dial(phoneNumber); + const OPEN_LOCATION_PATH = '_www/__uniappopenlocation.html'; + + function openLocation$1 (params) { + const statusBarStyle = plus.navigator.getStatusBarStyle(); + const webview = plus.webview.create( + OPEN_LOCATION_PATH, + MAP_ID, { + titleNView: { + autoBackButton: true, + titleColor: '#ffffff', + titleText: '', + titleSize: '17px', + type: 'transparent' + }, + popGesture: 'close', + scrollIndicator: 'none' + }, { + __uniapp_type: 'map', + __uniapp_statusbar_style: statusBarStyle, + 'uni-app': 'none' + } + ); + if (statusBarStyle === 'light') { + plus.navigator.setStatusBarStyle('dark'); + webview.addEventListener('popGesture', ({ + type, + result + }) => { + if (type === 'start') { + plus.navigator.setStatusBarStyle('light'); + } else if (type === 'end' && !result) { + plus.navigator.setStatusBarStyle('dark'); + } + }); + } + webview.show(ANI_SHOW, ANI_DURATION, () => { + webview.evalJS(`__openLocation__(${JSON.stringify(params)})`); + }); + return { - errMsg: 'makePhoneCall:ok' + errMsg: 'openLocation:ok' } } - const SCAN_ID = '__UNIAPP_SCAN'; - const SCAN_PATH = '_www/__uniappscan.html'; - - const MESSAGE_TYPE = 'scanCode'; - - function scanCode ({ - onlyFromCamera = false, - scanType - }, callbackId) { - const barcode = plus.barcode; - const SCAN_TYPES = { - 'qrCode': [ - barcode.QR, - barcode.AZTEC, - barcode.MAXICODE - ], - 'barCode': [ - barcode.EAN13, - barcode.EAN8, - barcode.UPCA, - barcode.UPCE, - barcode.CODABAR, - barcode.CODE128, - barcode.CODE39, - barcode.CODE93, - barcode.ITF, - barcode.RSS14, - barcode.RSSEXPANDED - ], - 'datamatrix': [barcode.DATAMATRIX], - 'pdf417': [barcode.PDF417] - }; - - const SCAN_MAPS = { - [barcode.QR]: 'QR_CODE', - [barcode.EAN13]: 'EAN_13', - [barcode.EAN8]: 'EAN_8', - [barcode.DATAMATRIX]: 'DATA_MATRIX', - [barcode.UPCA]: 'UPC_A', - [barcode.UPCE]: 'UPC_E', - [barcode.CODABAR]: 'CODABAR', - [barcode.CODE39]: 'CODE_39', - [barcode.CODE93]: 'CODE_93', - [barcode.CODE128]: 'CODE_128', - [barcode.ITF]: 'CODE_25', - [barcode.PDF417]: 'PDF_417', - [barcode.AZTEC]: 'AZTEC', - [barcode.RSS14]: 'RSS_14', - [barcode.RSSEXPANDED]: 'RSSEXPANDED' - }; - - const statusBarStyle = getStatusBarStyle(); - const isDark = statusBarStyle !== 'light'; + const RECORD_TIME = 60 * 60 * 1000; - let result; + let recorder; + let recordTimeout; - let filters = []; - if (Array.isArray(scanType) && scanType.length) { - scanType.forEach(type => { // 暂不考虑去重 - const types = SCAN_TYPES[type]; - if (types) { - filters = filters.concat(types); - } + function startRecord (args, callbackId) { + recorder && recorder.stop(); + recorder = plus.audio.getRecorder(); + recorder.record({ + filename: '_doc/audio/', + format: 'aac' + }, (res) => { + invoke(callbackId, { + errMsg: 'startRecord:ok', + tempFilePath: res + }); + }, (res) => { + invoke(callbackId, { + errMsg: 'startRecord:fail' }); + }); + recordTimeout = setTimeout(() => { + recorder.stop(); + recorder = false; + }, RECORD_TIME); + } + + function stopRecord () { + if (recorder) { + recordTimeout && clearTimeout(recordTimeout); + recorder.stop(); + return { + errMsg: 'stopRecord:ok' + } } - if (!filters.length) { - filters = filters.concat(SCAN_TYPES['qrCode']).concat(SCAN_TYPES['barCode']).concat(SCAN_TYPES['datamatrix']).concat( - SCAN_TYPES['pdf417']); + return { + errMsg: 'stopRecord:fail' } + } - const buttons = []; - if (!onlyFromCamera) { - buttons.push({ - 'float': 'right', - 'text': '相册', - 'fontSize': '17px', - 'width': '60px', - 'onclick': function () { - plus.gallery.pick(file => { - barcode.scan(file, (type, code) => { - if (isDark) { - plus.navigator.setStatusBarStyle('isDark'); - } - result = { - type, - code - }; - webview.close('auto'); - }, () => { - plus.nativeUI.toast('识别失败'); - }, filters); - }, err => { - if (err.code !== 12) { - plus.nativeUI.toast('选择失败'); - } - }, { - multiple: false, - system: false - }); - } - }); - } + let player; + let playerFilePath; + let playerStatus; - const webview = plus.webview.create(SCAN_PATH, SCAN_ID, { - titleNView: { - autoBackButton: true, - type: 'float', - backgroundColor: 'rgba(0,0,0,0)', - titleColor: '#ffffff', - titleText: '扫码', - titleSize: '17px', - buttons - }, - popGesture: 'close', - backButtonAutoControl: 'close' - }, { - __uniapp_type: 'scan', - __uniapp_dark: isDark, - __uniapp_scan_type: filters, - 'uni-app': 'none' - }); - const waiting = plus.nativeUI.showWaiting(); - webview.addEventListener('titleUpdate', () => { - webview.show(ANI_SHOW, ANI_DURATION, () => { - waiting.close(); - }); - }); - webview.addEventListener('close', () => { - if (result) { - invoke(callbackId, { - result: result.code, - scanType: SCAN_MAPS[result.type] || '', - charSet: 'utf8', - path: '', - errMsg: 'scanCode:ok' + function playVoice ({ + filePath + } = {}, callbackId) { + if (player && playerFilePath === filePath && playerStatus === 'pause') { // 如果是当前音频被暂停,则继续播放 + playerStatus = 'play'; + player.play((res) => { + player = false; + playerFilePath = false; + playerStatus = false; + invoke(callbackId, { + errMsg: 'playVoice:ok' }); - } else { - invoke(callbackId, { - errMsg: 'scanCode:fail cancel' - }); + }); + return { + errMsg: 'playVoice:ok' } - consumePlusMessage(MESSAGE_TYPE); - }); - if (isDark) { // 状态栏前景色 - plus.navigator.setStatusBarStyle('light'); - webview.addEventListener('popGesture', ({ - type, - result - }) => { - if (type === 'start') { - plus.navigator.setStatusBarStyle('dark'); - } else if (type === 'end' && !result) { - plus.navigator.setStatusBarStyle('light'); - } + } + if (player) { // 如果存在音频播放,则停止 + player.stop(); + } + playerFilePath = filePath; + playerStatus = 'play'; + player = plus.audio.createPlayer(getRealPath$1(filePath)); + // 播放操作成功回调 + player.play((res) => { + player = false; + playerFilePath = false; + playerStatus = false; + invoke(callbackId, { + errMsg: 'playVoice:ok' }); + }); + } + + function pauseVoice () { + if (player && playerStatus === 'play') { + player.pause(); + playerStatus = 'pause'; + } + return { + errMsg: 'pauseVoice:ok' } + } - registerPlusMessage(MESSAGE_TYPE, function (res) { - if (res && 'code' in res) { - result = res; - } - }, false); + function stopVoice () { + if (player) { + player.stop(); + player = false; + playerFilePath = false; + playerStatus = false; + } + return { + errMsg: 'stopVoice:ok' + } } - function getSystemInfoSync () { - return callApiSync(getSystemInfo, Object.create(null), 'getSystemInfo', 'getSystemInfoSync') + /** + * 获取文件信息 + * @param {string} filePath 文件路径 + * @returns {Promise} 文件信息Promise + */ + function getFileInfo$1 (filePath) { + return new Promise((resolve, reject) => { + plus.io.resolveLocalFileSystemURL(filePath, function (entry) { + entry.getMetadata(function (meta) { + resolve({ + size: meta.size + }); + }, reject, false); + }, reject); + }) } - function getSystemInfo () { - const platform = plus.os.name.toLowerCase(); - const ios = platform === 'ios'; - // 安卓 plus 接口获取的屏幕大小值不为整数,iOS js 获取的屏幕大小横屏时颠倒 - const screenWidth = plus.screen.resolutionWidth; - const screenHeight = plus.screen.resolutionHeight; - // 横屏时 iOS 获取的状态栏高度错误,进行纠正 - var landscape = Math.abs(plus.navigator.getOrientation()) === 90; - var statusBarHeight = Math.round(plus.navigator.getStatusbarHeight()); - if (ios && landscape) { - statusBarHeight = Math.min(20, statusBarHeight); - } - var safeAreaInsets; - function getSafeAreaInsets () { - return { - left: 0, - right: 0, - top: titleNView ? 0 : statusBarHeight, - bottom: 0 - } + const invokeChooseImage = function (callbackId, type, sizeType, tempFilePaths = []) { + if (!tempFilePaths.length) { + invoke(callbackId, { + code: sizeType, + errMsg: `chooseImage:${type}` + }); + return } - // 判断是否存在 titleNView - var titleNView; - var webview = getLastWebview(); - if (webview) { - let style = webview.getStyle(); - if (style) { - titleNView = style && style.titleNView; - titleNView = titleNView && titleNView.type === 'default'; + var tempFiles = []; + // plus.zip.compressImage 压缩文件并发调用在iOS端容易出现问题(图像错误、闪退),改为队列执行 + tempFilePaths.reduce((promise, tempFilePath, index, array) => { + return promise + .then(() => { + return getFileInfo$1(tempFilePath) + }) + .then(fileInfo => { + var size = fileInfo.size; + // 压缩阈值 0.5 兆 + var threshold = 1024 * 1024 * 0.5; + // 判断是否需要压缩 + if ((sizeType.indexOf('compressed') >= 0 && sizeType.indexOf('original') < 0) || ((( + sizeType.indexOf( + 'compressed') < 0 && sizeType.indexOf('original') < 0) || (sizeType + .indexOf('compressed') >= 0 && sizeType.indexOf( + 'original') >= 0)) && size > threshold)) { + return new Promise((resolve, reject) => { + var dstPath = TEMP_PATH + '/compressed/' + Date.now() + ( + tempFilePath.match(/\.\S+$/) || [''])[0]; + plus.nativeUI.showWaiting(); + plus.zip.compressImage({ + src: tempFilePath, + dst: dstPath, + overwrite: true + }, () => { + resolve(dstPath); + }, (error) => { + reject(error); + }); + }) + .then(dstPath => { + array[index] = tempFilePath = dstPath; + return getFileInfo$1(tempFilePath) + }) + .then(fileInfo => { + return tempFiles.push({ + path: tempFilePath, + size: fileInfo.size + }) + }) + } + return tempFiles.push({ + path: tempFilePath, + size: size + }) + }) + }, Promise.resolve()) + .then(() => { + plus.nativeUI.closeWaiting(); + invoke(callbackId, { + errMsg: `chooseImage:${type}`, + tempFilePaths, + tempFiles + }); + }).catch(() => { + plus.nativeUI.closeWaiting(); + invoke(callbackId, { + errMsg: `chooseImage:${type}` + }); + }); + }; + const openCamera = function (callbackId, sizeType) { + const camera = plus.camera.getCamera(); + camera.captureImage(e => invokeChooseImage(callbackId, 'ok', sizeType, [e]), + e => invokeChooseImage(callbackId, 'fail', 1), { + filename: TEMP_PATH + '/camera/' + }); + }; + const openAlbum = function (callbackId, sizeType, count) { + // TODO Android 需要拷贝到 temp 目录 + plus.gallery.pick(e => invokeChooseImage(callbackId, 'ok', sizeType, e.files.map(file => { + return file + })), e => { + invokeChooseImage(callbackId, 'fail', 2); + }, { + maximum: count, + multiple: true, + system: false, + filename: TEMP_PATH + '/gallery/' + }); + }; + + function chooseImage$1 ({ + count = 9, + sizeType = ['original', 'compressed'], + sourceType = ['album', 'camera'] + } = {}, callbackId) { + let fallback = true; + if (sourceType.length === 1) { + if (sourceType[0] === 'album') { + fallback = false; + openAlbum(callbackId, sizeType, count); + } else if (sourceType[0] === 'camera') { + fallback = false; + openCamera(callbackId, sizeType); } - safeAreaInsets = ios ? webview.getSafeAreaInsets() : getSafeAreaInsets(); - } else { - safeAreaInsets = ios ? plus.navigator.getSafeAreaInsets() : getSafeAreaInsets(); } - var windowHeight = Math.min(screenHeight - (titleNView ? (statusBarHeight + TITLEBAR_HEIGHT) - : 0) - (isTabBarPage() && tabBar$1.visible ? tabBar$1.height : 0), screenHeight); - var windowWidth = screenWidth; - var safeArea = { - left: safeAreaInsets.left, - right: windowWidth - safeAreaInsets.right, - top: safeAreaInsets.top, - bottom: windowHeight - safeAreaInsets.bottom, - width: windowWidth - safeAreaInsets.left - safeAreaInsets.right, - height: windowHeight - safeAreaInsets.top - safeAreaInsets.bottom - }; - - return { - errMsg: 'getSystemInfo:ok', - brand: plus.device.vendor, - model: plus.device.model, - pixelRatio: plus.screen.scale, - screenWidth, - screenHeight, - windowWidth, - windowHeight, - statusBarHeight, - language: plus.os.language, - system: plus.os.version, - version: plus.runtime.innerVersion, - fontSizeSetting: '', - platform, - SDKVersion: '', - windowTop: 0, - windowBottom: 0, - safeArea + if (fallback) { + plus.nativeUI.actionSheet({ + cancel: '取消', + buttons: [{ + title: '拍摄' + }, { + title: '从手机相册选择' + }] + }, (e) => { + switch (e.index) { + case 0: + invokeChooseImage(callbackId, 'fail', 0); + break + case 1: + openCamera(callbackId, sizeType); + break + case 2: + openAlbum(callbackId, sizeType, count); + break + } + }); } } - function vibrateLong () { - plus.device.vibrate(400); - return { - errMsg: 'vibrateLong:ok' + const invokeChooseVideo = function (callbackId, type, tempFilePath = '') { + let callbackResult = { + errMsg: `chooseVideo:${type}`, + tempFilePath: tempFilePath, + duration: 0, + size: 0, + height: 0, + width: 0 + }; + + if (type !== 'ok') { + invoke(callbackId, callbackResult); + return } - } - function vibrateShort () { - plus.device.vibrate(15); - return { - errMsg: 'vibrateShort:ok' + + plus.io.getVideoInfo({ + filePath: tempFilePath, + success (videoInfo) { + callbackResult.size = videoInfo.size; + callbackResult.duration = videoInfo.duration; + callbackResult.width = videoInfo.width; + callbackResult.height = videoInfo.height; + invoke(callbackId, callbackResult); + }, + fail () { + invoke(callbackId, callbackResult); + }, + complete () { + invoke(callbackId, callbackResult); + } + }); + }; + const openCamera$1 = function (callbackId, maxDuration, cameraIndex) { + const camera = plus.camera.getCamera(); + camera.startVideoCapture(e => invokeChooseVideo(callbackId, 'ok', e), e => invokeChooseVideo( + callbackId, 'fail'), { + index: cameraIndex, + videoMaximumDuration: maxDuration, + filename: TEMP_PATH + '/camera/' + }); + }; + const openAlbum$1 = function (callbackId) { + plus.gallery.pick(e => { + invokeChooseVideo(callbackId, 'ok', e); + }, e => invokeChooseVideo(callbackId, 'fail'), { + filter: 'video', + system: false, + filename: TEMP_PATH + '/gallery/' + }); + }; + function chooseVideo$1 ({ + sourceType = ['album', 'camera'], + maxDuration = 60, + camera = 'back' + } = {}, callbackId) { + let fallback = true; + let cameraIndex = (camera === 'front') ? 2 : 1; + if (sourceType.length === 1) { + if (sourceType[0] === 'album') { + fallback = false; + openAlbum$1(callbackId); + } else if (sourceType[0] === 'camera') { + fallback = false; + openCamera$1(callbackId, maxDuration, cameraIndex); + } + } + if (fallback) { + plus.nativeUI.actionSheet({ + cancel: '取消', + buttons: [{ + title: '拍摄' + }, { + title: '从手机相册选择' + }] + }, e => { + switch (e.index) { + case 0: + invokeChooseVideo(callbackId, 'fail'); + break + case 1: + openCamera$1(callbackId, maxDuration, cameraIndex); + break + case 2: + openAlbum$1(callbackId); + break + } + }); } } - const SAVED_DIR = 'uniapp_save'; - const SAVE_PATH = `_doc/${SAVED_DIR}`; - const REGEX_FILENAME = /^.*[/]/; - - function getSavedFileDir (success, fail) { - fail = fail || function () {}; - plus.io.requestFileSystem(plus.io.PRIVATE_DOC, fs => { // 请求_doc fs - fs.root.getDirectory(SAVED_DIR, { // 获取文件保存目录对象 - create: true - }, dir => { - success(dir); - }, err => { - fail('目录[' + SAVED_DIR + ']创建失败' + err.message); + function compressImage ({ + src, + quality + }, callbackId) { + var dst = TEMP_PATH + '/compressed/' + Date.now() + (src.match(/\.\S+$/) || [''])[0]; + plus.zip.compressImage({ + src, + dst, + quality + }, () => { + invoke(callbackId, { + errMsg: `compressImage:ok`, + tempFilePath: dst + }); + }, () => { + invoke(callbackId, { + errMsg: `compressImage:fail` }); - }, err => { - fail('目录[_doc]读取失败' + err.message); }); - } - - function saveFile ({ - tempFilePath + } + + function getImageInfo$1 ({ + src } = {}, callbackId) { - let fileName = tempFilePath.replace(REGEX_FILENAME, ''); - if (fileName) { - let extName = ''; - if (~fileName.indexOf('.')) { - extName = '.' + fileName.split('.').pop(); - } - - fileName = (+new Date()) + '' + extName; - - plus.io.resolveLocalFileSystemURL(getRealPath(tempFilePath), entry => { // 读取临时文件 FileEntry - getSavedFileDir(dir => { - entry.copyTo(dir, fileName, () => { // 复制临时文件 FileEntry,为了避免把相册里的文件删除,使用 copy,微信中是要删除临时文件的 - const savedFilePath = SAVE_PATH + '/' + fileName; - invoke(callbackId, { - errMsg: 'saveFile:ok', - savedFilePath - }); - }, err => { - invoke(callbackId, { - errMsg: 'saveFile:fail 保存文件[' + tempFilePath + - '] copyTo 失败:' + err.message - }); - }); - }, message => { - invoke(callbackId, { - errMsg: 'saveFile:fail ' + message - }); + // fixed by hxy + plus.io.getImageInfo({ + src, + success (imageInfo) { + invoke(callbackId, { + errMsg: 'getImageInfo:ok', + ...imageInfo }); - }, err => { + }, + fail () { invoke(callbackId, { - errMsg: 'saveFile:fail 文件[' + tempFilePath + ']读取失败' + err.message + errMsg: 'getImageInfo:fail' }); - }); - } else { - return { - errMsg: 'saveFile:fail 文件名[' + tempFilePath + ']不存在' } - } - } + }); + } + + function previewImage$1 ({ + current = 0, + background = '#000000', + indicator = 'number', + loop = false, + urls, + longPressActions + } = {}) { + urls = urls.map(url => getRealPath$1(url)); - function getSavedFileList (options, callbackId) { - getSavedFileDir(entry => { - var reader = entry.createReader(); + const index = Number(current); + if (isNaN(index)) { + current = urls.indexOf(getRealPath$1(current)); + current = current < 0 ? 0 : current; + } else { + current = index; + } - var fileList = []; - reader.readEntries(entries => { - if (entries && entries.length) { - entries.forEach(entry => { - entry.getMetadata(meta => { - fileList.push({ - filePath: plus.io.convertAbsoluteFileSystem(entry.fullPath), - createTime: meta.modificationTime.getTime(), - size: meta.size - }); - if (fileList.length === entries.length) { - invoke(callbackId, { - errMsg: 'getSavedFileList:ok', - fileList - }); - } - }, error => { - invoke(callbackId, { - errMsg: 'getSavedFileList:fail ' + error.message - }); - }, false); - }); + plus.nativeUI.previewImage(urls, { + current, + background, + indicator, + loop, + onLongPress: function (res) { + let itemList = []; + let itemColor = ''; + let title = ''; + let hasLongPressActions = longPressActions && longPressActions.callbackId; + if (!hasLongPressActions) { + itemList = ['保存相册']; + itemColor = '#000000'; + title = ''; } else { - invoke(callbackId, { - errMsg: 'getSavedFileList:ok', - fileList - }); + itemList = longPressActions.itemList ? longPressActions.itemList : []; + itemColor = longPressActions.itemColor ? longPressActions.itemColor : '#000000'; + title = longPressActions.title ? longPressActions.title : ''; + } + + const options = { + buttons: itemList.map(item => ({ + title: item, + color: itemColor + })), + cancel: '取消' + }; + if (title) { + options.title = title; } - }, error => { - invoke(callbackId, { - errMsg: 'getSavedFileList:fail ' + error.message + // if (plus.os.name === 'iOS') { + // options.cancel = '取消' + // } + plus.nativeUI.actionSheet(options, (e) => { + if (e.index > 0) { + if (hasLongPressActions) { + publish(longPressActions.callbackId, { + errMsg: 'showActionSheet:ok', + tapIndex: e.index - 1, + index: res.index + }); + return + } + plus.gallery.save(res.url, function (GallerySaveEvent) { + plus.nativeUI.toast('保存图片到相册成功'); + }); + } else if (hasLongPressActions) { + publish(longPressActions.callbackId, { + errMsg: 'showActionSheet:fail cancel' + }); + } }); - }); - }, message => { - invoke(callbackId, { - errMsg: 'getSavedFileList:fail ' + message - }); + } }); - } + return { + errMsg: 'previewImage:ok' + } + } + + let recorder$1; + let recordTimeout$1; - function getFileInfo ({ - filePath, - digestAlgorithm = 'md5' - } = {}, callbackId) { - // TODO 计算文件摘要 - plus.io.resolveLocalFileSystemURL(getRealPath(filePath), entry => { - entry.getMetadata(meta => { - invoke(callbackId, { - errMsg: 'getFileInfo:ok', - size: meta.size, - digestAlgorithm: '' - }); - }, err => { - invoke(callbackId, { - errMsg: 'getFileInfo:fail 文件[' + - filePath + - '] getMetadata 失败:' + err.message - }); - }); - }, err => { - invoke(callbackId, { - errMsg: 'getFileInfo:fail 文件[' + filePath + ']读取失败:' + err.message - }); - }); - } + const publishRecorderStateChange = (state, res = {}) => { + publish('onRecorderStateChange', Object.assign({ + state + }, res)); + }; - function getSavedFileInfo ({ - filePath - } = {}, callbackId) { - plus.io.resolveLocalFileSystemURL(getRealPath(filePath), entry => { - entry.getMetadata(meta => { - invoke(callbackId, { - createTime: meta.modificationTime.getTime(), - size: meta.size, - errMsg: 'getSavedFileInfo:ok' + const Recorder = { + start ({ + duration = 60000, + sampleRate, + numberOfChannels, + encodeBitRate, + format = 'mp3', + frameSize, + audioSource = 'auto' + }, callbackId) { + if (recorder$1) { + return publishRecorderStateChange('start') + } + recorder$1 = plus.audio.getRecorder(); + recorder$1.record({ + format, + samplerate: sampleRate, + filename: TEMP_PATH + '/recorder/' + }, res => publishRecorderStateChange('stop', { + tempFilePath: res + }), err => publishRecorderStateChange('error', { + errMsg: err.message + })); + recordTimeout$1 = setTimeout(() => { + Recorder.stop(); + }, duration); + publishRecorderStateChange('start'); + }, + stop () { + if (recorder$1) { + recorder$1.stop(); + recorder$1 = false; + recordTimeout$1 && clearTimeout(recordTimeout$1); + } + }, + pause () { + if (recorder$1) { + publishRecorderStateChange('error', { + errMsg: '暂不支持录音pause操作' }); - }, error => { - invoke(callbackId, { - errMsg: 'getSavedFileInfo:fail ' + error.message + } + }, + resume () { + if (recorder$1) { + publishRecorderStateChange('error', { + errMsg: '暂不支持录音resume操作' }); - }, false); - }, () => { - invoke(callbackId, { - errMsg: 'getSavedFileInfo:fail file not find' - }); - }); - } + } + } + }; - function removeSavedFile ({ + function operateRecorder ({ + operationType, + ...args + }, callbackId) { + Recorder[operationType](args); + return { + errMsg: 'operateRecorder:ok' + } + } + + function saveImageToPhotosAlbum ({ filePath } = {}, callbackId) { - plus.io.resolveLocalFileSystemURL(getRealPath(filePath), entry => { - entry.remove(() => { - invoke(callbackId, { - errMsg: 'removeSavedFile:ok' - }); - }, err => { - invoke(callbackId, { - errMsg: 'removeSavedFile:fail 文件[' + filePath + ']删除失败:' + err.message - }); + plus.gallery.save(getRealPath$1(filePath), e => { + invoke(callbackId, { + errMsg: 'saveImageToPhotosAlbum:ok' }); - }, () => { + }, e => { invoke(callbackId, { - errMsg: 'removeSavedFile:fail file not find' + errMsg: 'saveImageToPhotosAlbum:fail' }); }); } - function openDocument$1 ({ - filePath, - fileType + function saveVideoToPhotosAlbum ({ + filePath } = {}, callbackId) { - plus.io.resolveLocalFileSystemURL(getRealPath(filePath), entry => { - plus.runtime.openFile(getRealPath(filePath)); + plus.gallery.save(getRealPath$1(filePath), e => { invoke(callbackId, { - errMsg: 'openDocument:ok' + errMsg: 'saveVideoToPhotosAlbum:ok' }); - }, err => { + }, e => { invoke(callbackId, { - errMsg: 'openDocument:fail 文件[' + filePath + ']读取失败:' + err.message + errMsg: 'saveVideoToPhotosAlbum:fail' }); }); } - const CHOOSE_LOCATION_PATH = '_www/__uniappchooselocation.html'; + let downloadTaskId = 0; + const downloadTasks = {}; + + const publishStateChange = (res) => { + publish('onDownloadTaskStateChange', res); + }; + + const createDownloadTaskById = function (downloadTaskId, { + url, + header + } = {}) { + const downloader = plus.downloader.createDownload(url, { + time: __uniConfig.networkTimeout.downloadFile ? __uniConfig.networkTimeout.downloadFile / 1000 : 120, + filename: TEMP_PATH + '/download/', + // 需要与其它平台上的表现保持一致,不走重试的逻辑。 + retry: 0, + retryInterval: 0 + }, (download, statusCode) => { + if (statusCode) { + publishStateChange({ + downloadTaskId, + state: 'success', + tempFilePath: download.filename, + statusCode + }); + } else { + publishStateChange({ + downloadTaskId, + state: 'fail', + statusCode + }); + } + }); + for (const name in header) { + if (header.hasOwnProperty(name)) { + downloader.setRequestHeader(name, header[name]); + } + } + downloader.addEventListener('statechanged', (download, status) => { + if (download.downloadedSize && download.totalSize) { + publishStateChange({ + downloadTaskId, + state: 'progressUpdate', + progress: parseInt(download.downloadedSize / download.totalSize * 100), + totalBytesWritten: download.downloadedSize, + totalBytesExpectedToWrite: download.totalSize + }); + } + }); + downloadTasks[downloadTaskId] = downloader; + downloader.start(); + return { + downloadTaskId, + errMsg: 'createDownloadTask:ok' + } + }; + + function operateDownloadTask ({ + downloadTaskId, + operationType + } = {}) { + const downloadTask = downloadTasks[downloadTaskId]; + if (downloadTask && operationType === 'abort') { + delete downloadTasks[downloadTaskId]; + downloadTask.abort(); + publishStateChange({ + downloadTaskId, + state: 'fail', + errMsg: 'abort' + }); + return { + errMsg: 'operateDownloadTask:ok' + } + } + return { + errMsg: 'operateDownloadTask:fail' + } + } + + function createDownloadTask (args) { + return createDownloadTaskById(++downloadTaskId, args) + } + + let requestTaskId = 0; + const requestTasks = {}; - const MESSAGE_TYPE$1 = 'chooseLocation'; - - function chooseLocation$1 (params, callbackId) { - const statusBarStyle = plus.navigator.getStatusBarStyle(); - const webview = plus.webview.create( - CHOOSE_LOCATION_PATH, - MAP_ID, { - titleNView: { - autoBackButton: true, - backgroundColor: '#000000', - titleColor: '#ffffff', - titleText: '选择位置', - titleSize: '17px', - buttons: [{ - float: 'right', - text: '完成', - fontSize: '17px', - onclick: function () { - webview.evalJS('__chooseLocationConfirm__()'); - } - }] - }, - popGesture: 'close', - scrollIndicator: 'none' - }, { - __uniapp_type: 'map', - __uniapp_statusbar_style: statusBarStyle, - 'uni-app': 'none' - } - ); - if (statusBarStyle === 'dark') { - plus.navigator.setStatusBarStyle('light'); - webview.addEventListener('popGesture', ({ - type, - result - }) => { - if (type === 'start') { - plus.navigator.setStatusBarStyle('dark'); - } else if (type === 'end' && !result) { - plus.navigator.setStatusBarStyle('light'); - } - }); - } - let index = 0; - let onShow = function () { - index++; - if (index === 2) { - webview.evalJS(`__chooseLocation__(${JSON.stringify(params)})`); - } - }; - webview.addEventListener('loaded', onShow); - webview.show('slide-in-bottom', ANI_DURATION, onShow); + const publishStateChange$1 = res => { + publish('onRequestTaskStateChange', res); + delete requestTasks[requestTaskId]; + }; - let result; + function createRequestTaskById (requestTaskId, { + url, + data, + header, + method = 'GET', + responseType, + sslVerify = true + } = {}) { + const stream = requireNativePlugin('stream'); + const headers = {}; - webview.addEventListener('close', () => { - if (result) { - invoke(callbackId, { - name: result.poiname, - address: result.poiaddress, - latitude: result.latlng.lat, - longitude: result.latlng.lng, - errMsg: 'chooseLocation:ok' - }); + let abortTimeout; + let aborted; + let hasContentType = false; + for (const name in header) { + if (!hasContentType && name.toLowerCase() === 'content-type') { + hasContentType = true; + headers['Content-Type'] = header[name]; } else { - consumePlusMessage(MESSAGE_TYPE$1); - invoke(callbackId, { - errMsg: 'chooseLocation:fail cancel' + headers[name] = header[name]; + } + } + + if (!hasContentType && method === 'POST') { + headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'; + } + + const timeout = __uniConfig.networkTimeout.request; + if (timeout) { + abortTimeout = setTimeout(() => { + aborted = true; + publishStateChange$1({ + requestTaskId, + state: 'fail', + statusCode: 0, + errMsg: 'timeout' }); + }, timeout); + } + const options = { + method, + url: url.trim(), + // weex 官方文档有误,headers 类型实际 object,用 string 类型会无响应 + headers, + type: responseType === 'arraybuffer' ? 'base64' : 'text', + // weex 官方文档未说明实际支持 timeout,单位:ms + timeout: timeout || 6e5, + // 配置和weex模块内相反 + sslVerify: !sslVerify + }; + if (method !== 'GET') { + options.body = data; + } + try { + stream.fetch(options, ({ + ok, + status, + data, + headers + }) => { + if (aborted) { + return + } + if (abortTimeout) { + clearTimeout(abortTimeout); + } + const statusCode = status; + if (statusCode > 0) { + publishStateChange$1({ + requestTaskId, + state: 'success', + data: ok && responseType === 'arraybuffer' ? base64ToArrayBuffer$2(data) : data, + statusCode, + header: headers + }); + } else { + publishStateChange$1({ + requestTaskId, + state: 'fail', + statusCode, + errMsg: 'abort' + }); + } + }); + requestTasks[requestTaskId] = { + abort () { + aborted = true; + if (abortTimeout) { + clearTimeout(abortTimeout); + } + publishStateChange$1({ + requestTaskId, + state: 'fail', + statusCode: 0, + errMsg: 'abort' + }); + } + }; + } catch (e) { + return { + requestTaskId, + errMsg: 'createRequestTask:fail' } - }); - - registerPlusMessage(MESSAGE_TYPE$1, function (res) { - if (res && 'latlng' in res) { - result = res; - } - }, false); + } + return { + requestTaskId, + errMsg: 'createRequestTask:ok' + } } - function getLocationSuccess (type, position, callbackId) { - const coords = position.coords; - if (type !== position.coordsType) { - if (process.env.NODE_ENV !== 'production') { - console.log( - `UNIAPP[location]:before[${position.coordsType}][lng:${ - coords.longitude - },lat:${coords.latitude}]` - ); - } - let coordArray; - if (type === 'wgs84') { - coordArray = gcj02towgs84(coords.longitude, coords.latitude); - } else if (type === 'gcj02') { - coordArray = wgs84togcj02(coords.longitude, coords.latitude); - } - if (coordArray) { - coords.longitude = coordArray[0]; - coords.latitude = coordArray[1]; - if (process.env.NODE_ENV !== 'production') { - console.log( - `UNIAPP[location]:after[${type}][lng:${coords.longitude},lat:${ - coords.latitude - }]` - ); - } - } - } + function createRequestTask (args) { + return createRequestTaskById(++requestTaskId, args) + } + + function operateRequestTask ({ + requestTaskId, + operationType + } = {}) { + const requestTask = requestTasks[requestTaskId]; + if (requestTask && operationType === 'abort') { + requestTask.abort(); + return { + errMsg: 'operateRequestTask:ok' + } + } + return { + errMsg: 'operateRequestTask:fail' + } + } + + const socketTasks = {}; - invoke(callbackId, { - type, - altitude: coords.altitude || 0, - latitude: coords.latitude, - longitude: coords.longitude, - speed: coords.speed, - accuracy: coords.accuracy, - address: position.address, - errMsg: 'getLocation:ok' + const publishStateChange$2 = (res) => { + publish('onSocketTaskStateChange', res); + }; + + let socket; + function getSocket () { + if (socket) { + return socket + } + socket = requireNativePlugin('uni-webSocket'); + socket.onopen(function (e) { + publishStateChange$2({ + socketTaskId: e.id, + state: 'open' + }); + }); + socket.onmessage(function (e) { + const data = e.data; + publishStateChange$2({ + socketTaskId: e.id, + state: 'message', + data: typeof data === 'object' ? base64ToArrayBuffer$2(data.base64) : data + }); + }); + socket.onerror(function (e) { + publishStateChange$2({ + socketTaskId: e.id, + state: 'error', + errMsg: e.data + }); + }); + socket.onclose(function (e) { + const socketTaskId = e.id; + delete socketTasks[socketTaskId]; + publishStateChange$2({ + socketTaskId, + state: 'close' + }); }); + return socket } - function getLocation$1 ({ - type = 'wgs84', - geocode = false, - altitude = false - } = {}, callbackId) { - plus.geolocation.getCurrentPosition( - position => { - getLocationSuccess(type, position, callbackId); - }, - e => { - // 坐标地址解析失败 - if (e.code === 1501) { - getLocationSuccess(type, e, callbackId); - return - } + const createSocketTaskById = function (socketTaskId, { + url, + data, + header, + method, + protocols + } = {}) { + const socket = getSocket(); + socket.WebSocket({ + id: socketTaskId, + url, + protocol: Array.isArray(protocols) ? protocols.join(',') : protocols + }); + socketTasks[socketTaskId] = socket; + return { + socketTaskId, + errMsg: 'createSocketTask:ok' + } + }; - invoke(callbackId, { - errMsg: 'getLocation:fail ' + e.message - }); - }, { - geocode: geocode, - enableHighAccuracy: altitude - } - ); - } - - const OPEN_LOCATION_PATH = '_www/__uniappopenlocation.html'; + function createSocketTask (args) { + return createSocketTaskById(String(Date.now()), args) + } - function openLocation$1 (params) { - const statusBarStyle = plus.navigator.getStatusBarStyle(); - const webview = plus.webview.create( - OPEN_LOCATION_PATH, - MAP_ID, { - titleNView: { - autoBackButton: true, - titleColor: '#ffffff', - titleText: '', - titleSize: '17px', - type: 'transparent' - }, - popGesture: 'close', - scrollIndicator: 'none' - }, { - __uniapp_type: 'map', - __uniapp_statusbar_style: statusBarStyle, - 'uni-app': 'none' + function operateSocketTask (args) { + const { + operationType, + code, + reason, + data, + socketTaskId + } = unpack(args); + const socket = socketTasks[socketTaskId]; + if (!socket) { + return { + errMsg: 'operateSocketTask:fail' } - ); - if (statusBarStyle === 'light') { - plus.navigator.setStatusBarStyle('dark'); - webview.addEventListener('popGesture', ({ - type, - result - }) => { - if (type === 'start') { - plus.navigator.setStatusBarStyle('light'); - } else if (type === 'end' && !result) { - plus.navigator.setStatusBarStyle('dark'); + } + switch (operationType) { + case 'send': + if (data) { + socket.send({ + id: socketTaskId, + data: typeof data === 'object' ? { + '@type': 'binary', + base64: arrayBufferToBase64$2(data) + } : data + }); + } + return { + errMsg: 'operateSocketTask:ok' + } + case 'close': + socket.close({ + id: socketTaskId, + code, + reason + }); + delete socketTasks[socketTaskId]; + return { + errMsg: 'operateSocketTask:ok' } - }); } - webview.show(ANI_SHOW, ANI_DURATION, () => { - webview.evalJS(`__openLocation__(${JSON.stringify(params)})`); - }); - return { - errMsg: 'openLocation:ok' + errMsg: 'operateSocketTask:fail' } } - const RECORD_TIME = 60 * 60 * 1000; + let uploadTaskId = 0; + const uploadTasks = {}; - let recorder; - let recordTimeout; + const publishStateChange$3 = (res) => { + publish('onUploadTaskStateChange', res); + }; - function startRecord (args, callbackId) { - recorder && recorder.stop(); - recorder = plus.audio.getRecorder(); - recorder.record({ - filename: '_doc/audio/', - format: 'aac' - }, (res) => { - invoke(callbackId, { - errMsg: 'startRecord:ok', - tempFilePath: res + const createUploadTaskById = function (uploadTaskId, { + url, + filePath, + name, + files, + header, + formData + } = {}) { + const uploader = plus.uploader.createUpload(url, { + timeout: __uniConfig.networkTimeout.uploadFile ? __uniConfig.networkTimeout.uploadFile / 1000 : 120, + // 需要与其它平台上的表现保持一致,不走重试的逻辑。 + retry: 0, + retryInterval: 0 + }, (upload, statusCode) => { + if (statusCode) { + publishStateChange$3({ + uploadTaskId, + state: 'success', + data: upload.responseText, + statusCode + }); + } else { + publishStateChange$3({ + uploadTaskId, + state: 'fail', + data: '', + statusCode + }); + } + delete uploadTasks[uploadTaskId]; + }); + + for (const name in header) { + if (header.hasOwnProperty(name)) { + uploader.setRequestHeader(name, header[name]); + } + } + for (const name in formData) { + if (formData.hasOwnProperty(name)) { + uploader.addData(name, formData[name]); + } + } + if (files && files.length) { + files.forEach(file => { + uploader.addFile(getRealPath$1(file.uri), { + key: file.name || 'file' + }); }); - }, (res) => { - invoke(callbackId, { - errMsg: 'startRecord:fail' + } else { + uploader.addFile(getRealPath$1(filePath), { + key: name }); + } + uploader.addEventListener('statechanged', (upload, status) => { + if (upload.uploadedSize && upload.totalSize) { + publishStateChange$3({ + uploadTaskId, + state: 'progressUpdate', + progress: parseInt(upload.uploadedSize / upload.totalSize * 100), + totalBytesSent: upload.uploadedSize, + totalBytesExpectedToSend: upload.totalSize + }); + } }); - recordTimeout = setTimeout(() => { - recorder.stop(); - recorder = false; - }, RECORD_TIME); - } + uploadTasks[uploadTaskId] = uploader; + uploader.start(); + return { + uploadTaskId, + errMsg: 'createUploadTask:ok' + } + }; - function stopRecord () { - if (recorder) { - recordTimeout && clearTimeout(recordTimeout); - recorder.stop(); + function operateUploadTask ({ + uploadTaskId, + operationType + } = {}) { + const uploadTask = uploadTasks[uploadTaskId]; + if (uploadTask && operationType === 'abort') { + delete uploadTasks[uploadTaskId]; + uploadTask.abort(); + publishStateChange$3({ + uploadTaskId, + state: 'fail', + errMsg: 'abort' + }); return { - errMsg: 'stopRecord:ok' + errMsg: 'operateUploadTask:ok' } } return { - errMsg: 'stopRecord:fail' + errMsg: 'operateUploadTask:fail' } } - let player; - let playerFilePath; - let playerStatus; - - function playVoice ({ - filePath - } = {}, callbackId) { - if (player && playerFilePath === filePath && playerStatus === 'pause') { // 如果是当前音频被暂停,则继续播放 - playerStatus = 'play'; - player.play((res) => { - player = false; - playerFilePath = false; - playerStatus = false; - invoke(callbackId, { - errMsg: 'playVoice:ok' + function createUploadTask (args) { + return createUploadTaskById(++uploadTaskId, args) + } + + const providers = { + oauth (callback) { + plus.oauth.getServices(services => { + const provider = []; + services.forEach(({ + id + }) => { + provider.push(id); + }); + callback(null, provider); + }, err => { + callback(err); + }); + }, + share (callback) { + plus.share.getServices(services => { + const provider = []; + services.forEach(({ + id + }) => { + provider.push(id); }); + callback(null, provider); + }, err => { + callback(err); }); - return { - errMsg: 'playVoice:ok' + }, + payment (callback) { + plus.payment.getChannels(services => { + const provider = []; + services.forEach(({ + id + }) => { + provider.push(id); + }); + callback(null, provider); + }, err => { + callback(err); + }); + }, + push (callback) { + if (typeof weex !== 'undefined' || typeof plus !== 'undefined') { + callback(null, [plus.push.getClientInfo().id]); + } else { + callback(null, []); } } - if (player) { // 如果存在音频播放,则停止 - player.stop(); - } - playerFilePath = filePath; - playerStatus = 'play'; - player = plus.audio.createPlayer(getRealPath(filePath)); - // 播放操作成功回调 - player.play((res) => { - player = false; - playerFilePath = false; - playerStatus = false; + }; + + function getProvider$1 ({ + service + }, callbackId) { + if (providers[service]) { + providers[service]((err, provider) => { + if (err) { + invoke(callbackId, { + errMsg: 'getProvider:fail:' + err.message + }); + } else { + invoke(callbackId, { + errMsg: 'getProvider:ok', + service, + provider + }); + } + }); + } else { invoke(callbackId, { - errMsg: 'playVoice:ok' + errMsg: 'getProvider:fail:服务[' + service + ']不支持' }); - }); - } - - function pauseVoice () { - if (player && playerStatus === 'play') { - player.pause(); - playerStatus = 'pause'; - } - return { - errMsg: 'pauseVoice:ok' - } - } - - function stopVoice () { - if (player) { - player.stop(); - player = false; - playerFilePath = false; - playerStatus = false; - } - return { - errMsg: 'stopVoice:ok' } } + const loginServices = {}; + + const loginByService = (provider, callbackId) => { + function login () { + loginServices[provider].login(res => { + const authResult = res.target.authResult; + invoke(callbackId, { + code: authResult.code, + authResult: authResult, + errMsg: 'login:ok' + }); + }, err => { + invoke(callbackId, { + code: err.code, + errMsg: 'login:fail:' + err.message + }); + }); + } + // 先注销再登录 + loginServices[provider].logout(login, login); + }; /** - * 获取文件信息 - * @param {string} filePath 文件路径 - * @returns {Promise} 文件信息Promise + * 微信登录 */ - function getFileInfo$1 (filePath) { - return new Promise((resolve, reject) => { - plus.io.resolveLocalFileSystemURL(filePath, function (entry) { - entry.getMetadata(function (meta) { - resolve({ - size: meta.size + function login (params, callbackId) { + const provider = params.provider || 'weixin'; + if (loginServices[provider]) { + loginByService(provider, callbackId); + } else { + plus.oauth.getServices(services => { + loginServices[provider] = services.find(({ + id + }) => id === provider); + if (!loginServices[provider]) { + invoke(callbackId, { + code: '', + errMsg: 'login:fail:登录服务[' + provider + ']不存在' }); - }, reject, false); - }, reject); - }) + } else { + loginByService(provider, callbackId); + } + }, err => { + invoke(callbackId, { + code: err.code, + errMsg: 'login:fail:' + err.message + }); + }); + } } - const invokeChooseImage = function (callbackId, type, sizeType, tempFilePaths = []) { - if (!tempFilePaths.length) { - invoke(callbackId, { - code: sizeType, - errMsg: `chooseImage:${type}` - }); - return + function getUserInfo (params, callbackId) { + const provider = params.provider || 'weixin'; + const loginService = loginServices[provider]; + if (!loginService || !loginService.authResult) { + return invoke(callbackId, { + errMsg: 'operateWXData:fail:请先调用 uni.login' + }) } - var tempFiles = []; - // plus.zip.compressImage 压缩文件并发调用在iOS端容易出现问题(图像错误、闪退),改为队列执行 - tempFilePaths.reduce((promise, tempFilePath, index, array) => { - return promise - .then(() => { - return getFileInfo$1(tempFilePath) - }) - .then(fileInfo => { - var size = fileInfo.size; - // 压缩阈值 0.5 兆 - var threshold = 1024 * 1024 * 0.5; - // 判断是否需要压缩 - if ((sizeType.indexOf('compressed') >= 0 && sizeType.indexOf('original') < 0) || ((( - sizeType.indexOf( - 'compressed') < 0 && sizeType.indexOf('original') < 0) || (sizeType - .indexOf('compressed') >= 0 && sizeType.indexOf( - 'original') >= 0)) && size > threshold)) { - return new Promise((resolve, reject) => { - var dstPath = TEMP_PATH + '/compressed/' + Date.now() + ( - tempFilePath.match(/\.\S+$/) || [''])[0]; - plus.nativeUI.showWaiting(); - plus.zip.compressImage({ - src: tempFilePath, - dst: dstPath, - overwrite: true - }, () => { - resolve(dstPath); - }, (error) => { - reject(error); - }); - }) - .then(dstPath => { - array[index] = tempFilePath = dstPath; - return getFileInfo$1(tempFilePath) - }) - .then(fileInfo => { - return tempFiles.push({ - path: tempFilePath, - size: fileInfo.size - }) - }) - } - return tempFiles.push({ - path: tempFilePath, - size: size - }) - }) - }, Promise.resolve()) - .then(() => { - plus.nativeUI.closeWaiting(); + loginService.getUserInfo(res => { + let userInfo; + if (provider === 'weixin') { + const wechatUserInfo = loginService.userInfo; + userInfo = { + openId: wechatUserInfo.openid, + nickName: wechatUserInfo.nickname, + gender: wechatUserInfo.sex, + city: wechatUserInfo.city, + province: wechatUserInfo.province, + country: wechatUserInfo.country, + avatarUrl: wechatUserInfo.headimgurl, + unionId: wechatUserInfo.unionid + }; + } else { + loginService.userInfo.openId = loginService.userInfo.openId || loginService.userInfo.openid || + loginService.authResult.openid; + loginService.userInfo.nickName = loginService.userInfo.nickName || loginService.userInfo.nickname; + loginService.userInfo.avatarUrl = loginService.userInfo.avatarUrl || loginService.userInfo.avatarUrl || + loginService.userInfo.headimgurl; + userInfo = loginService.userInfo; + } + const result = { + errMsg: 'operateWXData:ok' + }; + if (params.data && params.data.api_name === 'webapi_getuserinfo') { + result.data = { + data: JSON.stringify(userInfo), + rawData: '', + signature: '', + encryptedData: '', + iv: '' + }; + } else { + result.userInfo = userInfo; + } + invoke(callbackId, result); + }, err => { + invoke(callbackId, { + errMsg: 'operateWXData:fail:' + err.message + }); + }); + } + + /** + * 获取用户信息 + */ + function operateWXData (params, callbackId) { + switch (params.data.api_name) { + case 'webapi_getuserinfo': + getUserInfo(params, callbackId); + break + default: + return { + errMsg: 'operateWXData:fail' + } + } + } + + function requestPayment (params, callbackId) { + const provider = params.provider; + plus.payment.getChannels(services => { + const service = services.find(({ + id + }) => id === provider); + if (!service) { invoke(callbackId, { - errMsg: `chooseImage:${type}`, - tempFilePaths, - tempFiles + errMsg: 'requestPayment:fail:支付服务[' + provider + ']不存在' }); - }).catch(() => { - plus.nativeUI.closeWaiting(); - invoke(callbackId, { - errMsg: `chooseImage:${type}` + } else { + plus.payment.request(service, params.orderInfo, res => { + invoke(callbackId, { + errMsg: 'requestPayment:ok' + }); + }, err => { + invoke(callbackId, { + errMsg: 'requestPayment:fail:' + err.message + }); }); + } + }, err => { + invoke(callbackId, { + errMsg: 'requestPayment:fail:' + err.message }); - }; - const openCamera = function (callbackId, sizeType) { - const camera = plus.camera.getCamera(); - camera.captureImage(e => invokeChooseImage(callbackId, 'ok', sizeType, [e]), - e => invokeChooseImage(callbackId, 'fail', 1), { - filename: TEMP_PATH + '/camera/' - }); - }; - const openAlbum = function (callbackId, sizeType, count) { - // TODO Android 需要拷贝到 temp 目录 - plus.gallery.pick(e => invokeChooseImage(callbackId, 'ok', sizeType, e.files.map(file => { - return file - })), e => { - invokeChooseImage(callbackId, 'fail', 2); - }, { - maximum: count, - multiple: true, - system: false, - filename: TEMP_PATH + '/gallery/' }); - }; + } + + let onPushing; - function chooseImage$1 ({ - count = 9, - sizeType = ['original', 'compressed'], - sourceType = ['album', 'camera'] - } = {}, callbackId) { - let fallback = true; - if (sourceType.length === 1) { - if (sourceType[0] === 'album') { - fallback = false; - openAlbum(callbackId, sizeType, count); - } else if (sourceType[0] === 'camera') { - fallback = false; - openCamera(callbackId, sizeType); + let isListening = false; + + let unsubscribe = false; + + function subscribePush (params, callbackId) { + const clientInfo = plus.push.getClientInfo(); + if (clientInfo) { + if (!isListening) { + isListening = true; + plus.push.addEventListener('receive', msg => { + if (onPushing && !unsubscribe) { + publish('onPushMessage', { + messageId: msg.__UUID__, + data: msg.payload, + errMsg: 'onPush:ok' + }); + } + }); + } + unsubscribe = false; + clientInfo.errMsg = 'subscribePush:ok'; + return clientInfo + } else { + return { + errMsg: 'subscribePush:fail:请确保当前运行环境已包含 push 模块' } } - if (fallback) { - plus.nativeUI.actionSheet({ - cancel: '取消', - buttons: [{ - title: '拍摄' - }, { - title: '从手机相册选择' - }] - }, (e) => { - switch (e.index) { - case 0: - invokeChooseImage(callbackId, 'fail', 0); - break - case 1: - openCamera(callbackId, sizeType); - break - case 2: - openAlbum(callbackId, sizeType, count); - break - } - }); - } - } - - const invokeChooseVideo = function (callbackId, type, tempFilePath = '') { - let callbackResult = { - errMsg: `chooseVideo:${type}`, - tempFilePath: tempFilePath, - duration: 0, - size: 0, - height: 0, - width: 0 - }; + } - if (type !== 'ok') { - invoke(callbackId, callbackResult); - return + function unsubscribePush (params) { + unsubscribe = true; + return { + errMsg: 'unsubscribePush:ok' } + } - plus.io.getVideoInfo({ - filePath: tempFilePath, - success (videoInfo) { - callbackResult.size = videoInfo.size; - callbackResult.duration = videoInfo.duration; - callbackResult.width = videoInfo.width; - callbackResult.height = videoInfo.height; - invoke(callbackId, callbackResult); - }, - fail () { - invoke(callbackId, callbackResult); - }, - complete () { - invoke(callbackId, callbackResult); + function onPush () { + if (!isListening) { + return { + errMsg: 'onPush:fail:请先调用 uni.subscribePush' } - }); - }; - const openCamera$1 = function (callbackId, maxDuration, cameraIndex) { - const camera = plus.camera.getCamera(); - camera.startVideoCapture(e => invokeChooseVideo(callbackId, 'ok', e), e => invokeChooseVideo( - callbackId, 'fail'), { - index: cameraIndex, - videoMaximumDuration: maxDuration, - filename: TEMP_PATH + '/camera/' - }); - }; - const openAlbum$1 = function (callbackId) { - plus.gallery.pick(e => { - invokeChooseVideo(callbackId, 'ok', e); - }, e => invokeChooseVideo(callbackId, 'fail'), { - filter: 'video', - system: false, - filename: TEMP_PATH + '/gallery/' - }); - }; - function chooseVideo$1 ({ - sourceType = ['album', 'camera'], - maxDuration = 60, - camera = 'back' - } = {}, callbackId) { - let fallback = true; - let cameraIndex = (camera === 'front') ? 2 : 1; - if (sourceType.length === 1) { - if (sourceType[0] === 'album') { - fallback = false; - openAlbum$1(callbackId); - } else if (sourceType[0] === 'camera') { - fallback = false; - openCamera$1(callbackId, maxDuration, cameraIndex); + } + if (plus.push.getClientInfo()) { + onPushing = true; + return { + errMsg: 'onPush:ok' } } - if (fallback) { - plus.nativeUI.actionSheet({ - cancel: '取消', - buttons: [{ - title: '拍摄' - }, { - title: '从手机相册选择' - }] - }, e => { - switch (e.index) { - case 0: - invokeChooseVideo(callbackId, 'fail'); - break - case 1: - openCamera$1(callbackId, maxDuration, cameraIndex); - break - case 2: - openAlbum$1(callbackId); - break - } - }); + return { + errMsg: 'onPush:fail:请确保当前运行环境已包含 push 模块' + } + } + + function offPush (params) { + onPushing = false; + return { + errMsg: 'offPush:ok' } } - function compressImage ({ - src, - quality - }, callbackId) { - var dst = TEMP_PATH + '/compressed/' + Date.now() + (src.match(/\.\S+$/) || [''])[0]; - plus.zip.compressImage({ - src, - dst, - quality - }, () => { - invoke(callbackId, { - errMsg: `compressImage:ok`, - tempFilePath: dst - }); - }, () => { - invoke(callbackId, { - errMsg: `compressImage:fail` - }); - }); + function requireNativePlugin$1 (name) { + return weex.requireModule(name) } - function getImageInfo$1 ({ - src - } = {}, callbackId) { - // fixed by hxy - plus.io.getImageInfo({ - src, - success (imageInfo) { + // 0:图文,1:纯文字,2:纯图片,3:音乐,4:视频,5:小程序 + const TYPES = { + '0': { + name: 'web', + title: '图文' + }, + '1': { + name: 'text', + title: '纯文字' + }, + '2': { + name: 'image', + title: '纯图片' + }, + '3': { + name: 'music', + title: '音乐' + }, + '4': { + name: 'video', + title: '视频' + }, + '5': { + name: 'miniProgram', + title: '小程序' + } + }; + + const parseParams = (args, callbackId, method) => { + args.type = args.type || 0; + + let { + provider, + type, + title, + summary: content, + href, + imageUrl, + mediaUrl: media, + scene, + miniProgram + } = args; + + if (typeof imageUrl === 'string' && imageUrl) { + imageUrl = getRealPath$1(imageUrl); + } + + const shareType = TYPES[type + '']; + if (shareType) { + let sendMsg = { + provider, + type: shareType.name, + title, + content, + href, + pictures: [imageUrl], + thumbs: [imageUrl], + media, + miniProgram, + extra: { + scene + } + }; + if (provider === 'weixin' && (type === 1 || type === 2)) { + delete sendMsg.thumbs; + } + return sendMsg + } + return '分享参数 type 不正确' + }; + + const sendShareMsg = function (service, params, callbackId, method = 'share') { + service.send( + params, + () => { invoke(callbackId, { - errMsg: 'getImageInfo:ok', - ...imageInfo + errMsg: method + ':ok' }); }, - fail () { + err => { invoke(callbackId, { - errMsg: 'getImageInfo:fail' + errMsg: method + ':fail:' + err.message }); } - }); - } - - function previewImage$1 ({ - current = 0, - background = '#000000', - indicator = 'number', - loop = false, - urls, - longPressActions - } = {}) { - urls = urls.map(url => getRealPath(url)); + ); + }; - const index = Number(current); - if (isNaN(index)) { - current = urls.indexOf(getRealPath(current)); - current = current < 0 ? 0 : current; + function shareAppMessageDirectly ({ + title, + path, + imageUrl, + useDefaultSnapshot + }, callbackId) { + title = title || __uniConfig.appname; + const goShare = () => { + share({ + provider: 'weixin', + type: 0, + title, + imageUrl, + href: path, + scene: 'WXSceneSession' + }, + callbackId, + 'shareAppMessageDirectly' + ); + }; + if (useDefaultSnapshot) { + const pages = getCurrentPages(); + const webview = plus.webview.getWebviewById(pages[pages.length - 1].__wxWebviewId__ + ''); + if (webview) { + const bitmap = new plus.nativeObj.Bitmap(); + webview.draw( + bitmap, + () => { + const fileName = TEMP_PATH + '/share/snapshot.jpg'; + bitmap.save( + fileName, { + overwrite: true, + format: 'jpg' + }, + () => { + imageUrl = fileName; + goShare(); + }, + err => { + invoke(callbackId, { + errMsg: 'shareAppMessageDirectly:fail:' + err.message + }); + } + ); + }, + err => { + invoke(callbackId, { + errMsg: 'shareAppMessageDirectly:fail:' + err.message + }); + } + ); + } else { + goShare(); + } } else { - current = index; + goShare(); } + } - plus.nativeUI.previewImage(urls, { - current, - background, - indicator, - loop, - onLongPress: function (res) { - let itemList = []; - let itemColor = ''; - let title = ''; - let hasLongPressActions = longPressActions && longPressActions.callbackId; - if (!hasLongPressActions) { - itemList = ['保存相册']; - itemColor = '#000000'; - title = ''; + function share (params, callbackId, method = 'share') { + params = parseParams(params); + if (typeof params === 'string') { + return invoke(callbackId, { + errMsg: method + ':fail:' + params + }) + } + const provider = params.provider; + plus.share.getServices( + services => { + const service = services.find(({ + id + }) => id === provider); + if (!service) { + invoke(callbackId, { + errMsg: method + ':fail:分享服务[' + provider + ']不存在' + }); } else { - itemList = longPressActions.itemList ? longPressActions.itemList : []; - itemColor = longPressActions.itemColor ? longPressActions.itemColor : '#000000'; - title = longPressActions.title ? longPressActions.title : ''; - } - - const options = { - buttons: itemList.map(item => ({ - title: item, - color: itemColor - })), - cancel: '取消' - }; - if (title) { - options.title = title; - } - // if (plus.os.name === 'iOS') { - // options.cancel = '取消' - // } - plus.nativeUI.actionSheet(options, (e) => { - if (e.index > 0) { - if (hasLongPressActions) { - publish(longPressActions.callbackId, { - errMsg: 'showActionSheet:ok', - tapIndex: e.index - 1, - index: res.index - }); - return - } - plus.gallery.save(res.url, function (GallerySaveEvent) { - plus.nativeUI.toast('保存图片到相册成功'); - }); - } else if (hasLongPressActions) { - publish(longPressActions.callbackId, { - errMsg: 'showActionSheet:fail cancel' - }); + if (service.authenticated) { + sendShareMsg(service, params, callbackId); + } else { + service.authorize( + () => sendShareMsg(service, params, callbackId), + err => { + invoke(callbackId, { + errMsg: method + ':fail:' + err.message + }); + } + ); } + } + }, + err => { + invoke(callbackId, { + errMsg: method + ':fail:' + err.message }); } - }); - return { - errMsg: 'previewImage:ok' - } + ); } - let recorder$1; - let recordTimeout$1; - - const publishRecorderStateChange = (state, res = {}) => { - publish('onRecorderStateChange', Object.assign({ - state - }, res)); - }; - - const Recorder = { - start ({ - duration = 60000, - sampleRate, - numberOfChannels, - encodeBitRate, - format = 'mp3', - frameSize, - audioSource = 'auto' - }, callbackId) { - if (recorder$1) { - return publishRecorderStateChange('start') - } - recorder$1 = plus.audio.getRecorder(); - recorder$1.record({ - format, - samplerate: sampleRate, - filename: TEMP_PATH + '/recorder/' - }, res => publishRecorderStateChange('stop', { - tempFilePath: res - }), err => publishRecorderStateChange('error', { - errMsg: err.message - })); - recordTimeout$1 = setTimeout(() => { - Recorder.stop(); - }, duration); - publishRecorderStateChange('start'); - }, - stop () { - if (recorder$1) { - recorder$1.stop(); - recorder$1 = false; - recordTimeout$1 && clearTimeout(recordTimeout$1); - } - }, - pause () { - if (recorder$1) { - publishRecorderStateChange('error', { - errMsg: '暂不支持录音pause操作' - }); - } - }, - resume () { - if (recorder$1) { - publishRecorderStateChange('error', { - errMsg: '暂不支持录音resume操作' - }); + function registerPlus (newPlus) { + // 确保 plus 是 app-service 中的 + if (plus !== newPlus) { + if (process.env.NODE_ENV !== 'production') { + console.log(`[registerPlus][${Date.now()}]`); } + plus = newPlus; } - }; - - function operateRecorder ({ - operationType, - ...args - }, callbackId) { - Recorder[operationType](args); - return { - errMsg: 'operateRecorder:ok' - } - } - - function saveImageToPhotosAlbum ({ - filePath - } = {}, callbackId) { - plus.gallery.save(getRealPath(filePath), e => { - invoke(callbackId, { - errMsg: 'saveImageToPhotosAlbum:ok' - }); - }, e => { - invoke(callbackId, { - errMsg: 'saveImageToPhotosAlbum:fail' - }); - }); - } - - function saveVideoToPhotosAlbum ({ - filePath - } = {}, callbackId) { - plus.gallery.save(getRealPath(filePath), e => { - invoke(callbackId, { - errMsg: 'saveVideoToPhotosAlbum:ok' - }); - }, e => { - invoke(callbackId, { - errMsg: 'saveVideoToPhotosAlbum:fail' - }); - }); } - let downloadTaskId = 0; - const downloadTasks = {}; + let firstBackTime = 0; - const publishStateChange = (res) => { - publish('onDownloadTaskStateChange', res); - }; + function quit () { + if (!firstBackTime) { + firstBackTime = Date.now(); + plus.nativeUI.toast('再按一次退出应用'); + setTimeout(() => { + firstBackTime = null; + }, 2000); + } else if (Date.now() - firstBackTime < 2000) { + plus.runtime.quit(); + } + } - const createDownloadTaskById = function (downloadTaskId, { - url, - header - } = {}) { - const downloader = plus.downloader.createDownload(url, { - time: __uniConfig.networkTimeout.downloadFile ? __uniConfig.networkTimeout.downloadFile / 1000 : 120, - filename: TEMP_PATH + '/download/', - // 需要与其它平台上的表现保持一致,不走重试的逻辑。 - retry: 0, - retryInterval: 0 - }, (download, statusCode) => { - if (statusCode) { - publishStateChange({ - downloadTaskId, - state: 'success', - tempFilePath: download.filename, - statusCode - }); + function backWebview (webview, callback) { + if (!webview.__uniapp_webview) { + return callback() + } + const children = webview.children(); + if (!children || !children.length) { // 有子 webview + return callback() + } + const childWebview = children[0]; + childWebview.canBack(({ + canBack + }) => { + if (canBack) { + childWebview.back(); // webview 返回 } else { - publishStateChange({ - downloadTaskId, - state: 'fail', - statusCode - }); + callback(); } }); - for (const name in header) { - if (header.hasOwnProperty(name)) { - downloader.setRequestHeader(name, header[name]); - } + } + + function back (delta, animationType, animationDuration) { + const pages = getCurrentPages(); + const len = pages.length; + const currentPage = pages[len - 1]; + + if (delta > 1) { + // 中间页隐藏 + pages.slice(len - delta, len - 1).reverse().forEach(deltaPage => { + deltaPage.$getAppWebview().close('none'); + }); } - downloader.addEventListener('statechanged', (download, status) => { - if (download.downloadedSize && download.totalSize) { - publishStateChange({ - downloadTaskId, - state: 'progressUpdate', - progress: parseInt(download.downloadedSize / download.totalSize * 100), - totalBytesWritten: download.downloadedSize, - totalBytesExpectedToWrite: download.totalSize - }); + + backWebview(currentPage, () => { + if (animationType) { + currentPage.$getAppWebview().close(animationType, animationDuration || ANI_DURATION); + } else { + if (currentPage.$page.openType === 'redirect') { // 如果是 redirectTo 跳转的,需要制定 back 动画 + currentPage.$getAppWebview().close(ANI_CLOSE, ANI_DURATION); + } + currentPage.$getAppWebview().close('auto'); } - }); - downloadTasks[downloadTaskId] = downloader; - downloader.start(); - return { - downloadTaskId, - errMsg: 'createDownloadTask:ok' - } - }; - function operateDownloadTask ({ - downloadTaskId, - operationType - } = {}) { - const downloadTask = downloadTasks[downloadTaskId]; - if (downloadTask && operationType === 'abort') { - delete downloadTasks[downloadTaskId]; - downloadTask.abort(); - publishStateChange({ - downloadTaskId, - state: 'fail', - errMsg: 'abort' + pages.slice(len - delta, len).forEach(page => page.$remove()); + + setStatusBarStyle(); + + UniServiceJSBridge.emit('onAppRoute', { + type: 'navigateBack' }); - return { - errMsg: 'operateDownloadTask:ok' - } + }); + } + + function navigateBack$1 ({ + from = 'navigateBack', + delta, + animationType, + animationDuration + }) { + const pages = getCurrentPages(); + + const currentPage = pages[pages.length - 1]; + if ( + currentPage.$vm && + currentPage.$vm.$options.onBackPress && + currentPage.$vm.__call_hook && + currentPage.$vm.__call_hook('onBackPress', { + from + }) + ) { + return } + + uni.hideToast(); // 后退时,关闭 toast,loading + + currentPage.$page.meta.isQuit + ? quit() + : back(delta, animationType, animationDuration); + return { - errMsg: 'operateDownloadTask:fail' + errMsg: 'navigateBack:ok' } - } - - function createDownloadTask (args) { - return createDownloadTaskById(++downloadTaskId, args) } - let requestTaskId = 0; - const requestTasks = {}; - - const publishStateChange$1 = res => { - publish('onRequestTaskStateChange', res); - delete requestTasks[requestTaskId]; - }; - - function createRequestTaskById (requestTaskId, { - url, - data, - header, - method = 'GET', - responseType, - sslVerify = true - } = {}) { - const stream = requireNativePlugin('stream'); - const headers = {}; - - let abortTimeout; - let aborted; - let hasContentType = false; - for (const name in header) { - if (!hasContentType && name.toLowerCase() === 'content-type') { - hasContentType = true; - headers['Content-Type'] = header[name]; - } else { - headers[name] = header[name]; - } - } - - if (!hasContentType && method === 'POST') { - headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'; + function parseTitleNView (routeOptions) { + const windowOptions = routeOptions.window; + const titleNView = windowOptions.titleNView; + if ( // 无头 + titleNView === false || + titleNView === 'false' || + ( + windowOptions.navigationStyle === 'custom' && + !isPlainObject(titleNView) + ) + ) { + return false } - const timeout = __uniConfig.networkTimeout.request; - if (timeout) { - abortTimeout = setTimeout(() => { - aborted = true; - publishStateChange$1({ - requestTaskId, - state: 'fail', - statusCode: 0, - errMsg: 'timeout' - }); - }, timeout); - } - const options = { - method, - url: url.trim(), - // weex 官方文档有误,headers 类型实际 object,用 string 类型会无响应 - headers, - type: responseType === 'arraybuffer' ? 'base64' : 'text', - // weex 官方文档未说明实际支持 timeout,单位:ms - timeout: timeout || 6e5, - // 配置和weex模块内相反 - sslVerify: !sslVerify - }; - if (method !== 'GET') { - options.body = data; - } - try { - stream.fetch(options, ({ - ok, - status, - data, - headers - }) => { - if (aborted) { - return - } - if (abortTimeout) { - clearTimeout(abortTimeout); - } - const statusCode = status; - if (statusCode > 0) { - publishStateChange$1({ - requestTaskId, - state: 'success', - data: ok && responseType === 'arraybuffer' ? base64ToArrayBuffer(data) : data, - statusCode, - header: headers - }); - } else { - publishStateChange$1({ - requestTaskId, - state: 'fail', - statusCode, - errMsg: 'abort' - }); - } - }); - requestTasks[requestTaskId] = { - abort () { - aborted = true; - if (abortTimeout) { - clearTimeout(abortTimeout); - } - publishStateChange$1({ - requestTaskId, - state: 'fail', - statusCode: 0, - errMsg: 'abort' - }); + const titleImage = windowOptions.titleImage || ''; + const transparentTitle = windowOptions.transparentTitle || 'none'; + const titleNViewTypeList = { + 'none': 'default', + 'auto': 'transparent', + 'always': 'float' + }; + + const ret = { + autoBackButton: !routeOptions.meta.isQuit, + titleText: titleImage === '' ? windowOptions.navigationBarTitleText || '' : '', + titleColor: windowOptions.navigationBarTextStyle === 'black' ? '#000000' : '#ffffff', + type: titleNViewTypeList[transparentTitle], + backgroundColor: transparentTitle !== 'always' ? windowOptions.navigationBarBackgroundColor || '#000000' : 'rgba(0,0,0,0)', + tags: titleImage === '' ? [] : [{ + 'tag': 'img', + 'src': titleImage, + 'position': { + 'left': 'auto', + 'top': 'auto', + 'width': 'auto', + 'height': '26px' } - }; - } catch (e) { - return { - requestTaskId, - errMsg: 'createRequestTask:fail' - } - } - return { - requestTaskId, - errMsg: 'createRequestTask:ok' - } + }] + }; + + routeOptions.meta.statusBarStyle = windowOptions.navigationBarTextStyle === 'black' ? 'dark' : 'light'; + + if (isPlainObject(titleNView)) { + return Object.assign(ret, titleNView) + } + + return ret } - function createRequestTask (args) { - return createRequestTaskById(++requestTaskId, args) + function parsePullToRefresh (routeOptions) { + const windowOptions = routeOptions.window; + + if (windowOptions.enablePullDownRefresh) { + const pullToRefreshStyles = Object.create(null); + // 初始化默认值 + if (plus.os.name === 'Android') { + Object.assign(pullToRefreshStyles, { + support: true, + style: 'circle' + }); + } else { + Object.assign(pullToRefreshStyles, { + support: true, + style: 'default', + height: '50px', + range: '200px', + contentdown: { + caption: '' + }, + contentover: { + caption: '' + }, + contentrefresh: { + caption: '' + } + }); + } + + if (windowOptions.backgroundTextStyle) { + pullToRefreshStyles.color = windowOptions.backgroundTextStyle; + pullToRefreshStyles.snowColor = windowOptions.backgroundTextStyle; + } + + Object.assign(pullToRefreshStyles, windowOptions.pullToRefresh || {}); + + return pullToRefreshStyles + } } - function operateRequestTask ({ - requestTaskId, - operationType - } = {}) { - const requestTask = requestTasks[requestTaskId]; - if (requestTask && operationType === 'abort') { - requestTask.abort(); - return { - errMsg: 'operateRequestTask:ok' - } - } - return { - errMsg: 'operateRequestTask:fail' - } + const WEBVIEW_STYLE_BLACKLIST = [ + 'navigationBarBackgroundColor', + 'navigationBarTextStyle', + 'navigationBarTitleText', + 'navigationBarShadow', + 'navigationStyle', + 'disableScroll', + 'backgroundColor', + 'backgroundTextStyle', + 'enablePullDownRefresh', + 'onReachBottomDistance', + 'usingComponents', + // 需要解析的 + 'titleNView', + 'pullToRefresh' + ]; + + function parseWebviewStyle (id, path, routeOptions = {}) { + const webviewStyle = Object.create(null); + + // 合并 + routeOptions.window = Object.assign( + JSON.parse(JSON.stringify(__uniConfig.window || {})), + routeOptions.window || {} + ); + + Object.keys(routeOptions.window).forEach(name => { + if (WEBVIEW_STYLE_BLACKLIST.indexOf(name) === -1) { + webviewStyle[name] = routeOptions.window[name]; + } + }); + + const titleNView = parseTitleNView(routeOptions); + if (titleNView) { + if (id === 1 && __uniConfig.realEntryPagePath === path) { + titleNView.autoBackButton = true; + } + webviewStyle.titleNView = titleNView; + } + + const pullToRefresh = parsePullToRefresh(routeOptions); + if (pullToRefresh) { + if (pullToRefresh.style === 'circle') { + webviewStyle.bounce = 'none'; + } + webviewStyle.pullToRefresh = pullToRefresh; + } + + // 不支持 hide + if (webviewStyle.popGesture === 'hide') { + delete webviewStyle.popGesture; + } + + // TODO 下拉刷新 + + if (path && routeOptions.meta.isNVue) { + webviewStyle.uniNView = { + path, + defaultFontSize: __uniConfig.defaultFontSize, + viewport: __uniConfig.viewport + }; + } + + return webviewStyle } - const socketTasks = {}; + let preloadWebview; - const publishStateChange$2 = (res) => { - publish('onSocketTaskStateChange', res); + let id = 2; + + const WEBVIEW_LISTENERS = { + 'pullToRefresh': 'onPullDownRefresh', + 'titleNViewSearchInputChanged': 'onNavigationBarSearchInputChanged', + 'titleNViewSearchInputConfirmed': 'onNavigationBarSearchInputConfirmed', + 'titleNViewSearchInputClicked': 'onNavigationBarSearchInputClicked' }; - let socket; - function getSocket () { - if (socket) { - return socket + function setPreloadWebview (webview) { + preloadWebview = webview; + } + + function createWebview (path, routeOptions) { + if (routeOptions.meta.isNVue) { + const webviewId = id++; + const webviewStyle = parseWebviewStyle( + webviewId, + path, + routeOptions + ); + if (process.env.NODE_ENV !== 'production') { + console.log(`[uni-app] createWebview`, webviewId, path, webviewStyle); + } + return plus.webview.create('', String(webviewId), webviewStyle, { + nvue: true + }) } - socket = requireNativePlugin('uni-webSocket'); - socket.onopen(function (e) { - publishStateChange$2({ - socketTaskId: e.id, - state: 'open' + if (id === 2) { // 如果首页非 nvue,则直接返回 Launch Webview + return plus.webview.getLaunchWebview() + } + const webview = preloadWebview; + return webview + } + + function initWebview (webview, routeOptions) { + // 首页或非 nvue 页面 + if (webview.id === '1' || !routeOptions.meta.isNVue) { + const webviewStyle = parseWebviewStyle( + parseInt(webview.id), + '', + routeOptions + ); + if (process.env.NODE_ENV !== 'production') { + console.log(`[uni-app] updateWebview`, webviewStyle); + } + + webview.setStyle(webviewStyle); + } + + const { + on, + emit + } = UniServiceJSBridge; + + // TODO subNVues + Object.keys(WEBVIEW_LISTENERS).forEach(name => { + webview.addEventListener(name, (e) => { + emit(WEBVIEW_LISTENERS[name], e, parseInt(webview.id)); }); }); - socket.onmessage(function (e) { - const data = e.data; - publishStateChange$2({ - socketTaskId: e.id, - state: 'message', - data: typeof data === 'object' ? base64ToArrayBuffer(data.base64) : data - }); + + webview.addEventListener('resize', ({ + width, + height + }) => { + const res = { + size: { + windowWidth: Math.ceil(width), + windowHeight: Math.ceil(height) + } + }; + publish('onViewDidResize', res); + emit('onResize', res, parseInt(webview.id)); }); - socket.onerror(function (e) { - publishStateChange$2({ - socketTaskId: e.id, - state: 'error', - errMsg: e.data - }); + + // TODO 应该结束之前未完成的下拉刷新 + on(webview.id + '.startPullDownRefresh', () => { + webview.beginPullToRefresh(); }); - socket.onclose(function (e) { - const socketTaskId = e.id; - delete socketTasks[socketTaskId]; - publishStateChange$2({ - socketTaskId, - state: 'close' - }); + + on(webview.id + '.stopPullDownRefresh', () => { + webview.endPullToRefresh(); }); - return socket + + return webview } - const createSocketTaskById = function (socketTaskId, { - url, - data, - header, - method, - protocols - } = {}) { - const socket = getSocket(); - socket.WebSocket({ - id: socketTaskId, - url, - protocol: Array.isArray(protocols) ? protocols.join(',') : protocols - }); - socketTasks[socketTaskId] = socket; - return { - socketTaskId, - errMsg: 'createSocketTask:ok' + function createPreloadWebview () { + if (!preloadWebview || preloadWebview.__uniapp_route) { // 不存在,或已被使用 + preloadWebview = plus.webview.create(VIEW_WEBVIEW_PATH, String(id++)); } - }; + return preloadWebview + } - function createSocketTask (args) { - return createSocketTaskById(String(Date.now()), args) + const webviewReadyCallbacks = {}; + + function registerWebviewReady (pageId, callback) { + (webviewReadyCallbacks[pageId] || (webviewReadyCallbacks[pageId] = [])).push(callback); } - function operateSocketTask (args) { + function consumeWebviewReady (pageId) { + const callbacks = webviewReadyCallbacks[pageId]; + Array.isArray(callbacks) && callbacks.forEach(callback => callback()); + delete webviewReadyCallbacks[pageId]; + } + + let todoNavigator = false; + + function navigate(path, callback) { + { + if (todoNavigator) { + return console.error(`已存在待跳转页面${todoNavigator.path},请不要连续多次跳转页面`) + } + // 未创建 preloadWebview 或 preloadWebview 已被使用 + const waitPreloadWebview = !preloadWebview || (preloadWebview && preloadWebview.__uniapp_route); + // 已创建未 loaded + const waitPreloadWebviewReady = preloadWebview && !preloadWebview.loaded; + + if (waitPreloadWebview || waitPreloadWebviewReady) { + todoNavigator = { + path: path, + nvue: __uniRoutes.find(route => route.path === path).meta.isNVue, + navigate: callback + }; + if (process.env.NODE_ENV !== 'production') { + console.log(`todoNavigator:${todoNavigator.path} ${waitPreloadWebview ? 'waitForCreate' : 'waitForReady'}`); + } + } else { + callback(); + } + if (waitPreloadWebviewReady) { + registerWebviewReady(preloadWebview.id, todoNavigate); + } + } + } + + function todoNavigate() { + if (!todoNavigator) { + return + } const { - operationType, - code, - reason, - data, - socketTaskId - } = unpack(args); - const socket = socketTasks[socketTaskId]; - if (!socket) { - return { - errMsg: 'operateSocketTask:fail' + navigate + } = todoNavigator; + if (process.env.NODE_ENV !== 'production') { + console.log(`todoNavigate:${todoNavigator.path}`); + } + todoNavigator = false; + return navigate() + } + + function navigateFinish() { + { + // 创建预加载 + const preloadWebview = createPreloadWebview(); + if (!todoNavigator) { + return + } + if (todoNavigator.nvue) { + return todoNavigate() } + preloadWebview.loaded ? + todoNavigator.navigate() : + registerWebviewReady(preloadWebview.id, todoNavigate); } - switch (operationType) { - case 'send': - if (data) { - socket.send({ - id: socketTaskId, - data: typeof data === 'object' ? { - '@type': 'binary', - base64: arrayBufferToBase64(data) - } : data - }); - } - return { - errMsg: 'operateSocketTask:ok' - } - case 'close': - socket.close({ - id: socketTaskId, - code, - reason - }); - delete socketTasks[socketTaskId]; - return { - errMsg: 'operateSocketTask:ok' + } + + function showWebview (webview, animationType, animationDuration, showCallback, delay) { + if (typeof delay === 'undefined') { + delay = webview.nvue ? 0 : 100; + } + + if (typeof animationDuration === 'undefined') { + animationDuration = ANI_DURATION; + } else { + animationDuration = parseInt(animationDuration); + } + + if (process.env.NODE_ENV !== 'production') { + console.log(`[show][${Date.now()}]`, delay); + } + setTimeout(() => { + webview.show( + animationType || ANI_SHOW, + animationDuration || ANI_DURATION, + () => { + if (process.env.NODE_ENV !== 'production') { + console.log(`[show.callback][${Date.now()}]`); + } + showCallback && showCallback(); + navigateFinish(); } + ); + }, delay); + } + + const PAGE_CREATE = 2; + const MOUNTED_DATA = 4; + const UPDATED_DATA = 6; + const PAGE_CREATED = 10; + + const WEBVIEW_READY = 'webviewReady'; + const WEBVIEW_UI_EVENT = 'webviewUIEvent'; + + const pageFactory = Object.create(null); + + function definePage (name, createPageVueComponent) { + pageFactory[name] = createPageVueComponent; + } + + const getPageVueComponent = cached(function (pagePath) { + return pageFactory[pagePath]() + }); + + function createPage (pagePath, pageId) { + if (!pageFactory[pagePath]) { + console.error(`${pagePath} not found`); } - return { - errMsg: 'operateSocketTask:fail' + let startTime = Date.now(); + const pageVm = new (getPageVueComponent(pagePath))({ + mpType: 'page', + pageId, + pagePath + }); + if (process.env.NODE_ENV !== 'production') { + console.log(`new ${pagePath}`, Date.now() - startTime); } + return pageVm } - let uploadTaskId = 0; - const uploadTasks = {}; + const pages = []; - const publishStateChange$3 = (res) => { - publish('onUploadTaskStateChange', res); - }; + function getCurrentPages$1 (returnAll) { + return returnAll ? pages.slice(0) : pages.filter(page => { + return !page.$page.meta.isTabBar || page.$page.meta.visible + }) + } - const createUploadTaskById = function (uploadTaskId, { - url, - filePath, - name, - files, - header, - formData - } = {}) { - const uploader = plus.uploader.createUpload(url, { - timeout: __uniConfig.networkTimeout.uploadFile ? __uniConfig.networkTimeout.uploadFile / 1000 : 120, - // 需要与其它平台上的表现保持一致,不走重试的逻辑。 - retry: 0, - retryInterval: 0 - }, (upload, statusCode) => { - if (statusCode) { - publishStateChange$3({ - uploadTaskId, - state: 'success', - data: upload.responseText, - statusCode - }); - } else { - publishStateChange$3({ - uploadTaskId, - state: 'fail', - data: '', - statusCode - }); - } - delete uploadTasks[uploadTaskId]; - }); + /** + * 首页需要主动registerPage,二级页面路由跳转时registerPage + */ + function registerPage ({ + path, + query, + openType, + webview + }) { + const routeOptions = JSON.parse(JSON.stringify(__uniRoutes.find(route => route.path === path))); - for (const name in header) { - if (header.hasOwnProperty(name)) { - uploader.setRequestHeader(name, header[name]); - } - } - for (const name in formData) { - if (formData.hasOwnProperty(name)) { - uploader.addData(name, formData[name]); - } + if (openType === 'reLaunch' || pages.length === 0) { + // pages.length===0 表示首页触发 redirectTo + routeOptions.meta.isQuit = true; + } else if (!routeOptions.meta.isTabBar) { + routeOptions.meta.isQuit = false; } - if (files && files.length) { - files.forEach(file => { - uploader.addFile(getRealPath(file.uri), { - key: file.name || 'file' - }); - }); + + if (!webview) { + webview = createWebview(path, routeOptions); } else { - uploader.addFile(getRealPath(filePath), { - key: name - }); + webview = plus.webview.getWebviewById(webview.id); } - uploader.addEventListener('statechanged', (upload, status) => { - if (upload.uploadedSize && upload.totalSize) { - publishStateChange$3({ - uploadTaskId, - state: 'progressUpdate', - progress: parseInt(upload.uploadedSize / upload.totalSize * 100), - totalBytesSent: upload.uploadedSize, - totalBytesExpectedToSend: upload.totalSize - }); - } - }); - uploadTasks[uploadTaskId] = uploader; - uploader.start(); - return { - uploadTaskId, - errMsg: 'createUploadTask:ok' + + if (routeOptions.meta.isTabBar) { + routeOptions.meta.visible = true; } - }; - function operateUploadTask ({ - uploadTaskId, - operationType - } = {}) { - const uploadTask = uploadTasks[uploadTaskId]; - if (uploadTask && operationType === 'abort') { - delete uploadTasks[uploadTaskId]; - uploadTask.abort(); - publishStateChange$3({ - uploadTaskId, - state: 'fail', - errMsg: 'abort' - }); - return { - errMsg: 'operateUploadTask:ok' + if (routeOptions.meta.isTabBar && webview.id !== '1') { + tabBar$1.append(webview); + } + + if (process.env.NODE_ENV !== 'production') { + console.log(`[uni-app] registerPage`, path, webview.id); + } + + initWebview(webview, routeOptions); + + const route = path.slice(1); + + webview.__uniapp_route = route; + + const pageInstance = { + route, + options: Object.assign({}, query || {}), + $getAppWebview () { + return webview + }, + $page: { + id: parseInt(webview.id), + meta: routeOptions.meta, + path, + route, + openType + }, + $remove () { + const index = pages.findIndex(page => page === this); + if (index !== -1) { + pages.splice(index, 1); + if (process.env.NODE_ENV !== 'production') { + console.log(`[uni-app] removePage`, path, webview.id); + } + } } + }; + + pages.push(pageInstance); + + // 首页是 nvue 时,在 registerPage 时,执行路由堆栈 + if (webview.id === '1' && routeOptions.meta.isNVue) { + webview.nvue = true; + __uniConfig.onReady(function () { + navigateFinish(); + }); } - return { - errMsg: 'operateUploadTask:fail' + + { + if (!webview.nvue) { + const pageId = webview.id; + const pagePath = path.slice(1); + + // 通知页面已开始创建 + UniServiceJSBridge.publishHandler('vdSync', { + data: [ + [PAGE_CREATE, [pageId, pagePath]] + ], + options: { + timestamp: Date.now() + } + }, [pageId]); + + pageInstance.$vm = createPage(pagePath, pageId); + pageInstance.$vm.$scope = pageInstance; + pageInstance.$vm.$mount(); + } } - } - function createUploadTask (args) { - return createUploadTaskById(++uploadTaskId, args) + return webview } - const providers = { - oauth (callback) { - plus.oauth.getServices(services => { - const provider = []; - services.forEach(({ - id - }) => { - provider.push(id); - }); - callback(null, provider); - }, err => { - callback(err); - }); - }, - share (callback) { - plus.share.getServices(services => { - const provider = []; - services.forEach(({ - id - }) => { - provider.push(id); - }); - callback(null, provider); - }, err => { - callback(err); - }); - }, - payment (callback) { - plus.payment.getChannels(services => { - const provider = []; - services.forEach(({ - id - }) => { - provider.push(id); + function _navigateTo ({ + path, + query, + animationType, + animationDuration + }, callbackId) { + UniServiceJSBridge.emit('onAppRoute', { + type: 'navigateTo', + path + }); + + showWebview( + registerPage({ + path, + query, + openType: 'navigate' + }), + animationType, + animationDuration, + () => { + invoke(callbackId, { + errMsg: 'navigateTo:ok' }); - callback(null, provider); - }, err => { - callback(err); - }); - }, - push (callback) { - if (typeof weex !== 'undefined' || typeof plus !== 'undefined') { - callback(null, [plus.push.getClientInfo().id]); - } else { - callback(null, []); } - } - }; + ); + setStatusBarStyle(); + } - function getProvider$1 ({ - service - }, callbackId) { - if (providers[service]) { - providers[service]((err, provider) => { - if (err) { - invoke(callbackId, { - errMsg: 'getProvider:fail:' + err.message - }); - } else { - invoke(callbackId, { - errMsg: 'getProvider:ok', - service, - provider - }); - } - }); - } else { - invoke(callbackId, { - errMsg: 'getProvider:fail:服务[' + service + ']不支持' + function navigateTo$1 ({ + url, + animationType, + animationDuration + }) { + const urls = url.split('?'); + const path = urls[0]; + const query = parseQuery(urls[1] || ''); + navigate(path, function () { + _navigateTo({ + path, + query, + animationType, + animationDuration }); - } + }); } - const loginServices = {}; + function _reLaunch ({ + path, + query + }, callbackId) { + const pages = getCurrentPages(true).slice(0); - const loginByService = (provider, callbackId) => { - function login () { - loginServices[provider].login(res => { - const authResult = res.target.authResult; - invoke(callbackId, { - code: authResult.code, - authResult: authResult, - errMsg: 'login:ok' - }); - }, err => { - invoke(callbackId, { - code: err.code, - errMsg: 'login:fail:' + err.message - }); - }); + const routeOptions = __uniRoutes.find(route => route.path === path); + + if (routeOptions.meta.isTabBar) { + tabBar$1.switchTab(path); } - // 先注销再登录 - loginServices[provider].logout(login, login); - }; - /** - * 微信登录 - */ - function login (params, callbackId) { - const provider = params.provider || 'weixin'; - if (loginServices[provider]) { - loginByService(provider, callbackId); - } else { - plus.oauth.getServices(services => { - loginServices[provider] = services.find(({ - id - }) => id === provider); - if (!loginServices[provider]) { - invoke(callbackId, { - code: '', - errMsg: 'login:fail:登录服务[' + provider + ']不存在' - }); - } else { - loginByService(provider, callbackId); - } - }, err => { + + showWebview( + registerPage({ + path, + query, + openType: 'reLaunch' + }), + 'none', + 0, + () => { invoke(callbackId, { - code: err.code, - errMsg: 'login:fail:' + err.message + errMsg: 'reLaunch:ok' }); - }); - } - } + } + ); - function getUserInfo (params, callbackId) { - const provider = params.provider || 'weixin'; - const loginService = loginServices[provider]; - if (!loginService || !loginService.authResult) { - return invoke(callbackId, { - errMsg: 'operateWXData:fail:请先调用 uni.login' - }) - } - loginService.getUserInfo(res => { - let userInfo; - if (provider === 'weixin') { - const wechatUserInfo = loginService.userInfo; - userInfo = { - openId: wechatUserInfo.openid, - nickName: wechatUserInfo.nickname, - gender: wechatUserInfo.sex, - city: wechatUserInfo.city, - province: wechatUserInfo.province, - country: wechatUserInfo.country, - avatarUrl: wechatUserInfo.headimgurl, - unionId: wechatUserInfo.unionid - }; - } else { - loginService.userInfo.openId = loginService.userInfo.openId || loginService.userInfo.openid || - loginService.authResult.openid; - loginService.userInfo.nickName = loginService.userInfo.nickName || loginService.userInfo.nickname; - loginService.userInfo.avatarUrl = loginService.userInfo.avatarUrl || loginService.userInfo.avatarUrl || - loginService.userInfo.headimgurl; - userInfo = loginService.userInfo; - } - const result = { - errMsg: 'operateWXData:ok' - }; - if (params.data && params.data.api_name === 'webapi_getuserinfo') { - result.data = { - data: JSON.stringify(userInfo), - rawData: '', - signature: '', - encryptedData: '', - iv: '' - }; - } else { - result.userInfo = userInfo; - } - invoke(callbackId, result); - }, err => { - invoke(callbackId, { - errMsg: 'operateWXData:fail:' + err.message - }); + pages.forEach(page => { + page.$remove(); + page.$getAppWebview().close('none'); }); + + setStatusBarStyle(); } - /** - * 获取用户信息 - */ - function operateWXData (params, callbackId) { - switch (params.data.api_name) { - case 'webapi_getuserinfo': - getUserInfo(params, callbackId); - break - default: - return { - errMsg: 'operateWXData:fail' - } - } + function reLaunch$1 ({ + url + }, callbackId) { + const urls = url.split('?'); + const path = urls[0]; + const query = parseQuery(urls[1] || ''); + navigate(path, function () { + _reLaunch({ + path, + query + }, callbackId); + }); } - function requestPayment (params, callbackId) { - const provider = params.provider; - plus.payment.getChannels(services => { - const service = services.find(({ - id - }) => id === provider); - if (!service) { + function _redirectTo ({ + path, + query + }, callbackId) { + const pages = getCurrentPages(); + const lastPage = pages[pages.length - 1]; + + lastPage && lastPage.$remove(); + + showWebview( + registerPage({ + path, + query, + openType: 'redirect' + }), + 'none', + 0, + () => { + lastPage && lastPage.$getAppWebview().close('none'); invoke(callbackId, { - errMsg: 'requestPayment:fail:支付服务[' + provider + ']不存在' + errMsg: 'redirectTo:ok' + }); + } + ); + + setStatusBarStyle(); + } + function redirectTo$1 ({ + url + }, callbackId) { + const urls = url.split('?'); + const path = urls[0]; + const query = parseQuery(urls[1] || ''); + navigate(path, function () { + _redirectTo({ + path, + query + }, callbackId); + }); + } + + function _switchTab ({ + path, + from + }, callbackId) { + tabBar$1.switchTab(path.slice(1)); + + const pages = getCurrentPages(); + const len = pages.length; + + if (len >= 1) { // 前一个页面是非 tabBar 页面 + const currentPage = pages[len - 1]; + if (!currentPage.$page.meta.isTabBar) { + pages.reverse().forEach(page => { + if (!page.$page.meta.isTabBar && page !== currentPage) { + page.$remove(); + page.$getAppWebview().close('none'); + } }); + currentPage.$remove(); + // 延迟执行避免iOS应用退出 + setTimeout(() => { + if (currentPage.$page.openType === 'redirect') { + currentPage.$getAppWebview().close(ANI_CLOSE, ANI_DURATION); + } else { + currentPage.$getAppWebview().close('auto'); + } + }, 100); + } else { + // 前一个 tabBar 触发 onHide + currentPage.$vm.__call_hook('onHide'); + } + } + + let tabBarPage; + // 查找当前 tabBarPage,且设置 visible + getCurrentPages(true).forEach(page => { + if (('/' + page.route) === path) { + page.$page.meta.visible = true; + tabBarPage = page; } else { - plus.payment.request(service, params.orderInfo, res => { - invoke(callbackId, { - errMsg: 'requestPayment:ok' - }); - }, err => { - invoke(callbackId, { - errMsg: 'requestPayment:fail:' + err.message - }); - }); + if (page.$page.meta.isTabBar) { + page.$page.meta.visible = false; + } } - }, err => { - invoke(callbackId, { - errMsg: 'requestPayment:fail:' + err.message + }); + + if (tabBarPage) { + tabBarPage.$vm.__call_hook('onShow'); + tabBarPage.$getAppWebview().show('none'); + } else { + return showWebview(registerPage({ + path, + query: {}, + openType: 'switchTab' + }), 'none', 0, () => { + invoke(callbackId, { + errMsg: 'switchTab:ok' + }); + }, 70) + } + + setStatusBarStyle(); + return { + errMsg: 'switchTab:ok' + } + } + + function switchTab$1 ({ + url, + from + }) { + const path = url.split('?')[0]; + navigate(path, function () { + _switchTab({ + path, + from }); }); } - let onPushing; - - let isListening = false; - - let unsubscribe = false; + function showKeyboard () { + plus.key.showSoftKeybord(); + return { + errMsg: 'showKeyboard:ok' + } + } - function subscribePush (params, callbackId) { - const clientInfo = plus.push.getClientInfo(); - if (clientInfo) { - if (!isListening) { - isListening = true; - plus.push.addEventListener('receive', msg => { - if (onPushing && !unsubscribe) { - publish('onPushMessage', { - messageId: msg.__UUID__, - data: msg.payload, - errMsg: 'onPush:ok' - }); + function hideKeyboard () { + plus.key.hideSoftKeybord(); + return { + errMsg: 'hideKeyboard:ok' + } + } + + function setNavigationBarTitle$1 ({ + title = '' + } = {}) { + const webview = getLastWebview(); + if (webview) { + const style = webview.getStyle(); + if (style && style.titleNView) { + webview.setStyle({ + titleNView: { + titleText: title } }); } - unsubscribe = false; - clientInfo.errMsg = 'subscribePush:ok'; - return clientInfo - } else { return { - errMsg: 'subscribePush:fail:请确保当前运行环境已包含 push 模块' + errMsg: 'setNavigationBarTitle:ok' } } + return { + errMsg: 'setNavigationBarTitle:fail' + } } - function unsubscribePush (params) { - unsubscribe = true; + function showNavigationBarLoading () { + plus.nativeUI.showWaiting('', { + modal: false + }); return { - errMsg: 'unsubscribePush:ok' + errMsg: 'showNavigationBarLoading:ok' } } - function onPush () { - if (!isListening) { - return { - errMsg: 'onPush:fail:请先调用 uni.subscribePush' - } - } - if (plus.push.getClientInfo()) { - onPushing = true; - return { - errMsg: 'onPush:ok' - } - } + function hideNavigationBarLoading () { + plus.nativeUI.closeWaiting(); return { - errMsg: 'onPush:fail:请确保当前运行环境已包含 push 模块' + errMsg: 'hideNavigationBarLoading:ok' } } - function offPush (params) { - onPushing = false; + function setNavigationBarColor$1 ({ + frontColor, + backgroundColor + } = {}) { + const webview = getLastWebview(); + if (webview) { + const styles = {}; + if (frontColor) { + styles.titleColor = frontColor; + } + if (backgroundColor) { + styles.backgroundColor = backgroundColor; + } + plus.navigator.setStatusBarStyle(frontColor === '#000000' ? 'dark' : 'light'); + const style = webview.getStyle(); + if (style && style.titleNView) { + webview.setStyle({ + titleNView: styles + }); + } + return { + errMsg: 'setNavigationBarColor:ok' + } + } return { - errMsg: 'offPush:ok' + errMsg: 'setNavigationBarColor:fail' } } - function requireNativePlugin$1 (name) { - return weex.requireModule(name) - } - - // 0:图文,1:纯文字,2:纯图片,3:音乐,4:视频,5:小程序 - const TYPES = { - '0': { - name: 'web', - title: '图文' - }, - '1': { - name: 'text', - title: '纯文字' - }, - '2': { - name: 'image', - title: '纯图片' - }, - '3': { - name: 'music', - title: '音乐' - }, - '4': { - name: 'video', - title: '视频' - }, - '5': { - name: 'miniProgram', - title: '小程序' - } - }; + let waiting; + let waitingTimeout; + let toast = false; + let toastTimeout; - const parseParams = (args, callbackId, method) => { - args.type = args.type || 0; + function showLoading$1 (args) { + return callApiSync(showToast$1, args, 'showToast', 'showLoading') + } - let { - provider, - type, - title, - summary: content, - href, - imageUrl, - mediaUrl: media, - scene, - miniProgram - } = args; + function hideLoading () { + return callApiSync(hideToast, Object.create(null), 'hideToast', 'hideLoading') + } - if (typeof imageUrl === 'string' && imageUrl) { - imageUrl = getRealPath(imageUrl); + function showToast$1 ({ + title = '', + icon = 'success', + image = '', + duration = 1500, + mask = false, + position = '' + } = {}) { + if (position) { + if (toast) { + toastTimeout && clearTimeout(toastTimeout); + plus.nativeUI.closeToast(); + } + if (waiting) { + waitingTimeout && clearTimeout(waitingTimeout); + waiting.close(); + } + if (~['top', 'center', 'bottom'].indexOf(position)) { + let richText = `${title}`; + plus.nativeUI.toast(richText, { + verticalAlign: position, + type: 'richtext' + }); + toast = true; + toastTimeout = setTimeout(() => { + hideToast(); + }, 2000); + return { + errMsg: 'showToast:ok' + } + } + console.warn('uni.showToast 传入的 "position" 值 "' + position + '" 无效'); } - const shareType = TYPES[type + '']; - if (shareType) { - let sendMsg = { - provider, - type: shareType.name, - title, - content, - href, - pictures: [imageUrl], - thumbs: [imageUrl], - media, - miniProgram, - extra: { - scene + if (duration) { + if (waiting) { + waitingTimeout && clearTimeout(waitingTimeout); + waiting.close(); + } + if (toast) { + toastTimeout && clearTimeout(toastTimeout); + plus.nativeUI.closeToast(); + } + if (icon && !~['success', 'loading', 'none'].indexOf(icon)) { + icon = 'success'; + } + const waitingOptions = { + modal: mask, + back: 'transmit', + padding: '10px', + size: '16px' // 固定字体大小 + }; + if (!image && (!icon || icon === 'none')) { // 无图 + // waitingOptions.width = '120px' + // waitingOptions.height = '40px' + waitingOptions.loading = { + display: 'none' + }; + } else { // 有图 + waitingOptions.width = '140px'; + waitingOptions.height = '112px'; + } + if (image) { + waitingOptions.loading = { + display: 'block', + height: '55px', + icon: image, + interval: duration + }; + } else { + if (icon === 'success') { + waitingOptions.loading = { + display: 'block', + height: '55px', + icon: '__uniappsuccess.png', + interval: duration + + }; } - }; - if (provider === 'weixin' && (type === 1 || type === 2)) { - delete sendMsg.thumbs; } - return sendMsg + + waiting = plus.nativeUI.showWaiting(title, waitingOptions); + waitingTimeout = setTimeout(() => { + hideToast(); + }, duration); } - return '分享参数 type 不正确' - }; + return { + errMsg: 'showToast:ok' + } + } - const sendShareMsg = function (service, params, callbackId, method = 'share') { - service.send( - params, - () => { + function hideToast () { + if (toast) { + toastTimeout && clearTimeout(toastTimeout); + plus.nativeUI.closeToast(); + toast = false; + } + if (waiting) { + waitingTimeout && clearTimeout(waitingTimeout); + waiting.close(); + waiting = null; + waitingTimeout = null; + } + return { + errMsg: 'hideToast:ok' + } + } + function showModal$1 ({ + title = '', + content = '', + showCancel = true, + cancelText = '取消', + cancelColor = '#000000', + confirmText = '确定', + confirmColor = '#3CC51F' + } = {}, callbackId) { + plus.nativeUI.confirm(content, (e) => { + if (showCancel) { invoke(callbackId, { - errMsg: method + ':ok' + errMsg: 'showModal:ok', + confirm: e.index === 1, + cancel: e.index === 0 || e.index === -1 }); - }, - err => { + } else { invoke(callbackId, { - errMsg: method + ':fail:' + err.message + errMsg: 'showModal:ok', + confirm: e.index === 0, + cancel: false }); } - ); - }; - - function shareAppMessageDirectly ({ - title, - path, - imageUrl, - useDefaultSnapshot + }, title, showCancel ? [cancelText, confirmText] : [confirmText]); + } + function showActionSheet$1 ({ + itemList = [], + itemColor = '#000000', + title = '' }, callbackId) { - title = title || __uniConfig.appname; - const goShare = () => { - share({ - provider: 'weixin', - type: 0, - title, - imageUrl, - href: path, - scene: 'WXSceneSession' - }, - callbackId, - 'shareAppMessageDirectly' - ); + const options = { + buttons: itemList.map(item => ({ + title: item + })) }; - if (useDefaultSnapshot) { - const pages = getCurrentPages(); - const webview = plus.webview.getWebviewById(pages[pages.length - 1].__wxWebviewId__ + ''); - if (webview) { - const bitmap = new plus.nativeObj.Bitmap(); - webview.draw( - bitmap, - () => { - const fileName = TEMP_PATH + '/share/snapshot.jpg'; - bitmap.save( - fileName, { - overwrite: true, - format: 'jpg' - }, - () => { - imageUrl = fileName; - goShare(); - }, - err => { - invoke(callbackId, { - errMsg: 'shareAppMessageDirectly:fail:' + err.message - }); - } - ); - }, - err => { - invoke(callbackId, { - errMsg: 'shareAppMessageDirectly:fail:' + err.message - }); - } - ); - } else { - goShare(); - } - } else { - goShare(); + if (title) { + options.title = title; } - } - function share (params, callbackId, method = 'share') { - params = parseParams(params); - if (typeof params === 'string') { - return invoke(callbackId, { - errMsg: method + ':fail:' + params - }) + if (plus.os.name === 'iOS') { + options.cancel = '取消'; } - const provider = params.provider; - plus.share.getServices( - services => { - const service = services.find(({ - id - }) => id === provider); - if (!service) { - invoke(callbackId, { - errMsg: method + ':fail:分享服务[' + provider + ']不存在' - }); - } else { - if (service.authenticated) { - sendShareMsg(service, params, callbackId); - } else { - service.authorize( - () => sendShareMsg(service, params, callbackId), - err => { - invoke(callbackId, { - errMsg: method + ':fail:' + err.message - }); - } - ); - } - } - }, - err => { + + plus.nativeUI.actionSheet(options, (e) => { + if (e.index > 0) { invoke(callbackId, { - errMsg: method + ':fail:' + err.message + errMsg: 'showActionSheet:ok', + tapIndex: e.index - 1 + }); + } else { + invoke(callbackId, { + errMsg: 'showActionSheet:fail cancel' }); } - ); + }); } - const ANI_DURATION$1 = 300; - const ANI_SHOW$1 = 'pop-in'; - const ANI_CLOSE = 'pop-out'; + let webview; - function showWebview (webview, animationType, animationDuration, showCallback, delay = 50) { - animationDuration = typeof animationDuration === 'undefined' ? ANI_DURATION$1 : parseInt(animationDuration); - setTimeout(() => { - webview.show( - animationType || ANI_SHOW$1, - animationDuration || ANI_DURATION$1, - () => { - showCallback && showCallback(); - navigateStack(webview); - } - ); - }, delay); + function setPullDownRefreshPageId (pullDownRefreshWebview) { + if (typeof pullDownRefreshWebview === 'number') { + webview = plus.webview.getWebviewById(String(pullDownRefreshWebview)); + } else { + webview = pullDownRefreshWebview; + } + } + + function startPullDownRefresh () { + if (webview) { + webview.endPullToRefresh(); + } + webview = getLastWebview(); + if (webview) { + webview.beginPullToRefresh(); + return { + errMsg: 'startPullDownRefresh:ok' + } + } + return { + errMsg: 'startPullDownRefresh:fail' + } + } + + function stopPullDownRefresh () { + if (!webview) { + webview = getLastWebview(); + } + if (webview) { + webview.endPullToRefresh(); + webview = null; + return { + errMsg: 'stopPullDownRefresh:ok' + } + } + return { + errMsg: 'stopPullDownRefresh:fail' + } } - let firstBackTime = 0; - - function quit () { - if (!firstBackTime) { - firstBackTime = Date.now(); - plus.nativeUI.toast('再按一次退出应用'); - setTimeout(() => { - firstBackTime = null; - }, 2000); - } else if (Date.now() - firstBackTime < 2000) { - plus.runtime.quit(); + function setTabBarBadge$2 ({ + index, + text, + type = 'text' + }) { + tabBar$1.setTabBarBadge(type, index, text); + return { + errMsg: 'setTabBarBadge:ok' } } - function backWebview (webview, callback) { - if (!webview.__uniapp_webview) { - return callback() + function setTabBarItem$2 ({ + index, + text, + iconPath, + selectedIconPath + }) { + if (!isTabBarPage()) { + return { + errMsg: 'setTabBarItem:fail not TabBar page' + } } - const children = webview.children(); - if (!children || !children.length) { // 有子 webview - return callback() + tabBar$1.setTabBarItem(index, text, iconPath, selectedIconPath); + return { + errMsg: 'setTabBarItem:ok' } - const childWebview = children[0]; - childWebview.canBack(({ - canBack - }) => { - if (canBack) { - childWebview.back(); // webview 返回 - } else { - callback(); - } - }); } - function back (delta, animationType, animationDuration) { - const pages = getCurrentPages(); - const len = pages.length; - const currentPage = pages[len - 1]; - - if (delta > 1) { - // 中间页隐藏 - pages.slice(len - delta, len - 1).reverse().forEach(deltaPage => { - deltaPage.$getAppWebview().close('none'); - }); - } - - backWebview(currentPage, () => { - if (animationType) { - currentPage.$getAppWebview().close(animationType, animationDuration || ANI_DURATION$1); - } else { - if (currentPage.$page.openType === 'redirect') { // 如果是 redirectTo 跳转的,需要制定 back 动画 - currentPage.$getAppWebview().close(ANI_CLOSE, ANI_DURATION$1); - } - currentPage.$getAppWebview().close('auto'); + function setTabBarStyle$2 ({ + color, + selectedColor, + backgroundColor, + borderStyle + }) { + if (!isTabBarPage()) { + return { + errMsg: 'setTabBarStyle:fail not TabBar page' } - - pages.slice(len - delta, len).forEach(page => page.$remove()); - - setStatusBarStyle(); - - UniServiceJSBridge.emit('onAppRoute', { - type: 'navigateBack' - }); + } + tabBar$1.setTabBarStyle({ + color, + selectedColor, + backgroundColor, + borderStyle: borderStyle === 'white' ? '#ffffff' : '#c6c6c6' }); + return { + errMsg: 'setTabBarStyle:ok' + } } - function navigateBack$1 ({ - from = 'navigateBack', - delta, - animationType, - animationDuration + function hideTabBar$2 ({ + animation }) { - const pages = getCurrentPages(); - - const currentPage = pages[pages.length - 1]; - if ( - currentPage.$vm && - currentPage.$vm.$options.onBackPress && - currentPage.$vm.__call_hook && - currentPage.$vm.__call_hook('onBackPress', { - from - }) - ) { - return + if (!isTabBarPage()) { + return { + errMsg: 'hideTabBar:fail not TabBar page' + } } + tabBar$1.hideTabBar(animation); + return { + errMsg: 'hideTabBar:ok' + } + } - uni.hideToast(); // 后退时,关闭 toast,loading - - currentPage.$page.meta.isQuit - ? quit() - : back(delta, animationType, animationDuration); - + function showTabBar$2 ({ + animation + }) { + if (!isTabBarPage()) { + return { + errMsg: 'showTabBar:fail not TabBar page' + } + } + tabBar$1.showTabBar(animation); return { - errMsg: 'navigateBack:ok' + errMsg: 'showTabBar:ok' } } - function _navigateTo ({ - path, - query, - animationType, - animationDuration - }, callbackId) { - UniServiceJSBridge.emit('onAppRoute', { - type: 'navigateTo', - path - }); + + + var api = /*#__PURE__*/Object.freeze({ + startPullDownRefresh: startPullDownRefresh, + stopPullDownRefresh: stopPullDownRefresh, + previewImage: previewImage$1, + createAudioInstance: createAudioInstance, + destroyAudioInstance: destroyAudioInstance, + setAudioState: setAudioState, + getAudioState: getAudioState, + operateAudio: operateAudio, + enableAccelerometer: enableAccelerometer, + addPhoneContact: addPhoneContact, + openBluetoothAdapter: openBluetoothAdapter, + closeBluetoothAdapter: closeBluetoothAdapter, + getBluetoothAdapterState: getBluetoothAdapterState, + startBluetoothDevicesDiscovery: startBluetoothDevicesDiscovery, + stopBluetoothDevicesDiscovery: stopBluetoothDevicesDiscovery, + getBluetoothDevices: getBluetoothDevices, + getConnectedBluetoothDevices: getConnectedBluetoothDevices, + createBLEConnection: createBLEConnection, + closeBLEConnection: closeBLEConnection, + getBLEDeviceServices: getBLEDeviceServices, + getBLEDeviceCharacteristics: getBLEDeviceCharacteristics, + notifyBLECharacteristicValueChange: notifyBLECharacteristicValueChange, + notifyBLECharacteristicValueChanged: notifyBLECharacteristicValueChanged, + readBLECharacteristicValue: readBLECharacteristicValue, + writeBLECharacteristicValue: writeBLECharacteristicValue, + getScreenBrightness: getScreenBrightness, + setScreenBrightness: setScreenBrightness, + setKeepScreenOn: setKeepScreenOn, + getClipboardData: getClipboardData, + setClipboardData: setClipboardData, + enableCompass: enableCompass, + getNetworkType: getNetworkType, + onBeaconUpdate: onBeaconUpdate, + onBeaconServiceChange: onBeaconServiceChange, + getBeacons: getBeacons, + startBeaconDiscovery: startBeaconDiscovery, + stopBeaconDiscovery: stopBeaconDiscovery, + makePhoneCall: makePhoneCall$1, + SCAN_ID: SCAN_ID, + SCAN_PATH: SCAN_PATH, + scanCode: scanCode, + getSystemInfoSync: getSystemInfoSync, + getSystemInfo: getSystemInfo, + vibrateLong: vibrateLong, + vibrateShort: vibrateShort, + saveFile: saveFile, + getSavedFileList: getSavedFileList, + getFileInfo: getFileInfo, + getSavedFileInfo: getSavedFileInfo, + removeSavedFile: removeSavedFile, + openDocument: openDocument$1, + chooseLocation: chooseLocation$1, + getLocation: getLocation$1, + openLocation: openLocation$1, + startRecord: startRecord, + stopRecord: stopRecord, + playVoice: playVoice, + pauseVoice: pauseVoice, + stopVoice: stopVoice, + chooseImage: chooseImage$1, + chooseVideo: chooseVideo$1, + compressImage: compressImage, + getImageInfo: getImageInfo$1, + getMusicPlayerState: getMusicPlayerState, + operateMusicPlayer: operateMusicPlayer, + setBackgroundAudioState: setBackgroundAudioState, + operateBackgroundAudio: operateBackgroundAudio, + getBackgroundAudioState: getBackgroundAudioState, + operateRecorder: operateRecorder, + saveImageToPhotosAlbum: saveImageToPhotosAlbum, + saveVideoToPhotosAlbum: saveVideoToPhotosAlbum, + operateDownloadTask: operateDownloadTask, + createDownloadTask: createDownloadTask, + createRequestTaskById: createRequestTaskById, + createRequestTask: createRequestTask, + operateRequestTask: operateRequestTask, + createSocketTask: createSocketTask, + operateSocketTask: operateSocketTask, + operateUploadTask: operateUploadTask, + createUploadTask: createUploadTask, + getProvider: getProvider$1, + login: login, + getUserInfo: getUserInfo, + operateWXData: operateWXData, + requestPayment: requestPayment, + subscribePush: subscribePush, + unsubscribePush: unsubscribePush, + onPush: onPush, + offPush: offPush, + requireNativePlugin: requireNativePlugin$1, + shareAppMessageDirectly: shareAppMessageDirectly, + share: share, + registerPlus: registerPlus, + navigateBack: navigateBack$1, + navigateTo: navigateTo$1, + reLaunch: reLaunch$1, + redirectTo: redirectTo$1, + switchTab: switchTab$1, + showKeyboard: showKeyboard, + hideKeyboard: hideKeyboard, + setNavigationBarTitle: setNavigationBarTitle$1, + showNavigationBarLoading: showNavigationBarLoading, + hideNavigationBarLoading: hideNavigationBarLoading, + setNavigationBarColor: setNavigationBarColor$1, + showLoading: showLoading$1, + hideLoading: hideLoading, + showToast: showToast$1, + hideToast: hideToast, + showModal: showModal$1, + showActionSheet: showActionSheet$1, + setTabBarBadge: setTabBarBadge$2, + setTabBarItem: setTabBarItem$2, + setTabBarStyle: setTabBarStyle$2, + hideTabBar: hideTabBar$2, + showTabBar: showTabBar$2 + }); + + const Emitter = new Vue(); - showWebview( - registerPage({ - path, - query, - openType: 'navigate' - }), - animationType, - animationDuration, - () => { - invoke(callbackId, { - errMsg: 'navigateTo:ok' - }); - } - ); - setStatusBarStyle(); + function apply (ctx, method, args) { + return ctx[method].apply(ctx, args) } - function navigateTo$1 ({ - url, - animationType, - animationDuration - }) { - const urls = url.split('?'); - const path = urls[0]; - const query = parseQuery(urls[1] || ''); - navigate(path, function () { - _navigateTo({ - path, - query, - animationType, - animationDuration - }); - }); - } - - function reLaunch$1 ({ - url - }, callbackId) { - const urls = url.split('?'); - const path = urls[0]; - - const query = parseQuery(urls[1] || ''); - - const pages = getCurrentPages(true).slice(0); - - const routeOptions = __uniRoutes.find(route => route.path === path); - - if (routeOptions.meta.isTabBar) { - tabBar$1.switchTab(url); - } + function $on$1 () { + return apply(Emitter, '$on', [...arguments]) + } - showWebview( - registerPage({ - path, - query, - openType: 'reLaunch' - }), - 'none', - 0, - () => { - invoke(callbackId, { - errMsg: 'reLaunch:ok' - }); - } - ); + function $off$1 () { + return apply(Emitter, '$off', [...arguments]) + } - pages.forEach(page => { - page.$remove(); - page.$getAppWebview().close('none'); - }); + function $once$1 () { + return apply(Emitter, '$once', [...arguments]) + } - setStatusBarStyle(); + function $emit$1 () { + return apply(Emitter, '$emit', [...arguments]) } - function redirectTo$1 ({ - url - }, callbackId) { - const urls = url.split('?'); - const path = urls[0]; - - const query = parseQuery(urls[1] || ''); - - const pages = getCurrentPages(); - const lastPage = pages[pages.length - 1]; - - lastPage && lastPage.$remove(); - - showWebview( - registerPage({ - path, - query, - openType: 'redirect' - }), - 'none', - 0, - () => { - lastPage && lastPage.$getAppWebview().close('none'); - invoke(callbackId, { - errMsg: 'redirectTo:ok' - }); - } - ); - - setStatusBarStyle(); + var eventApis = /*#__PURE__*/Object.freeze({ + $on: $on$1, + $off: $off$1, + $once: $once$1, + $emit: $emit$1 + }); + + var platformApi = Object.assign(Object.create(null), api, eventApis); + + /** + * 执行内部平台方法 + */ + function invokeMethod (name, ...args) { + return platformApi[name].apply(null, args) + } + /** + * 监听 service 层内部平台方法回调,与 publish 对应 + * @param {Object} name + * @param {Object} callback + */ + function onMethod (name, callback) { + return UniServiceJSBridge.on('api.' + name, callback) } - function _switchTab ({ - path, - from - }, callbackId) { - tabBar$1.switchTab(path.slice(1)); - - const pages = getCurrentPages(); - const len = pages.length; - - if (len >= 1) { // 前一个页面是非 tabBar 页面 - const currentPage = pages[len - 1]; - if (!currentPage.$page.meta.isTabBar) { - pages.reverse().forEach(page => { - if (!page.$page.meta.isTabBar && page !== currentPage) { - page.$remove(); - page.$getAppWebview().close('none'); - } - }); - currentPage.$remove(); - // 延迟执行避免iOS应用退出 - setTimeout(() => { - if (currentPage.$page.openType === 'redirect') { - currentPage.$getAppWebview().close(ANI_CLOSE, ANI_DURATION$1); - } else { - currentPage.$getAppWebview().close('auto'); - } - }, 100); - } else { - // 前一个 tabBar 触发 onHide - currentPage.$vm.__call_hook('onHide'); - } - } - - let tabBarPage; - // 查找当前 tabBarPage,且设置 visible - getCurrentPages(true).forEach(page => { - if (('/' + page.route) === path) { - page.$page.meta.visible = true; - tabBarPage = page; - } else { - if (page.$page.meta.isTabBar) { - page.$page.meta.visible = false; - } - } - }); - - if (tabBarPage) { - tabBarPage.$vm.__call_hook('onShow'); - tabBarPage.$getAppWebview().show('none'); - } else { - return showWebview(registerPage({ - path, - query: {}, - openType: 'switchTab' - }), 'none', 0, () => { - invoke(callbackId, { - errMsg: 'switchTab:ok' - }); - }, 70) - } + const eventNames = [ + 'canplay', + 'play', + 'pause', + 'stop', + 'ended', + 'timeupdate', + 'error', + 'waiting', + 'seeking', + 'seeked' + ]; - setStatusBarStyle(); - return { - errMsg: 'switchTab:ok' + const props = [ + { + name: 'src', + cache: true + }, + { + name: 'startTime', + default: 0, + cache: true + }, + { + name: 'autoplay', + default: false, + cache: true + }, + { + name: 'loop', + default: false, + cache: true + }, + { + name: 'obeyMuteSwitch', + default: true, + readonly: true, + cache: true + }, + { + name: 'duration', + readonly: true + }, + { + name: 'currentTime', + readonly: true + }, + { + name: 'paused', + readonly: true + }, + { + name: 'buffered', + readonly: true + }, + { + name: 'volume' } - } + ]; - function switchTab$1 ({ - url, - from - }) { - const path = url.split('?')[0]; - navigate(path, function () { - _switchTab({ - path, - from + class InnerAudioContext { + constructor (id) { + this.id = id; + this._callbacks = {}; + this._options = {}; + eventNames.forEach(name => { + this._callbacks[name] = []; + }); + props.forEach(item => { + const name = item.name; + const data = { + get () { + const result = item.cache ? this._options : invokeMethod('getAudioState', { + audioId: this.id + }); + const value = name in result ? result[name] : item.default; + return typeof value === 'number' && name !== 'volume' ? value / 1e3 : value + } + }; + if (!item.readonly) { + data.set = function (value) { + this._options[name] = value; + invokeMethod('setAudioState', Object.assign({}, this._options, { + audioId: this.id + })); + }; + } + Object.defineProperty(this, name, data); }); - }); - } - - function showKeyboard () { - plus.key.showSoftKeybord(); - return { - errMsg: 'showKeyboard:ok' } - } - - function hideKeyboard () { - plus.key.hideSoftKeybord(); - return { - errMsg: 'hideKeyboard:ok' + play () { + this._operate('play'); } - } - - function setNavigationBarTitle$1 ({ - title = '' - } = {}) { - const webview = getLastWebview(); - if (webview) { - const style = webview.getStyle(); - if (style && style.titleNView) { - webview.setStyle({ - titleNView: { - titleText: title - } - }); - } - return { - errMsg: 'setNavigationBarTitle:ok' - } + pause () { + this._operate('pause'); } - return { - errMsg: 'setNavigationBarTitle:fail' + stop () { + this._operate('stop'); } - } - - function showNavigationBarLoading () { - plus.nativeUI.showWaiting('', { - modal: false - }); - return { - errMsg: 'showNavigationBarLoading:ok' + seek (position) { + this._operate('play', { + currentTime: position + }); } - } - - function hideNavigationBarLoading () { - plus.nativeUI.closeWaiting(); - return { - errMsg: 'hideNavigationBarLoading:ok' + destroy () { + invokeMethod('destroyAudioInstance', { + audioId: this.id + }); + delete innerAudioContexts[this.id]; + } + _operate (type, options) { + invokeMethod('operateAudio', Object.assign({}, options, { + audioId: this.id, + operationType: type + })); } } - function setNavigationBarColor$1 ({ - frontColor, - backgroundColor - } = {}) { - const webview = getLastWebview(); - if (webview) { - const styles = {}; - if (frontColor) { - styles.titleColor = frontColor; - } - if (backgroundColor) { - styles.backgroundColor = backgroundColor; - } - plus.navigator.setStatusBarStyle(frontColor === '#000000' ? 'dark' : 'light'); - const style = webview.getStyle(); - if (style && style.titleNView) { - webview.setStyle({ - titleNView: styles - }); + eventNames.forEach(item => { + const name = item[0].toUpperCase() + item.substr(1); + InnerAudioContext.prototype[`on${name}`] = function (callback) { + this._callbacks[item].push(callback); + }; + InnerAudioContext.prototype[`off${name}`] = function (callback) { + const callbacks = this._callbacks[item]; + const index = callbacks.indexOf(callback); + if (index >= 0) { + callbacks.splice(index, 1); } - return { - errMsg: 'setNavigationBarColor:ok' + }; + }); + + onMethod('onAudioStateChange', ({ + state, + audioId, + errMsg, + errCode + }) => { + const audio = innerAudioContexts[audioId]; + audio && audio._callbacks[state].forEach(callback => { + if (typeof callback === 'function') { + callback(state === 'error' ? { + errMsg, + errCode + } : {}); } - } - return { - errMsg: 'setNavigationBarColor:fail' - } - } - - let waiting; - let waitingTimeout; - let toast = false; - let toastTimeout; + }); + }); - function showLoading$1 (args) { - return callApiSync(showToast$1, args, 'showToast', 'showLoading') - } + const innerAudioContexts = Object.create(null); - function hideLoading () { - return callApiSync(hideToast, Object.create(null), 'hideToast', 'hideLoading') - } + function createInnerAudioContext () { + const { + audioId + } = invokeMethod('createAudioInstance'); + const innerAudioContext = new InnerAudioContext(audioId); + innerAudioContexts[audioId] = innerAudioContext; + return innerAudioContext + } + + var require_context_module_1_4 = /*#__PURE__*/Object.freeze({ + createInnerAudioContext: createInnerAudioContext + }); + + const eventNames$1 = [ + 'canplay', + 'play', + 'pause', + 'stop', + 'ended', + 'timeupdate', + 'prev', + 'next', + 'error', + 'waiting' + ]; + const callbacks$1 = {}; + eventNames$1.forEach(name => { + callbacks$1[name] = []; + }); - function showToast$1 ({ - title = '', - icon = 'success', - image = '', - duration = 1500, - mask = false, - position = '' - } = {}) { - if (position) { - if (toast) { - toastTimeout && clearTimeout(toastTimeout); - plus.nativeUI.closeToast(); - } - if (waiting) { - waitingTimeout && clearTimeout(waitingTimeout); - waiting.close(); - } - if (~['top', 'center', 'bottom'].indexOf(position)) { - let richText = `${title}`; - plus.nativeUI.toast(richText, { - verticalAlign: position, - type: 'richtext' - }); - toast = true; - toastTimeout = setTimeout(() => { - hideToast(); - }, 2000); - return { - errMsg: 'showToast:ok' - } - } - console.warn('uni.showToast 传入的 "position" 值 "' + position + '" 无效'); + const props$1 = [ + { + name: 'duration', + readonly: true + }, + { + name: 'currentTime', + readonly: true + }, + { + name: 'paused', + readonly: true + }, + { + name: 'src', + cache: true + }, + { + name: 'startTime', + default: 0, + cache: true + }, + { + name: 'buffered', + readonly: true + }, + { + name: 'title', + cache: true + }, + { + name: 'epname', + cache: true + }, + { + name: 'singer', + cache: true + }, + { + name: 'coverImgUrl', + cache: true + }, + { + name: 'webUrl', + cache: true + }, + { + name: 'protocol', + readonly: true, + default: 'http' } + ]; - if (duration) { - if (waiting) { - waitingTimeout && clearTimeout(waitingTimeout); - waiting.close(); - } - if (toast) { - toastTimeout && clearTimeout(toastTimeout); - plus.nativeUI.closeToast(); - } - if (icon && !~['success', 'loading', 'none'].indexOf(icon)) { - icon = 'success'; - } - const waitingOptions = { - modal: mask, - back: 'transmit', - padding: '10px', - size: '16px' // 固定字体大小 - }; - if (!image && (!icon || icon === 'none')) { // 无图 - // waitingOptions.width = '120px' - // waitingOptions.height = '40px' - waitingOptions.loading = { - display: 'none' - }; - } else { // 有图 - waitingOptions.width = '140px'; - waitingOptions.height = '112px'; - } - if (image) { - waitingOptions.loading = { - display: 'block', - height: '55px', - icon: image, - interval: duration + class BackgroundAudioManager { + constructor () { + this._options = {}; + onMethod('onBackgroundAudioStateChange', ({ + state, + errMsg, + errCode + }) => { + callbacks$1[state].forEach(callback => { + if (typeof callback === 'function') { + callback(state === 'error' ? { + errMsg, + errCode + } : {}); + } + }); + }); + props$1.forEach(item => { + const name = item.name; + const data = { + get () { + const result = item.cache ? this._options : invokeMethod('getBackgroundAudioState'); + return name in result ? result[name] : item.default + } }; - } else { - if (icon === 'success') { - waitingOptions.loading = { - display: 'block', - height: '55px', - icon: '__uniappsuccess.png', - interval: duration - + if (!item.readonly) { + data.set = function (value) { + this._options[name] = value; + invokeMethod('setBackgroundAudioState', Object.assign({}, this._options, { + audioId: this.id + })); }; } - } - - waiting = plus.nativeUI.showWaiting(title, waitingOptions); - waitingTimeout = setTimeout(() => { - hideToast(); - }, duration); + Object.defineProperty(this, name, data); + }); } - return { - errMsg: 'showToast:ok' + play () { + this._operate('play'); } - } - - function hideToast () { - if (toast) { - toastTimeout && clearTimeout(toastTimeout); - plus.nativeUI.closeToast(); - toast = false; + pause () { + this._operate('pause'); } - if (waiting) { - waitingTimeout && clearTimeout(waitingTimeout); - waiting.close(); - waiting = null; - waitingTimeout = null; + stop () { + this._operate('stop'); } - return { - errMsg: 'hideToast:ok' + seek (position) { + this._operate('play', { + currentTime: position + }); + } + _operate (type, options) { + invokeMethod('operateBackgroundAudio', Object.assign({}, options, { + operationType: type + })); } } - function showModal$1 ({ - title = '', - content = '', - showCancel = true, - cancelText = '取消', - cancelColor = '#000000', - confirmText = '确定', - confirmColor = '#3CC51F' - } = {}, callbackId) { - plus.nativeUI.confirm(content, (e) => { - if (showCancel) { - invoke(callbackId, { - errMsg: 'showModal:ok', - confirm: e.index === 1, - cancel: e.index === 0 || e.index === -1 - }); - } else { - invoke(callbackId, { - errMsg: 'showModal:ok', - confirm: e.index === 0, - cancel: false - }); - } - }, title, showCancel ? [cancelText, confirmText] : [confirmText]); - } - function showActionSheet$1 ({ - itemList = [], - itemColor = '#000000', - title = '' - }, callbackId) { - const options = { - buttons: itemList.map(item => ({ - title: item - })) + + eventNames$1.forEach(item => { + const name = item[0].toUpperCase() + item.substr(1); + BackgroundAudioManager.prototype[`on${name}`] = function (callback) { + callbacks$1[item].push(callback); }; - if (title) { - options.title = title; + }); + + let backgroundAudioManager; + + function getBackgroundAudioManager () { + return backgroundAudioManager || (backgroundAudioManager = new BackgroundAudioManager()) + } + + var require_context_module_1_5 = /*#__PURE__*/Object.freeze({ + getBackgroundAudioManager: getBackgroundAudioManager + }); + + const callbacks$2 = []; + + onMethod('onAccelerometerChange', function (res) { + callbacks$2.forEach(callbackId => { + invoke(callbackId, res); + }); + }); + + let isEnable = false; + /** + * 监听加速度 + * @param {*} callbackId + */ + function onAccelerometerChange (callbackId) { + // TODO 当没有 start 时,添加 on 需要主动 start? + callbacks$2.push(callbackId); + if (!isEnable) { + startAccelerometer(); } + } - if (plus.os.name === 'iOS') { - options.cancel = '取消'; + function startAccelerometer ({ + interval // TODO + } = {}) { + if (isEnable) { + return } + isEnable = true; + return invokeMethod('enableAccelerometer', { + enable: true + }) + } - plus.nativeUI.actionSheet(options, (e) => { - if (e.index > 0) { - invoke(callbackId, { - errMsg: 'showActionSheet:ok', - tapIndex: e.index - 1 - }); - } else { - invoke(callbackId, { - errMsg: 'showActionSheet:fail cancel' - }); - } + function stopAccelerometer () { + isEnable = false; + return invokeMethod('enableAccelerometer', { + enable: false + }) + } + + var require_context_module_1_6 = /*#__PURE__*/Object.freeze({ + onAccelerometerChange: onAccelerometerChange, + startAccelerometer: startAccelerometer, + stopAccelerometer: stopAccelerometer + }); + + function on (method) { + const callbacks = []; + onMethod(method, data => { + callbacks.forEach(callbackId => { + invoke(callbackId, data); + }); }); - } - - function setTabBarBadge$2 ({ - index, - text, - type = 'text' - }) { - tabBar$1.setTabBarBadge(type, index, text); - return { - errMsg: 'setTabBarBadge:ok' + return function (callbackId) { + callbacks.push(callbackId); } } - function setTabBarItem$2 ({ - index, - text, - iconPath, - selectedIconPath - }) { - if (!isTabBarPage()) { - return { - errMsg: 'setTabBarItem:fail not TabBar page' - } - } - tabBar$1.setTabBarItem(index, text, iconPath, selectedIconPath); - return { - errMsg: 'setTabBarItem:ok' - } - } + const onBluetoothDeviceFound$1 = on('onBluetoothDeviceFound'); + const onBluetoothAdapterStateChange$1 = on('onBluetoothAdapterStateChange'); + const onBLEConnectionStateChange$1 = on('onBLEConnectionStateChange'); + const onBLECharacteristicValueChange$1 = on('onBLECharacteristicValueChange'); + + var require_context_module_1_7 = /*#__PURE__*/Object.freeze({ + onBluetoothDeviceFound: onBluetoothDeviceFound$1, + onBluetoothAdapterStateChange: onBluetoothAdapterStateChange$1, + onBLEConnectionStateChange: onBLEConnectionStateChange$1, + onBLECharacteristicValueChange: onBLECharacteristicValueChange$1 + }); + + const callbacks$3 = []; - function setTabBarStyle$2 ({ - color, - selectedColor, - backgroundColor, - borderStyle - }) { - if (!isTabBarPage()) { - return { - errMsg: 'setTabBarStyle:fail not TabBar page' - } - } - tabBar$1.setTabBarStyle({ - color, - selectedColor, - backgroundColor, - borderStyle: borderStyle === 'white' ? '#ffffff' : '#c6c6c6' + onMethod('onCompassChange', function (res) { + callbacks$3.forEach(callbackId => { + invoke(callbackId, res); }); - return { - errMsg: 'setTabBarStyle:ok' + }); + + let isEnable$1 = false; + /** + * 监听加速度 + * @param {*} callbackId + */ + function onCompassChange (callbackId) { + // TODO 当没有 start 时,添加 on 需要主动 start? + callbacks$3.push(callbackId); + if (!isEnable$1) { + startCompass(); } } - function hideTabBar$2 ({ - animation - }) { - if (!isTabBarPage()) { - return { - errMsg: 'hideTabBar:fail not TabBar page' - } - } - tabBar$1.hideTabBar(animation); - return { - errMsg: 'hideTabBar:ok' + function startCompass ({ + interval // TODO + } = {}) { + if (isEnable$1) { + return } + isEnable$1 = true; + return invokeMethod('enableCompass', { + enable: true + }) } - function showTabBar$2 ({ - animation - }) { - if (!isTabBarPage()) { - return { - errMsg: 'showTabBar:fail not TabBar page' - } - } - tabBar$1.showTabBar(animation); - return { - errMsg: 'showTabBar:ok' - } + function stopCompass () { + isEnable$1 = false; + return invokeMethod('enableCompass', { + enable: false + }) + } + + var require_context_module_1_8 = /*#__PURE__*/Object.freeze({ + onCompassChange: onCompassChange, + startCompass: startCompass, + stopCompass: stopCompass + }); + + const callbacks$4 = []; + + onMethod('onNetworkStatusChange', res => { + callbacks$4.forEach(callbackId => { + invoke(callbackId, res); + }); + }); + + function onNetworkStatusChange (callbackId) { + callbacks$4.push(callbackId); } + var require_context_module_1_9 = /*#__PURE__*/Object.freeze({ + onNetworkStatusChange: onNetworkStatusChange + }); + const callbacks$5 = { + pause: [], + resume: [], + start: [], + stop: [] + }; - var api = /*#__PURE__*/Object.freeze({ - startPullDownRefresh: startPullDownRefresh, - stopPullDownRefresh: stopPullDownRefresh, - getImageInfo: getImageInfo$1, - createAudioInstance: createAudioInstance, - destroyAudioInstance: destroyAudioInstance, - setAudioState: setAudioState, - getAudioState: getAudioState, - operateAudio: operateAudio, - enableAccelerometer: enableAccelerometer, - addPhoneContact: addPhoneContact, - openBluetoothAdapter: openBluetoothAdapter, - closeBluetoothAdapter: closeBluetoothAdapter, - getBluetoothAdapterState: getBluetoothAdapterState, - startBluetoothDevicesDiscovery: startBluetoothDevicesDiscovery, - stopBluetoothDevicesDiscovery: stopBluetoothDevicesDiscovery, - getBluetoothDevices: getBluetoothDevices, - getConnectedBluetoothDevices: getConnectedBluetoothDevices, - createBLEConnection: createBLEConnection, - closeBLEConnection: closeBLEConnection, - getBLEDeviceServices: getBLEDeviceServices, - getBLEDeviceCharacteristics: getBLEDeviceCharacteristics, - notifyBLECharacteristicValueChange: notifyBLECharacteristicValueChange, - notifyBLECharacteristicValueChanged: notifyBLECharacteristicValueChanged, - readBLECharacteristicValue: readBLECharacteristicValue, - writeBLECharacteristicValue: writeBLECharacteristicValue, - getScreenBrightness: getScreenBrightness, - setScreenBrightness: setScreenBrightness, - setKeepScreenOn: setKeepScreenOn, - getClipboardData: getClipboardData, - setClipboardData: setClipboardData, - enableCompass: enableCompass, - getNetworkType: getNetworkType, - onBeaconUpdate: onBeaconUpdate, - onBeaconServiceChange: onBeaconServiceChange, - getBeacons: getBeacons, - startBeaconDiscovery: startBeaconDiscovery, - stopBeaconDiscovery: stopBeaconDiscovery, - makePhoneCall: makePhoneCall$1, - SCAN_ID: SCAN_ID, - SCAN_PATH: SCAN_PATH, - scanCode: scanCode, - getSystemInfoSync: getSystemInfoSync, - getSystemInfo: getSystemInfo, - vibrateLong: vibrateLong, - vibrateShort: vibrateShort, - saveFile: saveFile, - getSavedFileList: getSavedFileList, - getFileInfo: getFileInfo, - getSavedFileInfo: getSavedFileInfo, - removeSavedFile: removeSavedFile, - openDocument: openDocument$1, - chooseLocation: chooseLocation$1, - getLocation: getLocation$1, - openLocation: openLocation$1, - startRecord: startRecord, - stopRecord: stopRecord, - playVoice: playVoice, - pauseVoice: pauseVoice, - stopVoice: stopVoice, - chooseImage: chooseImage$1, - chooseVideo: chooseVideo$1, - compressImage: compressImage, - getMusicPlayerState: getMusicPlayerState, - operateMusicPlayer: operateMusicPlayer, - setBackgroundAudioState: setBackgroundAudioState, - operateBackgroundAudio: operateBackgroundAudio, - getBackgroundAudioState: getBackgroundAudioState, - previewImage: previewImage$1, - operateRecorder: operateRecorder, - saveImageToPhotosAlbum: saveImageToPhotosAlbum, - saveVideoToPhotosAlbum: saveVideoToPhotosAlbum, - operateDownloadTask: operateDownloadTask, - createDownloadTask: createDownloadTask, - createRequestTaskById: createRequestTaskById, - createRequestTask: createRequestTask, - operateRequestTask: operateRequestTask, - createSocketTask: createSocketTask, - operateSocketTask: operateSocketTask, - operateUploadTask: operateUploadTask, - createUploadTask: createUploadTask, - getProvider: getProvider$1, - login: login, - getUserInfo: getUserInfo, - operateWXData: operateWXData, - requestPayment: requestPayment, - subscribePush: subscribePush, - unsubscribePush: unsubscribePush, - onPush: onPush, - offPush: offPush, - requireNativePlugin: requireNativePlugin$1, - shareAppMessageDirectly: shareAppMessageDirectly, - share: share, - navigateBack: navigateBack$1, - navigateTo: navigateTo$1, - reLaunch: reLaunch$1, - redirectTo: redirectTo$1, - switchTab: switchTab$1, - showKeyboard: showKeyboard, - hideKeyboard: hideKeyboard, - setNavigationBarTitle: setNavigationBarTitle$1, - showNavigationBarLoading: showNavigationBarLoading, - hideNavigationBarLoading: hideNavigationBarLoading, - setNavigationBarColor: setNavigationBarColor$1, - showLoading: showLoading$1, - hideLoading: hideLoading, - showToast: showToast$1, - hideToast: hideToast, - showModal: showModal$1, - showActionSheet: showActionSheet$1, - setTabBarBadge: setTabBarBadge$2, - setTabBarItem: setTabBarItem$2, - setTabBarStyle: setTabBarStyle$2, - hideTabBar: hideTabBar$2, - showTabBar: showTabBar$2 + class RecorderManager { + constructor () { + onMethod('onRecorderStateChange', res => { + const state = res.state; + delete res.state; + delete res.errMsg; + callbacks$5[state].forEach(callback => { + if (typeof callback === 'function') { + callback(res); + } + }); + }); + } + onError (callback) { + callbacks$5.error.push(callback); + } + onFrameRecorded (callback) { + + } + onInterruptionBegin (callback) { + + } + onInterruptionEnd (callback) { + + } + onPause (callback) { + callbacks$5.pause.push(callback); + } + onResume (callback) { + callbacks$5.resume.push(callback); + } + onStart (callback) { + callbacks$5.start.push(callback); + } + onStop (callback) { + callbacks$5.stop.push(callback); + } + pause () { + invokeMethod('operateRecorder', { + operationType: 'pause' + }); + } + resume () { + invokeMethod('operateRecorder', { + operationType: 'resume' + }); + } + start (options) { + invokeMethod('operateRecorder', Object.assign({}, options, { + operationType: 'start' + })); + } + stop () { + invokeMethod('operateRecorder', { + operationType: 'stop' + }); + } + } + + let recorderManager; + + function getRecorderManager () { + return recorderManager || (recorderManager = new RecorderManager()) + } + + var require_context_module_1_10 = /*#__PURE__*/Object.freeze({ + getRecorderManager: getRecorderManager }); - const Emitter = new Vue(); - - function apply (ctx, method, args) { - return ctx[method].apply(ctx, args) - } - - function $on$1 () { - return apply(Emitter, '$on', [...arguments]) - } + class DownloadTask { + constructor (downloadTaskId, callbackId) { + this.id = downloadTaskId; + this._callbackId = callbackId; + this._callbacks = []; + } + abort () { + invokeMethod('operateRequestTask', { + downloadTaskId: this.id, + operationType: 'abort' + }); + } + onProgressUpdate (callback) { + if (typeof callback !== 'function') { + return + } + this._callbacks.push(callback); + } + onHeadersReceived () { - function $off$1 () { - return apply(Emitter, '$off', [...arguments]) - } + } + offProgressUpdate (callback) { + const index = this._callbacks.indexOf(callback); + if (index >= 0) { + this._callbacks.splice(index, 1); + } + } + offHeadersReceived () { - function $once$1 () { - return apply(Emitter, '$once', [...arguments]) + } } + const downloadTasks$1 = Object.create(null); + onMethod('onDownloadTaskStateChange', ({ + downloadTaskId, + state, + tempFilePath, + statusCode, + progress, + totalBytesWritten, + totalBytesExpectedToWrite, + errMsg + }) => { + const downloadTask = downloadTasks$1[downloadTaskId]; + const callbackId = downloadTask._callbackId; - function $emit$1 () { - return apply(Emitter, '$emit', [...arguments]) + switch (state) { + case 'progressUpdate': + downloadTask._callbacks.forEach(callback => { + callback({ + progress, + totalBytesWritten, + totalBytesExpectedToWrite + }); + }); + break + case 'success': + invoke(callbackId, { + tempFilePath, + statusCode, + errMsg: 'request:ok' + }); + // eslint-disable-next-line no-fallthrough + case 'fail': + invoke(callbackId, { + errMsg: 'request:fail ' + errMsg + }); + // eslint-disable-next-line no-fallthrough + default: + // progressUpdate 可能晚于 success + setTimeout(() => { + delete downloadTasks$1[downloadTaskId]; + }, 100); + break + } + }); + function downloadFile$1 (args, callbackId) { + const { + downloadTaskId + } = invokeMethod('createDownloadTask', args); + const task = new DownloadTask(downloadTaskId, callbackId); + downloadTasks$1[downloadTaskId] = task; + return task } - var eventApis = /*#__PURE__*/Object.freeze({ - $on: $on$1, - $off: $off$1, - $once: $once$1, - $emit: $emit$1 + var require_context_module_1_11 = /*#__PURE__*/Object.freeze({ + downloadFile: downloadFile$1 }); - var platformApi = Object.assign(Object.create(null), api, eventApis); - - /** - * 执行内部平台方法 - */ - function invokeMethod (name, ...args) { - return platformApi[name].apply(null, args) - } - /** - * 监听 service 层内部平台方法回调,与 publish 对应 - * @param {Object} name - * @param {Object} callback - */ - function onMethod (name, callback) { - return UniServiceJSBridge.on('api.' + name, callback) - } - - const eventNames = [ - 'canplay', - 'play', - 'pause', - 'stop', - 'ended', - 'timeupdate', - 'error', - 'waiting', - 'seeking', - 'seeked' - ]; + const requestTasks$1 = Object.create(null); - const props = [ - { - name: 'src', - cache: true - }, - { - name: 'startTime', - default: 0, - cache: true - }, - { - name: 'autoplay', - default: false, - cache: true - }, - { - name: 'loop', - default: false, - cache: true - }, - { - name: 'obeyMuteSwitch', - default: true, - readonly: true, - cache: true - }, - { - name: 'duration', - readonly: true - }, - { - name: 'currentTime', - readonly: true - }, - { - name: 'paused', - readonly: true - }, - { - name: 'buffered', - readonly: true - }, - { - name: 'volume' + function formatResponse (res, args) { + if ( + typeof res.data === 'string' && + res.data.charCodeAt(0) === 65279 + ) { + res.data = res.data.substr(1); + } + + res.statusCode = parseInt(res.statusCode, 10); + + if (isPlainObject(res.header)) { + res.header = Object.keys(res.header).reduce(function (ret, key) { + const value = res.header[key]; + if (Array.isArray(value)) { + ret[key] = value.join(','); + } else if (typeof value === 'string') { + ret[key] = value; + } + return ret + }, {}); } - ]; - class InnerAudioContext { + if (args.dataType && args.dataType.toLowerCase() === 'json') { + try { + res.data = JSON.parse(res.data); + } catch (e) {} + } + + return res + } + + onMethod('onRequestTaskStateChange', function ({ + requestTaskId, + state, + data, + statusCode, + header, + errMsg + }) { + const { + args, + callbackId + } = requestTasks$1[requestTaskId] || {}; + + if (!callbackId) { + return + } + delete requestTasks$1[requestTaskId]; + switch (state) { + case 'success': + invoke(callbackId, formatResponse({ + data, + statusCode, + header, + errMsg: 'request:ok' + }, args)); + break + case 'fail': + invoke(callbackId, { + errMsg: 'request:fail ' + errMsg + }); + break + } + }); + + class RequestTask { constructor (id) { this.id = id; - this._callbacks = {}; - this._options = {}; - eventNames.forEach(name => { - this._callbacks[name] = []; + } + + abort () { + invokeMethod('operateRequestTask', { + requestTaskId: this.id, + operationType: 'abort' }); - props.forEach(item => { - const name = item.name; - const data = { - get () { - const result = item.cache ? this._options : invokeMethod('getAudioState', { - audioId: this.id - }); - const value = name in result ? result[name] : item.default; - return typeof value === 'number' && name !== 'volume' ? value / 1e3 : value - } - }; - if (!item.readonly) { - data.set = function (value) { - this._options[name] = value; - invokeMethod('setAudioState', Object.assign({}, this._options, { - audioId: this.id - })); - }; + } + + offHeadersReceived () { + + } + + onHeadersReceived () { + + } + } + + function request$1 (args, callbackId) { + const { + requestTaskId + } = invokeMethod('createRequestTask', args); + + requestTasks$1[requestTaskId] = { + args, + callbackId + }; + + return new RequestTask(requestTaskId) + } + + var require_context_module_1_12 = /*#__PURE__*/Object.freeze({ + request: request$1 + }); + + class SocketTask { + constructor (socketTaskId) { + this.id = socketTaskId; + this._callbacks = { + open: [], + close: [], + error: [], + message: [] + }; + this.CLOSED = 3; + this.CLOSING = 2; + this.CONNECTING = 0; + this.OPEN = 1; + this.readyState = this.CLOSED; + } + send (args) { + if (this.readyState !== this.OPEN) { + this._callback(args, 'sendSocketMessage:fail WebSocket is not connected'); + } + const { + errMsg + } = invokeMethod('operateSocketTask', Object.assign({}, args, { + operationType: 'send', + socketTaskId: this.id + })); + this._callback(args, errMsg.replace('operateSocketTask', 'sendSocketMessage')); + } + close (args) { + this.readyState = this.CLOSING; + const { + errMsg + } = invokeMethod('operateSocketTask', Object.assign({}, args, { + operationType: 'close', + socketTaskId: this.id + })); + this._callback(args, errMsg.replace('operateSocketTask', 'closeSocket')); + } + onOpen (callback) { + this._callbacks.open.push(callback); + } + onClose (callback) { + this._callbacks.close.push(callback); + } + onError (callback) { + this._callbacks.error.push(callback); + } + onMessage (callback) { + this._callbacks.message.push(callback); + } + _callback ({ + success, + fail, + complete + }, errMsg) { + var data = { + errMsg + }; + if (/:ok$/.test(errMsg)) { + if (typeof success === 'function') { + success(data); } - Object.defineProperty(this, name, data); - }); + } else { + if (typeof fail === 'function') { + fail(data); + } + } + if (typeof complete === 'function') { + complete(data); + } } - play () { - this._operate('play'); + } + + const socketTasks$1 = Object.create(null); + const socketTasksArray = []; + const callbacks$6 = Object.create(null); + onMethod('onSocketTaskStateChange', ({ + socketTaskId, + state, + data, + errMsg + }) => { + const socketTask = socketTasks$1[socketTaskId]; + if (!socketTask) { + return } - pause () { - this._operate('pause'); + socketTask._callbacks[state].forEach(callback => { + if (typeof callback === 'function') { + callback(state === 'message' ? { + data + } : {}); + } + }); + if (state === 'open') { + socketTask.readyState = socketTask.OPEN; } - stop () { - this._operate('stop'); + if (socketTask === socketTasksArray[0] && callbacks$6[state]) { + invoke(callbacks$6[state], state === 'message' ? { + data + } : {}); } - seek (position) { - this._operate('play', { - currentTime: position + if (state === 'error' || state === 'close') { + socketTask.readyState = socketTask.CLOSED; + delete socketTasks$1[socketTaskId]; + const index = socketTasksArray.indexOf(socketTask); + if (index >= 0) { + socketTasksArray.splice(index, 1); + } + } + }); + + function connectSocket$1 (args, callbackId) { + const { + socketTaskId + } = invokeMethod('createSocketTask', args); + const task = new SocketTask(socketTaskId); + socketTasks$1[socketTaskId] = task; + socketTasksArray.push(task); + setTimeout(() => { + invoke(callbackId, { + errMsg: 'connectSocket:ok' + }); + }, 0); + return task + } + + function sendSocketMessage$1 (args, callbackId) { + const socketTask = socketTasksArray[0]; + if (!socketTask || socketTask.readyState !== socketTask.OPEN) { + invoke(callbackId, { + errMsg: 'sendSocketMessage:fail WebSocket is not connected' }); + return } - destroy () { - invokeMethod('destroyAudioInstance', { - audioId: this.id + return invokeMethod('operateSocketTask', Object.assign({}, args, { + operationType: 'send', + socketTaskId: socketTask.id + })) + } + + function closeSocket$1 (args, callbackId) { + const socketTask = socketTasksArray[0]; + if (!socketTask) { + invoke(callbackId, { + errMsg: 'closeSocket:fail WebSocket is not connected' }); - delete innerAudioContexts[this.id]; - } - _operate (type, options) { - invokeMethod('operateAudio', Object.assign({}, options, { - audioId: this.id, - operationType: type - })); + return } + socketTask.readyState = socketTask.CLOSING; + return invokeMethod('operateSocketTask', Object.assign({}, args, { + operationType: 'close', + socketTaskId: socketTask.id + })) } - eventNames.forEach(item => { - const name = item[0].toUpperCase() + item.substr(1); - InnerAudioContext.prototype[`on${name}`] = function (callback) { - this._callbacks[item].push(callback); - }; - InnerAudioContext.prototype[`off${name}`] = function (callback) { - const callbacks = this._callbacks[item]; - const index = callbacks.indexOf(callback); - if (index >= 0) { - callbacks.splice(index, 1); - } - }; - }); + function onSocketOpen (callbackId) { + callbacks$6.open = callbackId; + } - onMethod('onAudioStateChange', ({ - state, - audioId, - errMsg, - errCode - }) => { - const audio = innerAudioContexts[audioId]; - audio && audio._callbacks[state].forEach(callback => { - if (typeof callback === 'function') { - callback(state === 'error' ? { - errMsg, - errCode - } : {}); - } - }); - }); + function onSocketError (callbackId) { + callbacks$6.error = callbackId; + } - const innerAudioContexts = Object.create(null); + function onSocketMessage (callbackId) { + callbacks$6.message = callbackId; + } - function createInnerAudioContext () { - const { - audioId - } = invokeMethod('createAudioInstance'); - const innerAudioContext = new InnerAudioContext(audioId); - innerAudioContexts[audioId] = innerAudioContext; - return innerAudioContext + function onSocketClose (callbackId) { + callbacks$6.close = callbackId; } - var require_context_module_1_4 = /*#__PURE__*/Object.freeze({ - createInnerAudioContext: createInnerAudioContext + var require_context_module_1_13 = /*#__PURE__*/Object.freeze({ + connectSocket: connectSocket$1, + sendSocketMessage: sendSocketMessage$1, + closeSocket: closeSocket$1, + onSocketOpen: onSocketOpen, + onSocketError: onSocketError, + onSocketMessage: onSocketMessage, + onSocketClose: onSocketClose }); - const eventNames$1 = [ - 'canplay', - 'play', - 'pause', - 'stop', - 'ended', - 'timeupdate', - 'prev', - 'next', - 'error', - 'waiting' - ]; - const callbacks$1 = {}; - eventNames$1.forEach(name => { - callbacks$1[name] = []; - }); - - const props$1 = [ - { - name: 'duration', - readonly: true - }, - { - name: 'currentTime', - readonly: true - }, - { - name: 'paused', - readonly: true - }, - { - name: 'src', - cache: true - }, - { - name: 'startTime', - default: 0, - cache: true - }, - { - name: 'buffered', - readonly: true - }, - { - name: 'title', - cache: true - }, - { - name: 'epname', - cache: true - }, - { - name: 'singer', - cache: true - }, - { - name: 'coverImgUrl', - cache: true - }, - { - name: 'webUrl', - cache: true - }, - { - name: 'protocol', - readonly: true, - default: 'http' + class UploadTask { + constructor (uploadTaskId, callbackId) { + this.id = uploadTaskId; + this._callbackId = callbackId; + this._callbacks = []; } - ]; - - class BackgroundAudioManager { - constructor () { - this._options = {}; - onMethod('onBackgroundAudioStateChange', ({ - state, - errMsg, - errCode - }) => { - callbacks$1[state].forEach(callback => { - if (typeof callback === 'function') { - callback(state === 'error' ? { - errMsg, - errCode - } : {}); - } - }); - }); - props$1.forEach(item => { - const name = item.name; - const data = { - get () { - const result = item.cache ? this._options : invokeMethod('getBackgroundAudioState'); - return name in result ? result[name] : item.default - } - }; - if (!item.readonly) { - data.set = function (value) { - this._options[name] = value; - invokeMethod('setBackgroundAudioState', Object.assign({}, this._options, { - audioId: this.id - })); - }; - } - Object.defineProperty(this, name, data); + abort () { + invokeMethod('operateRequestTask', { + uploadTaskId: this.id, + operationType: 'abort' }); } - play () { - this._operate('play'); - } - pause () { - this._operate('pause'); + onProgressUpdate (callback) { + if (typeof callback !== 'function') { + return + } + this._callbacks.push(callback); } - stop () { - this._operate('stop'); + onHeadersReceived () { + } - seek (position) { - this._operate('play', { - currentTime: position - }); + offProgressUpdate (callback) { + const index = this._callbacks.indexOf(callback); + if (index >= 0) { + this._callbacks.splice(index, 1); + } } - _operate (type, options) { - invokeMethod('operateBackgroundAudio', Object.assign({}, options, { - operationType: type - })); + offHeadersReceived () { + } } + const uploadTasks$1 = Object.create(null); + onMethod('onUploadTaskStateChange', ({ + uploadTaskId, + state, + data, + statusCode, + progress, + totalBytesSent, + totalBytesExpectedToSend, + errMsg + }) => { + const uploadTask = uploadTasks$1[uploadTaskId]; + const callbackId = uploadTask._callbackId; - eventNames$1.forEach(item => { - const name = item[0].toUpperCase() + item.substr(1); - BackgroundAudioManager.prototype[`on${name}`] = function (callback) { - callbacks$1[item].push(callback); - }; + switch (state) { + case 'progressUpdate': + uploadTask._callbacks.forEach(callback => { + callback({ + progress, + totalBytesSent, + totalBytesExpectedToSend + }); + }); + break + case 'success': + invoke(callbackId, { + data, + statusCode, + errMsg: 'request:ok' + }); + // eslint-disable-next-line no-fallthrough + case 'fail': + invoke(callbackId, { + errMsg: 'request:fail ' + errMsg + }); + // eslint-disable-next-line no-fallthrough + default: + // progressUpdate 可能晚于 success + setTimeout(() => { + delete uploadTasks$1[uploadTaskId]; + }, 100); + break + } }); - - let backgroundAudioManager; - - function getBackgroundAudioManager () { - return backgroundAudioManager || (backgroundAudioManager = new BackgroundAudioManager()) + function uploadFile$1 (args, callbackId) { + const { + uploadTaskId + } = invokeMethod('createUploadTask', args); + const task = new UploadTask(uploadTaskId, callbackId); + uploadTasks$1[uploadTaskId] = task; + return task } - var require_context_module_1_5 = /*#__PURE__*/Object.freeze({ - getBackgroundAudioManager: getBackgroundAudioManager + var require_context_module_1_14 = /*#__PURE__*/Object.freeze({ + uploadFile: uploadFile$1 }); - const callbacks$2 = []; + function setStorage$1 ({ + key, + data + } = {}) { + const value = { + type: typeof data === 'object' ? 'object' : 'string', + data: data + }; + localStorage.setItem(key, JSON.stringify(value)); + const keyList = localStorage.getItem('uni-storage-keys'); + if (!keyList) { + localStorage.setItem('uni-storage-keys', JSON.stringify([key])); + } else { + const keys = JSON.parse(keyList); + if (keys.indexOf(key) < 0) { + keys.push(key); + localStorage.setItem('uni-storage-keys', JSON.stringify(keys)); + } + } + return { + errMsg: 'setStorage:ok' + } + } - onMethod('onAccelerometerChange', function (res) { - callbacks$2.forEach(callbackId => { - invoke(callbackId, res); + function setStorageSync$1 (key, data) { + setStorage$1({ + key, + data }); - }); - - let isEnable = false; - /** - * 监听加速度 - * @param {*} callbackId - */ - function onAccelerometerChange (callbackId) { - // TODO 当没有 start 时,添加 on 需要主动 start? - callbacks$2.push(callbackId); - if (!isEnable) { - startAccelerometer(); - } } - function startAccelerometer ({ - interval // TODO + function getStorage$1 ({ + key } = {}) { - if (isEnable) { - return + const data = localStorage.getItem(key); + return data ? { + data: JSON.parse(data).data, + errMsg: 'getStorage:ok' + } : { + data: '', + errMsg: 'getStorage:fail' } - isEnable = true; - return invokeMethod('enableAccelerometer', { - enable: true - }) } - function stopAccelerometer () { - isEnable = false; - return invokeMethod('enableAccelerometer', { - enable: false - }) - } - - var require_context_module_1_6 = /*#__PURE__*/Object.freeze({ - onAccelerometerChange: onAccelerometerChange, - startAccelerometer: startAccelerometer, - stopAccelerometer: stopAccelerometer - }); - - function on (method) { - const callbacks = []; - onMethod(method, data => { - callbacks.forEach(callbackId => { - invoke(callbackId, data); - }); + function getStorageSync$1 (key) { + const res = getStorage$1({ + key }); - return function (callbackId) { - callbacks.push(callbackId); - } + return res.data } - const onBluetoothDeviceFound$1 = on('onBluetoothDeviceFound'); - const onBluetoothAdapterStateChange$1 = on('onBluetoothAdapterStateChange'); - const onBLEConnectionStateChange$1 = on('onBLEConnectionStateChange'); - const onBLECharacteristicValueChange$1 = on('onBLECharacteristicValueChange'); - - var require_context_module_1_7 = /*#__PURE__*/Object.freeze({ - onBluetoothDeviceFound: onBluetoothDeviceFound$1, - onBluetoothAdapterStateChange: onBluetoothAdapterStateChange$1, - onBLEConnectionStateChange: onBLEConnectionStateChange$1, - onBLECharacteristicValueChange: onBLECharacteristicValueChange$1 - }); - - const callbacks$3 = []; + function removeStorage$1 ({ + key + } = {}) { + const keyList = localStorage.getItem('uni-storage-keys'); + if (keyList) { + const keys = JSON.parse(keyList); + const index = keys.indexOf(key); + keys.splice(index, 1); + localStorage.setItem('uni-storage-keys', JSON.stringify(keys)); + } + localStorage.removeItem(key); + return { + errMsg: 'removeStorage:ok' + } + } - onMethod('onCompassChange', function (res) { - callbacks$3.forEach(callbackId => { - invoke(callbackId, res); + function removeStorageSync$1 (key) { + removeStorage$1({ + key }); - }); - - let isEnable$1 = false; - /** - * 监听加速度 - * @param {*} callbackId - */ - function onCompassChange (callbackId) { - // TODO 当没有 start 时,添加 on 需要主动 start? - callbacks$3.push(callbackId); - if (!isEnable$1) { - startCompass(); - } } - function startCompass ({ - interval // TODO - } = {}) { - if (isEnable$1) { - return + function clearStorage () { + localStorage.clear(); + return { + errMsg: 'clearStorage:ok' } - isEnable$1 = true; - return invokeMethod('enableCompass', { - enable: true - }) } - function stopCompass () { - isEnable$1 = false; - return invokeMethod('enableCompass', { - enable: false - }) - } - - var require_context_module_1_8 = /*#__PURE__*/Object.freeze({ - onCompassChange: onCompassChange, - startCompass: startCompass, - stopCompass: stopCompass - }); - - const callbacks$4 = []; + function clearStorageSync () { + clearStorage(); + } - onMethod('onNetworkStatusChange', res => { - callbacks$4.forEach(callbackId => { - invoke(callbackId, res); - }); - }); + function getStorageInfo () { // TODO 暂时先不做大小的转换 + const keyList = localStorage.getItem('uni-storage-keys'); + return keyList ? { + keys: JSON.parse(keyList), + currentSize: 0, + limitSize: 0, + errMsg: 'getStorageInfo:ok' + } : { + keys: '', + currentSize: 0, + limitSize: 0, + errMsg: 'getStorageInfo:fail' + } + } - function onNetworkStatusChange (callbackId) { - callbacks$4.push(callbackId); + function getStorageInfoSync () { + const res = getStorageInfo(); + delete res.errMsg; + return res } - var require_context_module_1_9 = /*#__PURE__*/Object.freeze({ - onNetworkStatusChange: onNetworkStatusChange + var require_context_module_1_15 = /*#__PURE__*/Object.freeze({ + setStorage: setStorage$1, + setStorageSync: setStorageSync$1, + getStorage: getStorage$1, + getStorageSync: getStorageSync$1, + removeStorage: removeStorage$1, + removeStorageSync: removeStorageSync$1, + clearStorage: clearStorage, + clearStorageSync: clearStorageSync, + getStorageInfo: getStorageInfo, + getStorageInfoSync: getStorageInfoSync }); - const callbacks$5 = { - pause: [], - resume: [], - start: [], - stop: [] - }; - - class RecorderManager { - constructor () { - onMethod('onRecorderStateChange', res => { - const state = res.state; - delete res.state; - delete res.errMsg; - callbacks$5[state].forEach(callback => { - if (typeof callback === 'function') { - callback(res); - } - }); - }); - } - onError (callback) { - callbacks$5.error.push(callback); - } - onFrameRecorded (callback) { - - } - onInterruptionBegin (callback) { - - } - onInterruptionEnd (callback) { + const defaultOption = { + duration: 400, + timingFunction: 'linear', + delay: 0, + transformOrigin: '50% 50% 0' + }; + class MPAnimation { + constructor (option) { + this.actions = []; + this.currentTransform = {}; + this.currentStepAnimates = []; + this.option = Object.assign({}, defaultOption, option); } - onPause (callback) { - callbacks$5.pause.push(callback); + _getOption (option) { + let _option = { + transition: Object.assign({}, this.option, option) + }; + _option.transformOrigin = _option.transition.transformOrigin; + delete _option.transition.transformOrigin; + return _option } - onResume (callback) { - callbacks$5.resume.push(callback); + _pushAnimates (type, args) { + this.currentStepAnimates.push({ + type: type, + args: args + }); } - onStart (callback) { - callbacks$5.start.push(callback); + _converType (type) { + return type.replace(/[A-Z]/g, text => { + return `-${text.toLowerCase()}` + }) } - onStop (callback) { - callbacks$5.stop.push(callback); + _getValue (value) { + return typeof value === 'number' ? `${value}px` : value } - pause () { - invokeMethod('operateRecorder', { - operationType: 'pause' - }); + export () { + const actions = this.actions; + this.actions = []; + return { + actions + } } - resume () { - invokeMethod('operateRecorder', { - operationType: 'resume' + step (option) { + this.currentStepAnimates.forEach(animate => { + if (animate.type !== 'style') { + this.currentTransform[animate.type] = animate; + } else { + this.currentTransform[`${animate.type}.${animate.args[0]}`] = animate; + } }); - } - start (options) { - invokeMethod('operateRecorder', Object.assign({}, options, { - operationType: 'start' - })); - } - stop () { - invokeMethod('operateRecorder', { - operationType: 'stop' + this.actions.push({ + animates: Object.values(this.currentTransform), + option: this._getOption(option) }); + this.currentStepAnimates = []; + return this } } - let recorderManager; + const animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d', 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY', 'translateZ']; + const animateTypes2 = ['opacity', 'backgroundColor']; + const animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom']; + animateTypes1.concat(animateTypes2, animateTypes3).forEach(type => { + MPAnimation.prototype[type] = function (...args) { + if (animateTypes2.concat(animateTypes3).includes(type)) { + this._pushAnimates('style', [this._converType(type), animateTypes3.includes(type) ? this._getValue(args[0]) : args[0]]); + } else { + this._pushAnimates(type, args); + } + return this + }; + }); - function getRecorderManager () { - return recorderManager || (recorderManager = new RecorderManager()) + function createAnimation (option) { + return new MPAnimation(option) } - var require_context_module_1_10 = /*#__PURE__*/Object.freeze({ - getRecorderManager: getRecorderManager + var require_context_module_1_16 = /*#__PURE__*/Object.freeze({ + createAnimation: createAnimation }); - class DownloadTask { - constructor (downloadTaskId, callbackId) { - this.id = downloadTaskId; - this._callbackId = callbackId; - this._callbacks = []; - } - abort () { - invokeMethod('operateRequestTask', { - downloadTaskId: this.id, - operationType: 'abort' - }); - } - onProgressUpdate (callback) { - if (typeof callback !== 'function') { - return - } - this._callbacks.push(callback); - } - onHeadersReceived () { + const callbacks$7 = []; + + onMethod('onKeyboardHeightChange', res => { + callbacks$7.forEach(callbackId => { + invoke(callbackId, res); + }); + }); + function onKeyboardHeightChange (callbackId) { + callbacks$7.push(callbackId); + } + + var require_context_module_1_17 = /*#__PURE__*/Object.freeze({ + onKeyboardHeightChange: onKeyboardHeightChange + }); + + function pageScrollTo$1 (args) { + const pages = getCurrentPages(); + if (pages.length) { + UniServiceJSBridge.publishHandler('pageScrollTo', args, pages[pages.length - 1].$page.id); } - offProgressUpdate (callback) { - const index = this._callbacks.indexOf(callback); - if (index >= 0) { - this._callbacks.splice(index, 1); - } - } - offHeadersReceived () { + return {} + } + + var require_context_module_1_18 = /*#__PURE__*/Object.freeze({ + pageScrollTo: pageScrollTo$1 + }); + + function removeTabBarBadge$1 ({ + index + }) { + return invokeMethod('setTabBarBadge', { + index, + type: 'none' + }) + } - } + function showTabBarRedDot$1 ({ + index + }) { + return invokeMethod('setTabBarBadge', { + index, + type: 'redDot' + }) } - const downloadTasks$1 = Object.create(null); - onMethod('onDownloadTaskStateChange', ({ - downloadTaskId, - state, - tempFilePath, - statusCode, - progress, - totalBytesWritten, - totalBytesExpectedToWrite, - errMsg - }) => { - const downloadTask = downloadTasks$1[downloadTaskId]; - const callbackId = downloadTask._callbackId; - switch (state) { - case 'progressUpdate': - downloadTask._callbacks.forEach(callback => { - callback({ - progress, - totalBytesWritten, - totalBytesExpectedToWrite - }); - }); - break - case 'success': - invoke(callbackId, { - tempFilePath, - statusCode, - errMsg: 'request:ok' - }); - // eslint-disable-next-line no-fallthrough - case 'fail': - invoke(callbackId, { - errMsg: 'request:fail ' + errMsg - }); - // eslint-disable-next-line no-fallthrough - default: - // progressUpdate 可能晚于 success - setTimeout(() => { - delete downloadTasks$1[downloadTaskId]; - }, 100); - break - } + const hideTabBarRedDot$1 = removeTabBarBadge$1; + + const callbacks$8 = []; + + onMethod('onTabBarMidButtonTap', res => { + callbacks$8.forEach(callbackId => { + invoke(callbackId, res); + }); }); - function downloadFile$1 (args, callbackId) { - const { - downloadTaskId - } = invokeMethod('createDownloadTask', args); - const task = new DownloadTask(downloadTaskId, callbackId); - downloadTasks$1[downloadTaskId] = task; - return task + + function onTabBarMidButtonTap (callbackId) { + callbacks$8.push(callbackId); + } + + var require_context_module_1_19 = /*#__PURE__*/Object.freeze({ + removeTabBarBadge: removeTabBarBadge$1, + showTabBarRedDot: showTabBarRedDot$1, + hideTabBarRedDot: hideTabBarRedDot$1, + onTabBarMidButtonTap: onTabBarMidButtonTap + }); + + const callbacks$9 = []; + onMethod('onViewDidResize', res => { + callbacks$9.forEach(callbackId => { + invoke(callbackId, res); + }); + }); + + function onWindowResize (callbackId) { + callbacks$9.push(callbackId); + } + + function offWindowResize (callbackId) { + // 此处和微信平台一致查询不到去掉最后一个 + callbacks$9.splice(callbacks$9.indexOf(callbackId), 1); } - var require_context_module_1_11 = /*#__PURE__*/Object.freeze({ - downloadFile: downloadFile$1 + var require_context_module_1_20 = /*#__PURE__*/Object.freeze({ + onWindowResize: onWindowResize, + offWindowResize: offWindowResize + }); + + const api$1 = Object.create(null); + + const modules$1 = + (function() { + var map = { + './base/base64.js': require_context_module_1_0, + './base/can-i-use.js': require_context_module_1_1, + './base/interceptor.js': require_context_module_1_2, + './base/upx2px.js': require_context_module_1_3, + './context/audio.js': require_context_module_1_4, + './context/background-audio.js': require_context_module_1_5, + './device/accelerometer.js': require_context_module_1_6, + './device/bluetooth.js': require_context_module_1_7, + './device/compass.js': require_context_module_1_8, + './device/network.js': require_context_module_1_9, + './media/recorder.js': require_context_module_1_10, + './network/download-file.js': require_context_module_1_11, + './network/request.js': require_context_module_1_12, + './network/socket.js': require_context_module_1_13, + './network/upload-file.js': require_context_module_1_14, + './storage/storage.js': require_context_module_1_15, + './ui/create-animation.js': require_context_module_1_16, + './ui/keyboard.js': require_context_module_1_17, + './ui/page-scroll-to.js': require_context_module_1_18, + './ui/tab-bar.js': require_context_module_1_19, + './ui/window.js': require_context_module_1_20, + + }; + var req = function req(key) { + return map[key] || (function() { throw new Error("Cannot find module '" + key + "'.") }()); + }; + req.keys = function() { + return Object.keys(map); + }; + return req; + })(); + + + modules$1.keys().forEach(function (key) { + Object.assign(api$1, modules$1(key)); }); - const requestTasks$1 = Object.create(null); + var api$2 = Object.assign(Object.create(null), api$1, platformApi); + + const uni$1 = Object.create(null); - function formatResponse (res, args) { - if ( - typeof res.data === 'string' && - res.data.charCodeAt(0) === 65279 - ) { - res.data = res.data.substr(1); + apis_1.forEach(name => { + if (api$2[name]) { + uni$1[name] = promisify(name, wrapper(name, api$2[name])); + } else { + uni$1[name] = wrapperUnimplemented(name); } - - res.statusCode = parseInt(res.statusCode, 10); - - if (isPlainObject(res.header)) { - res.header = Object.keys(res.header).reduce(function (ret, key) { - const value = res.header[key]; - if (Array.isArray(value)) { - ret[key] = value.join(','); - } else if (typeof value === 'string') { - ret[key] = value; - } - return ret - }, {}); + }); + + function publishHandler (eventType, args, pageIds) { + args = JSON.stringify(args); + if (process.env.NODE_ENV !== 'production') { + console.log(`UNIAPP[publishHandler]:[${+new Date()}]`, eventType, args, pageIds); } - - if (args.dataType && args.dataType.toLowerCase() === 'json') { - try { - res.data = JSON.parse(res.data); - } catch (e) {} + if (!Array.isArray(pageIds)) { + pageIds = [pageIds]; } - - return res + const evalJSCode = + `typeof UniViewJSBridge !== 'undefined' && UniViewJSBridge.subscribeHandler("${eventType}",${args})`; + pageIds.forEach(id => { + const webview = plus.webview.getWebviewById(String(id)); + webview && webview.evalJS(evalJSCode); + }); + } + + function callHook (vm, hook, params) { + return (vm.$vm || vm).__call_hook(hook, params) } - onMethod('onRequestTaskStateChange', function ({ - requestTaskId, - state, - data, - statusCode, - header, - errMsg - }) { - const { - args, - callbackId - } = requestTasks$1[requestTaskId] || {}; - - if (!callbackId) { - return - } - delete requestTasks$1[requestTaskId]; - switch (state) { - case 'success': - invoke(callbackId, formatResponse({ - data, - statusCode, - header, - errMsg: 'request:ok' - }, args)); - break - case 'fail': - invoke(callbackId, { - errMsg: 'request:fail ' + errMsg - }); - break + function callAppHook (vm, hook, params) { + if (hook !== 'onError') { + console.debug(`App:${hook} have been invoked` + (params ? ` ${JSON.stringify(params)}` : '')); } - }); + return (vm.$vm || vm).__call_hook(hook, params) + } - class RequestTask { - constructor (id) { - this.id = id; + function callPageHook (vm, hook, params) { + if (hook !== 'onPageScroll') { + console.debug(`${vm.$page.route}[${vm.$page.id}]:${hook} have been invoked`); } - - abort () { - invokeMethod('operateRequestTask', { - requestTaskId: this.id, - operationType: 'abort' - }); + return callHook(vm, hook, params) + } + + function initOn (on, { + getApp, + getCurrentPages + }) { + function onError (err) { + callAppHook(getApp(), 'onError', err); } - offHeadersReceived () { - + function onPageNotFound (page) { + callAppHook(getApp(), 'onPageNotFound', page); } - onHeadersReceived () { - + function onPullDownRefresh (args, pageId) { + const page = getCurrentPages().find(page => page.$page.id === pageId); + if (page) { + setPullDownRefreshPageId(pageId); + callPageHook(page, 'onPullDownRefresh'); + } } - } - - function request$1 (args, callbackId) { - const { - requestTaskId - } = invokeMethod('createRequestTask', args); - - requestTasks$1[requestTaskId] = { - args, - callbackId - }; - return new RequestTask(requestTaskId) - } - - var require_context_module_1_12 = /*#__PURE__*/Object.freeze({ - request: request$1 - }); - - class SocketTask { - constructor (socketTaskId) { - this.id = socketTaskId; - this._callbacks = { - open: [], - close: [], - error: [], - message: [] - }; - this.CLOSED = 3; - this.CLOSING = 2; - this.CONNECTING = 0; - this.OPEN = 1; - this.readyState = this.CLOSED; - } - send (args) { - if (this.readyState !== this.OPEN) { - this._callback(args, 'sendSocketMessage:fail WebSocket is not connected'); + function callCurrentPageHook (hook, args) { + const pages = getCurrentPages(); + if (pages.length) { + callPageHook(pages[pages.length - 1], hook, args); } - const { - errMsg - } = invokeMethod('operateSocketTask', Object.assign({}, args, { - operationType: 'send', - socketTaskId: this.id - })); - this._callback(args, errMsg.replace('operateSocketTask', 'sendSocketMessage')); - } - close (args) { - this.readyState = this.CLOSING; - const { - errMsg - } = invokeMethod('operateSocketTask', Object.assign({}, args, { - operationType: 'close', - socketTaskId: this.id - })); - this._callback(args, errMsg.replace('operateSocketTask', 'closeSocket')); - } - onOpen (callback) { - this._callbacks.open.push(callback); } - onClose (callback) { - this._callbacks.close.push(callback); + + function createCallCurrentPageHook (hook) { + return function (args) { + callCurrentPageHook(hook, args); + } } - onError (callback) { - this._callbacks.error.push(callback); + + function onAppEnterBackground () { + callAppHook(getApp(), 'onHide'); + callCurrentPageHook('onHide'); } - onMessage (callback) { - this._callbacks.message.push(callback); + + function onAppEnterForeground () { + callAppHook(getApp(), 'onShow'); + callCurrentPageHook('onShow'); } - _callback ({ - success, - fail, - complete - }, errMsg) { - var data = { - errMsg - }; - if (/:ok$/.test(errMsg)) { - if (typeof success === 'function') { - success(data); - } - } else { - if (typeof fail === 'function') { - fail(data); - } + + function onWebInvokeAppService ({ + name, + arg + }, pageId) { + if (name === 'postMessage') ; else { + uni[name](arg); } - if (typeof complete === 'function') { - complete(data); + } + + const routeHooks = { + navigateTo () { + callCurrentPageHook('onHide'); + }, + navigateBack () { + callCurrentPageHook('onShow'); } + }; + + function onAppRoute ({ + type + }) { + const routeHook = routeHooks[type]; + routeHook && routeHook(); } - } - const socketTasks$1 = Object.create(null); - const socketTasksArray = []; - const callbacks$6 = Object.create(null); - onMethod('onSocketTaskStateChange', ({ - socketTaskId, - state, - data, - errMsg - }) => { - const socketTask = socketTasks$1[socketTaskId]; - if (!socketTask) { - return + on('onError', onError); + on('onPageNotFound', onPageNotFound); + + { // 后续有时间,h5 平台也要迁移到 onAppRoute + on('onAppRoute', onAppRoute); } - socketTask._callbacks[state].forEach(callback => { - if (typeof callback === 'function') { - callback(state === 'message' ? { - data - } : {}); - } - }); - if (state === 'open') { - socketTask.readyState = socketTask.OPEN; + + on('onAppEnterBackground', onAppEnterBackground); + on('onAppEnterForeground', onAppEnterForeground); + + on('onPullDownRefresh', onPullDownRefresh); + + on('onTabItemTap', createCallCurrentPageHook('onTabItemTap')); + on('onNavigationBarButtonTap', createCallCurrentPageHook('onNavigationBarButtonTap')); + + on('onNavigationBarSearchInputChanged', createCallCurrentPageHook('onNavigationBarSearchInputChanged')); + on('onNavigationBarSearchInputConfirmed', createCallCurrentPageHook('onNavigationBarSearchInputConfirmed')); + on('onNavigationBarSearchInputClicked', createCallCurrentPageHook('onNavigationBarSearchInputClicked')); + + on('onWebInvokeAppService', onWebInvokeAppService); + } + + function perf (type, startTime) { + /* eslint-disable no-undef */ + startTime = startTime || __UniServiceStartTime__; + const endTime = Date.now(); + console.log(`[PERF][${endTime}] ${type} 耗时[${Date.now() - startTime}]`); + } + + function onWebviewReady (data, pageId) { + const isLaunchWebview = pageId === '1'; + if (isLaunchWebview) { // 首页 + setPreloadWebview(plus.webview.getLaunchWebview()); + } else if (!preloadWebview) { // preloadWebview 不存在,重新加载一下 + setPreloadWebview(plus.webview.getWebviewById(pageId)); } - if (socketTask === socketTasksArray[0] && callbacks$6[state]) { - invoke(callbacks$6[state], state === 'message' ? { - data - } : {}); + if (preloadWebview.id !== pageId) { + return console.error(`webview[${pageId}] not found`) } - if (state === 'error' || state === 'close') { - socketTask.readyState = socketTask.CLOSED; - delete socketTasks$1[socketTaskId]; - const index = socketTasksArray.indexOf(socketTask); - if (index >= 0) { - socketTasksArray.splice(index, 1); + preloadWebview.loaded = true; // 标记已 ready + + consumeWebviewReady(pageId); + + if (isLaunchWebview) { + const entryPagePath = '/' + __uniConfig.entryPagePath; + const routeOptions = __uniRoutes.find(route => route.path === entryPagePath); + if (!routeOptions.meta.isNVue) { // 非 nvue 首页,需要主动跳转 + const navigateType = routeOptions.meta.isTabBar ? 'switchTab' : 'navigateTo'; + process.env.NODE_ENV !== 'production' && perf(`${entryPagePath} navigateTo`); + return uni[navigateType]({ + url: entryPagePath + }) } } - }); + } - function connectSocket$1 (args, callbackId) { - const { - socketTaskId - } = invokeMethod('createSocketTask', args); - const task = new SocketTask(socketTaskId); - socketTasks$1[socketTaskId] = task; - socketTasksArray.push(task); - setTimeout(() => { - invoke(callbackId, { - errMsg: 'connectSocket:ok' - }); - }, 0); - return task + const webviewUIEvents = Object.create(null); + + function registerWebviewUIEvent (pageId, callback) { + (webviewUIEvents[pageId] || (webviewUIEvents[pageId] = [])).push(callback); } - function sendSocketMessage$1 (args, callbackId) { - const socketTask = socketTasksArray[0]; - if (!socketTask || socketTask.readyState !== socketTask.OPEN) { - invoke(callbackId, { - errMsg: 'sendSocketMessage:fail WebSocket is not connected' - }); - return - } - return invokeMethod('operateSocketTask', Object.assign({}, args, { - operationType: 'send', - socketTaskId: socketTask.id - })) + function removeWebviewUIEvent (pageId) { + delete webviewUIEvents[pageId]; } - function closeSocket$1 (args, callbackId) { - const socketTask = socketTasksArray[0]; - if (!socketTask) { - invoke(callbackId, { - errMsg: 'closeSocket:fail WebSocket is not connected' + function onWebviewUIEvent ({ + data, + options + }, pageId) { + const { + cid, + nid + } = options; + const handlers = webviewUIEvents[pageId]; + if (Array.isArray(handlers)) { + handlers.forEach(handler => { + handler(cid, nid, data); }); - return + } else { + console.error(`events[${pageId}] not found`); } - socketTask.readyState = socketTask.CLOSING; - return invokeMethod('operateSocketTask', Object.assign({}, args, { - operationType: 'close', - socketTaskId: socketTask.id - })) } - function onSocketOpen (callbackId) { - callbacks$6.open = callbackId; - } + function initSubscribeHandlers () { + const { + subscribe, + subscribeHandler + } = UniServiceJSBridge; - function onSocketError (callbackId) { - callbacks$6.error = callbackId; - } + registerPlusMessage('subscribeHandler', (data) => { + subscribeHandler(data.type, data.data, data.pageId); + }); + // TODO 检测目标 preloadWebview 是否已准备好,因为 preloadWebview 准备好时,此处代码还没执行 + subscribe(WEBVIEW_READY, onWebviewReady); + subscribe(WEBVIEW_UI_EVENT, onWebviewUIEvent); + } + + let appCtx; - function onSocketMessage (callbackId) { - callbacks$6.message = callbackId; + function getApp () { + return appCtx } - function onSocketClose (callbackId) { - callbacks$6.close = callbackId; - } - - var require_context_module_1_13 = /*#__PURE__*/Object.freeze({ - connectSocket: connectSocket$1, - sendSocketMessage: sendSocketMessage$1, - closeSocket: closeSocket$1, - onSocketOpen: onSocketOpen, - onSocketError: onSocketError, - onSocketMessage: onSocketMessage, - onSocketClose: onSocketClose - }); - - class UploadTask { - constructor (uploadTaskId, callbackId) { - this.id = uploadTaskId; - this._callbackId = callbackId; - this._callbacks = []; - } - abort () { - invokeMethod('operateRequestTask', { - uploadTaskId: this.id, - operationType: 'abort' + function initGlobalListeners () { + const emit = UniServiceJSBridge.emit; + + plus.key.addEventListener('backbutton', () => { + uni.navigateBack({ + from: 'backbutton' }); - } - onProgressUpdate (callback) { - if (typeof callback !== 'function') { - return + }); + + plus.globalEvent.addEventListener('pause', () => { + emit('onAppEnterBackground'); + }); + + plus.globalEvent.addEventListener('resume', () => { + emit('onAppEnterForeground'); + }); + + plus.globalEvent.addEventListener('netchange', () => { + const networkType = NETWORK_TYPES[plus.networkinfo.getCurrentType()]; + publish('onNetworkStatusChange', { + isConnected: networkType !== 'none', + networkType + }); + }); + + plus.globalEvent.addEventListener('KeyboardHeightChange', function (event) { + publish('onKeyboardHeightChange', { + height: event.height + }); + }); + + plus.globalEvent.addEventListener('plusMessage', function (e) { + if (process.env.NODE_ENV !== 'production') { + console.log('[plusMessage]:[' + Date.now() + ']' + JSON.stringify(e.data)); } - this._callbacks.push(callback); - } - onHeadersReceived () { + if (e.data && e.data.type) { + const type = e.data.type; + consumePlusMessage(type, e.data.args || {}); + } + }); + } + + function initAppLaunch (appVm) { + const args = { + path: __uniConfig.entryPagePath, + query: {}, + scene: 1001 + }; + + callAppHook(appVm, 'onLaunch', args); + callAppHook(appVm, 'onShow', args); + } + function initTabBar () { + if (!__uniConfig.tabBar || !__uniConfig.tabBar.list.length) { + return } - offProgressUpdate (callback) { - const index = this._callbacks.indexOf(callback); - if (index >= 0) { - this._callbacks.splice(index, 1); - } - } - offHeadersReceived () { + __uniConfig.tabBar.selected = 0; + + const selected = __uniConfig.tabBar.list.findIndex(page => page.pagePath === __uniConfig.entryPagePath); + if (selected !== -1) { + // 取当前 tab 索引值 + __uniConfig.tabBar.selected = selected; } - } - const uploadTasks$1 = Object.create(null); - onMethod('onUploadTaskStateChange', ({ - uploadTaskId, - state, - data, - statusCode, - progress, - totalBytesSent, - totalBytesExpectedToSend, - errMsg - }) => { - const uploadTask = uploadTasks$1[uploadTaskId]; - const callbackId = uploadTask._callbackId; - switch (state) { - case 'progressUpdate': - uploadTask._callbacks.forEach(callback => { - callback({ - progress, - totalBytesSent, - totalBytesExpectedToSend + tabBar$1.init(__uniConfig.tabBar, (item, index) => { + uni.switchTab({ + url: '/' + item.pagePath, + openType: 'switchTab', + from: 'tabBar', + success () { + UniServiceJSBridge.emit('onTabItemTap', { + index, + text: item.text, + pagePath: item.pagePath }); - }); - break - case 'success': - invoke(callbackId, { - data, - statusCode, - errMsg: 'request:ok' - }); - // eslint-disable-next-line no-fallthrough - case 'fail': - invoke(callbackId, { - errMsg: 'request:fail ' + errMsg - }); - // eslint-disable-next-line no-fallthrough - default: - // progressUpdate 可能晚于 success - setTimeout(() => { - delete uploadTasks$1[uploadTaskId]; - }, 100); - break + } + }); + }); + } + + function registerApp (appVm) { + if (process.env.NODE_ENV !== 'production') { + console.log(`[uni-app] registerApp`); } - }); - function uploadFile$1 (args, callbackId) { - const { - uploadTaskId - } = invokeMethod('createUploadTask', args); - const task = new UploadTask(uploadTaskId, callbackId); - uploadTasks$1[uploadTaskId] = task; - return task + + appCtx = appVm; + + appCtx.globalData = appVm.$options.globalData || {}; + + initOn(UniServiceJSBridge.on, { + getApp, + getCurrentPages: getCurrentPages$1 + }); + + initTabBar(); + + initGlobalListeners(); + + initSubscribeHandlers(); + + initAppLaunch(appVm); + + __uniConfig.ready = true; + + process.env.NODE_ENV !== 'production' && perf('registerApp'); } - var require_context_module_1_14 = /*#__PURE__*/Object.freeze({ - uploadFile: uploadFile$1 - }); + var tags = [ + 'uni-app', + 'uni-tabbar', + 'uni-page', + 'uni-page-head', + 'uni-page-wrapper', + 'uni-page-body', + 'uni-page-refresh', + 'uni-actionsheet', + 'uni-modal', + 'uni-picker', + 'uni-toast', + 'uni-resize-sensor', + + 'uni-ad', + 'uni-audio', + 'uni-button', + 'uni-camera', + 'uni-canvas', + 'uni-checkbox', + 'uni-checkbox-group', + 'uni-cover-image', + 'uni-cover-view', + 'uni-form', + 'uni-functional-page-navigator', + 'uni-icon', + 'uni-image', + 'uni-input', + 'uni-label', + 'uni-live-player', + 'uni-live-pusher', + 'uni-map', + 'uni-movable-area', + 'uni-movable-view', + 'uni-navigator', + 'uni-official-account', + 'uni-open-data', + 'uni-picker', + 'uni-picker-view', + 'uni-picker-view-column', + 'uni-progress', + 'uni-radio', + 'uni-radio-group', + 'uni-rich-text', + 'uni-scroll-view', + 'uni-slider', + 'uni-swiper', + 'uni-swiper-item', + 'uni-switch', + 'uni-text', + 'uni-textarea', + 'uni-video', + 'uni-view', + 'uni-web-view' + ]; - function setStorage$1 ({ - key, - data - } = {}) { - const value = { - type: typeof data === 'object' ? 'object' : 'string', - data: data + // 使用白名单过滤(前期有一批自定义组件使用了 uni-) + + function initVue (Vue) { + const oldIsReservedTag = Vue.config.isReservedTag; + + Vue.config.isReservedTag = function (tag) { + return tags.indexOf(tag) !== -1 || oldIsReservedTag(tag) }; - localStorage.setItem(key, JSON.stringify(value)); - const keyList = localStorage.getItem('uni-storage-keys'); - if (!keyList) { - localStorage.setItem('uni-storage-keys', JSON.stringify([key])); - } else { - const keys = JSON.parse(keyList); - if (keys.indexOf(key) < 0) { - keys.push(key); - localStorage.setItem('uni-storage-keys', JSON.stringify(keys)); + + Vue.config.ignoredElements = tags; + + const oldGetTagNamespace = Vue.config.getTagNamespace; + + const conflictTags = ['switch', 'image', 'text', 'view']; + + Vue.config.getTagNamespace = function (tag) { + if (~conflictTags.indexOf(tag)) { // svg 部分标签名称与 uni 标签冲突 + return false } + return oldGetTagNamespace(tag) || false + }; + } + + class VDomSync { + constructor (pageId, pagePath) { + this.pageId = pageId; + this.pagePath = pagePath; + this.batchData = []; + this.vms = Object.create(null); + this.initialized = false; + // 事件 + this.handlers = Object.create(null); + + this._init(); } - return { - errMsg: 'setStorage:ok' + + _init () { + registerWebviewUIEvent(this.pageId, (cid, nid, event) => { + console.log(`[EVENT]`, cid, nid, event); + if ( + this.handlers[cid] && + this.handlers[cid][nid] && + this.handlers[cid][nid][event.type] + ) { + this.handlers[cid][nid][event.type].forEach(handler => { + handler(event); + }); + } + }); } - } - function setStorageSync$1 (key, data) { - setStorage$1({ - key, - data - }); - } + getVm (id) { + return this.vms[id] + } - function getStorage$1 ({ - key - } = {}) { - const data = localStorage.getItem(key); - return data ? { - data: JSON.parse(data).data, - errMsg: 'getStorage:ok' - } : { - data: '', - errMsg: 'getStorage:fail' + addVm (vm) { + this.vms[vm._$id] = vm; } - } - function getStorageSync$1 (key) { - const res = getStorage$1({ - key - }); - return res.data - } + removeVm (vm) { + delete this.vms[vm._$id]; + } - function removeStorage$1 ({ - key - } = {}) { - const keyList = localStorage.getItem('uni-storage-keys'); - if (keyList) { - const keys = JSON.parse(keyList); - const index = keys.indexOf(key); - keys.splice(index, 1); - localStorage.setItem('uni-storage-keys', JSON.stringify(keys)); + addEvent (cid, nid, name, handler) { + const cHandlers = this.handlers[cid] || (this.handlers[cid] = Object.create(null)); + const nHandlers = cHandlers[nid] || (cHandlers[nid] = Object.create(null)); + (nHandlers[name] || (nHandlers[name] = [])).push(handler); } - localStorage.removeItem(key); - return { - errMsg: 'removeStorage:ok' + + removeEvent (cid, nid, name, handler) { + const cHandlers = this.handlers[cid] || (this.handlers[cid] = Object.create(null)); + const nHandlers = cHandlers[nid] || (cHandlers[nid] = Object.create(null)); + const eHandlers = nHandlers[name]; + if (Array.isArray(eHandlers)) { + const index = eHandlers.indexOf(handler); + if (index !== -1) { + eHandlers.splice(index, 1); + } + } } - } - function removeStorageSync$1 (key) { - removeStorage$1({ - key - }); - } + push (type, nodeId, data) { + this.batchData.push([type, [nodeId, data]]); + } - function clearStorage () { - localStorage.clear(); - return { - errMsg: 'clearStorage:ok' + flush () { + if (!this.initialized) { + this.initialized = true; + this.batchData.push([PAGE_CREATED, [this.pageId, this.pagePath]]); + } + if (this.batchData.length) { + UniServiceJSBridge.publishHandler('vdSync', { + data: this.batchData, + options: { + timestamp: Date.now() + } + }, [this.pageId]); + this.batchData.length = 0; + } } - } - function clearStorageSync () { - clearStorage(); + destroy () { + this.batchData.length = 0; + this.vms = Object.create(null); + this.initialized = false; + this.handlers = Object.create(null); + removeWebviewUIEvent(this.pageId); + } + } + + function setResult (data, k, v) { + data[k] = v; } - function getStorageInfo () { // TODO 暂时先不做大小的转换 - const keyList = localStorage.getItem('uni-storage-keys'); - return keyList ? { - keys: JSON.parse(keyList), - currentSize: 0, - limitSize: 0, - errMsg: 'getStorageInfo:ok' - } : { - keys: '', - currentSize: 0, - limitSize: 0, - errMsg: 'getStorageInfo:fail' + function diffObject (id, newObj, oldObj, result) { + let key, cur, old; + for (key in newObj) { + cur = newObj[key]; + old = oldObj[key]; + if (old !== cur) { + setResult(result[id] || (result[id] = {}), key, cur); + } } } - function getStorageInfoSync () { - const res = getStorageInfo(); - delete res.errMsg; - return res - } - - var require_context_module_1_15 = /*#__PURE__*/Object.freeze({ - setStorage: setStorage$1, - setStorageSync: setStorageSync$1, - getStorage: getStorage$1, - getStorageSync: getStorageSync$1, - removeStorage: removeStorage$1, - removeStorageSync: removeStorageSync$1, - clearStorage: clearStorage, - clearStorageSync: clearStorageSync, - getStorageInfo: getStorageInfo, - getStorageInfoSync: getStorageInfoSync - }); - - const defaultOption = { - duration: 400, - timingFunction: 'linear', - delay: 0, - transformOrigin: '50% 50% 0' - }; - - class MPAnimation { - constructor (option) { - this.actions = []; - this.currentTransform = {}; - this.currentStepAnimates = []; - this.option = Object.assign({}, defaultOption, option); - } - _getOption (option) { - let _option = { - transition: Object.assign({}, this.option, option) - }; - _option.transformOrigin = _option.transition.transformOrigin; - delete _option.transition.transformOrigin; - return _option - } - _pushAnimates (type, args) { - this.currentStepAnimates.push({ - type: type, - args: args - }); - } - _converType (type) { - return type.replace(/[A-Z]/g, text => { - return `-${text.toLowerCase()}` - }) - } - _getValue (value) { - return typeof value === 'number' ? `${value}px` : value - } - export () { - const actions = this.actions; - this.actions = []; - return { - actions - } - } - step (option) { - this.currentStepAnimates.forEach(animate => { - if (animate.type !== 'style') { - this.currentTransform[animate.type] = animate; - } else { - this.currentTransform[`${animate.type}.${animate.args[0]}`] = animate; - } - }); - this.actions.push({ - animates: Object.values(this.currentTransform), - option: this._getOption(option) - }); - this.currentStepAnimates = []; - return this - } - } - - const animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d', 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY', 'translateZ']; - const animateTypes2 = ['opacity', 'backgroundColor']; - const animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom']; - animateTypes1.concat(animateTypes2, animateTypes3).forEach(type => { - MPAnimation.prototype[type] = function (...args) { - if (animateTypes2.concat(animateTypes3).includes(type)) { - this._pushAnimates('style', [this._converType(type), animateTypes3.includes(type) ? this._getValue(args[0]) : args[0]]); - } else { - this._pushAnimates(type, args); - } - return this - }; - }); - - function createAnimation (option) { - return new MPAnimation(option) + function diff (newData, oldData) { + const result = Object.create(null); + let id, cur, old; + for (id in newData) { + cur = newData[id]; + old = oldData[id]; + if (!old) { + setResult(result, id, cur); + continue + } + diffObject(id, cur, old, result); + } + return result } - var require_context_module_1_16 = /*#__PURE__*/Object.freeze({ - createAnimation: createAnimation - }); - - const callbacks$7 = []; - - onMethod('onKeyboardHeightChange', res => { - callbacks$7.forEach(callbackId => { - invoke(callbackId, res); + function initData (Vue) { + Vue.prototype._$s = setData; + Vue.prototype._$i = setIfData; + Vue.prototype._$f = setForData; + Vue.prototype._$e = setElseIfData; + + Vue.prototype._$setData = function setData (type, data) { + this._$vd.push(type, this._$id, data); + this._$vd.initialized && this.$nextTick(this._$vd.flush.bind(this._$vd)); + }; + + Object.defineProperty(Vue.prototype, '_$vd', { + get () { + return this.$root._$vdomSync + } + }); + + Vue.mixin({ + beforeCreate () { + if (this.$options.mpType) { + this.mpType = this.$options.mpType; + } + if (this.mpType === 'app') { + return + } + if (this.mpType === 'page') { + this._$vdomSync = new VDomSync(this.$options.pageId, this.$options.pagePath); + } + if (this._$vd) { + this._$id = guid(); + this._$vd.addVm(this); + console.log(`[${this._$id}] beforeCreate ` + Date.now()); + // 目前全量采集做 diff(iOS 需要保留全量状态做 restore),理论上可以差量采集 + this._$data = Object.create(null); + this._$newData = Object.create(null); + } + }, + mounted () { + if (!this._$vd) { + return + } + const diffData = diff(this._$newData, this._$data); + this._$data = JSON.parse(JSON.stringify(this._$newData)); + console.log(`[${this._$id}] mounted ` + Date.now()); + this._$setData(MOUNTED_DATA, diffData); + if (this.mpType === 'page') { + // 页面 mounted 之后,第一次同步数据 + this._$vd.flush(); + } + }, + beforeUpdate () { + if (!this._$vd) { + return + } + console.log(`[${this._$id}] beforeUpdate ` + Date.now()); + this._$newData = Object.create(null); + }, + updated () { + if (!this._$vd) { + return + } + const diffData = diff(this._$newData, this._$data); + this._$data = JSON.parse(JSON.stringify(this._$newData)); + console.log(`[${this._$id}] updated ` + Date.now()); + this._$setData(UPDATED_DATA, diffData); + }, + beforeDestroy () { + if (!this._$vd) { + return + } + this._$vd.removeVm(this); + this._$vdomSync && this._$vdomSync.destory(); + } }); - }); + } - function onKeyboardHeightChange (callbackId) { - callbacks$7.push(callbackId); - } - - var require_context_module_1_17 = /*#__PURE__*/Object.freeze({ - onKeyboardHeightChange: onKeyboardHeightChange - }); - - function pageScrollTo$1 (args) { - const pages = getCurrentPages(); - if (pages.length) { - UniServiceJSBridge.publishHandler('pageScrollTo', args, pages[pages.length - 1].$page.id); + function setData (id, name, value) { + const diffData = this._$newData[id] || (this._$newData[id] = {}); + + if (typeof name !== 'string') { + for (let key in name) { + diffData[key] = name[key]; + } + return name } - return {} - } - - var require_context_module_1_18 = /*#__PURE__*/Object.freeze({ - pageScrollTo: pageScrollTo$1 - }); - - function removeTabBarBadge$1 ({ - index - }) { - return invokeMethod('setTabBarBadge', { - index, - type: 'none' - }) - } - function showTabBarRedDot$1 ({ - index - }) { - return invokeMethod('setTabBarBadge', { - index, - type: 'redDot' - }) + if (name === 'a-_i') { + return value + } + return (diffData[name] = value) } - const hideTabBarRedDot$1 = removeTabBarBadge$1; + function setForData (id, value) { + const { + forIndex, + key + } = value; - const callbacks$8 = []; + const diffData = this._$newData[id] || (this._$newData[id] = {}); + const vForData = diffData['v-for'] || (diffData['v-for'] = []); + if (!hasOwn(value, 'keyIndex')) { + vForData[forIndex] = key; + } else { + (vForData[forIndex] || (vForData[forIndex] = {}))['k' + value.keyIndex] = key; + } + return key + } - onMethod('onTabBarMidButtonTap', res => { - callbacks$8.forEach(callbackId => { - invoke(callbackId, res); - }); - }); + function setIfData (id, value) { + return ((this._$newData[id] || (this._$newData[id] = {}))['v-if'] = value) + } - function onTabBarMidButtonTap (callbackId) { - callbacks$8.push(callbackId); + function setElseIfData (id, value) { + return ((this._$newData[id] || (this._$newData[id] = {}))['v-else-if'] = value) } - var require_context_module_1_19 = /*#__PURE__*/Object.freeze({ - removeTabBarBadge: removeTabBarBadge$1, - showTabBarRedDot: showTabBarRedDot$1, - hideTabBarRedDot: hideTabBarRedDot$1, - onTabBarMidButtonTap: onTabBarMidButtonTap - }); - - const callbacks$9 = []; - onMethod('onViewDidResize', res => { - callbacks$9.forEach(callbackId => { - invoke(callbackId, res); - }); - }); + /* @flow */ - function onWindowResize (callbackId) { - callbacks$9.push(callbackId); - } + const LIFECYCLE_HOOKS = [ + // App + 'onLaunch', + 'onShow', + 'onHide', + 'onUniNViewMessage', + 'onError', + // Page + 'onLoad', + // 'onShow', + 'onReady', + // 'onHide', + 'onUnload', + 'onPullDownRefresh', + 'onReachBottom', + 'onTabItemTap', + 'onShareAppMessage', + 'onResize', + 'onPageScroll', + 'onNavigationBarButtonTap', + 'onBackPress', + 'onNavigationBarSearchInputChanged', + 'onNavigationBarSearchInputConfirmed', + 'onNavigationBarSearchInputClicked', + // Component + // 'onReady', // 兼容旧版本,应该移除该事件 + 'onPageShow', + 'onPageHide', + 'onPageResize' + ]; + function lifecycleMixin (Vue) { + // fixed vue-class-component + const oldExtend = Vue.extend; + Vue.extend = function (extendOptions) { + extendOptions = extendOptions || {}; - function offWindowResize (callbackId) { - // 此处和微信平台一致查询不到去掉最后一个 - callbacks$9.splice(callbacks$9.indexOf(callbackId), 1); + const methods = extendOptions.methods; + if (methods) { + Object.keys(methods).forEach(methodName => { + if (LIFECYCLE_HOOKS.indexOf(methodName) !== -1) { + extendOptions[methodName] = methods[methodName]; + delete methods[methodName]; + } + }); + } + + return oldExtend.call(this, extendOptions) + }; + + const strategies = Vue.config.optionMergeStrategies; + const mergeHook = strategies.created; + LIFECYCLE_HOOKS.forEach(hook => { + strategies[hook] = mergeHook; + }); } - var require_context_module_1_20 = /*#__PURE__*/Object.freeze({ - onWindowResize: onWindowResize, - offWindowResize: offWindowResize - }); - - const api$1 = Object.create(null); - - const modules$1 = - (function() { - var map = { - './base/base64.js': require_context_module_1_0, - './base/can-i-use.js': require_context_module_1_1, - './base/interceptor.js': require_context_module_1_2, - './base/upx2px.js': require_context_module_1_3, - './context/audio.js': require_context_module_1_4, - './context/background-audio.js': require_context_module_1_5, - './device/accelerometer.js': require_context_module_1_6, - './device/bluetooth.js': require_context_module_1_7, - './device/compass.js': require_context_module_1_8, - './device/network.js': require_context_module_1_9, - './media/recorder.js': require_context_module_1_10, - './network/download-file.js': require_context_module_1_11, - './network/request.js': require_context_module_1_12, - './network/socket.js': require_context_module_1_13, - './network/upload-file.js': require_context_module_1_14, - './storage/storage.js': require_context_module_1_15, - './ui/create-animation.js': require_context_module_1_16, - './ui/keyboard.js': require_context_module_1_17, - './ui/page-scroll-to.js': require_context_module_1_18, - './ui/tab-bar.js': require_context_module_1_19, - './ui/window.js': require_context_module_1_20, - - }; - var req = function req(key) { - return map[key] || (function() { throw new Error("Cannot find module '" + key + "'.") }()); - }; - req.keys = function() { - return Object.keys(map); - }; - return req; - })(); - - - modules$1.keys().forEach(function (key) { - Object.assign(api$1, modules$1(key)); - }); - - var api$2 = Object.assign(Object.create(null), api$1, platformApi); - - const uni$1 = Object.create(null); + var vuePlugin = { + install (Vue, options) { + initVue(Vue); - apis_1.forEach(name => { - if (api$2[name]) { - uni$1[name] = promisify(name, wrapper(name, api$2[name])); - } else { - uni$1[name] = wrapperUnimplemented(name); - } - }); - - function publishHandler (eventType, args, pageIds) { - args = JSON.stringify(args); - if (process.env.NODE_ENV !== 'production') { - console.log(`UNIAPP[publishHandler]:[${+new Date()}]`, eventType, args, pageIds); - } - if (!Array.isArray(pageIds)) { - pageIds = [pageIds]; + initData(Vue); + lifecycleMixin(Vue); + + const oldMount = Vue.prototype.$mount; + Vue.prototype.$mount = function mount (el, hydrating) { + if (this.mpType === 'app') { + this.$options.render = function () {}; + registerApp(this); + } + return oldMount.call(this, el, hydrating) + }; } - const evalJSCode = - `typeof UniViewJSBridge !== 'undefined' && UniViewJSBridge.subscribeHandler("${eventType}",${args})`; - pageIds.forEach(id => { - const webview = plus.webview.getWebviewById(String(id)); - webview && webview.evalJS(evalJSCode); - }); - } + }; UniServiceJSBridge.publishHandler = publishHandler; UniServiceJSBridge.invokeCallbackHandler = invokeCallbackHandler; var index = { - __registerConfig: registerConfig, + __vuePlugin: vuePlugin, + __definePage: definePage, __registerApp: registerApp, - __registerPage: definePage, + __registerPage: registerPage, uni: uni$1, getApp, getCurrentPages: getCurrentPages$1 @@ -9189,7 +9258,9 @@ var uni = serviceContext.uni var getApp = serviceContext.getApp var getCurrentPages = serviceContext.getCurrentPages +var __definePage = serviceContext.__definePage var __registerPage = serviceContext.__registerPage + return serviceContext } diff --git a/packages/uni-app-plus/dist/service.runtime.esm.js b/packages/uni-app-plus/dist/service.runtime.esm.js index ea6f1a289..487d4cf10 100644 --- a/packages/uni-app-plus/dist/service.runtime.esm.js +++ b/packages/uni-app-plus/dist/service.runtime.esm.js @@ -6719,7 +6719,7 @@ function updateExtras(oldVnode, vnode) { if (attrs) { for (var key$1 in attrs) { - key$1 !== '_i' && $s(id, key$1, attrs[key$1]); + key$1 !== '_i' && $s(id, 'a-' + key$1, attrs[key$1]); } } // 存储事件标记 diff --git a/packages/uni-app-plus/dist/view.css b/packages/uni-app-plus/dist/view.css index 81ec94f30..8abb27c84 100644 --- a/packages/uni-app-plus/dist/view.css +++ b/packages/uni-app-plus/dist/view.css @@ -1 +1,1394 @@ -*{margin:0;-webkit-tap-highlight-color:transparent}@font-face{font-weight:400;font-style:normal;font-family:uni;src:url("data:application/octet-stream;base64,AAEAAAALAIAAAwAwR1NVQrD+s+0AAAE4AAAAQk9TLzJAKEx+AAABfAAAAFZjbWFw65cFHQAAAhwAAAJQZ2x5ZvCRR/EAAASUAAAKtGhlYWQLKIN9AAAA4AAAADZoaGVhCCwD+gAAALwAAAAkaG10eEJo//8AAAHUAAAASGxvY2EYqhW6AAAEbAAAACZtYXhwASEAVQAAARgAAAAgbmFtZeNcHtgAAA9IAAAB5nBvc3T6bLhLAAARMAAAAOYAAQAAA+gAAABaA+j/////A+kAAQAAAAAAAAAAAAAAAAAAABIAAQAAAAEAACkCj3dfDzz1AAsD6AAAAADUER9XAAAAANQRH1f//wAAA+kD6gAAAAgAAgAAAAAAAAABAAAAEgBJAAUAAAAAAAIAAAAKAAoAAAD/AAAAAAAAAAEAAAAKAB4ALAABREZMVAAIAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAAAAQOwAZAABQAIAnoCvAAAAIwCegK8AAAB4AAxAQIAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABA6gHqEQPoAAAAWgPqAAAAAAABAAAAAAAAAAAAAAPoAAAD6AAAA+gAAAPoAAAD6AAAA+gAAAPoAAAD6AAAA+gAAAPoAAAD6AAAA+gAAAPoAAAD6AAAA+j//wPoAAAD6AAAAAAABQAAAAMAAAAsAAAABAAAAXQAAQAAAAAAbgADAAEAAAAsAAMACgAAAXQABABCAAAABAAEAAEAAOoR//8AAOoB//8AAAABAAQAAAABAAIAAwAEAAUABgAHAAgACQAKAAsADAANAA4ADwAQABEAAAEGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAANwAAAAAAAAAEQAA6gEAAOoBAAAAAQAA6gIAAOoCAAAAAgAA6gMAAOoDAAAAAwAA6gQAAOoEAAAABAAA6gUAAOoFAAAABQAA6gYAAOoGAAAABgAA6gcAAOoHAAAABwAA6ggAAOoIAAAACAAA6gkAAOoJAAAACQAA6goAAOoKAAAACgAA6gsAAOoLAAAACwAA6gwAAOoMAAAADAAA6g0AAOoNAAAADQAA6g4AAOoOAAAADgAA6g8AAOoPAAAADwAA6hAAAOoQAAAAEAAA6hEAAOoRAAAAEQAAAAAARgCMANIBJgF4AcQCMgJgAqgC/ANIA6YD/gROBKAE9AVaAAAAAgAAAAADrwOtABQAKQAAASIHBgcGFBcWFxYyNzY3NjQnJicmAyInJicmNDc2NzYyFxYXFhQHBgcGAfV4Z2Q7PDw7ZGfwZmQ7PDw7ZGZ4bl5bNjc3Nlte215bNjc3NlteA608O2Rn8GdjOzw8O2Nn8GdkOzz8rzc1W17bXlw1Nzc1XF7bXls1NwAAAAACAAAAAAOzA7MAFwAtAAABIgcGBwYVFBcWFxYzMjc2NzY1NCcmJyYTBwYiLwEmNjsBETQ2OwEyFhURMzIWAe52Z2Q7PT07ZGd2fGpmOz4+O2ZpIXYOKA52Dg0XXQsHJgcLXRcNA7M+O2ZqfHZnZDs9PTtkZ3Z9aWY7Pv3wmhISmhIaARcICwsI/ukaAAMAAAAAA+UD5QAXACMALAAAASIHBgcGFRQXFhcWMzI3Njc2NTQnJicmAxQrASI1AzQ7ATIHJyImNDYyFhQGAe6Ecm9BRERBb3KEiXZxQkREQnF1aQIxAwgCQgMBIxIZGSQZGQPkREJxdomEcm9BRERBb3KEinVxQkT9HQICAWICAjEZIxkZIxkAAAAAAwAAAAADsQPkABsAKgAzAAABBgcGBwYHBjcRFBcWFxYXNjc2NzY1ESQXJicmBzMyFhUDFAYrASInAzQ2EyImNDYyFhQGAfVBQTg7LDt/IEc+bF5sbF1tPUj+2KhQQVVvNAQGDAMCJgUBCwYeDxYWHhUVA+QPEg4SDhIpCv6tj3VkST4dHT5JZHWPAVNeNRkSGPwGBP7GAgMFAToEBv5AFR8VFR8VAAAAAgAAAAADsQPkABkALgAAAQYHBgc2BREUFxYXFhc2NzY3NjURJBcmJyYTAQYvASY/ATYyHwEWNjclNjIfARYB9VVVQk+v/tFHPmxebGxdbT1I/tGvT0JVo/7VBASKAwMSAQUBcQEFAgESAgUBEQQD4xMYEhk3YP6sjnVlSD8cHD9IZXWOAVRgNxkSGP62/tkDA48EBBkCAVYCAQHlAQIQBAAAAAACAAAAAAPkA+QAFwAtAAABIgcGBwYVFBcWFxYzMjc2NzY1NCcmJyYTAQYiLwEmPwE2Mh8BFjI3ATYyHwEWAe6Ecm9BQ0NCbnODiXVxQkREQnF1kf6gAQUBowMDFgEFAYUCBQEBQwIFARUEA+NEQnF1iYNzbkJDQ0FvcoSJdXFCRP6j/qUBAagEBR4CAWYBAQENAgIVBAAAAAQAAAAAA68DrQAUACkAPwBDAAABIgcGBwYUFxYXFjI3Njc2NCcmJyYDIicmJyY0NzY3NjIXFhcWFAcGBwYTBQ4BLwEmBg8BBhYfARYyNwE+ASYiFzAfAQH1eGdkOzw8O2Rn8GZkOzw8O2RmeG5eWzY3NzZbXtteWzY3NzZbXmn+9gYSBmAGDwUDBQEGfQUQBgElBQELEBUBAQOtPDtkZ/BnYzs8PDtjZ/BnZDs8/K83NVte215cNTc3NVxe215bNTcCJt0FAQVJBQIGBAcRBoAGBQEhBQ8LBAEBAAABAAAAAAO7AzoAFwAAEy4BPwE+AR8BFjY3ATYWFycWFAcBBiInPQoGBwUHGgzLDCELAh0LHwsNCgr9uQoeCgGzCyEOCw0HCZMJAQoBvgkCCg0LHQv9sQsKAAAAAAIAAAAAA+UD5gAXACwAAAEiBwYHBhUUFxYXFjMyNzY3NjU0JyYnJhMHBi8BJicmNRM0NjsBMhYVExceAQHvhHJvQUNDQm5zg4l1cUJEREJxdVcQAwT6AwIEEAMCKwIDDsUCAQPlREJxdYmDc25CQ0NBb3KEiXVxQkT9VhwEAncCAgMGAXoCAwMC/q2FAgQAAAQAAAAAA68DrQADABgALQAzAAABMB8BAyIHBgcGFBcWFxYyNzY3NjQnJicmAyInJicmNDc2NzYyFxYXFhQHBgcGAyMVMzUjAuUBAfJ4Z2Q7PDw7ZGfwZmQ7PDw7ZGZ4bl5bNjc3Nlte215bNjc3NltemyT92QKDAQEBLDw7ZGfwZ2M7PDw7Y2fwZ2Q7PPyvNzVbXtteXDU3NzVcXtteWzU3AjH9JAAAAAMAAAAAA+QD5AAXACcAMAAAASIHBgcGFRQXFhcWMzI3Njc2NTQnJicmAzMyFhUDFAYrASImNQM0NhMiJjQ2MhYUBgHuhHJvQUNDQm5zg4l1cUJEREJxdZ42BAYMAwInAwMMBh8PFhYeFhYD40RCcXWJg3NuQkNDQW9yhIl1cUJE/vYGBf7AAgMDAgFABQb+NhYfFhYfFgAABAAAAAADwAPAAAgAEgAoAD0AAAEyNjQmIgYUFhcjFTMRIxUzNSMDIgcGBwYVFBYXFjMyNzY3NjU0Jy4BAyInJicmNDc2NzYyFxYXFhQHBgcGAfQYISEwISFRjzk5yTorhG5rPT99am+DdmhlPD4+PMyFbV5bNTc3NVte2l5bNTc3NVteAqAiLyIiLyI5Hf7EHBwCsT89a26Ed8w8Pj48ZWh2g29qffyjNzVbXtpeWzU3NzVbXtpeWzU3AAADAAAAAAOoA6gACwAgADUAAAEHJwcXBxc3FzcnNwMiBwYHBhQXFhcWMjc2NzY0JyYnJgMiJyYnJjQ3Njc2MhcWFxYUBwYHBgKOmpocmpocmpocmpq2dmZiOjs7OmJm7GZiOjs7OmJmdmtdWTQ2NjRZXdZdWTQ2NjRZXQKqmpocmpocmpocmpoBGTs6YmbsZmI6Ozs6YmbsZmI6O/zCNjRZXdZdWTQ2NjRZXdZdWTQ2AAMAAAAAA+kD6gAaAC8AMAAAAQYHBiMiJyYnJjQ3Njc2MhcWFxYVFAcGBwEHATI3Njc2NCcmJyYiBwYHBhQXFhcWMwKONUBCR21dWjU3NzVaXdpdWzU2GBcrASM5/eBXS0grKysrSEuuSkkqLCwqSUpXASMrFxg2NVtd2l1aNTc3NVpdbUdCQDX+3jkBGSsrSEuuSkkqLCwqSUquS0grKwAC//8AAAPoA+gAFAAwAAABIgcGBwYQFxYXFiA3Njc2ECcmJyYTFg4BIi8BBwYuATQ/AScmPgEWHwE3Nh4BBg8BAfSIdHFDRERDcXQBEHRxQ0REQ3F0SQoBFBsKoqgKGxMKqKIKARQbCqKoChsUAQqoA+hEQ3F0/vB0cUNERENxdAEQdHFDRP1jChsTCqiiCgEUGwqiqAobFAEKqKIKARQbCqIAAAIAAAAAA+QD5AAXADQAAAEiBwYHBhUUFxYXFjMyNzY3NjU0JyYnJhMUBiMFFxYUDwEGLwEuAT8BNh8BFhQPAQUyFh0BAe6Ecm9BQ0NCbnODiXVxQkREQnF1fwQC/pGDAQEVAwTsAgEC7AQEFAIBhAFwAgMD40RCcXWJg3NuQkNDQW9yhIl1cUJE/fYCAwuVAgQCFAQE0AIFAtEEBBQCBQGVCwMDJwAAAAUAAAAAA9QD0wAjACcANwBHAEgAAAERFAYjISImNREjIiY9ATQ2MyE1NDYzITIWHQEhMhYdARQGIyERIREHIgYVERQWOwEyNjURNCYjISIGFREUFjsBMjY1ETQmKwEDeyYb/XYbJkMJDQ0JAQYZEgEvExkBBgkNDQn9CQJc0QkNDQktCQ0NCf7sCQ0NCS0JDQ0JLQMi/TQbJiYbAswMCiwJDS4SGRkSLg0JLAoM/UwCtGsNCf5NCQ0NCQGzCQ0NCf5NCQ0NCQGzCQ0AAAAAEADGAAEAAAAAAAEABAAAAAEAAAAAAAIABwAEAAEAAAAAAAMABAALAAEAAAAAAAQABAAPAAEAAAAAAAUACwATAAEAAAAAAAYABAAeAAEAAAAAAAoAKwAiAAEAAAAAAAsAEwBNAAMAAQQJAAEACABgAAMAAQQJAAIADgBoAAMAAQQJAAMACAB2AAMAAQQJAAQACAB+AAMAAQQJAAUAFgCGAAMAAQQJAAYACACcAAMAAQQJAAoAVgCkAAMAAQQJAAsAJgD6d2V1aVJlZ3VsYXJ3ZXVpd2V1aVZlcnNpb24gMS4wd2V1aUdlbmVyYXRlZCBieSBzdmcydHRmIGZyb20gRm9udGVsbG8gcHJvamVjdC5odHRwOi8vZm9udGVsbG8uY29tAHcAZQB1AGkAUgBlAGcAdQBsAGEAcgB3AGUAdQBpAHcAZQB1AGkAVgBlAHIAcwBpAG8AbgAgADEALgAwAHcAZQB1AGkARwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABzAHYAZwAyAHQAdABmACAAZgByAG8AbQAgAEYAbwBuAHQAZQBsAGwAbwAgAHAAcgBvAGoAZQBjAHQALgBoAHQAdABwADoALwAvAGYAbwBuAHQAZQBsAGwAbwAuAGMAbwBtAAAAAgAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAQIBAwEEAQUBBgEHAQgBCQEKAQsBDAENAQ4BDwEQAREBEgETAAZjaXJjbGUIZG93bmxvYWQEaW5mbwxzYWZlX3N1Y2Nlc3MJc2FmZV93YXJuB3N1Y2Nlc3MOc3VjY2Vzcy1jaXJjbGURc3VjY2Vzcy1uby1jaXJjbGUHd2FpdGluZw53YWl0aW5nLWNpcmNsZQR3YXJuC2luZm8tY2lyY2xlBmNhbmNlbAZzZWFyY2gFY2xlYXIEYmFjawZkZWxldGUAAAAA") format("truetype")}@font-face{font-weight:400;font-style:normal;font-family:unibtn;src:url("data:application/octet-stream;base64,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") format("truetype")}body,html{-webkit-user-select:none;user-select:none;width:100%;height:100%}body{overflow-x:hidden}[class*=" uni-icon-"],[class^=uni-icon-]{display:inline-block;vertical-align:middle;font:normal normal normal 14px/1 uni;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased}[class*=" uni-btn-icon"],[class^=uni-btn-icon]{display:inline-block;font:normal normal normal 14px/1 unibtn;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased}[class*=" uni-btn-icon"]:before,[class^=uni-btn-icon]:before{margin:0;box-sizing:border-box}.uni-icon-success-no-circle:before{content:"\EA08"}.uni-loading,uni-button[loading]:before{background:rgba(0,0,0,0) url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoMTIwIDU4LjY2IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0IyQjJCMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgxNTAgNTQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjQkFCOEI5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDE4MCA1MCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDMkMwQzEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTE1MCA0NS45OCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDQkNCQ0IiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTEyMCA0MS4zNCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNEMkQyRDIiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDM1IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0RBREFEQSIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtNjAgMjQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTJFMkUyIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKC0zMCAtNS45OCA2NSkiLz48L3N2Zz4=") no-repeat}.uni-loading{width:20px;height:20px;display:inline-block;vertical-align:middle;-webkit-animation:uni-loading 1s steps(12) infinite;animation:uni-loading 1s steps(12) infinite;background-size:100%}@-webkit-keyframes uni-loading{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes uni-loading{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.uni-mask{position:fixed;z-index:999;top:0;right:0;left:0;bottom:0;background:rgba(0,0,0,.6)}.uni-fade-enter-active,.uni-fade-leave-active{-webkit-transition-duration:.25s;transition-duration:.25s;-webkit-transition-property:opacity;transition-property:opacity;-webkit-transition-timing-function:ease;transition-timing-function:ease}.uni-fade-enter,.uni-fade-leave-active{opacity:0}[nvue] uni-scroll-view,[nvue] uni-swiper-item,[nvue] uni-view{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-shrink:0;flex-shrink:0;-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0;-webkit-flex-basis:auto;flex-basis:auto;-webkit-box-align:stretch;-webkit-align-items:stretch;align-items:stretch;-webkit-align-content:flex-start;align-content:flex-start}[nvue-dir-row] uni-swiper-item,[nvue-dir-row] uni-view{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row}[nvue-dir-column] uni-swiper-item,[nvue-dir-column] uni-view{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column}[nvue-dir-row-reverse] uni-swiper-item,[nvue-dir-row-reverse] uni-view{-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-webkit-flex-direction:row-reverse;flex-direction:row-reverse}[nvue-dir-column-reverse] uni-swiper-item,[nvue-dir-column-reverse] uni-view{-webkit-box-orient:vertical;-webkit-box-direction:reverse;-webkit-flex-direction:column-reverse;flex-direction:column-reverse}[nvue] uni-image,[nvue] uni-input,[nvue] uni-scroll-view,[nvue] uni-swiper,[nvue] uni-swiper-item,[nvue] uni-text,[nvue] uni-textarea,[nvue] uni-video,[nvue] uni-view{position:relative;border:0 solid #000;box-sizing:border-box}[nvue] uni-swiper-item{position:absolute}uni-button{position:relative;display:block;margin-left:auto;margin-right:auto;padding-left:14px;padding-right:14px;box-sizing:border-box;font-size:18px;text-align:center;text-decoration:none;line-height:2.55555556;border-radius:5px;-webkit-tap-highlight-color:transparent;overflow:hidden;color:#000;background-color:#f8f8f8}uni-button[hidden]{display:none!important}uni-button:after{content:" ";width:200%;height:200%;position:absolute;top:0;left:0;border:1px solid rgba(0,0,0,.2);-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;box-sizing:border-box;border-radius:10px}uni-button[native]{padding-left:0;padding-right:0}uni-button[native] .uni-button-cover-view-wrapper{border:inherit;border-color:inherit;border-radius:inherit;background-color:inherit}uni-button[native] .uni-button-cover-view-inner{padding-left:14px;padding-right:14px}uni-button uni-cover-view{line-height:inherit;white-space:inherit}uni-button[type=default]{color:#000;background-color:#f8f8f8}uni-button[type=primary]{color:#fff;background-color:#007aff}uni-button[type=warn]{color:#fff;background-color:#e64340}uni-button[disabled]{color:hsla(0,0%,100%,.6)}uni-button[disabled]:not([type]),uni-button[disabled][type=default]{color:rgba(0,0,0,.3);background-color:#f7f7f7}uni-button[disabled][type=primary]{background-color:rgba(0,122,255,.6)}uni-button[disabled][type=warn]{background-color:#ec8b89}uni-button[type=primary][plain]{color:#007aff;border:1px solid #007aff;background-color:rgba(0,0,0,0)}uni-button[type=primary][plain][disabled]{color:rgba(0,0,0,.2);border-color:rgba(0,0,0,.2)}uni-button[type=primary][plain]:after{border-width:0}uni-button[type=default][plain]{color:#353535;border:1px solid #353535;background-color:rgba(0,0,0,0)}uni-button[type=default][plain][disabled]{color:rgba(0,0,0,.2);border-color:rgba(0,0,0,.2)}uni-button[type=default][plain]:after{border-width:0}uni-button[plain]{color:#353535;border:1px solid #353535;background-color:rgba(0,0,0,0)}uni-button[plain][disabled]{color:rgba(0,0,0,.2);border-color:rgba(0,0,0,.2)}uni-button[plain]:after{border-width:0}uni-button[plain][native] .uni-button-cover-view-inner{padding:0}uni-button[type=warn][plain]{color:#e64340;border:1px solid #e64340;background-color:rgba(0,0,0,0)}uni-button[type=warn][plain][disabled]{color:rgba(0,0,0,.2);border-color:rgba(0,0,0,.2)}uni-button[type=warn][plain]:after{border-width:0}uni-button[size=mini]{display:inline-block;line-height:2.3;font-size:13px;padding:0 1.34em}uni-button[size=mini][native]{padding:0}uni-button[size=mini][native] .uni-button-cover-view-inner{padding:0 1.34em}uni-button[loading]:before{content:" ";display:inline-block;width:18px;height:18px;vertical-align:middle;-webkit-animation:uni-loading 1s steps(12) infinite;animation:uni-loading 1s steps(12) infinite;background-size:100%}uni-button[loading][type=primary]{color:hsla(0,0%,100%,.6);background-color:#0062cc}uni-button[loading][type=primary][plain]{color:#007aff;background-color:rgba(0,0,0,0)}uni-button[loading][type=default]{color:rgba(0,0,0,.6);background-color:#dedede}uni-button[loading][type=default][plain]{color:#353535;background-color:rgba(0,0,0,0)}uni-button[loading][type=warn]{color:hsla(0,0%,100%,.6);background-color:#ce3c39}uni-button[loading][type=warn][plain]{color:#e64340;background-color:rgba(0,0,0,0)}uni-button[loading][native]:before{content:none}.button-hover{color:rgba(0,0,0,.6);background-color:#dedede}.button-hover[plain]{color:rgba(53,53,53,.6);border-color:rgba(53,53,53,.6);background-color:rgba(0,0,0,0)}.button-hover[type=primary]{color:hsla(0,0%,100%,.6);background-color:#0062cc}.button-hover[type=primary][plain]{color:rgba(26,173,25,.6);border-color:rgba(26,173,25,.6);background-color:rgba(0,0,0,0)}.button-hover[type=default]{color:rgba(0,0,0,.6);background-color:#dedede}.button-hover[type=default][plain]{color:rgba(53,53,53,.6);border-color:rgba(53,53,53,.6);background-color:rgba(0,0,0,0)}.button-hover[type=warn]{color:hsla(0,0%,100%,.6);background-color:#ce3c39}.button-hover[type=warn][plain]{color:rgba(230,67,64,.6);border-color:rgba(230,67,64,.6);background-color:rgba(0,0,0,0)}uni-canvas{width:300px;height:150px;display:block;position:relative}uni-canvas>canvas{position:absolute;top:0;left:0;width:100%;height:100%}uni-checkbox-group[hidden]{display:none}uni-checkbox{-webkit-tap-highlight-color:transparent;display:inline-block}uni-checkbox[hidden]{display:none}uni-checkbox .uni-checkbox-wrapper{display:-webkit-inline-flex;display:-webkit-inline-box;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;align-items:center;vertical-align:middle}uni-checkbox .uni-checkbox-input{margin-right:5px;-webkit-appearance:none;appearance:none;outline:0;border:1px solid #d1d1d1;background-color:#fff;border-radius:3px;width:22px;height:22px;position:relative}uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked{color:#007aff}uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked:before{font:normal normal normal 14px/1 uni;content:"\EA08";font-size:22px;position:absolute;top:50%;left:50%;transform:translate(-50%,-48%) scale(.73);-webkit-transform:translate(-50%,-48%) scale(.73)}uni-checkbox .uni-checkbox-input.uni-checkbox-input-disabled{background-color:#e1e1e1}uni-checkbox .uni-checkbox-input.uni-checkbox-input-disabled:before{color:#adadad}uni-checkbox-group{display:block}uni-icon{display:inline-block;font-size:0;box-sizing:border-box}uni-icon[hidden]{display:none}uni-icon>i{font:normal normal normal 14px/1 weui}uni-icon>i:before{margin:0;box-sizing:border-box}@font-face{font-weight:400;font-style:normal;font-family:weui;src:url("data:application/octet-stream;base64,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") format("truetype")}.uni-icon-success:before{content:"\EA06"}.uni-icon-success_circle:before{content:"\EA07"}.uni-icon-success_no_circle:before{content:"\EA08"}.uni-icon-safe_success:before{content:"\EA04"}.uni-icon-safe_warn:before{content:"\EA05"}.uni-icon-info:before{content:"\EA03"}.uni-icon-info_circle:before{content:"\EA0C"}.uni-icon-warn:before{content:"\EA0B"}.uni-icon-waiting:before{content:"\EA09"}.uni-icon-waiting_circle:before{content:"\EA0A"}.uni-icon-circle:before{content:"\EA01"}.uni-icon-cancel:before{content:"\EA0D"}.uni-icon-download:before{content:"\EA02"}.uni-icon-search:before{content:"\EA0E"}.uni-icon-clear:before{content:"\EA0F"}.uni-icon-safe_success,.uni-icon-success,.uni-icon-success_circle,.uni-icon-success_no_circle{color:#007aff}.uni-icon-safe_warn{color:#ffbe00}.uni-icon-info{color:#10aeff}.uni-icon-info_circle{color:#007aff}.uni-icon-warn{color:#f76260}.uni-icon-waiting,.uni-icon-waiting_circle{color:#10aeff}.uni-icon-circle{color:#c9c9c9}.uni-icon-cancel{color:#f43530}.uni-icon-download{color:#007aff}.uni-icon-clear,.uni-icon-search{color:#b2b2b2}uni-image{width:320px;height:240px;display:inline-block;overflow:hidden;position:relative}uni-image[hidden]{display:none}uni-image>div,uni-image>img{width:100%;height:100%}uni-image>img{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;display:block;position:absolute;top:0;left:0;opacity:0}uni-image>.uni-image-will-change{will-change:transform}uni-input{display:block;font-size:16px;line-height:1.4em;height:1.4em;min-height:1.4em;overflow:hidden}uni-input[hidden]{display:none}.uni-input-form,.uni-input-input,.uni-input-placeholder,.uni-input-wrapper{outline:none;border:none;padding:0;margin:0;text-decoration:inherit}.uni-input-form,.uni-input-wrapper{display:block;position:relative;width:100%;height:100%}.uni-input-input,.uni-input-placeholder{width:100%}.uni-input-placeholder{position:absolute;top:50%;left:0;-webkit-transform:translateY(-50%);transform:translateY(-50%);color:grey;overflow:hidden;text-overflow:clip;white-space:pre;word-break:keep-all;pointer-events:none}.uni-input-input{display:block;height:100%;background:none;color:inherit;opacity:1;-webkit-text-fill-color:currentcolor;font:inherit;line-height:inherit;letter-spacing:inherit;text-align:inherit;text-indent:inherit;text-transform:inherit;text-shadow:inherit}.uni-input-input[type=search]::-webkit-search-cancel-button{display:none}.uni-input-input::-webkit-inner-spin-button,.uni-input-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.uni-input-input[type=number]{-moz-appearance:textfield}uni-movable-area{display:block;position:relative;width:10px;height:10px}uni-movable-area[hidden]{display:none}uni-movable-view{display:inline-block;width:10px;height:10px;top:0;left:0;position:absolute}uni-movable-view[hidden]{display:none}.navigator-hover{background-color:rgba(0,0,0,.1);opacity:.7}uni-navigator{height:auto;width:auto;display:block}uni-navigator[hidden]{display:none}uni-picker-view-column{-webkit-flex:1;-webkit-box-flex:1;flex:1;position:relative;height:100%;overflow:hidden}uni-picker-view-column[hidden]{display:none}.uni-picker-view-group{height:100%}.uni-picker-view-mask{transform:translateZ(0);-webkit-transform:translateZ(0);top:0;height:100%;margin:0 auto;background:-webkit-linear-gradient(top,hsla(0,0%,100%,.95),hsla(0,0%,100%,.6)),-webkit-linear-gradient(bottom,hsla(0,0%,100%,.95),hsla(0,0%,100%,.6));background:linear-gradient(180deg,hsla(0,0%,100%,.95),hsla(0,0%,100%,.6)),linear-gradient(0deg,hsla(0,0%,100%,.95),hsla(0,0%,100%,.6));background-position:top,bottom;background-size:100% 102px;background-repeat:no-repeat}.uni-picker-view-indicator{height:34px;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.uni-picker-view-indicator,.uni-picker-view-mask{position:absolute;left:0;width:100%;z-index:3;pointer-events:none}.uni-picker-view-content{position:absolute;top:0;left:0;width:100%;will-change:transform;padding:102px 0}.uni-picker-view-content>*{height:34px;overflow:hidden}.uni-picker-view-indicator:before{top:0;border-top:1px solid #e5e5e5;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.uni-picker-view-indicator:after{bottom:0;border-bottom:1px solid #e5e5e5;-webkit-transform-origin:0 100%;transform-origin:0 100%;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.uni-picker-view-indicator:after,.uni-picker-view-indicator:before{content:" ";position:absolute;left:0;right:0;height:1px;color:#e5e5e5}uni-picker-view{display:block}uni-picker-view .uni-picker-view-wrapper{display:-webkit-box;display:-webkit-flex;display:flex;position:relative;overflow:hidden;height:100%}uni-picker-view[hidden]{display:none}uni-picker{display:block}uni-progress{display:-webkit-flex;display:-webkit-box;display:flex;-webkit-align-items:center;-webkit-box-align:center;align-items:center}uni-progress[hidden]{display:none}.uni-progress-bar{-webkit-flex:1;-webkit-box-flex:1;flex:1}.uni-progress-inner-bar{width:0;height:100%}.uni-progress-info{margin-top:0;margin-bottom:0;min-width:2em;margin-left:15px;font-size:16px}uni-radio-group[hidden]{display:none}uni-radio{-webkit-tap-highlight-color:transparent;display:inline-block}uni-radio[hidden]{display:none}uni-radio .uni-radio-wrapper{display:-webkit-inline-flex;display:-webkit-inline-box;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;align-items:center;vertical-align:middle}uni-radio .uni-radio-input{-webkit-appearance:none;appearance:none;margin-right:5px;outline:0;border:1px solid #d1d1d1;background-color:#fff;border-radius:50%;width:22px;height:22px;position:relative}uni-radio .uni-radio-input.uni-radio-input-checked:before{font:normal normal normal 14px/1 uni;content:"\EA08";color:#fff;font-size:18px;position:absolute;top:50%;left:50%;transform:translate(-50%,-48%) scale(.73);-webkit-transform:translate(-50%,-48%) scale(.73)}uni-radio .uni-radio-input.uni-radio-input-disabled{background-color:#e1e1e1;border-color:#d1d1d1}uni-radio .uni-radio-input.uni-radio-input-disabled:before{color:#adadad}uni-radio-group{display:block}@-webkit-keyframes once-show{0%{top:0}}@keyframes once-show{0%{top:0}}uni-resize-sensor,uni-resize-sensor>div{position:absolute;left:0;top:0;right:0;bottom:0;overflow:hidden}uni-resize-sensor{display:block;z-index:-1;visibility:hidden;-webkit-animation:once-show 1ms;animation:once-show 1ms}uni-resize-sensor>div>div{position:absolute;left:0;top:0}uni-resize-sensor>div:first-child>div{width:100000px;height:100000px}uni-resize-sensor>div:last-child>div{width:200%;height:200%}uni-scroll-view{display:block;width:100%}uni-scroll-view[hidden]{display:none}.uni-scroll-view{position:relative;-webkit-overflow-scrolling:touch;width:100%;height:100%;max-height:inherit}uni-slider{margin:10px 18px;padding:0;display:block}uni-slider[hidden]{display:none}uni-slider .uni-slider-wrapper{display:-webkit-flex;display:-webkit-box;display:flex;-webkit-align-items:center;-webkit-box-align:center;align-items:center;min-height:16px}uni-slider .uni-slider-tap-area{-webkit-flex:1;-webkit-box-flex:1;flex:1;padding:8px 0}uni-slider .uni-slider-handle-wrapper{position:relative;height:2px;border-radius:5px;background-color:#e9e9e9;cursor:pointer;-webkit-tap-highlight-color:transparent}uni-slider .uni-slider-handle-wrapper,uni-slider .uni-slider-track{-webkit-transition:background-color .3s ease;transition:background-color .3s ease}uni-slider .uni-slider-track{height:100%;border-radius:6px;background-color:#007aff}uni-slider .uni-slider-handle,uni-slider .uni-slider-thumb{position:absolute;left:50%;top:50%;cursor:pointer;border-radius:50%;-webkit-transition:border-color .3s ease;transition:border-color .3s ease}uni-slider .uni-slider-handle{width:28px;height:28px;margin-top:-14px;margin-left:-14px;background-color:rgba(0,0,0,0);z-index:3}uni-slider .uni-slider-thumb{z-index:2;box-shadow:0 0 4px rgba(0,0,0,.2)}uni-slider .uni-slider-step{position:absolute;width:100%;height:2px;background:rgba(0,0,0,0);z-index:1}uni-slider .uni-slider-value{color:#888;font-size:14px;margin-left:1em}uni-slider .uni-slider-disabled .uni-slider-track{background-color:#ccc}uni-slider .uni-slider-disabled .uni-slider-thumb{background-color:#fff;border-color:#ccc}uni-swiper-item{display:block;overflow:hidden;will-change:transform;position:absolute;width:100%;height:100%}uni-swiper-item[hidden]{display:none}uni-swiper{display:block;height:150px}uni-swiper[hidden]{display:none}uni-swiper .uni-swiper-wrapper{overflow:hidden;position:relative;width:100%;height:100%;-webkit-transform:translateZ(0);transform:translateZ(0)}uni-swiper .uni-swiper-slides{position:absolute;left:0;top:0;right:0;bottom:0}uni-swiper .uni-swiper-slide-frame{position:absolute;left:0;top:0;width:100%;height:100%;will-change:transform}uni-swiper .uni-swiper-dots{position:absolute;font-size:0}uni-swiper .uni-swiper-dots-horizontal{left:50%;bottom:10px;text-align:center;white-space:nowrap;-webkit-transform:translate(-50%);transform:translate(-50%)}uni-swiper .uni-swiper-dots-horizontal .uni-swiper-dot{margin-right:8px}uni-swiper .uni-swiper-dots-horizontal .uni-swiper-dot:last-child{margin-right:0}uni-swiper .uni-swiper-dots-vertical{right:10px;top:50%;text-align:right;-webkit-transform:translateY(-50%);transform:translateY(-50%)}uni-swiper .uni-swiper-dots-vertical .uni-swiper-dot{display:block;margin-bottom:9px}uni-swiper .uni-swiper-dots-vertical .uni-swiper-dot:last-child{margin-bottom:0}uni-swiper .uni-swiper-dot{display:inline-block;width:8px;height:8px;cursor:pointer;-webkit-transition-property:background-color;transition-property:background-color;-webkit-transition-timing-function:ease;transition-timing-function:ease;background:rgba(0,0,0,.3);border-radius:50%}uni-swiper .uni-swiper-dot-active{background-color:#000}uni-switch{-webkit-tap-highlight-color:transparent;display:inline-block}uni-switch[hidden]{display:none}uni-switch .uni-switch-wrapper{display:-webkit-inline-flex;display:-webkit-inline-box;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;align-items:center;vertical-align:middle}uni-switch .uni-switch-input{-webkit-appearance:none;appearance:none;position:relative;width:52px;height:32px;margin-right:5px;border:1px solid #dfdfdf;outline:0;border-radius:16px;box-sizing:border-box;background-color:#dfdfdf;-webkit-transition:background-color .1s,border .1s;transition:background-color .1s,border .1s}uni-switch .uni-switch-input:before{width:50px;background-color:#fdfdfd}uni-switch .uni-switch-input:after,uni-switch .uni-switch-input:before{content:" ";position:absolute;top:0;left:0;height:30px;border-radius:15px;transition:-webkit-transform .3s;-webkit-transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s}uni-switch .uni-switch-input:after{width:30px;background-color:#fff;box-shadow:0 1px 3px rgba(0,0,0,.4)}uni-switch .uni-switch-input.uni-switch-input-checked{border-color:#007aff;background-color:#007aff}uni-switch .uni-switch-input.uni-switch-input-checked:before{-webkit-transform:scale(0);transform:scale(0)}uni-switch .uni-switch-input.uni-switch-input-checked:after{-webkit-transform:translateX(20px);transform:translateX(20px)}uni-switch .uni-checkbox-input{margin-right:5px;-webkit-appearance:none;appearance:none;outline:0;border:1px solid #d1d1d1;background-color:#fff;border-radius:3px;width:22px;height:22px;position:relative;color:#007aff}uni-switch .uni-checkbox-input.uni-checkbox-input-checked:before{font:normal normal normal 14px/1 uni;content:"\EA08";color:inherit;font-size:22px;position:absolute;top:50%;left:50%;transform:translate(-50%,-48%) scale(.73);-webkit-transform:translate(-50%,-48%) scale(.73)}uni-switch .uni-checkbox-input.uni-checkbox-input-disabled{background-color:#e1e1e1}uni-switch .uni-checkbox-input.uni-checkbox-input-disabled:before{color:#adadad}uni-text[selectable]{cursor:auto;user-select:text;-webkit-user-select:text}uni-textarea{width:300px;height:150px;display:block;position:relative;font-size:16px;line-height:normal}uni-textarea[hidden]{display:none}uni-textarea[auto-height] .uni-textarea-textarea{overflow-y:hidden}.uni-textarea-compute,.uni-textarea-placeholder,.uni-textarea-textarea,.uni-textarea-wrapper{outline:none;border:none;padding:0;margin:0;text-decoration:inherit}.uni-textarea-wrapper{display:block;position:relative;width:100%;height:100%}.uni-textarea-compute,.uni-textarea-placeholder,.uni-textarea-textarea{position:absolute;width:100%;height:100%;left:0;top:0;white-space:pre-wrap;word-break:break-all}.uni-textarea-placeholder{color:grey;overflow:hidden}.uni-textarea-compute{visibility:hidden;height:auto}.uni-textarea-textarea{resize:none;background:none;color:inherit;opacity:1;-webkit-text-fill-color:currentcolor;font:inherit;line-height:inherit;letter-spacing:inherit;text-align:inherit;text-indent:inherit;text-transform:inherit;text-shadow:inherit}.uni-textarea-textarea-ios{width:auto;right:0;margin:0 -3px}uni-view{display:block}uni-view[hidden]{display:none} \ No newline at end of file +* { + margin: 0; + -webkit-tap-highlight-color: transparent; +} + +@font-face { + font-weight: normal; + font-style: normal; + font-family: "uni"; + src: url('data:application/octet-stream;base64,AAEAAAALAIAAAwAwR1NVQrD+s+0AAAE4AAAAQk9TLzJAKEx+AAABfAAAAFZjbWFw65cFHQAAAhwAAAJQZ2x5ZvCRR/EAAASUAAAKtGhlYWQLKIN9AAAA4AAAADZoaGVhCCwD+gAAALwAAAAkaG10eEJo//8AAAHUAAAASGxvY2EYqhW6AAAEbAAAACZtYXhwASEAVQAAARgAAAAgbmFtZeNcHtgAAA9IAAAB5nBvc3T6bLhLAAARMAAAAOYAAQAAA+gAAABaA+j/////A+kAAQAAAAAAAAAAAAAAAAAAABIAAQAAAAEAACkCj3dfDzz1AAsD6AAAAADUER9XAAAAANQRH1f//wAAA+kD6gAAAAgAAgAAAAAAAAABAAAAEgBJAAUAAAAAAAIAAAAKAAoAAAD/AAAAAAAAAAEAAAAKAB4ALAABREZMVAAIAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAAAAQOwAZAABQAIAnoCvAAAAIwCegK8AAAB4AAxAQIAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABA6gHqEQPoAAAAWgPqAAAAAAABAAAAAAAAAAAAAAPoAAAD6AAAA+gAAAPoAAAD6AAAA+gAAAPoAAAD6AAAA+gAAAPoAAAD6AAAA+gAAAPoAAAD6AAAA+j//wPoAAAD6AAAAAAABQAAAAMAAAAsAAAABAAAAXQAAQAAAAAAbgADAAEAAAAsAAMACgAAAXQABABCAAAABAAEAAEAAOoR//8AAOoB//8AAAABAAQAAAABAAIAAwAEAAUABgAHAAgACQAKAAsADAANAA4ADwAQABEAAAEGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAANwAAAAAAAAAEQAA6gEAAOoBAAAAAQAA6gIAAOoCAAAAAgAA6gMAAOoDAAAAAwAA6gQAAOoEAAAABAAA6gUAAOoFAAAABQAA6gYAAOoGAAAABgAA6gcAAOoHAAAABwAA6ggAAOoIAAAACAAA6gkAAOoJAAAACQAA6goAAOoKAAAACgAA6gsAAOoLAAAACwAA6gwAAOoMAAAADAAA6g0AAOoNAAAADQAA6g4AAOoOAAAADgAA6g8AAOoPAAAADwAA6hAAAOoQAAAAEAAA6hEAAOoRAAAAEQAAAAAARgCMANIBJgF4AcQCMgJgAqgC/ANIA6YD/gROBKAE9AVaAAAAAgAAAAADrwOtABQAKQAAASIHBgcGFBcWFxYyNzY3NjQnJicmAyInJicmNDc2NzYyFxYXFhQHBgcGAfV4Z2Q7PDw7ZGfwZmQ7PDw7ZGZ4bl5bNjc3Nlte215bNjc3NlteA608O2Rn8GdjOzw8O2Nn8GdkOzz8rzc1W17bXlw1Nzc1XF7bXls1NwAAAAACAAAAAAOzA7MAFwAtAAABIgcGBwYVFBcWFxYzMjc2NzY1NCcmJyYTBwYiLwEmNjsBETQ2OwEyFhURMzIWAe52Z2Q7PT07ZGd2fGpmOz4+O2ZpIXYOKA52Dg0XXQsHJgcLXRcNA7M+O2ZqfHZnZDs9PTtkZ3Z9aWY7Pv3wmhISmhIaARcICwsI/ukaAAMAAAAAA+UD5QAXACMALAAAASIHBgcGFRQXFhcWMzI3Njc2NTQnJicmAxQrASI1AzQ7ATIHJyImNDYyFhQGAe6Ecm9BRERBb3KEiXZxQkREQnF1aQIxAwgCQgMBIxIZGSQZGQPkREJxdomEcm9BRERBb3KEinVxQkT9HQICAWICAjEZIxkZIxkAAAAAAwAAAAADsQPkABsAKgAzAAABBgcGBwYHBjcRFBcWFxYXNjc2NzY1ESQXJicmBzMyFhUDFAYrASInAzQ2EyImNDYyFhQGAfVBQTg7LDt/IEc+bF5sbF1tPUj+2KhQQVVvNAQGDAMCJgUBCwYeDxYWHhUVA+QPEg4SDhIpCv6tj3VkST4dHT5JZHWPAVNeNRkSGPwGBP7GAgMFAToEBv5AFR8VFR8VAAAAAgAAAAADsQPkABkALgAAAQYHBgc2BREUFxYXFhc2NzY3NjURJBcmJyYTAQYvASY/ATYyHwEWNjclNjIfARYB9VVVQk+v/tFHPmxebGxdbT1I/tGvT0JVo/7VBASKAwMSAQUBcQEFAgESAgUBEQQD4xMYEhk3YP6sjnVlSD8cHD9IZXWOAVRgNxkSGP62/tkDA48EBBkCAVYCAQHlAQIQBAAAAAACAAAAAAPkA+QAFwAtAAABIgcGBwYVFBcWFxYzMjc2NzY1NCcmJyYTAQYiLwEmPwE2Mh8BFjI3ATYyHwEWAe6Ecm9BQ0NCbnODiXVxQkREQnF1kf6gAQUBowMDFgEFAYUCBQEBQwIFARUEA+NEQnF1iYNzbkJDQ0FvcoSJdXFCRP6j/qUBAagEBR4CAWYBAQENAgIVBAAAAAQAAAAAA68DrQAUACkAPwBDAAABIgcGBwYUFxYXFjI3Njc2NCcmJyYDIicmJyY0NzY3NjIXFhcWFAcGBwYTBQ4BLwEmBg8BBhYfARYyNwE+ASYiFzAfAQH1eGdkOzw8O2Rn8GZkOzw8O2RmeG5eWzY3NzZbXtteWzY3NzZbXmn+9gYSBmAGDwUDBQEGfQUQBgElBQELEBUBAQOtPDtkZ/BnYzs8PDtjZ/BnZDs8/K83NVte215cNTc3NVxe215bNTcCJt0FAQVJBQIGBAcRBoAGBQEhBQ8LBAEBAAABAAAAAAO7AzoAFwAAEy4BPwE+AR8BFjY3ATYWFycWFAcBBiInPQoGBwUHGgzLDCELAh0LHwsNCgr9uQoeCgGzCyEOCw0HCZMJAQoBvgkCCg0LHQv9sQsKAAAAAAIAAAAAA+UD5gAXACwAAAEiBwYHBhUUFxYXFjMyNzY3NjU0JyYnJhMHBi8BJicmNRM0NjsBMhYVExceAQHvhHJvQUNDQm5zg4l1cUJEREJxdVcQAwT6AwIEEAMCKwIDDsUCAQPlREJxdYmDc25CQ0NBb3KEiXVxQkT9VhwEAncCAgMGAXoCAwMC/q2FAgQAAAQAAAAAA68DrQADABgALQAzAAABMB8BAyIHBgcGFBcWFxYyNzY3NjQnJicmAyInJicmNDc2NzYyFxYXFhQHBgcGAyMVMzUjAuUBAfJ4Z2Q7PDw7ZGfwZmQ7PDw7ZGZ4bl5bNjc3Nlte215bNjc3NltemyT92QKDAQEBLDw7ZGfwZ2M7PDw7Y2fwZ2Q7PPyvNzVbXtteXDU3NzVcXtteWzU3AjH9JAAAAAMAAAAAA+QD5AAXACcAMAAAASIHBgcGFRQXFhcWMzI3Njc2NTQnJicmAzMyFhUDFAYrASImNQM0NhMiJjQ2MhYUBgHuhHJvQUNDQm5zg4l1cUJEREJxdZ42BAYMAwInAwMMBh8PFhYeFhYD40RCcXWJg3NuQkNDQW9yhIl1cUJE/vYGBf7AAgMDAgFABQb+NhYfFhYfFgAABAAAAAADwAPAAAgAEgAoAD0AAAEyNjQmIgYUFhcjFTMRIxUzNSMDIgcGBwYVFBYXFjMyNzY3NjU0Jy4BAyInJicmNDc2NzYyFxYXFhQHBgcGAfQYISEwISFRjzk5yTorhG5rPT99am+DdmhlPD4+PMyFbV5bNTc3NVte2l5bNTc3NVteAqAiLyIiLyI5Hf7EHBwCsT89a26Ed8w8Pj48ZWh2g29qffyjNzVbXtpeWzU3NzVbXtpeWzU3AAADAAAAAAOoA6gACwAgADUAAAEHJwcXBxc3FzcnNwMiBwYHBhQXFhcWMjc2NzY0JyYnJgMiJyYnJjQ3Njc2MhcWFxYUBwYHBgKOmpocmpocmpocmpq2dmZiOjs7OmJm7GZiOjs7OmJmdmtdWTQ2NjRZXdZdWTQ2NjRZXQKqmpocmpocmpocmpoBGTs6YmbsZmI6Ozs6YmbsZmI6O/zCNjRZXdZdWTQ2NjRZXdZdWTQ2AAMAAAAAA+kD6gAaAC8AMAAAAQYHBiMiJyYnJjQ3Njc2MhcWFxYVFAcGBwEHATI3Njc2NCcmJyYiBwYHBhQXFhcWMwKONUBCR21dWjU3NzVaXdpdWzU2GBcrASM5/eBXS0grKysrSEuuSkkqLCwqSUpXASMrFxg2NVtd2l1aNTc3NVpdbUdCQDX+3jkBGSsrSEuuSkkqLCwqSUquS0grKwAC//8AAAPoA+gAFAAwAAABIgcGBwYQFxYXFiA3Njc2ECcmJyYTFg4BIi8BBwYuATQ/AScmPgEWHwE3Nh4BBg8BAfSIdHFDRERDcXQBEHRxQ0REQ3F0SQoBFBsKoqgKGxMKqKIKARQbCqKoChsUAQqoA+hEQ3F0/vB0cUNERENxdAEQdHFDRP1jChsTCqiiCgEUGwqiqAobFAEKqKIKARQbCqIAAAIAAAAAA+QD5AAXADQAAAEiBwYHBhUUFxYXFjMyNzY3NjU0JyYnJhMUBiMFFxYUDwEGLwEuAT8BNh8BFhQPAQUyFh0BAe6Ecm9BQ0NCbnODiXVxQkREQnF1fwQC/pGDAQEVAwTsAgEC7AQEFAIBhAFwAgMD40RCcXWJg3NuQkNDQW9yhIl1cUJE/fYCAwuVAgQCFAQE0AIFAtEEBBQCBQGVCwMDJwAAAAUAAAAAA9QD0wAjACcANwBHAEgAAAERFAYjISImNREjIiY9ATQ2MyE1NDYzITIWHQEhMhYdARQGIyERIREHIgYVERQWOwEyNjURNCYjISIGFREUFjsBMjY1ETQmKwEDeyYb/XYbJkMJDQ0JAQYZEgEvExkBBgkNDQn9CQJc0QkNDQktCQ0NCf7sCQ0NCS0JDQ0JLQMi/TQbJiYbAswMCiwJDS4SGRkSLg0JLAoM/UwCtGsNCf5NCQ0NCQGzCQ0NCf5NCQ0NCQGzCQ0AAAAAEADGAAEAAAAAAAEABAAAAAEAAAAAAAIABwAEAAEAAAAAAAMABAALAAEAAAAAAAQABAAPAAEAAAAAAAUACwATAAEAAAAAAAYABAAeAAEAAAAAAAoAKwAiAAEAAAAAAAsAEwBNAAMAAQQJAAEACABgAAMAAQQJAAIADgBoAAMAAQQJAAMACAB2AAMAAQQJAAQACAB+AAMAAQQJAAUAFgCGAAMAAQQJAAYACACcAAMAAQQJAAoAVgCkAAMAAQQJAAsAJgD6d2V1aVJlZ3VsYXJ3ZXVpd2V1aVZlcnNpb24gMS4wd2V1aUdlbmVyYXRlZCBieSBzdmcydHRmIGZyb20gRm9udGVsbG8gcHJvamVjdC5odHRwOi8vZm9udGVsbG8uY29tAHcAZQB1AGkAUgBlAGcAdQBsAGEAcgB3AGUAdQBpAHcAZQB1AGkAVgBlAHIAcwBpAG8AbgAgADEALgAwAHcAZQB1AGkARwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABzAHYAZwAyAHQAdABmACAAZgByAG8AbQAgAEYAbwBuAHQAZQBsAGwAbwAgAHAAcgBvAGoAZQBjAHQALgBoAHQAdABwADoALwAvAGYAbwBuAHQAZQBsAGwAbwAuAGMAbwBtAAAAAgAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAQIBAwEEAQUBBgEHAQgBCQEKAQsBDAENAQ4BDwEQAREBEgETAAZjaXJjbGUIZG93bmxvYWQEaW5mbwxzYWZlX3N1Y2Nlc3MJc2FmZV93YXJuB3N1Y2Nlc3MOc3VjY2Vzcy1jaXJjbGURc3VjY2Vzcy1uby1jaXJjbGUHd2FpdGluZw53YWl0aW5nLWNpcmNsZQR3YXJuC2luZm8tY2lyY2xlBmNhbmNlbAZzZWFyY2gFY2xlYXIEYmFjawZkZWxldGUAAAAA') format('truetype'); +} + +@font-face { + font-weight: normal; + font-style: normal; + font-family: "unibtn"; + src: url('data:application/octet-stream;base64,AAEAAAALAIAAAwAwT1MvMg8SAzoAAAC8AAAAYGNtYXAAILNAAAABHAAAAGRnYXNwAAAAEAAAAYAAAAAIZ2x5ZnVT/G4AAAGIAAAEHGhlYWQOAdVuAAAFpAAAADZoaGVhB3wDzAAABdwAAAAkaG10eCIABqYAAAYAAAAALGxvY2EDqgTMAAAGLAAAABhtYXhwAA8ATQAABkQAAAAgbmFtZXBR8sQAAAZkAAAB2nBvc3QAAwAAAAAIQAAAACAAAwPAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADmUAPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQASAAAAA4ACAACAAYAAQAg5gLmBuZQ//3//wAAAAAAIOYA5gTmUP/9//8AAf/jGgQaAxm6AAMAAQAAAAAAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQFgAHkCwQLqABYAAAEmNDc2MhcBHgEVFAYHAQYiJyY0NwkBAWAICAcWBwE1BAQEBP7LBxYHCAgBIv7eAsUHFwcICP7cBAsFBgsE/twICAcXCAETARMAAAEBWAB5ArkC6gAXAAAJAhYUBwYiJwEuATU0NjcBNjIXFhQHMQK5/t4BIggICBUI/swFAwMFATQIFQgICALF/u3+7QgXBwgIASQECwYFCwQBJAgIBxcHAAACANAAaQO6Aw0AHAA2AAAlFAYjISImNRE0NjsBNSMiBhURFBYzITI2PQEjFRMnBxcHDgMPATM1PgE3PgE/AgcXNyc3A1IHBP3CBAYGBLDAERgYEQJfERcuaKQhbndKgmM9BQEvBTYtLXVABmpuIaQBAaUEBwcEAagFBjEZEf40ERkZEqWUAbysI3MBBjxffkcIBzxuKysyBAEBdCKsAgIAAgCXAF4DcwMbADEASgAAAS4BLwIuASMiBg8CDgEHBhYfAQcGFhceATMyNj8BFx4BMzI2Nz4BJzQwNSc3PgEnBTYmLwE3PgE/ARceAR8BBw4BHwEnJgYPAQNzAgoG42cDCgcGCgNk4wYKAgEDBKUlAQUFAwYEAgUDyswCBQMGCgMCAQEoowUDAv38AQMEjcIFCQJWWAIJBcOMBAMBIq4FCwSuAhQGCAEfzQYGBgbOIwEIBgYMBJ/iBgwEAgICAWxqAQEGBgMJAwEB3qEFDAa2BgoEiB0BBgWxsAUGARuJBAsFwVoDAQJcAAIAvwB1A1ADEQAhAD4AAAEiBh0BFAYjISImPQE0JiMiBh0BHgEzITI2PQE0JicuASM3AS4BIyIGBwEGFBceATMyNjcBNjIXARYyNz4BJwL3Cg4LB/51CAsOCgkPASYbAYwbJwQDAwkFWf7mChgNDRgJ/uYGBwMJBQQIBAEZBRAFARoHEwcGAQYBsA4J4gcLCwfiCQ4OCeIbJycb4gQJAwQDNAEaCgkJCf7lBxMGBAMDAwEZBQX+5wYHBhMHAAAAAAMA3AF2AzEB+gALABcAJAAAATI2NTQmIyIGFRQWITI2NTQmIyIGFRQWITI2NTQmIyIGFRQWMwEeHCcnHBsnJwEDHCcnHBsnJwEEGycnGxwnJxwBdicbGycnGxsnJxsbJycbGycnGxsnJxsbJwAAAAABAOwAnQMUAs4AJQAAATc2NCcmIg8BJyYiBwYUHwEHBhQXHgEzMjY/ARceATMyNjc2NCcCKOwJCQgYCOzqCBgICQnq7AkJBAoGBQsE7OwECwUGCgQJCQG76gkXCQgI6+sICAgYCOvrCBgIBAQEBOvtBQQFBAgXCQABAAAAAQAA3hDrLV8PPPUACwQAAAAAANWUyKsAAAAA1ZTIqwAAAAADugMbAAAACAACAAAAAAAAAAEAAAPA/8AAAAQAAAAAAAO6AAEAAAAAAAAAAAAAAAAAAAALBAAAAAAAAAAAAAAAAgAAAAQAAWAEAAFYBAAA0AQAAJcEAAC/BAAA3AQAAOwAAAAAAAoAFAAeAEoAdgDGAToBmgHSAg4AAQAAAAsASwADAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAA4AAAABAAAAAAACAAcAnwABAAAAAAADAA4ASwABAAAAAAAEAA4AtAABAAAAAAAFAAsAKgABAAAAAAAGAA4AdQABAAAAAAAKABoA3gADAAEECQABABwADgADAAEECQACAA4ApgADAAEECQADABwAWQADAAEECQAEABwAwgADAAEECQAFABYANQADAAEECQAGABwAgwADAAEECQAKADQA+HN0cmVhbWljb25mb250AHMAdAByAGUAYQBtAGkAYwBvAG4AZgBvAG4AdFZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMHN0cmVhbWljb25mb250AHMAdAByAGUAYQBtAGkAYwBvAG4AZgBvAG4AdHN0cmVhbWljb25mb250AHMAdAByAGUAYQBtAGkAYwBvAG4AZgBvAG4AdFJlZ3VsYXIAUgBlAGcAdQBsAGEAcnN0cmVhbWljb25mb250AHMAdAByAGUAYQBtAGkAYwBvAG4AZgBvAG4AdEZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=') format('truetype') +} + +html, +body { + -webkit-user-select: none; + user-select: none; + width: 100%; + height: 100%; +} + +/* html { + height: 100% +} */ + +body { + overflow-x: hidden; +} + +[class^="uni-icon-"], +[class*=" uni-icon-"] { + display: inline-block; + vertical-align: middle; + font: normal normal normal 14px/1 "uni"; + font-size: inherit; + text-rendering: auto; + -webkit-font-smoothing: antialiased; +} + + + +[class^="uni-btn-icon"], +[class*=" uni-btn-icon"] { + display: inline-block; + font: normal normal normal 14px/1 "unibtn"; + font-size: inherit; + text-rendering: auto; + -webkit-font-smoothing: antialiased; +} + +[class^="uni-btn-icon"]:before, +[class*=" uni-btn-icon"]:before { + margin: 0; + box-sizing: border-box; +} + +.uni-icon-success-no-circle:before { + content: "\EA08"; +} + +.uni-loading, +uni-button[loading]:before { + background: transparent url("data:image/svg+xml;base64, PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoMTIwIDU4LjY2IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0IyQjJCMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgxNTAgNTQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjQkFCOEI5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDE4MCA1MCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDMkMwQzEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTE1MCA0NS45OCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDQkNCQ0IiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTEyMCA0MS4zNCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNEMkQyRDIiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDM1IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0RBREFEQSIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtNjAgMjQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTJFMkUyIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKC0zMCAtNS45OCA2NSkiLz48L3N2Zz4=") no-repeat; +} + +.uni-loading { + width: 20px; + height: 20px; + display: inline-block; + vertical-align: middle; + -webkit-animation: uni-loading 1s steps(12, end) infinite; + animation: uni-loading 1s steps(12, end) infinite; + background-size: 100%; +} + +@-webkit-keyframes uni-loading { + 0% { + -webkit-transform: rotate3d(0, 0, 1, 0deg); + transform: rotate3d(0, 0, 1, 0deg); + } + + 100% { + -webkit-transform: rotate3d(0, 0, 1, 360deg); + transform: rotate3d(0, 0, 1, 360deg); + } +} + +@keyframes uni-loading { + 0% { + -webkit-transform: rotate3d(0, 0, 1, 0deg); + transform: rotate3d(0, 0, 1, 0deg); + } + + 100% { + -webkit-transform: rotate3d(0, 0, 1, 360deg); + transform: rotate3d(0, 0, 1, 360deg); + } +} + +/* +html, +body, +uni-app, +uni-page { + height: 100%; +} */ + +.uni-mask { + position: fixed; + z-index: 999; + top: 0; + right: 0; + left: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.6); +} + + + + +.uni-fade-enter-active, +.uni-fade-leave-active { + -webkit-transition-duration: 0.25s; + transition-duration: 0.25s; + -webkit-transition-property: opacity; + transition-property: opacity; + -webkit-transition-timing-function: ease; + transition-timing-function: ease; +} + +.uni-fade-enter, +.uni-fade-leave-active { + opacity: 0 +} + +[nvue] uni-view, +[nvue] uni-swiper-item, +[nvue] uni-scroll-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; +} + +[nvue-dir-row] uni-view, +[nvue-dir-row] uni-swiper-item { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; +} + +[nvue-dir-column] uni-view, +[nvue-dir-column] uni-swiper-item { + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; +} + +[nvue-dir-row-reverse] uni-view, +[nvue-dir-row-reverse] uni-swiper-item { + -webkit-box-orient: horizontal; + -webkit-box-direction: reverse; + -webkit-flex-direction: row-reverse; + flex-direction: row-reverse; +} + +[nvue-dir-column-reverse] uni-view, +[nvue-dir-column-reverse] uni-swiper-item { + -webkit-box-orient: vertical; + -webkit-box-direction: reverse; + -webkit-flex-direction: column-reverse; + flex-direction: column-reverse; +} + +[nvue] uni-view, +[nvue] uni-image, +[nvue] uni-input, +[nvue] uni-scroll-view, +[nvue] uni-swiper, +[nvue] uni-swiper-item, +[nvue] uni-text, +[nvue] uni-textarea, +[nvue] uni-video { + position: relative; + border: 0px solid #000000; + box-sizing: border-box; +} + +[nvue] uni-swiper-item { + position: absolute; +} + + +uni-button { + position: relative; + display: block; + margin-left: auto; + margin-right: auto; + padding-left: 14px; + padding-right: 14px; + box-sizing: border-box; + font-size: 18px; + text-align: center; + text-decoration: none; + line-height: 2.55555556; + border-radius: 5px; + -webkit-tap-highlight-color: transparent; + overflow: hidden; + color: #000000; + background-color: #F8F8F8; +} +uni-button[hidden] { + display: none !important; +} +uni-button:after { + content: " "; + width: 200%; + height: 200%; + position: absolute; + top: 0; + left: 0; + border: 1px solid rgba(0, 0, 0, 0.2); + -webkit-transform: scale(0.5); + transform: scale(0.5); + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + border-radius: 10px; +} +uni-button[native] { + padding-left: 0; + padding-right: 0; +} +uni-button[native] .uni-button-cover-view-wrapper { + border: inherit; + border-color: inherit; + border-radius: inherit; + background-color: inherit; +} +uni-button[native] .uni-button-cover-view-inner { + padding-left: 14px; + padding-right: 14px; +} +uni-button uni-cover-view { + line-height: inherit; + white-space: inherit; +} +uni-button[type=default] { + color: #000000; + background-color: #F8F8F8; +} +uni-button[type=primary] { + color: #FFFFFF; + background-color: #007aff; +} +uni-button[type=warn] { + color: #FFFFFF; + background-color: #E64340; +} +uni-button[disabled] { + color: rgba(255, 255, 255, 0.6); +} +uni-button[disabled][type=default], +uni-button[disabled]:not([type]) { + color: rgba(0, 0, 0, 0.3); + background-color: #F7F7F7; +} +uni-button[disabled][type=primary] { + background-color: rgba(0, 122, 255, 0.6); +} +uni-button[disabled][type=warn] { + background-color: #EC8B89; +} +uni-button[type=primary][plain] { + color: #007aff; + border: 1px solid #007aff; + background-color: transparent; +} +uni-button[type=primary][plain][disabled] { + color: rgba(0, 0, 0, 0.2); + border-color: rgba(0, 0, 0, 0.2); +} +uni-button[type=primary][plain]:after { + border-width: 0; +} +uni-button[type=default][plain] { + color: #353535; + border: 1px solid #353535; + background-color: transparent; +} +uni-button[type=default][plain][disabled] { + color: rgba(0, 0, 0, 0.2); + border-color: rgba(0, 0, 0, 0.2); +} +uni-button[type=default][plain]:after { + border-width: 0; +} +uni-button[plain] { + color: #353535; + border: 1px solid #353535; + background-color: transparent; +} +uni-button[plain][disabled] { + color: rgba(0, 0, 0, 0.2); + border-color: rgba(0, 0, 0, 0.2); +} +uni-button[plain]:after { + border-width: 0; +} +uni-button[plain][native] .uni-button-cover-view-inner { + padding: 0; +} +uni-button[type=warn][plain] { + color: #e64340; + border: 1px solid #e64340; + background-color: transparent; +} +uni-button[type=warn][plain][disabled] { + color: rgba(0, 0, 0, 0.2); + border-color: rgba(0, 0, 0, 0.2); +} +uni-button[type=warn][plain]:after { + border-width: 0; +} +uni-button[size=mini] { + display: inline-block; + line-height: 2.3; + font-size: 13px; + padding: 0 1.34em; +} +uni-button[size=mini][native] { + padding: 0; +} +uni-button[size=mini][native] .uni-button-cover-view-inner { + padding: 0 1.34em; +} +uni-button[loading]:before { + content: " "; + display: inline-block; + width: 18px; + height: 18px; + vertical-align: middle; + -webkit-animation: uni-loading 1s steps(12, end) infinite; + animation: uni-loading 1s steps(12, end) infinite; + background-size: 100%; +} +uni-button[loading][type=primary] { + color: rgba(255, 255, 255, 0.6); + background-color: #0062cc; +} +uni-button[loading][type=primary][plain] { + color: #007aff; + background-color: transparent; +} +uni-button[loading][type=default] { + color: rgba(0, 0, 0, 0.6); + background-color: #DEDEDE; +} +uni-button[loading][type=default][plain] { + color: #353535; + background-color: transparent; +} +uni-button[loading][type=warn] { + color: rgba(255, 255, 255, 0.6); + background-color: #CE3C39; +} +uni-button[loading][type=warn][plain] { + color: #e64340; + background-color: transparent; +} +uni-button[loading][native]:before { + content: none; +} +.button-hover { + color: rgba(0, 0, 0, 0.6); + background-color: #DEDEDE; +} +.button-hover[plain] { + color: rgba(53, 53, 53, 0.6); + border-color: rgba(53, 53, 53, 0.6); + background-color: transparent; +} +.button-hover[type=primary] { + color: rgba(255, 255, 255, 0.6); + background-color: #0062cc; +} +.button-hover[type=primary][plain] { + color: rgba(26, 173, 25, 0.6); + border-color: rgba(26, 173, 25, 0.6); + background-color: transparent; +} +.button-hover[type=default] { + color: rgba(0, 0, 0, 0.6); + background-color: #DEDEDE; +} +.button-hover[type=default][plain] { + color: rgba(53, 53, 53, 0.6); + border-color: rgba(53, 53, 53, 0.6); + background-color: transparent; +} +.button-hover[type=warn] { + color: rgba(255, 255, 255, 0.6); + background-color: #CE3C39; +} +.button-hover[type=warn][plain] { + color: rgba(230, 67, 64, 0.6); + border-color: rgba(230, 67, 64, 0.6); + background-color: transparent; +} + + +uni-canvas { + width: 300px; + height: 150px; + display: block; + position: relative; +} +uni-canvas>canvas { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + + +uni-checkbox-group[hidden] { + display: none; +} + + +uni-checkbox { + -webkit-tap-highlight-color: transparent; + display: inline-block; +} +uni-checkbox[hidden] { + display: none; +} +uni-checkbox .uni-checkbox-wrapper { + display: -webkit-inline-flex; + display: -webkit-inline-box; + display: inline-flex; + -webkit-align-items: center; + -webkit-box-align: center; + align-items: center; + vertical-align: middle; +} +uni-checkbox .uni-checkbox-input { + margin-right: 5px; + -webkit-appearance: none; + appearance: none; + outline: 0; + border: 1px solid #D1D1D1; + background-color: #FFFFFF; + border-radius: 3px; + width: 22px; + height: 22px; + position: relative; +} +uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked { + color: #007aff; +} +uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked:before { + font: normal normal normal 14px/1 "uni"; + content: "\EA08"; + font-size: 22px; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -48%) scale(0.73); + -webkit-transform: translate(-50%, -48%) scale(0.73); +} +uni-checkbox .uni-checkbox-input.uni-checkbox-input-disabled { + background-color: #E1E1E1; +} +uni-checkbox .uni-checkbox-input.uni-checkbox-input-disabled:before { + color: #ADADAD; +} +uni-checkbox-group { + display: block; +} + + +uni-icon { + display: inline-block; + font-size: 0; + box-sizing: border-box; +} +uni-icon[hidden] { + display: none; +} +uni-icon > i { + font: normal normal normal 14px/1 "weui"; +} +uni-icon > i:before { + margin: 0; + box-sizing: border-box; +} +@font-face { + font-weight: normal; + font-style: normal; + font-family: "weui"; + src: url("data:application/octet-stream;base64,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") + format("truetype"); +} +.uni-icon-success:before { + content: "\EA06"; +} +.uni-icon-success_circle:before { + content: "\EA07"; +} +.uni-icon-success_no_circle:before { + content: "\EA08"; +} +.uni-icon-safe_success:before { + content: "\EA04"; +} +.uni-icon-safe_warn:before { + content: "\EA05"; +} +.uni-icon-info:before { + content: "\EA03"; +} +.uni-icon-info_circle:before { + content: "\EA0C"; +} +.uni-icon-warn:before { + content: "\EA0B"; +} +.uni-icon-waiting:before { + content: "\EA09"; +} +.uni-icon-waiting_circle:before { + content: "\EA0A"; +} +.uni-icon-circle:before { + content: "\EA01"; +} +.uni-icon-cancel:before { + content: "\EA0D"; +} +.uni-icon-download:before { + content: "\EA02"; +} +.uni-icon-search:before { + content: "\EA0E"; +} +.uni-icon-clear:before { + content: "\EA0F"; +} +.uni-icon-success { + color: #007aff; +} +.uni-icon-success_circle { + color: #007aff; +} +.uni-icon-success_no_circle { + color: #007aff; +} +.uni-icon-safe_success { + color: #007aff; +} +.uni-icon-safe_warn { + color: #ffbe00; +} +.uni-icon-info { + color: #10aeff; +} +.uni-icon-info_circle { + color: #007aff; +} +.uni-icon-warn { + color: #f76260; +} +.uni-icon-waiting { + color: #10aeff; +} +.uni-icon-waiting_circle { + color: #10aeff; +} +.uni-icon-circle { + color: #c9c9c9; +} +.uni-icon-cancel { + color: #f43530; +} +.uni-icon-download { + color: #007aff; +} +.uni-icon-search { + color: #b2b2b2; +} +.uni-icon-clear { + color: #b2b2b2; +} + + +uni-image { + width: 320px; + height: 240px; + display: inline-block; + overflow: hidden; + position: relative; +} +uni-image[hidden] { + display: none; +} +uni-image>div { + width: 100%; + height: 100%; +} +uni-image>img { + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + display: block; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0; +} +uni-image>.uni-image-will-change { + will-change: transform; +} + + +uni-input { + display: block; + font-size: 16px; + line-height: 1.4em; + height: 1.4em; + min-height: 1.4em; + overflow: hidden; +} +uni-input[hidden] { + display: none; +} +.uni-input-wrapper, +.uni-input-placeholder, +.uni-input-form, +.uni-input-input { + outline: none; + border: none; + padding: 0; + margin: 0; + text-decoration: inherit; +} +.uni-input-wrapper, +.uni-input-form { + display: block; + position: relative; + width: 100%; + height: 100%; +} +.uni-input-placeholder, +.uni-input-input{ + width: 100%; +} +.uni-input-placeholder { + position: absolute; + top: 50%; + left: 0; + -webkit-transform: translateY(-50%); + transform: translateY(-50%); + color: gray; + overflow: hidden; + text-overflow: clip; + white-space: pre; + word-break: keep-all; + pointer-events: none; +} +.uni-input-input { + display: block; + height: 100%; + background: none; + color: inherit; + opacity: 1; + -webkit-text-fill-color: currentcolor; + font: inherit; + line-height: inherit; + letter-spacing: inherit; + text-align: inherit; + text-indent: inherit; + text-transform: inherit; + text-shadow: inherit; +} +.uni-input-input[type="search"]::-webkit-search-cancel-button { + display: none; +} +.uni-input-input::-webkit-outer-spin-button, +.uni-input-input::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; +} +.uni-input-input[type="number"] { + -moz-appearance: textfield; +} + + +uni-movable-area { + display: block; + position: relative; + width: 10px; + height: 10px; +} +uni-movable-area[hidden] { + display: none; +} + + +uni-movable-view { + display: inline-block; + width: 10px; + height: 10px; + top: 0px; + left: 0px; + position: absolute; +} +uni-movable-view[hidden] { + display: none; +} + + +.navigator-hover { + background-color: rgba(0, 0, 0, 0.1); + opacity: 0.7; +} +uni-navigator { + height: auto; + width: auto; + display: block; +} +uni-navigator[hidden] { + display: none; +} + + +uni-picker-view-column { + -webkit-flex: 1; + -webkit-box-flex: 1; + flex: 1; + position: relative; + height: 100%; + overflow: hidden; +} +uni-picker-view-column[hidden] { + display: none; +} +.uni-picker-view-group { + height: 100%; +} +.uni-picker-view-mask { + transform: translateZ(0); + -webkit-transform: translateZ(0); +} +.uni-picker-view-indicator, +.uni-picker-view-mask { + position: absolute; + left: 0; + width: 100%; + z-index: 3; +} +.uni-picker-view-mask { + top: 0; + height: 100%; + margin: 0 auto; + background: -webkit-linear-gradient( + top, + hsla(0, 0%, 100%, 0.95), + hsla(0, 0%, 100%, 0.6) + ), + -webkit-linear-gradient(bottom, hsla(0, 0%, 100%, 0.95), hsla(0, 0%, 100%, 0.6)); + background: linear-gradient( + 180deg, + hsla(0, 0%, 100%, 0.95), + hsla(0, 0%, 100%, 0.6) + ), + linear-gradient(0deg, hsla(0, 0%, 100%, 0.95), hsla(0, 0%, 100%, 0.6)); + background-position: top, bottom; + background-size: 100% 102px; + background-repeat: no-repeat; +} +.uni-picker-view-indicator { + height: 34px; + /* top: 102px; */ + top: 50%; + -webkit-transform: translateY(-50%); + transform: translateY(-50%); +} +.uni-picker-view-indicator, +.uni-picker-view-mask { + position: absolute; + left: 0; + width: 100%; + z-index: 3; + pointer-events: none; +} +.uni-picker-view-content { + position: absolute; + top: 0; + left: 0; + width: 100%; + will-change: transform; + padding: 102px 0; +} +.uni-picker-view-content > * { + height: 34px; + overflow: hidden; +} +.uni-picker-view-indicator:after, +.uni-picker-view-indicator:before { + content: " "; + position: absolute; + left: 0; + right: 0; + height: 1px; + color: #e5e5e5; +} +.uni-picker-view-indicator:before { + top: 0; + border-top: 1px solid #e5e5e5; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + -webkit-transform: scaleY(0.5); + transform: scaleY(0.5); +} +.uni-picker-view-indicator:after { + bottom: 0; + border-bottom: 1px solid #e5e5e5; + -webkit-transform-origin: 0 100%; + transform-origin: 0 100%; + -webkit-transform: scaleY(0.5); + transform: scaleY(0.5); +} +.uni-picker-view-indicator:after, +.uni-picker-view-indicator:before { + content: " "; + position: absolute; + left: 0; + right: 0; + height: 1px; + color: #e5e5e5; +} + + +uni-picker-view { + display: block; +} +uni-picker-view .uni-picker-view-wrapper { + display: -webkit-box; + display: -webkit-flex; + display: flex; + position: relative; + overflow: hidden; + height: 100%; +} +uni-picker-view[hidden] { + display: none; +} + + +uni-picker { + display: block; +} + + +uni-progress { + display: -webkit-flex; + display: -webkit-box; + display: flex; + -webkit-align-items: center; + -webkit-box-align: center; + align-items: center; +} +uni-progress[hidden] { + display: none; +} +.uni-progress-bar { + -webkit-flex: 1; + -webkit-box-flex: 1; + flex: 1; +} +.uni-progress-inner-bar { + width: 0; + height: 100%; +} +.uni-progress-info { + margin-top: 0; + margin-bottom: 0; + min-width: 2em; + margin-left: 15px; + font-size: 16px; +} + + +uni-radio-group[hidden] { + display: none; +} + + +uni-radio { + -webkit-tap-highlight-color: transparent; + display: inline-block; +} +uni-radio[hidden] { + display: none; +} +uni-radio .uni-radio-wrapper { + display: -webkit-inline-flex; + display: -webkit-inline-box; + display: inline-flex; + -webkit-align-items: center; + -webkit-box-align: center; + align-items: center; + vertical-align: middle; +} +uni-radio .uni-radio-input { + -webkit-appearance: none; + appearance: none; + margin-right: 5px; + outline: 0; + border: 1px solid #D1D1D1; + background-color: #ffffff; + border-radius: 50%; + width: 22px; + height: 22px; + position: relative; +} +uni-radio .uni-radio-input.uni-radio-input-checked:before { + font: normal normal normal 14px/1 "uni"; + content: "\EA08"; + color: #ffffff; + font-size: 18px; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -48%) scale(0.73); + -webkit-transform: translate(-50%, -48%) scale(0.73); +} +uni-radio .uni-radio-input.uni-radio-input-disabled { + background-color: #E1E1E1; + border-color: #D1D1D1; +} +uni-radio .uni-radio-input.uni-radio-input-disabled:before { + color: #ADADAD; +} +uni-radio-group { + display: block; +} + + +@-webkit-keyframes once-show { +from { + top: 0; +} +} +@keyframes once-show { +from { + top: 0; +} +} +uni-resize-sensor, +uni-resize-sensor > div { + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + overflow: hidden; +} +uni-resize-sensor { + display: block; + z-index: -1; + visibility: hidden; + -webkit-animation: once-show 1ms; + animation: once-show 1ms; +} +uni-resize-sensor > div > div { + position: absolute; + left: 0; + top: 0; +} +uni-resize-sensor > div:first-child > div { + width: 100000px; + height: 100000px; +} +uni-resize-sensor > div:last-child > div { + width: 200%; + height: 200%; +} + + +uni-scroll-view { + display: block; + width: 100%; +} +uni-scroll-view[hidden] { + display: none; +} +.uni-scroll-view { + position: relative; + -webkit-overflow-scrolling: touch; + width: 100%; + /* display: flex; 时在安卓下会导致scrollWidth和offsetWidth一样 */ + height: 100%; + max-height: inherit; +} + + +uni-slider { + margin: 10px 18px; + padding: 0; + display: block; +} +uni-slider[hidden] { + display: none; +} +uni-slider .uni-slider-wrapper { + display: -webkit-flex; + display: -webkit-box; + display: flex; + -webkit-align-items: center; + -webkit-box-align: center; + align-items: center; + min-height: 16px; +} +uni-slider .uni-slider-tap-area { + -webkit-flex: 1; + -webkit-box-flex: 1; + flex: 1; + padding: 8px 0; +} +uni-slider .uni-slider-handle-wrapper { + position: relative; + height: 2px; + border-radius: 5px; + background-color: #e9e9e9; + cursor: pointer; + -webkit-transition: background-color 0.3s ease; + transition: background-color 0.3s ease; + -webkit-tap-highlight-color: transparent; +} +uni-slider .uni-slider-track { + height: 100%; + border-radius: 6px; + background-color: #007aff; + -webkit-transition: background-color 0.3s ease; + transition: background-color 0.3s ease; +} +uni-slider .uni-slider-handle, +uni-slider .uni-slider-thumb { + position: absolute; + left: 50%; + top: 50%; + cursor: pointer; + border-radius: 50%; + -webkit-transition: border-color 0.3s ease; + transition: border-color 0.3s ease; +} +uni-slider .uni-slider-handle { + width: 28px; + height: 28px; + margin-top: -14px; + margin-left: -14px; + background-color: transparent; + z-index: 3; +} +uni-slider .uni-slider-thumb { + z-index: 2; + box-shadow: 0 0 4px rgba(0, 0, 0, 0.2); +} +uni-slider .uni-slider-step { + position: absolute; + width: 100%; + height: 2px; + background: transparent; + z-index: 1; +} +uni-slider .uni-slider-value { + color: #888; + font-size: 14px; + margin-left: 1em; +} +uni-slider .uni-slider-disabled .uni-slider-track { + background-color: #ccc; +} +uni-slider .uni-slider-disabled .uni-slider-thumb { + background-color: #FFF; + border-color: #ccc; +} + + +uni-swiper-item { + display: block; + overflow: hidden; + will-change: transform; + position: absolute; + width: 100%; + height: 100%; +} +uni-swiper-item[hidden] { + display: none; +} + + +uni-swiper { + display: block; + height: 150px; +} +uni-swiper[hidden] { + display: none; +} +uni-swiper .uni-swiper-wrapper { + overflow: hidden; + position: relative; + width: 100%; + height: 100%; + -webkit-transform: translateZ(0); + transform: translateZ(0); +} +uni-swiper .uni-swiper-slides { + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; +} +uni-swiper .uni-swiper-slide-frame { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + will-change: transform; +} +uni-swiper .uni-swiper-dots { + position: absolute; + font-size: 0; +} +uni-swiper .uni-swiper-dots-horizontal { + left: 50%; + bottom: 10px; + text-align: center; + white-space: nowrap; + -webkit-transform: translate(-50%, 0); + transform: translate(-50%, 0); +} +uni-swiper .uni-swiper-dots-horizontal .uni-swiper-dot { + margin-right: 8px; +} +uni-swiper .uni-swiper-dots-horizontal .uni-swiper-dot:last-child { + margin-right: 0; +} +uni-swiper .uni-swiper-dots-vertical { + right: 10px; + top: 50%; + text-align: right; + -webkit-transform: translate(0, -50%); + transform: translate(0, -50%); +} +uni-swiper .uni-swiper-dots-vertical .uni-swiper-dot { + display: block; + margin-bottom: 9px; +} +uni-swiper .uni-swiper-dots-vertical .uni-swiper-dot:last-child { + margin-bottom: 0; +} +uni-swiper .uni-swiper-dot { + display: inline-block; + width: 8px; + height: 8px; + cursor: pointer; + -webkit-transition-property: background-color; + transition-property: background-color; + -webkit-transition-timing-function: ease; + transition-timing-function: ease; + background: rgba(0, 0, 0, 0.3); + border-radius: 50%; +} +uni-swiper .uni-swiper-dot-active { + background-color: #000000; +} + + +uni-switch { + -webkit-tap-highlight-color: transparent; + display: inline-block; +} +uni-switch[hidden] { + display: none; +} +uni-switch .uni-switch-wrapper { + display: -webkit-inline-flex; + display: -webkit-inline-box; + display: inline-flex; + -webkit-align-items: center; + -webkit-box-align: center; + align-items: center; + vertical-align: middle; +} +uni-switch .uni-switch-input { + -webkit-appearance: none; + appearance: none; + position: relative; + width: 52px; + height: 32px; + margin-right: 5px; + border: 1px solid #DFDFDF; + outline: 0; + border-radius: 16px; + box-sizing: border-box; + background-color: #DFDFDF; + -webkit-transition: background-color 0.1s, border 0.1s; + transition: background-color 0.1s, border 0.1s; +} +uni-switch .uni-switch-input:before { + content: " "; + position: absolute; + top: 0; + left: 0; + width: 50px; + height: 30px; + border-radius: 15px; + background-color: #FDFDFD; + transition: -webkit-transform 0.3s; + -webkit-transition: -webkit-transform 0.3s; + transition: transform 0.3s; + transition: transform 0.3s, -webkit-transform 0.3s; +} +uni-switch .uni-switch-input:after { + content: " "; + position: absolute; + top: 0; + left: 0; + width: 30px; + height: 30px; + border-radius: 15px; + background-color: #FFFFFF; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); + transition: -webkit-transform 0.3s; + -webkit-transition: -webkit-transform 0.3s; + transition: transform 0.3s; + transition: transform 0.3s, -webkit-transform 0.3s; +} +uni-switch .uni-switch-input.uni-switch-input-checked { + border-color: #007aff; + background-color: #007aff; +} +uni-switch .uni-switch-input.uni-switch-input-checked:before { + -webkit-transform: scale(0); + transform: scale(0); +} +uni-switch .uni-switch-input.uni-switch-input-checked:after { + -webkit-transform: translateX(20px); + transform: translateX(20px); +} +uni-switch .uni-checkbox-input { + margin-right: 5px; + -webkit-appearance: none; + appearance: none; + outline: 0; + border: 1px solid #D1D1D1; + background-color: #FFFFFF; + border-radius: 3px; + width: 22px; + height: 22px; + position: relative; + color: #007aff; +} +uni-switch .uni-checkbox-input.uni-checkbox-input-checked:before { + font: normal normal normal 14px/1 "uni"; + content: "\EA08"; + color: inherit; + font-size: 22px; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -48%) scale(0.73); + -webkit-transform: translate(-50%, -48%) scale(0.73); +} +uni-switch .uni-checkbox-input.uni-checkbox-input-disabled { + background-color: #E1E1E1; +} +uni-switch .uni-checkbox-input.uni-checkbox-input-disabled:before { + color: #ADADAD; +} + + +uni-text[selectable] { + cursor: auto; + user-select: text; + -webkit-user-select: text; +} + + +uni-textarea { + width: 300px; + height: 150px; + display: block; + position: relative; + font-size: 16px; + line-height: normal; +} +uni-textarea[hidden] { + display: none; +} +uni-textarea[auto-height] .uni-textarea-textarea { + overflow-y: hidden; +} +.uni-textarea-wrapper, +.uni-textarea-placeholder, +.uni-textarea-compute, +.uni-textarea-textarea { + outline: none; + border: none; + padding: 0; + margin: 0; + text-decoration: inherit; +} +.uni-textarea-wrapper { + display: block; + position: relative; + width: 100%; + height: 100%; +} +.uni-textarea-placeholder, +.uni-textarea-compute, +.uni-textarea-textarea { + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + white-space: pre-wrap; + word-break: break-all; +} +.uni-textarea-placeholder { + color: grey; + overflow: hidden; +} +.uni-textarea-compute { + visibility: hidden; + height: auto; +} +.uni-textarea-textarea { + resize: none; + background: none; + color: inherit; + opacity: 1; + -webkit-text-fill-color: currentcolor; + font: inherit; + line-height: inherit; + letter-spacing: inherit; + text-align: inherit; + text-indent: inherit; + text-transform: inherit; + text-shadow: inherit; +} +/* 用于解决 iOS textarea 内部默认边距 */ +.uni-textarea-textarea-ios { + width: auto; + right: 0; + margin: 0 -3px; +} + + +uni-view { + display: block; +} +uni-view[hidden] { + display: none; +} + diff --git a/packages/uni-app-plus/dist/view.umd.js b/packages/uni-app-plus/dist/view.umd.js index ac9b8cb6f..513bdf76d 100644 --- a/packages/uni-app-plus/dist/view.umd.js +++ b/packages/uni-app-plus/dist/view.umd.js @@ -91,48 +91,11 @@ return /******/ (function(modules) { // webpackBootstrap /******/ /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "fae3"); +/******/ return __webpack_require__(__webpack_require__.s = 122); /******/ }) /************************************************************************/ -/******/ ({ - -/***/ "0741": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("9a72"); -/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__); -/* unused harmony reexport * */ - /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a); - -/***/ }), - -/***/ "08c9": -/***/ (function(module, exports, __webpack_require__) { - -// extracted by mini-css-extract-plugin - -/***/ }), - -/***/ "0950": -/***/ (function(module, exports, __webpack_require__) { - -// extracted by mini-css-extract-plugin - -/***/ }), - -/***/ "0998": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("4509"); -/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__); -/* unused harmony reexport * */ - /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a); - -/***/ }), - -/***/ "0c7c": +/******/ ([ +/* 0 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -233,12977 +196,12427 @@ function normalizeComponent ( /***/ }), - -/***/ "0dba": -/***/ (function(module, exports, __webpack_require__) { - -// extracted by mini-css-extract-plugin - -/***/ }), - -/***/ "0f55": +/* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("eaa4"); -/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__); -/* unused harmony reexport * */ - /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a); - -/***/ }), -/***/ "1047": -/***/ (function(module, exports, __webpack_require__) { +// CONCATENATED MODULE: ./src/core/view/mixins/emitter.js +// 暂不提供通知所有 +// function broadcast (componentName, eventName, ...params) { +// this.$children.forEach(child => { +// const name = child.$options.name && child.$options.name.substr(1) +// if (~componentName.indexOf(name)) { +// child.$emit.apply(child, [eventName].concat(params)) +// } else { +// broadcast.apply(child, [componentName, eventName].concat([params])) +// } +// }) +// } +function broadcast(componentName, eventName) { + var children = this.$children; + var len = children.length; -// extracted by mini-css-extract-plugin + for (var _len = arguments.length, params = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + params[_key - 2] = arguments[_key]; + } -/***/ }), + for (var i = 0; i < len; i++) { + var child = children[i]; + var name = child.$options.name && child.$options.name.substr(4); -/***/ "1082": -/***/ (function(module, __webpack_exports__, __webpack_require__) { + if (~componentName.indexOf(name)) { + child.$emit.apply(child, [eventName].concat(params)); + return false; + } else { + if (broadcast.apply(child, [componentName, eventName].concat([params])) === false) { + return false; + } + } + } +} -"use strict"; -__webpack_require__.r(__webpack_exports__); +/* harmony default export */ var emitter = ({ + methods: { + $dispatch: function $dispatch(componentName, eventName) { + if (typeof componentName === 'string') { + componentName = [componentName]; + } -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7050de7c-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/image/index.vue?vue&type=template&id=5c570748& -var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('uni-image',_vm._g({},_vm.$listeners),[_c('div',{ref:"content",style:(_vm.modeStyle)}),_c('img',{attrs:{"src":_vm.realImagePath}}),(_vm.mode === 'widthFix')?_c('v-uni-resize-sensor',{ref:"sensor",on:{"resize":_vm._resize}}):_vm._e()],1)} -var staticRenderFns = [] + var parent = this.$parent || this.$root; + var name = parent.$options.name && parent.$options.name.substr(4); + while (parent && (!name || !~componentName.indexOf(name))) { + parent = parent.$parent; -// CONCATENATED MODULE: ./src/core/view/components/image/index.vue?vue&type=template&id=5c570748& + if (parent) { + name = parent.$options.name && parent.$options.name.substr(4); + } + } -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/image/index.vue?vue&type=script&lang=js& -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + if (parent) { + for (var _len2 = arguments.length, params = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + params[_key2 - 2] = arguments[_key2]; + } -// -// -// -// -// -// -// -// -// -// -// -// -/* harmony default export */ var imagevue_type_script_lang_js_ = ({ - name: 'Image', - props: { - src: { - type: String, - default: '' - }, - mode: { - type: String, - default: 'scaleToFill' - }, - // TODO 懒加载 - lazyLoad: { - type: [Boolean, String], - default: false - } - }, - data: function data() { - return { - originalWidth: 0, - originalHeight: 0, - availHeight: '', - sizeFixed: false - }; - }, - computed: { - ratio: function ratio() { - return this.originalWidth && this.originalHeight ? this.originalWidth / this.originalHeight : 0; - }, - realImagePath: function realImagePath() { - return this.src && this.$getRealPath(this.src); + parent.$emit.apply(parent, [eventName].concat(params)); + } }, - modeStyle: function modeStyle() { - var size = 'auto'; - var position = ''; - var repeat = 'no-repeat'; - - switch (this.mode) { - case 'aspectFit': - size = 'contain'; - position = 'center center'; - break; + $broadcast: function $broadcast(componentName, eventName) { + if (typeof componentName === 'string') { + componentName = [componentName]; + } - case 'aspectFill': - size = 'cover'; - position = 'center center'; - break; + for (var _len3 = arguments.length, params = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) { + params[_key3 - 2] = arguments[_key3]; + } - case 'widthFix': - size = '100% 100%'; - break; + broadcast.apply(this, [componentName, eventName].concat(params)); + } + } +}); +// EXTERNAL MODULE: ./src/core/view/mixins/listeners.js +var listeners = __webpack_require__(51); - case 'top': - position = 'center top'; - break; +// EXTERNAL MODULE: ./src/core/view/mixins/hover.js +var hover = __webpack_require__(12); - case 'bottom': - position = 'center bottom'; - break; +// EXTERNAL MODULE: ./src/core/view/mixins/subscriber.js +var subscriber = __webpack_require__(52); - case 'center': - position = 'center center'; - break; +// CONCATENATED MODULE: ./src/core/view/mixins/index.js +/* concated harmony reexport emitter */__webpack_require__.d(__webpack_exports__, "a", function() { return emitter; }); +/* concated harmony reexport listeners */__webpack_require__.d(__webpack_exports__, "c", function() { return listeners["a" /* default */]; }); +/* concated harmony reexport hover */__webpack_require__.d(__webpack_exports__, "b", function() { return hover["a" /* default */]; }); +/* concated harmony reexport subscriber */__webpack_require__.d(__webpack_exports__, "d", function() { return subscriber["a" /* default */]; }); - case 'left': - position = 'left center'; - break; - case 'right': - position = 'right center'; - break; - case 'top left': - position = 'left top'; - break; - case 'top right': - position = 'right top'; - break; - case 'bottom left': - position = 'left bottom'; - break; +/***/ }), +/* 2 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - case 'bottom right': - position = 'right bottom'; - break; +"use strict"; - default: - size = '100% 100%'; - position = '0% 0%'; - break; - } +// CONCATENATED MODULE: ./src/shared/env.js +var supportsPassive = false; - return "background-position:".concat(position, ";background-size:").concat(size, ";background-repeat:").concat(repeat, ";"); +try { + var opts = {}; + Object.defineProperty(opts, 'passive', { + get: function get() { + /* istanbul ignore next */ + supportsPassive = true; } - }, - watch: { - src: function src(newValue, oldValue) { - this._loadImage(); - }, - mode: function mode(newValue, oldValue) { - if (oldValue === 'widthFix') { - this.$el.style.height = this.availHeight; - this.sizeFixed = false; - } + }); // https://github.com/facebook/flow/issues/285 - if (newValue === 'widthFix' && this.ratio) { - this._fixSize(); - } - } - }, - mounted: function mounted() { - this.availHeight = this.$el.style.height || ''; + window.addEventListener('test-passive', null, opts); +} catch (e) {} +// CONCATENATED MODULE: ./src/shared/util.js +var _toString = Object.prototype.toString; +var util_hasOwnProperty = Object.prototype.hasOwnProperty; - this._loadImage(); - }, - methods: { - _resize: function _resize() { - if (this.mode === 'widthFix' && !this.sizeFixed) { - this._fixSize(); - } - }, - _fixSize: function _fixSize() { - var elWidth = this._getWidth(); - - if (elWidth) { - var height = elWidth / this.ratio; // fix: 解决 Chrome 浏览器上某些情况下导致 1px 缝隙的问题 +var _completeValue = function _completeValue(value) { + return value > 9 ? value : '0' + value; +}; - if ((typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) && navigator.vendor === 'Google Inc.' && height > 10) { - height = Math.round(height / 2) * 2; - } +function isFn(fn) { + return typeof fn === 'function'; +} +function isStr(str) { + return typeof str === 'string'; +} +function isPlainObject(obj) { + return _toString.call(obj) === '[object Object]'; +} +function hasOwn(obj, key) { + return util_hasOwnProperty.call(obj, key); +} +function noop() {} +function toRawType(val) { + return _toString.call(val).slice(8, -1); +} +/** + * Create a cached version of a pure function. + */ - this.$el.style.height = height + 'px'; - this.sizeFixed = true; - } - }, - _loadImage: function _loadImage() { - this.$refs.content.style.backgroundImage = this.src ? "url(".concat(this.realImagePath, ")") : 'none'; +function cached(fn) { + var cache = Object.create(null); + return function cachedFn(str) { + var hit = cache[str]; + return hit || (cache[str] = fn(str)); + }; +} +/** + * Camelize a hyphen-delimited string. + */ - var _self = this; +var camelizeRE = /-(\w)/g; +var camelize = cached(function (str) { + return str.replace(camelizeRE, function (_, c) { + return c ? c.toUpperCase() : ''; + }); +}); +function setProperties(item, props, propsData) { + props.forEach(function (name) { + if (hasOwn(propsData, name)) { + item[name] = propsData[name]; + } + }); +} +function getLen() { + var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - var img = new Image(); + /* eslint-disable no-control-regex */ + return ('' + str).replace(/[^\x00-\xff]/g, '**').length; +} +function formatDateTime(_ref) { + var _ref$date = _ref.date, + date = _ref$date === void 0 ? new Date() : _ref$date, + _ref$mode = _ref.mode, + mode = _ref$mode === void 0 ? 'date' : _ref$mode; - img.onload = function ($event) { - _self.originalWidth = this.width; - _self.originalHeight = this.height; + if (mode === 'time') { + return _completeValue(date.getHours()) + ':' + _completeValue(date.getMinutes()); + } else { + return date.getFullYear() + '-' + _completeValue(date.getMonth() + 1) + '-' + _completeValue(date.getDate()); + } +} +function updateElementStyle(element, styles) { + for (var attrName in styles) { + element.style[attrName] = styles[attrName]; + } +} +function guid() { + return Math.floor(4294967296 * (1 + Math.random())).toString(16).slice(1); +} +// CONCATENATED MODULE: ./src/shared/color.js +function hexToRgba(hex) { + var r; + var g; + var b; + hex = hex.replace('#', ''); - if (_self.mode === 'widthFix') { - _self._fixSize(); - } + if (hex.length === 6) { + r = hex.substring(0, 2); + g = hex.substring(2, 4); + b = hex.substring(4, 6); + } else if (hex.length === 3) { + r = hex.substring(0, 1); + g = hex.substring(1, 2); + b = hex.substring(2, 3); + } else { + return false; + } - _self.$trigger('load', $event, { - width: this.width, - height: this.height - }); - }; + if (r.length === 1) { + r += r; + } - img.onerror = function ($event) { - _self.$trigger('error', $event, { - errMsg: "GET ".concat(_self.src, " 404 (Not Found)") - }); - }; + if (g.length === 1) { + g += g; + } - img.src = this.realImagePath; - }, - _getWidth: function _getWidth() { - var computedStyle = window.getComputedStyle(this.$el); - var borderWidth = (parseFloat(computedStyle.borderLeftWidth, 10) || 0) + (parseFloat(computedStyle.borderRightWidth, 10) || 0); - var paddingWidth = (parseFloat(computedStyle.paddingLeft, 10) || 0) + (parseFloat(computedStyle.paddingRight, 10) || 0); - return this.$el.offsetWidth - borderWidth - paddingWidth; - } + if (b.length === 1) { + b += b; } -}); -// CONCATENATED MODULE: ./src/core/view/components/image/index.vue?vue&type=script&lang=js& - /* harmony default export */ var components_imagevue_type_script_lang_js_ = (imagevue_type_script_lang_js_); -// EXTERNAL MODULE: ./src/core/view/components/image/index.vue?vue&type=style&index=0&lang=css& -var imagevue_type_style_index_0_lang_css_ = __webpack_require__("db18"); -// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js -var componentNormalizer = __webpack_require__("0c7c"); + r = parseInt(r, 16); + g = parseInt(g, 16); + b = parseInt(b, 16); + return { + r: r, + g: g, + b: b + }; +} +// CONCATENATED MODULE: ./src/shared/query.js +var encodeReserveRE = /[!'()*]/g; -// CONCATENATED MODULE: ./src/core/view/components/image/index.vue +var encodeReserveReplacer = function encodeReserveReplacer(c) { + return '%' + c.charCodeAt(0).toString(16); +}; +var commaRE = /%2C/g; // fixed encodeURIComponent which is more conformant to RFC3986: +// - escapes [!'()*] +// - preserve commas +var encode = function encode(str) { + return encodeURIComponent(str).replace(encodeReserveRE, encodeReserveReplacer).replace(commaRE, ','); +}; +var decode = decodeURIComponent; +function parseQuery(query) { + var res = {}; + query = query.trim().replace(/^(\?|#|&)/, ''); + if (!query) { + return res; + } + query.split('&').forEach(function (param) { + var parts = param.replace(/\+/g, ' ').split('='); + var key = decode(parts.shift()); + var val = parts.length > 0 ? decode(parts.join('=')) : null; -/* normalize component */ + if (res[key] === undefined) { + res[key] = val; + } else if (Array.isArray(res[key])) { + res[key].push(val); + } else { + res[key] = [res[key], val]; + } + }); + return res; +} +function stringifyQuery(obj) { + var res = obj ? Object.keys(obj).map(function (key) { + var val = obj[key]; -var component = Object(componentNormalizer["a" /* default */])( - components_imagevue_type_script_lang_js_, - render, - staticRenderFns, - false, - null, - null, - null - -) + if (val === undefined) { + return ''; + } -/* harmony default export */ var components_image = __webpack_exports__["default"] = (component.exports); + if (val === null) { + return encode(key); + } -/***/ }), + if (Array.isArray(val)) { + var result = []; + val.forEach(function (val2) { + if (val2 === undefined) { + return; + } + + if (val2 === null) { + result.push(encode(key)); + } else { + result.push(encode(key) + '=' + encode(val2)); + } + }); + return result.join('&'); + } + + return encode(key) + '=' + encode(val); + }).filter(function (x) { + return x.length > 0; + }).join('&') : null; + return res ? "?".concat(res) : ''; +} +// CONCATENATED MODULE: ./src/shared/index.js +/* concated harmony reexport supportsPassive */__webpack_require__.d(__webpack_exports__, "f", function() { return supportsPassive; }); +/* concated harmony reexport isFn */__webpack_require__.d(__webpack_exports__, "d", function() { return isFn; }); +/* unused concated harmony import isStr */ +/* concated harmony reexport isPlainObject */__webpack_require__.d(__webpack_exports__, "e", function() { return isPlainObject; }); +/* concated harmony reexport hasOwn */__webpack_require__.d(__webpack_exports__, "c", function() { return hasOwn; }); +/* unused concated harmony import noop */ +/* unused concated harmony import toRawType */ +/* concated harmony reexport cached */__webpack_require__.d(__webpack_exports__, "a", function() { return cached; }); +/* unused concated harmony import camelize */ +/* unused concated harmony import setProperties */ +/* unused concated harmony import getLen */ +/* unused concated harmony import formatDateTime */ +/* unused concated harmony import updateElementStyle */ +/* concated harmony reexport guid */__webpack_require__.d(__webpack_exports__, "b", function() { return guid; }); +/* unused concated harmony import hexToRgba */ +/* unused concated harmony import parseQuery */ +/* unused concated harmony import stringifyQuery */ -/***/ "1360": -/***/ (function(module, exports, __webpack_require__) { -// extracted by mini-css-extract-plugin -/***/ }), -/***/ "1442": + +/***/ }), +/* 3 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return initEvent; }); -/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("a20d"); +__webpack_require__.r(__webpack_exports__); -function initEvent(Vue) { - Vue.prototype.$handleViewEvent = function ($vueEvent, options) { - var cid = this._$id; - var nid = $vueEvent.currentTarget.getAttribute('_i'); +// EXTERNAL MODULE: ./packages/uni-app-plus/dist/view.runtime.esm.js +var view_runtime_esm = __webpack_require__(8); - if (!nid) { - return console.error("[".concat(cid, "] nid not found")); - } +// EXTERNAL MODULE: ./src/shared/index.js + 4 modules +var shared = __webpack_require__(2); - var $event = this.$handleEvent($vueEvent); // 移除无效属性 +// EXTERNAL MODULE: ./src/core/helpers/index.js +var helpers = __webpack_require__(4); - delete $event._processed; - delete $event.mp; - delete $event.preventDefault; - delete $event.stopPropagation; - UniViewJSBridge.publishHandler(_constants__WEBPACK_IMPORTED_MODULE_0__[/* WEBVIEW_UI_EVENT */ "f"], { - data: $event, - options: { - cid: cid, - nid: nid - } - }); - }; -} -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("501c"))) - -/***/ }), - -/***/ "17fd": -/***/ (function(module, __webpack_exports__, __webpack_require__) { +// CONCATENATED MODULE: ./src/core/helpers/constants.js +var NAVBAR_HEIGHT = 44; +var TABBAR_HEIGHT = 50; +// EXTERNAL MODULE: ./src/core/view/bridge/subscribe/scroll.js +var subscribe_scroll = __webpack_require__(54); -"use strict"; -__webpack_require__.r(__webpack_exports__); +// EXTERNAL MODULE: ./src/core/view/bridge/subscribe/api/request-component-info.js +var request_component_info = __webpack_require__(55); -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7050de7c-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/navigator/index.vue?vue&type=template&id=d8d61df6& -var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.hoverClass && _vm.hoverClass !== 'none')?_c('uni-navigator',_vm._g({class:[_vm.hovering ? _vm.hoverClass : ''],on:{"touchstart":_vm._hoverTouchStart,"touchend":_vm._hoverTouchEnd,"touchcancel":_vm._hoverTouchCancel,"click":_vm._onClick}},_vm.$listeners),[_vm._t("default")],2):_c('uni-navigator',_vm._g({on:{"click":_vm._onClick}},_vm.$listeners),[_vm._t("default")],2)} -var staticRenderFns = [] +// EXTERNAL MODULE: ./src/core/view/bridge/subscribe/api/request-component-observer.js +var request_component_observer = __webpack_require__(48); +// CONCATENATED MODULE: ./src/core/view/bridge/subscribe/api/index.js -// CONCATENATED MODULE: ./src/core/view/components/navigator/index.vue?vue&type=template&id=d8d61df6& -// EXTERNAL MODULE: ./src/core/view/mixins/index.js + 1 modules -var mixins = __webpack_require__("8af1"); +/* harmony default export */ var api = ({ + requestComponentInfo: request_component_info["a" /* requestComponentInfo */], + requestComponentObserver: request_component_observer["b" /* requestComponentObserver */], + destroyComponentObserver: request_component_observer["a" /* destroyComponentObserver */] +}); +// CONCATENATED MODULE: ./src/core/view/bridge/subscribe/index.js -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/navigator/index.vue?vue&type=script&lang=js& -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -var OPEN_TYPES = ['navigate', 'redirect', 'switchTab', 'reLaunch', 'navigateBack']; -/* harmony default export */ var navigatorvue_type_script_lang_js_ = ({ - name: 'Navigator', - mixins: [mixins["b" /* hover */]], - props: { - hoverClass: { - type: String, - default: 'navigator-hover' - }, - url: { - type: String, - default: '' - }, - openType: { - type: String, - default: 'navigate', - validator: function validator(value) { - return ~OPEN_TYPES.indexOf(value); - } - }, - delta: { - type: Number, - default: 1 - }, - hoverStartTime: { - type: Number, - default: 20 - }, - hoverStayTime: { - type: Number, - default: 600 - } - }, - methods: { - _onClick: function _onClick($event) { - if (this.openType !== 'navigateBack' && !this.url) { - console.error(" should have url attribute when using navigateTo, redirectTo, reLaunch or switchTab"); - return; - } - switch (this.openType) { - case 'navigate': - uni.navigateTo({ - url: this.url - }); - break; - case 'redirect': - uni.redirectTo({ - url: this.url - }); - break; - case 'switchTab': - uni.switchTab({ - url: this.url - }); - break; +var passiveOptions = shared["f" /* supportsPassive */] ? { + passive: false +} : false; - case 'reLaunch': - uni.reLaunch({ - url: this.url - }); - break; +function updateCssVar(vm) { + if (uni.canIUse('css.var')) { + var pageVm = vm.$parent.$parent; + var windowTop = pageVm.showNavigationBar && pageVm.navigationBar.type !== 'transparent' && pageVm.navigationBar.type !== 'float' ? NAVBAR_HEIGHT + 'px' : '0px'; + var windowBottom = getApp().$children[0].showTabBar ? TABBAR_HEIGHT + 'px' : '0px'; + var style = document.documentElement.style; + style.setProperty('--window-top', windowTop); + style.setProperty('--window-bottom', windowBottom); + console.debug("".concat(vm.$page.route, "[").concat(vm.$page.id, "]\uFF1A--window-top=").concat(windowTop)); + console.debug("".concat(vm.$page.route, "[").concat(vm.$page.id, "]\uFF1A--window-bottom=").concat(windowBottom)); + } +} - case 'navigateBack': - uni.navigateBack({ - delta: this.delta - }); - break; +function initSubscribe(subscribe) { + Object.keys(api).forEach(function (name) { + subscribe(name, api[name]); + }); + subscribe('pageScrollTo', subscribe_scroll["a" /* pageScrollTo */]); - default: - break; - } - } - } -}); -// CONCATENATED MODULE: ./src/core/view/components/navigator/index.vue?vue&type=script&lang=js& - /* harmony default export */ var components_navigatorvue_type_script_lang_js_ = (navigatorvue_type_script_lang_js_); -// EXTERNAL MODULE: ./src/core/view/components/navigator/index.vue?vue&type=style&index=0&lang=css& -var navigatorvue_type_style_index_0_lang_css_ = __webpack_require__("f7fd"); + if (false) { var disableScrollListener, scrollListener; } +} +// EXTERNAL MODULE: ./src/platforms/app-plus/view/bridge.js +var bridge = __webpack_require__(11); -// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js -var componentNormalizer = __webpack_require__("0c7c"); +// CONCATENATED MODULE: ./src/core/view/bridge/index.js +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "on", function() { return on; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "off", function() { return off; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return once; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "emit", function() { return emit; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribe", function() { return bridge_subscribe; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unsubscribe", function() { return unsubscribe; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeHandler", function() { return subscribeHandler; }); +/* concated harmony reexport publishHandler */__webpack_require__.d(__webpack_exports__, "publishHandler", function() { return bridge["a" /* publishHandler */]; }); -// CONCATENATED MODULE: ./src/core/view/components/navigator/index.vue +var Emitter = new view_runtime_esm["a" /* default */](); +var on = Emitter.$on.bind(Emitter); +var off = Emitter.$off.bind(Emitter); +var once = Emitter.$once.bind(Emitter); +var emit = Emitter.$emit.bind(Emitter); +function bridge_subscribe(event, callback) { + return on('service.' + event, callback); +} +function unsubscribe(event, callback) { + return off('service.' + event, callback); +} +function subscribeHandler(event, args, pageId) { + if (true) { + console.log("[subscribeHandler][".concat(Date.now(), "]:"), event, args, pageId); + } + emit('service.' + event, args, pageId); +} +initSubscribe(bridge_subscribe); +/***/ }), +/* 4 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isPage; }); +/* unused harmony export hasLifecycleHook */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return normalizeDataset; }); +/* unused harmony export upx2px */ +var components = ['SystemAsyncLoading', 'SystemAsyncError']; +function isPage(vm) { + if (vm.$parent && vm.$parent.$options.name === 'PageBody') { + if (components.indexOf(vm.$options.name) !== -1) { + return false; + } -/* normalize component */ + return true; + } -var component = Object(componentNormalizer["a" /* default */])( - components_navigatorvue_type_script_lang_js_, - render, - staticRenderFns, - false, - null, - null, - null - -) + return false; +} +function hasLifecycleHook() { + var vueOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var hook = arguments.length > 1 ? arguments[1] : undefined; + return Array.isArray(vueOptions[hook]) && vueOptions[hook].length; +} +function normalizeDataset() { + var dataset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + // ios8.x,9.x Object.assign({},dataset) 始终返回 {} + // http://ask.dcloud.net.cn/question/70246 + var result = JSON.parse(JSON.stringify(dataset)); -/* harmony default export */ var components_navigator = __webpack_exports__["default"] = (component.exports); + if (false) { var _len, key, i, len, keys; } -/***/ }), + return result; +} +function upx2px(str) { + str = str + ''; -/***/ "1922": -/***/ (function(module, exports) { + if (str.indexOf('upx') !== -1) { + // upx转换 + return uni.upx2px(parseInt(str) || 0); + } -function webpackEmptyContext(req) { - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; + return parseInt(str) || 0; } -webpackEmptyContext.keys = function() { return []; }; -webpackEmptyContext.resolve = webpackEmptyContext; -module.exports = webpackEmptyContext; -webpackEmptyContext.id = "1922"; /***/ }), - -/***/ "1955": +/* 5 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -__webpack_require__.r(__webpack_exports__); - -// EXTERNAL MODULE: ./src/core/view/mixins/touchtrack.js -var touchtrack = __webpack_require__("ba15"); - -// EXTERNAL MODULE: ./src/core/view/mixins/scroller/index.js + 2 modules -var scroller = __webpack_require__("8aec"); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return PAGE_CREATE; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MOUNTED_DATA; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return UPDATED_DATA; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return PAGE_CREATED; }); +/* unused harmony export LAYOUT_READY */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return APP_SERVICE_ID; }); +/* unused harmony export WEBVIEW_READY */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return WEBVIEW_UI_EVENT; }); +var PAGE_CREATE = 2; +var MOUNTED_DATA = 4; +var UPDATED_DATA = 6; +var PAGE_CREATED = 10; +var LAYOUT_READY = 30; +var APP_SERVICE_ID = '__uniapp__service'; +var WEBVIEW_READY = 'webviewReady'; +var WEBVIEW_UI_EVENT = 'webviewUIEvent'; -// EXTERNAL MODULE: ./src/core/view/mixins/scroller/Friction.js -var Friction = __webpack_require__("5363"); +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { -// EXTERNAL MODULE: ./src/core/view/mixins/scroller/Spring.js -var Spring = __webpack_require__("72b3"); +"use strict"; -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/picker-view-column/index.vue?vue&type=script&lang=js& - - - - -/* harmony default export */ var picker_view_columnvue_type_script_lang_js_ = ({ - name: 'PickerViewColumn', - mixins: [touchtrack["a" /* default */], scroller["a" /* default */]], - data: function data() { - return { - scope: "picker-view-column-".concat(Date.now()), - inited: false, - indicatorStyle: '', - indicatorClass: '', - indicatorHeight: 34, - maskStyle: '', - maskClass: '', - current: this.$parent.getItemValue(this), - length: 0 - }; - }, - computed: { - height: function height() { - return this.$parent.height; - }, - maskSize: function maskSize() { - return (this.height - this.indicatorHeight) / 2; +var attrs = ['top', 'left', 'right', 'bottom']; +var inited; +var elementComputedStyle = {}; +var support; +function getSupport() { + if (!('CSS' in window) || typeof CSS.supports != 'function') { + support = ''; } - }, - watch: { - indicatorHeight: function indicatorHeight(val) { - this._setItemHeight(val); - - if (this.inited) { - this.update(); - } - }, - current: function current(val) { - this.$parent.setItemValue(this, val); - }, - length: function length(val) { - if (this.inited) { - this.update(val); - } + else if (CSS.supports('top: env(safe-area-inset-top)')) { + support = 'env'; } - }, - created: function created() { - var $parent = this.$parent; - this.indicatorStyle = $parent.indicatorStyle; - this.indicatorClass = $parent.indicatorClass; - this.maskStyle = $parent.maskStyle; - this.maskClass = $parent.maskClass; // this.__pageRerender = this._pageRerender.bind(this) - }, - mounted: function mounted() { - var _this = this; - - this.touchtrack(this.$refs.main, '_handleTrack', true); - this.setCurrent(this.current); - this.$nextTick(function () { - _this.init(); - - _this.update(); - }); - }, - methods: { - _setItemHeight: function _setItemHeight(height) { - var style = document.createElement('style'); - style.innerText = ".uni-picker-view-content.".concat(this.scope, ">*{height: ").concat(height, "px;overflow: hidden;}"); - document.head.appendChild(style); - }, - _handleTrack: function _handleTrack(e) { - if (this._scroller) { - switch (e.detail.state) { - case 'start': - this._handleTouchStart(e); - - break; - - case 'move': - this._handleTouchMove(e); - - break; - - case 'end': - case 'cancel': - this._handleTouchEnd(e); - - } - } - }, - _handleTap: function _handleTap(e) { - if (e.target !== e.currentTarget && !this._scroller.isScrolling()) { - var t = e.touches && e.touches[0] && e.touches[0].clientY; - var n = typeof t === 'number' ? t : e.detail.y - document.body.scrollTop; - var i = this.$el.getBoundingClientRect(); - var r = n - i.top - this._height / 2; - var o = this.indicatorHeight / 2; - - if (!(Math.abs(r) <= o)) { - var a = Math.ceil((Math.abs(r) - o) / this.indicatorHeight); - var s = r < 0 ? -a : a; - this.current += s; - - this._scroller.scrollTo(this.current * this.indicatorHeight); - } - } - }, - setCurrent: function setCurrent(current) { - if (current !== this.current) { - this.current = current; - - if (this.inited) { - this.update(); + else if (CSS.supports('top: constant(safe-area-inset-top)')) { + support = 'constant'; + } + else { + support = ''; + } + return support; +} +function init() { + support = typeof support === 'string' ? support : getSupport(); + if (!support) { + attrs.forEach(function (attr) { + elementComputedStyle[attr] = 0; + }); + return; + } + function setStyle(el, style) { + var elStyle = el.style; + Object.keys(style).forEach(function (key) { + var val = style[key]; + elStyle[key] = val; + }); + } + var cbs = []; + function parentReady(callback) { + if (callback) { + cbs.push(callback); } - } - }, - init: function init() { - var _this2 = this; - - this.initScroller(this.$refs.content, { - enableY: true, - enableX: false, - enableSnap: true, - itemSize: this.indicatorHeight, - friction: new Friction["a" /* Friction */](0.0001), - spring: new Spring["a" /* Spring */](2, 90, 20), - onSnap: function onSnap(index) { - if (!isNaN(index) && index !== _this2.current) { - _this2.current = index; - } + else { + cbs.forEach(function (cb) { + cb(); + }); } - }); - this.inited = true; - }, - update: function update() { - var _this3 = this; - - this.$nextTick(function () { - var index = Math.max(_this3.length - 1, 0); - var current = Math.min(_this3.current, index); - - _this3._scroller.update(current * _this3.indicatorHeight, undefined, _this3.indicatorHeight); - }); - }, - _resize: function _resize(_ref) { - var height = _ref.height; - this.indicatorHeight = height; } - }, - render: function render(createElement) { - this.length = this.$slots.default && this.$slots.default.length || 0; - return createElement('uni-picker-view-column', { - on: { - tap: this._handleTap - } - }, [createElement('div', { - ref: 'main', - staticClass: 'uni-picker-view-group' - }, [createElement('div', { - ref: 'mask', - staticClass: 'uni-picker-view-mask', - class: this.maskClass, - style: "background-size: 100% ".concat(this.maskSize, "px;").concat(this.maskStyle) - }), createElement('div', { - ref: 'indicator', - staticClass: 'uni-picker-view-indicator', - class: this.indicatorClass, - style: this.indicatorStyle - }, [createElement('v-uni-resize-sensor', { - attrs: { - initial: true - }, - on: { - resize: this._resize - } - })]), createElement('div', { - ref: 'content', - staticClass: 'uni-picker-view-content', - class: this.scope, - style: "padding: ".concat(this.maskSize, "px 0;") - }, [this.$slots.default])])]); - } -}); -// CONCATENATED MODULE: ./src/core/view/components/picker-view-column/index.vue?vue&type=script&lang=js& - /* harmony default export */ var components_picker_view_columnvue_type_script_lang_js_ = (picker_view_columnvue_type_script_lang_js_); -// EXTERNAL MODULE: ./src/core/view/components/picker-view-column/index.vue?vue&type=style&index=0&lang=css& -var picker_view_columnvue_type_style_index_0_lang_css_ = __webpack_require__("edfa"); - -// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js -var componentNormalizer = __webpack_require__("0c7c"); - -// CONCATENATED MODULE: ./src/core/view/components/picker-view-column/index.vue -var render, staticRenderFns - - - - - -/* normalize component */ - -var component = Object(componentNormalizer["a" /* default */])( - components_picker_view_columnvue_type_script_lang_js_, - render, - staticRenderFns, - false, - null, - null, - null - -) - -/* harmony default export */ var picker_view_column = __webpack_exports__["default"] = (component.exports); - -/***/ }), - -/***/ "1b6f": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("f2b3"); - -/* harmony default export */ __webpack_exports__["a"] = ({ - // 取消id的定义,某些组件(canvas)内不在props内定义id - // props: { - // id: { - // type: String, - // default: '' - // } - // }, - mounted: function mounted() { - var _this = this; - - this._toggleListeners('subscribe', this.id); // 初始化监听 - - - this.$watch('id', function (newId, oldId) { - // watch id - _this._toggleListeners('unsubscribe', oldId, true); - - _this._toggleListeners('subscribe', newId, true); - }); - }, - beforeDestroy: function beforeDestroy() { - // 销毁时移除 - this._toggleListeners('unsubscribe', this.id); - }, - methods: { - _toggleListeners: function _toggleListeners(type, id, watch) { - if (watch && !id) { - // id被置空 - return; - } - - if (!Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "c"])(this._handleSubscribe)) { - return; - } // 纠正VUniVideo等组件命名为Video - - - UniViewJSBridge[type](this.$page.id + '-' + this.$options.name.replace(/VUni([A-Z])/, '$1').toLowerCase() + '-' + id, this._handleSubscribe); - } - } -}); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("501c"))) - -/***/ }), - -/***/ "1c64": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("9613"); -/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__); -/* unused harmony reexport * */ - /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a); - -/***/ }), - -/***/ "1e88": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getWindowOffset; }); -function getWindowOffset() { - return { - top: 0, - bottom: 0 - }; -} - -/***/ }), - -/***/ "1efd": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// EXTERNAL MODULE: ./packages/uni-app-plus/dist/view.runtime.esm.js -var view_runtime_esm = __webpack_require__("675f"); - -// CONCATENATED MODULE: ./src/core/helpers/get-real-route.js -function getRealRoute(fromRoute, toRoute) { - if (!toRoute) { - toRoute = fromRoute; - - if (toRoute.indexOf('/') === 0) { - return toRoute; + var passiveEvents = false; + try { + var opts = Object.defineProperty({}, 'passive', { + get: function () { + passiveEvents = { passive: true }; + } + }); + window.addEventListener('test', null, opts); } - - var pages = getCurrentPages(); - - if (pages.length) { - fromRoute = pages[pages.length - 1].$page.route; - } else { - fromRoute = ''; + catch (e) { } - } else { - if (toRoute.indexOf('/') === 0) { - return toRoute; + function addChild(parent, attr) { + var a1 = document.createElement('div'); + var a2 = document.createElement('div'); + var a1Children = document.createElement('div'); + var a2Children = document.createElement('div'); + var W = 100; + var MAX = 10000; + var aStyle = { + position: 'absolute', + width: W + 'px', + height: '200px', + boxSizing: 'border-box', + overflow: 'hidden', + paddingBottom: support + "(safe-area-inset-" + attr + ")" + }; + setStyle(a1, aStyle); + setStyle(a2, aStyle); + setStyle(a1Children, { + transition: '0s', + animation: 'none', + width: '400px', + height: '400px' + }); + setStyle(a2Children, { + transition: '0s', + animation: 'none', + width: '250%', + height: '250%' + }); + a1.appendChild(a1Children); + a2.appendChild(a2Children); + parent.appendChild(a1); + parent.appendChild(a2); + parentReady(function () { + a1.scrollTop = a2.scrollTop = MAX; + var a1LastScrollTop = a1.scrollTop; + var a2LastScrollTop = a2.scrollTop; + function onScroll() { + if (this.scrollTop === (this === a1 ? a1LastScrollTop : a2LastScrollTop)) { + return; + } + a1.scrollTop = a2.scrollTop = MAX; + a1LastScrollTop = a1.scrollTop; + a2LastScrollTop = a2.scrollTop; + attrChange(attr); + } + a1.addEventListener('scroll', onScroll, passiveEvents); + a2.addEventListener('scroll', onScroll, passiveEvents); + }); + var computedStyle = getComputedStyle(a1); + Object.defineProperty(elementComputedStyle, attr, { + configurable: true, + get: function () { + return parseFloat(computedStyle.paddingBottom); + } + }); } - } - - if (toRoute.indexOf('./') === 0) { - return getRealRoute(fromRoute, toRoute.substr(2)); - } - - var toRouteArray = toRoute.split('/'); - var toRouteLength = toRouteArray.length; - var i = 0; - - for (; i < toRouteLength && toRouteArray[i] === '..'; i++) {// noop - } - - toRouteArray.splice(0, i); - toRoute = toRouteArray.join('/'); - var fromRouteArray = fromRoute.length > 0 ? fromRoute.split('/') : []; - fromRouteArray.splice(fromRouteArray.length - i - 1, i + 1); - return '/' + fromRouteArray.concat(toRouteArray).join('/'); + var parentDiv = document.createElement('div'); + setStyle(parentDiv, { + position: 'absolute', + left: '0', + top: '0', + width: '0', + height: '0', + zIndex: '-1', + overflow: 'hidden', + visibility: 'hidden', + }); + attrs.forEach(function (key) { + addChild(parentDiv, key); + }); + document.body.appendChild(parentDiv); + parentReady(); + inited = true; } -// CONCATENATED MODULE: ./src/platforms/app-plus/helpers/get-real-path.js - -var SCHEME_RE = /^([a-z-]+:)?\/\//i; -var DATA_RE = /^data:.*,.*/; - -function addBase(filePath) { - return filePath; +function getAttr(attr) { + if (!inited) { + init(); + } + return elementComputedStyle[attr]; } - -function getRealPath(filePath) { - if (filePath.indexOf('/') === 0) { - if (filePath.indexOf('//') === 0) { - filePath = 'https:' + filePath; - } else { - return addBase(filePath.substr(1)); +var changeAttrs = []; +function attrChange(attr) { + if (!changeAttrs.length) { + setTimeout(function () { + var style = {}; + changeAttrs.forEach(function (attr) { + style[attr] = elementComputedStyle[attr]; + }); + changeAttrs.length = 0; + callbacks.forEach(function (callback) { + callback(style); + }); + }, 0); } - } // 网络资源或base64 - - - if (SCHEME_RE.test(filePath) || DATA_RE.test(filePath) || filePath.indexOf('blob:') === 0) { - return filePath; - } - - var pages = getCurrentPages(); - - if (pages.length) { - return addBase(getRealRoute(pages[pages.length - 1].$page.route, filePath).substr(1)); - } - - return filePath; + changeAttrs.push(attr); } -// EXTERNAL MODULE: ./src/core/view/plugins/events.js + 1 modules -var events = __webpack_require__("d4b6"); - -// CONCATENATED MODULE: ./src/core/view/mixins/base.js - - -/* harmony default export */ var base = ({ - methods: { - $getRealPath: function $getRealPath(src) { - return getRealPath(src); - }, - $trigger: function $trigger(name, $event, detail) { - this.$emit(name, events["b" /* processEvent */].call(this, name, $event, detail, this.$el, this.$el)); +var callbacks = []; +function onChange(callback) { + if (!getSupport()) { + return; } - } -}); -// CONCATENATED MODULE: ./src/core/view/mixins/animation.js -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } - -function converPx(value) { - if (/\d+[ur]px$/i.test(value)) { - value.replace(/\d+[ur]px$/i, function (text) { - return "".concat(uni.upx2px(parseFloat(text)), "px"); - }); // eslint-disable-next-line no-useless-escape - } else if (/^-?[\d\.]+$/.test(value)) { - return "".concat(value, "px"); - } - - return value || ''; -} - -function converType(type) { - return type.replace(/[A-Z]/g, function (text) { - return "-".concat(text.toLowerCase()); - }).replace('webkit', '-webkit'); -} - -function getStyle(action) { - var animateTypes1 = ['matrix', 'matrix3d', 'scale', 'scale3d', 'rotate3d', 'skew', 'translate', 'translate3d']; - var animateTypes2 = ['scaleX', 'scaleY', 'scaleZ', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'skewX', 'skewY', 'translateX', 'translateY', 'translateZ']; - var animateTypes3 = ['opacity', 'backgroundColor']; - var animateTypes4 = ['width', 'height', 'left', 'right', 'top', 'bottom']; - var animates = action.animates; - var option = action.option; - var transition = option.transition; - var style = {}; - var transform = []; - animates.forEach(function (animate) { - var type = animate.type; - - var args = _toConsumableArray(animate.args); - - if (animateTypes1.concat(animateTypes2).includes(type)) { - if (type.startsWith('rotate') || type.startsWith('skew')) { - args = args.map(function (value) { - return parseFloat(value) + 'deg'; - }); - } else if (type.startsWith('translate')) { - args = args.map(converPx); - } - - if (animateTypes2.indexOf(type)) { - args.length = 1; - } - - transform.push("".concat(type, "(").concat(args.join(','), ")")); - } else if (animateTypes3.concat(animateTypes4).includes(args[0])) { - type = args[0]; - var value = args[1]; - style[type] = animateTypes4.includes(type) ? converPx(value) : value; - } - }); - style.transform = style.webkitTransform = transform.join(' '); - style.transition = style.webkitTransition = Object.keys(style).map(function (type) { - return "".concat(converType(type), " ").concat(transition.duration, "ms ").concat(transition.timingFunction, " ").concat(transition.delay, "ms"); - }).join(','); - style.transformOrigin = style.webkitTransformOrigin = option.transformOrigin; - return style; -} - -function startAnimation(context) { - var animation = context.animation; - - if (!animation || !animation.actions || !animation.actions.length) { - return; - } - - var index = 0; - var actions = animation.actions; - var length = animation.actions.length; - - function animate() { - var action = actions[index]; - var transition = action.option.transition; - var style = getStyle(action); - Object.keys(style).forEach(function (key) { - context.$el.style[key] = style[key]; - }); - index += 1; - - if (index < length) { - setTimeout(animate, transition.duration + transition.delay); - } - } - - animate(); -} - -/* harmony default export */ var animation = ({ - props: ['animation'], - watch: { - animation: function animation() { - startAnimation(this); - } - }, - mounted: function mounted() { - startAnimation(this); - } -}); -// CONCATENATED MODULE: ./src/core/view/components/index.js - - - -var requireComponents = [// baseComponents -__webpack_require__("5408"), __webpack_require__("1922")]; -requireComponents.forEach(function (components, index) { - components.keys().forEach(function (fileName) { - // 获取组件配置 - var componentModule = components(fileName); - var componentConfig = componentModule.default || componentModule; - componentConfig.mixins = componentConfig.mixins ? [].concat(base, componentConfig.mixins) : [base]; - componentConfig.mixins.push(animation); - componentConfig.name = 'VUni' + componentConfig.name; - componentConfig.isReserved = true; // 全局注册组件 - - view_runtime_esm["a" /* default */].component(componentConfig.name, componentConfig); - }); -}); - -/***/ }), - -/***/ "24aa": -/***/ (function(module, exports) { - -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || new Function("return this")(); -} catch (e) { - // This works if the window reference is available - if (typeof window === "object") g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - - -/***/ }), - -/***/ "250d": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7050de7c-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/input/index.vue?vue&type=template&id=21a5c886& -var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('uni-input',_vm._g({on:{"change":function($event){$event.stopPropagation();}}},_vm.$listeners),[_c('div',{ref:"wrapper",staticClass:"uni-input-wrapper"},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(!(_vm.composing || _vm.inputValue.length)),expression:"!(composing || inputValue.length)"}],ref:"placeholder",staticClass:"uni-input-placeholder",class:_vm.placeholderClass,style:(_vm.placeholderStyle)},[_vm._v(_vm._s(_vm.placeholder))]),((_vm.inputType)==='checkbox')?_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.inputValue),expression:"inputValue"}],ref:"input",staticClass:"uni-input-input",attrs:{"disabled":_vm.disabled,"maxlength":_vm.maxlength,"step":_vm.step,"autocomplete":"off","type":"checkbox"},domProps:{"checked":Array.isArray(_vm.inputValue)?_vm._i(_vm.inputValue,null)>-1:(_vm.inputValue)},on:{"focus":_vm._onFocus,"blur":_vm._onBlur,"input":function($event){$event.stopPropagation();return _vm._onInput($event)},"compositionstart":_vm._onComposition,"compositionend":_vm._onComposition,"keyup":function($event){$event.stopPropagation();return _vm._onKeyup($event)},"change":function($event){var $$a=_vm.inputValue,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.inputValue=$$a.concat([$$v]))}else{$$i>-1&&(_vm.inputValue=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{_vm.inputValue=$$c}}}}):((_vm.inputType)==='radio')?_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.inputValue),expression:"inputValue"}],ref:"input",staticClass:"uni-input-input",attrs:{"disabled":_vm.disabled,"maxlength":_vm.maxlength,"step":_vm.step,"autocomplete":"off","type":"radio"},domProps:{"checked":_vm._q(_vm.inputValue,null)},on:{"focus":_vm._onFocus,"blur":_vm._onBlur,"input":function($event){$event.stopPropagation();return _vm._onInput($event)},"compositionstart":_vm._onComposition,"compositionend":_vm._onComposition,"keyup":function($event){$event.stopPropagation();return _vm._onKeyup($event)},"change":function($event){_vm.inputValue=null}}}):_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.inputValue),expression:"inputValue"}],ref:"input",staticClass:"uni-input-input",attrs:{"disabled":_vm.disabled,"maxlength":_vm.maxlength,"step":_vm.step,"autocomplete":"off","type":_vm.inputType},domProps:{"value":(_vm.inputValue)},on:{"focus":_vm._onFocus,"blur":_vm._onBlur,"input":[function($event){if($event.target.composing){ return; }_vm.inputValue=$event.target.value},function($event){$event.stopPropagation();return _vm._onInput($event)}],"compositionstart":_vm._onComposition,"compositionend":_vm._onComposition,"keyup":function($event){$event.stopPropagation();return _vm._onKeyup($event)}}})])])} -var staticRenderFns = [] - - -// CONCATENATED MODULE: ./src/core/view/components/input/index.vue?vue&type=template&id=21a5c886& - -// EXTERNAL MODULE: ./src/core/view/mixins/index.js + 1 modules -var mixins = __webpack_require__("8af1"); - -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/input/index.vue?vue&type=script&lang=js& -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// - -var INPUT_TYPES = ['text', 'number', 'idcard', 'digit', 'password']; -var NUMBER_TYPES = ['number', 'digit']; -/* harmony default export */ var inputvue_type_script_lang_js_ = ({ - name: 'Input', - mixins: [mixins["a" /* emitter */]], - model: { - prop: 'value', - event: 'update:value' - }, - props: { - name: { - type: String, - default: '' - }, - value: { - type: [String, Number], - default: '' - }, - type: { - type: String, - default: 'text' - }, - password: { - type: [Boolean, String], - default: false - }, - placeholder: { - type: String, - default: '' - }, - placeholderStyle: { - type: String, - default: '' - }, - placeholderClass: { - type: String, - default: '' - }, - disabled: { - type: [Boolean, String], - default: false - }, - maxlength: { - type: [Number, String], - default: 140 - }, - focus: { - type: [Boolean, String], - default: false - }, - confirmType: { - type: String, - default: 'done' - } - }, - data: function data() { - return { - inputValue: this.value + '', - composing: false, - wrapperHeight: 0, - cachedValue: '' - }; - }, - computed: { - inputType: function inputType() { - var type = ''; - - switch (this.type) { - case 'text': - this.confirmType === 'search' && (type = 'search'); - break; - - case 'idcard': - // TODO 可能要根据不同平台进行区分处理 - type = 'text'; - break; - - case 'digit': - type = 'number'; - break; - - default: - type = ~INPUT_TYPES.indexOf(this.type) ? this.type : 'text'; - break; - } - - return this.password ? 'password' : type; - }, - step: function step() { - // 处理部分设备中无法输入小数点的问题 - return ~NUMBER_TYPES.indexOf(this.type) ? '0.000000000000000001' : ''; - } - }, - watch: { - focus: function focus(value) { - value && this._focusInput(); - }, - value: function value(_value) { - this.inputValue = _value + ''; - }, - inputValue: function inputValue(value) { - this.$emit('update:value', value); - }, - maxlength: function maxlength(value) { - var realValue = this.inputValue.slice(0, parseInt(value, 10)); - realValue !== this.inputValue && (this.inputValue = realValue); - } - }, - created: function created() { - this.$dispatch('Form', 'uni-form-group-update', { - type: 'add', - vm: this - }); - }, - mounted: function mounted() { - if (this.confirmType === 'search') { - var formElem = document.createElement('form'); - formElem.action = ''; - - formElem.onsubmit = function () { - return false; - }; - - formElem.className = 'uni-input-form'; - formElem.appendChild(this.$refs.input); - this.$refs.wrapper.appendChild(formElem); - } - - var $vm = this; - - while ($vm) { - var scopeId = $vm.$options._scopeId; - - if (scopeId) { - this.$refs.placeholder.setAttribute(scopeId, ''); - } - - $vm = $vm.$parent; - } - - this.focus && this._focusInput(); - }, - beforeDestroy: function beforeDestroy() { - this.$dispatch('Form', 'uni-form-group-update', { - type: 'remove', - vm: this - }); - }, - methods: { - _onKeyup: function _onKeyup($event) { - if ($event.keyCode === 13) { - this.$trigger('confirm', $event, { - value: $event.target.value - }); - } - }, - _onInput: function _onInput($event) { - if (this.composing) { - return; - } // 处理部分输入法可以输入其它字符的情况 - - - if (~NUMBER_TYPES.indexOf(this.type)) { - if (this.$refs.input.validity && !this.$refs.input.validity.valid) { - $event.target.value = this.cachedValue; - this.inputValue = $event.target.value; // 输入非法字符不触发 input 事件 - - return; - } else { - this.cachedValue = this.inputValue; - } - } // type="number" 不支持 maxlength 属性,因此需要主动限制长度。 - - - if (this.inputType === 'number') { - var maxlength = parseInt(this.maxlength, 10); - - if (maxlength > 0 && $event.target.value.length > maxlength) { - $event.target.value = $event.target.value.slice(0, maxlength); - this.inputValue = $event.target.value; // 字符长度超出范围不触发 input 事件 - - return; - } - } - - this.$trigger('input', $event, { - value: this.inputValue - }); - }, - _onFocus: function _onFocus($event) { - this.$trigger('focus', $event, { - value: $event.target.value - }); - }, - _onBlur: function _onBlur($event) { - this.$trigger('blur', $event, { - value: $event.target.value - }); - }, - _focusInput: function _focusInput() { - var _this = this; - - setTimeout(function () { - _this.$refs.input.focus(); - }, 350); - }, - _blurInput: function _blurInput() { - var _this2 = this; - - setTimeout(function () { - _this2.$refs.input.blur(); - }, 350); - }, - _onComposition: function _onComposition($event) { - if ($event.type === 'compositionstart') { - this.composing = true; - } else { - this.composing = false; - } - }, - _resetFormData: function _resetFormData() { - this.inputValue = ''; - }, - _getFormData: function _getFormData() { - return this.name ? { - value: this.inputValue, - key: this.name - } : {}; - } - } -}); -// CONCATENATED MODULE: ./src/core/view/components/input/index.vue?vue&type=script&lang=js& - /* harmony default export */ var components_inputvue_type_script_lang_js_ = (inputvue_type_script_lang_js_); -// EXTERNAL MODULE: ./src/core/view/components/input/index.vue?vue&type=style&index=0&lang=css& -var inputvue_type_style_index_0_lang_css_ = __webpack_require__("0f55"); - -// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js -var componentNormalizer = __webpack_require__("0c7c"); - -// CONCATENATED MODULE: ./src/core/view/components/input/index.vue - - - - - - -/* normalize component */ - -var component = Object(componentNormalizer["a" /* default */])( - components_inputvue_type_script_lang_js_, - render, - staticRenderFns, - false, - null, - null, - null - -) - -/* harmony default export */ var input = __webpack_exports__["default"] = (component.exports); - -/***/ }), - -/***/ "25ce": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7050de7c-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/checkbox-group/index.vue?vue&type=template&id=6fa043c2& -var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('uni-checkbox-group',_vm._g({},_vm.$listeners),[_vm._t("default")],2)} -var staticRenderFns = [] - - -// CONCATENATED MODULE: ./src/core/view/components/checkbox-group/index.vue?vue&type=template&id=6fa043c2& - -// EXTERNAL MODULE: ./src/core/view/mixins/index.js + 1 modules -var mixins = __webpack_require__("8af1"); - -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/checkbox-group/index.vue?vue&type=script&lang=js& -// -// -// -// -// -// - -/* harmony default export */ var checkbox_groupvue_type_script_lang_js_ = ({ - name: 'CheckboxGroup', - mixins: [mixins["a" /* emitter */], mixins["c" /* listeners */]], - props: { - name: { - type: String, - default: '' - } - }, - data: function data() { - return { - checkboxList: [] - }; - }, - listeners: { - '@checkbox-change': '_changeHandler', - '@checkbox-group-update': '_checkboxGroupUpdateHandler' - }, - created: function created() { - this.$dispatch('Form', 'uni-form-group-update', { - type: 'add', - vm: this - }); - }, - beforeDestroy: function beforeDestroy() { - this.$dispatch('Form', 'uni-form-group-update', { - type: 'remove', - vm: this - }); - }, - methods: { - _changeHandler: function _changeHandler($event) { - var value = []; - this.checkboxList.forEach(function (vm) { - if (vm.checkboxChecked) { - value.push(vm.value); - } - }); - this.$trigger('change', $event, { - value: value - }); - }, - _checkboxGroupUpdateHandler: function _checkboxGroupUpdateHandler($event) { - if ($event.type === 'add') { - this.checkboxList.push($event.vm); - } else { - var index = this.checkboxList.indexOf($event.vm); - this.checkboxList.splice(index, 1); - } - }, - _getFormData: function _getFormData() { - var data = {}; - - if (this.name !== '') { - var value = []; - this.checkboxList.forEach(function (vm) { - if (vm.checkboxChecked) { - value.push(vm.value); - } - }); - data['value'] = value; - data['key'] = this.name; - } - - return data; - } - } -}); -// CONCATENATED MODULE: ./src/core/view/components/checkbox-group/index.vue?vue&type=script&lang=js& - /* harmony default export */ var components_checkbox_groupvue_type_script_lang_js_ = (checkbox_groupvue_type_script_lang_js_); -// EXTERNAL MODULE: ./src/core/view/components/checkbox-group/index.vue?vue&type=style&index=0&lang=css& -var checkbox_groupvue_type_style_index_0_lang_css_ = __webpack_require__("0998"); - -// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js -var componentNormalizer = __webpack_require__("0c7c"); - -// CONCATENATED MODULE: ./src/core/view/components/checkbox-group/index.vue - - - - - - -/* normalize component */ - -var component = Object(componentNormalizer["a" /* default */])( - components_checkbox_groupvue_type_script_lang_js_, - render, - staticRenderFns, - false, - null, - null, - null - -) - -/* harmony default export */ var checkbox_group = __webpack_exports__["default"] = (component.exports); - -/***/ }), - -/***/ "27ab": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/picker-view/index.vue?vue&type=script&lang=js& -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } - -/* harmony default export */ var picker_viewvue_type_script_lang_js_ = ({ - name: 'PickerView', - props: { - value: { - type: Array, - default: function _default() { - return []; - }, - validator: function validator(val) { - return Array.isArray(val) && val.filter(function (val) { - return typeof val === 'number'; - }).length === val.length; - } - }, - indicatorStyle: { - type: String, - default: '' - }, - indicatorClass: { - type: String, - default: '' - }, - maskStyle: { - type: String, - default: '' - }, - maskClass: { - type: String, - default: '' - } - }, - data: function data() { - return { - valueSync: _toConsumableArray(this.value), - height: 34, - items: [], - changeSource: '' - }; - }, - watch: { - value: function value(val) { - var _this = this; - - this.valueSync.length = val.length; - val.forEach(function (val, index) { - if (val !== _this.valueSync[index]) { - _this.$set(_this.valueSync, index, val); - } - }); - }, - valueSync: { - deep: true, - handler: function handler(val, oldVal) { - if (this.changeSource === '') { - this._valueChanged(val); - } else { - this.changeSource = ''; // 避免外部直接对此值进行修改 - - var value = val.map(function (val) { - return val; - }); - this.$emit('update:value', value); - this.$trigger('change', {}, { - value: value - }); - } - } - } - }, - methods: { - getItemIndex: function getItemIndex(vnode) { - return this.items.indexOf(vnode); - }, - getItemValue: function getItemValue(vm) { - return this.valueSync[this.getItemIndex(vm.$vnode)] || 0; - }, - setItemValue: function setItemValue(vm, val) { - var index = this.getItemIndex(vm.$vnode); - var oldVal = this.valueSync[index]; - - if (oldVal !== val) { - this.changeSource = 'touch'; - this.$set(this.valueSync, index, val); - } - }, - _valueChanged: function _valueChanged(val) { - this.items.forEach(function (item, index) { - item.componentInstance.setCurrent(val[index] || 0); - }); - }, - _resize: function _resize(_ref) { - var height = _ref.height; - this.height = height; - } - }, - render: function render(createElement) { - var items = []; - - if (this.$slots.default) { - this.$slots.default.forEach(function (vnode) { - if (vnode.componentOptions && vnode.componentOptions.tag === 'v-uni-picker-view-column') { - items.push(vnode); - } - }); - } - - this.items = items; - return createElement('uni-picker-view', { - on: this.$listeners - }, [createElement('v-uni-resize-sensor', { - attrs: { - initial: true - }, - on: { - resize: this._resize - } - }), createElement('div', { - ref: 'wrapper', - 'class': 'uni-picker-view-wrapper' - }, items)]); - } -}); -// CONCATENATED MODULE: ./src/core/view/components/picker-view/index.vue?vue&type=script&lang=js& - /* harmony default export */ var components_picker_viewvue_type_script_lang_js_ = (picker_viewvue_type_script_lang_js_); -// EXTERNAL MODULE: ./src/core/view/components/picker-view/index.vue?vue&type=style&index=0&lang=css& -var picker_viewvue_type_style_index_0_lang_css_ = __webpack_require__("6062"); - -// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js -var componentNormalizer = __webpack_require__("0c7c"); - -// CONCATENATED MODULE: ./src/core/view/components/picker-view/index.vue -var render, staticRenderFns - - - - - -/* normalize component */ - -var component = Object(componentNormalizer["a" /* default */])( - components_picker_viewvue_type_script_lang_js_, - render, - staticRenderFns, - false, - null, - null, - null - -) - -/* harmony default export */ var picker_view = __webpack_exports__["default"] = (component.exports); - -/***/ }), - -/***/ "2bbe": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7050de7c-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/view/index.vue?vue&type=template&id=164058a7& -var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.hoverClass && _vm.hoverClass !== 'none')?_c('uni-view',_vm._g({class:[_vm.hovering?_vm.hoverClass:''],on:{"touchstart":_vm._hoverTouchStart,"touchend":_vm._hoverTouchEnd,"touchcancel":_vm._hoverTouchCancel}},_vm.$listeners),[_vm._t("default")],2):_c('uni-view',_vm._g({},_vm.$listeners),[_vm._t("default")],2)} -var staticRenderFns = [] - - -// CONCATENATED MODULE: ./src/core/view/components/view/index.vue?vue&type=template&id=164058a7& - -// EXTERNAL MODULE: ./src/core/view/mixins/hover.js -var hover = __webpack_require__("83a6"); - -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/view/index.vue?vue&type=script&lang=js& -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// - -/* harmony default export */ var viewvue_type_script_lang_js_ = ({ - name: 'View', - mixins: [hover["a" /* default */]], - listeners: { - 'label-click': 'clickHandler' - } -}); -// CONCATENATED MODULE: ./src/core/view/components/view/index.vue?vue&type=script&lang=js& - /* harmony default export */ var components_viewvue_type_script_lang_js_ = (viewvue_type_script_lang_js_); -// EXTERNAL MODULE: ./src/core/view/components/view/index.vue?vue&type=style&index=0&lang=css& -var viewvue_type_style_index_0_lang_css_ = __webpack_require__("e865"); - -// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js -var componentNormalizer = __webpack_require__("0c7c"); - -// CONCATENATED MODULE: ./src/core/view/components/view/index.vue - - - - - - -/* normalize component */ - -var component = Object(componentNormalizer["a" /* default */])( - components_viewvue_type_script_lang_js_, - render, - staticRenderFns, - false, - null, - null, - null - -) - -/* harmony default export */ var view = __webpack_exports__["default"] = (component.exports); - -/***/ }), - -/***/ "33ed": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* unused harmony export disableScroll */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return pageScrollTo; }); -/* unused harmony export createScrollListener */ -/* harmony import */ var uni_platform_view_bridge__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("5bb5"); - -function disableScroll(evt) { - evt.preventDefault(); -} -function pageScrollTo(_ref) { - var scrollTop = _ref.scrollTop, - duration = _ref.duration; - var documentElement = document.documentElement; - var clientHeight = documentElement.clientHeight, - scrollHeight = documentElement.scrollHeight; - scrollTop = Math.min(scrollTop, scrollHeight - clientHeight); - - if (duration === 0) { - // 部分浏览器(比如微信)中 scrollTop 的值需要通过 document.body 来控制 - documentElement.scrollTop = document.body.scrollTop = scrollTop; - return; - } - - if (window.scrollY === scrollTop) { - return; - } - - function scrollTo(duration) { - if (duration <= 0) { - window.scrollTo(0, scrollTop); - return; - } - - var distaince = scrollTop - window.scrollY; - requestAnimationFrame(function () { - window.scrollTo(0, window.scrollY + distaince / duration * 10); - scrollTo(duration - 10); - }); - } - - scrollTo(duration); // TODO 暂不使用 transform 会导致 fixed 元素不可见 - // const body = document.body - // const bodyStyle = body.style - // - // function webkitTransitionEnd() { - // bodyStyle.webkitTransition = '' - // bodyStyle.webkitTransform = '' - // documentElement.scrollTop = scrollTop - // body.removeEventListener('webkitTransitionEnd', webkitTransitionEnd) - // } - // - // body.addEventListener('webkitTransitionEnd', webkitTransitionEnd) - // bodyStyle.webkitTransition = `-webkit-transform ${duration}ms ease-out` - // bodyStyle.webkitTransform = `translateY(${documentElement.scrollTop}px) translateZ(0)` -} -function createScrollListener(pageId, _ref2) { - var enablePageScroll = _ref2.enablePageScroll, - enablePageReachBottom = _ref2.enablePageReachBottom, - onReachBottomDistance = _ref2.onReachBottomDistance, - enableTransparentTitleNView = _ref2.enableTransparentTitleNView; - var ticking = false; - var hasReachBottom = false; - var onReachBottom = true; - - function isReachBottom() { - var _document$documentEle = document.documentElement, - clientHeight = _document$documentEle.clientHeight, - scrollHeight = _document$documentEle.scrollHeight; - var scrollY = window.scrollY; - var isBottom = scrollY > 0 && scrollHeight > clientHeight && scrollY + clientHeight + onReachBottomDistance >= scrollHeight; - - if (isBottom && !hasReachBottom) { - hasReachBottom = true; - return true; - } - - if (!isBottom && hasReachBottom) { - hasReachBottom = false; - } - - return false; - } - - function trigger() { - var pages = getCurrentPages(); - - if (!pages.length || pages[pages.length - 1].$page.id !== pageId) { - return; - } // publish - - - var scrollTop = window.pageYOffset; - - if (enablePageScroll) { - // 向 Service 发送 onPageScroll 事件 - Object(uni_platform_view_bridge__WEBPACK_IMPORTED_MODULE_0__[/* publishHandler */ "a"])('onPageScroll', { - scrollTop: scrollTop - }, pageId); - } - - if (enableTransparentTitleNView) { - UniViewJSBridge.emit('onPageScroll', { - scrollTop: scrollTop - }); - } - - if (enablePageReachBottom && onReachBottom && isReachBottom()) { - Object(uni_platform_view_bridge__WEBPACK_IMPORTED_MODULE_0__[/* publishHandler */ "a"])('onReachBottom', {}, pageId); - onReachBottom = false; - setTimeout(function () { - onReachBottom = true; - }, 350); - } - - ticking = false; - } - - return function onScroll() { - if (!ticking) { - requestAnimationFrame(trigger); - } - - ticking = true; - }; -} -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("501c"))) - -/***/ }), - -/***/ "3e5d": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return initData; }); -/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("a20d"); -/* harmony import */ var _vdom_sync__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("9d20"); -/* harmony import */ var _page__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("9856"); -var _handleData; - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } - -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - - - - -var vd; -var handleData = (_handleData = {}, _defineProperty(_handleData, _constants__WEBPACK_IMPORTED_MODULE_0__[/* PAGE_CREATE */ "c"], function onPageCreate(data) { - var _data = _slicedToArray(data, 1), - pageId = _data[0]; - - __uniConfig.id = pageId; - vd = new _vdom_sync__WEBPACK_IMPORTED_MODULE_1__[/* VDomSync */ "a"](pageId); -}), _defineProperty(_handleData, _constants__WEBPACK_IMPORTED_MODULE_0__[/* MOUNTED_DATA */ "b"], function onMounted(data) { - vd.addVData.apply(vd, data); -}), _defineProperty(_handleData, _constants__WEBPACK_IMPORTED_MODULE_0__[/* UPDATED_DATA */ "e"], function onUpdated(data) { - vd.updateVData.apply(vd, data); -}), _defineProperty(_handleData, _constants__WEBPACK_IMPORTED_MODULE_0__[/* PAGE_CREATED */ "d"], function onPageCreated(data) { - var _data2 = _slicedToArray(data, 1), - pagePath = _data2[0]; - - Object(_page__WEBPACK_IMPORTED_MODULE_2__[/* createPage */ "a"])(pagePath, { - mpType: 'page', - pageId: vd.pageId, - pagePath: pagePath - }).$mount('#app'); -}), _handleData); - -function vdSync(_ref) { - var data = _ref.data, - options = _ref.options; - data.forEach(function (data) { - handleData[data[0]](data[1]); - }); - vd.flush(); -} - -function initData(Vue) { - UniViewJSBridge.subscribe('vdSync', vdSync); - Object.defineProperty(Vue.prototype, '_$vd', { - get: function get() { - return !this.$options.isReserved && vd; - } - }); - Vue.mixin({ - beforeCreate: function beforeCreate() { - if (this.$options.mpType) { - this.mpType = this.$options.mpType; - } - - if (this._$vd) { - this._$vd.initVm(this); - - console.log("[".concat(this._$id, "] beforeCreate ") + Date.now()); - } else { - console.log("[null] beforeCreate " + Date.now()); - } - } - }); -} -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("501c"))) - -/***/ }), - -/***/ "3e8c": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/resize-sensor/index.vue?vue&type=script&lang=js& -/* harmony default export */ var resize_sensorvue_type_script_lang_js_ = ({ - name: 'ResizeSensor', - props: { - initial: { - type: [Boolean, String], - default: false - } - }, - data: function data() { - return { - size: { - width: -1, - height: -1 - } - }; - }, - watch: { - size: { - deep: true, - handler: function handler(size) { - this.$emit('resize', Object.assign({}, size)); - } - } - }, - mounted: function mounted() { - if (this.initial === true) { - this.$nextTick(this.update); - } - - if (this.$el.offsetParent !== this.$el.parentNode) { - this.$el.parentNode.style.position = 'relative'; - } - - if (!('AnimationEvent' in window)) { - this.reset(); - } - }, - methods: { - reset: function reset() { - var expand = this.$el.firstChild; - var shrink = this.$el.lastChild; - expand.scrollLeft = 100000; - expand.scrollTop = 100000; - shrink.scrollLeft = 100000; - shrink.scrollTop = 100000; - }, - update: function update() { - this.size.width = this.$el.offsetWidth; - this.size.height = this.$el.offsetHeight; - this.reset(); - } - }, - render: function render(create) { - return create('uni-resize-sensor', { - on: { - '~animationstart': this.update - } - }, [create('div', { - on: { - scroll: this.update - } - }, [create('div')]), create('div', { - on: { - scroll: this.update - } - }, [create('div')])]); - } -}); -// CONCATENATED MODULE: ./src/core/view/components/resize-sensor/index.vue?vue&type=script&lang=js& - /* harmony default export */ var components_resize_sensorvue_type_script_lang_js_ = (resize_sensorvue_type_script_lang_js_); -// EXTERNAL MODULE: ./src/core/view/components/resize-sensor/index.vue?vue&type=style&index=0&lang=css& -var resize_sensorvue_type_style_index_0_lang_css_ = __webpack_require__("64d0"); - -// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js -var componentNormalizer = __webpack_require__("0c7c"); - -// CONCATENATED MODULE: ./src/core/view/components/resize-sensor/index.vue -var render, staticRenderFns - - - - - -/* normalize component */ - -var component = Object(componentNormalizer["a" /* default */])( - components_resize_sensorvue_type_script_lang_js_, - render, - staticRenderFns, - false, - null, - null, - null - -) - -/* harmony default export */ var resize_sensor = __webpack_exports__["default"] = (component.exports); - -/***/ }), - -/***/ "4509": -/***/ (function(module, exports, __webpack_require__) { - -// extracted by mini-css-extract-plugin - -/***/ }), - -/***/ "4656": -/***/ (function(module, exports, __webpack_require__) { - -// extracted by mini-css-extract-plugin - -/***/ }), - -/***/ "4871": -/***/ (function(module, exports, __webpack_require__) { - -// extracted by mini-css-extract-plugin - -/***/ }), - -/***/ "488c": -/***/ (function(module, exports, __webpack_require__) { - -// extracted by mini-css-extract-plugin - -/***/ }), - -/***/ "4da7": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/text/index.vue?vue&type=script&lang=js& -var SPACE_UNICODE = { - 'ensp': "\u2002", - 'emsp': "\u2003", - 'nbsp': "\xA0" -}; -/* harmony default export */ var textvue_type_script_lang_js_ = ({ - name: 'Text', - props: { - selectable: { - type: [Boolean, String], - default: false - }, - space: { - type: String, - default: '' - }, - decode: { - type: [Boolean, String], - default: false - } - }, - methods: { - _decodeHtml: function _decodeHtml(htmlString) { - if (this.space && SPACE_UNICODE[this.space]) { - htmlString = htmlString.replace(/ /g, SPACE_UNICODE[this.space]); - } - - if (this.decode) { - htmlString = htmlString.replace(/ /g, SPACE_UNICODE.nbsp).replace(/ /g, SPACE_UNICODE.ensp).replace(/ /g, SPACE_UNICODE.emsp).replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, "'"); - } - - return htmlString; - } - }, - render: function render(createElement) { - var _this = this; - - var nodeList = []; - this.$slots.default && this.$slots.default.forEach(function (vnode) { - if (vnode.text) { - // 处理可能出现的多余的转义字符 - var nodeText = vnode.text.replace(/\\n/g, '\n'); - var texts = nodeText.split('\n'); - texts.forEach(function (text, index) { - nodeList.push(_this._decodeHtml(text)); - - if (index !== texts.length - 1) { - nodeList.push(createElement('br')); - } - }); - } else { - if (vnode.componentOptions && vnode.componentOptions.tag !== 'v-uni-text') { - console.warn(' 组件内只支持嵌套 ,不支持其它组件或自定义组件,否则会引发在不同平台的渲染差异。'); - } - - nodeList.push(vnode); - } - }); - return createElement('uni-text', { - on: this.$listeners, - attrs: { - selectable: !!this.selectable - } - }, [createElement('span', {}, nodeList)]); - } -}); -// CONCATENATED MODULE: ./src/core/view/components/text/index.vue?vue&type=script&lang=js& - /* harmony default export */ var components_textvue_type_script_lang_js_ = (textvue_type_script_lang_js_); -// EXTERNAL MODULE: ./src/core/view/components/text/index.vue?vue&type=style&index=0&lang=css& -var textvue_type_style_index_0_lang_css_ = __webpack_require__("c8ed"); - -// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js -var componentNormalizer = __webpack_require__("0c7c"); - -// CONCATENATED MODULE: ./src/core/view/components/text/index.vue -var render, staticRenderFns - - - - - -/* normalize component */ - -var component = Object(componentNormalizer["a" /* default */])( - components_textvue_type_script_lang_js_, - render, - staticRenderFns, - false, - null, - null, - null - -) - -/* harmony default export */ var components_text = __webpack_exports__["default"] = (component.exports); - -/***/ }), - -/***/ "4f1c": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7050de7c-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/switch/index.vue?vue&type=template&id=4b47fc1e& -var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('uni-switch',_vm._g({on:{"click":_vm._onClick}},_vm.$listeners),[_c('div',{staticClass:"uni-switch-wrapper"},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.type === 'switch'),expression:"type === 'switch'"}],staticClass:"uni-switch-input",class:[_vm.switchChecked ? 'uni-switch-input-checked' : ''],style:({backgroundColor: _vm.switchChecked ? _vm.color : '#DFDFDF',borderColor:_vm.switchChecked ? _vm.color : '#DFDFDF'})}),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.type === 'checkbox'),expression:"type === 'checkbox'"}],staticClass:"uni-checkbox-input",class:[_vm.switchChecked ? 'uni-checkbox-input-checked' : ''],style:({color: _vm.color})})])])} -var staticRenderFns = [] - - -// CONCATENATED MODULE: ./src/core/view/components/switch/index.vue?vue&type=template&id=4b47fc1e& - -// EXTERNAL MODULE: ./src/core/view/mixins/index.js + 1 modules -var mixins = __webpack_require__("8af1"); - -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/switch/index.vue?vue&type=script&lang=js& -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// - -/* harmony default export */ var switchvue_type_script_lang_js_ = ({ - name: 'Switch', - mixins: [mixins["a" /* emitter */], mixins["c" /* listeners */]], - props: { - name: { - type: String, - default: '' - }, - checked: { - type: [Boolean, String], - default: false - }, - type: { - type: String, - default: 'switch' - }, - id: { - type: String, - default: '' - }, - disabled: { - type: [Boolean, String], - default: false - }, - color: { - type: String, - default: '#007aff' - } - }, - data: function data() { - return { - switchChecked: this.checked - }; - }, - watch: { - checked: function checked(val) { - this.switchChecked = val; - } - }, - created: function created() { - this.$dispatch('Form', 'uni-form-group-update', { - type: 'add', - vm: this - }); - }, - beforeDestroy: function beforeDestroy() { - this.$dispatch('Form', 'uni-form-group-update', { - type: 'remove', - vm: this - }); - }, - listeners: { - 'label-click': '_onClick', - '@label-click': '_onClick' - }, - methods: { - _onClick: function _onClick($event) { - if (this.disabled) { - return; - } - - this.switchChecked = !this.switchChecked; - this.$trigger('change', $event, { - value: this.switchChecked - }); - }, - _resetFormData: function _resetFormData() { - this.switchChecked = false; - }, - _getFormData: function _getFormData() { - var data = {}; - - if (this.name !== '') { - data['value'] = this.switchChecked; - data['key'] = this.name; - } - - return data; - } - } -}); -// CONCATENATED MODULE: ./src/core/view/components/switch/index.vue?vue&type=script&lang=js& - /* harmony default export */ var components_switchvue_type_script_lang_js_ = (switchvue_type_script_lang_js_); -// EXTERNAL MODULE: ./src/core/view/components/switch/index.vue?vue&type=style&index=0&lang=css& -var switchvue_type_style_index_0_lang_css_ = __webpack_require__("a5ec"); - -// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js -var componentNormalizer = __webpack_require__("0c7c"); - -// CONCATENATED MODULE: ./src/core/view/components/switch/index.vue - - - - - - -/* normalize component */ - -var component = Object(componentNormalizer["a" /* default */])( - components_switchvue_type_script_lang_js_, - render, - staticRenderFns, - false, - null, - null, - null - -) - -/* harmony default export */ var components_switch = __webpack_exports__["default"] = (component.exports); - -/***/ }), - -/***/ "501c": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// EXTERNAL MODULE: ./packages/uni-app-plus/dist/view.runtime.esm.js -var view_runtime_esm = __webpack_require__("675f"); - -// EXTERNAL MODULE: ./src/shared/index.js + 4 modules -var shared = __webpack_require__("f2b3"); - -// EXTERNAL MODULE: ./src/core/helpers/index.js -var helpers = __webpack_require__("85b6"); - -// CONCATENATED MODULE: ./src/core/helpers/constants.js -var NAVBAR_HEIGHT = 44; -var TABBAR_HEIGHT = 50; -// EXTERNAL MODULE: ./src/core/view/bridge/subscribe/scroll.js -var subscribe_scroll = __webpack_require__("33ed"); - -// EXTERNAL MODULE: ./src/core/view/bridge/subscribe/api/request-component-info.js -var request_component_info = __webpack_require__("6bdf"); - -// EXTERNAL MODULE: ./src/core/view/bridge/subscribe/api/request-component-observer.js -var request_component_observer = __webpack_require__("5dc1"); - -// CONCATENATED MODULE: ./src/core/view/bridge/subscribe/api/index.js - - -/* harmony default export */ var api = ({ - requestComponentInfo: request_component_info["a" /* requestComponentInfo */], - requestComponentObserver: request_component_observer["b" /* requestComponentObserver */], - destroyComponentObserver: request_component_observer["a" /* destroyComponentObserver */] -}); -// CONCATENATED MODULE: ./src/core/view/bridge/subscribe/index.js - - - - - -var passiveOptions = shared["e" /* supportsPassive */] ? { - passive: false -} : false; - -function updateCssVar(vm) { - if (uni.canIUse('css.var')) { - var pageVm = vm.$parent.$parent; - var windowTop = pageVm.showNavigationBar && pageVm.navigationBar.type !== 'transparent' && pageVm.navigationBar.type !== 'float' ? NAVBAR_HEIGHT + 'px' : '0px'; - var windowBottom = getApp().$children[0].showTabBar ? TABBAR_HEIGHT + 'px' : '0px'; - var style = document.documentElement.style; - style.setProperty('--window-top', windowTop); - style.setProperty('--window-bottom', windowBottom); - console.debug("".concat(vm.$page.route, "[").concat(vm.$page.id, "]\uFF1A--window-top=").concat(windowTop)); - console.debug("".concat(vm.$page.route, "[").concat(vm.$page.id, "]\uFF1A--window-bottom=").concat(windowBottom)); - } -} - -function initSubscribe(subscribe) { - Object.keys(api).forEach(function (name) { - subscribe(name, api[name]); - }); - subscribe('pageScrollTo', subscribe_scroll["a" /* pageScrollTo */]); - - if (false) { var disableScrollListener, scrollListener; } -} -// EXTERNAL MODULE: ./src/platforms/app-plus/view/bridge.js -var bridge = __webpack_require__("5bb5"); - -// CONCATENATED MODULE: ./src/core/view/bridge/index.js -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "on", function() { return on; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "off", function() { return off; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return once; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "emit", function() { return emit; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribe", function() { return bridge_subscribe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unsubscribe", function() { return unsubscribe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeHandler", function() { return subscribeHandler; }); -/* concated harmony reexport publishHandler */__webpack_require__.d(__webpack_exports__, "publishHandler", function() { return bridge["a" /* publishHandler */]; }); - - -var Emitter = new view_runtime_esm["a" /* default */](); -var on = Emitter.$on.bind(Emitter); -var off = Emitter.$off.bind(Emitter); -var once = Emitter.$once.bind(Emitter); -var emit = Emitter.$emit.bind(Emitter); -function bridge_subscribe(event, callback) { - return on('service.' + event, callback); -} -function unsubscribe(event, callback) { - return off('service.' + event, callback); -} -function subscribeHandler(event, args, pageId) { - emit('service.' + event, args, pageId); -} - -initSubscribe(bridge_subscribe); - -/***/ }), - -/***/ "5129": -/***/ (function(module, exports) { - -module.exports = ['uni-app', 'uni-tabbar', 'uni-page', 'uni-page-head', 'uni-page-wrapper', 'uni-page-body', 'uni-page-refresh', 'uni-actionsheet', 'uni-modal', 'uni-picker', 'uni-toast', 'uni-resize-sensor', 'uni-ad', 'uni-audio', 'uni-button', 'uni-camera', 'uni-canvas', 'uni-checkbox', 'uni-checkbox-group', 'uni-cover-image', 'uni-cover-view', 'uni-form', 'uni-functional-page-navigator', 'uni-icon', 'uni-image', 'uni-input', 'uni-label', 'uni-live-player', 'uni-live-pusher', 'uni-map', 'uni-movable-area', 'uni-movable-view', 'uni-navigator', 'uni-official-account', 'uni-open-data', 'uni-picker', 'uni-picker-view', 'uni-picker-view-column', 'uni-progress', 'uni-radio', 'uni-radio-group', 'uni-rich-text', 'uni-scroll-view', 'uni-slider', 'uni-swiper', 'uni-swiper-item', 'uni-switch', 'uni-text', 'uni-textarea', 'uni-video', 'uni-view', 'uni-web-view']; - -/***/ }), - -/***/ "5363": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Friction; }); -function Friction(e) { - this._drag = e; - this._dragLog = Math.log(e); - this._x = 0; - this._v = 0; - this._startTime = 0; -} - -Friction.prototype.set = function (e, t) { - this._x = e; - this._v = t; - this._startTime = new Date().getTime(); -}; - -Friction.prototype.setVelocityByEnd = function (e) { - this._v = (e - this._x) * this._dragLog / (Math.pow(this._drag, 100) - 1); -}; - -Friction.prototype.x = function (e) { - if (e === undefined) { - e = (new Date().getTime() - this._startTime) / 1e3; - } - - var t; - t = e === this._dt && this._powDragDt ? this._powDragDt : this._powDragDt = Math.pow(this._drag, e); - this._dt = e; - return this._x + this._v * t / this._dragLog - this._v / this._dragLog; -}; - -Friction.prototype.dx = function (e) { - if (e === undefined) { - e = (new Date().getTime() - this._startTime) / 1e3; - } - - var t; - t = e === this._dt && this._powDragDt ? this._powDragDt : this._powDragDt = Math.pow(this._drag, e); - this._dt = e; - return this._v * t; -}; - -Friction.prototype.done = function () { - return Math.abs(this.dx()) < 3; -}; - -Friction.prototype.reconfigure = function (e) { - var t = this.x(); - var n = this.dx(); - this._drag = e; - this._dragLog = Math.log(e); - this.set(t, n); -}; - -Friction.prototype.configuration = function () { - var e = this; - return [{ - label: 'Friction', - read: function read() { - return e._drag; - }, - write: function write(t) { - e.reconfigure(t); - }, - min: 0.001, - max: 0.1, - step: 0.001 - }]; -}; - -/***/ }), - -/***/ "5408": -/***/ (function(module, exports, __webpack_require__) { - -var map = { - "./button/index.vue": "d3bd", - "./canvas/index.vue": "bacd", - "./checkbox-group/index.vue": "25ce", - "./checkbox/index.vue": "7bb3", - "./form/index.vue": "b34d", - "./icon/index.vue": "9a8b", - "./image/index.vue": "1082", - "./input/index.vue": "250d", - "./label/index.vue": "70f4", - "./movable-area/index.vue": "c61c", - "./movable-view/index.vue": "8842", - "./navigator/index.vue": "17fd", - "./picker-view-column/index.vue": "1955", - "./picker-view/index.vue": "27ab", - "./picker/index.vue": "c35d", - "./progress/index.vue": "9b1f", - "./radio-group/index.vue": "d5ec", - "./radio/index.vue": "6491", - "./resize-sensor/index.vue": "3e8c", - "./rich-text/index.vue": "b705", - "./scroll-view/index.vue": "f1ef", - "./slider/index.vue": "9f96", - "./swiper-item/index.vue": "9213", - "./swiper/index.vue": "5513", - "./switch/index.vue": "4f1c", - "./text/index.vue": "4da7", - "./textarea/index.vue": "5768", - "./view/index.vue": "2bbe" -}; - - -function webpackContext(req) { - var id = webpackContextResolve(req); - return __webpack_require__(id); -} -function webpackContextResolve(req) { - var id = map[req]; - if(!(id + 1)) { // check for number or string - var e = new Error("Cannot find module '" + req + "'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; - } - return id; -} -webpackContext.keys = function webpackContextKeys() { - return Object.keys(map); -}; -webpackContext.resolve = webpackContextResolve; -module.exports = webpackContext; -webpackContext.id = "5408"; - -/***/ }), - -/***/ "5513": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// EXTERNAL MODULE: ./src/core/view/mixins/touchtrack.js -var touchtrack = __webpack_require__("ba15"); - -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/swiper/index.vue?vue&type=script&lang=js& -// - -/* harmony default export */ var swipervue_type_script_lang_js_ = ({ - name: 'Swiper', - mixins: [touchtrack["a" /* default */]], - props: { - indicatorDots: { - type: [Boolean, String], - default: false - }, - vertical: { - type: [Boolean, String], - default: false - }, - autoplay: { - type: [Boolean, String], - default: false - }, - circular: { - type: [Boolean, String], - default: false - }, - interval: { - type: [Number, String], - default: 5e3 - }, - duration: { - type: [Number, String], - default: 500 - }, - current: { - type: [Number, String], - default: 0 - }, - indicatorColor: { - type: String, - default: '' - }, - indicatorActiveColor: { - type: String, - default: '' - }, - previousMargin: { - type: String, - default: '' - }, - nextMargin: { - type: String, - default: '' - }, - currentItemId: { - type: String, - default: '' - }, - skipHiddenItemLayout: { - type: [Boolean, String], - default: false - }, - displayMultipleItems: { - type: [Number, String], - default: 1 + if (!inited) { + init(); } - }, - data: function data() { - return { - currentSync: Math.round(this.current) || 0, - currentItemIdSync: this.currentItemId || '', - userTracking: false, - currentChangeSource: '', - items: [] - }; - }, - computed: { - intervalNumber: function intervalNumber() { - var interval = Number(this.interval); - return isNaN(interval) ? 5e3 : interval; - }, - durationNumber: function durationNumber() { - var duration = Number(this.duration); - return isNaN(duration) ? 500 : duration; - }, - displayMultipleItemsNumber: function displayMultipleItemsNumber() { - var displayMultipleItems = Math.round(this.displayMultipleItems); - return isNaN(displayMultipleItems) ? 1 : displayMultipleItems; - }, - slidesStyle: function slidesStyle() { - var style = {}; - - if (this.nextMargin || this.previousMargin) { - style = this.vertical ? { - left: 0, - right: 0, - top: this._upx2px(this.previousMargin), - bottom: this._upx2px(this.nextMargin) - } : { - top: 0, - bottom: 0, - left: this._upx2px(this.previousMargin), - right: this._upx2px(this.nextMargin) - }; - } - - return style; - }, - slideFrameStyle: function slideFrameStyle() { - var value = Math.abs(100 / this.displayMultipleItemsNumber) + '%'; - return { - width: this.vertical ? '100%' : value, - height: !this.vertical ? '100%' : value - }; - }, - circularEnabled: function circularEnabled() { - return this.circular && this.items.length > this.displayMultipleItemsNumber; + if (typeof callback === 'function') { + callbacks.push(callback); } - }, - watch: { - vertical: function vertical() { - this._resetLayout(); - }, - circular: function circular() { - this._resetLayout(); - }, - intervalNumber: function intervalNumber(val) { - if (this._timer) { - this._cancelSchedule(); - - this._scheduleAutoplay(); - } - }, - current: function current(val) { - this._currentCheck(); - }, - currentSync: function currentSync(val) { - this._currentChanged(val); - - this.$emit('update:current', val); - }, - currentItemId: function currentItemId(val) { - this._currentCheck(); - }, - currentItemIdSync: function currentItemIdSync(val) { - this.$emit('update:currentItemId', val); - }, - displayMultipleItemsNumber: function displayMultipleItemsNumber() { - this._resetLayout(); +} +function offChange(callback) { + var index = callbacks.indexOf(callback); + if (index >= 0) { + callbacks.splice(index, 1); } - }, - created: function created() { - this._invalid = true; - this._viewportPosition = 0; - this._viewportMoveRatio = 1; - this._animating = null; - this._requestedAnimation = false; - this._userDirectionChecked = false; - this._contentTrackViewport = 0; - this._contentTrackSpeed = 0; - this._contentTrackT = 0; - }, - mounted: function mounted() { - var _this = this; - - this._currentCheck(); - - this.touchtrack(this.$refs.slidesWrapper, '_handleContentTrack', true); - - this._resetLayout(); - - this.$watch(function () { - return _this.autoplay && !_this.userTracking; - }, this._inintAutoplay); - - this._inintAutoplay(this.autoplay && !this.userTracking); - - this.$watch('items.length', this._resetLayout); - }, - beforeDestroy: function beforeDestroy() { - this._cancelSchedule(); - }, - methods: { - _inintAutoplay: function _inintAutoplay(enable) { - if (enable) { - this._scheduleAutoplay(); - } else { - this._cancelSchedule(); - } - }, - - /** - * 页面变更检查和同步 - */ - _currentCheck: function _currentCheck() { - var current = -1; - - if (this.currentItemId) { - for (var i = 0, items = this.items; i < items.length; i++) { - var componentInstance = items[i].componentInstance; - - if (componentInstance && componentInstance.itemId === this.currentItemId) { - current = i; - break; - } - } - } - - if (current < 0) { - current = Math.round(this.current) || 0; - } - - current = current < 0 ? 0 : current; - - if (this.currentSync !== current) { - this.currentChangeSource = ''; - this.currentSync = current; - } - }, - _itemReady: function _itemReady(vnode, callback) { - if (vnode.componentInstance && vnode.componentInstance._isMounted) { - callback(); - } else { - vnode._callbacks = vnode._callbacks || []; - - vnode._callbacks.push(callback); - } - }, - - /** - * 当前页面变更 - */ - _currentChanged: function _currentChanged(current) { - var _this2 = this; - - var source = this.currentChangeSource; - this.currentChangeSource = ''; - - if (!source) { - this._animateViewport(current, '', 0); - } - - var item = this.items[current]; - - if (item) { - this._itemReady(item, function () { - var currentItemId = _this2.currentItemIdSync = item.componentInstance.itemId || ''; - - _this2.$trigger('change', {}, { - current: _this2.currentSync, - currentItemId: currentItemId, - source: source - }); - }); - } +} +var safeAreaInsets = { + get support() { + return (typeof support === 'string' ? support : getSupport()).length != 0; }, - - /** - * 自动播放 - */ - _scheduleAutoplay: function _scheduleAutoplay() { - var self = this; - - this._cancelSchedule(); - - function timer() { - self._timer = null; - self.currentChangeSource = 'autoplay'; - - if (self.circularEnabled) { - self.currentSync = self._normalizeCurrentValue(self.currentSync + 1); - } else { - self.currentSync = self.currentSync + self.displayMultipleItemsNumber < self.items.length ? self.currentSync + 1 : 0; - } - - self._animateViewport(self.currentSync, 'autoplay', self.circularEnabled ? 1 : 0); - - self._timer = setTimeout(timer, self.intervalNumber); - } - - if (!(!this._isMounted || this._invalid || this.items.length <= this.displayMultipleItemsNumber)) { - this._timer = setTimeout(timer, this.intervalNumber); - } + get top() { + return getAttr('top'); }, - - /** - * 清除定时器 - */ - _cancelSchedule: function _cancelSchedule() { - if (this._timer) { - clearTimeout(this._timer); - this._timer = null; - } + get left() { + return getAttr('left'); }, - - /** - * 检查当前页值 - */ - _normalizeCurrentValue: function _normalizeCurrentValue(current) { - var length = this.items.length; - - if (!length) { - return -1; - } - - var index = (Math.round(current) % length + length) % length; - - if (this.circularEnabled) { - if (length <= this.displayMultipleItemsNumber) { - return 0; - } - } else if (index > length - this.displayMultipleItemsNumber) { - return length - this.displayMultipleItemsNumber; - } - - return index; + get right() { + return getAttr('right'); }, - _upx2px: function _upx2px(val) { - if (/\d+[ur]px$/i.test(val)) { - val.replace(/\d+[ur]px$/i, function (text) { - return "".concat(uni.upx2px(parseFloat(text)), "px"); - }); - } - - return val || ''; + get bottom() { + return getAttr('bottom'); }, + onChange: onChange, + offChange: offChange +}; +module.exports = safeAreaInsets; +//# sourceMappingURL=index.js.map - /** - * 重新布局 - */ - _resetLayout: function _resetLayout() { - if (this._isMounted) { - this._cancelSchedule(); - - this._endViewportAnimation(); - - var items = this.items; - - for (var i = 0; i < items.length; i++) { - this._updateItemPos(i, i); - } - - this._viewportMoveRatio = 1; - - if (this.displayMultipleItemsNumber === 1 && items.length) { - var itemRect = items[0].componentInstance.$el.getBoundingClientRect(); - var slideFrameRect = this.$refs.slideFrame.getBoundingClientRect(); - this._viewportMoveRatio = itemRect.width / slideFrameRect.width; - - if (!(this._viewportMoveRatio > 0 && this._viewportMoveRatio < 1)) { - this._viewportMoveRatio = 1; - } - } - - var position = this._viewportPosition; - this._viewportPosition = -2; - var current = this.currentSync; - - if (current >= 0) { - this._invalid = false; +/***/ }), +/* 7 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - if (this.userTracking) { - this._updateViewport(position + current - this._contentTrackViewport); +"use strict"; +var addListenerToElement = function addListenerToElement(element, type, callback, r) { + // 暂时忽略capture + element.addEventListener(type, function ($event) { + if (typeof callback === 'function') { + if (callback($event) === false) { + $event.preventDefault(); + $event.stopPropagation(); + } + } + }, { + passive: false + }); +}; - this._contentTrackViewport = current; - } else { - this._updateViewport(current); +/* harmony default export */ __webpack_exports__["a"] = ({ + methods: { + touchtrack: function touchtrack(element, method, useCancel) { + var self = this; + var x0 = 0; + var y0 = 0; + var x1 = 0; + var y1 = 0; - if (this.autoplay) { - this._scheduleAutoplay(); - } + var fn = function fn($event, state, x, y) { + if (self[method]({ + target: $event.target, + currentTarget: $event.currentTarget, + preventDefault: $event.preventDefault.bind($event), + stopPropagation: $event.stopPropagation.bind($event), + touches: $event.touches, + changedTouches: $event.changedTouches, + detail: { + state: state, + x0: x, + y0: y, + dx: x - x0, + dy: y - y0, + ddx: x - x1, + ddy: y - y1, + timeStamp: $event.timeStamp } - } else { - this._invalid = true; - - this._updateViewport(-this.displayMultipleItemsNumber - 1); + }) === false) { + return false; } - } - }, - _checkCircularLayout: function _checkCircularLayout(e) { - if (!this._invalid) { - for (var items = this.items, n = items.length, i = e + this.displayMultipleItemsNumber, r = 0; r < n; r++) { - var item = items[r]; - var _position = item._position; - var s = Math.floor(e / n) * n + r; - var l = s + n; - var c = s - n; - var u = Math.max(e - (s + 1), s - i, 0); - var d = Math.max(e - (l + 1), l - i, 0); - var h = Math.max(e - (c + 1), c - i, 0); - var p = Math.min(u, d, h); - var f = [s, l, c][[u, d, h].indexOf(p)]; + }; - if (_position !== f) { - this._updateItemPos(r, f); - } + var $eventOld = null; + addListenerToElement(element, 'touchstart', function ($event) { + if ($event.touches.length === 1 && !$eventOld) { + $eventOld = $event; + x0 = x1 = $event.touches[0].pageX; + y0 = y1 = $event.touches[0].pageY; + return fn($event, 'start', x0, y0); } - } - }, - _updateItemPos: function _updateItemPos(current, position) { - var x = this.vertical ? '0' : 100 * position + '%'; - var y = this.vertical ? 100 * position + '%' : '0'; - var transform = 'translate(' + x + ', ' + y + ') translateZ(0)'; - var item = this.items[current]; - - this._itemReady(item, function () { - var el = item.componentInstance.$el; - el.style['-webkit-transform'] = transform; - el.style.transform = transform; - el._position = position; }); - }, - _updateViewport: function _updateViewport(index) { - if (!(Math.floor(2 * this._viewportPosition) === Math.floor(2 * index) && Math.ceil(2 * this._viewportPosition) === Math.ceil(2 * index))) { - if (this.circularEnabled) { - this._checkCircularLayout(index); + addListenerToElement(element, 'touchmove', function ($event) { + if ($event.touches.length === 1 && $eventOld) { + var res = fn($event, 'move', $event.touches[0].pageX, $event.touches[0].pageY); + x1 = $event.touches[0].pageX; + y1 = $event.touches[0].pageY; + return res; } - } + }); + addListenerToElement(element, 'touchend', function ($event) { + if ($event.touches.length === 0 && $eventOld) { + $eventOld = null; + return fn($event, 'end', $event.changedTouches[0].pageX, $event.changedTouches[0].pageY); + } + }); + addListenerToElement(element, 'touchcancel', function ($event) { + if ($eventOld) { + var $eventTemp = $eventOld; + $eventOld = null; + return fn($event, useCancel ? 'cancel' : 'end', $eventTemp.touches[0].pageX, $eventTemp.touches[0].pageY); + } + }); + } + } +}); - var x = this.vertical ? '0' : 100 * -index * this._viewportMoveRatio + '%'; - var y = this.vertical ? 100 * -index * this._viewportMoveRatio + '%' : '0'; - var transform = 'translate(' + x + ', ' + y + ') translateZ(0)'; - var slideFrame = this.$refs.slideFrame; +/***/ }), +/* 8 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - if (slideFrame) { - slideFrame.style['-webkit-transform'] = transform; - slideFrame.style.transform = transform; - } +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) {/*! + * Vue.js v2.6.10 + * (c) 2014-2019 Evan You + * Released under the MIT License. + */ +/* */ - this._viewportPosition = index; +var emptyObject = Object.freeze({}); - if (!this._transitionStart) { - if (index % 1 === 0) { - return; - } +// These helpers produce better VM code in JS engines due to their +// explicitness and function inlining. +function isUndef (v) { + return v === undefined || v === null +} - this._transitionStart = index; - } +function isDef (v) { + return v !== undefined && v !== null +} - index -= Math.floor(this._transitionStart); +function isTrue (v) { + return v === true +} - if (index <= -(this.items.length - 1)) { - index += this.items.length; - } else if (index >= this.items.length) { - index -= this.items.length; - } +function isFalse (v) { + return v === false +} - index = this._transitionStart % 1 > 0.5 || this._transitionStart < 0 ? index - 1 : index; - this.$trigger('transition', {}, { - dx: this.vertical ? 0 : index * slideFrame.offsetWidth, - dy: this.vertical ? index * slideFrame.offsetHeight : 0 - }); - }, - _animateFrameFuncProto: function _animateFrameFuncProto() { - var _this3 = this; +/** + * Check if value is primitive. + */ +function isPrimitive (value) { + return ( + typeof value === 'string' || + typeof value === 'number' || + // $flow-disable-line + typeof value === 'symbol' || + typeof value === 'boolean' + ) +} - if (!this._animating) { - this._requestedAnimation = false; - return; - } +/** + * Quick object check - this is primarily used to tell + * Objects from primitive values when we know the value + * is a JSON-compliant type. + */ +function isObject (obj) { + return obj !== null && typeof obj === 'object' +} - var _animating = this._animating; - var toPos = _animating.toPos; - var acc = _animating.acc; - var endTime = _animating.endTime; - var source = _animating.source; - var time = endTime - Date.now(); +/** + * Get the raw type string of a value, e.g., [object Object]. + */ +var _toString = Object.prototype.toString; - if (time <= 0) { - this._updateViewport(toPos); +function toRawType (value) { + return _toString.call(value).slice(8, -1) +} - this._animating = null; - this._requestedAnimation = false; - this._transitionStart = null; - var item = this.items[this.currentSync]; +/** + * Strict object type check. Only returns true + * for plain JavaScript objects. + */ +function isPlainObject (obj) { + return _toString.call(obj) === '[object Object]' +} - if (item) { - this._itemReady(item, function () { - var currentItemId = item.componentInstance.itemId || ''; +function isRegExp (v) { + return _toString.call(v) === '[object RegExp]' +} + +/** + * Check if val is a valid array index. + */ +function isValidArrayIndex (val) { + var n = parseFloat(String(val)); + return n >= 0 && Math.floor(n) === n && isFinite(val) +} + +function isPromise (val) { + return ( + isDef(val) && + typeof val.then === 'function' && + typeof val.catch === 'function' + ) +} + +/** + * Convert a value to a string that is actually rendered. + */ +function toString (val) { + return val == null + ? '' + : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString) + ? JSON.stringify(val, null, 2) + : String(val) +} - _this3.$trigger('animationfinish', {}, { - current: _this3.currentSync, - currentItemId: currentItemId, - source: source - }); - }); - } +/** + * Convert an input value to a number for persistence. + * If the conversion fails, return original string. + */ +function toNumber (val) { + var n = parseFloat(val); + return isNaN(n) ? val : n +} - return; - } +/** + * Make a map and return a function for checking if a key + * is in that map. + */ +function makeMap ( + str, + expectsLowerCase +) { + var map = Object.create(null); + var list = str.split(','); + for (var i = 0; i < list.length; i++) { + map[list[i]] = true; + } + return expectsLowerCase + ? function (val) { return map[val.toLowerCase()]; } + : function (val) { return map[val]; } +} - var s = acc * time * time / 2; - var l = toPos + s; +/** + * Check if a tag is a built-in tag. + */ +var isBuiltInTag = makeMap('slot,component', true); - this._updateViewport(l); +/** + * Check if an attribute is a reserved attribute. + */ +var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is'); - requestAnimationFrame(this._animateFrameFuncProto.bind(this)); - }, - _animateViewport: function _animateViewport(current, source, n) { - this._cancelViewportAnimation(); +/** + * Remove an item from an array. + */ +function remove (arr, item) { + if (arr.length) { + var index = arr.indexOf(item); + if (index > -1) { + return arr.splice(index, 1) + } + } +} - var duration = this.durationNumber; - var length = this.items.length; - var position = this._viewportPosition; +/** + * Check whether an object has the property. + */ +var hasOwnProperty = Object.prototype.hasOwnProperty; +function hasOwn (obj, key) { + return hasOwnProperty.call(obj, key) +} - if (this.circularEnabled) { - if (n < 0) { - for (; position < current;) { - position += length; - } +/** + * Create a cached version of a pure function. + */ +function cached (fn) { + var cache = Object.create(null); + return (function cachedFn (str) { + var hit = cache[str]; + return hit || (cache[str] = fn(str)) + }) +} - for (; position - length > current;) { - position -= length; - } - } else if (n > 0) { - for (; position > current;) { - position -= length; - } +/** + * Camelize a hyphen-delimited string. + */ +var camelizeRE = /-(\w)/g; +var camelize = cached(function (str) { + return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; }) +}); - for (; position + length < current;) { - position += length; - } - } else { - for (; position + length < current;) { - position += length; - } +/** + * Capitalize a string. + */ +var capitalize = cached(function (str) { + return str.charAt(0).toUpperCase() + str.slice(1) +}); - for (; position - length > current;) { - position -= length; - } +/** + * Hyphenate a camelCase string. + */ +var hyphenateRE = /\B([A-Z])/g; +var hyphenate = cached(function (str) { + return str.replace(hyphenateRE, '-$1').toLowerCase() +}); - if (position + length - current < current - position) { - position += length; - } - } - } +/** + * Simple bind polyfill for environments that do not support it, + * e.g., PhantomJS 1.x. Technically, we don't need this anymore + * since native bind is now performant enough in most browsers. + * But removing it would mean breaking code that was able to run in + * PhantomJS 1.x, so this must be kept for backward compatibility. + */ - this._animating = { - toPos: current, - acc: 2 * (position - current) / (duration * duration), - endTime: Date.now() + duration, - source: source - }; +/* istanbul ignore next */ +function polyfillBind (fn, ctx) { + function boundFn (a) { + var l = arguments.length; + return l + ? l > 1 + ? fn.apply(ctx, arguments) + : fn.call(ctx, a) + : fn.call(ctx) + } - if (!this._requestedAnimation) { - this._requestedAnimation = true; - requestAnimationFrame(this._animateFrameFuncProto.bind(this)); - } - }, - _cancelViewportAnimation: function _cancelViewportAnimation() { - this._animating = null; - }, + boundFn._length = fn.length; + return boundFn +} - /** - * 结束动画 - */ - _endViewportAnimation: function _endViewportAnimation() { - if (this._animating) { - this._updateViewport(this._animating.toPos); +function nativeBind (fn, ctx) { + return fn.bind(ctx) +} - this._animating = null; - } - }, - _handleTrackStart: function _handleTrackStart() { - this._cancelSchedule(); +var bind = Function.prototype.bind + ? nativeBind + : polyfillBind; - this._contentTrackViewport = this._viewportPosition; - this._contentTrackSpeed = 0; - this._contentTrackT = Date.now(); +/** + * Convert an Array-like object to a real Array. + */ +function toArray (list, start) { + start = start || 0; + var i = list.length - start; + var ret = new Array(i); + while (i--) { + ret[i] = list[i + start]; + } + return ret +} - this._cancelViewportAnimation(); - }, - _handleTrackMove: function _handleTrackMove(data) { - var self = this; - var contentTrackT = this._contentTrackT; - this._contentTrackT = Date.now(); - var length = this.items.length; - var other = length - this.displayMultipleItemsNumber; +/** + * Mix properties into target object. + */ +function extend (to, _from) { + for (var key in _from) { + to[key] = _from[key]; + } + return to +} - function calc(val) { - return 0.5 - 0.25 / (val + 0.5); - } +/** + * Merge an Array of Objects into a single Object. + */ +function toObject (arr) { + var res = {}; + for (var i = 0; i < arr.length; i++) { + if (arr[i]) { + extend(res, arr[i]); + } + } + return res +} - function move(oldVal, newVal) { - var val = self._contentTrackViewport + oldVal; - self._contentTrackSpeed = 0.6 * self._contentTrackSpeed + 0.4 * newVal; +/* eslint-disable no-unused-vars */ - if (!self.circularEnabled) { - if (val < 0 || val > other) { - if (val < 0) { - val = -calc(-val); - } else { - if (val > other) { - val = other + calc(val - other); - } - } +/** + * Perform no operation. + * Stubbing args to make Flow happy without leaving useless transpiled code + * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/). + */ +function noop (a, b, c) {} - self._contentTrackSpeed = 0; - } - } +/** + * Always return false. + */ +var no = function (a, b, c) { return false; }; - self._updateViewport(val); - } +/* eslint-enable no-unused-vars */ - var time = this._contentTrackT - contentTrackT || 1; +/** + * Return the same value. + */ +var identity = function (_) { return _; }; - if (this.vertical) { - move(-data.dy / this.$refs.slideFrame.offsetHeight, -data.ddy / time); +/** + * Check if two values are loosely equal - that is, + * if they are plain objects, do they have the same shape? + */ +function looseEqual (a, b) { + if (a === b) { return true } + var isObjectA = isObject(a); + var isObjectB = isObject(b); + if (isObjectA && isObjectB) { + try { + var isArrayA = Array.isArray(a); + var isArrayB = Array.isArray(b); + if (isArrayA && isArrayB) { + return a.length === b.length && a.every(function (e, i) { + return looseEqual(e, b[i]) + }) + } else if (a instanceof Date && b instanceof Date) { + return a.getTime() === b.getTime() + } else if (!isArrayA && !isArrayB) { + var keysA = Object.keys(a); + var keysB = Object.keys(b); + return keysA.length === keysB.length && keysA.every(function (key) { + return looseEqual(a[key], b[key]) + }) } else { - move(-data.dx / this.$refs.slideFrame.offsetWidth, -data.ddx / time); + /* istanbul ignore next */ + return false } - }, - _handleTrackEnd: function _handleTrackEnd(isCancel) { - this.userTracking = false; - var t = this._contentTrackSpeed / Math.abs(this._contentTrackSpeed); - var n = 0; + } catch (e) { + /* istanbul ignore next */ + return false + } + } else if (!isObjectA && !isObjectB) { + return String(a) === String(b) + } else { + return false + } +} - if (!isCancel && Math.abs(this._contentTrackSpeed) > 0.2) { - n = 0.5 * t; - } +/** + * Return the first index at which a loosely equal value can be + * found in the array (if value is a plain object, the array must + * contain an object of the same shape), or -1 if it is not present. + */ +function looseIndexOf (arr, val) { + for (var i = 0; i < arr.length; i++) { + if (looseEqual(arr[i], val)) { return i } + } + return -1 +} - var current = this._normalizeCurrentValue(this._viewportPosition + n); +/** + * Ensure a function is called only once. + */ +function once (fn) { + var called = false; + return function () { + if (!called) { + called = true; + fn.apply(this, arguments); + } + } +} - if (isCancel) { - this._updateViewport(this._contentTrackViewport); - } else { - this.currentChangeSource = 'touch'; - this.currentSync = current; +var SSR_ATTR = 'data-server-rendered'; - this._animateViewport(current, 'touch', n !== 0 ? n : current === 0 && this.circularEnabled && this._viewportPosition >= 1 ? 1 : 0); - } - }, - _handleContentTrack: function _handleContentTrack(e) { - if (!this._invalid) { - if (e.detail.state === 'start') { - this.userTracking = true; - this._userDirectionChecked = false; - return this._handleTrackStart(); - } // fixed by xxxxxx +var ASSET_TYPES = [ + 'component', + 'directive', + 'filter' +]; +var LIFECYCLE_HOOKS = [ + 'beforeCreate', + 'created', + 'beforeMount', + 'mounted', + 'beforeUpdate', + 'updated', + 'beforeDestroy', + 'destroyed', + 'activated', + 'deactivated', + 'errorCaptured', + 'serverPrefetch' +]; - if (e.detail.state === 'end') { - return this._handleTrackEnd(false); - } +/* */ - if (e.detail.state === 'cancel') { - return this._handleTrackEnd(true); - } - if (this.userTracking) { - if (!this._userDirectionChecked) { - this._userDirectionChecked = true; - var t = Math.abs(e.detail.dx); - var n = Math.abs(e.detail.dy); - if (t >= n && this.vertical) { - this.userTracking = false; - } else { - if (t <= n && !this.vertical) { - this.userTracking = false; - } - } +var config = ({ + /** + * Option merge strategies (used in core/util/options) + */ + // $flow-disable-line + optionMergeStrategies: Object.create(null), - if (!this.userTracking) { - if (this.autoplay) { - this._scheduleAutoplay(); - } + /** + * Whether to suppress warnings. + */ + silent: false, - return; - } - } + /** + * Show production mode tip message on boot? + */ + productionTip: "development" !== 'production', - this._handleTrackMove(e.detail); + /** + * Whether to enable devtools + */ + devtools: "development" !== 'production', - return false; - } - } - } - }, - render: function render(createElement) { - var slidesDots = []; - var swiperItems = []; + /** + * Whether to record perf + */ + performance: false, - if (this.$slots.default) { - this.$slots.default.forEach(function (vnode) { - if (vnode.componentOptions && vnode.componentOptions.tag === 'v-uni-swiper-item') { - swiperItems.push(vnode); - } - }); - } + /** + * Error handler for watcher errors + */ + errorHandler: null, - for (var index = 0, length = swiperItems.length; index < length; index++) { - var currentSync = this.currentSync; - slidesDots.push(createElement('div', { - class: { - 'uni-swiper-dot': true, - 'uni-swiper-dot-active': index < currentSync + this.displayMultipleItemsNumber && index >= currentSync || index < currentSync + this.displayMultipleItemsNumber - length - }, - style: { - 'background': index === currentSync ? this.indicatorActiveColor : this.indicatorColor - } - })); - } + /** + * Warn handler for watcher warns + */ + warnHandler: null, - this.items = swiperItems; - var slidesWrapperChild = [createElement('div', { - ref: 'slides', - style: this.slidesStyle, - 'class': 'uni-swiper-slides' - }, [createElement('div', { - ref: 'slideFrame', - class: 'uni-swiper-slide-frame', - style: this.slideFrameStyle - }, swiperItems)])]; + /** + * Ignore certain custom elements + */ + ignoredElements: [], - if (this.indicatorDots) { - slidesWrapperChild.push(createElement('div', { - ref: 'slidesDots', - 'class': ['uni-swiper-dots', this.vertical ? 'uni-swiper-dots-vertical' : 'uni-swiper-dots-horizontal'] - }, slidesDots)); - } + /** + * Custom user key aliases for v-on + */ + // $flow-disable-line + keyCodes: Object.create(null), - return createElement('uni-swiper', [createElement('div', { - ref: 'slidesWrapper', - 'class': 'uni-swiper-wrapper', - on: this.$listeners - }, slidesWrapperChild)]); - } -}); -// CONCATENATED MODULE: ./src/core/view/components/swiper/index.vue?vue&type=script&lang=js& - /* harmony default export */ var components_swipervue_type_script_lang_js_ = (swipervue_type_script_lang_js_); -// EXTERNAL MODULE: ./src/core/view/components/swiper/index.vue?vue&type=style&index=0&lang=css& -var swipervue_type_style_index_0_lang_css_ = __webpack_require__("1c64"); + /** + * Check if a tag is reserved so that it cannot be registered as a + * component. This is platform-dependent and may be overwritten. + */ + isReservedTag: no, -// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js -var componentNormalizer = __webpack_require__("0c7c"); + /** + * Check if an attribute is reserved so that it cannot be used as a component + * prop. This is platform-dependent and may be overwritten. + */ + isReservedAttr: no, -// CONCATENATED MODULE: ./src/core/view/components/swiper/index.vue -var render, staticRenderFns + /** + * Check if a tag is an unknown element. + * Platform-dependent. + */ + isUnknownElement: no, + + /** + * Get the namespace of an element + */ + getTagNamespace: noop, + /** + * Parse the real tag name for the specific platform. + */ + parsePlatformTagName: identity, + /** + * Check if an attribute must be bound using property, e.g. value + * Platform-dependent. + */ + mustUseProp: no, + /** + * Perform updates asynchronously. Intended to be used by Vue Test Utils + * This will significantly reduce performance if set to false. + */ + async: true, + /** + * Exposed for legacy reasons + */ + _lifecycleHooks: LIFECYCLE_HOOKS +}); -/* normalize component */ +/* */ -var component = Object(componentNormalizer["a" /* default */])( - components_swipervue_type_script_lang_js_, - render, - staticRenderFns, - false, - null, - null, - null - -) +/** + * unicode letters used for parsing html tags, component names and property paths. + * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname + * skipping \u10000-\uEFFFF due to it freezing up PhantomJS + */ +var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/; -/* harmony default export */ var swiper = __webpack_exports__["default"] = (component.exports); +/** + * Check if a string starts with $ or _ + */ +function isReserved (str) { + var c = (str + '').charCodeAt(0); + return c === 0x24 || c === 0x5F +} -/***/ }), +/** + * Define a property. + */ +function def (obj, key, val, enumerable) { + Object.defineProperty(obj, key, { + value: val, + enumerable: !!enumerable, + writable: true, + configurable: true + }); +} -/***/ "5676": -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/** + * Parse simple path. + */ +var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]")); +function parsePath (path) { + if (bailRE.test(path)) { + return + } + var segments = path.split('.'); + return function (obj) { + for (var i = 0; i < segments.length; i++) { + if (!obj) { return } + obj = obj[segments[i]]; + } + return obj + } +} -"use strict"; -/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("0950"); -/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__); -/* unused harmony reexport * */ - /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a); +/* */ -/***/ }), +// can we use __proto__? +var hasProto = '__proto__' in {}; -/***/ "5768": -/***/ (function(module, __webpack_exports__, __webpack_require__) { +// Browser environment sniffing +var inBrowser = typeof window !== 'undefined'; +var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform; +var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase(); +var UA = inBrowser && window.navigator.userAgent.toLowerCase(); +var isIE = UA && /msie|trident/.test(UA); +var isIE9 = UA && UA.indexOf('msie 9.0') > 0; +var isEdge = UA && UA.indexOf('edge/') > 0; +var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android'); +var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios'); +var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; +var isPhantomJS = UA && /phantomjs/.test(UA); +var isFF = UA && UA.match(/firefox\/(\d+)/); -"use strict"; -__webpack_require__.r(__webpack_exports__); +// Firefox has a "watch" function on Object.prototype... +var nativeWatch = ({}).watch; -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7050de7c-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/textarea/index.vue?vue&type=template&id=2edd7458& -var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('uni-textarea',_vm._g({attrs:{"value":_vm._checkEmpty(_vm.value),"maxlength":_vm.maxlengthNumber,"placeholder":_vm._checkEmpty(_vm.placeholder),"disabled":_vm.disabled,"focus":_vm.focus,"auto-focus":_vm.autoFocus,"placeholder-class":_vm._checkEmpty(_vm.placeholderClass),"placeholder-style":_vm._checkEmpty(_vm.placeholderStyle),"auto-height":_vm.autoHeight,"cursor":_vm.cursorNumber,"selection-start":_vm.selectionStartNumber,"selection-end":_vm.selectionEndNumber},on:{"change":function($event){$event.stopPropagation();}}},_vm.$listeners),[_c('div',{staticClass:"uni-textarea-wrapper"},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(!(_vm.composition||_vm.valueSync.length)),expression:"!(composition||valueSync.length)"}],ref:"placeholder",staticClass:"uni-textarea-placeholder",class:_vm.placeholderClass,style:(_vm.placeholderStyle)},[_vm._v(_vm._s(_vm.placeholder))]),_c('div',{staticClass:"uni-textarea-compute"},[_vm._l((_vm.valueCompute),function(item,index){return _c('div',{key:index},[_vm._v(_vm._s(item.trim() ? item : '.'))])}),_c('v-uni-resize-sensor',{ref:"sensor",on:{"resize":_vm._resize}})],2),_c('textarea',{directives:[{name:"model",rawName:"v-model",value:(_vm.valueSync),expression:"valueSync"}],ref:"textarea",staticClass:"uni-textarea-textarea",class:{'uni-textarea-textarea-ios': _vm.isIOS},attrs:{"disabled":_vm.disabled,"maxlength":_vm.maxlengthNumber,"autofocus":_vm.autoFocus},domProps:{"value":(_vm.valueSync)},on:{"compositionstart":_vm._compositionstart,"compositionend":_vm._compositionend,"input":[function($event){if($event.target.composing){ return; }_vm.valueSync=$event.target.value},function($event){$event.stopPropagation();return _vm._input($event)}],"focus":_vm._focus,"blur":_vm._blur,"&touchstart":function($event){return _vm._touchstart($event)}}})])])} -var staticRenderFns = [] +var supportsPassive = false; +if (inBrowser) { + try { + var opts = {}; + Object.defineProperty(opts, 'passive', ({ + get: function get () { + /* istanbul ignore next */ + supportsPassive = true; + } + })); // https://github.com/facebook/flow/issues/285 + window.addEventListener('test-passive', null, opts); + } catch (e) {} +} +// this needs to be lazy-evaled because vue may be required before +// vue-server-renderer can set VUE_ENV +var _isServer; +var isServerRendering = function () { + if (_isServer === undefined) { + /* istanbul ignore if */ + if (!inBrowser && !inWeex && typeof global !== 'undefined') { + // detect presence of vue-server-renderer and avoid + // Webpack shimming the process + _isServer = global['process'] && global['process'].env.VUE_ENV === 'server'; + } else { + _isServer = false; + } + } + return _isServer +}; -// CONCATENATED MODULE: ./src/core/view/components/textarea/index.vue?vue&type=template&id=2edd7458& +// detect devtools +var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__; -// EXTERNAL MODULE: ./src/core/view/mixins/index.js + 1 modules -var mixins = __webpack_require__("8af1"); +/* istanbul ignore next */ +function isNative (Ctor) { + return typeof Ctor === 'function' && /native code/.test(Ctor.toString()) +} -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/textarea/index.vue?vue&type=script&lang=js& -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// +var hasSymbol = + typeof Symbol !== 'undefined' && isNative(Symbol) && + typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys); -/* harmony default export */ var textareavue_type_script_lang_js_ = ({ - name: 'Textarea', - mixins: [mixins["a" /* emitter */]], - model: { - prop: 'value', - event: 'update:value' - }, - props: { - name: { - type: String, - default: '' - }, - value: { - type: [String, Number], - default: '' - }, - maxlength: { - type: [Number, String], - default: 140 - }, - placeholder: { - type: String, - default: '' - }, - disabled: { - type: [Boolean, String], - default: false - }, - focus: { - type: [Boolean, String], - default: false - }, - autoFocus: { - type: [Boolean, String], - default: false - }, - placeholderClass: { - type: String, - default: '' - }, - placeholderStyle: { - type: String, - default: '' - }, - autoHeight: { - type: [Boolean, String], - default: false - }, - cursor: { - type: [Number, String], - default: -1 - }, - selectionStart: { - type: [Number, String], - default: -1 - }, - selectionEnd: { - type: [Number, String], - default: -1 +var _Set; +/* istanbul ignore if */ // $flow-disable-line +if (typeof Set !== 'undefined' && isNative(Set)) { + // use native Set when available. + _Set = Set; +} else { + // a non-standard Set polyfill that only works with primitive keys. + _Set = /*@__PURE__*/(function () { + function Set () { + this.set = Object.create(null); } - }, - data: function data() { - return { - valueSync: String(this.value), - valueComposition: '', - composition: false, - focusSync: this.focus, - height: 0, - focusChangeSource: '', - isIOS: String(navigator.platform).indexOf('iP') === 0 && String(navigator.vendor).indexOf('Apple') === 0 + Set.prototype.has = function has (key) { + return this.set[key] === true }; - }, - computed: { - maxlengthNumber: function maxlengthNumber() { - var maxlength = Number(this.maxlength); - return isNaN(maxlength) ? 140 : maxlength; - }, - cursorNumber: function cursorNumber() { - var cursor = Number(this.cursor); - return isNaN(cursor) ? -1 : cursor; - }, - selectionStartNumber: function selectionStartNumber() { - var selectionStart = Number(this.selectionStart); - return isNaN(selectionStart) ? -1 : selectionStart; - }, - selectionEndNumber: function selectionEndNumber() { - var selectionEnd = Number(this.selectionEnd); - return isNaN(selectionEnd) ? -1 : selectionEnd; - }, - valueCompute: function valueCompute() { - return (this.composition ? this.valueComposition : this.valueSync).split('\n'); + Set.prototype.add = function add (key) { + this.set[key] = true; + }; + Set.prototype.clear = function clear () { + this.set = Object.create(null); + }; + + return Set; + }()); +} + +/* */ + +var warn = noop; +var tip = noop; +var generateComponentTrace = (noop); // work around flow check +var formatComponentName = (noop); + +if (true) { + var hasConsole = typeof console !== 'undefined'; + var classifyRE = /(?:^|[-_])(\w)/g; + var classify = function (str) { return str + .replace(classifyRE, function (c) { return c.toUpperCase(); }) + .replace(/[-_]/g, ''); }; + + warn = function (msg, vm) { + var trace = vm ? generateComponentTrace(vm) : ''; + + if (config.warnHandler) { + config.warnHandler.call(null, msg, vm, trace); + } else if (hasConsole && (!config.silent)) { + console.error(("[Vue warn]: " + msg + trace)); } - }, - watch: { - value: function value(val) { - this.valueSync = String(val); - }, - valueSync: function valueSync(val) { - if (val !== this._oldValue) { - this._oldValue = val; - this.$trigger('input', {}, { - value: val, - cursor: this.$refs.textarea.selectionEnd - }); - this.$emit('update:value', val); - } - }, - focus: function focus(val) { - if (val) { - this.focusChangeSource = 'focus'; + }; - if (this.$refs.textarea) { - this.$refs.textarea.focus(); - } - } else { - if (this.$refs.textarea) { - this.$refs.textarea.blur(); - } - } - }, - focusSync: function focusSync(val) { - this.$emit('update:focus', val); + tip = function (msg, vm) { + if (hasConsole && (!config.silent)) { + console.warn("[Vue tip]: " + msg + ( + vm ? generateComponentTrace(vm) : '' + )); + } + }; - this._checkSelection(); + formatComponentName = function (vm, includeFile) { + if (vm.$root === vm) { + return '' + } + var options = typeof vm === 'function' && vm.cid != null + ? vm.options + : vm._isVue + ? vm.$options || vm.constructor.options + : vm; + var name = options.name || options._componentTag; + var file = options.__file; + if (!name && file) { + var match = file.match(/([^/\\]+)\.vue$/); + name = match && match[1]; + } - this._checkCursor(); - }, - cursorNumber: function cursorNumber() { - this._checkCursor(); - }, - selectionStartNumber: function selectionStartNumber() { - this._checkSelection(); - }, - selectionEndNumber: function selectionEndNumber() { - this._checkSelection(); - }, - height: function height(_height) { - var lineHeight = getComputedStyle(this.$el).lineHeight.replace('px', ''); - var lineCount = Math.round(_height / lineHeight); - this.$trigger('linechange', {}, { - height: _height, - heightRpx: 750 / window.innerWidth * _height, - lineCount: lineCount - }); + return ( + (name ? ("<" + (classify(name)) + ">") : "") + + (file && includeFile !== false ? (" at " + file) : '') + ) + }; - if (this.autoHeight) { - this.$el.style.height = this.height + 'px'; - } + var repeat = function (str, n) { + var res = ''; + while (n) { + if (n % 2 === 1) { res += str; } + if (n > 1) { str += str; } + n >>= 1; } - }, - created: function created() { - this.$dispatch('Form', 'uni-form-group-update', { - type: 'add', - vm: this - }); - }, - mounted: function mounted() { - this._oldValue = this.$refs.textarea.value = this.valueSync; + return res + }; - this._resize({ - height: this.$refs.sensor.$el.offsetHeight - }); - }, - beforeDestroy: function beforeDestroy() { - this.$dispatch('Form', 'uni-form-group-update', { - type: 'remove', - vm: this - }); - }, - methods: { - _focus: function _focus($event) { - this.focusSync = true; - this.$trigger('focus', $event, { - value: this.valueSync - }); - }, - _checkSelection: function _checkSelection() { - if (this.focusSync && !this.focusChangeSource && this.selectionStartNumber > -1 && this.selectionEndNumber > -1) { - this.$refs.textarea.selectionStart = this.selectionStartNumber; - this.$refs.textarea.selectionEnd = this.selectionEndNumber; - } - }, - _checkCursor: function _checkCursor() { - if (this.focusSync && (this.focusChangeSource === 'focus' || !this.focusChangeSource && this.selectionStartNumber < 0 && this.selectionEndNumber < 0) && this.cursorNumber > -1) { - this.$refs.textarea.selectionEnd = this.$refs.textarea.selectionStart = this.cursorNumber; - } - }, - _blur: function _blur($event) { - this.focusSync = false; - this.$trigger('blur', $event, { - value: this.valueSync, - cursor: this.$refs.textarea.selectionEnd - }); - }, - _compositionstart: function _compositionstart($event) { - this.composition = true; - }, - _compositionend: function _compositionend($event) { - this.composition = false; - }, - // 暂无完成按钮,此功能未实现 - _confirm: function _confirm($event) { - this.$trigger('confirm', $event, { - value: this.valueSync - }); - }, - _linechange: function _linechange($event) { - this.$trigger('linechange', $event, { - value: this.valueSync - }); - }, - _touchstart: function _touchstart() { - this.focusChangeSource = 'touch'; - }, - _resize: function _resize(_ref) { - var height = _ref.height; - this.height = height; - }, - _input: function _input($event) { - if (this.composition) { - this.valueComposition = $event.target.value; - } - }, - _getFormData: function _getFormData() { - return { - value: this.valueSync, - key: this.name - }; - }, - _resetFormData: function _resetFormData() { - this.valueSync = ''; - }, - _checkEmpty: function _checkEmpty(str) { - return str || false; + generateComponentTrace = function (vm) { + if (vm._isVue && vm.$parent) { + var tree = []; + var currentRecursiveSequence = 0; + while (vm) { + if (tree.length > 0) { + var last = tree[tree.length - 1]; + if (last.constructor === vm.constructor) { + currentRecursiveSequence++; + vm = vm.$parent; + continue + } else if (currentRecursiveSequence > 0) { + tree[tree.length - 1] = [last, currentRecursiveSequence]; + currentRecursiveSequence = 0; + } + } + tree.push(vm); + vm = vm.$parent; + } + return '\n\nfound in\n\n' + tree + .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm) + ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)") + : formatComponentName(vm))); }) + .join('\n') + } else { + return ("\n\n(found in " + (formatComponentName(vm)) + ")") } + }; +} + +/* */ + +var uid = 0; + +/** + * A dep is an observable that can have multiple + * directives subscribing to it. + */ +var Dep = function Dep () { + this.id = uid++; + this.subs = []; +}; + +Dep.prototype.addSub = function addSub (sub) { + this.subs.push(sub); +}; + +Dep.prototype.removeSub = function removeSub (sub) { + remove(this.subs, sub); +}; + +Dep.prototype.depend = function depend () { + if (Dep.target) { + Dep.target.addDep(this); } -}); -// CONCATENATED MODULE: ./src/core/view/components/textarea/index.vue?vue&type=script&lang=js& - /* harmony default export */ var components_textareavue_type_script_lang_js_ = (textareavue_type_script_lang_js_); -// EXTERNAL MODULE: ./src/core/view/components/textarea/index.vue?vue&type=style&index=0&lang=css& -var textareavue_type_style_index_0_lang_css_ = __webpack_require__("9400"); +}; + +Dep.prototype.notify = function notify () { + // stabilize the subscriber list first + var subs = this.subs.slice(); + if ( true && !config.async) { + // subs aren't sorted in scheduler if not running async + // we need to sort them now to make sure they fire in correct + // order + subs.sort(function (a, b) { return a.id - b.id; }); + } + for (var i = 0, l = subs.length; i < l; i++) { + subs[i].update(); + } +}; + +// The current target watcher being evaluated. +// This is globally unique because only one watcher +// can be evaluated at a time. +Dep.target = null; +var targetStack = []; + +function pushTarget (target) { + targetStack.push(target); + Dep.target = target; +} -// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js -var componentNormalizer = __webpack_require__("0c7c"); +function popTarget () { + targetStack.pop(); + Dep.target = targetStack[targetStack.length - 1]; +} -// CONCATENATED MODULE: ./src/core/view/components/textarea/index.vue +/* */ +var VNode = function VNode ( + tag, + data, + children, + text, + elm, + context, + componentOptions, + asyncFactory +) { + this.tag = tag; + this.data = data; + this.children = children; + this.text = text; + this.elm = elm; + this.ns = undefined; + this.context = context; + this.fnContext = undefined; + this.fnOptions = undefined; + this.fnScopeId = undefined; + this.key = data && data.key; + this.componentOptions = componentOptions; + this.componentInstance = undefined; + this.parent = undefined; + this.raw = false; + this.isStatic = false; + this.isRootInsert = true; + this.isComment = false; + this.isCloned = false; + this.isOnce = false; + this.asyncFactory = asyncFactory; + this.asyncMeta = undefined; + this.isAsyncPlaceholder = false; +}; +var prototypeAccessors = { child: { configurable: true } }; +// DEPRECATED: alias for componentInstance for backwards compat. +/* istanbul ignore next */ +prototypeAccessors.child.get = function () { + return this.componentInstance +}; +Object.defineProperties( VNode.prototype, prototypeAccessors ); +var createEmptyVNode = function (text) { + if ( text === void 0 ) text = ''; -/* normalize component */ + var node = new VNode(); + node.text = text; + node.isComment = true; + return node +}; -var component = Object(componentNormalizer["a" /* default */])( - components_textareavue_type_script_lang_js_, - render, - staticRenderFns, - false, - null, - null, - null - -) +function createTextVNode (val) { + return new VNode(undefined, undefined, undefined, String(val)) +} -/* harmony default export */ var components_textarea = __webpack_exports__["default"] = (component.exports); +// optimized shallow clone +// used for static nodes and slot nodes because they may be reused across +// multiple renders, cloning them avoids errors when DOM manipulations rely +// on their elm reference. +function cloneVNode (vnode) { + var cloned = new VNode( + vnode.tag, + vnode.data, + // #7975 + // clone children array to avoid mutating original in case of cloning + // a child. + vnode.children && vnode.children.slice(), + vnode.text, + vnode.elm, + vnode.context, + vnode.componentOptions, + vnode.asyncFactory + ); + cloned.ns = vnode.ns; + cloned.isStatic = vnode.isStatic; + cloned.key = vnode.key; + cloned.isComment = vnode.isComment; + cloned.fnContext = vnode.fnContext; + cloned.fnOptions = vnode.fnOptions; + cloned.fnScopeId = vnode.fnScopeId; + cloned.asyncMeta = vnode.asyncMeta; + cloned.isCloned = true; + return cloned +} -/***/ }), +/* + * not type checking this file because flow doesn't play well with + * dynamically accessing methods on Array prototype + */ -/***/ "599d": -/***/ (function(module, __webpack_exports__, __webpack_require__) { +var arrayProto = Array.prototype; +var arrayMethods = Object.create(arrayProto); -"use strict"; +var methodsToPatch = [ + 'push', + 'pop', + 'shift', + 'unshift', + 'splice', + 'sort', + 'reverse' +]; -// CONCATENATED MODULE: ./src/core/service/api/base/upx2px.js -var EPS = 1e-4; -var BASE_DEVICE_WIDTH = 750; -var isIOS = false; -var deviceWidth = 0; -var deviceDPR = 0; +/** + * Intercept mutating methods and emit events + */ +methodsToPatch.forEach(function (method) { + // cache original method + var original = arrayProto[method]; + def(arrayMethods, method, function mutator () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; -function checkDeviceWidth() { - var _uni$getSystemInfoSyn = uni.getSystemInfoSync(), - platform = _uni$getSystemInfoSyn.platform, - pixelRatio = _uni$getSystemInfoSyn.pixelRatio, - windowWidth = _uni$getSystemInfoSyn.windowWidth; + var result = original.apply(this, args); + var ob = this.__ob__; + var inserted; + switch (method) { + case 'push': + case 'unshift': + inserted = args; + break + case 'splice': + inserted = args.slice(2); + break + } + if (inserted) { ob.observeArray(inserted); } + // notify change + ob.dep.notify(); + return result + }); +}); - deviceWidth = windowWidth; - deviceDPR = pixelRatio; - isIOS = platform === 'ios'; +/* */ + +var arrayKeys = Object.getOwnPropertyNames(arrayMethods); + +/** + * In some cases we may want to disable observation inside a component's + * update computation. + */ +var shouldObserve = true; + +function toggleObserving (value) { + shouldObserve = value; +} + +/** + * Observer class that is attached to each observed + * object. Once attached, the observer converts the target + * object's property keys into getter/setters that + * collect dependencies and dispatch updates. + */ +var Observer = function Observer (value) { + this.value = value; + this.dep = new Dep(); + this.vmCount = 0; + def(value, '__ob__', this); + if (Array.isArray(value)) { + if (hasProto) { + protoAugment(value, arrayMethods); + } else { + copyAugment(value, arrayMethods, arrayKeys); + } + this.observeArray(value); + } else { + this.walk(value); + } +}; + +/** + * Walk through all properties and convert them into + * getter/setters. This method should only be called when + * value type is Object. + */ +Observer.prototype.walk = function walk (obj) { + var keys = Object.keys(obj); + for (var i = 0; i < keys.length; i++) { + defineReactive$$1(obj, keys[i]); + } +}; + +/** + * Observe a list of Array items. + */ +Observer.prototype.observeArray = function observeArray (items) { + for (var i = 0, l = items.length; i < l; i++) { + observe(items[i]); + } +}; + +// helpers + +/** + * Augment a target Object or Array by intercepting + * the prototype chain using __proto__ + */ +function protoAugment (target, src) { + /* eslint-disable no-proto */ + target.__proto__ = src; + /* eslint-enable no-proto */ +} + +/** + * Augment a target Object or Array by defining + * hidden properties. + */ +/* istanbul ignore next */ +function copyAugment (target, src, keys) { + for (var i = 0, l = keys.length; i < l; i++) { + var key = keys[i]; + def(target, key, src[key]); + } +} + +/** + * Attempt to create an observer instance for a value, + * returns the new observer if successfully observed, + * or the existing observer if the value already has one. + */ +function observe (value, asRootData) { + if (!isObject(value) || value instanceof VNode) { + return + } + var ob; + if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) { + ob = value.__ob__; + } else if ( + shouldObserve && + !isServerRendering() && + (Array.isArray(value) || isPlainObject(value)) && + Object.isExtensible(value) && + !value._isVue + ) { + ob = new Observer(value); + } + if (asRootData && ob) { + ob.vmCount++; + } + return ob } -function upx2px(number, newDeviceWidth) { - if (deviceWidth === 0) { - checkDeviceWidth(); - } +/** + * Define a reactive property on an Object. + */ +function defineReactive$$1 ( + obj, + key, + val, + customSetter, + shallow +) { + var dep = new Dep(); - number = Number(number); + var property = Object.getOwnPropertyDescriptor(obj, key); + if (property && property.configurable === false) { + return + } - if (number === 0) { - return 0; + // cater for pre-defined getter/setters + var getter = property && property.get; + var setter = property && property.set; + if ((!getter || setter) && arguments.length === 2) { + val = obj[key]; } - var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth); + var childOb = !shallow && observe(val); + Object.defineProperty(obj, key, { + enumerable: true, + configurable: true, + get: function reactiveGetter () { + var value = getter ? getter.call(obj) : val; + if (Dep.target) { + dep.depend(); + if (childOb) { + childOb.dep.depend(); + if (Array.isArray(value)) { + dependArray(value); + } + } + } + return value + }, + set: function reactiveSetter (newVal) { + var value = getter ? getter.call(obj) : val; + /* eslint-disable no-self-compare */ + if (newVal === value || (newVal !== newVal && value !== value)) { + return + } + /* eslint-enable no-self-compare */ + if ( true && customSetter) { + customSetter(); + } + // #7981: for accessor properties without setter + if (getter && !setter) { return } + if (setter) { + setter.call(obj, newVal); + } else { + val = newVal; + } + childOb = !shallow && observe(newVal); + dep.notify(); + } + }); +} - if (result < 0) { - result = -result; +/** + * Set a property on an object. Adds the new property and + * triggers change notification if the property doesn't + * already exist. + */ +function set (target, key, val) { + if ( true && + (isUndef(target) || isPrimitive(target)) + ) { + warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target)))); + } + if (Array.isArray(target) && isValidArrayIndex(key)) { + target.length = Math.max(target.length, key); + target.splice(key, 1, val); + return val + } + if (key in target && !(key in Object.prototype)) { + target[key] = val; + return val + } + var ob = (target).__ob__; + if (target._isVue || (ob && ob.vmCount)) { + true && warn( + 'Avoid adding reactive properties to a Vue instance or its root $data ' + + 'at runtime - declare it upfront in the data option.' + ); + return val + } + if (!ob) { + target[key] = val; + return val } + defineReactive$$1(ob.value, key, val); + ob.dep.notify(); + return val +} - result = Math.floor(result + EPS); +/** + * Delete a property and trigger change if necessary. + */ +function del (target, key) { + if ( true && + (isUndef(target) || isPrimitive(target)) + ) { + warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target)))); + } + if (Array.isArray(target) && isValidArrayIndex(key)) { + target.splice(key, 1); + return + } + var ob = (target).__ob__; + if (target._isVue || (ob && ob.vmCount)) { + true && warn( + 'Avoid deleting properties on a Vue instance or its root $data ' + + '- just set it to null.' + ); + return + } + if (!hasOwn(target, key)) { + return + } + delete target[key]; + if (!ob) { + return + } + ob.dep.notify(); +} - if (result === 0) { - if (deviceDPR === 1 || !isIOS) { - return 1; - } else { - return 0.5; +/** + * Collect dependencies on array elements when the array is touched, since + * we cannot intercept array element access like property getters. + */ +function dependArray (value) { + for (var e = (void 0), i = 0, l = value.length; i < l; i++) { + e = value[i]; + e && e.__ob__ && e.__ob__.dep.depend(); + if (Array.isArray(e)) { + dependArray(e); } } - - return number < 0 ? -result : result; } -// EXTERNAL MODULE: ./src/platforms/app-plus/helpers/get-window-offset.js -var get_window_offset = __webpack_require__("1e88"); - -// EXTERNAL MODULE: ./node_modules/safe-area-insets/out/index.js -var out = __webpack_require__("d8c8"); -var out_default = /*#__PURE__*/__webpack_require__.n(out); - -// CONCATENATED MODULE: ./src/platforms/h5/service/api/device/get-system-info.js +/* */ -var ua = navigator.userAgent; -/** - * 是否安卓设备 +/** + * Option overwriting strategies are functions that handle + * how to merge a parent option value and a child option + * value into the final value. */ +var strats = config.optionMergeStrategies; -var isAndroid = /android/i.test(ua); -/** - * 是否iOS设备 +/** + * Options with restrictions */ +if (true) { + strats.el = strats.propsData = function (parent, child, vm, key) { + if (!vm) { + warn( + "option \"" + key + "\" can only be used during instance " + + 'creation with the `new` keyword.' + ); + } + return defaultStrat(parent, child) + }; +} -var get_system_info_isIOS = /iphone|ipad|ipod/i.test(ua); -/** - * 获取系统信息-同步 +/** + * Helper that recursively merges two data objects together. */ +function mergeData (to, from) { + if (!from) { return to } + var key, toVal, fromVal; -function getSystemInfoSync() { - var windowWidth = window.innerWidth; - var windowHeight = window.innerHeight; - var screen = window.screen; - var pixelRatio = window.devicePixelRatio; - var screenWidth = screen.width; - var screenHeight = screen.height; - var language = navigator.language; - var statusBarHeight = 0; - var osname; - var osversion; - var model; - - if (get_system_info_isIOS) { - osname = 'iOS'; - var osversionFind = ua.match(/OS\s([\w_]+)\slike/); + var keys = hasSymbol + ? Reflect.ownKeys(from) + : Object.keys(from); - if (osversionFind) { - osversion = osversionFind[1].replace(/_/g, '.'); + for (var i = 0; i < keys.length; i++) { + key = keys[i]; + // in case the object is already observed... + if (key === '__ob__') { continue } + toVal = to[key]; + fromVal = from[key]; + if (!hasOwn(to, key)) { + set(to, key, fromVal); + } else if ( + toVal !== fromVal && + isPlainObject(toVal) && + isPlainObject(fromVal) + ) { + mergeData(toVal, fromVal); } + } + return to +} - var modelFind = ua.match(/\(([a-zA-Z]+);/); - - if (modelFind) { - model = modelFind[1]; +/** + * Data + */ +function mergeDataOrFn ( + parentVal, + childVal, + vm +) { + if (!vm) { + // in a Vue.extend merge, both should be functions + if (!childVal) { + return parentVal + } + if (!parentVal) { + return childVal + } + // when parentVal & childVal are both present, + // we need to return a function that returns the + // merged result of both functions... no need to + // check if parentVal is a function here because + // it has to be a function to pass previous merges. + return function mergedDataFn () { + return mergeData( + typeof childVal === 'function' ? childVal.call(this, this) : childVal, + typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal + ) + } + } else { + return function mergedInstanceDataFn () { + // instance merge + var instanceData = typeof childVal === 'function' + ? childVal.call(vm, vm) + : childVal; + var defaultData = typeof parentVal === 'function' + ? parentVal.call(vm, vm) + : parentVal; + if (instanceData) { + return mergeData(instanceData, defaultData) + } else { + return defaultData + } } - } else if (isAndroid) { - osname = 'Android'; // eslint-disable-next-line no-useless-escape + } +} - var _osversionFind = ua.match(/Android[\s/]([\w\.]+)[;\s]/); +strats.data = function ( + parentVal, + childVal, + vm +) { + if (!vm) { + if (childVal && typeof childVal !== 'function') { + true && warn( + 'The "data" option should be a function ' + + 'that returns a per-instance value in component ' + + 'definitions.', + vm + ); - if (_osversionFind) { - osversion = _osversionFind[1]; + return parentVal } + return mergeDataOrFn(parentVal, childVal) + } - var infoFind = ua.match(/\((.+?)\)/); - var infos = infoFind ? infoFind[1].split(';') : ua.split(' '); // eslint-disable-next-line no-useless-escape + return mergeDataOrFn(parentVal, childVal, vm) +}; - var otherInfo = [/\bAndroid\b/i, /\bLinux\b/i, /\bU\b/i, /^\s?[a-z][a-z]$/i, /^\s?[a-z][a-z]-[a-z][a-z]$/i, /\bwv\b/i, /\/[\d\.,]+$/, /^\s?[\d\.,]+$/, /\bBrowser\b/i, /\bMobile\b/i]; +/** + * Hooks and props are merged as arrays. + */ +function mergeHook ( + parentVal, + childVal +) { + var res = childVal + ? parentVal + ? parentVal.concat(childVal) + : Array.isArray(childVal) + ? childVal + : [childVal] + : parentVal; + return res + ? dedupeHooks(res) + : res +} - for (var i = 0; i < infos.length; i++) { - var info = infos[i]; +function dedupeHooks (hooks) { + var res = []; + for (var i = 0; i < hooks.length; i++) { + if (res.indexOf(hooks[i]) === -1) { + res.push(hooks[i]); + } + } + return res +} - if (info.indexOf('Build') > 0) { - model = info.split('Build')[0].trim(); - break; - } +LIFECYCLE_HOOKS.forEach(function (hook) { + strats[hook] = mergeHook; +}); - var other = void 0; +/** + * Assets + * + * When a vm is present (instance creation), we need to do + * a three-way merge between constructor options, instance + * options and parent options. + */ +function mergeAssets ( + parentVal, + childVal, + vm, + key +) { + var res = Object.create(parentVal || null); + if (childVal) { + true && assertObjectType(key, childVal, vm); + return extend(res, childVal) + } else { + return res + } +} - for (var o = 0; o < otherInfo.length; o++) { - if (otherInfo[o].test(info)) { - other = true; - break; - } - } +ASSET_TYPES.forEach(function (type) { + strats[type + 's'] = mergeAssets; +}); - if (!other) { - model = info.trim(); - break; - } +/** + * Watchers. + * + * Watchers hashes should not overwrite one + * another, so we merge them as arrays. + */ +strats.watch = function ( + parentVal, + childVal, + vm, + key +) { + // work around Firefox's Object.prototype.watch... + if (parentVal === nativeWatch) { parentVal = undefined; } + if (childVal === nativeWatch) { childVal = undefined; } + /* istanbul ignore if */ + if (!childVal) { return Object.create(parentVal || null) } + if (true) { + assertObjectType(key, childVal, vm); + } + if (!parentVal) { return childVal } + var ret = {}; + extend(ret, parentVal); + for (var key$1 in childVal) { + var parent = ret[key$1]; + var child = childVal[key$1]; + if (parent && !Array.isArray(parent)) { + parent = [parent]; } - } else { - osname = 'Other'; - osversion = '0'; + ret[key$1] = parent + ? parent.concat(child) + : Array.isArray(child) ? child : [child]; } + return ret +}; - var system = "".concat(osname, " ").concat(osversion); - var platform = osname.toLocaleLowerCase(); - var safeArea = { - left: out_default.a.left, - right: windowWidth - out_default.a.right, - top: out_default.a.top, - bottom: windowHeight - out_default.a.bottom, - width: windowWidth - out_default.a.left - out_default.a.right, - height: windowHeight - out_default.a.top - out_default.a.bottom - }; - - var _getWindowOffset = Object(get_window_offset["a" /* default */])(), - windowTop = _getWindowOffset.top, - windowBottom = _getWindowOffset.bottom; +/** + * Other object hashes. + */ +strats.props = +strats.methods = +strats.inject = +strats.computed = function ( + parentVal, + childVal, + vm, + key +) { + if (childVal && "development" !== 'production') { + assertObjectType(key, childVal, vm); + } + if (!parentVal) { return childVal } + var ret = Object.create(null); + extend(ret, parentVal); + if (childVal) { extend(ret, childVal); } + return ret +}; +strats.provide = mergeDataOrFn; - windowHeight -= windowTop; - windowHeight -= windowBottom; - return { - windowTop: windowTop, - windowBottom: windowBottom, - windowWidth: windowWidth, - windowHeight: windowHeight, - pixelRatio: pixelRatio, - screenWidth: screenWidth, - screenHeight: screenHeight, - language: language, - statusBarHeight: statusBarHeight, - system: system, - platform: platform, - model: model, - safeArea: safeArea - }; -} -/** - * 获取系统信息-异步 +/** + * Default strategy. */ +var defaultStrat = function (parentVal, childVal) { + return childVal === undefined + ? parentVal + : childVal +}; -function getSystemInfo() { - return getSystemInfoSync(); +/** + * Validate component names + */ +function checkComponents (options) { + for (var key in options.components) { + validateComponentName(key); + } } -// CONCATENATED MODULE: ./lib/app-plus/view-api.js -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return canIUse; }); -/* concated harmony reexport upx2px */__webpack_require__.d(__webpack_exports__, "c", function() { return upx2px; }); -/* concated harmony reexport getSystemInfoSync */__webpack_require__.d(__webpack_exports__, "b", function() { return getSystemInfoSync; }); +function validateComponentName (name) { + if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) { + warn( + 'Invalid component name: "' + name + '". Component names ' + + 'should conform to valid custom element name in html5 specification.' + ); + } + if (isBuiltInTag(name) || config.isReservedTag(name)) { + warn( + 'Do not use built-in or reserved HTML elements as component ' + + 'id: ' + name + ); + } +} -function canIUse(schema) { - if (schema === 'css.var') { - return window.CSS && window.CSS.supports && window.CSS.supports('--a', 0); +/** + * Ensure all props option syntax are normalized into the + * Object-based format. + */ +function normalizeProps (options, vm) { + var props = options.props; + if (!props) { return } + var res = {}; + var i, val, name; + if (Array.isArray(props)) { + i = props.length; + while (i--) { + val = props[i]; + if (typeof val === 'string') { + name = camelize(val); + res[name] = { type: null }; + } else if (true) { + warn('props must be strings when using array syntax.'); + } + } + } else if (isPlainObject(props)) { + for (var key in props) { + val = props[key]; + name = camelize(key); + res[name] = isPlainObject(val) + ? val + : { type: val }; + } + } else if (true) { + warn( + "Invalid value for option \"props\": expected an Array or an Object, " + + "but got " + (toRawType(props)) + ".", + vm + ); } - - return true; + options.props = res; } -/***/ }), - -/***/ "5ab3": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("fcd8"); -/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__); -/* unused harmony reexport * */ - /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a); - -/***/ }), - -/***/ "5abe": -/***/ (function(module, exports) { - /** - * Copyright 2016 Google Inc. All Rights Reserved. - * - * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE. - * - * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document - * + * Normalize all injections into Object-based format */ -(function() { -'use strict'; - -// Exit early if we're not running in a browser. -if (typeof window !== 'object') { - return; -} - -// Exit early if all IntersectionObserver and IntersectionObserverEntry -// features are natively supported. -if ('IntersectionObserver' in window && - 'IntersectionObserverEntry' in window && - 'intersectionRatio' in window.IntersectionObserverEntry.prototype) { - - // Minimal polyfill for Edge 15's lack of `isIntersecting` - // See: https://github.com/w3c/IntersectionObserver/issues/211 - if (!('isIntersecting' in window.IntersectionObserverEntry.prototype)) { - Object.defineProperty(window.IntersectionObserverEntry.prototype, - 'isIntersecting', { - get: function () { - return this.intersectionRatio > 0; - } - }); +function normalizeInject (options, vm) { + var inject = options.inject; + if (!inject) { return } + var normalized = options.inject = {}; + if (Array.isArray(inject)) { + for (var i = 0; i < inject.length; i++) { + normalized[inject[i]] = { from: inject[i] }; + } + } else if (isPlainObject(inject)) { + for (var key in inject) { + var val = inject[key]; + normalized[key] = isPlainObject(val) + ? extend({ from: key }, val) + : { from: val }; + } + } else if (true) { + warn( + "Invalid value for option \"inject\": expected an Array or an Object, " + + "but got " + (toRawType(inject)) + ".", + vm + ); } - return; } - /** - * A local reference to the document. + * Normalize raw function directives into object format. */ -var document = window.document; +function normalizeDirectives (options) { + var dirs = options.directives; + if (dirs) { + for (var key in dirs) { + var def$$1 = dirs[key]; + if (typeof def$$1 === 'function') { + dirs[key] = { bind: def$$1, update: def$$1 }; + } + } + } +} +function assertObjectType (name, value, vm) { + if (!isPlainObject(value)) { + warn( + "Invalid value for option \"" + name + "\": expected an Object, " + + "but got " + (toRawType(value)) + ".", + vm + ); + } +} /** - * An IntersectionObserver registry. This registry exists to hold a strong - * reference to IntersectionObserver instances currently observing a target - * element. Without this registry, instances without another reference may be - * garbage collected. + * Merge two option objects into a new one. + * Core utility used in both instantiation and inheritance. */ -var registry = []; +function mergeOptions ( + parent, + child, + vm +) { + if (true) { + checkComponents(child); + } + if (typeof child === 'function') { + child = child.options; + } -/** - * Creates the global IntersectionObserverEntry constructor. - * https://w3c.github.io/IntersectionObserver/#intersection-observer-entry - * @param {Object} entry A dictionary of instance properties. - * @constructor - */ -function IntersectionObserverEntry(entry) { - this.time = entry.time; - this.target = entry.target; - this.rootBounds = entry.rootBounds; - this.boundingClientRect = entry.boundingClientRect; - this.intersectionRect = entry.intersectionRect || getEmptyRect(); - this.isIntersecting = !!entry.intersectionRect; + normalizeProps(child, vm); + normalizeInject(child, vm); + normalizeDirectives(child); - // Calculates the intersection ratio. - var targetRect = this.boundingClientRect; - var targetArea = targetRect.width * targetRect.height; - var intersectionRect = this.intersectionRect; - var intersectionArea = intersectionRect.width * intersectionRect.height; + // Apply extends and mixins on the child options, + // but only if it is a raw options object that isn't + // the result of another mergeOptions call. + // Only merged options has the _base property. + if (!child._base) { + if (child.extends) { + parent = mergeOptions(parent, child.extends, vm); + } + if (child.mixins) { + for (var i = 0, l = child.mixins.length; i < l; i++) { + parent = mergeOptions(parent, child.mixins[i], vm); + } + } + } - // Sets intersection ratio. - if (targetArea) { - // Round the intersection ratio to avoid floating point math issues: - // https://github.com/w3c/IntersectionObserver/issues/324 - this.intersectionRatio = Number((intersectionArea / targetArea).toFixed(4)); - } else { - // If area is zero and is intersecting, sets to 1, otherwise to 0 - this.intersectionRatio = this.isIntersecting ? 1 : 0; + var options = {}; + var key; + for (key in parent) { + mergeField(key); + } + for (key in child) { + if (!hasOwn(parent, key)) { + mergeField(key); + } + } + function mergeField (key) { + var strat = strats[key] || defaultStrat; + options[key] = strat(parent[key], child[key], vm, key); } + return options } - /** - * Creates the global IntersectionObserver constructor. - * https://w3c.github.io/IntersectionObserver/#intersection-observer-interface - * @param {Function} callback The function to be invoked after intersection - * changes have queued. The function is not invoked if the queue has - * been emptied by calling the `takeRecords` method. - * @param {Object=} opt_options Optional configuration options. - * @constructor + * Resolve an asset. + * This function is used because child instances need access + * to assets defined in its ancestor chain. */ -function IntersectionObserver(callback, opt_options) { - - var options = opt_options || {}; - - if (typeof callback != 'function') { - throw new Error('callback must be a function'); +function resolveAsset ( + options, + type, + id, + warnMissing +) { + /* istanbul ignore if */ + if (typeof id !== 'string') { + return } - - if (options.root && options.root.nodeType != 1) { - throw new Error('root must be an Element'); + var assets = options[type]; + // check local registration variations first + if (hasOwn(assets, id)) { return assets[id] } + var camelizedId = camelize(id); + if (hasOwn(assets, camelizedId)) { return assets[camelizedId] } + var PascalCaseId = capitalize(camelizedId); + if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] } + // fallback to prototype chain + var res = assets[id] || assets[camelizedId] || assets[PascalCaseId]; + if ( true && warnMissing && !res) { + warn( + 'Failed to resolve ' + type.slice(0, -1) + ': ' + id, + options + ); } + return res +} - // Binds and throttles `this._checkForIntersections`. - this._checkForIntersections = throttle( - this._checkForIntersections.bind(this), this.THROTTLE_TIMEOUT); +/* */ - // Private properties. - this._callback = callback; - this._observationTargets = []; - this._queuedEntries = []; - this._rootMarginValues = this._parseRootMargin(options.rootMargin); - // Public properties. - this.thresholds = this._initThresholds(options.threshold); - this.root = options.root || null; - this.rootMargin = this._rootMarginValues.map(function(margin) { - return margin.value + margin.unit; - }).join(' '); + +function validateProp ( + key, + propOptions, + propsData, + vm +) { + var prop = propOptions[key]; + var absent = !hasOwn(propsData, key); + var value = propsData[key]; + // boolean casting + var booleanIndex = getTypeIndex(Boolean, prop.type); + if (booleanIndex > -1) { + if (absent && !hasOwn(prop, 'default')) { + value = false; + } else if (value === '' || value === hyphenate(key)) { + // only cast empty string / same name to boolean if + // boolean has higher priority + var stringIndex = getTypeIndex(String, prop.type); + if (stringIndex < 0 || booleanIndex < stringIndex) { + value = true; + } + } + } + // check default value + if (value === undefined) { + value = getPropDefaultValue(vm, prop, key); + // since the default value is a fresh copy, + // make sure to observe it. + var prevShouldObserve = shouldObserve; + toggleObserving(true); + observe(value); + toggleObserving(prevShouldObserve); + } + if ( + true + ) { + assertProp(prop, key, value, vm, absent); + } + return value } - -/** - * The minimum interval within which the document will be checked for - * intersection changes. - */ -IntersectionObserver.prototype.THROTTLE_TIMEOUT = 100; - - -/** - * The frequency in which the polyfill polls for intersection changes. - * this can be updated on a per instance basis and must be set prior to - * calling `observe` on the first target. - */ -IntersectionObserver.prototype.POLL_INTERVAL = null; - -/** - * Use a mutation observer on the root element - * to detect intersection changes. - */ -IntersectionObserver.prototype.USE_MUTATION_OBSERVER = true; - - /** - * Starts observing a target element for intersection changes based on - * the thresholds values. - * @param {Element} target The DOM element to observe. + * Get the default value of a prop. */ -IntersectionObserver.prototype.observe = function(target) { - var isTargetAlreadyObserved = this._observationTargets.some(function(item) { - return item.element == target; - }); - - if (isTargetAlreadyObserved) { - return; +function getPropDefaultValue (vm, prop, key) { + // no default, return undefined + if (!hasOwn(prop, 'default')) { + return undefined } - - if (!(target && target.nodeType == 1)) { - throw new Error('target must be an Element'); + var def = prop.default; + // warn against non-factory defaults for Object & Array + if ( true && isObject(def)) { + warn( + 'Invalid default value for prop "' + key + '": ' + + 'Props with type Object/Array must use a factory function ' + + 'to return the default value.', + vm + ); } - - this._registerInstance(); - this._observationTargets.push({element: target, entry: null}); - this._monitorIntersections(); - this._checkForIntersections(); -}; - + // the raw prop value was also undefined from previous render, + // return previous default value to avoid unnecessary watcher trigger + if (vm && vm.$options.propsData && + vm.$options.propsData[key] === undefined && + vm._props[key] !== undefined + ) { + return vm._props[key] + } + // call factory function for non-Function types + // a value is Function if its prototype is function even across different execution context + return typeof def === 'function' && getType(prop.type) !== 'Function' + ? def.call(vm) + : def +} /** - * Stops observing a target element for intersection changes. - * @param {Element} target The DOM element to observe. + * Assert whether a prop is valid. */ -IntersectionObserver.prototype.unobserve = function(target) { - this._observationTargets = - this._observationTargets.filter(function(item) { - - return item.element != target; - }); - if (!this._observationTargets.length) { - this._unmonitorIntersections(); - this._unregisterInstance(); +function assertProp ( + prop, + name, + value, + vm, + absent +) { + if (prop.required && absent) { + warn( + 'Missing required prop: "' + name + '"', + vm + ); + return + } + if (value == null && !prop.required) { + return + } + var type = prop.type; + var valid = !type || type === true; + var expectedTypes = []; + if (type) { + if (!Array.isArray(type)) { + type = [type]; + } + for (var i = 0; i < type.length && !valid; i++) { + var assertedType = assertType(value, type[i]); + expectedTypes.push(assertedType.expectedType || ''); + valid = assertedType.valid; + } } -}; + if (!valid) { + warn( + getInvalidTypeMessage(name, value, expectedTypes), + vm + ); + return + } + var validator = prop.validator; + if (validator) { + if (!validator(value)) { + warn( + 'Invalid prop: custom validator check failed for prop "' + name + '".', + vm + ); + } + } +} -/** - * Stops observing all target elements for intersection changes. - */ -IntersectionObserver.prototype.disconnect = function() { - this._observationTargets = []; - this._unmonitorIntersections(); - this._unregisterInstance(); -}; +var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/; +function assertType (value, type) { + var valid; + var expectedType = getType(type); + if (simpleCheckRE.test(expectedType)) { + var t = typeof value; + valid = t === expectedType.toLowerCase(); + // for primitive wrapper objects + if (!valid && t === 'object') { + valid = value instanceof type; + } + } else if (expectedType === 'Object') { + valid = isPlainObject(value); + } else if (expectedType === 'Array') { + valid = Array.isArray(value); + } else { + valid = value instanceof type; + } + return { + valid: valid, + expectedType: expectedType + } +} /** - * Returns any queue entries that have not yet been reported to the - * callback and clears the queue. This can be used in conjunction with the - * callback to obtain the absolute most up-to-date intersection information. - * @return {Array} The currently queued entries. + * Use function string name to check built-in types, + * because a simple equality check will fail when running + * across different vms / iframes. */ -IntersectionObserver.prototype.takeRecords = function() { - var records = this._queuedEntries.slice(); - this._queuedEntries = []; - return records; -}; - +function getType (fn) { + var match = fn && fn.toString().match(/^\s*function (\w+)/); + return match ? match[1] : '' +} -/** - * Accepts the threshold value from the user configuration object and - * returns a sorted array of unique threshold values. If a value is not - * between 0 and 1 and error is thrown. - * @private - * @param {Array|number=} opt_threshold An optional threshold value or - * a list of threshold values, defaulting to [0]. - * @return {Array} A sorted list of unique and valid threshold values. - */ -IntersectionObserver.prototype._initThresholds = function(opt_threshold) { - var threshold = opt_threshold || [0]; - if (!Array.isArray(threshold)) threshold = [threshold]; +function isSameType (a, b) { + return getType(a) === getType(b) +} - return threshold.sort().filter(function(t, i, a) { - if (typeof t != 'number' || isNaN(t) || t < 0 || t > 1) { - throw new Error('threshold must be a number between 0 and 1 inclusively'); +function getTypeIndex (type, expectedTypes) { + if (!Array.isArray(expectedTypes)) { + return isSameType(expectedTypes, type) ? 0 : -1 + } + for (var i = 0, len = expectedTypes.length; i < len; i++) { + if (isSameType(expectedTypes[i], type)) { + return i } - return t !== a[i - 1]; - }); -}; + } + return -1 +} +function getInvalidTypeMessage (name, value, expectedTypes) { + var message = "Invalid prop: type check failed for prop \"" + name + "\"." + + " Expected " + (expectedTypes.map(capitalize).join(', ')); + var expectedType = expectedTypes[0]; + var receivedType = toRawType(value); + var expectedValue = styleValue(value, expectedType); + var receivedValue = styleValue(value, receivedType); + // check if we need to specify expected value + if (expectedTypes.length === 1 && + isExplicable(expectedType) && + !isBoolean(expectedType, receivedType)) { + message += " with value " + expectedValue; + } + message += ", got " + receivedType + " "; + // check if we need to specify received value + if (isExplicable(receivedType)) { + message += "with value " + receivedValue + "."; + } + return message +} -/** - * Accepts the rootMargin value from the user configuration object - * and returns an array of the four margin values as an object containing - * the value and unit properties. If any of the values are not properly - * formatted or use a unit other than px or %, and error is thrown. - * @private - * @param {string=} opt_rootMargin An optional rootMargin value, - * defaulting to '0px'. - * @return {Array} An array of margin objects with the keys - * value and unit. - */ -IntersectionObserver.prototype._parseRootMargin = function(opt_rootMargin) { - var marginString = opt_rootMargin || '0px'; - var margins = marginString.split(/\s+/).map(function(margin) { - var parts = /^(-?\d*\.?\d+)(px|%)$/.exec(margin); - if (!parts) { - throw new Error('rootMargin must be specified in pixels or percent'); - } - return {value: parseFloat(parts[1]), unit: parts[2]}; - }); +function styleValue (value, type) { + if (type === 'String') { + return ("\"" + value + "\"") + } else if (type === 'Number') { + return ("" + (Number(value))) + } else { + return ("" + value) + } +} - // Handles shorthand. - margins[1] = margins[1] || margins[0]; - margins[2] = margins[2] || margins[0]; - margins[3] = margins[3] || margins[1]; +function isExplicable (value) { + var explicitTypes = ['string', 'number', 'boolean']; + return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; }) +} - return margins; -}; +function isBoolean () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; }) +} -/** - * Starts polling for intersection changes if the polling is not already - * happening, and if the page's visibility state is visible. - * @private - */ -IntersectionObserver.prototype._monitorIntersections = function() { - if (!this._monitoringIntersections) { - this._monitoringIntersections = true; +/* */ - // If a poll interval is set, use polling instead of listening to - // resize and scroll events or DOM mutations. - if (this.POLL_INTERVAL) { - this._monitoringInterval = setInterval( - this._checkForIntersections, this.POLL_INTERVAL); +function handleError (err, vm, info) { + // Deactivate deps tracking while processing error handler to avoid possible infinite rendering. + // See: https://github.com/vuejs/vuex/issues/1505 + pushTarget(); + try { + if (vm) { + var cur = vm; + while ((cur = cur.$parent)) { + var hooks = cur.$options.errorCaptured; + if (hooks) { + for (var i = 0; i < hooks.length; i++) { + try { + var capture = hooks[i].call(cur, err, vm, info) === false; + if (capture) { return } + } catch (e) { + globalHandleError(e, cur, 'errorCaptured hook'); + } + } + } + } } - else { - addEvent(window, 'resize', this._checkForIntersections, true); - addEvent(document, 'scroll', this._checkForIntersections, true); + globalHandleError(err, vm, info); + } finally { + popTarget(); + } +} - if (this.USE_MUTATION_OBSERVER && 'MutationObserver' in window) { - this._domObserver = new MutationObserver(this._checkForIntersections); - this._domObserver.observe(document, { - attributes: true, - childList: true, - characterData: true, - subtree: true - }); +function invokeWithErrorHandling ( + handler, + context, + args, + vm, + info +) { + var res; + try { + res = args ? handler.apply(context, args) : handler.call(context); + if (res && !res._isVue && isPromise(res) && !res._handled) { + res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); }); + // issue #9511 + // avoid catch triggering multiple times when nested calls + res._handled = true; + } + } catch (e) { + handleError(e, vm, info); + } + return res +} + +function globalHandleError (err, vm, info) { + if (config.errorHandler) { + try { + return config.errorHandler.call(null, err, vm, info) + } catch (e) { + // if the user intentionally throws the original error in the handler, + // do not log it twice + if (e !== err) { + logError(e, null, 'config.errorHandler'); } } } -}; + logError(err, vm, info); +} +function logError (err, vm, info) { + if (true) { + warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm); + } + /* istanbul ignore else */ + if ((inBrowser || inWeex) && typeof console !== 'undefined') { + console.error(err); + } else { + throw err + } +} -/** - * Stops polling for intersection changes. - * @private - */ -IntersectionObserver.prototype._unmonitorIntersections = function() { - if (this._monitoringIntersections) { - this._monitoringIntersections = false; +/* */ - clearInterval(this._monitoringInterval); - this._monitoringInterval = null; +var isUsingMicroTask = false; - removeEvent(window, 'resize', this._checkForIntersections, true); - removeEvent(document, 'scroll', this._checkForIntersections, true); +var callbacks = []; +var pending = false; - if (this._domObserver) { - this._domObserver.disconnect(); - this._domObserver = null; - } +function flushCallbacks () { + pending = false; + var copies = callbacks.slice(0); + callbacks.length = 0; + for (var i = 0; i < copies.length; i++) { + copies[i](); } -}; - - -/** - * Scans each observation target for intersection changes and adds them - * to the internal entries queue. If new entries are found, it - * schedules the callback to be invoked. - * @private - */ -IntersectionObserver.prototype._checkForIntersections = function() { - var rootIsInDom = this._rootIsInDom(); - var rootRect = rootIsInDom ? this._getRootRect() : getEmptyRect(); +} - this._observationTargets.forEach(function(item) { - var target = item.element; - var targetRect = getBoundingClientRect(target); - var rootContainsTarget = this._rootContainsTarget(target); - var oldEntry = item.entry; - var intersectionRect = rootIsInDom && rootContainsTarget && - this._computeTargetAndRootIntersection(target, rootRect); +// Here we have async deferring wrappers using microtasks. +// In 2.5 we used (macro) tasks (in combination with microtasks). +// However, it has subtle problems when state is changed right before repaint +// (e.g. #6813, out-in transitions). +// Also, using (macro) tasks in event handler would cause some weird behaviors +// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109). +// So we now use microtasks everywhere, again. +// A major drawback of this tradeoff is that there are some scenarios +// where microtasks have too high a priority and fire in between supposedly +// sequential events (e.g. #4521, #6690, which have workarounds) +// or even between bubbling of the same event (#6566). +var timerFunc; - var newEntry = item.entry = new IntersectionObserverEntry({ - time: now(), - target: target, - boundingClientRect: targetRect, - rootBounds: rootRect, - intersectionRect: intersectionRect - }); +// The nextTick behavior leverages the microtask queue, which can be accessed +// via either native Promise.then or MutationObserver. +// MutationObserver has wider support, however it is seriously bugged in +// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It +// completely stops working after triggering a few times... so, if native +// Promise is available, we will use it: +/* istanbul ignore next, $flow-disable-line */ +if (typeof Promise !== 'undefined' && isNative(Promise)) { + var p = Promise.resolve(); + timerFunc = function () { + p.then(flushCallbacks); + // In problematic UIWebViews, Promise.then doesn't completely break, but + // it can get stuck in a weird state where callbacks are pushed into the + // microtask queue but the queue isn't being flushed, until the browser + // needs to do some other work, e.g. handle a timer. Therefore we can + // "force" the microtask queue to be flushed by adding an empty timer. + if (isIOS) { setTimeout(noop); } + }; + isUsingMicroTask = true; +} else if (!isIE && typeof MutationObserver !== 'undefined' && ( + isNative(MutationObserver) || + // PhantomJS and iOS 7.x + MutationObserver.toString() === '[object MutationObserverConstructor]' +)) { + // Use MutationObserver where native Promise is not available, + // e.g. PhantomJS, iOS7, Android 4.4 + // (#6466 MutationObserver is unreliable in IE11) + var counter = 1; + var observer = new MutationObserver(flushCallbacks); + var textNode = document.createTextNode(String(counter)); + observer.observe(textNode, { + characterData: true + }); + timerFunc = function () { + counter = (counter + 1) % 2; + textNode.data = String(counter); + }; + isUsingMicroTask = true; +} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) { + // Fallback to setImmediate. + // Technically it leverages the (macro) task queue, + // but it is still a better choice than setTimeout. + timerFunc = function () { + setImmediate(flushCallbacks); + }; +} else { + // Fallback to setTimeout. + timerFunc = function () { + setTimeout(flushCallbacks, 0); + }; +} - if (!oldEntry) { - this._queuedEntries.push(newEntry); - } else if (rootIsInDom && rootContainsTarget) { - // If the new entry intersection ratio has crossed any of the - // thresholds, add a new entry. - if (this._hasCrossedThreshold(oldEntry, newEntry)) { - this._queuedEntries.push(newEntry); - } - } else { - // If the root is not in the DOM or target is not contained within - // root but the previous entry for this target had an intersection, - // add a new record indicating removal. - if (oldEntry && oldEntry.isIntersecting) { - this._queuedEntries.push(newEntry); +function nextTick (cb, ctx) { + var _resolve; + callbacks.push(function () { + if (cb) { + try { + cb.call(ctx); + } catch (e) { + handleError(e, ctx, 'nextTick'); } + } else if (_resolve) { + _resolve(ctx); } - }, this); - - if (this._queuedEntries.length) { - this._callback(this.takeRecords(), this); + }); + if (!pending) { + pending = true; + timerFunc(); } -}; + // $flow-disable-line + if (!cb && typeof Promise !== 'undefined') { + return new Promise(function (resolve) { + _resolve = resolve; + }) + } +} +/* */ -/** - * Accepts a target and root rect computes the intersection between then - * following the algorithm in the spec. - * TODO(philipwalton): at this time clip-path is not considered. - * https://w3c.github.io/IntersectionObserver/#calculate-intersection-rect-algo - * @param {Element} target The target DOM element - * @param {Object} rootRect The bounding rect of the root after being - * expanded by the rootMargin value. - * @return {?Object} The final intersection rect object or undefined if no - * intersection is found. - * @private - */ -IntersectionObserver.prototype._computeTargetAndRootIntersection = - function(target, rootRect) { +/* not type checking this file because flow doesn't play well with Proxy */ - // If the element isn't displayed, an intersection can't happen. - if (window.getComputedStyle(target).display == 'none') return; +var initProxy; - var targetRect = getBoundingClientRect(target); - var intersectionRect = targetRect; - var parent = getParentNode(target); - var atRoot = false; +if (true) { + var allowedGlobals = makeMap( + 'Infinity,undefined,NaN,isFinite,isNaN,' + + 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + + 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' + + 'require' // for Webpack/Browserify + ); - while (!atRoot) { - var parentRect = null; - var parentComputedStyle = parent.nodeType == 1 ? - window.getComputedStyle(parent) : {}; + var warnNonPresent = function (target, key) { + warn( + "Property or method \"" + key + "\" is not defined on the instance but " + + 'referenced during render. Make sure that this property is reactive, ' + + 'either in the data option, or for class-based components, by ' + + 'initializing the property. ' + + 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', + target + ); + }; - // If the parent isn't displayed, an intersection can't happen. - if (parentComputedStyle.display == 'none') return; + var warnReservedPrefix = function (target, key) { + warn( + "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " + + 'properties starting with "$" or "_" are not proxied in the Vue instance to ' + + 'prevent conflicts with Vue internals. ' + + 'See: https://vuejs.org/v2/api/#data', + target + ); + }; - if (parent == this.root || parent == document) { - atRoot = true; - parentRect = rootRect; - } else { - // If the element has a non-visible overflow, and it's not the - // or element, update the intersection rect. - // Note: and cannot be clipped to a rect that's not also - // the document rect, so no need to compute a new intersection. - if (parent != document.body && - parent != document.documentElement && - parentComputedStyle.overflow != 'visible') { - parentRect = getBoundingClientRect(parent); + var hasProxy = + typeof Proxy !== 'undefined' && isNative(Proxy); + + if (hasProxy) { + var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact'); + config.keyCodes = new Proxy(config.keyCodes, { + set: function set (target, key, value) { + if (isBuiltInModifier(key)) { + warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key)); + return false + } else { + target[key] = value; + return true + } + } + }); + } + + var hasHandler = { + has: function has (target, key) { + var has = key in target; + var isAllowed = allowedGlobals(key) || + (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data)); + if (!has && !isAllowed) { + if (key in target.$data) { warnReservedPrefix(target, key); } + else { warnNonPresent(target, key); } } + return has || !isAllowed } + }; - // If either of the above conditionals set a new parentRect, - // calculate new intersection data. - if (parentRect) { - intersectionRect = computeRectIntersection(parentRect, intersectionRect); + var getHandler = { + get: function get (target, key) { + if (typeof key === 'string' && !(key in target)) { + if (key in target.$data) { warnReservedPrefix(target, key); } + else { warnNonPresent(target, key); } + } + return target[key] + } + }; - if (!intersectionRect) break; + initProxy = function initProxy (vm) { + if (hasProxy) { + // determine which proxy handler to use + var options = vm.$options; + var handlers = options.render && options.render._withStripped + ? getHandler + : hasHandler; + vm._renderProxy = new Proxy(vm, handlers); + } else { + vm._renderProxy = vm; } - parent = getParentNode(parent); - } - return intersectionRect; -}; + }; +} + +/* */ +var seenObjects = new _Set(); /** - * Returns the root rect after being expanded by the rootMargin value. - * @return {Object} The expanded root rect. - * @private + * Recursively traverse an object to evoke all converted + * getters, so that every nested property inside the object + * is collected as a "deep" dependency. */ -IntersectionObserver.prototype._getRootRect = function() { - var rootRect; - if (this.root) { - rootRect = getBoundingClientRect(this.root); +function traverse (val) { + _traverse(val, seenObjects); + seenObjects.clear(); +} + +function _traverse (val, seen) { + var i, keys; + var isA = Array.isArray(val); + if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) { + return + } + if (val.__ob__) { + var depId = val.__ob__.dep.id; + if (seen.has(depId)) { + return + } + seen.add(depId); + } + if (isA) { + i = val.length; + while (i--) { _traverse(val[i], seen); } } else { - // Use / instead of window since scroll bars affect size. - var html = document.documentElement; - var body = document.body; - rootRect = { - top: 0, - left: 0, - right: html.clientWidth || body.clientWidth, - width: html.clientWidth || body.clientWidth, - bottom: html.clientHeight || body.clientHeight, - height: html.clientHeight || body.clientHeight + keys = Object.keys(val); + i = keys.length; + while (i--) { _traverse(val[keys[i]], seen); } + } +} + +var mark; +var measure; + +if (true) { + var perf = inBrowser && window.performance; + /* istanbul ignore if */ + if ( + perf && + perf.mark && + perf.measure && + perf.clearMarks && + perf.clearMeasures + ) { + mark = function (tag) { return perf.mark(tag); }; + measure = function (name, startTag, endTag) { + perf.measure(name, startTag, endTag); + perf.clearMarks(startTag); + perf.clearMarks(endTag); + // perf.clearMeasures(name) }; } - return this._expandRectByRootMargin(rootRect); -}; +} +/* */ -/** - * Accepts a rect and expands it by the rootMargin value. - * @param {Object} rect The rect object to expand. - * @return {Object} The expanded rect. - * @private - */ -IntersectionObserver.prototype._expandRectByRootMargin = function(rect) { - var margins = this._rootMarginValues.map(function(margin, i) { - return margin.unit == 'px' ? margin.value : - margin.value * (i % 2 ? rect.width : rect.height) / 100; - }); - var newRect = { - top: rect.top - margins[0], - right: rect.right + margins[1], - bottom: rect.bottom + margins[2], - left: rect.left - margins[3] - }; - newRect.width = newRect.right - newRect.left; - newRect.height = newRect.bottom - newRect.top; +var normalizeEvent = cached(function (name) { + var passive = name.charAt(0) === '&'; + name = passive ? name.slice(1) : name; + var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first + name = once$$1 ? name.slice(1) : name; + var capture = name.charAt(0) === '!'; + name = capture ? name.slice(1) : name; + return { + name: name, + once: once$$1, + capture: capture, + passive: passive + } +}); - return newRect; -}; +function createFnInvoker (fns, vm) { + function invoker () { + var arguments$1 = arguments; + + var fns = invoker.fns; + if (Array.isArray(fns)) { + var cloned = fns.slice(); + for (var i = 0; i < cloned.length; i++) { + invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler"); + } + } else { + // return handler return value for single handlers + return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler") + } + } + invoker.fns = fns; + return invoker +} + +function updateListeners ( + on, + oldOn, + add, + remove$$1, + createOnceHandler, + vm +) { + var name, def$$1, cur, old, event; + for (name in on) { + def$$1 = cur = on[name]; + old = oldOn[name]; + event = normalizeEvent(name); + if (isUndef(cur)) { + true && warn( + "Invalid handler for event \"" + (event.name) + "\": got " + String(cur), + vm + ); + } else if (isUndef(old)) { + if (isUndef(cur.fns)) { + cur = on[name] = createFnInvoker(cur, vm); + } + if (isTrue(event.once)) { + cur = on[name] = createOnceHandler(event.name, cur, event.capture); + } + add(event.name, cur, event.capture, event.passive, event.params); + } else if (cur !== old) { + old.fns = cur; + on[name] = old; + } + } + for (name in oldOn) { + if (isUndef(on[name])) { + event = normalizeEvent(name); + remove$$1(event.name, oldOn[name], event.capture); + } + } +} +/* */ -/** - * Accepts an old and new entry and returns true if at least one of the - * threshold values has been crossed. - * @param {?IntersectionObserverEntry} oldEntry The previous entry for a - * particular target element or null if no previous entry exists. - * @param {IntersectionObserverEntry} newEntry The current entry for a - * particular target element. - * @return {boolean} Returns true if a any threshold has been crossed. - * @private - */ -IntersectionObserver.prototype._hasCrossedThreshold = - function(oldEntry, newEntry) { +function mergeVNodeHook (def, hookKey, hook) { + if (def instanceof VNode) { + def = def.data.hook || (def.data.hook = {}); + } + var invoker; + var oldHook = def[hookKey]; + + function wrappedHook () { + hook.apply(this, arguments); + // important: remove merged hook to ensure it's called only once + // and prevent memory leak + remove(invoker.fns, wrappedHook); + } - // To make comparing easier, an entry that has a ratio of 0 - // but does not actually intersect is given a value of -1 - var oldRatio = oldEntry && oldEntry.isIntersecting ? - oldEntry.intersectionRatio || 0 : -1; - var newRatio = newEntry.isIntersecting ? - newEntry.intersectionRatio || 0 : -1; + if (isUndef(oldHook)) { + // no existing hook + invoker = createFnInvoker([wrappedHook]); + } else { + /* istanbul ignore if */ + if (isDef(oldHook.fns) && isTrue(oldHook.merged)) { + // already a merged invoker + invoker = oldHook; + invoker.fns.push(wrappedHook); + } else { + // existing plain hook + invoker = createFnInvoker([oldHook, wrappedHook]); + } + } - // Ignore unchanged ratios - if (oldRatio === newRatio) return; + invoker.merged = true; + def[hookKey] = invoker; +} - for (var i = 0; i < this.thresholds.length; i++) { - var threshold = this.thresholds[i]; +/* */ - // Return true if an entry matches a threshold or if the new ratio - // and the old ratio are on the opposite sides of a threshold. - if (threshold == oldRatio || threshold == newRatio || - threshold < oldRatio !== threshold < newRatio) { - return true; +function extractPropsFromVNodeData ( + data, + Ctor, + tag +) { + // we are only extracting raw values here. + // validation and default values are handled in the child + // component itself. + var propOptions = Ctor.options.props; + if (isUndef(propOptions)) { + return + } + var res = {}; + var attrs = data.attrs; + var props = data.props; + if (isDef(attrs) || isDef(props)) { + for (var key in propOptions) { + var altKey = hyphenate(key); + if (true) { + var keyInLowerCase = key.toLowerCase(); + if ( + key !== keyInLowerCase && + attrs && hasOwn(attrs, keyInLowerCase) + ) { + tip( + "Prop \"" + keyInLowerCase + "\" is passed to component " + + (formatComponentName(tag || Ctor)) + ", but the declared prop name is" + + " \"" + key + "\". " + + "Note that HTML attributes are case-insensitive and camelCased " + + "props need to use their kebab-case equivalents when using in-DOM " + + "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"." + ); + } + } + checkProp(res, props, key, altKey, true) || + checkProp(res, attrs, key, altKey, false); } } -}; + return res +} + +function checkProp ( + res, + hash, + key, + altKey, + preserve +) { + if (isDef(hash)) { + if (hasOwn(hash, key)) { + res[key] = hash[key]; + if (!preserve) { + delete hash[key]; + } + return true + } else if (hasOwn(hash, altKey)) { + res[key] = hash[altKey]; + if (!preserve) { + delete hash[altKey]; + } + return true + } + } + return false +} +/* */ -/** - * Returns whether or not the root element is an element and is in the DOM. - * @return {boolean} True if the root element is an element and is in the DOM. - * @private - */ -IntersectionObserver.prototype._rootIsInDom = function() { - return !this.root || containsDeep(document, this.root); -}; +// The template compiler attempts to minimize the need for normalization by +// statically analyzing the template at compile time. +// +// For plain HTML markup, normalization can be completely skipped because the +// generated render function is guaranteed to return Array. There are +// two cases where extra normalization is needed: +// 1. When the children contains components - because a functional component +// may return an Array instead of a single root. In this case, just a simple +// normalization is needed - if any child is an Array, we flatten the whole +// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep +// because functional components already normalize their own children. +function simpleNormalizeChildren (children) { + for (var i = 0; i < children.length; i++) { + if (Array.isArray(children[i])) { + return Array.prototype.concat.apply([], children) + } + } + return children +} -/** - * Returns whether or not the target element is a child of root. - * @param {Element} target The target element to check. - * @return {boolean} True if the target element is a child of root. - * @private - */ -IntersectionObserver.prototype._rootContainsTarget = function(target) { - return containsDeep(this.root || document, target); -}; +// 2. When the children contains constructs that always generated nested Arrays, +// e.g.