diff --git a/build/build.qa.js b/build/build.qa.js new file mode 100644 index 0000000000000000000000000000000000000000..b4ac950c83f6ea8b32f12d34bd270b338d1c901a --- /dev/null +++ b/build/build.qa.js @@ -0,0 +1,77 @@ +const fs = require('fs') +const del = require('del') +const path = require('path') +const copy = require('copy') +const rollup = require('rollup') + +const genConfig = require('./rollup.config.qa') + +const filename = 'vue.' + (process.env.NODE_ENV === 'production' ? 'prod' : 'dev') + '.js' + +async function build () { + const bridgeBundle = await rollup.rollup(genConfig('bridge')) + const { + output: bridgeOutput + } = await bridgeBundle.generate({ + format: 'iife' + }) + const bridgeCode = bridgeOutput[0].code + const appBundle = await rollup.rollup(genConfig('app')) + const { + output: appOutput + } = await appBundle.generate({ + format: 'iife', + banner: ` +dsl.onInitApp(function({ + inst, + context, + instRequireModule +}) { + if(!context.quickapp.dock.makeEvaluateBuildScript){ + context.quickapp.dock.makeEvaluateBuildScript = args => args + } + const $app_require$ = instRequireModule; +`, + footer: ` +});` + }) + const appCode = appOutput[0].code + const pageBundle = await rollup.rollup(genConfig('page')) + const { + output: pageOutput + } = await pageBundle.generate({ + format: 'iife', + banner: ` + dsl.onInitPage(function({ + $app_require$, + Vue + }) { + `, + footer: ` + });` + }) + const pageCode = pageOutput[0].code + const vueCode = fs.readFileSync(path.resolve(__dirname, '../packages/uni-quickapp/assets/' + filename)) + + fs.writeFileSync( + path.resolve(__dirname, '../packages/uni-quickapp/dist/' + filename), + vueCode + bridgeCode + appCode + pageCode, { + encoding: 'utf8' + } + ) + + if (process.env.NODE_ENV === 'production') { // 命令会执行dev,prod两次,仅prod时执行copy + const componentsSrc = path.resolve(__dirname, '../src/platforms/quickapp/view/components/**/*') + const componentsDest = path.resolve(__dirname, '../packages/uni-quickapp/components') + + del.sync([componentsDest]) + + copy(componentsSrc, componentsDest, function (err, file) { + if (err) { + throw err + } + }) + } +} + +build() diff --git a/build/rollup.config.qa.js b/build/rollup.config.qa.js new file mode 100644 index 0000000000000000000000000000000000000000..f5c6618b254fd1cc360e0255730eb6bf0a4f6805 --- /dev/null +++ b/build/rollup.config.qa.js @@ -0,0 +1,72 @@ +const path = require('path') +const alias = require('rollup-plugin-alias') +const replace = require('rollup-plugin-replace') +const nodeResolve = require('rollup-plugin-node-resolve') +const commonjs = require('rollup-plugin-commonjs') +const terser = require('rollup-plugin-terser') +const requireContext = require('../lib/rollup-plugin-require-context') + +process.env.UNI_PLATFORM = 'quickapp' + +const external = [] + +const resolve = dir => path.resolve(__dirname, '../', dir) + +function replaceModuleImport (str) { + return str.replace( + /require\s*\(\s*(['"])@([\w$_][\w$-.]*?)\1\)/gm, + (e, r, p) => `$app_require$(${r}@app-module/${p}${r})` + ).replace( + /import\s+([\w${}]+?)\s+from\s+(['"])@([\w$_][\w$-.]*?)\2/gm, + (e, r, p, t) => `var ${r} = $app_require$(${p}@app-module/${t}${p})` + ) +} + +const plugins = [{ + name: 'replaceModuleImport', + transform (source) { + return { + code: replaceModuleImport(source) + } + } +}, +alias({ + 'uni-core': resolve('src/core'), + 'uni-platform': resolve('src/platforms/' + process.env.UNI_PLATFORM), + 'uni-platforms': resolve('src/platforms'), + 'uni-shared': resolve('src/shared/index.js'), + 'uni-helpers': resolve('src/core/helpers'), + 'uni-invoke-api': resolve('src/platforms/quickapp/service/invoke-api'), + 'uni-service-api': resolve('src/platforms/quickapp/service/api'), + 'uni-api-protocol': resolve('src/core/helpers/protocol') +}), +nodeResolve(), +requireContext(), +commonjs(), +replace({ + __PLATFORM__: JSON.stringify(process.env.UNI_PLATFORM), + __PLATFORM_TITLE__: '快应用' +}) +] + +// if (process.env.NODE_ENV === 'production') { +plugins.push(terser.terser()) +// } + +module.exports = function (type) { + let input = '' + + if (type === 'bridge') { + input = 'src/platforms/quickapp/runtime/bridge.js' + } else if (type === 'app') { + input = 'src/platforms/quickapp/runtime/app.js' + } else if (type === 'page') { + input = 'src/platforms/quickapp/runtime/page.js' + } + + return { + input, + plugins, + external + } +} diff --git a/package.json b/package.json index be975b27174bcf0bb8d27afd5e09e75209caca96..39e4691a53423e4b3ab65f34e8469d94b0d296ea 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "build:mp-toutiao": "cross-env UNI_PLATFORM=mp-toutiao rollup -c build/rollup.config.mp.js", "build:mp-weixin:mp": "npm run lint && cross-env UNI_PLATFORM=mp-weixin UNI_MP=true rollup -c build/rollup.config.mp.js", "build:mp-weixin:wxs": "rollup -c build/rollup.config.wxs.js", + "build:quickapp": "cross-env NODE_ENV=development node build/build.qa.js && cross-env NODE_ENV=production node build/build.qa.js", "build:runtime": "npm run lint && npm run build:mp-weixin && npm run build:mp-qq && npm run build:mp-alipay && npm run build:mp-baidu && npm run build:mp-toutiao && npm run build:app-plus", "build:stat": "npm run lint && rollup -c build/rollup.config.stat.js", "build:web-view": "npm run lint && rollup -c build/rollup.config.web-view.js", @@ -70,8 +71,10 @@ "rollup-plugin-alias": "^1.4.0", "rollup-plugin-babel": "^4.3.3", "rollup-plugin-commonjs": "^10.0.1", + "rollup-plugin-inject": "^3.0.2", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-replace": "^2.1.0", + "rollup-plugin-terser": "^5.2.0", "rollup-plugin-uglify": "^6.0.3", "shell-exec": "^1.0.2", "strip-json-comments": "^2.0.1", @@ -139,4 +142,4 @@ "main": "index.js", "description": "", "author": "" -} +} diff --git a/packages/uni-app-plus/dist/index.js b/packages/uni-app-plus/dist/index.js index c0631e1b2d9d889d78825dda68a85116fe764ebd..7aa090e0814b67627c7b3a8e56d1fc3cf341a8c2 100644 --- a/packages/uni-app-plus/dist/index.js +++ b/packages/uni-app-plus/dist/index.js @@ -1314,7 +1314,8 @@ function parseBaseComponent (vueComponentOptions, { const options = { multipleSlots: true, - addGlobalClass: true + addGlobalClass: true, + ...(vueOptions.options || {}) }; const componentOptions = { diff --git a/packages/uni-cli-shared/lib/pages.js b/packages/uni-cli-shared/lib/pages.js index a13820a4035d951f07c03bab7de90e630a1fbcdd..ca794991c65a9c9c85aa8f4827ba94ad4c20311a 100644 --- a/packages/uni-cli-shared/lib/pages.js +++ b/packages/uni-cli-shared/lib/pages.js @@ -334,21 +334,41 @@ let uniAutoImportComponents = [] let uniAutoImportScanComponents = [] -function initAutoImportScanComponents () { - const componentsPath = path.resolve(process.env.UNI_INPUT_DIR, 'components') +let uniQuickAppAutoImportScanComponents = false + +function getAutoComponentsByDir (componentsPath, absolute = false) { const components = {} try { fs.readdirSync(componentsPath).forEach(name => { - if (fs.existsSync(path.resolve(componentsPath, name, name + '.vue'))) { - components[`^${name}$`] = `@/components/${name}/${name}.vue` - } else if (fs.existsSync(path.resolve(componentsPath, name, name + '.nvue'))) { - components[`^${name}$`] = `@/components/${name}/${name}.nvue` + const folder = path.resolve(componentsPath, name) + const importDir = absolute ? normalizePath(folder) : `@/components/${name}` + if (fs.existsSync(path.resolve(folder, name + '.vue'))) { + components[`^${name}$`] = `${importDir}/${name}.vue` + } else if (fs.existsSync(path.resolve(folder, name + '.nvue'))) { + components[`^${name}$`] = `${importDir}/${name}.nvue` } }) } catch (e) {} + return components +} - uniAutoImportScanComponents = parseUsingAutoImportComponents(components) +function initAutoImportScanComponents () { + const componentsPath = path.resolve(process.env.UNI_INPUT_DIR, 'components') + + const components = getAutoComponentsByDir(componentsPath) + + if (process.env.UNI_PLATFORM === 'quickapp') { + if (!uniQuickAppAutoImportScanComponents) { + uniQuickAppAutoImportScanComponents = getAutoComponentsByDir( + path.resolve(require.resolve('@dcloudio/uni-quickapp'), '../../components'), + true + ) + } + // 平台内置组件优先级高 + Object.assign(components, uniQuickAppAutoImportScanComponents) + } + uniAutoImportScanComponents = parseUsingAutoImportComponents(components) refreshAutoComponentMap() } diff --git a/packages/uni-cli-shared/lib/platform.js b/packages/uni-cli-shared/lib/platform.js index 6b0da7dad18207e3df3cc2ff6e36d8d6acce0e86..61e808d356d6fa558284f0d4b84fba2dbea2f09a 100644 --- a/packages/uni-cli-shared/lib/platform.js +++ b/packages/uni-cli-shared/lib/platform.js @@ -337,6 +337,23 @@ const PLATFORMS = { ...getCopyOptions(['ttcomponents']) ] } + }, + 'quickapp': { + vue: '@dcloudio/vue-cli-plugin-uni/packages/h5-vue', + subPackages: false, + cssVars: { + '--status-bar-height': '25px', + '--window-top': '0px', + '--window-bottom': '0px' + }, + copyWebpackOptions ({ + assetsDir + }) { + return [ + ...getStaticCopyOptions(assetsDir), + ...getCopyOptions(['qacomponents']) + ] + } } } // 解决 vue-cli-service lint 时 UNI_PLATFORM 不存在 @@ -564,7 +581,11 @@ module.exports = { return platform.vue }, getPlatformCompiler () { - if (process.env.UNI_USING_COMPONENTS || process.env.UNI_PLATFORM === 'h5') { + if ( + process.env.UNI_USING_COMPONENTS || + process.env.UNI_PLATFORM === 'h5' || + process.env.UNI_PLATFORM === 'quickapp' + ) { return require(uniCompiler) } return require(platform.compiler) @@ -579,7 +600,7 @@ module.exports = { mergeLonghand: false, mergeRules: false, cssDeclarationSorter: false, - uniqueSelectors: false, // 标签排序影响头条小程序 + uniqueSelectors: false, // 标签排序影响头条小程序 minifySelectors: false, // 标签排序影响头条小程序 discardComments: false, discardDuplicates: false // 条件编译会导致重复 diff --git a/packages/uni-mp-alipay/dist/index.js b/packages/uni-mp-alipay/dist/index.js index 857c1264b2de97b5c144bed9863e9494841d92da..ede7974eaa96e95a876c13976399f24daebed991 100644 --- a/packages/uni-mp-alipay/dist/index.js +++ b/packages/uni-mp-alipay/dist/index.js @@ -442,19 +442,32 @@ const protocols = { // 需要做转换的 API 列表 if (!fromArgs.header) { // 默认增加 header 参数,方便格式化 content-type fromArgs.header = {}; } + const headers = { + 'content-type': 'application/json' + }; + Object.keys(fromArgs.header).forEach(key => { + headers[key.toLocaleLowerCase()] = fromArgs.header[key]; + }); return { header (header = {}, toArgs) { - const headers = { - 'content-type': 'application/json' - }; - Object.keys(header).forEach(key => { - headers[key.toLocaleLowerCase()] = header[key]; - }); return { name: 'headers', value: headers } }, + data (data) { + // 钉钉在content-type为application/json时,不会自动序列化 + if (my.dd && headers['content-type'].indexOf('application/json') === 0) { + return { + name: 'data', + value: JSON.stringify(data) + } + } + return { + name: 'data', + value: data + } + }, method: 'method', // TODO 支付宝小程序仅支持 get,post responseType: false } @@ -551,12 +564,12 @@ const protocols = { // 需要做转换的 API 列表 returnValue: { apFilePath: 'tempFilePath' } - }, - chooseVideo: { - // 支付宝小程序文档中未找到(仅在getSetting处提及),但实际可用 - returnValue: { - apFilePath: 'tempFilePath' - } + }, + chooseVideo: { + // 支付宝小程序文档中未找到(仅在getSetting处提及),但实际可用 + returnValue: { + apFilePath: 'tempFilePath' + } }, connectSocket: { args: { @@ -640,22 +653,22 @@ const protocols = { // 需要做转换的 API 列表 }, scanCode: { name: 'scan', - args (fromArgs) { - if (fromArgs.scanType === 'qrCode') { - fromArgs.type = 'qr'; + args (fromArgs) { + if (fromArgs.scanType === 'qrCode') { + fromArgs.type = 'qr'; + return { + onlyFromCamera: 'hideAlbum' + } + } else if (fromArgs.scanType === 'barCode') { + fromArgs.type = 'bar'; return { - onlyFromCamera: 'hideAlbum' - } - } else if (fromArgs.scanType === 'barCode') { - fromArgs.type = 'bar'; + onlyFromCamera: 'hideAlbum' + } + } else { return { - onlyFromCamera: 'hideAlbum' - } - } else { - return { - scanType: false, - onlyFromCamera: 'hideAlbum' - } + scanType: false, + onlyFromCamera: 'hideAlbum' + } } }, returnValue: { @@ -686,8 +699,16 @@ const protocols = { // 需要做转换的 API 列表 } }, getUserInfo: { - name: 'getAuthUserInfo', + name: my.canIUse('getOpenUserInfo') ? 'getOpenUserInfo' : 'getAuthUserInfo', returnValue (result) { + if (my.canIUse('getOpenUserInfo')) { + let response = {}; + try { + response = JSON.parse(result.response).response; + } catch (e) {} + result.nickName = response.nickName; + result.avatar = response.avatar; + } result.userInfo = { nickName: result.nickName, avatarUrl: result.avatar @@ -706,18 +727,18 @@ const protocols = { // 需要做转换的 API 列表 item.uuid = item.serviceId; }); } - }, - createBLEConnection: { - name: 'connectBLEDevice', - args: { - timeout: false - } - }, - closeBLEConnection: { - name: 'disconnectBLEDevice' - }, - onBLEConnectionStateChange: { - name: 'onBLEConnectionStateChanged' + }, + createBLEConnection: { + name: 'connectBLEDevice', + args: { + timeout: false + } + }, + closeBLEConnection: { + name: 'disconnectBLEDevice' + }, + onBLEConnectionStateChange: { + name: 'onBLEConnectionStateChanged' }, makePhoneCall: { args: { @@ -749,35 +770,35 @@ const protocols = { // 需要做转换的 API 列表 returnValue: { brightness: 'value' } - }, - showShareMenu: { - name: 'showSharePanel' - }, - hideHomeButton: { - name: 'hideBackHome' - }, - saveImageToPhotosAlbum: { - name: 'saveImage', - args: { - filePath: 'url' - } - }, - saveVideoToPhotosAlbum: { - args: { - filePath: 'src' - } - }, - chooseAddress: { - name: 'getAddress', - returnValue (result) { - let info = result.result || {}; - result.userName = info.fullname; - result.provinceName = info.prov; - result.cityName = info.city; - result.detailInfo = info.address; - result.telNumber = info.mobilePhone; - result.errMsg = result.resultStatus; - } + }, + showShareMenu: { + name: 'showSharePanel' + }, + hideHomeButton: { + name: 'hideBackHome' + }, + saveImageToPhotosAlbum: { + name: 'saveImage', + args: { + filePath: 'url' + } + }, + saveVideoToPhotosAlbum: { + args: { + filePath: 'src' + } + }, + chooseAddress: { + name: 'getAddress', + returnValue (result) { + let info = result.result || {}; + result.userName = info.fullname; + result.provinceName = info.prov; + result.cityName = info.city; + result.detailInfo = info.address; + result.telNumber = info.mobilePhone; + result.errMsg = result.resultStatus; + } } }; @@ -2113,7 +2134,7 @@ function parseComponent (vueComponentOptions) { } }, didUnmount () { - this.$vm.$destroy(); + this.$vm && this.$vm.$destroy(); }, methods: { __r: handleRef, diff --git a/packages/uni-mp-baidu/dist/index.js b/packages/uni-mp-baidu/dist/index.js index 8a0c8464a1e5af74fbead9fffee48989c4dd6e13..ca718f756766dd8551b986337ce17f999499e9bb 100644 --- a/packages/uni-mp-baidu/dist/index.js +++ b/packages/uni-mp-baidu/dist/index.js @@ -1448,7 +1448,8 @@ function parseBaseComponent (vueComponentOptions, { const options = { multipleSlots: true, - addGlobalClass: true + addGlobalClass: true, + ...(vueOptions.options || {}) }; const componentOptions = { diff --git a/packages/uni-mp-qq/dist/index.js b/packages/uni-mp-qq/dist/index.js index 5e8389121e58523a62389773a576784409296d9e..9ed02a0ec4b6d1ab6e24a11d50a9a87746c1a275 100644 --- a/packages/uni-mp-qq/dist/index.js +++ b/packages/uni-mp-qq/dist/index.js @@ -1366,10 +1366,11 @@ function parseBaseComponent (vueComponentOptions, { const options = { multipleSlots: true, - addGlobalClass: true + addGlobalClass: true, + ...(vueOptions.options || {}) }; - { + { // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项 if (vueOptions['mp-weixin'] && vueOptions['mp-weixin']['options']) { Object.assign(options, vueOptions['mp-weixin']['options']); diff --git a/packages/uni-mp-toutiao/dist/index.js b/packages/uni-mp-toutiao/dist/index.js index 7a9b2565a1dbcc3253092d7c0f392be48e5efbe7..f0458258bfa90a7a9b444abab192a120727874f5 100644 --- a/packages/uni-mp-toutiao/dist/index.js +++ b/packages/uni-mp-toutiao/dist/index.js @@ -1538,7 +1538,8 @@ function parseBaseComponent (vueComponentOptions, { const options = { multipleSlots: true, - addGlobalClass: true + addGlobalClass: true, + ...(vueOptions.options || {}) }; const componentOptions = { diff --git a/packages/uni-mp-weixin/dist/index.js b/packages/uni-mp-weixin/dist/index.js index 2aac3bf6dc66ba1777f697e86ef4c8c29932a4d8..d59bed55582cbcd073d5f94ff82b9fc26b4b308d 100644 --- a/packages/uni-mp-weixin/dist/index.js +++ b/packages/uni-mp-weixin/dist/index.js @@ -1319,10 +1319,11 @@ function parseBaseComponent (vueComponentOptions, { const options = { multipleSlots: true, - addGlobalClass: true + addGlobalClass: true, + ...(vueOptions.options || {}) }; - { + { // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项 if (vueOptions['mp-weixin'] && vueOptions['mp-weixin']['options']) { Object.assign(options, vueOptions['mp-weixin']['options']); diff --git a/packages/uni-quickapp/LICENSE b/packages/uni-quickapp/LICENSE new file mode 100755 index 0000000000000000000000000000000000000000..7a4a3ea2424c09fbe48d455aed1eaa94d9124835 --- /dev/null +++ b/packages/uni-quickapp/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/packages/uni-quickapp/README.md b/packages/uni-quickapp/README.md new file mode 100644 index 0000000000000000000000000000000000000000..fcb145165e7400280ebfe2e49aa37eca478f7946 --- /dev/null +++ b/packages/uni-quickapp/README.md @@ -0,0 +1,3 @@ +1.解析pages.json,manifest.json 输出 manifest.json ,webpack entries +2.webpack 增加各种loader +1.copy dsl.js \ No newline at end of file diff --git a/packages/uni-quickapp/assets/vue.dev.js b/packages/uni-quickapp/assets/vue.dev.js new file mode 100644 index 0000000000000000000000000000000000000000..0969e4fc08a779bf1e0bbf49b89ba3f124eaf9d8 --- /dev/null +++ b/packages/uni-quickapp/assets/vue.dev.js @@ -0,0 +1 @@ +var dsl=function(){"use strict";const e={initApp:"quickapp.app.initApp",initPage:"quickapp.page.initPage",destroyPage:"quickapp.page.destroyPage",fireEvent:"quickapp.page.fireEvent",onShow:"quickapp.page.onShow",onHide:"quickapp.page.onHide",onBackPress:"quickapp.page.onBackPress",onMenuPress:"quickapp.page.onMenuPress",onOrientationChange:"quickapp.page.onOrientationChange",onConfigurationChanged:"quickapp.page.onConfigurationChanged",onRefresh:"quickapp.page.onRefresh",callbackDone:"quickapp.page.callbackDone"},t=/^@(app)-application\//,n=/^@(app)-component\//,r=/^@(app)-module\//;function o(e){return e.replace(t,"").replace(n,"").replace(r,"")}var i={};function a(e,t,n){return"function"==typeof global.compileAndRunScript?function(e,t,n){let r="(function (";const o=[],i=[];for(const t in e)o.push(t),i.push(e[t]);for(let e=0;e=0&&Math.floor(t)===t&&isFinite(e)}function h(e){return i(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function m(e){return null==e?"":Array.isArray(e)||f(e)&&e.toString===l?JSON.stringify(e,null,2):String(e)}function y(e){var t=parseFloat(e);return isNaN(t)?e:t}function g(e,t){for(var n=Object.create(null),r=e.split(","),o=0;o-1)return e.splice(n,1)}}var w=Object.prototype.hasOwnProperty;function A(e,t){return w.call(e,t)}function k(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var x=/-(\w)/g,O=k(function(e){return e.replace(x,function(e,t){return t?t.toUpperCase():""})}),C=k(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),S=/\B([A-Z])/g,j=k(function(e){return e.replace(S,"-$1").toLowerCase()});var E=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function I(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function P(e,t){for(var n in t)e[n]=t[n];return e}function M(e,t,n){}var T=function(e,t,n){return!1},D=function(e){return e};function F(e,t){if(e===t)return!0;var n=c(e),r=c(t);if(!n||!r)return!n&&!r&&String(e)===String(t);try{var o=Array.isArray(e),i=Array.isArray(t);if(o&&i)return e.length===t.length&&e.every(function(e,n){return F(e,t[n])});if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(o||i)return!1;var a=Object.keys(e),s=Object.keys(t);return a.length===s.length&&a.every(function(n){return F(e[n],t[n])})}catch(e){return!1}}function N(e,t){for(var n=0;n0,te=X&&X.indexOf("edge/")>0,ne=(X&&X.indexOf("android"),X&&/iphone|ipad|ipod|ios/.test(X)||"ios"===G),re=(X&&/chrome\/\d+/.test(X),X&&/phantomjs/.test(X),X&&X.match(/firefox\/(\d+)/),{}.watch);if(Q)try{var oe={};Object.defineProperty(oe,"passive",{get:function(){}}),window.addEventListener("test-passive",null,oe)}catch(e){}var ie=function(){return void 0===W&&(W=!Q&&!Y&&void 0!==u&&(u.process&&"server"===u.process.env.VUE_ENV)),W},ae=Q&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function se(e){return"function"==typeof e&&/native code/.test(e.toString())}var ce,ue="undefined"!=typeof Symbol&&se(Symbol)&&"undefined"!=typeof Reflect&&se(Reflect.ownKeys);ce="undefined"!=typeof Set&&se(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var le=M,pe=M,fe=M,de=M,ve="undefined"!=typeof console,he=/(?:^|[-_])(\w)/g;le=function(e,t){var n=t?fe(t):"";B.warnHandler?B.warnHandler.call(null,e,t,n):ve&&!B.silent&&console.error("[Vue warn]: "+e+n)},pe=function(e,t){ve&&!B.silent&&console.warn("[Vue tip]: "+e+(t?fe(t):""))},de=function(e,t){if(e.$root===e)return"";var n="function"==typeof e&&null!=e.cid?e.options:e._isVue?e.$options||e.constructor.options:e,r=n.name||n._componentTag,o=n.__file;if(!r&&o){var i=o.match(/([^/\\]+)\.vue$/);r=i&&i[1]}return(r?"<"+r.replace(he,function(e){return e.toUpperCase()}).replace(/[-_]/g,"")+">":"")+(o&&!1!==t?" at "+o:"")};fe=function(e){if(e._isVue&&e.$parent){for(var t=[],n=0;e;){if(t.length>0){var r=t[t.length-1];if(r.constructor===e.constructor){n++,e=e.$parent;continue}n>0&&(t[t.length-1]=[r,n],n=0)}t.push(e),e=e.$parent}return"\n\nfound in\n\n"+t.map(function(e,t){return""+(0===t?"---\x3e ":function(e,t){for(var n="";t;)t%2==1&&(n+=e),t>1&&(e+=e),t>>=1;return n}(" ",5+2*t))+(Array.isArray(e)?de(e[0])+"... ("+e[1]+" recursive calls)":de(e))}).join("\n")}return"\n\n(found in "+de(e)+")"};var me=0,ye=function(){"undefined"!=typeof SharedObject?this.id=SharedObject.uid++:this.id=me++,this.subs=[]};function ge(e){ye.SharedObject.targetStack.push(e),ye.SharedObject.target=e}function _e(){ye.SharedObject.targetStack.pop(),ye.SharedObject.target=ye.SharedObject.targetStack[ye.SharedObject.targetStack.length-1]}ye.prototype.addSub=function(e){this.subs.push(e)},ye.prototype.removeSub=function(e){$(this.subs,e)},ye.prototype.depend=function(){ye.SharedObject.target&&ye.SharedObject.target.addDep(this)},ye.prototype.notify=function(){var e=this.subs.slice();B.async||e.sort(function(e,t){return e.id-t.id});for(var t=0,n=e.length;t-1)if(i&&!A(o,"default"))a=!1;else if(""===a||a===j(e)){var u=Ye(String,o.type);(u<0||s0&&(Pt((u=e(u,(n||"")+"_"+c))[0])&&Pt(p)&&(r[l]=Ae(p.text+u[0].text),u.shift()),r.push.apply(r,u)):s(u)?Pt(p)?r[l]=Ae(p.text+u):""!==u&&r.push(Ae(u)):Pt(u)&&Pt(p)?r[l]=Ae(p.text+u.text):(a(t._isVList)&&i(u.tag)&&o(u.key)&&i(n)&&(u.key="__vlist"+n+"_"+c+"__"),r.push(u)));return r}(e):void 0}function Pt(e){return i(e)&&i(e.text)&&!1===e.isComment}function Mt(e,t){if(e){for(var n=Object.create(null),r=ue?Reflect.ownKeys(e):Object.keys(e),o=0;o0,a=e?!!e.$stable:!i,s=e&&e.$key;if(e){if(e._normalized)return e._normalized;if(a&&n&&n!==r&&s===n.$key&&!i&&!n.$hasNormal)return n;for(var c in o={},e)e[c]&&"$"!==c[0]&&(o[c]=Nt(t,c,e[c]))}else o={};for(var u in t)u in o||(o[u]=Lt(t,u));return e&&Object.isExtensible(e)&&(e._normalized=o),z(o,"$stable",a),z(o,"$key",s),z(o,"$hasNormal",i),o}function Nt(e,t,n){var r=function(){var e=arguments.length?n.apply(null,arguments):n({});return(e=e&&"object"==typeof e&&!Array.isArray(e)?[e]:It(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:r,enumerable:!0,configurable:!0}),r}function Lt(e,t){return function(){return e[t]}}function qt(e,t){var n,r,o,a,s;if(Array.isArray(e)||"string"==typeof e)for(n=new Array(e.length),r=0,o=e.length;r.",e),l=new be(B.parsePlatformTagName(t),n,r,void 0,void 0,e)):l=n&&n.pre||!i(f=Ue(e.$options,"components",t))?new be(t,n,r,void 0,void 0,e):an(f,n,e,r,t)}else l=an(t,n,e,r);return Array.isArray(l)?l:i(l)?(i(p)&&function e(t,n,r){t.ns=n;"foreignObject"===t.tag&&(n=void 0,r=!0);if(i(t.children))for(var s=0,c=t.children.length;st.createEvent("Event").timeStamp&&(In=function(){return Pn.now()})}function Mn(){var e,t;for(In(),jn=!0,kn.sort(function(e,t){return e.id-t.id}),En=0;EnAn)){le("You may have an infinite update loop "+(e.user?'in watcher with expression "'+e.expression+'"':"in a component render function."),e.vm);break}var n=xn.slice(),r=kn.slice();En=kn.length=xn.length=0,On={},Cn={},Sn=jn=!1,function(e){for(var t=0;tEn&&kn[n].id>e.id;)n--;kn.splice(n+1,0,e)}else kn.push(e);if(!Sn){if(Sn=!0,!B.async)return void Mn();ft(Mn)}}}(this)},Dn.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||c(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Ze(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},Dn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},Dn.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},Dn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||$(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var Fn={enumerable:!0,configurable:!0,get:M,set:M};function Nn(e,t,n){Fn.get=function(){return this[t][n]},Fn.set=function(e){this[t][n]=e},Object.defineProperty(e,n,Fn)}function Ln(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},o=e.$options._propKeys=[],i=!e.$parent;i||je(!1);var a=function(a){o.push(a);var s=ze(a,t,n,e),c=j(a);(b(c)||B.isReservedAttr(c))&&le('"'+c+'" is a reserved attribute and cannot be used as component prop.',e),Pe(r,a,s,function(){i||_n||le("Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: \""+a+'"',e)}),a in e||Nn(e,"_props",a)};for(var s in t)a(s);je(!0)}(e,t.props),t.methods&&function(e,t){var n=e.$options.props;for(var r in t)"function"!=typeof t[r]&&le('Method "'+r+'" has type "'+typeof t[r]+'" in the component definition. Did you reference the function correctly?',e),n&&A(n,r)&&le('Method "'+r+'" has already been defined as a prop.',e),r in e&&U(r)&&le('Method "'+r+'" conflicts with an existing Vue instance method. Avoid defining component methods that start with _ or $.'),e[r]="function"!=typeof t[r]?M:E(t[r],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;f(t=e._data="function"==typeof t?function(e,t){ge();try{return e.call(t,t)}catch(e){return Ze(e,t,"data()"),{}}finally{_e()}}(t,e):t||{})||(t={},le("data functions should return an object:\nhttps://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function",e));var n=Object.keys(t),r=e.$options.props,o=e.$options.methods,i=n.length;for(;i--;){var a=n[i];o&&A(o,a)&&le('Method "'+a+'" has already been defined as a data property.',e),r&&A(r,a)?le('The data property "'+a+'" is already declared as a prop. Use prop default value instead.',e):U(a)||Nn(e,"_data",a)}Ie(t,!0)}(e):Ie(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=ie();for(var o in t){var i=t[o],a="function"==typeof i?i:i.get;null==a&&le('Getter is missing for computed property "'+o+'".',e),r||(n[o]=new Dn(e,a||M,M,qn)),o in e?o in e.$data?le('The computed property "'+o+'" is already defined in data.',e):e.$options.props&&o in e.$options.props&&le('The computed property "'+o+'" is already defined as a prop.',e):Rn(e,o,i)}}(e,t.computed),t.watch&&t.watch!==re&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var o=0;o-1:"string"==typeof e?e.split(",").indexOf(t)>-1:!!d(e)&&e.test(t)}function Yn(e,t){var n=e.cache,r=e.keys,o=e._vnode;for(var i in n){var a=n[i];if(a){var s=Kn(a.componentOptions);s&&!t(s)&&Gn(n,i,r,o)}}}function Gn(e,t,n,r){var o=e[t];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),e[t]=null,$(n,t)}!function(e){e.prototype._init=function(e){var t,n,o=this;o._uid=Un++,B.performance&&bt&&(t="vue-perf-start:"+o._uid,n="vue-perf-end:"+o._uid,bt(t)),o._isVue=!0,e&&e._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(o,e):o.$options=He(zn(o.constructor),e||{},o),ot(o),o._self=o,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(o),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&yn(e,t)}(o),function(e){e._vnode=null,e._staticTrees=null;var t=e.$options,n=e.$vnode=t._parentVnode,o=n&&n.context;e.$slots=Tt(t._renderChildren,o),e.$scopedSlots=r,e._c=function(t,n,r,o){return ln(e,t,n,r,o,!1)},e.$createElement=function(t,n,r,o){return ln(e,t,n,r,o,!0)};var i=n&&n.data;Pe(e,"$attrs",i&&i.attrs||r,function(){!_n&&le("$attrs is readonly.",e)},!0),Pe(e,"$listeners",t._parentListeners||r,function(){!_n&&le("$listeners is readonly.",e)},!0)}(o),wn(o,"beforeCreate"),"mp-toutiao"!==o.mpHost&&function(e){var t=Mt(e.$options.inject,e);t&&(je(!1),Object.keys(t).forEach(function(n){Pe(e,n,t[n],function(){le('Avoid mutating an injected value directly since the changes will be overwritten whenever the provided component re-renders. injection being mutated: "'+n+'"',e)})}),je(!0))}(o),Ln(o),"mp-toutiao"!==o.mpHost&&function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(o),"mp-toutiao"!==o.mpHost&&wn(o,"created"),B.performance&&bt&&(o._name=de(o,!1),bt(n),$t("vue "+o._name+" init",t,n)),o.$options.el&&o.$mount(o.$options.el)}}(Jn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};t.set=function(){le("Avoid replacing instance root $data. Use nested data properties instead.",this)},n.set=function(){le("$props is readonly.",this)},Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=Me,e.prototype.$delete=Te,e.prototype.$watch=function(e,t,n){if(f(t))return Hn(this,e,t,n);(n=n||{}).user=!0;var r=new Dn(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){Ze(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(Jn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var o=0,i=e.length;o1?I(r):r;for(var o=I(arguments,1),i='event handler for "'+e+'"',a=0,s=r.length;aparseInt(this.max)&&Gn(s,c[0],c,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return B},set:function(){le("Do not replace the Vue.config object, set individual fields instead.")}};Object.defineProperty(e,"config",t),e.util={warn:le,extend:P,mergeOptions:He,defineReactive:Pe},e.set=Me,e.delete=Te,e.nextTick=ft,e.observable=function(e){return Ie(e),e},e.options=Object.create(null),R.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,P(e.options.components,Zn),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=I(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=He(this.options,e),this}}(e),Wn(e),function(e){R.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&Ve(e),"component"===t&&f(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(Jn),Object.defineProperty(Jn.prototype,"$isServer",{get:ie}),Object.defineProperty(Jn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(Jn,"FunctionalRenderContext",{value:en}),Jn.version="2.6.11";function er(e,t,r){n.setElementAttr(e,t,r)}var tr=Object.freeze({namespaceMap:{},createElement:function(e){var r=t.createElement(e);return n.bindElementMethods(r),r},createElementNS:function(e,n){return t.createElement(e+":"+n)},createTextNode:function(e){return t.createTextNode(e)},createComment:function(e){return t.createComment(e)},insertBefore:function(e,t,n){e.insertBefore(t,n)},removeChild:function(e,t){e.removeChild(t)},appendChild:function(e,t){e.appendChild(t)},parentNode:function(e){return e.parentNode},nextSibling:function(e){return e.nextSibling},tagName:function(e){return e.tagName},setTextContent:function(e,t){n.setElementAttr(e.parentNode,"value",t)},setAttribute:er}),nr={create:function(e,t){rr(t)},update:function(e,t){e.data.ref!==t.data.ref&&(rr(e,!0),rr(t))},destroy:function(e){rr(e,!0)}};function rr(e,t){var n=e.data.ref;if(i(n)){var r=e.context,o=e.componentInstance||e.elm,a=r.$refs;t?Array.isArray(a[n])?$(a[n],o):a[n]===o&&(a[n]=void 0):e.data.refInFor?Array.isArray(a[n])?a[n].indexOf(o)<0&&a[n].push(o):a[n]=[o]:a[n]=o}}g("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),g("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0);var or=g("text,number,password,search,email,tel,url"),ir=new be("",{},[]),ar=["create","activate","update","remove","destroy"];function sr(e,t){return e.key===t.key&&(e.tag===t.tag&&e.isComment===t.isComment&&i(e.data)===i(t.data)&&function(e,t){if("input"!==e.tag)return!0;var n,r=i(n=e.data)&&i(n=n.attrs)&&n.type,o=i(n=t.data)&&i(n=n.attrs)&&n.type;return r===o||or(r)&&or(o)}(e,t)||a(e.isAsyncPlaceholder)&&e.asyncFactory===t.asyncFactory&&o(t.asyncFactory.error))}function cr(e,t,n){var r,o,a={};for(r=t;r<=n;++r)i(o=e[r].key)&&(a[o]=r);return a}var ur={create:lr,update:lr,destroy:function(e){lr(e,ir)}};function lr(e,t){(e.data.directives||t.data.directives)&&function(e,t){var n,r,o,i=e===ir,a=t===ir,s=fr(e.data.directives,e.context),c=fr(t.data.directives,t.context),u=[],l=[];for(n in c)r=s[n],o=c[n],r?(o.oldValue=r.value,o.oldArg=r.arg,vr(o,"update",t,e),o.def&&o.def.componentUpdated&&l.push(o)):(vr(o,"bind",t,e),o.def&&o.def.inserted&&u.push(o));if(u.length){var p=function(){for(var n=0;n1,j=t.context.$options.style||{},E=j[$],I=j["@TRANSITION"]&&j["@TRANSITION"][A]||{},T=function(e,t,n,r,o,i){var a={},s=t[n],c=t[r],u=t[o];if(s)for(var l in s)a[l]=e.style[l],null!=a[l]||u&&null!=u[l]||c&&null!=c[l]||le('transition property "'+l+'" is declared in enter starting class (.'+n+"), but not declared anywhere in enter ending class (."+r+"), enter active cass (."+o+") or the element's default styling. Note in Quickapp, CSS properties need explicit values to be transitionable.");if(u)for(var p in u)0!==p.indexOf("transition")&&(a[p]=u[p]);c&&P(a,c);return a}(n,j,$,w,A,t.context),D=Object.keys(T).length>0,F=n._enterCb=L(function(){F.cancelled?C&&C(n):O&&O(n),n._enterCb=null});if(setTimeout(function(){var e=n.parentNode,r=e&&e._pending&&e._pending[t.key];(r&&r.context===t.context&&r.tag===t.tag&&r.elm._leaveCb&&r.elm._leaveCb(),x&&x(n,F),D)?t.context.$requireQuickappModule("animation").transition(n.ref,{styles:T,duration:I.duration||0,delay:I.delay||0,timingFunction:I.timingFunction||"linear"},S?M:F):S||F()},16),k&&k(n),E)for(var N in E)n.setStyle(N,E[N]);D||S||F()}}}function qr(e,t){if(!o(e.data.domProps)||!o(t.data.domProps)){var n,r,a=t.elm,s=e.data.domProps||{},c=t.data.domProps||{};for(n in i(c.__ob__)&&(c=t.data.domProps=P({},c)),s)o(c[n])&&er(a,n,"");for(n in c){if(r=c[n],"value"===n)er(a,n,o(r)?"":String(r));else er(a,n,r)}}}var Rr=function(e){var t,n,r={},c=e.modules,u=e.nodeOps;for(t=0;t - did you register the component correctly? For recursive components, make sure to provide the "name" option.',e.context),e.elm=e.ns?u.createElementNS(e.ns,g):u.createElement(g,e),$(e),y(e,v,t),i(d)&&b(e,t),m(n,e.elm,o),d&&d.pre&&f--):a(e.isComment)?(e.elm=u.createComment(e.text),m(n,e.elm,o)):(e.elm=u.createTextNode(e.text),m(n,e.elm,o))}}function h(e,t){i(e.data.pendingInsert)&&(t.push.apply(t,e.data.pendingInsert),e.data.pendingInsert=null),e.elm=e.componentInstance.$el,_(e)?(b(e,t),$(e)):(rr(e),t.push(e))}function m(e,t,n){i(e)&&(i(n)?u.parentNode(n)===e&&u.insertBefore(e,t,n):u.appendChild(e,t))}function y(e,t,n){if(Array.isArray(t)){O(t);for(var r=0;rd?w(e,o(n[y+1])?null:n[y+1].elm,n,f,y,r):f>y&&k(t,p,d)}(p,h,m,n,l):i(m)?(O(m),i(e.text)&&u.setTextContent(p,""),w(p,null,m,0,m.length-1,n)):i(h)?k(h,0,h.length-1):i(e.text)&&u.setTextContent(p,""):e.text!==t.text&&u.setTextContent(p,t.text),i(d)&&i(f=d.hook)&&i(f=f.postpatch)&&f(e,t)}}}function j(e,t,n){if(a(n)&&i(e.parent))e.parent.data.pendingInsert=t;else for(var r=0;r, or missing . Bailing hydration and performing full client-side render.")}c=e,e=new be(u.tagName(c).toLowerCase(),{},[],void 0,c)}var d=e.elm,h=u.parentNode(d);if(v(t,p,d._leaveCb?null:h,u.nextSibling(d)),i(t.parent))for(var m=t.parent,y=_(t);m;){for(var g=0;g1,d=e.context.$options.style||{},v=d[o],h=d[i]||d[a],m=d["@TRANSITION"]&&d["@TRANSITION"][a]||{},y=n._leaveCb=L(function(){n.parentNode&&n.parentNode._pending&&(n.parentNode._pending[e.key]=null),y.cancelled?l&&l(n):(t(),u&&u(n)),n._leaveCb=null});p?p(g):g();function g(){var t=e.context.$requireQuickappModule("animation");function r(){t.transition(n.ref,{styles:h,duration:m.duration||0,delay:m.delay||0,timingFunction:m.timingFunction||"linear"},f?M:y)}y.cancelled||(e.data.show||((n.parentNode._pending||(n.parentNode._pending={}))[e.key]=e),s&&s(n),v?t.transition(n.ref,{styles:v},r):r(),c&&c(n,y),h||f||y())}}}].concat(hr),LONG_LIST_THRESHOLD:10}),Vr={inserted:function(e,t,n,r){"select"===n.tag?(r.elm&&!r.elm._vOptions?St(n,"postpatch",function(){Vr.componentUpdated(e,t,n)}):Br(e,t,n.context),e._vOptions=[].map.call(e.options,Ur)):("textarea"===n.tag||kr(e.attr.type))&&(e._vModifiers=t.modifiers,t.modifiers.lazy||e.addEventListener("change",zr))},componentUpdated:function(e,t,n){if("select"===n.tag){Br(e,t,n.context);var r=e._vOptions,o=e._vOptions=[].map.call(e.options,Ur);if(o.some(function(e,t){return!F(e,r[t])}))(e.multiple?t.value.some(function(e){return Hr(e,o)}):t.value!==t.oldValue&&Hr(t.value,o))&&Jr(e,"change")}}};function Br(e,t,n){!function(e,t,n){var r,o,i=t.value,a=e.multiple;if(a&&!Array.isArray(i))return void le(' expects an Array value for its binding, but got '+Object.prototype.toString.call(i).slice(8,-1),n);for(var s=0,c=e.options.length;s-1,o.selected!==r&&(o.selected=r);else if(F(Ur(o),i))return void(e.selectedIndex!==s&&(e.selectedIndex=s));a||(e.selectedIndex=-1)}(e,t,n)}function Hr(e,t){return t.every(function(t){return!F(t,e)})}function Ur(e){return"_value"in e?e._value:e.value}function zr(e){e.target.composing=!1,Jr(e.target,"input")}function Jr(e,n){var r=t.createEvent(n);e.dispatchEvent(r)}var Wr={model:Vr,show:{bind:function(e,t,r){var o=t.value,i=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display||"";n.setElementStyle(e,"display",o?i:"none")},update:function(e,t,r){var o=t.value;o!==t.oldValue&&n.setElementStyle(e,"display",o?e.__vOriginalDisplay:"none")},unbind:function(e,t,r,o,i){i||n.setElementStyle(e,"display",e.__vOriginalDisplay)}}};P(Jn.options.directives,Wr),P(Jn.options.components,{});var Kr=["public","protected","private"];Jn.config.mustUseProp=function(){},Jn.config.isReservedTag=wr,Jn.config.isRuntimeComponent=Ar,Jn.config.isUnknownElement=function(){},Jn.prototype.__patch__=Rr,Jn.prototype.$mount=function(e,t){var n=this.$options.type;void 0===n&&(n="component");var r=function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=we,e.$options.template&&"#"!==e.$options.template.charAt(0)||e.$options.el||t?le("You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.",e):le("Failed to mount component: template or render function not defined.",e)),wn(e,"beforeMount"),r=B.performance&&bt?function(){var t=e._name,r=e._uid,o="vue-perf-start:"+r,i="vue-perf-end:"+r;bt(o);var a=e._render();bt(i),$t("vue "+t+" render",o,i),bt(o),e._update(a,n),bt(i),$t("vue "+t+" patch",o,i)}:function(){e._update(e._render(),n)},new Dn(e,r,M,{before:function(){e._isMounted&&!e._isDestroyed&&wn(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(wn(e,"onServiceCreated"),wn(e,"onServiceAttached"),e._isMounted=!0,wn(e,"mounted")),e}(this,e&&function(e,t){if("object"==typeof e&&null!==e)return e;var n=t.body,r=t.createElement("div");return n.appendChild(r),r}.bind(this)(e,this.$document),t);return"page"===n&&(this._connectVm2Page&&this._connectVm2Page(),this._registerPageLifecycle&&this._registerPageLifecycle()),r},Jn.prototype._initExternalData=function(){var e=Jn.config.externalData;if("page"===this.$options.type&&e)if(this.$options._descriptor){var t=this._page.intent&&this._page.intent.fromExternal;for(var n in this._page.intent&&void 0!==this._page.intent.fromExternal||(t=!0),global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 页面VM中声明的权限定义:"+JSON.stringify(this.$options._descriptor)),this.$options.$props&&!function(e){for(var t in e)return!1;return!0}(e)&&console.warn("### App Framework ### 页面VM中不支持props,推荐在public或protected中声明参数"),e){var r=this.$options._descriptor[n];if(r){var o=t&&Kr.indexOf(r.access)>0,i=!t&&Kr.indexOf(r.access)>1;o||i?console.warn("### App Framework ### 传递外部数据"+n+"在VM中声明为"+r.access+",放弃更新"):(global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 传递外部数据"+n+",原值为:"+JSON.stringify(this._data[n])),global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 传递外部数据"+n+",新值为:"+JSON.stringify(e[n])),this.$options.data[n]=e[n])}else global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 传递外部数据"+n+"在VM中未声明,放弃更新")}}else(function e(t){for(var n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];if("function"==typeof Object.assign)Object.assign.apply(Object,[t].concat(n));else{var o=n.shift();for(var i in o)t[i]=o[i];n.length&&e.apply(void 0,[t].concat(n))}return t})(this.$options.data,e)},Jn.prototype._mergeAccess2Data=function(e){if("function"==typeof e.data&&(e.data=e.data()),e.data&&Kr.some(function(t){return e[t]}))throw new Error("页面VM对象中的属性data不可与"+Kr.join(",")+"同时存在,请使用private替换data名称");e.data||(e.data={},e._descriptor={},Kr.forEach(function(t){var n=typeof e[t];if("object"===n)for(var r in e.data=Object.assign(e.data,e[t]),e[t])e._descriptor[r]={access:t};else"function"===n&&console.warn("页面VM对象中的属性"+t+"的值不能是函数,请使用对象")}))};var Qr=Jn.prototype._init;Jn.prototype._init=function(e){var t=this.constructor.options;"page"===t.type&&(this._connectLifecycle&&this._connectLifecycle(t),this._mergeAccess2Data&&this._mergeAccess2Data(t)),Qr.call(this,e)},Jn.prototype._connectLifecycle=function(e){var t=this;e.mounted=e.mounted||[],e.mounted=Array.isArray(e.mounted)?e.mounted:[e.mounted],e.mounted.push(function(){t._ready=!0});e.created=e.created||[],e.created=Array.isArray(e.created)?e.created:[e.created],e.created.push(function(){t._initExternalData()}),e.created.unshift(function(){var e=t.$options.onInit;e&&"function"==typeof e&&e.call(t,t._page._meta.query)})},e.Vue=Jn}}(l={exports:{}},l.exports),l.exports),d=(p=f)&&p.__esModule?p.default:p;const v={onShow:"onShow",onHide:"onHide",onBackPress:"onBackPress",onMenuPress:"onMenuPress",onDestroy:"onDestroy",onConfigurationChanged:"onConfigurationChanged",onOrientationChange:"onOrientationChange",onRefresh:"onRefresh"},h={};let m=null;let y,g=null;function _(e,t,n,r,o){const a=function(e,t){return i.quickapp.runtime.helper.getDocumentNodeByRef(e,t)}(e.doc,t);if(a){return function(e,t,n,r){if(!e)return;const o=i.quickapp.runtime.helper.createEvent(t);if(Object.assign(o,n),global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### fireEventWrap():事件(${t})的参数:${JSON.stringify(n)}, ${JSON.stringify(r)}`),r){const t=r.attr||{};for(const n in t)i.quickapp.runtime.helper.setElementAttr(e,n,t[n],!0);const n=r.style||{};for(const t in n)i.quickapp.runtime.helper.setElementStyle(e,t,n[t],!0)}return e.dispatchEvent(o)}(a,n,r,{attr:o})}return new Error(`fireEvent: 无效element索引 "${t}"`)}function b(e){g||(g=Promise.resolve().then(()=>{e.doc.listener.updateFinish(),g=null}))}function $(e,t,n,r){const s=e.id,c=e.doc.listener,u=c.addActions;c.addActions=((...t)=>{b(e),u.apply(c,t)});const l=e.doc,p=l.createElement("div");l.documentElement.appendChild(p);const f=h[s]={instanceId:s,document:l},g=f.Vue=function(e,t,n){const r=t.page,o=t.appRequireModule,a={setElementAttr(e,t,n){i.quickapp.runtime.helper.setElementAttr(e,t,n)},setElementStyle(e,t,n){"number"==typeof n&&(n+=""),i.quickapp.runtime.helper.setElementStyle(e,t,n)},bindElementMethods(e){i.quickapp.dock.bindComponentMethods(r,e)}},s={};d(s,r.doc,a);const c=s.Vue;global.Vue=!0;const u=h[e],l=/^quickapp:/i,p=c.config.isReservedTag||function(){return!1},f=c.config.isRuntimeComponent||function(){return!1};return c.config.externalData=n,c.config.isReservedTag=function(e){return f(e),p(e)||l.test(e)},c.config.parsePlatformTagName=function(e){return e.replace(l,"")},c.prototype.$instanceId=e,c.prototype.$document=u.document,c.prototype._connectVm2Page=function(){r.vm=this},Object.defineProperty(c.prototype,"$app",{get(){if(!this._isDestroyed)return r.app}}),Object.defineProperty(c.prototype,"$page",{get(){if(this._isDestroyed)return;const e=r.app;return Object.assign({setTitleBar:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 setTitleBar ----`),i.quickapp.runtime.helper.updatePageTitleBar(r.doc,e))},scrollTo:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 scrollTo ----`),i.quickapp.runtime.helper.scrollTo(r.doc,e))},scrollBy:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 scrollBy ----`),i.quickapp.runtime.helper.scrollBy(r.doc,e))},exitFullscreen:function(){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 exitFullscreen ----`),i.quickapp.runtime.helper.exitFullscreen(r.doc))},setStatusBar:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 setStatusBar ----`),i.quickapp.runtime.helper.updatePageStatusBar(r.doc,e))},finish:function(){r&&r.doc&&(null===m&&(m=i.quickapp.platform.requireModule(e,"system.page")),m.finishPage(r.id))}},r&&r._meta)}}),Object.defineProperties(c.prototype,{$valid:{get:()=>!!r&&r._valid,configurable:!1},$visible:{get:()=>!!r&&r._valid&&r._visible,configurable:!1},$destroyed:{get:()=>!!r&&r.vm&&r.vm._isDestroyed,configurable:!1}}),c.prototype._registerPageLifecycle=function(){Object.keys(v).forEach(e=>{this.$on(`xlc:${e}`,(...t)=>{let n=!1;const r=this.$options[e];if(!r||"function"!=typeof r)return;const o=Array.isArray(r)?r:[r];if(o&&o.length)for(let e=0;e{},$app_bootstrap$:()=>{},$app_define_wrap$:()=>{},$app_require$:t=>i.quickapp.platform.requireModule(e,o(t)),$app_evaluate$:i.quickapp.dock.makeEvaluateBuildScript(r)},r);let $;"function"==typeof y&&y(_),$="(function(global){"+($=t.toString())+"\n })(Object.create(this))";{const t=e.pageName?`${e.pageName}/${e.pageComponent}.js`:"";global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### bundleUrl----",t),a(_,$,t)}return e.doc.listener.createFinish(),f}function w(e,t,n,...r){let o=!1;return t.vm&&t.vm._ready?(t.vm.$emit(`xlc:${e}`,n,...r),o=t.vm._events[`xlc:${e}`].result,b(t),global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### ${e} (${t.id})----`)):global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### ${e} 页面(${t.id})创建失败, 无法响应事件---- `),o}return{init:function(t){i.quickapp=t,global.process=global.process||{},global.process.env={},t.subscribe(e.initApp,e=>(function(e,t){global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### 开始初始化App(${e.id})`);const n=t=>i.quickapp.platform.requireModule(e,o(t)),r=t=>{e.$def=t,"function"==typeof c&&c(t)},u=()=>{global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### 调用App(${e.name})生命周期---- onCreate`),e.$emit("applc:onCreate")};"function"==typeof s&&s({context:i,inst:e,instRequireModule:n});const l=i.quickapp.dock.makeEvaluateBuildScript(null);let p;p=`(function(global){"use strict"; ${p=t.toString()}; \n })(Object.create(this))`,global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 开始编译代码----"),a({$app_define$:r,$app_require$:n,$app_bootstrap$:u,$app_evaluate$:l},p,"app.js")})(...e)),t.subscribe(e.initPage,e=>$(...e)),t.subscribe(e.destroyPage,e=>{!function(e){e.vm&&(e.vm.$emit("xlc:onDestroy"),e.vm.$destroy())}(...e)}),t.subscribe(e.fireEvent,e=>{const t=_(...e);return b(e[0]),t}),t.subscribe(e.callbackDone,e=>{b(e[0])}),t.subscribe(e.onShow,e=>w(v.onShow,...e)),t.subscribe(e.onHide,e=>w(v.onHide,...e)),t.subscribe(e.onBackPress,e=>w(v.onBackPress,...e)),t.subscribe(e.onMenuPress,e=>(w(v.onMenuPress,...e),function(e){let t=!1;if(e.vm&&e.vm._ready){const n=e.vm._events,r=n&&n["xlc:onMenuPress"]&&n["xlc:onMenuPress"].handlers;r&&r.length&&(t=!0)}return t}(...e))),t.subscribe(e.onConfigurationChanged,e=>w(v.onConfigurationChanged,...e)),t.subscribe(e.onOrientationChange,e=>w(v.onOrientationChange,...e)),t.subscribe(e.onRefresh,e=>w(v.onRefresh,...e))},onInitApp:function(e){s=e},onDefineApp:function(e){c=e},onInitPage:function(e){y=e}}}(); +!function(){"use strict";class e{constructor(){this._events=Object.create(null)}on(e,t){const n=this;if(Array.isArray(e))for(let s=0,r=e.length;se);const n=r;!function(){"use strict";var t=["base64ToArrayBuffer","arrayBufferToBase64","addInterceptor","removeInterceptor","request","uploadFile","downloadFile","connectSocket","onSocketOpen","onSocketError","sendSocketMessage","onSocketMessage","closeSocket","onSocketClose","navigateTo","redirectTo","reLaunch","switchTab","navigateBack","setStorage","setStorageSync","getStorage","getStorageSync","getStorageInfo","getStorageInfoSync","removeStorage","removeStorageSync","clearStorage","clearStorageSync","getLocation","chooseLocation","openLocation","createMapContext","chooseImage","previewImage","getImageInfo","saveImageToPhotosAlbum","compressImage","getRecorderManager","getBackgroundAudioManager","createInnerAudioContext","chooseVideo","saveVideoToPhotosAlbum","createVideoContext","createCameraContext","createLivePlayerContext","createLivePusherContext","getSystemInfo","getSystemInfoSync","canIUse","onMemoryWarning","getNetworkType","onNetworkStatusChange","onAccelerometerChange","startAccelerometer","stopAccelerometer","onCompassChange","startCompass","stopCompass","onGyroscopeChange","startGyroscope","stopGyroscope","makePhoneCall","scanCode","setClipboardData","getClipboardData","setScreenBrightness","getScreenBrightness","setKeepScreenOn","onUserCaptureScreen","vibrateLong","vibrateShort","addPhoneContact","openBluetoothAdapter","startBluetoothDevicesDiscovery","onBluetoothDeviceFound","stopBluetoothDevicesDiscovery","onBluetoothAdapterStateChange","getConnectedBluetoothDevices","getBluetoothDevices","getBluetoothAdapterState","closeBluetoothAdapter","writeBLECharacteristicValue","readBLECharacteristicValue","onBLEConnectionStateChange","onBLECharacteristicValueChange","notifyBLECharacteristicValueChange","getBLEDeviceServices","getBLEDeviceCharacteristics","createBLEConnection","closeBLEConnection","onBeaconServiceChange","onBeaconUpdate","getBeacons","startBeaconDiscovery","stopBeaconDiscovery","checkIsSupportSoterAuthentication","checkIsSoterEnrolledInDevice","startSoterAuthentication","hideKeyboard","onKeyboardHeightChange","showToast","hideToast","showLoading","hideLoading","showModal","showActionSheet","setNavigationBarTitle","setNavigationBarColor","showNavigationBarLoading","hideNavigationBarLoading","setTabBarItem","setTabBarStyle","hideTabBar","showTabBar","setTabBarBadge","removeTabBarBadge","showTabBarRedDot","hideTabBarRedDot","onTabBarMidButtonTap","setBackgroundColor","setBackgroundTextStyle","createAnimation","pageScrollTo","onWindowResize","offWindowResize","loadFontFace","startPullDownRefresh","stopPullDownRefresh","createSelectorQuery","createIntersectionObserver","$emit","$on","$once","$off","saveFile","getSavedFileList","getSavedFileInfo","removeSavedFile","getFileInfo","openDocument","getFileSystemManager","createOffscreenCanvas","createCanvasContext","canvasToTempFilePath","canvasPutImageData","canvasGetImageData","getProvider","login","checkSession","getUserInfo","share","showShareMenu","hideShareMenu","requestPayment","subscribePush","unsubscribePush","onPush","offPush","requireNativePlugin","upx2px","restoreGlobal","getSubNVueById","getCurrentSubNVue","setPageMeta","createRewardedVideoAd"];let r=!1;try{const e={};Object.defineProperty(e,"passive",{get(){r=!0}}),window.addEventListener("test-passive",null,e)}catch(e){}const o=Object.prototype.toString,a=Object.prototype.hasOwnProperty;function i(e){return"function"==typeof e}function c(e){return"[object Object]"===o.call(e)}function s(e,t){return a.call(e,t)}const u=decodeURIComponent;function l(e){const t={};return(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach(e=>{const r=e.replace(/\+/g," ").split("="),n=u(r.shift()),o=r.length>0?u(r.join("=")):null;void 0===t[n]?t[n]=o:Array.isArray(t[n])?t[n].push(o):t[n]=[t[n],o]}),t):t}function d(e){return function(){try{return e.apply(e,arguments)}catch(e){console.error(e)}}}function p(e){return function(){try{return e.apply(e,arguments)}catch(e){console.error(e)}}}const f=["invoke","success","fail","complete","returnValue"],g={},y={};function h(e,t){Object.keys(t).forEach(r=>{-1!==f.indexOf(r)&&i(t[r])&&(e[r]=function(e,t){const r=t?e?e.concat(t):Array.isArray(t)?t:[t]:e;return r?function(e){const t=[];for(let r=0;r{-1!==f.indexOf(r)&&i(t[r])&&function(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}(e[r],t[r])})}function b(e){return function(t){return e(t)||t}}function v(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}function S(e,t){let r=!1;for(let n=0;ne(t)}}function _(e,t={}){return["success","fail","complete"].forEach(r=>{if(Array.isArray(e[r])){const n=t[r];t[r]=function(t){S(e[r],t).then(e=>i(n)&&n(e)||e)}}}),t}function O(e,t){const r=[];Array.isArray(g.returnValue)&&r.push(...g.returnValue);const n=y[e];return n&&Array.isArray(n.returnValue)&&r.push(...n.returnValue),r.forEach(e=>{t=e(t)||t}),t}function T(e,t,r,...n){const o=function(e){const t=Object.create(null);Object.keys(g).forEach(e=>{"returnValue"!==e&&(t[e]=g[e].slice())});const r=y[e];return r&&Object.keys(r).forEach(e=>{"returnValue"!==e&&(t[e]=(t[e]||[]).concat(r[e]))}),t}(e);if(o&&Object.keys(o).length){if(Array.isArray(o.invoke)){return S(o.invoke,r).then(e=>t(_(o,e),...n))}return t(_(o,r),...n)}return t(r,...n)}const j={returnValue:e=>v(e)?e.then(e=>e[1]).catch(e=>e[0]):e},C=/^\$|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/,k=/^create|Manager$/,B=["request","downloadFile","uploadFile","connectSocket"],A=/^on/;function x(e){return C.test(e)}function w(e){return A.test(e)&&"onPush"!==e}function E(e){return!(function(e){return k.test(e)}(e)||x(e)||w(e))}const I=[{name:"base64",type:String,required:!0}],q=[{name:"arrayBuffer",type:[ArrayBuffer,Uint8Array],required:!0}];var N=Object.freeze({__proto__:null,base64ToArrayBuffer:I,arrayBufferToBase64:q});const P=[{name:"schema",type:String,required:!0}];var M=Object.freeze({__proto__:null,canIUse:P});const D=[{name:"event",type:[String,Array],required:!0},{name:"callback",type:Function,required:!0}],L=D,z=[{name:"event",type:[String,Array]},{name:"callback",type:Function}],$=[{name:"event",type:String,required:!0}];var U=Object.freeze({__proto__:null,$on:D,$once:L,$off:z,$emit:$});const F=[{name:"method",type:[String,Object],required:!0}],R=F;var V=Object.freeze({__proto__:null,addInterceptor:F,removeInterceptor:R});const G=[{name:"upx",type:[Number,String],required:!0}];var H=Object.freeze({__proto__:null,upx2px:G});function W(e){return function(t,r){t&&(r[e]=Math.round(t))}}const J={canvasId:{type:String,required:!0},x:{type:Number,required:!0,validator:W("x")},y:{type:Number,required:!0,validator:W("y")},width:{type:Number,required:!0,validator:W("width")},height:{type:Number,required:!0,validator:W("height")}},K={canvasId:{type:String,required:!0},data:{type:Uint8ClampedArray,required:!0},x:{type:Number,required:!0,validator:W("x")},y:{type:Number,required:!0,validator:W("y")},width:{type:Number,required:!0,validator:W("width")},height:{type:Number,validator:W("height")}},Y={PNG:"png",JPG:"jpeg"},X={x:{type:Number,default:0,validator:W("x")},y:{type:Number,default:0,validator:W("y")},width:{type:Number,validator:W("width")},height:{type:Number,validator:W("height")},destWidth:{type:Number,validator:W("destWidth")},destHeight:{type:Number,validator:W("destHeight")},canvasId:{type:String,require:!0},fileType:{type:String,validator(e,t){e=(e||"").toUpperCase(),t.fileType=e in Y?Y[e]:Y.PNG}},quality:{type:Number,validator(e,t){e=Math.floor(e),t.quality=e>0&&e<1?e:1}}},Q={canvasId:{type:String,require:!0},actions:{type:Array,require:!0},reserve:{type:Boolean,default:!1}};var Z=Object.freeze({__proto__:null,canvasGetImageData:J,canvasPutImageData:K,canvasToTempFilePath:X,drawCanvas:Q});const ee=[{name:"id",type:String,required:!0}],te=ee,re=ee,ne=ee,oe=[{name:"canvasId",type:String,required:!0},{name:"componentInstance",type:Object}];var ae=Object.freeze({__proto__:null,createAudioContext:te,createVideoContext:re,createMapContext:ne,createCanvasContext:oe});const ie={phoneNumber:{type:String,required:!0,validator(e){if(!e)return"makePhoneCall:fail parameter error: parameter.phoneNumber should not be empty String;"}}};var ce=Object.freeze({__proto__:null,makePhoneCall:ie});const se={beforeSuccess(){uni.showToast({title:"内容已复制",icon:"success",mask:!1})}};var ue=Object.freeze({__proto__:null,setClipboardData:se});const le={filePath:{type:String,required:!0},fileType:{type:String}};var de=Object.freeze({__proto__:null,openDocument:le});const pe={keyword:{type:String}};var fe=Object.freeze({__proto__:null,chooseLocation:pe});const ge={WGS84:"WGS84",GCJ02:"GCJ02"},ye={type:{type:String,validator(e,t){e=(e||"").toUpperCase(),t.type=Object.values(ge).indexOf(e)<0?ge.WGS84:e},default:ge.WGS84},altitude:{altitude:Boolean,default:!1}};var he=Object.freeze({__proto__:null,getLocation:ye});const me={latitude:{type:Number,required:!0},longitude:{type:Number,required:!0},scale:{type:Number,validator(e,t){e=Math.floor(e),t.scale=e>=5&&e<=18?e:18},default:18},name:{type:String},address:{type:String}};var be=Object.freeze({__proto__:null,openLocation:me});const ve=["original","compressed"],Se=["album","camera"],_e={count:{type:Number,required:!1,default:9,validator(e,t){e<=0&&(t.count=9)}},sizeType:{type:[Array,String],required:!1,default:ve,validator(e,t){const r=e.length;if(r){if("string"==typeof e)~ve.indexOf(e)||(t.sizeType=ve);else for(let n=0;n0?e.split("/"):[];return a.splice(a.length-o-1,o+1),"/"+a.concat(r).join("/")}const Be=/^([a-z-]+:)?\/\//i,Ae=/^data:.*,.*/;function xe(e){return __uniConfig.router.base?__uniConfig.router.base+e:e}function we(e){if(0===e.indexOf("/")){if(0!==e.indexOf("//"))return xe(e.substr(1));e="https:"+e}if(Be.test(e)||Ae.test(e)||0===e.indexOf("blob:"))return e;const t=getCurrentPages();return t.length?xe(ke(t[t.length-1].$page.route,e).substr(1)):e}const Ee={src:{type:String,required:!0,validator(e,t){t.src=we(e)}}};var Ie=Object.freeze({__proto__:null,getImageInfo:Ee});const qe={urls:{type:Array,required:!0,validator(e,t){var r;if(t.urls=e.map(e=>{if("string"==typeof e)return we(e);r=!0}),r)return"url is not string"}},current:{type:[String,Number],validator(e,t){"number"==typeof e?t.current=e>0&&ee);o={},a.forEach(e=>{e=e.split("="),o[e[0]]=e[1]});for(let e in t)t.hasOwnProperty(e)&&(c(t[e])?o[$e(e)]=$e(JSON.stringify(t[e])):o[$e(e)]=$e(t[e]));return o=Object.keys(o).map(e=>`${e}=${o[e]}`).join("&"),e+(o?"?"+o:"")+(n?"#"+n:"")}(e,t.data))}},header:{type:Object,validator(e,t){const r=t.header=e||{};t.method!==De.GET&&(Object.keys(r).find(e=>"content-type"===e.toLowerCase())||(r["Content-Type"]="application/json"))}},dataType:{type:String,validator(e,t){t.dataType=(e||Le).toLowerCase()}},responseType:{type:String,validator(e,t){e=(e||"").toLowerCase(),t.responseType=Object.values(ze).indexOf(e)<0?ze.TEXT:e}}};var Fe=Object.freeze({__proto__:null,request:Ue});const Re={OPTIONS:"OPTIONS",GET:"GET",HEAD:"HEAD",POST:"POST",PUT:"PUT",DELETE:"DELETE",TRACE:"TRACE",CONNECT:"CONNECT"},Ve={url:{type:String,required:!0},header:{type:Object,validator(e,t){t.header=e||{}}},method:{type:String,validator(e,t){e=(e||"").toUpperCase(),t.method=Object.values(Re).indexOf(e)<0?Re.GET:e}},protocols:{type:Array,validator(e,t){t.protocols=(e||[]).filter(e=>"string"==typeof e)}}},Ge={data:{type:[String,ArrayBuffer]}},He={code:{type:Number},reason:{type:String}};var We=Object.freeze({__proto__:null,connectSocket:Ve,sendSocketMessage:Ge,closeSocket:He});const Je={url:{type:String,required:!0},files:{type:Array},filePath:{type:String,validator(e,t){e&&(t.type=we(e))}},name:{type:String},header:{type:Object,validator(e,t){t.header=e||{}}},formData:{type:Object,validator(e,t){t.formData=e||{}}}};var Ke=Object.freeze({__proto__:null,uploadFile:Je});const Ye={OAUTH:"OAUTH",SHARE:"SHARE",PAYMENT:"PAYMENT",PUSH:"PUSH"},Xe={service:{type:String,required:!0,validator(e,t){if((e=(e||"").toUpperCase())&&Object.values(Ye).indexOf(e)<0)return"service error"}}};var Qe=Object.freeze({__proto__:null,getProvider:Xe});function Ze(e){return function(t,r){const n=(t=ke(t)).split("?")[0],o=__uniRoutes.find(({path:e,alias:t})=>e===n||t===n);if(!o)return"page `"+t+"` is not found";if("navigateTo"===e||"redirectTo"===e){if(o.meta.isTabBar)return`can not ${e} a tabbar page`}else if("switchTab"===e&&!o.meta.isTabBar)return"can not switch to no-tabBar page";o.meta.isTabBar&&(t=n),o.meta.isEntry&&(t=t.replace(o.alias,"/")),r.url=function(e){if("string"!=typeof e)return e;const t=e.indexOf("?");if(-1===t)return e;const r=e.substr(t+1).trim().replace(/^(\?|#|&)/,"");if(!r)return e;e=e.substr(0,t);const n=[];return r.split("&").forEach(e=>{const t=e.replace(/\+/g," ").split("="),r=t.shift(),o=t.length>0?t.join("="):"";n.push(r+"="+encodeURIComponent(o))}),n.length?e+"?"+n.join("&"):e}(t)}}function et(e,t={}){return Object.assign({url:{type:String,required:!0,validator:Ze(e)}},t)}function tt(e){return{animationType:{type:String,validator(t){if(t&&-1===e.indexOf(t))return"`"+t+"` is not supported for `animationType` (supported values are: `"+e.join("`|`")+"`)"}},animationDuration:{type:Number}}}const rt=et("redirectTo"),nt=et("reLaunch"),ot=et("navigateTo",tt(["slide-in-right","slide-in-left","slide-in-top","slide-in-bottom","fade-in","zoom-out","zoom-fade-out","pop-in","none"])),at=et("switchTab"),it=Object.assign({delta:{type:Number,validator(e,t){e=parseInt(e)||1,t.delta=Math.min(getCurrentPages().length-1,e)}}},tt(["slide-out-right","slide-out-left","slide-out-top","slide-out-bottom","fade-out","zoom-in","zoom-fade-in","pop-out","none"]));var ct=Object.freeze({__proto__:null,redirectTo:rt,reLaunch:nt,navigateTo:ot,switchTab:at,navigateBack:it});const st={key:{type:String,required:!0}},ut=[{name:"key",type:String,required:!0}],lt={key:{type:String,required:!0},data:{required:!0}},dt=[{name:"key",type:String,required:!0},{name:"data",required:!0}],pt=st,ft=ut;var gt=Object.freeze({__proto__:null,getStorage:st,getStorageSync:ut,setStorage:lt,setStorageSync:dt,removeStorage:pt,removeStorageSync:ft});const yt={family:{type:String,required:!0},source:{type:String,required:!0},desc:{type:Object,required:!1},success:{type:Function,required:!1},fail:{type:Function,required:!1},complete:{type:Function,required:!1}};var ht=Object.freeze({__proto__:null,loadFontFace:yt});const mt=["#ffffff","#000000"],bt={frontColor:{type:String,required:!0,validator(e,t){if(-1===mt.indexOf(e))return`invalid frontColor "${e}"`}},backgroundColor:{type:String,required:!0},animation:{type:Object,default:()=>({duration:0,timingFunc:"linear"}),validator(e={},t){t.animation={duration:e.duration||0,timingFunc:e.timingFunc||"linear"}}}},vt={title:{type:String,required:!0}};var St=Object.freeze({__proto__:null,setNavigationBarColor:bt,setNavigationBarTitle:vt});const _t={scrollTop:{type:Number,required:!0},duration:{type:Number,default:300,validator(e,t){t.duration=Math.max(0,e)}}};var Ot=Object.freeze({__proto__:null,pageScrollTo:_t});const Tt={title:{type:String,default:""},content:{type:String,default:""},showCancel:{type:Boolean,default:!0},cancelText:{type:String,default:"取消"},cancelColor:{type:String,default:"#000000"},confirmText:{type:String,default:"确定"},confirmColor:{type:String,default:"#007aff"},visible:{type:Boolean,default:!0}},jt={title:{type:String,default:""},icon:{default:"success",validator(e,t){-1===["success","loading","none"].indexOf(e)&&(t.icon="success")}},image:{type:String,default:"",validator(e,t){e&&(t.image=we(e))}},duration:{type:Number,default:1500},mask:{type:Boolean,default:!1},visible:{type:Boolean,default:!0}},Ct={title:{type:String,default:""},icon:{type:String,default:"loading"},duration:{type:Number,default:1e8},mask:{type:Boolean,default:!1},visible:{type:Boolean,default:!0}},kt={itemList:{type:Array,required:!0,validator(e,t){if(!e.length)return"parameter.itemList should have at least 1 item"}},itemColor:{type:String,default:"#000000"},visible:{type:Boolean,default:!0}};var Bt=Object.freeze({__proto__:null,showModal:Tt,showToast:jt,showLoading:Ct,showActionSheet:kt});const At={type:Number,required:!0},xt={index:At,text:{type:String},iconPath:{type:String},selectedIconPath:{type:String}},wt={color:{type:String},selectedColor:{type:String},backgroundColor:{type:String},borderStyle:{type:String,validator(e,t){e&&(t.borderStyle="black"===e?"black":"white")}}},Et={animation:{type:Boolean,default:!1}},It={animation:{type:Boolean,default:!1}},qt={index:At},Nt={index:At},Pt={index:At},Mt={index:At,text:{type:String,required:!0,validator(e,t){(function(e=""){return(""+e).replace(/[^\x00-\xff]/g,"**").length})(e)>=4&&(t.text="...")}}};var Dt=Object.freeze({__proto__:null,setTabBarItem:xt,setTabBarStyle:wt,hideTabBar:Et,showTabBar:It,hideTabBarRedDot:qt,showTabBarRedDot:Nt,removeTabBarBadge:Pt,setTabBarBadge:Mt});const Lt=Object.create(null),zt=($t={"./base/base64.js":N,"./base/can-i-use.js":M,"./base/event-bus.js":U,"./base/interceptor.js":V,"./base/upx2px.js":H,"./context/canvas.js":Z,"./context/context.js":ae,"./device/make-phone-call.js":ce,"./device/set-clipboard-data.js":ue,"./file/open-document.js":de,"./location/choose-location.js":fe,"./location/get-location.js":he,"./location/open-location.js":be,"./media/choose-image.js":Oe,"./media/choose-video.js":Ce,"./media/get-image-info.js":Ie,"./media/preview-image.js":Ne,"./network/download-file.js":Me,"./network/request.js":Fe,"./network/socket.js":We,"./network/upload-file.js":Ke,"./plugin/get-provider.js":Qe,"./route/route.js":ct,"./storage/storage.js":gt,"./ui/load-font-face.js":ht,"./ui/navigation-bar.js":St,"./ui/page-scroll-to.js":Ot,"./ui/popup.js":Bt,"./ui/tab-bar.js":Dt},(Ut=function(e){return $t[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}).keys=function(){return Object.keys($t)},Ut);var $t,Ut;function Ft(e,t,r){const n=t[e],a=!s(r,e);let c=r[e];if(function(e,t){if(!Array.isArray(t))return Ht(t,e)?0:-1;for(let r=0,n=t.length;r-1&&a&&!s(n,"default")&&(c=!1),void 0===c&&s(n,"default")){const t=n.default;c=i(t)?t():t,r[e]=c}return function(e,t,r,n,a){if(e.required&&n)return`Missing required parameter \`${t}\``;if(null==r&&!e.required){const t=e.validator;return t?t(r,a):void 0}let i=e.type,c=!i||!0===i;const s=[];if(i){Array.isArray(i)||(i=[i]);for(let e=0;e"boolean"===e.toLowerCase())}(a,i)&&(n+=` with value ${c}`);n+=`, got ${i} `,Kt(i)&&(n+=`with value ${s}.`);return n}(t,r,s);const u=e.validator;if(u)return u(r,a)}(n,e,c,a,r)}zt.keys().forEach((function(e){Object.assign(Lt,zt(e))}));const Rt=/^(String|Number|Boolean|Function|Symbol)$/;function Vt(e,t){let r;const n=Gt(t);if(Rt.test(n)){const o=typeof e;r=o===n.toLowerCase(),r||"object"!==o||(r=e instanceof t)}else r="Object"===n?c(e):"Array"===n?Array.isArray(e):e instanceof t;return{valid:r,expectedType:n}}function Gt(e){const t=e&&e.toString().match(/^\s*function (\w+)/);return t?t[1]:""}function Ht(e,t){return Gt(e)===Gt(t)}function Wt(e,t){return"String"===t?`"${e}"`:"Number"===t?`${Number(e)}`:`${e}`}const Jt=["string","number","boolean"];function Kt(e){return Jt.some(t=>e.toLowerCase()===t)}function Yt(e,t,r){const n=`${t}:fail ${e}`;if(console.error(n),-1===r)throw new Error(n);return"number"==typeof r&&rr(r,{errMsg:n}),!1}const Xt=[{name:"callback",type:Function,required:!0}];function Qt(e,t,r){let n=Lt[e];if(!n&&w(e)&&(n=Xt),n){if(Array.isArray(n)&&Array.isArray(t)){const e=Object.create(null),r=Object.create(null),o=t.length;n.forEach((n,a)=>{e[n.name]=n,o>a&&(r[n.name]=t[a])}),n=e,t=r}if(i(n.beforeValidate)){const o=n.beforeValidate(t);if(o)return Yt(o,e,r)}const o=Object.keys(n);for(let a=0;a-1&&(r=t.errMsg.substr(n)),t.errMsg=e+":fail"+r}const r=t.errMsg;0===r.indexOf(e+":ok")?(i(m)&&m(t),l&&o(t),i(b)&&b(t)):0===r.indexOf(e+":cancel")?(t.errMsg=t.errMsg.replace(e+":cancel",e+":fail cancel"),f&&a(t),i(_)&&_(t),g&&s(t),i(O)&&O(t)):0===r.indexOf(e+":fail")&&(i(v)&&v(t),f&&a(t),i(S)&&S(t)),y&&u(t),i(T)&&T(t)}},{params:t,callbackId:j}}(e,t,r);return c(n)&&!Qt(e,n,o)?{params:n,callbackId:!1}:{params:n,callbackId:o}}function rr(e,t){if("number"==typeof e){const r=er[e];if(r)return r.keepAlive||delete er[e],r.callback(t)}return t}function nr(e,t,r={}){return i(t)?(function(e,t){const r=Lt[e];r&&i(r.beforeSuccess)&&(t.beforeSuccess=r.beforeSuccess)}(e,r),function(...n){if(x(e)){if(Qt(e,n,-1))return t.apply(null,n)}else if(w(e)){if(Qt(e,n,-1))return t(function(e,t){const r=Zt++,n="api."+e+"."+r;return er[r]={name:n,keepAlive:!0,callback:function(e){t(e)}},r}(e,n[0]))}else{let o={};n.length&&(o=n[0]);const{params:a,callbackId:s}=tr(e,o,r);if(!1!==s){let r;return r=i(a)?t(s):t(a,s),r&&!function(e){return-1!==B.indexOf(e)}(e)&&(r=rr(s,r),c(r)&&(r.errMsg=r.errMsg||e+":ok")),r}}}):t}var or,ar=(function(e,t){!function(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(256),n=0;n>2],a+=e[(3&n[r])<<4|n[r+1]>>4],a+=e[(15&n[r+1])<<2|n[r+2]>>6],a+=e[63&n[r+2]];return o%3==2?a=a.substring(0,a.length-1)+"=":o%3==1&&(a=a.substring(0,a.length-2)+"=="),a},t.decode=function(e){var t,n,o,a,i,c=.75*e.length,s=e.length,u=0;"="===e[e.length-1]&&(c--,"="===e[e.length-2]&&c--);var l=new ArrayBuffer(c),d=new Uint8Array(l);for(t=0;t>4,d[u++]=(15&o)<<4|a>>2,d[u++]=(3&a)<<6|63&i;return l}}()}(or={exports:{}},or.exports),or.exports),ir=ar.encode,cr=ar.decode;var sr={};const ur={promiseInterceptor:j};let lr=!1,dr=0,pr=0;var fr=n("@app-module/system.router");function gr(e){return e.substr(0,e.lastIndexOf("/"))}var yr=n("@app-module/system.router");var hr=n("@app-module/system.router");var mr=Object.freeze({__proto__:null,navigateBack:function({delta:e}){return fr.back(),{errMsg:"navigateBack:ok"}},navigateTo:function({url:e}){const t=e.split("?"),r=t[0],n=l(t[1]||"");return yr.push({uri:gr(r),params:n}),{errMsg:"navigateTo:ok"}},redirectTo:function({url:e}){const t=e.split("?"),r=t[0],n=l(t[1]||"");return hr.replace({uri:gr(r),params:n}),{errMsg:"redirectTo:ok"}}});function br(e,...t){return mr[e].apply(null,t)}function vr(e,t){return UniServiceJSBridge.on("api."+e,t)}const Sr=["canplay","play","pause","stop","ended","timeUpdate","error","waiting","seeking","seeked"],_r=[{name:"src",cache:!0},{name:"startTime",default:0,cache:!0},{name:"autoplay",default:!1,cache:!0},{name:"loop",default:!1,cache:!0},{name:"obeyMuteSwitch",default:!0,readonly:!0,cache:!0},{name:"duration",readonly:!0},{name:"currentTime",readonly:!0},{name:"paused",readonly:!0},{name:"buffered",readonly:!0},{name:"volume"}];class Or{constructor(e){this.id=e,this._callbacks={},this._options={},Sr.forEach(e=>{this._callbacks[e.toLowerCase()]=[]}),_r.forEach(e=>{const t=e.name,r={get(){const r=e.cache?this._options:br("getAudioState",{audioId:this.id}),n=t in r?r[t]:e.default;return"number"==typeof n&&"volume"!==t?n/1e3:n}};e.readonly||(r.set=function(e){this._options[t]=e,br("setAudioState",Object.assign({},this._options,{audioId:this.id}))}),Object.defineProperty(this,t,r)})}play(){this._operate("play")}pause(){this._operate("pause")}stop(){this._operate("stop")}seek(e){this._operate("seek",{currentTime:1e3*e})}destroy(){clearInterval(this.__timing),br("destroyAudioInstance",{audioId:this.id}),delete jr[this.id]}_operate(e,t){br("operateAudio",Object.assign({},t,{audioId:this.id,operationType:e}))}}function Tr(e,t,r,n){e._callbacks[t].forEach(e=>{"function"==typeof e&&e("error"===t?{errMsg:r,errCode:n}:{})})}Sr.forEach(e=>{const t=e[0].toUpperCase()+e.substr(1);e=e.toLowerCase(),Or.prototype[`on${t}`]=function(t){this._callbacks[e].push(t)},Or.prototype[`off${t}`]=function(t){const r=this._callbacks[e],n=r.indexOf(t);n>=0&&r.splice(n,1)}}),vr("onAudioStateChange",({state:e,audioId:t,errMsg:r,errCode:n})=>{const o=jr[t];if(o)if(Tr(o,e,r,n),"play"===e){const e=o.currentTime;o.__timing=setInterval(()=>{o.currentTime!==e&&Tr(o,"timeupdate")},200)}else"pause"!==e&&"stop"!==e&&"error"!==e||clearInterval(o.__timing)});const jr=Object.create(null);const Cr=["canplay","play","pause","stop","ended","timeUpdate","prev","next","error","waiting"],kr={};Cr.forEach(e=>{kr[e]=[]});const Br=[{name:"duration",readonly:!0},{name:"currentTime",readonly:!0},{name:"paused",readonly:!0},{name:"src",cache:!0},{name:"startTime",default:0,cache:!0},{name:"buffered",readonly:!0},{name:"title",cache:!0},{name:"epname",cache:!0},{name:"singer",cache:!0},{name:"coverImgUrl",cache:!0},{name:"webUrl",cache:!0},{name:"protocol",readonly:!0,default:"http"}];class Ar{constructor(){this._options={},vr("onBackgroundAudioStateChange",({state:e,errMsg:t,errCode:r})=>{kr[e].forEach(n=>{"function"==typeof n&&n("error"===e?{errMsg:t,errCode:r}:{})})}),Br.forEach(e=>{const t=e.name,r={get(){const r=e.cache?this._options:br("getBackgroundAudioState");return t in r?r[t]:e.default}};e.readonly||(r.set=function(e){this._options[t]=e,br("setBackgroundAudioState",Object.assign({},this._options,{audioId:this.id}))}),Object.defineProperty(this,t,r)})}play(){this._operate("play")}pause(){this._operate("pause")}stop(){this._operate("stop")}seek(e){this._operate("seek",{currentTime:e})}_operate(e,t){br("operateBackgroundAudio",Object.assign({},t,{operationType:e}))}}let xr;Cr.forEach(e=>{const t=e[0].toUpperCase()+e.substr(1);Ar.prototype[`on${t}`]=function(t){kr[e].push(t)}});var wr={...Object.freeze({__proto__:null,base64ToArrayBuffer:function(e){return cr(e)},arrayBufferToBase64:function(e){return ir(e)},canIUse:function(e){return!s(sr,e)||sr[e]},interceptors:ur,addInterceptor:function(e,t){"string"==typeof e&&c(t)?h(y[e]||(y[e]={}),t):c(e)&&h(g,e)},removeInterceptor:function(e,t){"string"==typeof e?c(t)?m(y[e],t):delete y[e]:c(e)&&m(g,e)},upx2px:function(e,t){if(0===dr&&function(){const{platform:e,pixelRatio:t,windowWidth:r}=uni.getSystemInfoSync();dr=r,pr=t,lr="ios"===e}(),0===(e=Number(e)))return 0;let r=e/750*(t||dr);return r<0&&(r=-r),r=Math.floor(r+1e-4),0===r?1!==pr&&lr?.5:1:e<0?-r:r},createInnerAudioContext:function(){const{audioId:e}=br("createAudioInstance"),t=new Or(e);return jr[e]=t,t},getBackgroundAudioManager:function(){return xr||(xr=new Ar)}}),...mr};const Er=Object.create(null);let Ir;t.forEach(e=>{wr[e]?Er[e]=function(e,t){return E(e)?function(r={},...n){return i(r.success)||i(r.fail)||i(r.complete)?O(e,T(e,t,r,...n)):O(e,new Promise((o,a)=>{T(e,t,Object.assign({},r,{success:o,fail:a}),...n),Promise.prototype.finally||(Promise.prototype.finally=function(e){const t=this.constructor;return this.then(r=>t.resolve(e()).then(()=>r),r=>t.resolve(e()).then(()=>{throw r}))})}).then(e=>[null,e]).catch(e=>[e]))}:t}(e,nr(e,wr[e])):Er[e]=function(e){return function(t){console.error("API `"+e+"` is not yet implemented")}}(e)});const qr=[],Nr=[],Pr=[];function Mr(e){e&&e.store&&(Ir=e.store)}Mr.prototype.$mount=function(){},Mr.config={},Mr.use=function(e){Nr.push(e)},Mr.mixin=function(e){qr.push(e)},Mr.component=function(e,t){Pr.push({id:e,definition:t})},(Object.getPrototypeOf(global)||global).__VuePlugin={install(e,t){qr.forEach(t=>{e.mixin(t)}),Nr.forEach(t=>{e.use(t)}),Pr.forEach(({id:t,definition:r})=>{e.component(t,r)}),Object.keys(Mr.prototype).forEach(t=>{"$mount"!==t&&(e.prototype[t]=Mr.prototype[t])}),Ir&&(e.prototype.$store=Ir)}};const Dr={globalData:{}};global.UniServiceJSBridge.invokeCallbackHandler=rr;var Lr={uni:Er,Vue:Mr,getApp:function({allowDefault:t=!1}={}){return e.$def?function(e){if(e.__$processed)return e;const t=e.methods;return t&&(Object.keys(t).forEach(r=>{e[r]=t[r]}),delete e.methods),Object.keys(Dr).forEach(t=>{"globalData"!==t&&(e[t]=Dr[t])}),e.globalData||(e.globalData={}),Object.assign(e.globalData,Dr.globalData),e.__$processed=!0,e}(e.$def):t?Dr:void 0},getCurrentPages:function(){return[]}};const zr=Object.getPrototypeOf(global)||global;dsl.onDefineApp(t=>{const r="function"==typeof t.onLaunch,n="function"==typeof t.onShow;(r||n)&&(e._events["applc:onCreate"]||(e._events["applc:onCreate"]=[])).push(()=>{r&&t.onLaunch(),n&&t.onShow()}),zr.__uniRoutes=function({pages:e}){const t=[];return Object.keys(e).forEach(r=>{const n=e[r];t.push({path:"/"+r+"/"+n.component,meta:{}})}),t}(t.manifest.router)}),Object.assign(zr,Lr)}()})); +dsl.onInitPage((function({$app_require$:e,Vue:u}){!function(){"use strict";"undefined"!=typeof __VuePlugin&&u.use(__VuePlugin)}()})); diff --git a/packages/uni-quickapp/dist/vue.prod.js b/packages/uni-quickapp/dist/vue.prod.js new file mode 100644 index 0000000000000000000000000000000000000000..2efd6503a2026723fe56733052ef5970f3992d3f --- /dev/null +++ b/packages/uni-quickapp/dist/vue.prod.js @@ -0,0 +1,4 @@ +var dsl=function(){"use strict";const e={initApp:"quickapp.app.initApp",initPage:"quickapp.page.initPage",destroyPage:"quickapp.page.destroyPage",fireEvent:"quickapp.page.fireEvent",onShow:"quickapp.page.onShow",onHide:"quickapp.page.onHide",onBackPress:"quickapp.page.onBackPress",onMenuPress:"quickapp.page.onMenuPress",onOrientationChange:"quickapp.page.onOrientationChange",onConfigurationChanged:"quickapp.page.onConfigurationChanged",onRefresh:"quickapp.page.onRefresh",callbackDone:"quickapp.page.callbackDone"},t=/^@(app)-application\//,n=/^@(app)-component\//,r=/^@(app)-module\//;function o(e){return e.replace(t,"").replace(n,"").replace(r,"")}var i={};function a(e,t,n){return"function"==typeof global.compileAndRunScript?function(e,t,n){let r="(function (";const o=[],i=[];for(const t in e)o.push(t),i.push(e[t]);for(let e=0;e=0&&Math.floor(t)===t&&isFinite(e)}function d(e){return i(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function v(e){return null==e?"":Array.isArray(e)||p(e)&&e.toString===l?JSON.stringify(e,null,2):String(e)}function h(e){var t=parseFloat(e);return isNaN(t)?e:t}function y(e,t){for(var n=Object.create(null),r=e.split(","),o=0;o-1)return e.splice(n,1)}}var _=Object.prototype.hasOwnProperty;function b(e,t){return _.call(e,t)}function $(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var A=/-(\w)/g,k=$(function(e){return e.replace(A,function(e,t){return t?t.toUpperCase():""})}),w=$(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),O=/\B([A-Z])/g,x=$(function(e){return e.replace(O,"-$1").toLowerCase()});var C=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function S(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function j(e,t){for(var n in t)e[n]=t[n];return e}function E(e,t,n){}var P=function(e,t,n){return!1},I=function(e){return e};function D(e,t){if(e===t)return!0;var n=c(e),r=c(t);if(!n||!r)return!n&&!r&&String(e)===String(t);try{var o=Array.isArray(e),i=Array.isArray(t);if(o&&i)return e.length===t.length&&e.every(function(e,n){return D(e,t[n])});if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(o||i)return!1;var a=Object.keys(e),s=Object.keys(t);return a.length===s.length&&a.every(function(n){return D(e[n],t[n])})}catch(e){return!1}}function F(e,t){for(var n=0;n0,X=W&&W.indexOf("edge/")>0,G=(W&&W.indexOf("android"),W&&/iphone|ipad|ipod|ios/.test(W)||"ios"===K),Z=(W&&/chrome\/\d+/.test(W),W&&/phantomjs/.test(W),W&&W.match(/firefox\/(\d+)/),{}.watch);if(U)try{var Y={};Object.defineProperty(Y,"passive",{get:function(){}}),window.addEventListener("test-passive",null,Y)}catch(e){}var ee=function(){return void 0===B&&(B=!U&&!z&&void 0!==u&&(u.process&&"server"===u.process.env.VUE_ENV)),B},te=U&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ne(e){return"function"==typeof e&&/native code/.test(e.toString())}var re,oe="undefined"!=typeof Symbol&&ne(Symbol)&&"undefined"!=typeof Reflect&&ne(Reflect.ownKeys);re="undefined"!=typeof Set&&ne(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ie=E,ae=0,se=function(){"undefined"!=typeof SharedObject?this.id=SharedObject.uid++:this.id=ae++,this.subs=[]};function ce(e){se.SharedObject.targetStack.push(e),se.SharedObject.target=e}function ue(){se.SharedObject.targetStack.pop(),se.SharedObject.target=se.SharedObject.targetStack[se.SharedObject.targetStack.length-1]}se.prototype.addSub=function(e){this.subs.push(e)},se.prototype.removeSub=function(e){g(this.subs,e)},se.prototype.depend=function(){se.SharedObject.target&&se.SharedObject.target.addDep(this)},se.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t-1)if(i&&!b(o,"default"))a=!1;else if(""===a||a===x(e)){var c=Me(String,o.type);(c<0||s0&&(it((u=e(u,(n||"")+"_"+c))[0])&&it(p)&&(r[l]=de(p.text+u[0].text),u.shift()),r.push.apply(r,u)):s(u)?it(p)?r[l]=de(p.text+u):""!==u&&r.push(de(u)):it(u)&&it(p)?r[l]=de(p.text+u.text):(a(t._isVList)&&i(u.tag)&&o(u.key)&&i(n)&&(u.key="__vlist"+n+"_"+c+"__"),r.push(u)));return r}(e):void 0}function it(e){return i(e)&&i(e.text)&&!1===e.isComment}function at(e,t){if(e){for(var n=Object.create(null),r=oe?Reflect.ownKeys(e):Object.keys(e),o=0;o0,a=e?!!e.$stable:!i,s=e&&e.$key;if(e){if(e._normalized)return e._normalized;if(a&&n&&n!==r&&s===n.$key&&!i&&!n.$hasNormal)return n;for(var c in o={},e)e[c]&&"$"!==c[0]&&(o[c]=lt(t,c,e[c]))}else o={};for(var u in t)u in o||(o[u]=pt(t,u));return e&&Object.isExtensible(e)&&(e._normalized=o),R(o,"$stable",a),R(o,"$key",s),R(o,"$hasNormal",i),o}function lt(e,t,n){var r=function(){var e=arguments.length?n.apply(null,arguments):n({});return(e=e&&"object"==typeof e&&!Array.isArray(e)?[e]:ot(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:r,enumerable:!0,configurable:!0}),r}function pt(e,t){return function(){return e[t]}}function ft(e,t){var n,r,o,a,s;if(Array.isArray(e)||"string"==typeof e)for(n=new Array(e.length),r=0,o=e.length;rt.createEvent("Event").timeStamp&&(en=function(){return tn.now()})}function nn(){var e,t;for(en(),Zt=!0,Jt.sort(function(e,t){return e.id-t.id}),Yt=0;YtYt&&Jt[n].id>e.id;)n--;Jt.splice(n+1,0,e)}else Jt.push(e);Gt||(Gt=!0,Qe(nn))}}(this)},on.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||c(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Ne(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},on.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},on.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},on.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||g(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var an={enumerable:!0,configurable:!0,get:E,set:E};function sn(e,t,n){an.get=function(){return this[t][n]},an.set=function(e){this[t][n]=e},Object.defineProperty(e,n,an)}function cn(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},o=e.$options._propKeys=[];e.$parent&&_e(!1);var i=function(i){o.push(i);var a=De(i,t,n,e);Ae(r,i,a),i in e||sn(e,"_props",i)};for(var a in t)i(a);_e(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?E:C(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;p(t=e._data="function"==typeof t?function(e,t){ce();try{return e.call(t,t)}catch(e){return Ne(e,t,"data()"),{}}finally{ue()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,o=(e.$options.methods,n.length);for(;o--;){var i=n[o];r&&b(r,i)||(a=void 0,36!==(a=(i+"").charCodeAt(0))&&95!==a&&sn(e,"_data",i))}var a;$e(t,!0)}(e):$e(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=ee();for(var o in t){var i=t[o],a="function"==typeof i?i:i.get;r||(n[o]=new on(e,a||E,E,un)),o in e||ln(e,o,i)}}(e,t.computed),t.watch&&t.watch!==Z&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var o=0;o-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(n=e,"[object RegExp]"===l.call(n)&&e.test(t));var n}function bn(e,t){var n=e.cache,r=e.keys,o=e._vnode;for(var i in n){var a=n[i];if(a){var s=gn(a.componentOptions);s&&!t(s)&&$n(n,i,r,o)}}}function $n(e,t,n,r){var o=e[t];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),e[t]=null,g(n,t)}!function(e){e.prototype._init=function(e){var t=this;t._uid=vn++,t._isVue=!0,e&&e._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(t,e):t.$options=Pe(hn(t.constructor),e||{},t),t._renderProxy=t,t._self=t,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(t),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&Ht(e,t)}(t),function(e){e._vnode=null,e._staticTrees=null;var t=e.$options,n=e.$vnode=t._parentVnode,o=n&&n.context;e.$slots=st(t._renderChildren,o),e.$scopedSlots=r,e._c=function(t,n,r,o){return Mt(e,t,n,r,o,!1)},e.$createElement=function(t,n,r,o){return Mt(e,t,n,r,o,!0)};var i=n&&n.data;Ae(e,"$attrs",i&&i.attrs||r,null,!0),Ae(e,"$listeners",t._parentListeners||r,null,!0)}(t),Wt(t,"beforeCreate"),"mp-toutiao"!==t.mpHost&&function(e){var t=at(e.$options.inject,e);t&&(_e(!1),Object.keys(t).forEach(function(n){Ae(e,n,t[n])}),_e(!0))}(t),cn(t),"mp-toutiao"!==t.mpHost&&function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(t),"mp-toutiao"!==t.mpHost&&Wt(t,"created"),t.$options.el&&t.$mount(t.$options.el)}}(yn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=ke,e.prototype.$delete=we,e.prototype.$watch=function(e,t,n){if(p(t))return dn(this,e,t,n);(n=n||{}).user=!0;var r=new on(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){Ne(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(yn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var o=0,i=e.length;o1?S(t):t;for(var n=S(arguments,1),r='event handler for "'+e+'"',o=0,i=t.length;oparseInt(this.max)&&$n(s,c[0],c,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return L}};Object.defineProperty(e,"config",t),e.util={warn:ie,extend:j,mergeOptions:Pe,defineReactive:Ae},e.set=ke,e.delete=we,e.nextTick=Qe,e.observable=function(e){return $e(e),e},e.options=Object.create(null),N.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,j(e.options.components,kn),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=S(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=Pe(this.options,e),this}}(e),mn(e),function(e){N.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&p(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(yn),Object.defineProperty(yn.prototype,"$isServer",{get:ee}),Object.defineProperty(yn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(yn,"FunctionalRenderContext",{value:Ct}),yn.version="2.6.11";function wn(e,t,r){n.setElementAttr(e,t,r)}var On=Object.freeze({namespaceMap:{},createElement:function(e){var r=t.createElement(e);return n.bindElementMethods(r),r},createElementNS:function(e,n){return t.createElement(e+":"+n)},createTextNode:function(e){return t.createTextNode(e)},createComment:function(e){return t.createComment(e)},insertBefore:function(e,t,n){e.insertBefore(t,n)},removeChild:function(e,t){e.removeChild(t)},appendChild:function(e,t){e.appendChild(t)},parentNode:function(e){return e.parentNode},nextSibling:function(e){return e.nextSibling},tagName:function(e){return e.tagName},setTextContent:function(e,t){n.setElementAttr(e.parentNode,"value",t)},setAttribute:wn}),xn={create:function(e,t){Cn(t)},update:function(e,t){e.data.ref!==t.data.ref&&(Cn(e,!0),Cn(t))},destroy:function(e){Cn(e,!0)}};function Cn(e,t){var n=e.data.ref;if(i(n)){var r=e.context,o=e.componentInstance||e.elm,a=r.$refs;t?Array.isArray(a[n])?g(a[n],o):a[n]===o&&(a[n]=void 0):e.data.refInFor?Array.isArray(a[n])?a[n].indexOf(o)<0&&a[n].push(o):a[n]=[o]:a[n]=o}}y("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),y("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0);var Sn=y("text,number,password,search,email,tel,url"),jn=new le("",{},[]),En=["create","activate","update","remove","destroy"];function Pn(e,t){return e.key===t.key&&(e.tag===t.tag&&e.isComment===t.isComment&&i(e.data)===i(t.data)&&function(e,t){if("input"!==e.tag)return!0;var n,r=i(n=e.data)&&i(n=n.attrs)&&n.type,o=i(n=t.data)&&i(n=n.attrs)&&n.type;return r===o||Sn(r)&&Sn(o)}(e,t)||a(e.isAsyncPlaceholder)&&e.asyncFactory===t.asyncFactory&&o(t.asyncFactory.error))}function In(e,t,n){var r,o,a={};for(r=t;r<=n;++r)i(o=e[r].key)&&(a[o]=r);return a}var Dn={create:Fn,update:Fn,destroy:function(e){Fn(e,jn)}};function Fn(e,t){(e.data.directives||t.data.directives)&&function(e,t){var n,r,o,i=e===jn,a=t===jn,s=Mn(e.data.directives,e.context),c=Mn(t.data.directives,t.context),u=[],l=[];for(n in c)r=s[n],o=c[n],r?(o.oldValue=r.value,o.oldArg=r.arg,qn(o,"update",t,e),o.def&&o.def.componentUpdated&&l.push(o)):(qn(o,"bind",t,e),o.def&&o.def.inserted&&u.push(o));if(u.length){var p=function(){for(var n=0;n1,P=t.context.$options.style||{},I=P[$],D=P["@TRANSITION"]&&P["@TRANSITION"][k]||{},F=function(e,t,n,r,o,i){var a={},s=t[n],c=t[r],u=t[o];if(s)for(var l in s)a[l]=e.style[l];if(u)for(var p in u)0!==p.indexOf("transition")&&(a[p]=u[p]);c&&j(a,c);return a}(n,P,$,A,k,t.context),M=Object.keys(F).length>0,N=n._enterCb=T(function(){N.cancelled?C&&C(n):x&&x(n),n._enterCb=null});if(setTimeout(function(){var e=n.parentNode,r=e&&e._pending&&e._pending[t.key];(r&&r.context===t.context&&r.tag===t.tag&&r.elm._leaveCb&&r.elm._leaveCb(),O&&O(n,N),M)?t.context.$requireQuickappModule("animation").transition(n.ref,{styles:F,duration:D.duration||0,delay:D.delay||0,timingFunction:D.timingFunction||"linear"},S?E:N):S||N()},16),w&&w(n),I)for(var q in I)n.setStyle(q,I[q]);M||S||N()}}}function ur(e,t){if(!o(e.data.domProps)||!o(t.data.domProps)){var n,r,a=t.elm,s=e.data.domProps||{},c=t.data.domProps||{};for(n in i(c.__ob__)&&(c=t.data.domProps=j({},c)),s)o(c[n])&&wn(a,n,"");for(n in c){if(r=c[n],"value"===n)wn(a,n,o(r)?"":String(r));else wn(a,n,r)}}}var lr=function(e){var t,n,r={},c=e.modules,u=e.nodeOps;for(t=0;tv?_(e,o(n[m+1])?null:n[m+1].elm,n,d,m,r):d>m&&$(t,f,v)}(f,y,m,n,l):i(m)?(i(e.text)&&u.setTextContent(f,""),_(f,null,m,0,m.length-1,n)):i(y)?$(y,0,y.length-1):i(e.text)&&u.setTextContent(f,""):e.text!==t.text&&u.setTextContent(f,t.text),i(v)&&i(d=v.hook)&&i(d=d.postpatch)&&d(e,t)}}}function O(e,t,n){if(a(n)&&i(e.parent))e.parent.data.pendingInsert=t;else for(var r=0;r1,d=e.context.$options.style||{},v=d[o],h=d[i]||d[a],y=d["@TRANSITION"]&&d["@TRANSITION"][a]||{},m=n._leaveCb=T(function(){n.parentNode&&n.parentNode._pending&&(n.parentNode._pending[e.key]=null),m.cancelled?l&&l(n):(t(),u&&u(n)),n._leaveCb=null});p?p(g):g();function g(){var t=e.context.$requireQuickappModule("animation");function r(){t.transition(n.ref,{styles:h,duration:y.duration||0,delay:y.delay||0,timingFunction:y.timingFunction||"linear"},f?E:m)}m.cancelled||(e.data.show||((n.parentNode._pending||(n.parentNode._pending={}))[e.key]=e),s&&s(n),v?t.transition(n.ref,{styles:v},r):r(),c&&c(n,m),h||f||m())}}}].concat(Ln),LONG_LIST_THRESHOLD:10}),pr={inserted:function(e,t,n,r){"select"===n.tag?(r.elm&&!r.elm._vOptions?tt(n,"postpatch",function(){pr.componentUpdated(e,t,n)}):fr(e,t,n.context),e._vOptions=[].map.call(e.options,vr)):("textarea"===n.tag||Jn(e.attr.type))&&(e._vModifiers=t.modifiers,t.modifiers.lazy||e.addEventListener("change",hr))},componentUpdated:function(e,t,n){if("select"===n.tag){fr(e,t,n.context);var r=e._vOptions,o=e._vOptions=[].map.call(e.options,vr);if(o.some(function(e,t){return!D(e,r[t])}))(e.multiple?t.value.some(function(e){return dr(e,o)}):t.value!==t.oldValue&&dr(t.value,o))&&yr(e,"change")}}};function fr(e,t,n){!function(e,t,n){var r,o,i=t.value,a=e.multiple;if(a&&!Array.isArray(i))return;for(var s=0,c=e.options.length;s-1,o.selected!==r&&(o.selected=r);else if(D(vr(o),i))return void(e.selectedIndex!==s&&(e.selectedIndex=s));a||(e.selectedIndex=-1)}(e,t)}function dr(e,t){return t.every(function(t){return!D(t,e)})}function vr(e){return"_value"in e?e._value:e.value}function hr(e){e.target.composing=!1,yr(e.target,"input")}function yr(e,n){var r=t.createEvent(n);e.dispatchEvent(r)}var mr={model:pr,show:{bind:function(e,t,r){var o=t.value,i=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display||"";n.setElementStyle(e,"display",o?i:"none")},update:function(e,t,r){var o=t.value;o!==t.oldValue&&n.setElementStyle(e,"display",o?e.__vOriginalDisplay:"none")},unbind:function(e,t,r,o,i){i||n.setElementStyle(e,"display",e.__vOriginalDisplay)}}};j(yn.options.directives,mr),j(yn.options.components,{});var gr=["public","protected","private"];yn.config.mustUseProp=function(){},yn.config.isReservedTag=Kn,yn.config.isRuntimeComponent=Wn,yn.config.isUnknownElement=function(){},yn.prototype.__patch__=lr,yn.prototype.$mount=function(e,t){var n=this.$options.type;void 0===n&&(n="component");var r=function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=fe),Wt(e,"beforeMount"),r=function(){e._update(e._render(),n)},new on(e,r,E,{before:function(){e._isMounted&&!e._isDestroyed&&Wt(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(Wt(e,"onServiceCreated"),Wt(e,"onServiceAttached"),e._isMounted=!0,Wt(e,"mounted")),e}(this,e&&function(e,t){if("object"==typeof e&&null!==e)return e;var n=t.body,r=t.createElement("div");return n.appendChild(r),r}.bind(this)(e,this.$document),t);return"page"===n&&(this._connectVm2Page&&this._connectVm2Page(),this._registerPageLifecycle&&this._registerPageLifecycle()),r},yn.prototype._initExternalData=function(){var e=yn.config.externalData;if("page"===this.$options.type&&e)if(this.$options._descriptor){var t=this._page.intent&&this._page.intent.fromExternal;for(var n in this._page.intent&&void 0!==this._page.intent.fromExternal||(t=!0),global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 页面VM中声明的权限定义:"+JSON.stringify(this.$options._descriptor)),this.$options.$props&&!function(e){for(var t in e)return!1;return!0}(e)&&console.warn("### App Framework ### 页面VM中不支持props,推荐在public或protected中声明参数"),e){var r=this.$options._descriptor[n];if(r){var o=t&&gr.indexOf(r.access)>0,i=!t&&gr.indexOf(r.access)>1;o||i?console.warn("### App Framework ### 传递外部数据"+n+"在VM中声明为"+r.access+",放弃更新"):(global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 传递外部数据"+n+",原值为:"+JSON.stringify(this._data[n])),global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 传递外部数据"+n+",新值为:"+JSON.stringify(e[n])),this.$options.data[n]=e[n])}else global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 传递外部数据"+n+"在VM中未声明,放弃更新")}}else(function e(t){for(var n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];if("function"==typeof Object.assign)Object.assign.apply(Object,[t].concat(n));else{var o=n.shift();for(var i in o)t[i]=o[i];n.length&&e.apply(void 0,[t].concat(n))}return t})(this.$options.data,e)},yn.prototype._mergeAccess2Data=function(e){if("function"==typeof e.data&&(e.data=e.data()),e.data&&gr.some(function(t){return e[t]}))throw new Error("页面VM对象中的属性data不可与"+gr.join(",")+"同时存在,请使用private替换data名称");e.data||(e.data={},e._descriptor={},gr.forEach(function(t){var n=typeof e[t];if("object"===n)for(var r in e.data=Object.assign(e.data,e[t]),e[t])e._descriptor[r]={access:t};else"function"===n&&console.warn("页面VM对象中的属性"+t+"的值不能是函数,请使用对象")}))};var _r=yn.prototype._init;yn.prototype._init=function(e){var t=this.constructor.options;"page"===t.type&&(this._connectLifecycle&&this._connectLifecycle(t),this._mergeAccess2Data&&this._mergeAccess2Data(t)),_r.call(this,e)},yn.prototype._connectLifecycle=function(e){var t=this;e.mounted=e.mounted||[],e.mounted=Array.isArray(e.mounted)?e.mounted:[e.mounted],e.mounted.push(function(){t._ready=!0});e.created=e.created||[],e.created=Array.isArray(e.created)?e.created:[e.created],e.created.push(function(){t._initExternalData()}),e.created.unshift(function(){var e=t.$options.onInit;e&&"function"==typeof e&&e.call(t,t._page._meta.query)})},e.Vue=yn}}(l={exports:{}},l.exports),l.exports),d=(p=f)&&p.__esModule?p.default:p;const v={onShow:"onShow",onHide:"onHide",onBackPress:"onBackPress",onMenuPress:"onMenuPress",onDestroy:"onDestroy",onConfigurationChanged:"onConfigurationChanged",onOrientationChange:"onOrientationChange",onRefresh:"onRefresh"},h={};let y=null;let m,g=null;function _(e,t,n,r,o){const a=function(e,t){return i.quickapp.runtime.helper.getDocumentNodeByRef(e,t)}(e.doc,t);if(a){return function(e,t,n,r){if(!e)return;const o=i.quickapp.runtime.helper.createEvent(t);if(Object.assign(o,n),global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### fireEventWrap():事件(${t})的参数:${JSON.stringify(n)}, ${JSON.stringify(r)}`),r){const t=r.attr||{};for(const n in t)i.quickapp.runtime.helper.setElementAttr(e,n,t[n],!0);const n=r.style||{};for(const t in n)i.quickapp.runtime.helper.setElementStyle(e,t,n[t],!0)}return e.dispatchEvent(o)}(a,n,r,{attr:o})}return new Error(`fireEvent: 无效element索引 "${t}"`)}function b(e){g||(g=Promise.resolve().then(()=>{e.doc.listener.updateFinish(),g=null}))}function $(e,t,n,r){const s=e.id,c=e.doc.listener,u=c.addActions;c.addActions=((...t)=>{b(e),u.apply(c,t)});const l=e.doc,p=l.createElement("div");l.documentElement.appendChild(p);const f=h[s]={instanceId:s,document:l},g=f.Vue=function(e,t,n){const r=t.page,o=t.appRequireModule,a={setElementAttr(e,t,n){i.quickapp.runtime.helper.setElementAttr(e,t,n)},setElementStyle(e,t,n){"number"==typeof n&&(n+=""),i.quickapp.runtime.helper.setElementStyle(e,t,n)},bindElementMethods(e){i.quickapp.dock.bindComponentMethods(r,e)}},s={};d(s,r.doc,a);const c=s.Vue;global.Vue=!0;const u=h[e],l=/^quickapp:/i,p=c.config.isReservedTag||function(){return!1},f=c.config.isRuntimeComponent||function(){return!1};return c.config.externalData=n,c.config.isReservedTag=function(e){return f(e),p(e)||l.test(e)},c.config.parsePlatformTagName=function(e){return e.replace(l,"")},c.prototype.$instanceId=e,c.prototype.$document=u.document,c.prototype._connectVm2Page=function(){r.vm=this},Object.defineProperty(c.prototype,"$app",{get(){if(!this._isDestroyed)return r.app}}),Object.defineProperty(c.prototype,"$page",{get(){if(this._isDestroyed)return;const e=r.app;return Object.assign({setTitleBar:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 setTitleBar ----`),i.quickapp.runtime.helper.updatePageTitleBar(r.doc,e))},scrollTo:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 scrollTo ----`),i.quickapp.runtime.helper.scrollTo(r.doc,e))},scrollBy:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 scrollBy ----`),i.quickapp.runtime.helper.scrollBy(r.doc,e))},exitFullscreen:function(){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 exitFullscreen ----`),i.quickapp.runtime.helper.exitFullscreen(r.doc))},setStatusBar:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 setStatusBar ----`),i.quickapp.runtime.helper.updatePageStatusBar(r.doc,e))},finish:function(){r&&r.doc&&(null===y&&(y=i.quickapp.platform.requireModule(e,"system.page")),y.finishPage(r.id))}},r&&r._meta)}}),Object.defineProperties(c.prototype,{$valid:{get:()=>!!r&&r._valid,configurable:!1},$visible:{get:()=>!!r&&r._valid&&r._visible,configurable:!1},$destroyed:{get:()=>!!r&&r.vm&&r.vm._isDestroyed,configurable:!1}}),c.prototype._registerPageLifecycle=function(){Object.keys(v).forEach(e=>{this.$on(`xlc:${e}`,(...t)=>{let n=!1;const r=this.$options[e];if(!r||"function"!=typeof r)return;const o=Array.isArray(r)?r:[r];if(o&&o.length)for(let e=0;e{},$app_bootstrap$:()=>{},$app_define_wrap$:()=>{},$app_require$:t=>i.quickapp.platform.requireModule(e,o(t)),$app_evaluate$:i.quickapp.dock.makeEvaluateBuildScript(r)},r);let $;"function"==typeof m&&m(_),$="(function(global){"+($=t.toString())+"\n })(Object.create(this))";{const t=e.pageName?`${e.pageName}/${e.pageComponent}.js`:"";global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### bundleUrl----",t),a(_,$,t)}return e.doc.listener.createFinish(),f}function A(e,t,n,...r){let o=!1;return t.vm&&t.vm._ready?(t.vm.$emit(`xlc:${e}`,n,...r),o=t.vm._events[`xlc:${e}`].result,b(t),global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### ${e} (${t.id})----`)):global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### ${e} 页面(${t.id})创建失败, 无法响应事件---- `),o}return{init:function(t){i.quickapp=t,global.process=global.process||{},global.process.env={},t.subscribe(e.initApp,e=>(function(e,t){global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### 开始初始化App(${e.id})`);const n=t=>i.quickapp.platform.requireModule(e,o(t)),r=t=>{e.$def=t,"function"==typeof c&&c(t)},u=()=>{global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### 调用App(${e.name})生命周期---- onCreate`),e.$emit("applc:onCreate")};"function"==typeof s&&s({context:i,inst:e,instRequireModule:n});const l=i.quickapp.dock.makeEvaluateBuildScript(null);let p;p=`(function(global){"use strict"; ${p=t.toString()}; \n })(Object.create(this))`,global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 开始编译代码----"),a({$app_define$:r,$app_require$:n,$app_bootstrap$:u,$app_evaluate$:l},p,"app.js")})(...e)),t.subscribe(e.initPage,e=>$(...e)),t.subscribe(e.destroyPage,e=>{!function(e){e.vm&&(e.vm.$emit("xlc:onDestroy"),e.vm.$destroy())}(...e)}),t.subscribe(e.fireEvent,e=>{const t=_(...e);return b(e[0]),t}),t.subscribe(e.callbackDone,e=>{b(e[0])}),t.subscribe(e.onShow,e=>A(v.onShow,...e)),t.subscribe(e.onHide,e=>A(v.onHide,...e)),t.subscribe(e.onBackPress,e=>A(v.onBackPress,...e)),t.subscribe(e.onMenuPress,e=>(A(v.onMenuPress,...e),function(e){let t=!1;if(e.vm&&e.vm._ready){const n=e.vm._events,r=n&&n["xlc:onMenuPress"]&&n["xlc:onMenuPress"].handlers;r&&r.length&&(t=!0)}return t}(...e))),t.subscribe(e.onConfigurationChanged,e=>A(v.onConfigurationChanged,...e)),t.subscribe(e.onOrientationChange,e=>A(v.onOrientationChange,...e)),t.subscribe(e.onRefresh,e=>A(v.onRefresh,...e))},onInitApp:function(e){s=e},onDefineApp:function(e){c=e},onInitPage:function(e){m=e}}}(); +!function(){"use strict";class e{constructor(){this._events=Object.create(null)}on(e,t){const n=this;if(Array.isArray(e))for(let s=0,r=e.length;se);const n=r;!function(){"use strict";var t=["base64ToArrayBuffer","arrayBufferToBase64","addInterceptor","removeInterceptor","request","uploadFile","downloadFile","connectSocket","onSocketOpen","onSocketError","sendSocketMessage","onSocketMessage","closeSocket","onSocketClose","navigateTo","redirectTo","reLaunch","switchTab","navigateBack","setStorage","setStorageSync","getStorage","getStorageSync","getStorageInfo","getStorageInfoSync","removeStorage","removeStorageSync","clearStorage","clearStorageSync","getLocation","chooseLocation","openLocation","createMapContext","chooseImage","previewImage","getImageInfo","saveImageToPhotosAlbum","compressImage","getRecorderManager","getBackgroundAudioManager","createInnerAudioContext","chooseVideo","saveVideoToPhotosAlbum","createVideoContext","createCameraContext","createLivePlayerContext","createLivePusherContext","getSystemInfo","getSystemInfoSync","canIUse","onMemoryWarning","getNetworkType","onNetworkStatusChange","onAccelerometerChange","startAccelerometer","stopAccelerometer","onCompassChange","startCompass","stopCompass","onGyroscopeChange","startGyroscope","stopGyroscope","makePhoneCall","scanCode","setClipboardData","getClipboardData","setScreenBrightness","getScreenBrightness","setKeepScreenOn","onUserCaptureScreen","vibrateLong","vibrateShort","addPhoneContact","openBluetoothAdapter","startBluetoothDevicesDiscovery","onBluetoothDeviceFound","stopBluetoothDevicesDiscovery","onBluetoothAdapterStateChange","getConnectedBluetoothDevices","getBluetoothDevices","getBluetoothAdapterState","closeBluetoothAdapter","writeBLECharacteristicValue","readBLECharacteristicValue","onBLEConnectionStateChange","onBLECharacteristicValueChange","notifyBLECharacteristicValueChange","getBLEDeviceServices","getBLEDeviceCharacteristics","createBLEConnection","closeBLEConnection","onBeaconServiceChange","onBeaconUpdate","getBeacons","startBeaconDiscovery","stopBeaconDiscovery","checkIsSupportSoterAuthentication","checkIsSoterEnrolledInDevice","startSoterAuthentication","hideKeyboard","onKeyboardHeightChange","showToast","hideToast","showLoading","hideLoading","showModal","showActionSheet","setNavigationBarTitle","setNavigationBarColor","showNavigationBarLoading","hideNavigationBarLoading","setTabBarItem","setTabBarStyle","hideTabBar","showTabBar","setTabBarBadge","removeTabBarBadge","showTabBarRedDot","hideTabBarRedDot","onTabBarMidButtonTap","setBackgroundColor","setBackgroundTextStyle","createAnimation","pageScrollTo","onWindowResize","offWindowResize","loadFontFace","startPullDownRefresh","stopPullDownRefresh","createSelectorQuery","createIntersectionObserver","$emit","$on","$once","$off","saveFile","getSavedFileList","getSavedFileInfo","removeSavedFile","getFileInfo","openDocument","getFileSystemManager","createOffscreenCanvas","createCanvasContext","canvasToTempFilePath","canvasPutImageData","canvasGetImageData","getProvider","login","checkSession","getUserInfo","share","showShareMenu","hideShareMenu","requestPayment","subscribePush","unsubscribePush","onPush","offPush","requireNativePlugin","upx2px","restoreGlobal","getSubNVueById","getCurrentSubNVue","setPageMeta","createRewardedVideoAd"];let r=!1;try{const e={};Object.defineProperty(e,"passive",{get(){r=!0}}),window.addEventListener("test-passive",null,e)}catch(e){}const o=Object.prototype.toString,a=Object.prototype.hasOwnProperty;function i(e){return"function"==typeof e}function c(e){return"[object Object]"===o.call(e)}function s(e,t){return a.call(e,t)}const u=decodeURIComponent;function l(e){const t={};return(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach(e=>{const r=e.replace(/\+/g," ").split("="),n=u(r.shift()),o=r.length>0?u(r.join("=")):null;void 0===t[n]?t[n]=o:Array.isArray(t[n])?t[n].push(o):t[n]=[t[n],o]}),t):t}function d(e){return function(){try{return e.apply(e,arguments)}catch(e){console.error(e)}}}function p(e){return function(){try{return e.apply(e,arguments)}catch(e){console.error(e)}}}const f=["invoke","success","fail","complete","returnValue"],g={},y={};function h(e,t){Object.keys(t).forEach(r=>{-1!==f.indexOf(r)&&i(t[r])&&(e[r]=function(e,t){const r=t?e?e.concat(t):Array.isArray(t)?t:[t]:e;return r?function(e){const t=[];for(let r=0;r{-1!==f.indexOf(r)&&i(t[r])&&function(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}(e[r],t[r])})}function b(e){return function(t){return e(t)||t}}function v(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}function S(e,t){let r=!1;for(let n=0;ne(t)}}function _(e,t={}){return["success","fail","complete"].forEach(r=>{if(Array.isArray(e[r])){const n=t[r];t[r]=function(t){S(e[r],t).then(e=>i(n)&&n(e)||e)}}}),t}function O(e,t){const r=[];Array.isArray(g.returnValue)&&r.push(...g.returnValue);const n=y[e];return n&&Array.isArray(n.returnValue)&&r.push(...n.returnValue),r.forEach(e=>{t=e(t)||t}),t}function T(e,t,r,...n){const o=function(e){const t=Object.create(null);Object.keys(g).forEach(e=>{"returnValue"!==e&&(t[e]=g[e].slice())});const r=y[e];return r&&Object.keys(r).forEach(e=>{"returnValue"!==e&&(t[e]=(t[e]||[]).concat(r[e]))}),t}(e);if(o&&Object.keys(o).length){if(Array.isArray(o.invoke)){return S(o.invoke,r).then(e=>t(_(o,e),...n))}return t(_(o,r),...n)}return t(r,...n)}const j={returnValue:e=>v(e)?e.then(e=>e[1]).catch(e=>e[0]):e},C=/^\$|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/,k=/^create|Manager$/,B=["request","downloadFile","uploadFile","connectSocket"],A=/^on/;function x(e){return C.test(e)}function w(e){return A.test(e)&&"onPush"!==e}function E(e){return!(function(e){return k.test(e)}(e)||x(e)||w(e))}const I=[{name:"base64",type:String,required:!0}],q=[{name:"arrayBuffer",type:[ArrayBuffer,Uint8Array],required:!0}];var N=Object.freeze({__proto__:null,base64ToArrayBuffer:I,arrayBufferToBase64:q});const P=[{name:"schema",type:String,required:!0}];var M=Object.freeze({__proto__:null,canIUse:P});const D=[{name:"event",type:[String,Array],required:!0},{name:"callback",type:Function,required:!0}],L=D,z=[{name:"event",type:[String,Array]},{name:"callback",type:Function}],$=[{name:"event",type:String,required:!0}];var U=Object.freeze({__proto__:null,$on:D,$once:L,$off:z,$emit:$});const F=[{name:"method",type:[String,Object],required:!0}],R=F;var V=Object.freeze({__proto__:null,addInterceptor:F,removeInterceptor:R});const G=[{name:"upx",type:[Number,String],required:!0}];var H=Object.freeze({__proto__:null,upx2px:G});function W(e){return function(t,r){t&&(r[e]=Math.round(t))}}const J={canvasId:{type:String,required:!0},x:{type:Number,required:!0,validator:W("x")},y:{type:Number,required:!0,validator:W("y")},width:{type:Number,required:!0,validator:W("width")},height:{type:Number,required:!0,validator:W("height")}},K={canvasId:{type:String,required:!0},data:{type:Uint8ClampedArray,required:!0},x:{type:Number,required:!0,validator:W("x")},y:{type:Number,required:!0,validator:W("y")},width:{type:Number,required:!0,validator:W("width")},height:{type:Number,validator:W("height")}},Y={PNG:"png",JPG:"jpeg"},X={x:{type:Number,default:0,validator:W("x")},y:{type:Number,default:0,validator:W("y")},width:{type:Number,validator:W("width")},height:{type:Number,validator:W("height")},destWidth:{type:Number,validator:W("destWidth")},destHeight:{type:Number,validator:W("destHeight")},canvasId:{type:String,require:!0},fileType:{type:String,validator(e,t){e=(e||"").toUpperCase(),t.fileType=e in Y?Y[e]:Y.PNG}},quality:{type:Number,validator(e,t){e=Math.floor(e),t.quality=e>0&&e<1?e:1}}},Q={canvasId:{type:String,require:!0},actions:{type:Array,require:!0},reserve:{type:Boolean,default:!1}};var Z=Object.freeze({__proto__:null,canvasGetImageData:J,canvasPutImageData:K,canvasToTempFilePath:X,drawCanvas:Q});const ee=[{name:"id",type:String,required:!0}],te=ee,re=ee,ne=ee,oe=[{name:"canvasId",type:String,required:!0},{name:"componentInstance",type:Object}];var ae=Object.freeze({__proto__:null,createAudioContext:te,createVideoContext:re,createMapContext:ne,createCanvasContext:oe});const ie={phoneNumber:{type:String,required:!0,validator(e){if(!e)return"makePhoneCall:fail parameter error: parameter.phoneNumber should not be empty String;"}}};var ce=Object.freeze({__proto__:null,makePhoneCall:ie});const se={beforeSuccess(){uni.showToast({title:"内容已复制",icon:"success",mask:!1})}};var ue=Object.freeze({__proto__:null,setClipboardData:se});const le={filePath:{type:String,required:!0},fileType:{type:String}};var de=Object.freeze({__proto__:null,openDocument:le});const pe={keyword:{type:String}};var fe=Object.freeze({__proto__:null,chooseLocation:pe});const ge={WGS84:"WGS84",GCJ02:"GCJ02"},ye={type:{type:String,validator(e,t){e=(e||"").toUpperCase(),t.type=Object.values(ge).indexOf(e)<0?ge.WGS84:e},default:ge.WGS84},altitude:{altitude:Boolean,default:!1}};var he=Object.freeze({__proto__:null,getLocation:ye});const me={latitude:{type:Number,required:!0},longitude:{type:Number,required:!0},scale:{type:Number,validator(e,t){e=Math.floor(e),t.scale=e>=5&&e<=18?e:18},default:18},name:{type:String},address:{type:String}};var be=Object.freeze({__proto__:null,openLocation:me});const ve=["original","compressed"],Se=["album","camera"],_e={count:{type:Number,required:!1,default:9,validator(e,t){e<=0&&(t.count=9)}},sizeType:{type:[Array,String],required:!1,default:ve,validator(e,t){const r=e.length;if(r){if("string"==typeof e)~ve.indexOf(e)||(t.sizeType=ve);else for(let n=0;n0?e.split("/"):[];return a.splice(a.length-o-1,o+1),"/"+a.concat(r).join("/")}const Be=/^([a-z-]+:)?\/\//i,Ae=/^data:.*,.*/;function xe(e){return __uniConfig.router.base?__uniConfig.router.base+e:e}function we(e){if(0===e.indexOf("/")){if(0!==e.indexOf("//"))return xe(e.substr(1));e="https:"+e}if(Be.test(e)||Ae.test(e)||0===e.indexOf("blob:"))return e;const t=getCurrentPages();return t.length?xe(ke(t[t.length-1].$page.route,e).substr(1)):e}const Ee={src:{type:String,required:!0,validator(e,t){t.src=we(e)}}};var Ie=Object.freeze({__proto__:null,getImageInfo:Ee});const qe={urls:{type:Array,required:!0,validator(e,t){var r;if(t.urls=e.map(e=>{if("string"==typeof e)return we(e);r=!0}),r)return"url is not string"}},current:{type:[String,Number],validator(e,t){"number"==typeof e?t.current=e>0&&ee);o={},a.forEach(e=>{e=e.split("="),o[e[0]]=e[1]});for(let e in t)t.hasOwnProperty(e)&&(c(t[e])?o[$e(e)]=$e(JSON.stringify(t[e])):o[$e(e)]=$e(t[e]));return o=Object.keys(o).map(e=>`${e}=${o[e]}`).join("&"),e+(o?"?"+o:"")+(n?"#"+n:"")}(e,t.data))}},header:{type:Object,validator(e,t){const r=t.header=e||{};t.method!==De.GET&&(Object.keys(r).find(e=>"content-type"===e.toLowerCase())||(r["Content-Type"]="application/json"))}},dataType:{type:String,validator(e,t){t.dataType=(e||Le).toLowerCase()}},responseType:{type:String,validator(e,t){e=(e||"").toLowerCase(),t.responseType=Object.values(ze).indexOf(e)<0?ze.TEXT:e}}};var Fe=Object.freeze({__proto__:null,request:Ue});const Re={OPTIONS:"OPTIONS",GET:"GET",HEAD:"HEAD",POST:"POST",PUT:"PUT",DELETE:"DELETE",TRACE:"TRACE",CONNECT:"CONNECT"},Ve={url:{type:String,required:!0},header:{type:Object,validator(e,t){t.header=e||{}}},method:{type:String,validator(e,t){e=(e||"").toUpperCase(),t.method=Object.values(Re).indexOf(e)<0?Re.GET:e}},protocols:{type:Array,validator(e,t){t.protocols=(e||[]).filter(e=>"string"==typeof e)}}},Ge={data:{type:[String,ArrayBuffer]}},He={code:{type:Number},reason:{type:String}};var We=Object.freeze({__proto__:null,connectSocket:Ve,sendSocketMessage:Ge,closeSocket:He});const Je={url:{type:String,required:!0},files:{type:Array},filePath:{type:String,validator(e,t){e&&(t.type=we(e))}},name:{type:String},header:{type:Object,validator(e,t){t.header=e||{}}},formData:{type:Object,validator(e,t){t.formData=e||{}}}};var Ke=Object.freeze({__proto__:null,uploadFile:Je});const Ye={OAUTH:"OAUTH",SHARE:"SHARE",PAYMENT:"PAYMENT",PUSH:"PUSH"},Xe={service:{type:String,required:!0,validator(e,t){if((e=(e||"").toUpperCase())&&Object.values(Ye).indexOf(e)<0)return"service error"}}};var Qe=Object.freeze({__proto__:null,getProvider:Xe});function Ze(e){return function(t,r){const n=(t=ke(t)).split("?")[0],o=__uniRoutes.find(({path:e,alias:t})=>e===n||t===n);if(!o)return"page `"+t+"` is not found";if("navigateTo"===e||"redirectTo"===e){if(o.meta.isTabBar)return`can not ${e} a tabbar page`}else if("switchTab"===e&&!o.meta.isTabBar)return"can not switch to no-tabBar page";o.meta.isTabBar&&(t=n),o.meta.isEntry&&(t=t.replace(o.alias,"/")),r.url=function(e){if("string"!=typeof e)return e;const t=e.indexOf("?");if(-1===t)return e;const r=e.substr(t+1).trim().replace(/^(\?|#|&)/,"");if(!r)return e;e=e.substr(0,t);const n=[];return r.split("&").forEach(e=>{const t=e.replace(/\+/g," ").split("="),r=t.shift(),o=t.length>0?t.join("="):"";n.push(r+"="+encodeURIComponent(o))}),n.length?e+"?"+n.join("&"):e}(t)}}function et(e,t={}){return Object.assign({url:{type:String,required:!0,validator:Ze(e)}},t)}function tt(e){return{animationType:{type:String,validator(t){if(t&&-1===e.indexOf(t))return"`"+t+"` is not supported for `animationType` (supported values are: `"+e.join("`|`")+"`)"}},animationDuration:{type:Number}}}const rt=et("redirectTo"),nt=et("reLaunch"),ot=et("navigateTo",tt(["slide-in-right","slide-in-left","slide-in-top","slide-in-bottom","fade-in","zoom-out","zoom-fade-out","pop-in","none"])),at=et("switchTab"),it=Object.assign({delta:{type:Number,validator(e,t){e=parseInt(e)||1,t.delta=Math.min(getCurrentPages().length-1,e)}}},tt(["slide-out-right","slide-out-left","slide-out-top","slide-out-bottom","fade-out","zoom-in","zoom-fade-in","pop-out","none"]));var ct=Object.freeze({__proto__:null,redirectTo:rt,reLaunch:nt,navigateTo:ot,switchTab:at,navigateBack:it});const st={key:{type:String,required:!0}},ut=[{name:"key",type:String,required:!0}],lt={key:{type:String,required:!0},data:{required:!0}},dt=[{name:"key",type:String,required:!0},{name:"data",required:!0}],pt=st,ft=ut;var gt=Object.freeze({__proto__:null,getStorage:st,getStorageSync:ut,setStorage:lt,setStorageSync:dt,removeStorage:pt,removeStorageSync:ft});const yt={family:{type:String,required:!0},source:{type:String,required:!0},desc:{type:Object,required:!1},success:{type:Function,required:!1},fail:{type:Function,required:!1},complete:{type:Function,required:!1}};var ht=Object.freeze({__proto__:null,loadFontFace:yt});const mt=["#ffffff","#000000"],bt={frontColor:{type:String,required:!0,validator(e,t){if(-1===mt.indexOf(e))return`invalid frontColor "${e}"`}},backgroundColor:{type:String,required:!0},animation:{type:Object,default:()=>({duration:0,timingFunc:"linear"}),validator(e={},t){t.animation={duration:e.duration||0,timingFunc:e.timingFunc||"linear"}}}},vt={title:{type:String,required:!0}};var St=Object.freeze({__proto__:null,setNavigationBarColor:bt,setNavigationBarTitle:vt});const _t={scrollTop:{type:Number,required:!0},duration:{type:Number,default:300,validator(e,t){t.duration=Math.max(0,e)}}};var Ot=Object.freeze({__proto__:null,pageScrollTo:_t});const Tt={title:{type:String,default:""},content:{type:String,default:""},showCancel:{type:Boolean,default:!0},cancelText:{type:String,default:"取消"},cancelColor:{type:String,default:"#000000"},confirmText:{type:String,default:"确定"},confirmColor:{type:String,default:"#007aff"},visible:{type:Boolean,default:!0}},jt={title:{type:String,default:""},icon:{default:"success",validator(e,t){-1===["success","loading","none"].indexOf(e)&&(t.icon="success")}},image:{type:String,default:"",validator(e,t){e&&(t.image=we(e))}},duration:{type:Number,default:1500},mask:{type:Boolean,default:!1},visible:{type:Boolean,default:!0}},Ct={title:{type:String,default:""},icon:{type:String,default:"loading"},duration:{type:Number,default:1e8},mask:{type:Boolean,default:!1},visible:{type:Boolean,default:!0}},kt={itemList:{type:Array,required:!0,validator(e,t){if(!e.length)return"parameter.itemList should have at least 1 item"}},itemColor:{type:String,default:"#000000"},visible:{type:Boolean,default:!0}};var Bt=Object.freeze({__proto__:null,showModal:Tt,showToast:jt,showLoading:Ct,showActionSheet:kt});const At={type:Number,required:!0},xt={index:At,text:{type:String},iconPath:{type:String},selectedIconPath:{type:String}},wt={color:{type:String},selectedColor:{type:String},backgroundColor:{type:String},borderStyle:{type:String,validator(e,t){e&&(t.borderStyle="black"===e?"black":"white")}}},Et={animation:{type:Boolean,default:!1}},It={animation:{type:Boolean,default:!1}},qt={index:At},Nt={index:At},Pt={index:At},Mt={index:At,text:{type:String,required:!0,validator(e,t){(function(e=""){return(""+e).replace(/[^\x00-\xff]/g,"**").length})(e)>=4&&(t.text="...")}}};var Dt=Object.freeze({__proto__:null,setTabBarItem:xt,setTabBarStyle:wt,hideTabBar:Et,showTabBar:It,hideTabBarRedDot:qt,showTabBarRedDot:Nt,removeTabBarBadge:Pt,setTabBarBadge:Mt});const Lt=Object.create(null),zt=($t={"./base/base64.js":N,"./base/can-i-use.js":M,"./base/event-bus.js":U,"./base/interceptor.js":V,"./base/upx2px.js":H,"./context/canvas.js":Z,"./context/context.js":ae,"./device/make-phone-call.js":ce,"./device/set-clipboard-data.js":ue,"./file/open-document.js":de,"./location/choose-location.js":fe,"./location/get-location.js":he,"./location/open-location.js":be,"./media/choose-image.js":Oe,"./media/choose-video.js":Ce,"./media/get-image-info.js":Ie,"./media/preview-image.js":Ne,"./network/download-file.js":Me,"./network/request.js":Fe,"./network/socket.js":We,"./network/upload-file.js":Ke,"./plugin/get-provider.js":Qe,"./route/route.js":ct,"./storage/storage.js":gt,"./ui/load-font-face.js":ht,"./ui/navigation-bar.js":St,"./ui/page-scroll-to.js":Ot,"./ui/popup.js":Bt,"./ui/tab-bar.js":Dt},(Ut=function(e){return $t[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}).keys=function(){return Object.keys($t)},Ut);var $t,Ut;function Ft(e,t,r){const n=t[e],a=!s(r,e);let c=r[e];if(function(e,t){if(!Array.isArray(t))return Ht(t,e)?0:-1;for(let r=0,n=t.length;r-1&&a&&!s(n,"default")&&(c=!1),void 0===c&&s(n,"default")){const t=n.default;c=i(t)?t():t,r[e]=c}return function(e,t,r,n,a){if(e.required&&n)return`Missing required parameter \`${t}\``;if(null==r&&!e.required){const t=e.validator;return t?t(r,a):void 0}let i=e.type,c=!i||!0===i;const s=[];if(i){Array.isArray(i)||(i=[i]);for(let e=0;e"boolean"===e.toLowerCase())}(a,i)&&(n+=` with value ${c}`);n+=`, got ${i} `,Kt(i)&&(n+=`with value ${s}.`);return n}(t,r,s);const u=e.validator;if(u)return u(r,a)}(n,e,c,a,r)}zt.keys().forEach((function(e){Object.assign(Lt,zt(e))}));const Rt=/^(String|Number|Boolean|Function|Symbol)$/;function Vt(e,t){let r;const n=Gt(t);if(Rt.test(n)){const o=typeof e;r=o===n.toLowerCase(),r||"object"!==o||(r=e instanceof t)}else r="Object"===n?c(e):"Array"===n?Array.isArray(e):e instanceof t;return{valid:r,expectedType:n}}function Gt(e){const t=e&&e.toString().match(/^\s*function (\w+)/);return t?t[1]:""}function Ht(e,t){return Gt(e)===Gt(t)}function Wt(e,t){return"String"===t?`"${e}"`:"Number"===t?`${Number(e)}`:`${e}`}const Jt=["string","number","boolean"];function Kt(e){return Jt.some(t=>e.toLowerCase()===t)}function Yt(e,t,r){const n=`${t}:fail ${e}`;if(console.error(n),-1===r)throw new Error(n);return"number"==typeof r&&rr(r,{errMsg:n}),!1}const Xt=[{name:"callback",type:Function,required:!0}];function Qt(e,t,r){let n=Lt[e];if(!n&&w(e)&&(n=Xt),n){if(Array.isArray(n)&&Array.isArray(t)){const e=Object.create(null),r=Object.create(null),o=t.length;n.forEach((n,a)=>{e[n.name]=n,o>a&&(r[n.name]=t[a])}),n=e,t=r}if(i(n.beforeValidate)){const o=n.beforeValidate(t);if(o)return Yt(o,e,r)}const o=Object.keys(n);for(let a=0;a-1&&(r=t.errMsg.substr(n)),t.errMsg=e+":fail"+r}const r=t.errMsg;0===r.indexOf(e+":ok")?(i(m)&&m(t),l&&o(t),i(b)&&b(t)):0===r.indexOf(e+":cancel")?(t.errMsg=t.errMsg.replace(e+":cancel",e+":fail cancel"),f&&a(t),i(_)&&_(t),g&&s(t),i(O)&&O(t)):0===r.indexOf(e+":fail")&&(i(v)&&v(t),f&&a(t),i(S)&&S(t)),y&&u(t),i(T)&&T(t)}},{params:t,callbackId:j}}(e,t,r);return c(n)&&!Qt(e,n,o)?{params:n,callbackId:!1}:{params:n,callbackId:o}}function rr(e,t){if("number"==typeof e){const r=er[e];if(r)return r.keepAlive||delete er[e],r.callback(t)}return t}function nr(e,t,r={}){return i(t)?(function(e,t){const r=Lt[e];r&&i(r.beforeSuccess)&&(t.beforeSuccess=r.beforeSuccess)}(e,r),function(...n){if(x(e)){if(Qt(e,n,-1))return t.apply(null,n)}else if(w(e)){if(Qt(e,n,-1))return t(function(e,t){const r=Zt++,n="api."+e+"."+r;return er[r]={name:n,keepAlive:!0,callback:function(e){t(e)}},r}(e,n[0]))}else{let o={};n.length&&(o=n[0]);const{params:a,callbackId:s}=tr(e,o,r);if(!1!==s){let r;return r=i(a)?t(s):t(a,s),r&&!function(e){return-1!==B.indexOf(e)}(e)&&(r=rr(s,r),c(r)&&(r.errMsg=r.errMsg||e+":ok")),r}}}):t}var or,ar=(function(e,t){!function(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(256),n=0;n>2],a+=e[(3&n[r])<<4|n[r+1]>>4],a+=e[(15&n[r+1])<<2|n[r+2]>>6],a+=e[63&n[r+2]];return o%3==2?a=a.substring(0,a.length-1)+"=":o%3==1&&(a=a.substring(0,a.length-2)+"=="),a},t.decode=function(e){var t,n,o,a,i,c=.75*e.length,s=e.length,u=0;"="===e[e.length-1]&&(c--,"="===e[e.length-2]&&c--);var l=new ArrayBuffer(c),d=new Uint8Array(l);for(t=0;t>4,d[u++]=(15&o)<<4|a>>2,d[u++]=(3&a)<<6|63&i;return l}}()}(or={exports:{}},or.exports),or.exports),ir=ar.encode,cr=ar.decode;var sr={};const ur={promiseInterceptor:j};let lr=!1,dr=0,pr=0;var fr=n("@app-module/system.router");function gr(e){return e.substr(0,e.lastIndexOf("/"))}var yr=n("@app-module/system.router");var hr=n("@app-module/system.router");var mr=Object.freeze({__proto__:null,navigateBack:function({delta:e}){return fr.back(),{errMsg:"navigateBack:ok"}},navigateTo:function({url:e}){const t=e.split("?"),r=t[0],n=l(t[1]||"");return yr.push({uri:gr(r),params:n}),{errMsg:"navigateTo:ok"}},redirectTo:function({url:e}){const t=e.split("?"),r=t[0],n=l(t[1]||"");return hr.replace({uri:gr(r),params:n}),{errMsg:"redirectTo:ok"}}});function br(e,...t){return mr[e].apply(null,t)}function vr(e,t){return UniServiceJSBridge.on("api."+e,t)}const Sr=["canplay","play","pause","stop","ended","timeUpdate","error","waiting","seeking","seeked"],_r=[{name:"src",cache:!0},{name:"startTime",default:0,cache:!0},{name:"autoplay",default:!1,cache:!0},{name:"loop",default:!1,cache:!0},{name:"obeyMuteSwitch",default:!0,readonly:!0,cache:!0},{name:"duration",readonly:!0},{name:"currentTime",readonly:!0},{name:"paused",readonly:!0},{name:"buffered",readonly:!0},{name:"volume"}];class Or{constructor(e){this.id=e,this._callbacks={},this._options={},Sr.forEach(e=>{this._callbacks[e.toLowerCase()]=[]}),_r.forEach(e=>{const t=e.name,r={get(){const r=e.cache?this._options:br("getAudioState",{audioId:this.id}),n=t in r?r[t]:e.default;return"number"==typeof n&&"volume"!==t?n/1e3:n}};e.readonly||(r.set=function(e){this._options[t]=e,br("setAudioState",Object.assign({},this._options,{audioId:this.id}))}),Object.defineProperty(this,t,r)})}play(){this._operate("play")}pause(){this._operate("pause")}stop(){this._operate("stop")}seek(e){this._operate("seek",{currentTime:1e3*e})}destroy(){clearInterval(this.__timing),br("destroyAudioInstance",{audioId:this.id}),delete jr[this.id]}_operate(e,t){br("operateAudio",Object.assign({},t,{audioId:this.id,operationType:e}))}}function Tr(e,t,r,n){e._callbacks[t].forEach(e=>{"function"==typeof e&&e("error"===t?{errMsg:r,errCode:n}:{})})}Sr.forEach(e=>{const t=e[0].toUpperCase()+e.substr(1);e=e.toLowerCase(),Or.prototype[`on${t}`]=function(t){this._callbacks[e].push(t)},Or.prototype[`off${t}`]=function(t){const r=this._callbacks[e],n=r.indexOf(t);n>=0&&r.splice(n,1)}}),vr("onAudioStateChange",({state:e,audioId:t,errMsg:r,errCode:n})=>{const o=jr[t];if(o)if(Tr(o,e,r,n),"play"===e){const e=o.currentTime;o.__timing=setInterval(()=>{o.currentTime!==e&&Tr(o,"timeupdate")},200)}else"pause"!==e&&"stop"!==e&&"error"!==e||clearInterval(o.__timing)});const jr=Object.create(null);const Cr=["canplay","play","pause","stop","ended","timeUpdate","prev","next","error","waiting"],kr={};Cr.forEach(e=>{kr[e]=[]});const Br=[{name:"duration",readonly:!0},{name:"currentTime",readonly:!0},{name:"paused",readonly:!0},{name:"src",cache:!0},{name:"startTime",default:0,cache:!0},{name:"buffered",readonly:!0},{name:"title",cache:!0},{name:"epname",cache:!0},{name:"singer",cache:!0},{name:"coverImgUrl",cache:!0},{name:"webUrl",cache:!0},{name:"protocol",readonly:!0,default:"http"}];class Ar{constructor(){this._options={},vr("onBackgroundAudioStateChange",({state:e,errMsg:t,errCode:r})=>{kr[e].forEach(n=>{"function"==typeof n&&n("error"===e?{errMsg:t,errCode:r}:{})})}),Br.forEach(e=>{const t=e.name,r={get(){const r=e.cache?this._options:br("getBackgroundAudioState");return t in r?r[t]:e.default}};e.readonly||(r.set=function(e){this._options[t]=e,br("setBackgroundAudioState",Object.assign({},this._options,{audioId:this.id}))}),Object.defineProperty(this,t,r)})}play(){this._operate("play")}pause(){this._operate("pause")}stop(){this._operate("stop")}seek(e){this._operate("seek",{currentTime:e})}_operate(e,t){br("operateBackgroundAudio",Object.assign({},t,{operationType:e}))}}let xr;Cr.forEach(e=>{const t=e[0].toUpperCase()+e.substr(1);Ar.prototype[`on${t}`]=function(t){kr[e].push(t)}});var wr={...Object.freeze({__proto__:null,base64ToArrayBuffer:function(e){return cr(e)},arrayBufferToBase64:function(e){return ir(e)},canIUse:function(e){return!s(sr,e)||sr[e]},interceptors:ur,addInterceptor:function(e,t){"string"==typeof e&&c(t)?h(y[e]||(y[e]={}),t):c(e)&&h(g,e)},removeInterceptor:function(e,t){"string"==typeof e?c(t)?m(y[e],t):delete y[e]:c(e)&&m(g,e)},upx2px:function(e,t){if(0===dr&&function(){const{platform:e,pixelRatio:t,windowWidth:r}=uni.getSystemInfoSync();dr=r,pr=t,lr="ios"===e}(),0===(e=Number(e)))return 0;let r=e/750*(t||dr);return r<0&&(r=-r),r=Math.floor(r+1e-4),0===r?1!==pr&&lr?.5:1:e<0?-r:r},createInnerAudioContext:function(){const{audioId:e}=br("createAudioInstance"),t=new Or(e);return jr[e]=t,t},getBackgroundAudioManager:function(){return xr||(xr=new Ar)}}),...mr};const Er=Object.create(null);let Ir;t.forEach(e=>{wr[e]?Er[e]=function(e,t){return E(e)?function(r={},...n){return i(r.success)||i(r.fail)||i(r.complete)?O(e,T(e,t,r,...n)):O(e,new Promise((o,a)=>{T(e,t,Object.assign({},r,{success:o,fail:a}),...n),Promise.prototype.finally||(Promise.prototype.finally=function(e){const t=this.constructor;return this.then(r=>t.resolve(e()).then(()=>r),r=>t.resolve(e()).then(()=>{throw r}))})}).then(e=>[null,e]).catch(e=>[e]))}:t}(e,nr(e,wr[e])):Er[e]=function(e){return function(t){console.error("API `"+e+"` is not yet implemented")}}(e)});const qr=[],Nr=[],Pr=[];function Mr(e){e&&e.store&&(Ir=e.store)}Mr.prototype.$mount=function(){},Mr.config={},Mr.use=function(e){Nr.push(e)},Mr.mixin=function(e){qr.push(e)},Mr.component=function(e,t){Pr.push({id:e,definition:t})},(Object.getPrototypeOf(global)||global).__VuePlugin={install(e,t){qr.forEach(t=>{e.mixin(t)}),Nr.forEach(t=>{e.use(t)}),Pr.forEach(({id:t,definition:r})=>{e.component(t,r)}),Object.keys(Mr.prototype).forEach(t=>{"$mount"!==t&&(e.prototype[t]=Mr.prototype[t])}),Ir&&(e.prototype.$store=Ir)}};const Dr={globalData:{}};global.UniServiceJSBridge.invokeCallbackHandler=rr;var Lr={uni:Er,Vue:Mr,getApp:function({allowDefault:t=!1}={}){return e.$def?function(e){if(e.__$processed)return e;const t=e.methods;return t&&(Object.keys(t).forEach(r=>{e[r]=t[r]}),delete e.methods),Object.keys(Dr).forEach(t=>{"globalData"!==t&&(e[t]=Dr[t])}),e.globalData||(e.globalData={}),Object.assign(e.globalData,Dr.globalData),e.__$processed=!0,e}(e.$def):t?Dr:void 0},getCurrentPages:function(){return[]}};const zr=Object.getPrototypeOf(global)||global;dsl.onDefineApp(t=>{const r="function"==typeof t.onLaunch,n="function"==typeof t.onShow;(r||n)&&(e._events["applc:onCreate"]||(e._events["applc:onCreate"]=[])).push(()=>{r&&t.onLaunch(),n&&t.onShow()}),zr.__uniRoutes=function({pages:e}){const t=[];return Object.keys(e).forEach(r=>{const n=e[r];t.push({path:"/"+r+"/"+n.component,meta:{}})}),t}(t.manifest.router)}),Object.assign(zr,Lr)}()})); +dsl.onInitPage((function({$app_require$:e,Vue:u}){!function(){"use strict";"undefined"!=typeof __VuePlugin&&u.use(__VuePlugin)}()})); diff --git a/packages/uni-quickapp/lib/chain-webpack.js b/packages/uni-quickapp/lib/chain-webpack.js new file mode 100644 index 0000000000000000000000000000000000000000..d6634407c2c66cf9e0927d3ae79897265b49574b --- /dev/null +++ b/packages/uni-quickapp/lib/chain-webpack.js @@ -0,0 +1,34 @@ +module.exports = config => { + + config.module + .rule('vue') + .test([/\.vue$/, /\.nvue$/]) + .use('vue-loader') + .loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/vue-loader')) + .tap(options => Object.assign(options, { + compiler: require('@dcloudio/uni-template-compiler'), + compilerOptions: { + quickapp: true, + preserveWhitespace: false + }, + hotReload: false, + cacheDirectory: false, + cacheIdentifier: false + })) + + config.module + .rule('vue') + .uses + .delete('cache-loader') + + config.plugin('extract-css') + .init((Plugin, args) => new Plugin({ + filename: '[name].css.json' + })) + + config.plugins.delete('hmr') + config.plugins.delete('html') + config.plugins.delete('copy') + config.plugins.delete('preload') + config.plugins.delete('prefetch') +} diff --git a/packages/uni-quickapp/lib/compiler-module.js b/packages/uni-quickapp/lib/compiler-module.js new file mode 100644 index 0000000000000000000000000000000000000000..fde527550885d116574897b07a1d4661d47ac532 --- /dev/null +++ b/packages/uni-quickapp/lib/compiler-module.js @@ -0,0 +1,7 @@ +module.exports = { + preTransformNode(el) { + if (el.tag === 'view') { // view 是最常用组件,直接映射为div标签,保证性能 + el.tag = 'div' + } + } +} diff --git a/packages/uni-quickapp/lib/configure-webpack.js b/packages/uni-quickapp/lib/configure-webpack.js new file mode 100644 index 0000000000000000000000000000000000000000..372679a05630d9c134875c42b57fb985c2302ad1 --- /dev/null +++ b/packages/uni-quickapp/lib/configure-webpack.js @@ -0,0 +1,95 @@ +const path = require('path') + +const webpack = require('webpack') +const CopyPlugin = require('copy-webpack-plugin') + +const HandlerPlugin = require('@hap-toolkit/packager/lib/plugin/handler-plugin') +const ZipPlugin = require('@hap-toolkit/packager/lib/plugin/zip-plugin') +const NotifyPlugin = require('@hap-toolkit/packager/lib/plugin/notify-plugin') + +const Css2jsonPlugin = require('@hap-toolkit/dsl-vue/lib/plugin/css2json-plugin') +const InstVuePlugin = require('@hap-toolkit/dsl-vue/lib/plugin/instvue-plugin') + +const InstMainPlugin = require('./plugin/main-plugin') + +const parseManifest = require('./manifest/index') + +const env = { + // 平台:native + NODE_PLATFORM: 'native', + // 阶段: dev|test|release + NODE_PHASE: process.env.NODE_PHASE +} + +const dslFilename = ('vue.' + (process.env.NODE_ENV === 'production' ? 'prod' : 'dev') + '.js') + +parseManifest(process.UNI_PAGES, process.UNI_MANIFEST) + +const manifest = global.framework.manifest + +if (!manifest.package) { + console.error(`maniest.json quickapp 节点缺少 package 配置`) + process.exit(0) +} + +function genPriorities(entryPagePath) { + const o = [/^i18n\/.+\.json$/i, 'manifest.json', 'app.js', /^common\//i]; + if (entryPagePath) { + o.splice(3, 0, new RegExp(`^${entryPagePath}/$`), new RegExp(`^${entryPagePath}/.+`)) + } else console.error('未配置入口页面'); + return o +} + +module.exports = { + devtool: false, + entry() { + return process.UNI_ENTRY + }, + externals: { + vue: 'Vue' + }, + module: { + rules: [{ + //暂不考虑ts + test: path.resolve(process.env.UNI_INPUT_DIR, 'main.js'), + use: [{ + loader: path.resolve(__dirname, 'loader/main-loader') + }] + }] + }, + plugins: [ + new webpack.DefinePlugin({ + // 平台:na + ENV_PLATFORM: JSON.stringify(env.NODE_PLATFORM), + // 阶段: dev|test|release + ENV_PHASE: JSON.stringify(env.NODE_PHASE), + ENV_PHASE_DV: env.NODE_PHASE === 'dev', + ENV_PHASE_QA: env.NODE_PHASE === 'test', + ENV_PHASE_OL: env.NODE_PHASE === 'prod' + }), + new CopyPlugin([{ + from: path.resolve(__dirname, '../dist/' + dslFilename), + to: 'dsl.js' + }]), + new HandlerPlugin({}), + new Css2jsonPlugin(), + new InstVuePlugin(), + new InstMainPlugin(), + new ZipPlugin({ + name: manifest.package, + icon: manifest.icon, + versionCode: manifest.versionCode, + output: path.resolve(process.env.UNI_OUTPUT_DIR, '..'), + pathBuild: process.env.UNI_OUTPUT_DIR, + pathSignFolder: './sign', + sign: process.env.NODE_ENV === 'production' ? 'release' : 'debug', + priorities: genPriorities(manifest.router.entry), + subpackages: undefined, + comment: '', + cwd: process.env.UNI_INPUT_DIR, + disableStreamPack: undefined, + disableSubpackages: undefined + }), + new NotifyPlugin() + ] +} diff --git a/packages/uni-quickapp/lib/loader/main-loader.js b/packages/uni-quickapp/lib/loader/main-loader.js new file mode 100644 index 0000000000000000000000000000000000000000..f050366ca0441fae9cfc2eb576e9438661537b46 --- /dev/null +++ b/packages/uni-quickapp/lib/loader/main-loader.js @@ -0,0 +1,7 @@ +module.exports = function(source, map) { + return ` +import 'uni-pages'; +${source} +export default App; +` +} diff --git a/packages/uni-quickapp/lib/manifest/base-parser.js b/packages/uni-quickapp/lib/manifest/base-parser.js new file mode 100644 index 0000000000000000000000000000000000000000..da5dd0d77d7efd52fb432b4d7ed817a0efd90b56 --- /dev/null +++ b/packages/uni-quickapp/lib/manifest/base-parser.js @@ -0,0 +1,28 @@ +const ATTRS = { + 'name': 'name', + 'versionName': 'versionName', + 'versionCode': 'versionCode' +} + +function merge(to, from) { + Object.keys(ATTRS).forEach(name => { + if (!to[name]) { + to[name] = from[name] + } + }) +} + +module.exports = function parseBase(manifest, manifestJson) { + merge(manifest, manifestJson) + manifest.versionCode = parseInt(manifest.versionCode) || 1 + + if (!manifest.config) { + manifest.config = {} + } + if (!manifest.config.dsl) { + manifest.config.dsl = {} + } + manifest.config.dsl.name = 'vue' + + return manifest +} diff --git a/packages/uni-quickapp/lib/manifest/display-parser.js b/packages/uni-quickapp/lib/manifest/display-parser.js new file mode 100644 index 0000000000000000000000000000000000000000..088434a577e572ae2626db04105eec4f4cc1fe70 --- /dev/null +++ b/packages/uni-quickapp/lib/manifest/display-parser.js @@ -0,0 +1,65 @@ +const PLATFORMS = [ + 'h5', + 'app-plus', + 'mp-weixin', + 'mp-qq', + 'mp-baidu', + 'mp-alipay', + 'mp-toutiao', + 'quickapp' +] + +const DISPLAY = { + 'navigationBarBackgroundColor': 'titleBarBackgroundColor', + 'navigationBarTextStyle': (style, val) => { + if (val === 'black') { + style.titleBarTextColor = '#000000' + style.statusBarTextStyle = 'dark' + } else { + style.titleBarTextColor = '#ffffff' + style.statusBarTextStyle = 'light' + } + }, + 'navigationBarTitleText': 'titleBarText', + 'navigationStyle': (style, val) => { + if (val === 'custom') { + style.titleBar = false + } + } +} + +function parseStyle(style = {}) { + const ret = {} + Object.keys(style).forEach(name => { + if (!PLATFORMS.includes(name)) { + const transform = DISPLAY[name] + if (transform) { + if (typeof transform === 'string') { + ret[transform] = style[name] + } else if (typeof transform === 'function') { + transform(ret, style[name]) + } + } else { + ret[name] = style[name] + } + } + }) + if (style.quickapp) { + Object.assign(ret, style.quickapp) + } + return ret +} + +module.exports = function parseDisplay(manifest, pages, globalStyle = {}) { + const display = { + pages: {} + } + // globalStyle + Object.assign(display, parseStyle(globalStyle)) + + pages.forEach(page => { + const key = page.path.substr(0, page.path.lastIndexOf('/')) + display.pages[key] = parseStyle(page.style) + }) + manifest.display = display +} diff --git a/packages/uni-quickapp/lib/manifest/entry-parser.js b/packages/uni-quickapp/lib/manifest/entry-parser.js new file mode 100644 index 0000000000000000000000000000000000000000..5f48f72c2f11abb120821c893e83953f4947fbdf --- /dev/null +++ b/packages/uni-quickapp/lib/manifest/entry-parser.js @@ -0,0 +1,10 @@ +const path = require('path') +module.exports = function parseEntry(pages) { + const entry = { + 'app': path.resolve(process.env.UNI_INPUT_DIR, 'main.js') + } + pages.forEach(page => { + entry[page.path] = path.resolve(process.env.UNI_INPUT_DIR, page.path + '.vue?uxType=page') + }) + return entry +} diff --git a/packages/uni-quickapp/lib/manifest/index.js b/packages/uni-quickapp/lib/manifest/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e936379cb61e986e0e4555e58ca10f765ae7bd05 --- /dev/null +++ b/packages/uni-quickapp/lib/manifest/index.js @@ -0,0 +1,21 @@ +const parseBase = require('./base-parser') +const parsePages = require('./pages-parser') +const parseDisplay = require('./display-parser') + +const parseEntry = require('./entry-parser') + +module.exports = function(pagesJson, manifestJson, loader) { + const manifest = manifestJson.quickapp || {} + + parseBase(manifest, manifestJson) + parsePages(manifest, pagesJson.pages) + parseDisplay(manifest, pagesJson.pages, pagesJson.globalStyle) + + process.UNI_ENTRY = parseEntry(pagesJson.pages) + + global.framework.manifest = manifest + + loader && loader.emitFile('manifest.json', JSON.stringify(manifest)) + + return '' +} diff --git a/packages/uni-quickapp/lib/manifest/pages-parser.js b/packages/uni-quickapp/lib/manifest/pages-parser.js new file mode 100644 index 0000000000000000000000000000000000000000..15dac61b659cc5d1d937c646bc14f800f420fa45 --- /dev/null +++ b/packages/uni-quickapp/lib/manifest/pages-parser.js @@ -0,0 +1,15 @@ +module.exports = function parsePages(manifest, pages) { + const entryPagePath = pages[0].path + const router = { + entry: entryPagePath.substr(0, entryPagePath.lastIndexOf('/')), + pages: {} + } + pages.forEach(page => { + const lastIndex = page.path.lastIndexOf('/') + const key = page.path.substr(0, lastIndex) + router.pages[key] = { + component: page.path.substr(lastIndex + 1) + } + }) + manifest.router = router +} diff --git a/packages/uni-quickapp/lib/plugin/main-plugin.js b/packages/uni-quickapp/lib/plugin/main-plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..0da48aaadc935b3eb6fecddb53e60b745e0b5f88 --- /dev/null +++ b/packages/uni-quickapp/lib/plugin/main-plugin.js @@ -0,0 +1,19 @@ +const WebpackSources = require('webpack-sources') +class InstMainPlugin { + apply(compiler) { + compiler.hooks.compilation.tap('InstMainPlugin', (compilation) => { + compilation.hooks.optimizeChunkAssets.tapAsync('InstMainPlugin', (chunks, callback) => { + if (chunks.find(chunk => chunk.files.includes('app.js'))) { + const appAsset = compilation.assets['app.js'] + compilation.assets['app.js'] = + new WebpackSources.ConcatSource( + `(function(){\n var handler = function() {\n return `, appAsset, + `\n };\n if (typeof window === "undefined") {\n let options = handler();\n options.default['manifest'] = ${JSON.stringify(global.framework.manifest)}\n $app_define$(options.default)\n $app_bootstrap$()\n }\n })();` + ) + } + callback() + }) + }) + } +} +module.exports = InstMainPlugin diff --git a/packages/uni-quickapp/lib/vue.config.js b/packages/uni-quickapp/lib/vue.config.js new file mode 100644 index 0000000000000000000000000000000000000000..d4bab4ef82a3170d4ca11ae33575c405d60b91f6 --- /dev/null +++ b/packages/uni-quickapp/lib/vue.config.js @@ -0,0 +1,9 @@ +global.framework = {} + +const chainWebpack = require('./chain-webpack') +const configureWebpack = require('./configure-webpack') + +module.exports = { + chainWebpack, + configureWebpack +} diff --git a/packages/uni-quickapp/package.json b/packages/uni-quickapp/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f0fc7fb227c6718bfc6cd79a9457dcb4719f3a45 --- /dev/null +++ b/packages/uni-quickapp/package.json @@ -0,0 +1,23 @@ +{ + "name": "@dcloudio/uni-quickapp", + "version": "2.0.0-alpha-24720191216006", + "description": "uni-app quickapp", + "main": "dist/vue.prod.js", + "repository": { + "type": "git", + "url": "git+https://github.com/dcloudio/uni-app.git", + "directory": "packages/uni-quickapp" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "fxy060608", + "license": "Apache-2.0", + "gitHead": "110501ffb0313e417858dec92acf07522d4ded00", + "dependencies": { + "@hap-toolkit/dsl-vue": "0.6.13", + "@hap-toolkit/packager": "0.6.13", + "@hap-toolkit/server": "0.6.13", + "module-alias": "^2.1.0" + } +} diff --git a/packages/uni-template-compiler/lib/auto-components.js b/packages/uni-template-compiler/lib/auto-components.js index 5fea56b07af9b027795346f3b28c57f04cc5ebb7..da2a74f4f5dbb2e472141f3517e4141faab2a5e4 100644 --- a/packages/uni-template-compiler/lib/auto-components.js +++ b/packages/uni-template-compiler/lib/auto-components.js @@ -86,7 +86,10 @@ function compileTemplate (source, options, compile) { const compilerModule = { preTransformNode (el, options) { - if (isComponent(el.tag) && el.tag !== 'App') { // App.vue + if (process.env.UNI_PLATFORM === 'quickapp') { + // 排查所有标签 + (options.isUnaryTag.autoComponents || (options.isUnaryTag.autoComponents = new Set())).add(el.tag) + } else if (isComponent(el.tag) && el.tag !== 'App') { // App.vue // 挂在 isUnaryTag 上边,可以保证外部访问到 (options.isUnaryTag.autoComponents || (options.isUnaryTag.autoComponents = new Set())).add(el.tag) } @@ -95,4 +98,4 @@ const compilerModule = { module.exports = { compileTemplate, module: compilerModule -} +} diff --git a/packages/uni-template-compiler/lib/index.js b/packages/uni-template-compiler/lib/index.js index ff13c3db73f05cee8ba2fff9694fd4dc86b3959d..925dc967e2a7b88ade009a0c36ef6096f9d02bd7 100644 --- a/packages/uni-template-compiler/lib/index.js +++ b/packages/uni-template-compiler/lib/index.js @@ -72,9 +72,12 @@ module.exports = { console.error(source) throw e } + } else if (options.quickapp) { + // 后续改版,应统一由具体包实现 + (options.modules || (options.modules = [])).push(require('@dcloudio/uni-quickapp/lib/compiler-module')) } - if (!options.mp) { // h5 + if (!options.mp) { // h5,quickapp return compileTemplate(source, options, compile) } diff --git a/packages/vue-cli-plugin-uni/generator.js b/packages/vue-cli-plugin-uni/generator.js index adec6683d1b31b2907095559396d4ead6471d835..f29e0e74f1af4594eb7864a1dc4653bdad22df26 100644 --- a/packages/vue-cli-plugin-uni/generator.js +++ b/packages/vue-cli-plugin-uni/generator.js @@ -50,7 +50,8 @@ module.exports = (api, options, rootOptions) => { '@dcloudio/vue-cli-plugin-uni-optimize': version, '@dcloudio/webpack-uni-mp-loader': version, '@dcloudio/webpack-uni-pages-loader': version, - 'babel-plugin-import': '^1.11.0' + 'babel-plugin-import': '^1.11.0', + 'cross-env': '^7.0.2' }, browserslist: [ 'Android >= 4', diff --git a/packages/vue-cli-plugin-uni/index.js b/packages/vue-cli-plugin-uni/index.js index e86c7010f8d6d3a0904ae1ebea09b186cd73f7e9..212b6ac6cb2ce9bb17034c2c9a525ef0910862db 100644 --- a/packages/vue-cli-plugin-uni/index.js +++ b/packages/vue-cli-plugin-uni/index.js @@ -19,6 +19,28 @@ module.exports = (api, options) => { initBuildCommand(api, options) + if (process.env.UNI_PLATFORM === 'quickapp') { + process.env.UNI_OUTPUT_DIR = path.resolve(process.env.UNI_OUTPUT_DIR, 'build') + Object.assign(options, { + assetsDir, + parallel: false, + outputDir: process.env.UNI_OUTPUT_DIR + }) + require('./lib/options')(options) + const platformOptions = { + webpackConfig: {}, + chainWebpack () {} + } + const manifestPlatformOptions = {} + api.configureWebpack(require('./lib/configure-webpack')(platformOptions, manifestPlatformOptions, options, api)) + api.chainWebpack(require('./lib/chain-webpack')(platformOptions, options, api)) + + const vueConfig = require('@dcloudio/uni-quickapp/lib/vue.config.js') + api.configureWebpack(vueConfig.configureWebpack) + api.chainWebpack(vueConfig.chainWebpack) + return + } + const platformOptions = require('./lib/' + process.env.UNI_PLATFORM) let vueConfig = platformOptions.vueConfig diff --git a/packages/vue-cli-plugin-uni/lib/env.js b/packages/vue-cli-plugin-uni/lib/env.js index 2fd28fe77aa9294e8fea61bd0dcae3bf8933f502..ddfb9809e08b055c980b41ad9d756487d81120e1 100644 --- a/packages/vue-cli-plugin-uni/lib/env.js +++ b/packages/vue-cli-plugin-uni/lib/env.js @@ -18,27 +18,27 @@ if (process.env.UNI_CLOUD_SPACES) { if (spaces.length === 1) { const space = spaces[0] console.log(`本项目的uniCloud使用的默认服务空间spaceId为:${space.id}`) - } - process.env.UNI_CLOUD_PROVIDER = JSON.stringify(spaces.map(space => { - if (space.clientSecret) { - return { - provider: 'aliyun', - spaceName: space.name, - spaceId: space.id, - clientSecret: space.clientSecret, - endpoint: space.apiEndpoint - } - } else { - return { - provider: 'tencent', - spaceName: space.name, - spaceId: space.id - } - } + } + process.env.UNI_CLOUD_PROVIDER = JSON.stringify(spaces.map(space => { + if (space.clientSecret) { + return { + provider: 'aliyun', + spaceName: space.name, + spaceId: space.id, + clientSecret: space.clientSecret, + endpoint: space.apiEndpoint + } + } else { + return { + provider: 'tencent', + spaceName: space.name, + spaceId: space.id + } + } })) } } catch (e) {} -} +} if ( process.UNI_CLOUD && @@ -88,7 +88,7 @@ if (process.env.NODE_ENV === 'production') { // 发行模式,不启用 cache delete process.env.UNI_USING_CACHE } -const { +const { normalizePath, isSupportSubPackages, runByHBuilderX, @@ -120,6 +120,9 @@ if (Array.isArray(pagesJsonObj.subPackages)) { const manifestJsonObj = getManifestJson() const platformOptions = manifestJsonObj[process.env.UNI_PLATFORM] || {} +process.UNI_PAGES = pagesJsonObj +process.UNI_MANIFEST = manifestJsonObj + if (manifestJsonObj.debug) { process.env.VUE_APP_DEBUG = true } @@ -212,7 +215,7 @@ if (process.env.UNI_PLATFORM === 'app-plus') { normalizePath(path.resolve(process.env.UNI_INPUT_DIR, filepath)) ) } - } + } } else { // 其他平台,待确认配置方案 if ( manifestJsonObj['app-plus'] && diff --git a/packages/vue-cli-plugin-uni/packages/postcss/index.js b/packages/vue-cli-plugin-uni/packages/postcss/index.js index 0b1300e0351c9c07967df9c9e39444853f2da5d2..0b78b257366cb6a4221b7237117c4318cf8d7672 100644 --- a/packages/vue-cli-plugin-uni/packages/postcss/index.js +++ b/packages/vue-cli-plugin-uni/packages/postcss/index.js @@ -235,19 +235,20 @@ if (process.env.UNI_USING_V3) { // Transform each property declaration here decl.value = tranformValue(decl, opts) }) - - rule.selectors = rule.selectors.map(complexSelector => { - return transformSelector(complexSelector, simpleSelectors => { - return simpleSelectors.walkTags(tag => { - const k = tag.value - const v = CSS_TAGS[k] - if (v) { - tag.value = v === 'r' - ? `._${k}` : v - } - }) - }) - }) + if (process.env.UNI_PLATFORM !== 'quickapp') { + rule.selectors = rule.selectors.map(complexSelector => { + return transformSelector(complexSelector, simpleSelectors => { + return simpleSelectors.walkTags(tag => { + const k = tag.value + const v = CSS_TAGS[k] + if (v) { + tag.value = v === 'r' + ? `._${k}` : v + } + }) + }) + }) + } }) } } diff --git a/packages/webpack-uni-pages-loader/lib/index-new.js b/packages/webpack-uni-pages-loader/lib/index-new.js index 64c9716bd7304d537cde839c07f0cd83a0180c6b..b123e12355edcb9440e04a772f8f2b4e07300c22 100644 --- a/packages/webpack-uni-pages-loader/lib/index-new.js +++ b/packages/webpack-uni-pages-loader/lib/index-new.js @@ -69,6 +69,9 @@ module.exports = function (content) { if (process.env.UNI_PLATFORM === 'h5') { return require('./platforms/h5')(pagesJson, manifestJson) } + if (process.env.UNI_PLATFORM === 'quickapp') { + return require('./platforms/quickapp')(pagesJson, manifestJson, this) + } if (!process.env.UNI_USING_V3) { parsePages(pagesJson, function (page) { diff --git a/packages/webpack-uni-pages-loader/lib/index.js b/packages/webpack-uni-pages-loader/lib/index.js index 83d27c4c3bd7d21a9676836bce966800f7ca385b..33a71b3b0f3c42e98721d394aae1dc4bf31eb967 100644 --- a/packages/webpack-uni-pages-loader/lib/index.js +++ b/packages/webpack-uni-pages-loader/lib/index.js @@ -41,7 +41,11 @@ module.exports = function (content) { } } - if (process.env.UNI_USING_COMPONENTS || process.env.UNI_PLATFORM === 'h5') { + if ( + process.env.UNI_USING_COMPONENTS || + process.env.UNI_PLATFORM === 'h5' || + process.env.UNI_PLATFORM === 'quickapp' + ) { return require('./index-new').call(this, content) } diff --git a/packages/webpack-uni-pages-loader/lib/platforms/quickapp.js b/packages/webpack-uni-pages-loader/lib/platforms/quickapp.js index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e83a9c0ccc427a241d1651b4dda04d543b2b846c 100644 --- a/packages/webpack-uni-pages-loader/lib/platforms/quickapp.js +++ b/packages/webpack-uni-pages-loader/lib/platforms/quickapp.js @@ -0,0 +1,3 @@ +module.exports = function (pagesJson, manifestJson, loader) { + return require('@dcloudio/uni-quickapp/lib/manifest')(pagesJson, manifestJson, loader) +} diff --git a/src/platforms/app-plus/view/components/ad/index.vue b/src/platforms/app-plus/view/components/ad/index.vue index 48fb365c44cbb606304c1f9be82d4d18715d2ff2..bf3eb277a5e89ee60e48d3773f6fdad0bd8e4c97 100644 --- a/src/platforms/app-plus/view/components/ad/index.vue +++ b/src/platforms/app-plus/view/components/ad/index.vue @@ -141,6 +141,7 @@ export default { this._request() }, beforeDestroy () { + this.adView && this.adView.close() delete this.adView }, methods: { diff --git a/src/platforms/quickapp/helpers/Emitter.js b/src/platforms/quickapp/helpers/Emitter.js new file mode 100644 index 0000000000000000000000000000000000000000..66451c28a520f10f4cbe3c688b4e78207fc45679 --- /dev/null +++ b/src/platforms/quickapp/helpers/Emitter.js @@ -0,0 +1,29 @@ +export default class Emitter { + constructor () { + this._events = Object.create(null) + } + + on (event, fn) { + const vm = this + if (Array.isArray(event)) { + for (let i = 0, l = event.length; i < l; i++) { + vm.on(event[i], fn) + } + } else { + (vm._events[event] || (vm._events[event] = [])).push(fn) + } + return vm + } + + emit (event, ...args) { + const vm = this + const callbacks = vm._events[event] + if (callbacks) { + const cbs = callbacks.slice(0) + for (let i = 0, l = cbs.length; i < l; i++) { + cbs[i].apply(vm, args) + } + } + return vm + } +} diff --git a/src/platforms/quickapp/helpers/can-i-use.js b/src/platforms/quickapp/helpers/can-i-use.js new file mode 100644 index 0000000000000000000000000000000000000000..b1c6ea436a540020ff61f01dea449d5b39367b27 --- /dev/null +++ b/src/platforms/quickapp/helpers/can-i-use.js @@ -0,0 +1 @@ +export default {} diff --git a/src/platforms/quickapp/helpers/get-real-path.js b/src/platforms/quickapp/helpers/get-real-path.js new file mode 100644 index 0000000000000000000000000000000000000000..f0e5bdd6b94b97f36ace6da5cb225d260941aa49 --- /dev/null +++ b/src/platforms/quickapp/helpers/get-real-path.js @@ -0,0 +1,4 @@ +export { + default +} + from '../../h5/helpers/get-real-path' diff --git a/src/platforms/quickapp/runtime/app.js b/src/platforms/quickapp/runtime/app.js new file mode 100644 index 0000000000000000000000000000000000000000..aa6369fd59b4b13116ab68a0b8f3ed610d2d3bf1 --- /dev/null +++ b/src/platforms/quickapp/runtime/app.js @@ -0,0 +1,34 @@ +import globalRef from '../service/index' + +const injectRef = Object.getPrototypeOf(global) || global + +function parseRoutes ({ + pages +}) { + const routes = [] + Object.keys(pages).forEach((folder) => { + const options = pages[folder] + routes.push({ + path: '/' + folder + '/' + options.component, + meta: {} + }) + }) + return routes +} + +/* eslint-disable no-undef */ +dsl.onDefineApp(def => { + // 处理生命周期 + const hasOnLaunch = typeof def.onLaunch === 'function' + const hasOnShow = typeof def.onShow === 'function' + if (hasOnLaunch || hasOnShow) { + (inst._events['applc:onCreate'] || (inst._events['applc:onCreate'] = [])).push(() => { + hasOnLaunch && def.onLaunch() + hasOnShow && def.onShow() + }) + } + // __uniRoutes + injectRef.__uniRoutes = parseRoutes(def.manifest.router) +}) + +Object.assign(injectRef, globalRef) diff --git a/src/platforms/quickapp/runtime/bridge.js b/src/platforms/quickapp/runtime/bridge.js new file mode 100644 index 0000000000000000000000000000000000000000..af001629e35491651574c5e49038710d18ac3947 --- /dev/null +++ b/src/platforms/quickapp/runtime/bridge.js @@ -0,0 +1,6 @@ +import Emitter from '../helpers/Emitter' + +const injectRef = Object.getPrototypeOf(global) || global + +injectRef.UniServiceJSBridge = new Emitter() +injectRef.UniViewJSBridge = new Emitter() diff --git a/src/platforms/quickapp/runtime/page.js b/src/platforms/quickapp/runtime/page.js new file mode 100644 index 0000000000000000000000000000000000000000..b4dde19353d847cf9f8584936faf204d65c95903 --- /dev/null +++ b/src/platforms/quickapp/runtime/page.js @@ -0,0 +1,4 @@ +/* eslint-disable no-undef */ +if (typeof __VuePlugin !== 'undefined') { + Vue.use(__VuePlugin) +} diff --git a/src/platforms/quickapp/service/api.js b/src/platforms/quickapp/service/api.js new file mode 100644 index 0000000000000000000000000000000000000000..3e0c21de714857ca510e854562c89fb5c7b830fd --- /dev/null +++ b/src/platforms/quickapp/service/api.js @@ -0,0 +1,7 @@ +import * as baseApi from './base-api' +import * as platformApi from './platform-api' + +export default { + ...baseApi, + ...platformApi +} diff --git a/src/platforms/quickapp/service/api/route/navigate-back.js b/src/platforms/quickapp/service/api/route/navigate-back.js new file mode 100644 index 0000000000000000000000000000000000000000..b818b738fc527eb8f44a526b3dc0021c83858591 --- /dev/null +++ b/src/platforms/quickapp/service/api/route/navigate-back.js @@ -0,0 +1,11 @@ +import router from '@system.router' + +export function navigateBack ({ + delta +}) { + // TODO delta + router.back() + return { + errMsg: 'navigateBack:ok' + } +} diff --git a/src/platforms/quickapp/service/api/route/navigate-to.js b/src/platforms/quickapp/service/api/route/navigate-to.js new file mode 100644 index 0000000000000000000000000000000000000000..ed2b6ad4c08818be5dc5f0ff5675738bdb55acb2 --- /dev/null +++ b/src/platforms/quickapp/service/api/route/navigate-to.js @@ -0,0 +1,24 @@ +import { + parseQuery +} from 'uni-shared' + +import { + parseUri +} from './util' + +import router from '@system.router' + +export function navigateTo ({ + url +}) { + const urls = url.split('?') + const path = urls[0] + const query = parseQuery(urls[1] || '') + router.push({ + uri: parseUri(path), + params: query + }) + return { + errMsg: 'navigateTo:ok' + } +} diff --git a/src/platforms/quickapp/service/api/route/redirect-to.js b/src/platforms/quickapp/service/api/route/redirect-to.js new file mode 100644 index 0000000000000000000000000000000000000000..0c99863432162735f6eb8a377578295d2099f98f --- /dev/null +++ b/src/platforms/quickapp/service/api/route/redirect-to.js @@ -0,0 +1,24 @@ +import { + parseQuery +} from 'uni-shared' + +import { + parseUri +} from './util' + +import router from '@system.router' + +export function redirectTo ({ + url +}) { + const urls = url.split('?') + const path = urls[0] + const query = parseQuery(urls[1] || '') + router.replace({ + uri: parseUri(path), + params: query + }) + return { + errMsg: 'redirectTo:ok' + } +} diff --git a/src/platforms/quickapp/service/api/route/util.js b/src/platforms/quickapp/service/api/route/util.js new file mode 100644 index 0000000000000000000000000000000000000000..1e14180e9ce6bb880d11e56902d01e0a6bf34002 --- /dev/null +++ b/src/platforms/quickapp/service/api/route/util.js @@ -0,0 +1,3 @@ +export function parseUri (path) { + return path.substr(0, path.lastIndexOf('/')) +} diff --git a/src/platforms/quickapp/service/base-api.js b/src/platforms/quickapp/service/base-api.js new file mode 100644 index 0000000000000000000000000000000000000000..302b7c293a35dc6f1b302b7ceb1bb457dbca49df --- /dev/null +++ b/src/platforms/quickapp/service/base-api.js @@ -0,0 +1,9 @@ +// base +export * from 'uni-core/service/api/base/base64' +export * from 'uni-core/service/api/base/can-i-use' +export * from 'uni-core/service/api/base/interceptor' +export * from 'uni-core/service/api/base/upx2px' + +export * from 'uni-core/service/api/context/audio' +export * from 'uni-core/service/api/context/background-audio' +// TODO diff --git a/src/platforms/quickapp/service/bridge.js b/src/platforms/quickapp/service/bridge.js new file mode 100644 index 0000000000000000000000000000000000000000..3a2b6525075db0bc698fe2c4c448c5fb534d956d --- /dev/null +++ b/src/platforms/quickapp/service/bridge.js @@ -0,0 +1,3 @@ +export function invoke (...args) { + return global.UniServiceJSBridge.invokeCallbackHandler(...args) +} diff --git a/src/platforms/quickapp/service/framework/app.js b/src/platforms/quickapp/service/framework/app.js new file mode 100644 index 0000000000000000000000000000000000000000..e9a538e94144aa1c4a56ff10f1ac1d6152b0793f --- /dev/null +++ b/src/platforms/quickapp/service/framework/app.js @@ -0,0 +1,40 @@ +const defaultApp = { + globalData: {} +} + +function wrapper (def) { + if (def.__$processed) { + return def + } + const methods = def.methods + if (methods) { + Object.keys(methods).forEach(name => { + def[name] = methods[name] + }) + delete def.methods + } + // merge defaultApp + Object.keys(defaultApp).forEach(name => { + if (name !== 'globalData') { + def[name] = defaultApp[name] + } + }) + if (!def.globalData) { + def.globalData = {} + } + Object.assign(def.globalData, defaultApp.globalData) + def.__$processed = true + return def +} + +export function getApp ({ + allowDefault = false +} = {}) { + /* eslint-disable no-undef */ + if (inst.$def) { + return wrapper(inst.$def) + } + if (allowDefault) { // 返回默认实现 + return defaultApp + } +} diff --git a/src/platforms/quickapp/service/framework/page.js b/src/platforms/quickapp/service/framework/page.js new file mode 100644 index 0000000000000000000000000000000000000000..8800cfb88c352940b0ac7d5144440d9b76409126 --- /dev/null +++ b/src/platforms/quickapp/service/framework/page.js @@ -0,0 +1,4 @@ +// TODO 需要自己维护路由堆栈? +export function getCurrentPages () { + return [] +} diff --git a/src/platforms/quickapp/service/framework/vue.js b/src/platforms/quickapp/service/framework/vue.js new file mode 100644 index 0000000000000000000000000000000000000000..1b4a4bc9bfe13f8b2c51efbd6b59249ca1fab4d5 --- /dev/null +++ b/src/platforms/quickapp/service/framework/vue.js @@ -0,0 +1,63 @@ +// 目前仅支持 store, use, mixin, component, prototype + +let store +const mixins = [] +const plugins = [] +const components = [] + +// fake +function Vue (options) { + if (options && options.store) { + store = options.store + } +} + +Vue.prototype.$mount = function () {} + +Vue.config = {} + +Vue.use = function (plugin) { + plugins.push(plugin) +} + +Vue.mixin = function (mixin) { + mixins.push(mixin) +} + +Vue.component = function (id, definition) { + components.push({ + id, + definition + }) +} + +const injectRef = Object.getPrototypeOf(global) || global + +injectRef.__VuePlugin = { + install (PageVue, options) { + mixins.forEach(mixin => { + PageVue.mixin(mixin) + }) + + plugins.forEach(plugin => { + PageVue.use(plugin) + }) + + components.forEach(({ + id, + definition + }) => { + PageVue.component(id, definition) + }) + + Object.keys(Vue.prototype).forEach(name => { + if (name !== '$mount') { + PageVue.prototype[name] = Vue.prototype[name] + } + }) + + store && (PageVue.prototype.$store = store) + } +} + +export default Vue diff --git a/src/platforms/quickapp/service/index.js b/src/platforms/quickapp/service/index.js new file mode 100644 index 0000000000000000000000000000000000000000..401263ab8f54e6e367f410585f2fd0ae74461e7a --- /dev/null +++ b/src/platforms/quickapp/service/index.js @@ -0,0 +1,28 @@ +import { + uni +} from 'uni-core/service/uni' + +import { + invokeCallbackHandler +} from 'uni-helpers/api' + +import Vue from './framework/vue' + +import { + getApp +} from './framework/app' + +import { + getCurrentPages +} from './framework/page' + +global.UniServiceJSBridge.invokeCallbackHandler = invokeCallbackHandler + +// TODO 补充__uniRoutes?路由校验那里用到了 + +export default { + uni, + Vue, + getApp, + getCurrentPages +} diff --git a/src/platforms/quickapp/service/invoke-api.js b/src/platforms/quickapp/service/invoke-api.js new file mode 100644 index 0000000000000000000000000000000000000000..54ea567e9f4b48e57050f8dcd7d8f017a49bda02 --- /dev/null +++ b/src/platforms/quickapp/service/invoke-api.js @@ -0,0 +1,3 @@ +import * as api from './platform-api' + +export default api diff --git a/src/platforms/quickapp/service/platform-api.js b/src/platforms/quickapp/service/platform-api.js new file mode 100644 index 0000000000000000000000000000000000000000..a36bfa45f872d6adfc8597c7f748f5178013e572 --- /dev/null +++ b/src/platforms/quickapp/service/platform-api.js @@ -0,0 +1,3 @@ +export * from './api/route/navigate-back' +export * from './api/route/navigate-to' +export * from './api/route/redirect-to' diff --git a/src/platforms/quickapp/service/publish-handler.js b/src/platforms/quickapp/service/publish-handler.js new file mode 100644 index 0000000000000000000000000000000000000000..13b05913ea4ca6ad10af3db9da66bfd0f692dbb4 --- /dev/null +++ b/src/platforms/quickapp/service/publish-handler.js @@ -0,0 +1,3 @@ +export function publishHandler (event, args, pageId) { + // TODO +} diff --git a/src/platforms/quickapp/view/components/button/button.vue b/src/platforms/quickapp/view/components/button/button.vue new file mode 100644 index 0000000000000000000000000000000000000000..1c88399143d910d5502fd7ab10a8c0325536973c --- /dev/null +++ b/src/platforms/quickapp/view/components/button/button.vue @@ -0,0 +1,14 @@ + + + diff --git a/yarn.lock b/yarn.lock index 1b458b27018fe239cc47da5ffecbf84e0367eed2..b81b32132fa277a954b984ed70148a7b10c017c2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5640,6 +5640,12 @@ magic-string@^0.25.2: dependencies: sourcemap-codec "^1.4.4" +magic-string@^0.25.3: + version "0.25.7" + resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" + dependencies: + sourcemap-codec "^1.4.4" + make-dir@^2.0.0, make-dir@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" @@ -7515,6 +7521,14 @@ rollup-plugin-commonjs@^10.0.1: resolve "^1.11.0" rollup-pluginutils "^2.8.1" +rollup-plugin-inject@^3.0.2: + version "3.0.2" + resolved "https://registry.npmjs.org/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz#e4233855bfba6c0c12a312fd6649dff9a13ee9f4" + dependencies: + estree-walker "^0.6.1" + magic-string "^0.25.3" + rollup-pluginutils "^2.8.1" + rollup-plugin-node-resolve@^5.2.0: version "5.2.0" resolved "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz#730f93d10ed202473b1fb54a5997a7db8c6d8523" @@ -7532,6 +7546,16 @@ rollup-plugin-replace@^2.1.0: magic-string "^0.25.2" rollup-pluginutils "^2.6.0" +rollup-plugin-terser@^5.2.0: + version "5.2.0" + resolved "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-5.2.0.tgz#ba758adf769347b7f1eaf9ef35978d2e207dccc7" + dependencies: + "@babel/code-frame" "^7.5.5" + jest-worker "^24.9.0" + rollup-pluginutils "^2.8.2" + serialize-javascript "^2.1.2" + terser "^4.6.2" + rollup-plugin-uglify@^6.0.3: version "6.0.4" resolved "https://registry.npmjs.org/rollup-plugin-uglify/-/rollup-plugin-uglify-6.0.4.tgz#65a0959d91586627f1e46a7db966fd504ec6c4e6" @@ -7541,7 +7565,7 @@ rollup-plugin-uglify@^6.0.3: serialize-javascript "^2.1.2" uglify-js "^3.4.9" -rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.1: +rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.1, rollup-pluginutils@^2.8.2: version "2.8.2" resolved "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" dependencies: @@ -8289,6 +8313,14 @@ terser@^4.1.2, terser@^4.4.3: source-map "~0.6.1" source-map-support "~0.5.12" +terser@^4.6.2: + version "4.6.6" + resolved "https://registry.npmjs.org/terser/-/terser-4.6.6.tgz#da2382e6cafbdf86205e82fb9a115bd664d54863" + dependencies: + commander "^2.20.0" + source-map "~0.6.1" + source-map-support "~0.5.12" + test-exclude@^5.2.3: version "5.2.3" resolved "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz#c3d3e1e311eb7ee405e092dac10aefd09091eac0"