diff --git a/build/webpack.config.js b/build/webpack.config.js
index 72c5e91f406ad958b996563f15a7e7671bf8d140..3278949e9343d0390bd8f9006674de3e1df845ff 100644
--- a/build/webpack.config.js
+++ b/build/webpack.config.js
@@ -42,8 +42,8 @@ module.exports = {
}),
new webpack.ProvidePlugin({
'console': [resolve('src/core/helpers/console'), 'default'],
- 'UniViewJSBridge': [resolve('src/core/view/bridge')],
- 'UniServiceJSBridge': [resolve('src/core/service/bridge')]
+ 'UniViewJSBridge': [resolve('src/core/view/bridge/index')],
+ 'UniServiceJSBridge': [resolve('src/core/service/bridge/index')]
})
]
}
diff --git a/build/webpack.config.test.js b/build/webpack.config.test.js
index 0c1681d8d2a5a1b2f957b8b0305ee7abffa7815e..c5111533f3e4170b7096530096b44b158f229ce4 100644
--- a/build/webpack.config.test.js
+++ b/build/webpack.config.test.js
@@ -41,8 +41,8 @@ config.plugins = config.plugins.concat([
}),
new webpack.ProvidePlugin({
'console': [resolve('src/core/helpers/console'), 'default'],
- 'UniViewJSBridge': [resolve('src/core/view/bridge')],
- 'UniServiceJSBridge': [resolve('src/core/service/bridge')]
+ 'UniViewJSBridge': [resolve('src/core/view/bridge/index')],
+ 'UniServiceJSBridge': [resolve('src/core/service/bridge/index')]
})
])
module.exports = config
diff --git a/lib/h5/main.js b/lib/h5/main.js
index 89656dca6246e7f3bdc2aacf5a7319d4e2ebdfa2..821b6b7ccd88fa1ac79087c719c0ed15d21e3bce 100644
--- a/lib/h5/main.js
+++ b/lib/h5/main.js
@@ -17,7 +17,7 @@ const {
default: uni,
getApp,
getCurrentPages
-} = require('uni-service')
+} = require('uni-platform/service/index')
global.uni = uni
@@ -36,4 +36,4 @@ Vue.use(require('uni-view/plugins').default, {
require('uni-core/vue')
require('uni-platform/components')
-// require('uni-components')
+require('uni-components')
diff --git a/package.json b/package.json
index 70ee0d6adc2ebf477574fe30cbb00a5a463e592d..e450eeb5c84261664f657690bebd2ed8f1a16d60 100644
--- a/package.json
+++ b/package.json
@@ -83,6 +83,7 @@
"wx": true,
"my": true,
"swan": true,
+ "weex": true,
"__id__": true,
"__uniConfig": true,
"__uniRoutes": true,
diff --git a/packages/uni-app-plus-nvue/dist/index.js b/packages/uni-app-plus-nvue/dist/index.js
index 486c5a644421cddeead0fd8d00d88d832e092403..24a6e0a46c80b4ab839df1853666265e2aaa44be 100644
--- a/packages/uni-app-plus-nvue/dist/index.js
+++ b/packages/uni-app-plus-nvue/dist/index.js
@@ -529,7 +529,7 @@ function initServiceJSBridge (Vue, instanceContext) {
on: Emitter.$on.bind(Emitter),
off: Emitter.$off.bind(Emitter),
once: Emitter.$once.bind(Emitter),
- emit: Emitter.$emit.bind(Emitter)
+ emit: Emitter.$emit.bind(Emitter)
};
initOn(bridge.on, instanceContext);
diff --git a/packages/uni-app-plus-nvue/dist/uni.js b/packages/uni-app-plus-nvue/dist/uni.js
index b5ce218e0e7d2d505f4d24873b6573406ca27934..838887ec08eae290015b6b8228124d3a93780e3b 100644
--- a/packages/uni-app-plus-nvue/dist/uni.js
+++ b/packages/uni-app-plus-nvue/dist/uni.js
@@ -2182,171 +2182,6 @@ var require_context_module_0_2 = /*#__PURE__*/Object.freeze({
removeInterceptor: removeInterceptor
});
-function pageScrollTo$1 (args) {
- const pages = getCurrentPages();
- if (pages.length) {
- UniServiceJSBridge.publishHandler('pageScrollTo', args, pages[pages.length - 1].$page.id);
- }
- return {}
-}
-
-let pageId;
-
-function setPullDownRefreshPageId (pullDownRefreshPageId) {
- pageId = pullDownRefreshPageId;
-}
-
-function startPullDownRefresh () {
- if (pageId) {
- UniServiceJSBridge.emit(pageId + '.stopPullDownRefresh', {}, pageId);
- }
- const pages = getCurrentPages();
- if (pages.length) {
- pageId = pages[pages.length - 1].$page.id;
- UniServiceJSBridge.emit(pageId + '.startPullDownRefresh', {}, pageId);
- }
- return {}
-}
-
-function stopPullDownRefresh () {
- if (pageId) {
- UniServiceJSBridge.emit(pageId + '.stopPullDownRefresh', {}, pageId);
- pageId = null;
- } else {
- const pages = getCurrentPages();
- if (pages.length) {
- pageId = pages[pages.length - 1].$page.id;
- UniServiceJSBridge.emit(pageId + '.stopPullDownRefresh', {}, pageId);
- }
- }
- return {}
-}
-
-var require_context_module_0_3 = /*#__PURE__*/Object.freeze({
- pageScrollTo: pageScrollTo$1,
- setPullDownRefreshPageId: setPullDownRefreshPageId,
- startPullDownRefresh: startPullDownRefresh,
- stopPullDownRefresh: stopPullDownRefresh
-});
-
-function setStorage$1 ({
- key,
- data
-} = {}) {
- const value = {
- type: typeof data === 'object' ? 'object' : 'string',
- data: data
- };
- localStorage.setItem(key, JSON.stringify(value));
- const keyList = localStorage.getItem('uni-storage-keys');
- if (!keyList) {
- localStorage.setItem('uni-storage-keys', JSON.stringify([key]));
- } else {
- const keys = JSON.parse(keyList);
- if (keys.indexOf(key) < 0) {
- keys.push(key);
- localStorage.setItem('uni-storage-keys', JSON.stringify(keys));
- }
- }
- return {
- errMsg: 'setStorage:ok'
- }
-}
-
-function setStorageSync$1 (key, data) {
- setStorage$1({
- key,
- data
- });
-}
-
-function getStorage ({
- key
-} = {}) {
- const data = localStorage.getItem(key);
- return data ? {
- data: JSON.parse(data).data,
- errMsg: 'getStorage:ok'
- } : {
- data: '',
- errMsg: 'getStorage:fail'
- }
-}
-
-function getStorageSync (key) {
- const res = getStorage({
- key
- });
- return res.data
-}
-
-function removeStorage ({
- key
-} = {}) {
- const keyList = localStorage.getItem('uni-storage-keys');
- if (keyList) {
- const keys = JSON.parse(keyList);
- const index = keys.indexOf(key);
- keys.splice(index, 1);
- localStorage.setItem('uni-storage-keys', JSON.stringify(keys));
- }
- localStorage.removeItem(key);
- return {
- errMsg: 'removeStorage:ok'
- }
-}
-
-function removeStorageSync (key) {
- removeStorage({
- key
- });
-}
-
-function clearStorage () {
- localStorage.clear();
- return {
- errMsg: 'clearStorage:ok'
- }
-}
-
-function clearStorageSync () {
- clearStorage();
-}
-
-function getStorageInfo () { // TODO 暂时先不做大小的转换
- const keyList = localStorage.getItem('uni-storage-keys');
- return keyList ? {
- keys: JSON.parse(keyList),
- currentSize: 0,
- limitSize: 0,
- errMsg: 'getStorageInfo:ok'
- } : {
- keys: '',
- currentSize: 0,
- limitSize: 0,
- errMsg: 'getStorageInfo:fail'
- }
-}
-
-function getStorageInfoSync () {
- const res = getStorageInfo();
- delete res.errMsg;
- return res
-}
-
-var require_context_module_0_4 = /*#__PURE__*/Object.freeze({
- setStorage: setStorage$1,
- setStorageSync: setStorageSync$1,
- getStorage: getStorage,
- getStorageSync: getStorageSync,
- removeStorage: removeStorage,
- removeStorageSync: removeStorageSync,
- clearStorage: clearStorage,
- clearStorageSync: clearStorageSync,
- getStorageInfo: getStorageInfo,
- getStorageInfoSync: getStorageInfoSync
-});
-
const EPS = 1e-4;
const BASE_DEVICE_WIDTH = 750;
let isIOS = false;
@@ -2365,4181 +2200,189 @@ function checkDeviceWidth () {
isIOS = platform === 'ios';
}
-function upx2px (number, newDeviceWidth) {
- if (deviceWidth === 0) {
- checkDeviceWidth();
- }
-
- number = Number(number);
- if (number === 0) {
- return 0
- }
- let result = (number / BASE_DEVICE_WIDTH) * (newDeviceWidth || deviceWidth);
- if (result < 0) {
- result = -result;
- }
- result = Math.floor(result + EPS);
- if (result === 0) {
- if (deviceDPR === 1 || !isIOS) {
- return 1
- } else {
- return 0.5
- }
- }
- return number < 0 ? -result : result
-}
-
-var require_context_module_0_5 = /*#__PURE__*/Object.freeze({
- upx2px: upx2px
-});
-
-const api = Object.create(null);
-
-const modules$1 =
- (function() {
- var map = {
- './base64.js': require_context_module_0_0,
-'./can-i-use.js': require_context_module_0_1,
-'./interceptor.js': require_context_module_0_2,
-'./page-event.js': require_context_module_0_3,
-'./storage.js': require_context_module_0_4,
-'./upx2px.js': require_context_module_0_5,
-
- };
- var req = function req(key) {
- return map[key] || (function() { throw new Error("Cannot find module '" + key + "'.") }());
- };
- req.keys = function() {
- return Object.keys(map);
- };
- return req;
- })();
-
-
-modules$1.keys().forEach(function (key) {
- Object.assign(api, modules$1(key));
-});
-
-function getLastWebview () {
- try {
- const pages = getCurrentPages();
- if (pages.length) {
- return pages[pages.length - 1].$getAppWebview()
- }
- } catch (e) {
- if (process.env.NODE_ENV !== 'production') {
- console.log('getCurrentPages is not ready');
- }
- }
-}
-
-function isTabBarPage (route = '') {
- if (!(__uniConfig.tabBar && Array.isArray(__uniConfig.tabBar.list))) {
- return false
- }
- try {
- if (!route) {
- const pages = getCurrentPages();
- if (!pages.length) {
- return false
- }
- const page = pages[pages.length - 1];
- if (!page) {
- return false
- }
- route = page.route;
- }
- return !!__uniConfig.tabBar.list.find(tabBarPage => {
- const pagePath = tabBarPage.pagePath;
- return pagePath === route || pagePath === (route + '.html')
- })
- } catch (e) {
- if (process.env.NODE_ENV !== 'production') {
- console.log('getCurrentPages is not ready');
- }
- }
- return false
-}
-
-const getRealRoute$1 = (e, t) => {
- if (t.indexOf('./') === 0) return getRealRoute$1(e, t.substr(2))
- let n;
- let i;
- let o = t.split('/');
- for (n = 0, i = o.length; n < i && o[n] === '..'; n++);
- o.splice(0, n);
- t = o.join('/');
- let r = e.length > 0 ? e.split('/') : [];
- r.splice(r.length - n - 1, n + 1);
- return r.concat(o).join('/')
-};
-
-// 处理 Android 平台解压与非解压模式下获取的路径不一致的情况
-const _handleLocalPath = filePath => {
- let localUrl = plus.io.convertLocalFileSystemURL(filePath);
- return localUrl.replace(/^\/?apps\//, '/android_asset/apps/').replace(/\/$/, '')
-};
-
-function getRealPath$1 (filePath) {
- const SCHEME_RE = /^([a-z-]+:)?\/\//i;
- const BASE64_RE = /^data:[a-z-]+\/[a-z-]+;base64,/;
-
- // 无协议的情况补全 https
- if (filePath.indexOf('//') === 0) {
- filePath = 'https:' + filePath;
- }
-
- // 网络资源或base64
- if (SCHEME_RE.test(filePath) || BASE64_RE.test(filePath)) {
- return filePath
- }
-
- if (filePath.indexOf('_www') === 0 || filePath.indexOf('_doc') === 0 || filePath.indexOf('_documents') === 0 ||
- filePath.indexOf('_downloads') === 0) {
- return 'file://' + _handleLocalPath(filePath)
- }
- const wwwPath = 'file://' + _handleLocalPath('_www');
- // 绝对路径转换为本地文件系统路径
- if (filePath.indexOf('/') === 0) {
- return wwwPath + filePath
- }
- // 相对资源
- if (filePath.indexOf('../') === 0 || filePath.indexOf('./') === 0) {
- if (typeof __id__ === 'string') {
- return wwwPath + getRealRoute$1('/' + __id__, filePath)
- } else {
- const pages = getCurrentPages();
- if (pages.length) {
- return wwwPath + getRealRoute$1('/' + pages[pages.length - 1].route, filePath)
- }
- }
- }
- return filePath
-}
-
-function getStatusBarStyle () {
- let style = plus.navigator.getStatusBarStyle();
- if (style === 'UIStatusBarStyleBlackTranslucent' || style === 'UIStatusBarStyleBlackOpaque' || style === 'null') {
- style = 'light';
- } else if (style === 'UIStatusBarStyleDefault') {
- style = 'dark';
- }
- return style
-}
-
-const PI = 3.1415926535897932384626;
-const a = 6378245.0;
-const ee = 0.00669342162296594323;
-
-function wgs84togcj02 (lng, lat) {
- lat = +lat;
- lng = +lng;
- if (outOfChina(lng, lat)) {
- return [lng, lat]
- }
- let dlat = _transformlat(lng - 105.0, lat - 35.0);
- let dlng = _transformlng(lng - 105.0, lat - 35.0);
- const radlat = lat / 180.0 * PI;
- let magic = Math.sin(radlat);
- magic = 1 - ee * magic * magic;
- const sqrtmagic = Math.sqrt(magic);
- dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
- dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
- const mglat = lat + dlat;
- const mglng = lng + dlng;
- return [mglng, mglat]
-}
-
-function gcj02towgs84 (lng, lat) {
- lat = +lat;
- lng = +lng;
- if (outOfChina(lng, lat)) {
- return [lng, lat]
- }
- let dlat = _transformlat(lng - 105.0, lat - 35.0);
- let dlng = _transformlng(lng - 105.0, lat - 35.0);
- const radlat = lat / 180.0 * PI;
- let magic = Math.sin(radlat);
- magic = 1 - ee * magic * magic;
- const sqrtmagic = Math.sqrt(magic);
- dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
- dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
- const mglat = lat + dlat;
- const mglng = lng + dlng;
- return [lng * 2 - mglng, lat * 2 - mglat]
-}
-
-const _transformlat = function (lng, lat) {
- let ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
- ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0;
- ret += (20.0 * Math.sin(lat * PI) + 40.0 * Math.sin(lat / 3.0 * PI)) * 2.0 / 3.0;
- ret += (160.0 * Math.sin(lat / 12.0 * PI) + 320 * Math.sin(lat * PI / 30.0)) * 2.0 / 3.0;
- return ret
-};
-const _transformlng = function (lng, lat) {
- let ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
- ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0;
- ret += (20.0 * Math.sin(lng * PI) + 40.0 * Math.sin(lng / 3.0 * PI)) * 2.0 / 3.0;
- ret += (150.0 * Math.sin(lng / 12.0 * PI) + 300.0 * Math.sin(lng / 30.0 * PI)) * 2.0 / 3.0;
- return ret
-};
-
-const outOfChina = function (lng, lat) {
- return (lng < 72.004 || lng > 137.8347) || ((lat < 0.8293 || lat > 55.8271) || false)
-};
-
-function requireNativePlugin (name) {
- return uni.requireNativePlugin(name)
-}
-
-function unpack (args) {
- return args
-}
-
-function invoke (...args) {
- return UniServiceJSBridge.invokeCallbackHandler(...args)
-}
-
-function publish (...args) {
- return UniServiceJSBridge.publish(...args)
-}
-
-let audios = {};
-
-const evts = ['play', 'canplay', 'ended', 'stop', 'waiting', 'seeking', 'seeked', 'pause'];
-
-const publishAudioStateChange = (state, res = {}) => publish('onAudioStateChange', Object.assign({
- state
-}, res));
-
-const initStateChage = audioId => {
- const audio = audios[audioId];
- if (!audio) {
- return
- }
- if (!audio.initStateChage) {
- audio.initStateChage = true;
-
- audio.addEventListener('error', error => {
- publishAudioStateChange('error', {
- audioId,
- errMsg: 'MediaError',
- errCode: error.code
- });
- });
-
- evts.forEach(event => {
- audio.addEventListener(event, () => {
- // 添加 isStopped 属性是为了解决 安卓设备停止播放后获取播放进度不正确的问题
- if (event === 'play') {
- audio.isStopped = false;
- } else if (event === 'stop') {
- audio.isStopped = true;
- }
- publishAudioStateChange(event, {
- audioId
- });
- });
- });
- }
-};
-
-function createAudioInstance () {
- const audioId = `${Date.now()}${Math.random()}`;
- const audio = audios[audioId] = plus.audio.createPlayer('');
- audio.src = '';
- audio.volume = 1;
- audio.startTime = 0;
- return {
- errMsg: 'createAudioInstance:ok',
- audioId
- }
-}
-
-function destroyAudioInstance ({
- audioId
-}) {
- if (audios[audioId]) {
- audios[audioId].close();
- delete audios[audioId];
- }
- return {
- errMsg: 'destroyAudioInstance:ok',
- audioId
- }
-}
-
-function setAudioState ({
- audioId,
- src,
- startTime,
- autoplay = false,
- loop = false,
- obeyMuteSwitch,
- volume
-}) {
- const audio = audios[audioId];
- if (audio) {
- let style = {
- loop,
- autoplay
- };
- if (src) {
- audio.src = style.src = getRealPath$1(src);
- }
- if (startTime) {
- audio.startTime = style.startTime = startTime;
- }
- if (typeof volume === 'number') {
- audio.volume = style.volume = volume;
- }
- audio.setStyles(style);
- initStateChage(audioId);
- }
- return {
- errMsg: 'setAudioState:ok'
- }
-}
-
-function getAudioState ({
- audioId
-}) {
- const audio = audios[audioId];
- if (!audio) {
- return {
- errMsg: 'getAudioState:fail'
- }
- }
- let {
- src,
- startTime,
- volume
- } = audio;
-
- return {
- errMsg: 'getAudioState:ok',
- duration: 1e3 * (audio.getDuration() || 0),
- currentTime: audio.isStopped ? 0 : 1e3 * audio.getPosition(),
- paused: audio.isPaused,
- src,
- volume,
- startTime: 1e3 * startTime,
- buffered: 1e3 * audio.getBuffered()
- }
-}
-
-function operateAudio ({
- operationType,
- audioId,
- currentTime
-}) {
- const audio = audios[audioId];
- const operationTypes = ['play', 'pause', 'stop'];
- if (operationTypes.indexOf(operationType) >= 0) {
- audio[operationType === operationTypes[0] && audio.isPaused ? 'resume' : operationType]();
- } else if (operationType === 'seek') {
- audio.seekTo(currentTime / 1e3);
- }
- return {
- errMsg: 'operateAudio:ok'
- }
-}
-
-let audio;
-
-const publishBackgroundAudioStateChange = (state, res = {}) => publish('onBackgroundAudioStateChange', Object.assign({
- state
-}, res));
-
-const events = ['play', 'pause', 'ended', 'stop'];
-
-function initMusic () {
- if (audio) {
- return
- }
- audio = plus.audio.createPlayer({
- autoplay: true,
- backgroundControl: true
- });
- audio.src = audio.title = audio.epname = audio.singer = audio.coverImgUrl = audio.webUrl = '';
- audio.startTime = 0;
- events.forEach(event => {
- audio.addEventListener(event, () => {
- // 添加 isStopped 属性是为了解决 安卓设备停止播放后获取播放进度不正确的问题
- if (event === 'play') {
- audio.isStopped = false;
- } else if (event === 'stop') {
- audio.isStopped = true;
- }
- const eventName = `onMusic${event[0].toUpperCase() + event.substr(1)}`;
- publish(eventName, {
- dataUrl: audio.src,
- errMsg: `${eventName}:ok`
- });
- publishBackgroundAudioStateChange(event, {
- dataUrl: audio.src
- });
- });
- });
- audio.addEventListener('waiting', () => {
- publishBackgroundAudioStateChange('waiting', {
- dataUrl: audio.src
- });
- });
- audio.addEventListener('error', err => {
- publish('onMusicError', {
- dataUrl: audio.src,
- errMsg: 'Error:' + err.message
- });
- publishBackgroundAudioStateChange('error', {
- dataUrl: audio.src,
- errMsg: err.message,
- errCode: err.code
- });
- });
- audio.addEventListener('prev', () => publish('onBackgroundAudioPrev'));
- audio.addEventListener('next', () => publish('onBackgroundAudioNext'));
-}
-
-function setMusicState (args) {
- initMusic();
- const props = ['src', 'startTime', 'coverImgUrl', 'webUrl', 'singer', 'epname', 'title'];
- const style = {};
- Object.keys(args).forEach(key => {
- if (props.indexOf(key) >= 0) {
- let val = args[key];
- if (key === props[0] && val) {
- val = getRealPath$1(val);
- }
- audio[key] = style[key] = val;
- }
- });
- audio.setStyles(style);
-}
-
-function getAudio () {
- return audio
-}
-
-function getMusicPlayerState () {
- const audio = getAudio();
- if (audio) {
- return {
- dataUrl: audio.src,
- duration: audio.getDuration() || 0,
- currentPosition: audio.getPosition(),
- status: audio.isPaused ? 0 : 1,
- downloadPercent: Math.round(100 * audio.getBuffered() / audio.getDuration()),
- errMsg: `getMusicPlayerState:ok`
- }
- }
- return {
- status: 2,
- errMsg: `getMusicPlayerState:ok`
- }
-}
-function operateMusicPlayer ({
- operationType,
- dataUrl,
- position,
- api = 'operateMusicPlayer',
- title,
- coverImgUrl
-}) {
- const audio = getAudio();
- var operationTypes = ['resume', 'pause', 'stop'];
- if (operationTypes.indexOf(operationType) > 0) {
- audio && audio[operationType]();
- } else if (operationType === 'play') {
- setMusicState({
- src: dataUrl,
- startTime: position,
- title,
- coverImgUrl
- });
- audio.play();
- } else if (operationType === 'seek') {
- audio && audio.seekTo(position);
- }
- return {
- errMsg: `${api}:ok`
- }
-}
-function setBackgroundAudioState (args) {
- setMusicState(args);
- return {
- errMsg: `setBackgroundAudioState:ok`
- }
-}
-function operateBackgroundAudio ({
- operationType,
- src,
- startTime,
- currentTime
-}) {
- return operateMusicPlayer({
- operationType,
- dataUrl: src,
- position: startTime || currentTime || 0,
- api: 'operateBackgroundAudio'
- })
-}
-function getBackgroundAudioState () {
- let data = {
- duration: 0,
- currentTime: 0,
- paused: false,
- src: '',
- buffered: 0,
- title: '',
- epname: '',
- singer: '',
- coverImgUrl: '',
- webUrl: '',
- startTime: 0,
- errMsg: `getBackgroundAudioState:ok`
- };
- const audio = getAudio();
- if (audio) {
- let newData = {
- duration: audio.getDuration() || 0,
- currentTime: audio.isStopped ? 0 : audio.getPosition(),
- paused: audio.isPaused,
- src: audio.src,
- buffered: audio.getBuffered(),
- title: audio.title,
- epname: audio.epname,
- singer: audio.singer,
- coverImgUrl: audio.coverImgUrl,
- webUrl: audio.webUrl,
- startTime: audio.startTime
- };
- data = Object.assign(data, newData);
- }
- return data
-}
-
-const DEVICE_FREQUENCY = 200;
-const NETWORK_TYPES = ['unknown', 'none', 'ethernet', 'wifi', '2g', '3g', '4g'];
-
-const MAP_ID = '__UNIAPP_MAP';
-
-const TEMP_PATH_BASE = '_doc/uniapp_temp';
-const TEMP_PATH = `${TEMP_PATH_BASE}_${Date.now()}`;
-
-let watchAccelerationId = false;
-let isWatchAcceleration = false;
-
-const clearWatchAcceleration = () => {
- if (watchAccelerationId) {
- plus.accelerometer.clearWatch(watchAccelerationId);
- watchAccelerationId = false;
- }
-};
-
-function enableAccelerometer ({
- enable
-}) {
- if (enable) { // 启用监听
- clearWatchAcceleration();
- watchAccelerationId = plus.accelerometer.watchAcceleration((res) => {
- publish('onAccelerometerChange', {
- x: res.xAxis,
- y: res.yAxis,
- z: res.zAxis,
- errMsg: 'enableAccelerometer:ok'
- });
- }, (e) => {
- publish('onAccelerometerChange', {
- errMsg: 'enableAccelerometer:fail'
- });
- }, {
- frequency: DEVICE_FREQUENCY
- });
- if (!isWatchAcceleration) {
- isWatchAcceleration = true;
- const webview = getLastWebview();
- if (webview) {
- webview.addEventListener('close', clearWatchAcceleration);
- }
- }
- } else {
- clearWatchAcceleration();
- }
- return {
- errMsg: 'enableAccelerometer:ok'
- }
-}
-
-function addPhoneContact ({
- photoFilePath = '',
- nickName,
- lastName,
- middleName,
- firstName,
- remark,
- mobilePhoneNumber,
- weChatNumber,
- addressCountry,
- addressState,
- addressCity,
- addressStreet,
- addressPostalCode,
- organization,
- title,
- workFaxNumber,
- workPhoneNumber,
- hostNumber,
- email,
- url,
- workAddressCountry,
- workAddressState,
- workAddressCity,
- workAddressStreet,
- workAddressPostalCode,
- homeFaxNumber,
- homePhoneNumber,
- homeAddressCountry,
- homeAddressState,
- homeAddressCity,
- homeAddressStreet,
- homeAddressPostalCode
-} = {}, callbackId) {
- plus.contacts.getAddressBook(plus.contacts.ADDRESSBOOK_PHONE, (addressbook) => {
- const contact = addressbook.create();
- const name = {};
- if (lastName) {
- name.familyName = lastName;
- }
- if (firstName) {
- name.givenName = firstName;
- }
- if (middleName) {
- name.middleName = middleName;
- }
- contact.name = name;
-
- if (nickName) {
- contact.nickname = nickName;
- }
-
- if (photoFilePath) {
- contact.photos = [{
- type: 'url',
- value: photoFilePath
- }];
- }
-
- if (remark) {
- contact.note = remark;
- }
-
- const mobilePhone = {
- type: 'mobile'
- };
-
- const workPhone = {
- type: 'work'
- };
-
- const companyPhone = {
- type: 'company'
- };
-
- const homeFax = {
- type: 'home fax'
- };
-
- const workFax = {
- type: 'work fax'
- };
-
- if (mobilePhoneNumber) {
- mobilePhone.value = mobilePhoneNumber;
- }
-
- if (workPhoneNumber) {
- workPhone.value = workPhoneNumber;
- }
-
- if (hostNumber) {
- companyPhone.value = hostNumber;
- }
-
- if (homeFaxNumber) {
- homeFax.value = homeFaxNumber;
- }
-
- if (workFaxNumber) {
- workFax.value = workFaxNumber;
- }
-
- contact.phoneNumbers = [mobilePhone, workPhone, companyPhone, homeFax, workFax];
-
- if (email) {
- contact.emails = [{
- type: 'home',
- value: email
- }];
- }
-
- if (url) {
- contact.urls = [{
- type: 'other',
- value: url
- }];
- }
-
- if (weChatNumber) {
- contact.ims = [{
- type: 'other',
- value: weChatNumber
- }];
- }
-
- const defaultAddress = {
- type: 'other',
- preferred: true
- };
-
- const homeAddress = {
- type: 'home'
- };
- const companyAddress = {
- type: 'company'
- };
-
- if (addressCountry) {
- defaultAddress.country = addressCountry;
- }
-
- if (addressState) {
- defaultAddress.region = addressState;
- }
-
- if (addressCity) {
- defaultAddress.locality = addressCity;
- }
-
- if (addressStreet) {
- defaultAddress.streetAddress = addressStreet;
- }
-
- if (addressPostalCode) {
- defaultAddress.postalCode = addressPostalCode;
- }
-
- if (homeAddressCountry) {
- homeAddress.country = homeAddressCountry;
- }
-
- if (homeAddressState) {
- homeAddress.region = homeAddressState;
- }
-
- if (homeAddressCity) {
- homeAddress.locality = homeAddressCity;
- }
-
- if (homeAddressStreet) {
- homeAddress.streetAddress = homeAddressStreet;
- }
-
- if (homeAddressPostalCode) {
- homeAddress.postalCode = homeAddressPostalCode;
- }
-
- if (workAddressCountry) {
- companyAddress.country = workAddressCountry;
- }
-
- if (workAddressState) {
- companyAddress.region = workAddressState;
- }
-
- if (workAddressCity) {
- companyAddress.locality = workAddressCity;
- }
-
- if (workAddressStreet) {
- companyAddress.streetAddress = workAddressStreet;
- }
-
- if (workAddressPostalCode) {
- companyAddress.postalCode = workAddressPostalCode;
- }
-
- contact.addresses = [defaultAddress, homeAddress, companyAddress];
-
- contact.save(() => {
- invoke(callbackId, {
- errMsg: 'addPhoneContact:ok'
- });
- }, (e) => {
- invoke(callbackId, {
- errMsg: 'addPhoneContact:fail'
- });
- });
- }, (e) => {
- invoke(callbackId, {
- errMsg: 'addPhoneContact:fail'
- });
- });
-}
-
-/**
- * 执行蓝牙相关方法
- */
-function bluetoothExec (method, callbackId, data = {}, beforeSuccess) {
- var deviceId = data.deviceId;
- if (deviceId) {
- data.deviceId = deviceId.toUpperCase();
- }
- var serviceId = data.serviceId;
- if (serviceId) {
- data.serviceId = serviceId.toUpperCase();
- }
-
- plus.bluetooth[method.replace('Changed', 'Change')](Object.assign(data, {
- success (data) {
- if (typeof beforeSuccess === 'function') {
- beforeSuccess(data);
- }
- invoke(callbackId, Object.assign({}, data, {
- errMsg: `${method}:ok`,
- code: undefined,
- message: undefined
- }));
- },
- fail (error = {}) {
- invoke(callbackId, {
- errMsg: `${method}:fail ${error.message || ''}`,
- errCode: error.code || 0
- });
- }
- }));
-}
-/**
- * 监听蓝牙相关事件
- */
-function bluetoothOn (method, beforeSuccess) {
- plus.bluetooth[method.replace('Changed', 'Change')](function (data) {
- if (typeof beforeSuccess === 'function') {
- beforeSuccess(data);
- }
- publish(method, Object.assign({}, data, {
- code: undefined,
- message: undefined
- }));
- });
- return true
-}
-
-function checkDevices (data) {
- data.devices = data.devices.map(device => {
- var advertisData = device.advertisData;
- if (advertisData && typeof advertisData !== 'string') {
- device.advertisData = wx.arrayBufferToBase64(advertisData);
- }
- return device
- });
-}
-
-var onBluetoothAdapterStateChange;
-var onBluetoothDeviceFound;
-var onBLEConnectionStateChange;
-var onBLEConnectionStateChanged;
-var onBLECharacteristicValueChange;
-
-function openBluetoothAdapter (data, callbackId) {
- onBluetoothAdapterStateChange = onBluetoothAdapterStateChange || bluetoothOn('onBluetoothAdapterStateChange');
- bluetoothExec('openBluetoothAdapter', callbackId);
-}
-
-function closeBluetoothAdapter (data, callbackId) {
- bluetoothExec('closeBluetoothAdapter', callbackId);
-}
-
-function getBluetoothAdapterState (data, callbackId) {
- bluetoothExec('getBluetoothAdapterState', callbackId);
-}
-
-function startBluetoothDevicesDiscovery (data, callbackId) {
- onBluetoothDeviceFound = onBluetoothDeviceFound || bluetoothOn('onBluetoothDeviceFound', checkDevices);
- bluetoothExec('startBluetoothDevicesDiscovery', callbackId, data);
-}
-
-function stopBluetoothDevicesDiscovery (data, callbackId) {
- bluetoothExec('stopBluetoothDevicesDiscovery', callbackId);
-}
-
-function getBluetoothDevices (data, callbackId) {
- bluetoothExec('getBluetoothDevices', callbackId, {}, checkDevices);
-}
-
-function getConnectedBluetoothDevices (data, callbackId) {
- bluetoothExec('getConnectedBluetoothDevices', callbackId, data);
-}
-
-function createBLEConnection (data, callbackId) {
- onBLEConnectionStateChange = onBLEConnectionStateChange || bluetoothOn('onBLEConnectionStateChange');
- onBLEConnectionStateChanged = onBLEConnectionStateChanged || bluetoothOn('onBLEConnectionStateChanged');
- bluetoothExec('createBLEConnection', callbackId, data);
-}
-
-function closeBLEConnection (data, callbackId) {
- bluetoothExec('closeBLEConnection', callbackId, data);
-}
-
-function getBLEDeviceServices (data, callbackId) {
- bluetoothExec('getBLEDeviceServices', callbackId, data);
-}
-
-function getBLEDeviceCharacteristics (data, callbackId) {
- bluetoothExec('getBLEDeviceCharacteristics', callbackId, data);
-}
-
-function notifyBLECharacteristicValueChange (data, callbackId) {
- onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange',
- data => {
- data.value = wx.arrayBufferToBase64(data.value);
- });
- bluetoothExec('notifyBLECharacteristicValueChange', callbackId, data);
-}
-
-function notifyBLECharacteristicValueChanged (data, callbackId) {
- onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange',
- data => {
- data.value = wx.arrayBufferToBase64(data.value);
- });
- bluetoothExec('notifyBLECharacteristicValueChanged', callbackId, data);
-}
-
-function readBLECharacteristicValue (data, callbackId) {
- bluetoothExec('readBLECharacteristicValue', callbackId, data);
-}
-
-function writeBLECharacteristicValue (data, callbackId) {
- data.value = wx.base64ToArrayBuffer(data.value);
- bluetoothExec('writeBLECharacteristicValue', callbackId, data);
-}
-
-function getScreenBrightness () {
- return {
- errMsg: 'getScreenBrightness:ok',
- value: plus.screen.getBrightness()
- }
-}
-
-function setScreenBrightness ({
- value
-} = {}) {
- plus.screen.setBrightness(value);
- return {
- errMsg: 'setScreenBrightness:ok'
- }
-}
-
-function setKeepScreenOn ({
- keepScreenOn
-} = {}) {
- plus.device.setWakelock(!!keepScreenOn);
- return {
- errMsg: 'setKeepScreenOn:ok'
- }
-}
-
-function getClipboardData (options, callbackId) {
- const clipboard = requireNativePlugin('clipboard');
- clipboard.getString(ret => {
- if (ret.result === 'success') {
- invoke(callbackId, {
- data: ret.data,
- errMsg: 'getClipboardData:ok'
- });
- } else {
- invoke(callbackId, {
- data: ret.result,
- errMsg: 'getClipboardData:fail'
- });
- }
- });
-}
-
-function setClipboardData ({
- data
-}) {
- const clipboard = requireNativePlugin('clipboard');
- clipboard.setString(data);
- return {
- errMsg: 'setClipboardData:ok'
- }
-}
-
-let watchOrientationId = false;
-let isWatchOrientation = false;
-
-const clearWatchOrientation = () => {
- if (watchOrientationId) {
- plus.orientation.clearWatch(watchOrientationId);
- watchOrientationId = false;
- }
-};
-
-function enableCompass ({
- enable
-}) {
- if (enable) {
- clearWatchOrientation();
- watchOrientationId = plus.orientation.watchOrientation((o) => {
- publish('onCompassChange', {
- direction: o.magneticHeading,
- errMsg: 'enableCompass:ok'
- });
- }, (e) => {
- publish('onCompassChange', {
- errMsg: 'enableCompass:fail'
- });
- }, {
- frequency: DEVICE_FREQUENCY
- });
- if (!isWatchOrientation) {
- isWatchOrientation = true;
- const webview = getLastWebview();
- if (webview) {
- webview.addEventListener('close', () => {
- plus.orientation.clearWatch(watchOrientationId);
- });
- }
- }
- } else {
- clearWatchOrientation();
- }
- return {
- errMsg: 'enableCompass:ok'
- }
-}
-
-function getNetworkType () {
- return {
- errMsg: 'getNetworkType:ok',
- networkType: NETWORK_TYPES[plus.networkinfo.getCurrentType()]
- }
-}
-
-let beaconUpdateState = false;
-
-function onBeaconUpdate () {
- if (!beaconUpdateState) {
- plus.ibeacon.onBeaconUpdate(function (data) {
- publish('onBeaconUpdated', data);
- });
- beaconUpdateState = true;
- }
-}
-
-let beaconServiceChangeState = false;
-
-function onBeaconServiceChange () {
- if (!beaconServiceChangeState) {
- plus.ibeacon.onBeaconServiceChange(function (data) {
- publish('onBeaconServiceChange', data);
- publish('onBeaconServiceChanged', data);
- });
- beaconServiceChangeState = true;
- }
-}
-
-function getBeacons (params, callbackId) {
- plus.ibeacon.getBeacons({
- success: (result) => {
- invoke(callbackId, {
- errMsg: 'getBeacons:ok',
- beacons: result.beacons
- });
- },
- fail: (error) => {
- invoke(callbackId, {
- errMsg: 'getBeacons:fail:' + error.message
- });
- }
- });
-}
-
-function startBeaconDiscovery ({
- uuids,
- ignoreBluetoothAvailable = false
-}, callbackId) {
- plus.ibeacon.startBeaconDiscovery({
- uuids,
- ignoreBluetoothAvailable,
- success: (result) => {
- invoke(callbackId, {
- errMsg: 'startBeaconDiscovery:ok',
- beacons: result.beacons
- });
- },
- fail: (error) => {
- invoke(callbackId, {
- errMsg: 'startBeaconDiscovery:fail:' + error.message
- });
- }
- });
-}
-
-function stopBeaconDiscovery (params, callbackId) {
- plus.ibeacon.stopBeaconDiscovery({
- success: (result) => {
- invoke(callbackId, Object.assign(result, {
- errMsg: 'stopBeaconDiscovery:ok'
- }));
- },
- fail: (error) => {
- invoke(callbackId, {
- errMsg: 'stopBeaconDiscovery:fail:' + error.message
- });
- }
- });
-}
-
-function makePhoneCall$1 ({
- phoneNumber
-} = {}) {
- plus.device.dial(phoneNumber);
- return {
- errMsg: 'makePhoneCall:ok'
- }
-}
-
-const ANI_SHOW = 'pop-in';
-const ANI_DURATION = 300;
-
-const TABBAR_HEIGHT = 56;
-const TITLEBAR_HEIGHT = 44;
-
-const callbacks = {};
-/**
- * 注册 view 层通知 service 层事件处理
- */
-function registerPlusMessage (type, callback, keepAlive = true) {
- if (callbacks[type]) {
- throw new Error(`${type} 已注册:` + (callbacks[type].toString()))
- }
- callback.keepAlive = !!keepAlive;
- callbacks[type] = callback;
-}
-
-const SCAN_ID = '__UNIAPP_SCAN';
-const SCAN_PATH = '_www/__uniappscan.html';
-
-const MESSAGE_TYPE = 'scanCode';
-
-function scanCode ({
- onlyFromCamera = false,
- scanType
-}, callbackId) {
- const barcode = plus.barcode;
- const SCAN_TYPES = {
- 'qrCode': [
- barcode.QR,
- barcode.AZTEC,
- barcode.MAXICODE
- ],
- 'barCode': [
- barcode.EAN13,
- barcode.EAN8,
- barcode.UPCA,
- barcode.UPCE,
- barcode.CODABAR,
- barcode.CODE128,
- barcode.CODE39,
- barcode.CODE93,
- barcode.ITF,
- barcode.RSS14,
- barcode.RSSEXPANDED
- ],
- 'datamatrix': [barcode.DATAMATRIX],
- 'pdf417': [barcode.PDF417]
- };
-
- const SCAN_MAPS = {
- [barcode.QR]: 'QR_CODE',
- [barcode.EAN13]: 'EAN_13',
- [barcode.EAN8]: 'EAN_8',
- [barcode.DATAMATRIX]: 'DATA_MATRIX',
- [barcode.UPCA]: 'UPC_A',
- [barcode.UPCE]: 'UPC_E',
- [barcode.CODABAR]: 'CODABAR',
- [barcode.CODE39]: 'CODE_39',
- [barcode.CODE93]: 'CODE_93',
- [barcode.CODE128]: 'CODE_128',
- [barcode.ITF]: 'CODE_25',
- [barcode.PDF417]: 'PDF_417',
- [barcode.AZTEC]: 'AZTEC',
- [barcode.RSS14]: 'RSS_14',
- [barcode.RSSEXPANDED]: 'RSSEXPANDED'
- };
-
- const statusBarStyle = getStatusBarStyle();
- const isDark = statusBarStyle !== 'light';
-
- let result;
-
- let filters = [];
- if (Array.isArray(scanType) && scanType.length) {
- scanType.forEach(type => { // 暂不考虑去重
- const types = SCAN_TYPES[type];
- if (types) {
- filters = filters.concat(types);
- }
- });
- }
- if (!filters.length) {
- filters = filters.concat(SCAN_TYPES['qrCode']).concat(SCAN_TYPES['barCode']).concat(SCAN_TYPES['datamatrix']).concat(
- SCAN_TYPES['pdf417']);
- }
-
- const buttons = [];
- if (!onlyFromCamera) {
- buttons.push({
- 'float': 'right',
- 'text': '相册',
- 'fontSize': '17px',
- 'width': '60px',
- 'onclick': function () {
- plus.gallery.pick(file => {
- barcode.scan(file, (type, code) => {
- if (isDark) {
- plus.navigator.setStatusBarStyle('isDark');
- }
- webview.close('auto');
- result = {
- type,
- code
- };
- }, () => {
- plus.nativeUI.toast('识别失败');
- }, filters);
- }, err => {
- if (err.code !== 12) {
- plus.nativeUI.toast('选择失败');
- }
- }, {
- multiple: false,
- system: false
- });
- }
- });
- }
-
- const webview = plus.webview.create(SCAN_PATH, SCAN_ID, {
- titleNView: {
- autoBackButton: true,
- type: 'float',
- backgroundColor: 'rgba(0,0,0,0)',
- titleColor: '#ffffff',
- titleText: '扫码',
- titleSize: '17px',
- buttons
- },
- popGesture: 'close',
- backButtonAutoControl: 'close'
- }, {
- __uniapp_type: 'scan',
- __uniapp_dark: isDark,
- __uniapp_scan_type: filters,
- 'uni-app': 'none'
- });
- const waiting = plus.nativeUI.showWaiting();
- webview.addEventListener('titleUpdate', () => {
- webview.show(ANI_SHOW, ANI_DURATION, () => {
- waiting.close();
- });
- });
- webview.addEventListener('close', () => {
- if (result && 'code' in result) {
- invoke(callbackId, {
- result: result.code,
- scanType: SCAN_MAPS[result.type] || '',
- charSet: 'utf8',
- path: '',
- errMsg: 'scanCode:ok'
- });
- } else {
- invoke(callbackId, {
- errMsg: 'scanCode:fail cancel'
- });
- }
- });
- if (isDark) { // 状态栏前景色
- plus.navigator.setStatusBarStyle('light');
- webview.addEventListener('popGesture', ({
- type,
- result
- }) => {
- if (type === 'start') {
- plus.navigator.setStatusBarStyle('dark');
- } else if (type === 'end' && !result) {
- plus.navigator.setStatusBarStyle('light');
- }
- });
- }
- // fixed by hxy 注册扫码事件
- registerPlusMessage(MESSAGE_TYPE, function (res) {
- if (res && !res.errMsg) {
- result = res;
- } else {
- const errMsg = res && res.errMsg ? ' ' + res.errMsg : '';
- result = {
- errMsg: 'scanCode:fail' + errMsg
- };
- }
- }, false);
-}
-
-var safeArea = {
- get bottom () {
- if (plus.os.name === 'iOS') {
- const safeArea = plus.navigator.getSafeAreaInsets();
- return safeArea ? safeArea.bottom : 0
- }
- return 0
- }
-};
-
-const IMAGE_TOP = 7;
-const IMAGE_WIDTH = 24;
-const IMAGE_HEIGHT = 24;
-const TEXT_TOP = 36;
-const TEXT_SIZE = 12;
-const TEXT_NOICON_SIZE = 17;
-const TEXT_HEIGHT = 12;
-const IMAGE_ID = 'TABITEM_IMAGE_';
-const TABBAR_VIEW_ID = 'TABBAR_VIEW_';
-
-let view;
-let config;
-let winWidth;
-let itemWidth;
-let itemLength;
-let itemImageLeft;
-let itemRects = [];
-const itemIcons = [];
-const itemLayouts = [];
-const itemDot = [];
-const itemBadge = [];
-let itemClickCallback;
-
-let selected = 0;
-/**
- * tabbar显示状态
- */
-let visible = true;
-
-const init = function () {
- const list = config.list;
- itemLength = config.list.length;
-
- calcItemLayout(); // 计算选项卡布局
-
- initBitmaps(list); // 初始化选项卡图标
-
- initView();
-};
-
-let initView = function () {
- const viewStyles = {
- height: TABBAR_HEIGHT
- };
- if (config.position === 'top') {
- viewStyles.top = 0;
- } else {
- viewStyles.bottom = 0;
- viewStyles.height += safeArea.bottom;
- }
- if (process.env.NODE_ENV !== 'production') {
- console.log(`UNIAPP[tabbar]:${JSON.stringify(viewStyles)}`);
- }
- view = new plus.nativeObj.View(TABBAR_VIEW_ID, viewStyles, getDraws());
-
- view.interceptTouchEvent(true);
-
- view.addEventListener('click', (e) => {
- if (!__uniConfig.__ready__) { // 未 ready,不允许点击
- if (process.env.NODE_ENV !== 'production') {
- console.log(`UNIAPP[tabbar].prevent`);
- }
- return
- }
- const x = e.clientX;
- const y = e.clientY;
- for (let i = 0; i < itemRects.length; i++) {
- if (isCross(x, y, itemRects[i])) {
- const draws = getSelectedDraws(i);
- const drawTab = !!draws.length;
- itemClickCallback && itemClickCallback(config.list[i], i, drawTab);
- if (drawTab) {
- setTimeout(() => view.draw(draws));
- }
- break
- }
- }
- });
- plus.globalEvent.addEventListener('orientationchange', () => {
- calcItemLayout(config.list);
- if (config.position !== 'top') {
- let height = TABBAR_HEIGHT + safeArea.bottom;
- view.setStyle({
- height: height
- });
- if (visible) {
- setWebviewPosition(height);
- }
- }
- view.draw(getDraws());
- });
- if (!visible) {
- view.hide();
- }
-};
-
-let isCross = function (x, y, rect) {
- if (x > rect.left && x < (rect.left + rect.width) && y > rect.top && y < (rect.top + rect.height)) {
- return true
- }
- return false
-};
-
-let initBitmaps = function (list) {
- for (let i = 0; i < list.length; i++) {
- const item = list[i];
- if (item.iconData) {
- const bitmap = new plus.nativeObj.Bitmap(IMAGE_ID + i);
- bitmap.loadBase64Data(item.iconData);
- const selectedBitmap = new plus.nativeObj.Bitmap(`${IMAGE_ID}SELECTED_${i}`);
- selectedBitmap.loadBase64Data(item.selectedIconData);
- itemIcons[i] = {
- icon: bitmap,
- selectedIcon: selectedBitmap
- };
- } else if (item.iconPath) {
- itemIcons[i] = {
- icon: item.iconPath,
- selectedIcon: item.selectedIconPath
- };
- } else {
- itemIcons[i] = {
- icon: false,
- selectedIcon: false
- };
- }
- }
-};
-
-let getDraws = function () {
- const backgroundColor = config.backgroundColor;
- const borderHeight = Math.max(0.5, 1 / plus.screen.scale); // 高分屏最少0.5
- const borderTop = config.position === 'top' ? (TABBAR_HEIGHT - borderHeight) : 0;
- const borderStyle = config.borderStyle === 'white' ? 'rgba(255,255,255,0.33)' : 'rgba(0,0,0,0.33)';
-
- const draws = [{
- id: `${TABBAR_VIEW_ID}BG`, // 背景色
- tag: 'rect',
- color: backgroundColor,
- position: {
- top: 0,
- left: 0,
- width: '100%',
- height: TABBAR_HEIGHT + safeArea.bottom
- }
- }, {
- id: `${TABBAR_VIEW_ID}BORDER`,
- tag: 'rect',
- color: borderStyle,
- position: {
- top: borderTop,
- left: 0,
- width: '100%',
- height: `${borderHeight}px`
- }
- }];
-
- for (let i = 0; i < itemLength; i++) {
- const item = config.list[i];
- if (i === selected) {
- drawTabItem(draws, i, item.text, config.selectedColor, itemIcons[i].selectedIcon);
- } else {
- drawTabItem(draws, i, item.text, config.color, itemIcons[i].icon);
- }
- }
- return draws
-};
-
-let getSelectedDraws = function (newSelected) {
- if (selected === newSelected) {
- return false
- }
- const draws = [];
- const lastSelected = selected;
- selected = newSelected;
- drawTabItem(draws, lastSelected);
- drawTabItem(draws, selected);
- return draws
-};
-/**
- * 获取文字宽度(全角为1)
- * @param {*} text
- */
-function getFontWidth (text) {
- // eslint-disable-next-line
- return text.length - (text.match(/[\u0000-\u00ff]/g) || []).length / 2
-}
-let calcItemLayout = function () {
- winWidth = plus.screen.resolutionWidth;
- itemWidth = winWidth / itemLength;
- itemImageLeft = (itemWidth - IMAGE_WIDTH) / 2;
- itemRects = [];
- let dotTop = 0;
- let dotLeft = 0;
- for (let i = 0; i < itemLength; i++) {
- itemRects.push({
- top: 0,
- left: i * itemWidth,
- width: itemWidth,
- height: TABBAR_HEIGHT
- });
- }
-
- for (let i = 0; i < itemLength; i++) {
- const item = config.list[i];
- let imgLeft = itemWidth * i + itemImageLeft;
- if ((item.iconData || item.iconPath) && item.text) { // 图文
- itemLayouts[i] = {
- text: {
- top: TEXT_TOP,
- left: `${i * itemWidth}px`,
- width: `${itemWidth}px`,
- height: TEXT_HEIGHT
- },
- img: {
- top: IMAGE_TOP,
- left: `${imgLeft}px`,
- width: IMAGE_WIDTH,
- height: IMAGE_HEIGHT
- }
- };
- dotTop = IMAGE_TOP;
- dotLeft = imgLeft + IMAGE_WIDTH;
- } else if (!(item.iconData || item.iconPath) && item.text) { // 仅文字
- let textLeft = i * itemWidth;
- itemLayouts[i] = {
- text: {
- top: 0,
- left: `${textLeft}px`,
- width: `${itemWidth}px`,
- height: TABBAR_HEIGHT
- }
- };
- dotTop = (44 - TEXT_NOICON_SIZE) / 2;
- dotLeft = textLeft + itemWidth * 0.5 + getFontWidth(item.text) * TEXT_NOICON_SIZE * 0.5;
- } else if ((item.iconData || item.iconPath) && !item.text) { // 仅图片
- const diff = 10;
- let imgTop = (TABBAR_HEIGHT - IMAGE_HEIGHT - diff) / 2;
- let imgLeft = itemWidth * i + itemImageLeft - diff / 2;
- itemLayouts[i] = {
- img: {
- top: `${imgTop}px`,
- left: `${imgLeft}px`,
- width: IMAGE_WIDTH + diff,
- height: IMAGE_HEIGHT + diff
- }
- };
- dotTop = imgTop;
- dotLeft = imgLeft + IMAGE_WIDTH + diff;
- }
- let height = itemBadge[i] ? 14 : 10;
- let badge = itemBadge[i] || '0';
- let font = getFontWidth(badge) - 0.5;
- font = font > 1 ? 1 : font;
- let width = height + font * 12;
- width = width < height ? height : width;
- let itemLayout = itemLayouts[i];
- if (itemLayout) {
- itemLayout.doc = {
- top: dotTop,
- left: `${dotLeft - width * 0.382}px`,
- width: `${width}px`,
- height: `${height}px`
- };
- itemLayout.badge = {
- top: dotTop,
- left: `${dotLeft - width * 0.382}px`,
- width: `${width}px`,
- height: `${height}px`
- };
- }
- }
-};
-
-let drawTabItem = function (draws, index) {
- const layout = itemLayouts[index];
-
- const item = config.list[index];
-
- let color = config.color;
- let icon = itemIcons[index].icon;
- let dot = itemDot[index];
- let badge = itemBadge[index] || '';
-
- if (index === selected) {
- color = config.selectedColor;
- icon = itemIcons[index].selectedIcon;
- }
-
- if (icon) {
- draws.push({
- id: `${TABBAR_VIEW_ID}ITEM_${index}_ICON`,
- tag: 'img',
- position: layout.img,
- src: icon
- });
- }
- if (item.text) {
- draws.push({
- id: `${TABBAR_VIEW_ID}ITEM_${index}_TEXT`,
- tag: 'font',
- position: layout.text,
- text: item.text,
- textStyles: {
- size: icon ? TEXT_SIZE : `${TEXT_NOICON_SIZE}px`,
- color
- }
- });
- }
- const hiddenPosition = {
- letf: 0,
- top: 0,
- width: 0,
- height: 0
- };
- // 绘制小红点(角标背景)
- draws.push({
- id: `${TABBAR_VIEW_ID}ITEM_${index}_DOT`,
- tag: 'rect',
- position: (dot || badge) ? layout.doc : hiddenPosition,
- rectStyles: {
- color: '#ff0000',
- radius: badge ? '7px' : '5px'
- }
- });
- // 绘制角标文本
- draws.push({
- id: `${TABBAR_VIEW_ID}ITEM_${index}_BADGE`,
- tag: 'font',
- position: badge ? layout.badge : hiddenPosition,
- text: badge || ' ',
- textStyles: {
- align: 'center',
- verticalAlign: 'middle',
- color: badge ? '#ffffff' : 'rgba(0,0,0,0)',
- overflow: 'ellipsis',
- size: '10px'
- }
- });
-};
-/**
- * {
- "color": "#7A7E83",
- "selectedColor": "#3cc51f",
- "borderStyle": "black",
- "backgroundColor": "#ffffff",
- "list": [{
- "pagePath": "page/component/index.html",
- "iconData": "",
- "selectedIconData": "",
- "text": "组件"
- }, {
- "pagePath": "page/API/index.html",
- "iconData": "",
- "selectedIconData": "",
- "text": "接口"
- }],
- "position":"bottom"//bottom|top
- }
- */
-
-/**
- * 设置角标
- * @param {string} type
- * @param {number} index
- * @param {string} text
- */
-function setTabBarBadge$1 (type, index, text) {
- if (type === 'none') {
- itemDot[index] = false;
- itemBadge[index] = '';
- } else if (type === 'text') {
- itemBadge[index] = text;
- } else if (type === 'redDot') {
- itemDot[index] = true;
- }
- if (view) {
- calcItemLayout(config.list);
- view.draw(getDraws());
- }
-}
-/**
- * 动态设置 tabBar 某一项的内容
- */
-function setTabBarItem$1 (index, text, iconPath, selectedIconPath) {
- if (iconPath || selectedIconPath) {
- let itemIcon = itemIcons[index] = itemIcons[index] || {};
- if (iconPath) {
- itemIcon.icon = getRealPath$1(iconPath);
- }
- if (selectedIconPath) {
- itemIcon.selectedIcon = getRealPath$1(selectedIconPath);
- }
- }
- if (text) {
- config.list[index].text = text;
- }
- view.draw(getDraws());
-}
-/**
- * 动态设置 tabBar 的整体样式
- * @param {Object} style 样式
- */
-function setTabBarStyle$1 (style) {
- for (const key in style) {
- config[key] = style[key];
- }
- view.draw(getDraws());
-}
-/**
- * 设置tab页底部或顶部距离
- * @param {*} value 距离
- */
-function setWebviewPosition (value) {
- const position = config.position === 'top' ? 'top' : 'bottom';
- plus.webview.all().forEach(webview => {
- if (isTabBarPage(String(webview.__uniapp_route))) {
- webview.setStyle({
- [position]: value
- });
- }
- });
-}
-/**
- * 隐藏 tabBar
- * @param {boolean} animation 是否需要动画效果 暂未支持
- */
-function hideTabBar$1 (animation) {
- if (visible === false) {
- return
- }
- visible = false;
- if (view) {
- view.hide();
- setWebviewPosition(0);
- }
-}
-/**
- * 显示 tabBar
- * @param {boolean} animation 是否需要动画效果 暂未支持
- */
-function showTabBar$1 (animation) {
- if (visible === true) {
- return
- }
- visible = true;
- if (view) {
- view.show();
- setWebviewPosition(TABBAR_HEIGHT + safeArea.bottom);
- }
-}
-
-var tabbar = {
- init (options, clickCallback) {
- if (options && options.list.length) {
- selected = options.selected || 0;
- config = options;
- config.position = 'bottom'; // 暂时强制使用bottom
- itemClickCallback = clickCallback;
- init();
- return view
- }
- },
- switchTab (page) {
- if (itemLength) {
- for (let i = 0; i < itemLength; i++) {
- if (config.list[i].pagePath === (`${page}.html`)) {
- const draws = getSelectedDraws(i);
- if (draws.length) {
- view.draw(draws);
- }
- return true
- }
- }
- }
- return false
- },
- setTabBarBadge: setTabBarBadge$1,
- setTabBarItem: setTabBarItem$1,
- setTabBarStyle: setTabBarStyle$1,
- hideTabBar: hideTabBar$1,
- showTabBar: showTabBar$1,
- get visible () {
- return visible
- }
-};
-
-function getSystemInfo (args) {
- const platform = plus.os.name.toLowerCase();
- const ios = platform === 'ios';
- // 安卓 plus 接口获取的屏幕大小值不为整数,iOS js 获取的屏幕大小横屏时颠倒
- const screenWidth = plus.screen.resolutionWidth;
- const screenHeight = plus.screen.resolutionHeight;
- // 横屏时 iOS 获取的状态栏高度错误,进行纠正
- var landscape = Math.abs(plus.navigator.getOrientation()) === 90;
- var statusBarHeight = plus.navigator.getStatusbarHeight();
- if (ios && landscape) {
- statusBarHeight = Math.min(20, statusBarHeight);
- }
- // 判断是否存在 titleNView
- var titleNView;
- var webview = getLastWebview();
- if (webview) {
- let style = webview.getStyle();
- if (style) {
- titleNView = style && style.titleNView;
- titleNView = titleNView && titleNView.type === 'default';
- }
- }
- return {
- errMsg: 'getSystemInfo:ok',
- brand: '',
- model: plus.device.model,
- pixelRatio: plus.screen.scale,
- screenWidth,
- screenHeight,
- // 安卓端 webview 宽度有时比屏幕多 1px,相比取最小值
- // TODO screenWidth,screenHeight
- windowWidth: screenWidth,
- windowHeight: Math.min(screenHeight - (titleNView ? (statusBarHeight + TITLEBAR_HEIGHT)
- : 0) - (isTabBarPage() && tabbar.visible ? TABBAR_HEIGHT : 0), screenHeight),
- statusBarHeight,
- language: plus.os.language,
- system: plus.os.version,
- version: plus.runtime.innerVersion,
- fontSizeSetting: '',
- platform,
- SDKVersion: '',
- windowTop: 0,
- windowBottom: 0
- }
-}
-
-function vibrateLong () {
- plus.device.vibrate(400);
- return {
- errMsg: 'vibrateLong:ok'
- }
-}
-function vibrateShort () {
- plus.device.vibrate(15);
- return {
- errMsg: 'vibrateShort:ok'
- }
-}
-
-const SAVED_DIR = 'uniapp_save';
-const SAVE_PATH = `_doc/${SAVED_DIR}`;
-const REGEX_FILENAME = /^.*[/]/;
-
-function getSavedFileDir (success, fail) {
- fail = fail || function () {};
- plus.io.requestFileSystem(plus.io.PRIVATE_DOC, fs => { // 请求_doc fs
- fs.root.getDirectory(SAVED_DIR, { // 获取文件保存目录对象
- create: true
- }, dir => {
- success(dir);
- }, err => {
- fail('目录[' + SAVED_DIR + ']创建失败' + err.message);
- });
- }, err => {
- fail('目录[_doc]读取失败' + err.message);
- });
-}
-
-function saveFile ({
- tempFilePath
-} = {}, callbackId) {
- let fileName = tempFilePath.replace(REGEX_FILENAME, '');
- if (fileName) {
- let extName = '';
- if (~fileName.indexOf('.')) {
- extName = '.' + fileName.split('.').pop();
- }
-
- fileName = (+new Date()) + '' + extName;
-
- plus.io.resolveLocalFileSystemURL(getRealPath$1(tempFilePath), entry => { // 读取临时文件 FileEntry
- getSavedFileDir(dir => {
- entry.copyTo(dir, fileName, () => { // 复制临时文件 FileEntry,为了避免把相册里的文件删除,使用 copy,微信中是要删除临时文件的
- const savedFilePath = SAVE_PATH + '/' + fileName;
- invoke(callbackId, {
- errMsg: 'saveFile:ok',
- savedFilePath
- });
- }, err => {
- invoke(callbackId, {
- errMsg: 'saveFile:fail 保存文件[' + tempFilePath +
- '] copyTo 失败:' + err.message
- });
- });
- }, message => {
- invoke(callbackId, {
- errMsg: 'saveFile:fail ' + message
- });
- });
- }, err => {
- invoke(callbackId, {
- errMsg: 'saveFile:fail 文件[' + tempFilePath + ']读取失败' + err.message
- });
- });
- } else {
- return {
- errMsg: 'saveFile:fail 文件名[' + tempFilePath + ']不存在'
- }
- }
-}
-
-function getSavedFileList (options, callbackId) {
- getSavedFileDir(entry => {
- var reader = entry.createReader();
-
- var fileList = [];
- reader.readEntries(entries => {
- if (entries && entries.length) {
- entries.forEach(entry => {
- entry.getMetadata(meta => {
- fileList.push({
- filePath: plus.io.convertAbsoluteFileSystem(entry.fullPath),
- createTime: meta.modificationTime.getTime(),
- size: meta.size
- });
- if (fileList.length === entries.length) {
- invoke(callbackId, {
- errMsg: 'getSavedFileList:ok',
- fileList
- });
- }
- }, error => {
- invoke(callbackId, {
- errMsg: 'getSavedFileList:fail ' + error.message
- });
- }, false);
- });
- } else {
- invoke(callbackId, {
- errMsg: 'getSavedFileList:ok',
- fileList
- });
- }
- }, error => {
- invoke(callbackId, {
- errMsg: 'getSavedFileList:fail ' + error.message
- });
- });
- }, message => {
- invoke(callbackId, {
- errMsg: 'getSavedFileList:fail ' + message
- });
- });
-}
-
-function getFileInfo ({
- filePath,
- digestAlgorithm = 'md5'
-} = {}, callbackId) {
- // TODO 计算文件摘要
- plus.io.resolveLocalFileSystemURL(getRealPath$1(filePath), entry => {
- entry.getMetadata(meta => {
- invoke(callbackId, {
- errMsg: 'getFileInfo:ok',
- size: meta.size,
- digestAlgorithm: ''
- });
- }, err => {
- invoke(callbackId, {
- errMsg: 'getFileInfo:fail 文件[' +
- filePath +
- '] getMetadata 失败:' + err.message
- });
- });
- }, err => {
- invoke(callbackId, {
- errMsg: 'getFileInfo:fail 文件[' + filePath + ']读取失败:' + err.message
- });
- });
-}
-
-function getSavedFileInfo ({
- filePath
-} = {}, callbackId) {
- plus.io.resolveLocalFileSystemURL(getRealPath$1(filePath), entry => {
- entry.getMetadata(meta => {
- invoke(callbackId, {
- createTime: meta.modificationTime.getTime(),
- size: meta.size,
- errMsg: 'getSavedFileInfo:ok'
- });
- }, error => {
- invoke(callbackId, {
- errMsg: 'getSavedFileInfo:fail ' + error.message
- });
- }, false);
- }, () => {
- invoke(callbackId, {
- errMsg: 'getSavedFileInfo:fail file not find'
- });
- });
-}
-
-function removeSavedFile ({
- filePath
-} = {}, callbackId) {
- plus.io.resolveLocalFileSystemURL(getRealPath$1(filePath), entry => {
- entry.remove(() => {
- invoke(callbackId, {
- errMsg: 'removeSavedFile:ok'
- });
- }, err => {
- invoke(callbackId, {
- errMsg: 'removeSavedFile:fail 文件[' + filePath + ']删除失败:' + err.message
- });
- });
- }, () => {
- invoke(callbackId, {
- errMsg: 'removeSavedFile:fail file not find'
- });
- });
-}
-
-function openDocument$1 ({
- filePath,
- fileType
-} = {}, callbackId) {
- plus.io.resolveLocalFileSystemURL(getRealPath$1(filePath), entry => {
- plus.runtime.openFile(getRealPath$1(filePath));
- invoke(callbackId, {
- errMsg: 'openDocument:ok'
- });
- }, err => {
- invoke(callbackId, {
- errMsg: 'openDocument:fail 文件[' + filePath + ']读取失败:' + err.message
- });
- });
-}
-
-const CHOOSE_LOCATION_PATH = '_www/__uniappchooselocation.html';
-
-function chooseLocation (params, callbackId) {
- const statusBarStyle = plus.navigator.getStatusBarStyle();
- const webview = plus.webview.create(
- CHOOSE_LOCATION_PATH,
- MAP_ID, {
- titleNView: {
- autoBackButton: true,
- backgroundColor: '#000000',
- titleColor: '#ffffff',
- titleText: '选择位置',
- titleSize: '17px',
- buttons: [{
- float: 'right',
- text: '完成',
- fontSize: '17px',
- onclick: function () {
- webview.evalJS('__chooseLocationConfirm__()');
- }
- }]
- },
- popGesture: 'close',
- scrollIndicator: 'none'
- }, {
- __uniapp_type: 'map',
- __uniapp_statusbar_style: statusBarStyle,
- 'uni-app': 'none'
- }
- );
- if (statusBarStyle === 'dark') {
- plus.navigator.setStatusBarStyle('light');
- webview.addEventListener('popGesture', ({
- type,
- result
- }) => {
- if (type === 'start') {
- plus.navigator.setStatusBarStyle('dark');
- } else if (type === 'end' && !result) {
- plus.navigator.setStatusBarStyle('light');
- }
- });
- }
-
- webview.show('slide-in-bottom', ANI_DURATION, () => {
- webview.evalJS(`__chooseLocation__(${JSON.stringify(params)})`);
- });
-
- // fixed by hxy
- registerPlusMessage('chooseLocation', function (res) {
- if (res && !res.errMsg) {
- invoke(callbackId, {
- name: res.poiname,
- address: res.poiaddress,
- latitude: res.latlng.lat,
- longitude: res.latlng.lng,
- errMsg: 'chooseLocation:ok'
- });
- } else {
- const errMsg = res && res.errMsg ? ' ' + res.errMsg : '';
- invoke(callbackId, {
- errMsg: 'chooseLocation:fail' + errMsg
- });
- }
- }, false);
-}
-
-function getLocationSuccess (type, position, callbackId) {
- const coords = position.coords;
- if (type !== position.coordsType) {
- if (process.env.NODE_ENV !== 'production') {
- console.log(
- `UNIAPP[location]:before[${position.coordsType}][lng:${
- coords.longitude
- },lat:${coords.latitude}]`
- );
- }
- let coordArray;
- if (type === 'wgs84') {
- coordArray = gcj02towgs84(coords.longitude, coords.latitude);
- } else if (type === 'gcj02') {
- coordArray = wgs84togcj02(coords.longitude, coords.latitude);
- }
- if (coordArray) {
- coords.longitude = coordArray[0];
- coords.latitude = coordArray[1];
- if (process.env.NODE_ENV !== 'production') {
- console.log(
- `UNIAPP[location]:after[${type}][lng:${coords.longitude},lat:${
- coords.latitude
- }]`
- );
- }
- }
- }
-
- invoke(callbackId, {
- type,
- altitude: coords.altitude || 0,
- latitude: coords.latitude,
- longitude: coords.longitude,
- speed: coords.speed,
- accuracy: coords.accuracy,
- address: position.address,
- errMsg: 'getLocation:ok'
- });
-}
-
-function getLocation$1 ({
- type = 'wgs84',
- geocode = false,
- altitude = false
-} = {}, callbackId) {
- plus.geolocation.getCurrentPosition(
- position => {
- getLocationSuccess(type, position, callbackId);
- },
- e => {
- // 坐标地址解析失败
- if (e.code === 1501) {
- getLocationSuccess(type, e, callbackId);
- return
- }
-
- invoke(callbackId, {
- errMsg: 'getLocation:fail ' + e.message
- });
- }, {
- geocode: geocode,
- enableHighAccuracy: altitude
- }
- );
-}
-
-const OPEN_LOCATION_PATH = '_www/__uniappopenlocation.html';
-
-function openLocation$1 (params) {
- const statusBarStyle = plus.navigator.getStatusBarStyle();
- const webview = plus.webview.create(
- OPEN_LOCATION_PATH,
- MAP_ID, {
- titleNView: {
- autoBackButton: true,
- titleColor: '#ffffff',
- titleText: '',
- titleSize: '17px',
- type: 'transparent'
- },
- popGesture: 'close',
- scrollIndicator: 'none'
- }, {
- __uniapp_type: 'map',
- __uniapp_statusbar_style: statusBarStyle,
- 'uni-app': 'none'
- }
- );
- if (statusBarStyle === 'light') {
- plus.navigator.setStatusBarStyle('dark');
- webview.addEventListener('popGesture', ({
- type,
- result
- }) => {
- if (type === 'start') {
- plus.navigator.setStatusBarStyle('light');
- } else if (type === 'end' && !result) {
- plus.navigator.setStatusBarStyle('dark');
- }
- });
- }
- webview.show(ANI_SHOW, ANI_DURATION, () => {
- webview.evalJS(`__openLocation__(${JSON.stringify(params)})`);
- });
-
- return {
- errMsg: 'openLocation:ok'
- }
-}
-
-const RECORD_TIME = 60 * 60 * 1000;
-
-let recorder;
-let recordTimeout;
-
-function startRecord (args, callbackId) {
- recorder && recorder.stop();
- recorder = plus.audio.getRecorder();
- recorder.record({
- filename: '_doc/audio/',
- format: 'aac'
- }, (res) => {
- invoke(callbackId, {
- errMsg: 'startRecord:ok',
- tempFilePath: res
- });
- }, (res) => {
- invoke(callbackId, {
- errMsg: 'startRecord:fail'
- });
- });
- recordTimeout = setTimeout(() => {
- recorder.stop();
- recorder = false;
- }, RECORD_TIME);
-}
-
-function stopRecord () {
- if (recorder) {
- recordTimeout && clearTimeout(recordTimeout);
- recorder.stop();
- return {
- errMsg: 'stopRecord:ok'
- }
- }
- return {
- errMsg: 'stopRecord:fail'
- }
-}
-
-let player;
-let playerFilePath;
-let playerStatus;
-
-function playVoice ({
- filePath
-} = {}, callbackId) {
- if (player && playerFilePath === filePath && playerStatus === 'pause') { // 如果是当前音频被暂停,则继续播放
- playerStatus = 'play';
- player.play((res) => {
- player = false;
- playerFilePath = false;
- playerStatus = false;
- invoke(callbackId, {
- errMsg: 'playVoice:ok'
- });
- });
- return {
- errMsg: 'playVoice:ok'
- }
- }
- if (player) { // 如果存在音频播放,则停止
- player.stop();
- }
- playerFilePath = filePath;
- playerStatus = 'play';
- player = plus.audio.createPlayer(getRealPath$1(filePath));
- // 播放操作成功回调
- player.play((res) => {
- player = false;
- playerFilePath = false;
- playerStatus = false;
- invoke(callbackId, {
- errMsg: 'playVoice:ok'
- });
- });
-}
-
-function pauseVoice () {
- if (player && playerStatus === 'play') {
- player.pause();
- playerStatus = 'pause';
- }
- return {
- errMsg: 'pauseVoice:ok'
- }
-}
-
-function stopVoice () {
- if (player) {
- player.stop();
- player = false;
- playerFilePath = false;
- playerStatus = false;
- }
- return {
- errMsg: 'stopVoice:ok'
- }
-}
-
-/**
- * 获取文件信息
- * @param {string} filePath 文件路径
- * @returns {Promise} 文件信息Promise
- */
-function getFileInfo$1 (filePath) {
- return new Promise((resolve, reject) => {
- plus.io.resolveLocalFileSystemURL(filePath, function (entry) {
- entry.getMetadata(function (meta) {
- resolve({
- size: meta.size
- });
- }, reject, false);
- }, reject);
- })
-}
-
-const invokeChooseImage = function (callbackId, type, sizeType, tempFilePaths = []) {
- if (!tempFilePaths.length) {
- invoke(callbackId, {
- code: sizeType,
- errMsg: `chooseImage:${type}`
- });
- return
- }
- var tempFiles = [];
- // plus.zip.compressImage 压缩文件并发调用在iOS端容易出现问题(图像错误、闪退),改为队列执行
- tempFilePaths.reduce((promise, tempFilePath, index, array) => {
- return promise
- .then(() => {
- return getFileInfo$1(tempFilePath)
- })
- .then(fileInfo => {
- var size = fileInfo.size;
- // 压缩阈值 0.5 兆
- var threshold = 1024 * 1024 * 0.5;
- // 判断是否需要压缩
- if ((sizeType.indexOf('compressed') >= 0 && sizeType.indexOf('original') < 0) || (((
- sizeType.indexOf(
- 'compressed') < 0 && sizeType.indexOf('original') < 0) || (sizeType
- .indexOf('compressed') >= 0 && sizeType.indexOf(
- 'original') >= 0)) && size > threshold)) {
- return new Promise((resolve, reject) => {
- var dstPath = TEMP_PATH + '/compressed/' + Date.now() + (
- tempFilePath.match(/\.\S+$/) || [''])[0];
- plus.nativeUI.showWaiting();
- plus.zip.compressImage({
- src: tempFilePath,
- dst: dstPath,
- overwrite: true
- }, () => {
- resolve(dstPath);
- }, (error) => {
- reject(error);
- });
- })
- .then(dstPath => {
- array[index] = tempFilePath = dstPath;
- return getFileInfo$1(tempFilePath)
- })
- .then(fileInfo => {
- return tempFiles.push({
- path: tempFilePath,
- size: fileInfo.size
- })
- })
- }
- return tempFiles.push({
- path: tempFilePath,
- size: size
- })
- })
- }, Promise.resolve())
- .then(() => {
- plus.nativeUI.closeWaiting();
- invoke(callbackId, {
- errMsg: `chooseImage:${type}`,
- tempFilePaths,
- tempFiles
- });
- }).catch(() => {
- plus.nativeUI.closeWaiting();
- invoke(callbackId, {
- errMsg: `chooseImage:${type}`
- });
- });
-};
-const openCamera = function (callbackId, sizeType) {
- const camera = plus.camera.getCamera();
- camera.captureImage(e => invokeChooseImage(callbackId, 'ok', sizeType, [e]),
- e => invokeChooseImage(callbackId, 'fail', 1), {
- filename: TEMP_PATH + '/camera/'
- });
-};
-const openAlbum = function (callbackId, sizeType, count) {
- // TODO Android 需要拷贝到 temp 目录
- plus.gallery.pick(e => invokeChooseImage(callbackId, 'ok', sizeType, e.files.map(file => {
- return file
- })), e => {
- invokeChooseImage(callbackId, 'fail', 2);
- }, {
- maximum: count,
- multiple: true,
- system: false,
- filename: TEMP_PATH + '/gallery/'
- });
-};
-
-function chooseImage$1 ({
- count = 9,
- sizeType = ['original', 'compressed'],
- sourceType = ['album', 'camera']
-} = {}, callbackId) {
- let fallback = true;
- if (sourceType.length === 1) {
- if (sourceType[0] === 'album') {
- fallback = false;
- openAlbum(callbackId, sizeType, count);
- } else if (sourceType[0] === 'camera') {
- fallback = false;
- openCamera(callbackId, sizeType);
- }
- }
- if (fallback) {
- plus.nativeUI.actionSheet({
- cancel: '取消',
- buttons: [{
- title: '拍摄'
- }, {
- title: '从手机相册选择'
- }]
- }, (e) => {
- switch (e.index) {
- case 0:
- invokeChooseImage(callbackId, 'fail', 0);
- break
- case 1:
- openCamera(callbackId, sizeType);
- break
- case 2:
- openAlbum(callbackId, sizeType, count);
- break
- }
- });
- }
-}
-
-const invokeChooseVideo = function (callbackId, type, tempFilePath = '') {
- let callbackResult = {
- errMsg: `chooseVideo:${type}`,
- tempFilePath: tempFilePath,
- duration: 0,
- size: 0,
- height: 0,
- width: 0
- };
-
- if (type !== 'ok') {
- invoke(callbackId, callbackResult);
- return
- }
-
- plus.io.getVideoInfo({
- filePath: tempFilePath,
- success (videoInfo) {
- callbackResult.size = videoInfo.size;
- callbackResult.duration = videoInfo.duration;
- callbackResult.width = videoInfo.width;
- callbackResult.height = videoInfo.height;
- invoke(callbackId, callbackResult);
- },
- fail () {
- invoke(callbackId, callbackResult);
- },
- complete () {
- invoke(callbackId, callbackResult);
- }
- });
-};
-const openCamera$1 = function (callbackId, maxDuration, cameraIndex) {
- const camera = plus.camera.getCamera();
- camera.startVideoCapture(e => invokeChooseVideo(callbackId, 'ok', e), e => invokeChooseVideo(
- callbackId, 'fail'), {
- index: cameraIndex,
- videoMaximumDuration: maxDuration,
- filename: TEMP_PATH + '/camera/'
- });
-};
-const openAlbum$1 = function (callbackId) {
- plus.gallery.pick(e => {
- invokeChooseVideo(callbackId, 'ok', e);
- }, e => invokeChooseVideo(callbackId, 'fail'), {
- filter: 'video',
- system: false,
- filename: TEMP_PATH + '/gallery/'
- });
-};
-function chooseVideo$1 ({
- sourceType = ['album', 'camera'],
- maxDuration = 60,
- camera = 'back'
-} = {}, callbackId) {
- let fallback = true;
- let cameraIndex = (camera === 'front') ? 2 : 1;
- if (sourceType.length === 1) {
- if (sourceType[0] === 'album') {
- fallback = false;
- openAlbum$1(callbackId);
- } else if (sourceType[0] === 'camera') {
- fallback = false;
- openCamera$1(callbackId, maxDuration, cameraIndex);
- }
- }
- if (fallback) {
- plus.nativeUI.actionSheet({
- cancel: '取消',
- buttons: [{
- title: '拍摄'
- }, {
- title: '从手机相册选择'
- }]
- }, e => {
- switch (e.index) {
- case 0:
- invokeChooseVideo(callbackId, 'fail');
- break
- case 1:
- openCamera$1(callbackId, maxDuration, cameraIndex);
- break
- case 2:
- openAlbum$1(callbackId);
- break
- }
- });
- }
-}
-
-function compressImage ({
- src,
- quality
-}, callbackId) {
- var dst = TEMP_PATH + '/compressed/' + Date.now() + (src.match(/\.\S+$/) || [''])[0];
- plus.zip.compressImage({
- src,
- dst,
- quality
- }, () => {
- invoke(callbackId, {
- errMsg: `compressImage:ok`,
- tempFilePath: dst
- });
- }, () => {
- invoke(callbackId, {
- errMsg: `compressImage:fail`
- });
- });
-}
-
-function getImageInfo$1 ({
- src
-} = {}, callbackId) {
- // fixed by hxy
- plus.io.getImageInfo({
- src,
- success (imageInfo) {
- invoke(callbackId, {
- errMsg: 'getImageInfo:ok',
- ...imageInfo
- });
- },
- fail () {
- invoke(callbackId, {
- errMsg: 'getImageInfo:fail'
- });
- }
- });
-}
-
-function previewImage$1 ({
- current = 0,
- background = '#000000',
- indicator = 'number',
- loop = false,
- urls,
- longPressActions
-} = {}) {
- urls = urls.map(url => getRealPath$1(url));
-
- const index = Number(current);
- if (isNaN(index)) {
- current = urls.indexOf(getRealPath$1(current));
- current = current < 0 ? 0 : current;
- } else {
- current = index;
- }
-
- plus.nativeUI.previewImage(urls, {
- current,
- background,
- indicator,
- loop,
- onLongPress: function (res) {
- let itemList = [];
- let itemColor = '';
- let title = '';
- let hasLongPressActions = longPressActions && longPressActions.callbackId;
- if (!hasLongPressActions) {
- itemList = ['保存相册'];
- itemColor = '#000000';
- title = '';
- } else {
- itemList = longPressActions.itemList ? longPressActions.itemList : [];
- itemColor = longPressActions.itemColor ? longPressActions.itemColor : '#000000';
- title = longPressActions.title ? longPressActions.title : '';
- }
-
- const options = {
- buttons: itemList.map(item => ({
- title: item,
- color: itemColor
- })),
- cancel: '取消'
- };
- if (title) {
- options.title = title;
- }
- // if (plus.os.name === 'iOS') {
- // options.cancel = '取消'
- // }
- plus.nativeUI.actionSheet(options, (e) => {
- if (e.index > 0) {
- if (hasLongPressActions) {
- publish(longPressActions.callbackId, {
- errMsg: 'showActionSheet:ok',
- tapIndex: e.index - 1,
- index: res.index
- });
- return
- }
- plus.gallery.save(res.url, function (GallerySaveEvent) {
- plus.nativeUI.toast('保存图片到相册成功');
- });
- } else if (hasLongPressActions) {
- publish(longPressActions.callbackId, {
- errMsg: 'showActionSheet:fail cancel'
- });
- }
- });
- }
- });
- return {
- errMsg: 'previewImage:ok'
- }
-}
-
-let recorder$1;
-let recordTimeout$1;
-
-const publishRecorderStateChange = (state, res = {}) => {
- publish('onRecorderStateChange', Object.assign({
- state
- }, res));
-};
-
-const Recorder = {
- start ({
- duration = 60000,
- sampleRate,
- numberOfChannels,
- encodeBitRate,
- format = 'mp3',
- frameSize,
- audioSource = 'auto'
- }, callbackId) {
- if (recorder$1) {
- return publishRecorderStateChange('start')
- }
- recorder$1 = plus.audio.getRecorder();
- recorder$1.record({
- format,
- samplerate: sampleRate,
- filename: TEMP_PATH + '/recorder/'
- }, res => publishRecorderStateChange('stop', {
- tempFilePath: res
- }), err => publishRecorderStateChange('error', {
- errMsg: err.message
- }));
- recordTimeout$1 = setTimeout(() => {
- Recorder.stop();
- }, duration);
- publishRecorderStateChange('start');
- },
- stop () {
- if (recorder$1) {
- recorder$1.stop();
- recorder$1 = false;
- recordTimeout$1 && clearTimeout(recordTimeout$1);
- }
- },
- pause () {
- if (recorder$1) {
- publishRecorderStateChange('error', {
- errMsg: '暂不支持录音pause操作'
- });
- }
- },
- resume () {
- if (recorder$1) {
- publishRecorderStateChange('error', {
- errMsg: '暂不支持录音resume操作'
- });
- }
- }
-};
-
-function operateRecorder ({
- operationType,
- ...args
-}, callbackId) {
- Recorder[operationType](args);
- return {
- errMsg: 'operateRecorder:ok'
- }
-}
-
-function saveImageToPhotosAlbum ({
- filePath
-} = {}, callbackId) {
- plus.gallery.save(getRealPath$1(filePath), e => {
- invoke(callbackId, {
- errMsg: 'saveImageToPhotosAlbum:ok'
- });
- }, e => {
- invoke(callbackId, {
- errMsg: 'saveImageToPhotosAlbum:fail'
- });
- });
-}
-
-function saveVideoToPhotosAlbum ({
- filePath
-} = {}, callbackId) {
- plus.gallery.save(getRealPath$1(filePath), e => {
- invoke(callbackId, {
- errMsg: 'saveVideoToPhotosAlbum:ok'
- });
- }, e => {
- invoke(callbackId, {
- errMsg: 'saveVideoToPhotosAlbum:fail'
- });
- });
-}
-
-let downloadTaskId = 0;
-const downloadTasks = {};
-
-const publishStateChange = (res) => {
- publish('onDownloadTaskStateChange', res);
-};
-
-const createDownloadTaskById = function (downloadTaskId, {
- url,
- header
-} = {}) {
- const downloader = plus.downloader.createDownload(url, {
- time: __uniConfig.networkTimeout.downloadFile ? __uniConfig.networkTimeout.downloadFile / 1000 : 120,
- filename: TEMP_PATH + '/download/',
- // 需要与其它平台上的表现保持一致,不走重试的逻辑。
- retry: 0,
- retryInterval: 0
- }, (download, statusCode) => {
- if (statusCode) {
- publishStateChange({
- downloadTaskId,
- state: 'success',
- tempFilePath: download.filename,
- statusCode
- });
- } else {
- publishStateChange({
- downloadTaskId,
- state: 'fail',
- statusCode
- });
- }
- });
- for (const name in header) {
- if (header.hasOwnProperty(name)) {
- downloader.setRequestHeader(name, header[name]);
- }
- }
- downloader.addEventListener('statechanged', (download, status) => {
- if (download.downloadedSize && download.totalSize) {
- publishStateChange({
- downloadTaskId,
- state: 'progressUpdate',
- progress: parseInt(download.downloadedSize / download.totalSize * 100),
- totalBytesWritten: download.downloadedSize,
- totalBytesExpectedToWrite: download.totalSize
- });
- }
- });
- downloadTasks[downloadTaskId] = downloader;
- downloader.start();
- return {
- downloadTaskId,
- errMsg: 'createDownloadTask:ok'
- }
-};
-
-function operateDownloadTask ({
- downloadTaskId,
- operationType
-} = {}) {
- const downloadTask = downloadTasks[downloadTaskId];
- if (downloadTask && operationType === 'abort') {
- delete downloadTasks[downloadTaskId];
- downloadTask.abort();
- publishStateChange({
- downloadTaskId,
- state: 'fail',
- errMsg: 'abort'
- });
- return {
- errMsg: 'operateDownloadTask:ok'
- }
- }
- return {
- errMsg: 'operateDownloadTask:fail'
- }
-}
-
-function createDownloadTask (args) {
- return createDownloadTaskById(++downloadTaskId, args)
-}
-
-const USER_AGENT =
- 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13G36 MicroMessenger/6.5.1 NetType/WIFI Language/zh_CN';
-
-let requestTaskId = 0;
-const requestTasks = {};
-
-const publishStateChange$1 = res => {
- publish('onRequestTaskStateChange', res);
- delete requestTasks[requestTaskId];
-};
-
-const parseResponseHeaders = headerStr => {
- const headers = {};
- if (!headerStr) {
- return headers
- }
- const headerPairs = headerStr.split('\u000d\u000a');
- for (let i = 0; i < headerPairs.length; i++) {
- const headerPair = headerPairs[i];
- const index = headerPair.indexOf('\u003a\u0020');
- if (index > 0) {
- const key = headerPair.substring(0, index);
- const val = headerPair.substring(index + 2);
- headers[key] = val;
- }
- }
- return headers
-};
-
-function createRequestTaskById (requestTaskId, {
- url,
- data,
- header,
- method = 'GET'
-} = {}) {
- let abortTimeout;
- let xhr;
- // fixed by hxy 始终使用 plus 的 XHR
- xhr = new plus.net.XMLHttpRequest();
- xhr.open(method, url, true);
- xhr.onreadystatechange = function () {
- if (xhr.readyState === 4) {
- if (abortTimeout) {
- clearTimeout(abortTimeout);
- }
- xhr.onreadystatechange = null;
- const statusCode = xhr.status;
- if (statusCode) {
- publishStateChange$1({
- requestTaskId,
- state: 'success',
- data: xhr.responseText,
- statusCode,
- header: parseResponseHeaders(xhr.getAllResponseHeaders())
- });
- } else {
- publishStateChange$1({
- requestTaskId,
- state: 'fail',
- statusCode,
- errMsg: 'abort'
- });
- }
- }
- };
- let hasContentType = false;
- for (const name in header) {
- if (header.hasOwnProperty(name)) {
- if (!hasContentType && name.toLowerCase() === 'content-type') {
- hasContentType = true;
- xhr.setRequestHeader('Content-Type', header[name]); // 大小写必须一致,否则部分服务器会返回invalid header name
- } else {
- xhr.setRequestHeader(name, header[name]);
- }
- }
- }
- if (!hasContentType && method === 'POST') {
- xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
- }
- if (__uniConfig.crossDomain === true) {
- xhr.setRequestHeader('User-Agent', USER_AGENT);
- }
-
- if (__uniConfig.networkTimeout.request) {
- abortTimeout = setTimeout(() => {
- xhr.onreadystatechange = null;
- xhr.abort();
- publishStateChange$1({
- requestTaskId,
- state: 'fail',
- data: xhr.responseText,
- statusCode: 0,
- errMsg: 'timeout'
- });
- }, __uniConfig.networkTimeout.request);
- }
-
- if (typeof data !== 'string' && method === 'GET') {
- data = null;
- }
- try {
- xhr.send(data);
- requestTasks[requestTaskId] = xhr;
- } catch (e) {
- return {
- requestTaskId,
- errMsg: 'createRequestTask:fail'
- }
- }
- return {
- requestTaskId,
- errMsg: 'createRequestTask:ok'
- }
-}
-
-function createRequestTask (args) {
- return createRequestTaskById(++requestTaskId, args)
-}
-
-function operateRequestTask ({
- requestTaskId,
- operationType
-} = {}) {
- const requestTask = requestTasks[requestTaskId];
- if (requestTask && operationType === 'abort') {
- requestTask.abort();
- return {
- errMsg: 'operateRequestTask:ok'
- }
- }
- return {
- errMsg: 'operateRequestTask:fail'
- }
-}
-
-let socketTaskId = 0;
-const socketTasks = {};
-
-const publishStateChange$2 = (res) => {
- publish('onSocketTaskStateChange', res);
-};
-
-const createSocketTaskById = function (socketTaskId, {
- url,
- data,
- header,
- method,
- protocols
-} = {}) {
- // fixed by hxy 需要测试是否支持 arraybuffer
- const socket = requireNativePlugin('webSocket');
- socket.WebSocket(url, Array.isArray(protocols) ? protocols.join(',') : protocols);
- // socket.binaryType = 'arraybuffer'
- socketTasks[socketTaskId] = socket;
-
- socket.onopen(function (e) {
- publishStateChange$2({
- socketTaskId,
- state: 'open'
- });
- });
- socket.onmessage(function (e) {
- publishStateChange$2({
- socketTaskId,
- state: 'message',
- data: e.data
- });
- });
- socket.onerror(function (e) {
- publishStateChange$2({
- socketTaskId,
- state: 'error',
- errMsg: e.message
- });
- });
- socket.onclose(function (e) {
- delete socketTasks[socketTaskId];
- publishStateChange$2({
- socketTaskId,
- state: 'close'
- });
- });
- return {
- socketTaskId,
- errMsg: 'createSocketTask:ok'
- }
-};
-
-function createSocketTask (args) {
- return createSocketTaskById(++socketTaskId, args)
-}
-
-function operateSocketTask (args) {
- const {
- operationType,
- code,
- data,
- socketTaskId
- } = unpack(args);
- const socket = socketTasks[socketTaskId];
- if (!socket) {
- return {
- errMsg: 'operateSocketTask:fail'
- }
- }
- switch (operationType) {
- case 'send':
- if (data) {
- socket.send(data);
- }
- return {
- errMsg: 'operateSocketTask:ok'
- }
- case 'close':
- socket.close(code);
- delete socketTasks[socketTaskId];
- return {
- errMsg: 'operateSocketTask:ok'
- }
- }
- return {
- errMsg: 'operateSocketTask:fail'
- }
-}
-
-let uploadTaskId = 0;
-const uploadTasks = {};
-
-const publishStateChange$3 = (res) => {
- publish('onUploadTaskStateChange', res);
-};
-
-const createUploadTaskById = function (uploadTaskId, {
- url,
- filePath,
- name,
- files,
- header,
- formData
-} = {}) {
- const uploader = plus.uploader.createUpload(url, {
- timeout: __uniConfig.networkTimeout.uploadFile ? __uniConfig.networkTimeout.uploadFile / 1000 : 120,
- // 需要与其它平台上的表现保持一致,不走重试的逻辑。
- retry: 0,
- retryInterval: 0
- }, (upload, statusCode) => {
- if (statusCode) {
- publishStateChange$3({
- uploadTaskId,
- state: 'success',
- data: upload.responseText,
- statusCode
- });
- } else {
- publishStateChange$3({
- uploadTaskId,
- state: 'fail',
- data: '',
- statusCode
- });
- }
- delete uploadTasks[uploadTaskId];
- });
-
- for (const name in header) {
- if (header.hasOwnProperty(name)) {
- uploader.setRequestHeader(name, header[name]);
- }
- }
- for (const name in formData) {
- if (formData.hasOwnProperty(name)) {
- uploader.addData(name, formData[name]);
- }
- }
- if (files && files.length) {
- files.forEach(file => {
- uploader.addFile(getRealPath$1(file.uri), {
- key: file.name || 'file'
- });
- });
- } else {
- uploader.addFile(getRealPath$1(filePath), {
- key: name
- });
- }
- uploader.addEventListener('statechanged', (upload, status) => {
- if (upload.uploadedSize && upload.totalSize) {
- publishStateChange$3({
- uploadTaskId,
- state: 'progressUpdate',
- progress: parseInt(upload.uploadedSize / upload.totalSize * 100),
- totalBytesSent: upload.uploadedSize,
- totalBytesExpectedToSend: upload.totalSize
- });
- }
- });
- uploadTasks[uploadTaskId] = uploader;
- uploader.start();
- return {
- uploadTaskId,
- errMsg: 'createUploadTask:ok'
- }
-};
-
-function operateUploadTask ({
- uploadTaskId,
- operationType
-} = {}) {
- const uploadTask = uploadTasks[uploadTaskId];
- if (uploadTask && operationType === 'abort') {
- delete uploadTasks[uploadTaskId];
- uploadTask.abort();
- publishStateChange$3({
- uploadTaskId,
- state: 'fail',
- errMsg: 'abort'
- });
- return {
- errMsg: 'operateUploadTask:ok'
- }
- }
- return {
- errMsg: 'operateUploadTask:fail'
- }
-}
-
-function createUploadTask (args) {
- return createUploadTaskById(++uploadTaskId, args)
-}
-
-const providers = {
- oauth (callback) {
- plus.oauth.getServices(services => {
- const provider = [];
- services.forEach(({
- id
- }) => {
- provider.push(id);
- });
- callback(null, provider);
- }, err => {
- callback(err);
- });
- },
- share (callback) {
- plus.share.getServices(services => {
- const provider = [];
- services.forEach(({
- id
- }) => {
- provider.push(id);
- });
- callback(null, provider);
- }, err => {
- callback(err);
- });
- },
- payment (callback) {
- plus.payment.getChannels(services => {
- const provider = [];
- services.forEach(({
- id
- }) => {
- provider.push(id);
- });
- callback(null, provider);
- }, err => {
- callback(err);
- });
- },
- push (callback) {
- if (typeof weex !== 'undefined' || typeof plus !== 'undefined') {
- callback(null, [plus.push.getClientInfo().id]);
- } else {
- callback(null, []);
- }
- }
-};
-
-function getProvider$1 ({
- service
-}, callbackId) {
- if (providers[service]) {
- providers[service]((err, provider) => {
- if (err) {
- invoke(callbackId, {
- errMsg: 'getProvider:fail:' + err.message
- });
- } else {
- invoke(callbackId, {
- errMsg: 'getProvider:ok',
- service,
- provider
- });
- }
- });
- } else {
- invoke(callbackId, {
- errMsg: 'getProvider:fail:服务[' + service + ']不支持'
- });
- }
-}
-
-const loginServices = {};
-
-const loginByService = (provider, callbackId) => {
- function login () {
- loginServices[provider].login(res => {
- const authResult = res.target.authResult;
- invoke(callbackId, {
- code: authResult.code,
- authResult: authResult,
- errMsg: 'login:ok'
- });
- }, err => {
- invoke(callbackId, {
- code: err.code,
- errMsg: 'login:fail:' + err.message
- });
- });
- }
- // 先注销再登录
- loginServices[provider].logout(login, login);
-};
-/**
- * 微信登录
- */
-function login (params, callbackId) {
- const provider = params.provider || 'weixin';
- if (loginServices[provider]) {
- loginByService(provider, callbackId);
- } else {
- plus.oauth.getServices(services => {
- loginServices[provider] = services.find(({
- id
- }) => id === provider);
- if (!loginServices[provider]) {
- invoke(callbackId, {
- code: '',
- errMsg: 'login:fail:登录服务[' + provider + ']不存在'
- });
- } else {
- loginByService(provider, callbackId);
- }
- }, err => {
- invoke(callbackId, {
- code: err.code,
- errMsg: 'login:fail:' + err.message
- });
- });
- }
-}
-
-const getUserInfo = function (params, callbackId) {
- const provider = params.provider || 'weixin';
- const loginService = loginServices[provider];
- if (!loginService || !loginService.authResult) {
- return invoke(callbackId, {
- errMsg: 'operateWXData:fail:请先调用 uni.login'
- })
- }
- loginService.getUserInfo(res => {
- if (provider === 'weixin') {
- const wechatUserInfo = loginService.userInfo;
- const userInfo = {
- openId: wechatUserInfo.openid,
- nickName: wechatUserInfo.nickname,
- gender: wechatUserInfo.sex,
- city: wechatUserInfo.city,
- province: wechatUserInfo.province,
- country: wechatUserInfo.country,
- avatarUrl: wechatUserInfo.headimgurl,
- unionId: wechatUserInfo.unionid
- };
- invoke(callbackId, {
- errMsg: 'operateWXData:ok',
- data: {
- data: JSON.stringify(userInfo),
- rawData: '',
- signature: '',
- encryptedData: '',
- iv: ''
- }
- });
- } else {
- loginService.userInfo.openId = loginService.userInfo.openId || loginService.userInfo.openid ||
- loginService.authResult.openid;
- loginService.userInfo.nickName = loginService.userInfo.nickName || loginService.userInfo.nickname;
- loginService.userInfo.avatarUrl = loginService.userInfo.avatarUrl || loginService.userInfo.avatarUrl ||
- loginService.userInfo.headimgurl;
- invoke(callbackId, {
- errMsg: 'operateWXData:ok',
- data: {
- data: JSON.stringify(loginService.userInfo),
- rawData: '',
- signature: '',
- encryptedData: '',
- iv: ''
- }
- });
- }
- }, err => {
- invoke(callbackId, {
- errMsg: 'operateWXData:fail:' + err.message
- });
- });
-};
-
-/**
- * 获取用户信息
- */
-function operateWXData (params, callbackId) {
- switch (params.data.api_name) {
- case 'webapi_getuserinfo':
- getUserInfo(params, callbackId);
- break
- default:
- return {
- errMsg: 'operateWXData:fail'
- }
- }
-}
-
-function requestPayment (params, callbackId) {
- const provider = params.provider;
- plus.payment.getChannels(services => {
- const service = services.find(({
- id
- }) => id === provider);
- if (!service) {
- invoke(callbackId, {
- errMsg: 'requestPayment:fail:支付服务[' + provider + ']不存在'
- });
- } else {
- plus.payment.request(service, params.orderInfo, res => {
- invoke(callbackId, {
- errMsg: 'requestPayment:ok'
- });
- }, err => {
- invoke(callbackId, {
- errMsg: 'requestPayment:fail:' + err.message
- });
- });
- }
- }, err => {
- invoke(callbackId, {
- errMsg: 'requestPayment:fail:' + err.message
- });
- });
-}
-
-let onPushing;
-
-let isListening = false;
-
-let unsubscribe = false;
-
-function subscribePush (params, callbackId) {
- const clientInfo = plus.push.getClientInfo();
- if (clientInfo) {
- if (!isListening) {
- isListening = true;
- plus.push.addEventListener('receive', msg => {
- if (onPushing && !unsubscribe) {
- publish('onPushMessage', {
- messageId: msg.__UUID__,
- data: msg.payload,
- errMsg: 'onPush:ok'
- });
- }
- });
- }
- unsubscribe = false;
- clientInfo.errMsg = 'subscribePush:ok';
- return clientInfo
- } else {
- return {
- errMsg: 'subscribePush:fail:请确保当前运行环境已包含 push 模块'
- }
- }
-}
-
-function unsubscribePush (params) {
- unsubscribe = true;
- return {
- errMsg: 'unsubscribePush:ok'
- }
-}
-
-function onPush () {
- if (!isListening) {
- return {
- errMsg: 'onPush:fail:请先调用 uni.subscribePush'
- }
- }
- if (plus.push.getClientInfo()) {
- onPushing = true;
- return {
- errMsg: 'onPush:ok'
- }
- }
- return {
- errMsg: 'onPush:fail:请确保当前运行环境已包含 push 模块'
- }
-}
-
-function offPush (params) {
- onPushing = false;
- return {
- errMsg: 'offPush:ok'
- }
-}
-
-// 0:图文,1:纯文字,2:纯图片,3:音乐,4:视频,5:小程序
-const TYPES = {
- '0': {
- name: 'web',
- title: '图文'
- },
- '1': {
- name: 'text',
- title: '纯文字'
- },
- '2': {
- name: 'image',
- title: '纯图片'
- },
- '3': {
- name: 'music',
- title: '音乐'
- },
- '4': {
- name: 'video',
- title: '视频'
- },
- '5': {
- name: 'miniProgram',
- title: '小程序'
- }
-};
-
-const parseParams = (args, callbackId, method) => {
- args.type = args.type || 0;
-
- let {
- provider,
- type,
- title,
- summary: content,
- href,
- imageUrl,
- mediaUrl: media,
- scene,
- miniProgram
- } = args;
-
- if (typeof imageUrl === 'string' && imageUrl) {
- imageUrl = getRealPath$1(imageUrl);
- }
-
- const shareType = TYPES[type + ''];
- if (shareType) {
- let sendMsg = {
- provider,
- type: shareType.name,
- title,
- content,
- href,
- pictures: [imageUrl],
- thumbs: [imageUrl],
- media,
- miniProgram,
- extra: {
- scene
- }
- };
- if (provider === 'weixin' && (type === 1 || type === 2)) {
- delete sendMsg.thumbs;
- }
- return sendMsg
- }
- return '分享参数 type 不正确'
-};
-
-const sendShareMsg = function (service, params, callbackId, method = 'share') {
- service.send(
- params,
- () => {
- invoke(callbackId, {
- errMsg: method + ':ok'
- });
- },
- err => {
- invoke(callbackId, {
- errMsg: method + ':fail:' + err.message
- });
- }
- );
-};
-
-function shareAppMessageDirectly ({
- title,
- path,
- imageUrl,
- useDefaultSnapshot
-}, callbackId) {
- title = title || __uniConfig.appname;
- const goShare = () => {
- share({
- provider: 'weixin',
- type: 0,
- title,
- imageUrl,
- href: path,
- scene: 'WXSceneSession'
- },
- callbackId,
- 'shareAppMessageDirectly'
- );
- };
- if (useDefaultSnapshot) {
- const pages = getCurrentPages();
- const webview = plus.webview.getWebviewById(pages[pages.length - 1].__wxWebviewId__ + '');
- if (webview) {
- const bitmap = new plus.nativeObj.Bitmap();
- webview.draw(
- bitmap,
- () => {
- const fileName = TEMP_PATH + '/share/snapshot.jpg';
- bitmap.save(
- fileName, {
- overwrite: true,
- format: 'jpg'
- },
- () => {
- imageUrl = fileName;
- goShare();
- },
- err => {
- invoke(callbackId, {
- errMsg: 'shareAppMessageDirectly:fail:' + err.message
- });
- }
- );
- },
- err => {
- invoke(callbackId, {
- errMsg: 'shareAppMessageDirectly:fail:' + err.message
- });
- }
- );
- } else {
- goShare();
- }
- } else {
- goShare();
+function upx2px (number, newDeviceWidth) {
+ if (deviceWidth === 0) {
+ checkDeviceWidth();
}
-}
-function share (params, callbackId, method = 'share') {
- params = parseParams(params);
- if (typeof params === 'string') {
- return invoke(callbackId, {
- errMsg: method + ':fail:' + params
- })
+ number = Number(number);
+ if (number === 0) {
+ return 0
}
- const provider = params.provider;
- plus.share.getServices(
- services => {
- const service = services.find(({
- id
- }) => id === provider);
- if (!service) {
- invoke(callbackId, {
- errMsg: method + ':fail:分享服务[' + provider + ']不存在'
- });
- } else {
- if (service.authenticated) {
- sendShareMsg(service, params, callbackId);
- } else {
- service.authorize(
- () => sendShareMsg(service, params, callbackId),
- err => {
- invoke(callbackId, {
- errMsg: method + ':fail:' + err.message
- });
- }
- );
- }
- }
- },
- err => {
- invoke(callbackId, {
- errMsg: method + ':fail:' + err.message
- });
- }
- );
-}
-
-function showKeyboard () {
- plus.key.showSoftKeybord();
- return {
- errMsg: 'showKeyboard:ok'
+ let result = (number / BASE_DEVICE_WIDTH) * (newDeviceWidth || deviceWidth);
+ if (result < 0) {
+ result = -result;
}
-}
-
-function hideKeyboard () {
- plus.key.hideSoftKeybord();
- return {
- errMsg: 'hideKeyboard:ok'
+ result = Math.floor(result + EPS);
+ if (result === 0) {
+ if (deviceDPR === 1 || !isIOS) {
+ return 1
+ } else {
+ return 0.5
+ }
}
+ return number < 0 ? -result : result
}
-function setNavigationBarTitle$1 ({
- title = ''
+var require_context_module_0_3 = /*#__PURE__*/Object.freeze({
+ upx2px: upx2px
+});
+
+function setStorage$1 ({
+ key,
+ data
} = {}) {
- const webview = getLastWebview();
- if (webview) {
- const style = webview.getStyle();
- if (style && style.titleNView) {
- webview.setStyle({
- titleNView: {
- titleText: title
- }
- });
- }
- return {
- errMsg: 'setNavigationBarTitle:ok'
+ const value = {
+ type: typeof data === 'object' ? 'object' : 'string',
+ data: data
+ };
+ localStorage.setItem(key, JSON.stringify(value));
+ const keyList = localStorage.getItem('uni-storage-keys');
+ if (!keyList) {
+ localStorage.setItem('uni-storage-keys', JSON.stringify([key]));
+ } else {
+ const keys = JSON.parse(keyList);
+ if (keys.indexOf(key) < 0) {
+ keys.push(key);
+ localStorage.setItem('uni-storage-keys', JSON.stringify(keys));
}
}
return {
- errMsg: 'setNavigationBarTitle:fail'
+ errMsg: 'setStorage:ok'
}
}
-function showNavigationBarLoading () {
- plus.nativeUI.showWaiting('', {
- modal: false
+function setStorageSync$1 (key, data) {
+ setStorage$1({
+ key,
+ data
});
- return {
- errMsg: 'showNavigationBarLoading:ok'
- }
-}
-
-function hideNavigationBarLoading () {
- plus.nativeUI.closeWaiting();
- return {
- errMsg: 'hideNavigationBarLoading:ok'
- }
}
-function setNavigationBarColor$1 ({
- frontColor,
- backgroundColor
+function getStorage ({
+ key
} = {}) {
- const webview = getLastWebview();
- if (webview) {
- const styles = {};
- if (frontColor) {
- styles.titleColor = frontColor;
- }
- if (backgroundColor) {
- styles.backgroundColor = backgroundColor;
- }
- plus.navigator.setStatusBarStyle(frontColor === '#000000' ? 'dark' : 'light');
- const style = webview.getStyle();
- if (style && style.titleNView) {
- webview.setStyle({
- titleNView: styles
- });
- }
- return {
- errMsg: 'setNavigationBarColor:ok'
- }
- }
- return {
- errMsg: 'setNavigationBarColor:fail'
- }
-}
-
-let waiting;
-let waitingTimeout;
-let toast = false;
-let toastTimeout;
-
-function showLoading$1 (args) {
- const ret = showToast$1(args);
- if (ret && ret.errMsg) {
- ret.errMsg = ret.errMsg.replace('showToast', 'showLoading');
+ const data = localStorage.getItem(key);
+ return data ? {
+ data: JSON.parse(data).data,
+ errMsg: 'getStorage:ok'
+ } : {
+ data: '',
+ errMsg: 'getStorage:fail'
}
- return ret
}
-function hideLoading () {
- const ret = hideToast();
- if (ret && ret.errMsg) {
- ret.errMsg = ret.errMsg.replace('hideToast', 'hideLoading');
- }
- return ret
+function getStorageSync (key) {
+ const res = getStorage({
+ key
+ });
+ return res.data
}
-function showToast$1 ({
- title = '',
- icon = 'success',
- image = '',
- duration = 1500,
- mask = false,
- position = ''
+function removeStorage ({
+ key
} = {}) {
- if (position) {
- if (toast) {
- toastTimeout && clearTimeout(toastTimeout);
- plus.nativeUI.closeToast();
- }
- if (waiting) {
- waitingTimeout && clearTimeout(waitingTimeout);
- waiting.close();
- }
- if (~['top', 'center', 'bottom'].indexOf(position)) {
- let richText = `${title}`;
- plus.nativeUI.toast(richText, {
- verticalAlign: position,
- type: 'richtext'
- });
- toast = true;
- toastTimeout = setTimeout(() => {
- hideToast();
- }, 2000);
- return {
- errMsg: 'showToast:ok'
- }
- }
- console.warn('uni.showToast 传入的 "position" 值 "' + position + '" 无效');
- }
-
- if (duration) {
- if (waiting) {
- waitingTimeout && clearTimeout(waitingTimeout);
- waiting.close();
- }
- if (toast) {
- toastTimeout && clearTimeout(toastTimeout);
- plus.nativeUI.closeToast();
- }
- if (icon && !~['success', 'loading', 'none'].indexOf(icon)) {
- icon = 'success';
- }
- const waitingOptions = {
- modal: mask,
- back: 'transmit',
- padding: '10px',
- size: '16px' // 固定字体大小
- };
- if (!image && (!icon || icon === 'none')) { // 无图
- // waitingOptions.width = '120px'
- // waitingOptions.height = '40px'
- waitingOptions.loading = {
- display: 'none'
- };
- } else { // 有图
- waitingOptions.width = '140px';
- waitingOptions.height = '112px';
- }
- if (image) {
- waitingOptions.loading = {
- display: 'block',
- height: '55px',
- icon: image,
- interval: duration
- };
- } else {
- if (icon === 'success') {
- waitingOptions.loading = {
- display: 'block',
- height: '55px',
- icon: '__uniappsuccess.png',
- interval: duration
-
- };
- }
- }
-
- waiting = plus.nativeUI.showWaiting(title, waitingOptions);
- waitingTimeout = setTimeout(() => {
- hideToast();
- }, duration);
- }
- return {
- errMsg: 'showToast:ok'
- }
-}
-
-function hideToast () {
- if (toast) {
- toastTimeout && clearTimeout(toastTimeout);
- plus.nativeUI.closeToast();
- toast = false;
- }
- if (waiting) {
- waitingTimeout && clearTimeout(waitingTimeout);
- waiting.close();
- waiting = null;
- waitingTimeout = null;
+ const keyList = localStorage.getItem('uni-storage-keys');
+ if (keyList) {
+ const keys = JSON.parse(keyList);
+ const index = keys.indexOf(key);
+ keys.splice(index, 1);
+ localStorage.setItem('uni-storage-keys', JSON.stringify(keys));
}
+ localStorage.removeItem(key);
return {
- errMsg: 'hideToast:ok'
+ errMsg: 'removeStorage:ok'
}
}
-function showModal$1 ({
- title = '',
- content = '',
- showCancel = true,
- cancelText = '取消',
- cancelColor = '#000000',
- confirmText = '确定',
- confirmColor = '#3CC51F'
-} = {}, callbackId) {
- plus.nativeUI.confirm(content, (e) => {
- if (showCancel) {
- invoke(callbackId, {
- errMsg: 'showModal:ok',
- confirm: e.index === 1,
- cancel: e.index === 0 || e.index === -1
- });
- } else {
- invoke(callbackId, {
- errMsg: 'showModal:ok',
- confirm: e.index === 0,
- cancel: false
- });
- }
- }, title, showCancel ? [cancelText, confirmText] : [confirmText]);
-}
-function showActionSheet$1 ({
- itemList = [],
- itemColor = '#000000',
- title = ''
-}, callbackId) {
- const options = {
- buttons: itemList.map(item => ({
- title: item
- }))
- };
- if (title) {
- options.title = title;
- }
- if (plus.os.name === 'iOS') {
- options.cancel = '取消';
- }
-
- plus.nativeUI.actionSheet(options, (e) => {
- if (e.index > 0) {
- invoke(callbackId, {
- errMsg: 'showActionSheet:ok',
- tapIndex: e.index - 1
- });
- } else {
- invoke(callbackId, {
- errMsg: 'showActionSheet:fail cancel'
- });
- }
+function removeStorageSync (key) {
+ removeStorage({
+ key
});
-}
-
-let webview;
-
-function startPullDownRefresh$1 () {
- if (webview) {
- webview.endPullToRefresh();
- }
- webview = getLastWebview();
- if (webview) {
- webview.beginPullToRefresh();
- return {
- errMsg: 'startPullDownRefresh:ok'
- }
- }
- return {
- errMsg: 'startPullDownRefresh:fail'
- }
-}
-
-function stopPullDownRefresh$1 () {
- if (webview) {
- webview.endPullToRefresh();
- webview = null;
- return {
- errMsg: 'stopPullDownRefresh:ok'
- }
- }
- return {
- errMsg: 'stopPullDownRefresh:fail'
- }
-}
-
-function setTabBarBadge$2 ({
- index,
- text,
- type
-}) {
- tabbar.setTabBarBadge(type, index, text);
- return {
- errMsg: 'setTabBarBadge:ok'
- }
}
-function setTabBarItem$2 ({
- index,
- text,
- iconPath,
- selectedIconPath
-}) {
- if (!isTabBarPage()) {
- return {
- errMsg: 'setTabBarItem:fail not TabBar page'
- }
- }
- tabbar.setTabBarItem(index, text, iconPath, selectedIconPath);
+function clearStorage () {
+ localStorage.clear();
return {
- errMsg: 'setTabBarItem:ok'
+ errMsg: 'clearStorage:ok'
}
}
-function setTabBarStyle$2 ({
- color,
- selectedColor,
- backgroundColor,
- borderStyle
-}) {
- if (!isTabBarPage()) {
- return {
- errMsg: 'setTabBarStyle:fail not TabBar page'
- }
- }
- tabbar.setTabBarStyle({
- color,
- selectedColor,
- backgroundColor,
- borderStyle
- });
- return {
- errMsg: 'setTabBarStyle:ok'
- }
+function clearStorageSync () {
+ clearStorage();
}
-function hideTabBar$2 ({
- animation
-}) {
- if (!isTabBarPage()) {
- return {
- errMsg: 'hideTabBar:fail not TabBar page'
- }
- }
- tabbar.hideTabBar(animation);
- return {
- errMsg: 'hideTabBar:ok'
+function getStorageInfo () { // TODO 暂时先不做大小的转换
+ const keyList = localStorage.getItem('uni-storage-keys');
+ return keyList ? {
+ keys: JSON.parse(keyList),
+ currentSize: 0,
+ limitSize: 0,
+ errMsg: 'getStorageInfo:ok'
+ } : {
+ keys: '',
+ currentSize: 0,
+ limitSize: 0,
+ errMsg: 'getStorageInfo:fail'
}
}
-function showTabBar$2 ({
- animation
-}) {
- if (!isTabBarPage()) {
- return {
- errMsg: 'showTabBar:fail not TabBar page'
- }
- }
- tabbar.showTabBar(animation);
- return {
- errMsg: 'showTabBar:ok'
+function getStorageInfoSync () {
+ const res = getStorageInfo();
+ delete res.errMsg;
+ return res
+}
+
+var require_context_module_0_4 = /*#__PURE__*/Object.freeze({
+ setStorage: setStorage$1,
+ setStorageSync: setStorageSync$1,
+ getStorage: getStorage,
+ getStorageSync: getStorageSync,
+ removeStorage: removeStorage,
+ removeStorageSync: removeStorageSync,
+ clearStorage: clearStorage,
+ clearStorageSync: clearStorageSync,
+ getStorageInfo: getStorageInfo,
+ getStorageInfoSync: getStorageInfoSync
+});
+
+function pageScrollTo$1 (args) {
+ const pages = getCurrentPages();
+ if (pages.length) {
+ UniServiceJSBridge.publishHandler('pageScrollTo', args, pages[pages.length - 1].$page.id);
}
+ return {}
}
+var require_context_module_0_5 = /*#__PURE__*/Object.freeze({
+ pageScrollTo: pageScrollTo$1
+});
+
+const api = Object.create(null);
+
+const modules$1 =
+ (function() {
+ var map = {
+ './base/base64.js': require_context_module_0_0,
+'./base/can-i-use.js': require_context_module_0_1,
+'./base/interceptor.js': require_context_module_0_2,
+'./base/upx2px.js': require_context_module_0_3,
+'./storage/storage.js': require_context_module_0_4,
+'./ui/page-scroll-to.js': require_context_module_0_5,
+
+ };
+ var req = function req(key) {
+ return map[key] || (function() { throw new Error("Cannot find module '" + key + "'.") }());
+ };
+ req.keys = function() {
+ return Object.keys(map);
+ };
+ return req;
+ })();
-var appApi = /*#__PURE__*/Object.freeze({
- startPullDownRefresh: startPullDownRefresh$1,
- stopPullDownRefresh: stopPullDownRefresh$1,
- chooseImage: chooseImage$1,
- createAudioInstance: createAudioInstance,
- destroyAudioInstance: destroyAudioInstance,
- setAudioState: setAudioState,
- getAudioState: getAudioState,
- operateAudio: operateAudio,
- enableAccelerometer: enableAccelerometer,
- addPhoneContact: addPhoneContact,
- openBluetoothAdapter: openBluetoothAdapter,
- closeBluetoothAdapter: closeBluetoothAdapter,
- getBluetoothAdapterState: getBluetoothAdapterState,
- startBluetoothDevicesDiscovery: startBluetoothDevicesDiscovery,
- stopBluetoothDevicesDiscovery: stopBluetoothDevicesDiscovery,
- getBluetoothDevices: getBluetoothDevices,
- getConnectedBluetoothDevices: getConnectedBluetoothDevices,
- createBLEConnection: createBLEConnection,
- closeBLEConnection: closeBLEConnection,
- getBLEDeviceServices: getBLEDeviceServices,
- getBLEDeviceCharacteristics: getBLEDeviceCharacteristics,
- notifyBLECharacteristicValueChange: notifyBLECharacteristicValueChange,
- notifyBLECharacteristicValueChanged: notifyBLECharacteristicValueChanged,
- readBLECharacteristicValue: readBLECharacteristicValue,
- writeBLECharacteristicValue: writeBLECharacteristicValue,
- getScreenBrightness: getScreenBrightness,
- setScreenBrightness: setScreenBrightness,
- setKeepScreenOn: setKeepScreenOn,
- getClipboardData: getClipboardData,
- setClipboardData: setClipboardData,
- enableCompass: enableCompass,
- getNetworkType: getNetworkType,
- onBeaconUpdate: onBeaconUpdate,
- onBeaconServiceChange: onBeaconServiceChange,
- getBeacons: getBeacons,
- startBeaconDiscovery: startBeaconDiscovery,
- stopBeaconDiscovery: stopBeaconDiscovery,
- makePhoneCall: makePhoneCall$1,
- SCAN_ID: SCAN_ID,
- SCAN_PATH: SCAN_PATH,
- scanCode: scanCode,
- getSystemInfo: getSystemInfo,
- vibrateLong: vibrateLong,
- vibrateShort: vibrateShort,
- saveFile: saveFile,
- getSavedFileList: getSavedFileList,
- getFileInfo: getFileInfo,
- getSavedFileInfo: getSavedFileInfo,
- removeSavedFile: removeSavedFile,
- openDocument: openDocument$1,
- chooseLocation: chooseLocation,
- getLocation: getLocation$1,
- openLocation: openLocation$1,
- startRecord: startRecord,
- stopRecord: stopRecord,
- playVoice: playVoice,
- pauseVoice: pauseVoice,
- stopVoice: stopVoice,
- getMusicPlayerState: getMusicPlayerState,
- operateMusicPlayer: operateMusicPlayer,
- setBackgroundAudioState: setBackgroundAudioState,
- operateBackgroundAudio: operateBackgroundAudio,
- getBackgroundAudioState: getBackgroundAudioState,
- chooseVideo: chooseVideo$1,
- compressImage: compressImage,
- getImageInfo: getImageInfo$1,
- previewImage: previewImage$1,
- operateRecorder: operateRecorder,
- saveImageToPhotosAlbum: saveImageToPhotosAlbum,
- saveVideoToPhotosAlbum: saveVideoToPhotosAlbum,
- operateDownloadTask: operateDownloadTask,
- createDownloadTask: createDownloadTask,
- createRequestTaskById: createRequestTaskById,
- createRequestTask: createRequestTask,
- operateRequestTask: operateRequestTask,
- createSocketTask: createSocketTask,
- operateSocketTask: operateSocketTask,
- operateUploadTask: operateUploadTask,
- createUploadTask: createUploadTask,
- getProvider: getProvider$1,
- login: login,
- operateWXData: operateWXData,
- requestPayment: requestPayment,
- subscribePush: subscribePush,
- unsubscribePush: unsubscribePush,
- onPush: onPush,
- offPush: offPush,
- shareAppMessageDirectly: shareAppMessageDirectly,
- share: share,
- showKeyboard: showKeyboard,
- hideKeyboard: hideKeyboard,
- setNavigationBarTitle: setNavigationBarTitle$1,
- showNavigationBarLoading: showNavigationBarLoading,
- hideNavigationBarLoading: hideNavigationBarLoading,
- setNavigationBarColor: setNavigationBarColor$1,
- showLoading: showLoading$1,
- hideLoading: hideLoading,
- showToast: showToast$1,
- hideToast: hideToast,
- showModal: showModal$1,
- showActionSheet: showActionSheet$1,
- setTabBarBadge: setTabBarBadge$2,
- setTabBarItem: setTabBarItem$2,
- setTabBarStyle: setTabBarStyle$2,
- hideTabBar: hideTabBar$2,
- showTabBar: showTabBar$2
+modules$1.keys().forEach(function (key) {
+ Object.assign(api, modules$1(key));
});
const SUCCESS = 'success';
@@ -6828,14 +2671,18 @@ function createVideoContext$1 (id, vm) {
return new VideoContext(id, elm)
}
-const ANI_DURATION$1 = 300;
-const ANI_SHOW$1 = 'pop-in';
+function requireNativePlugin (name) {
+ return weex.requireModule(name)
+}
+
+const ANI_DURATION = 300;
+const ANI_SHOW = 'pop-in';
function showWebview (webview, animationType, animationDuration) {
setTimeout(() => {
webview.show(
- animationType || ANI_SHOW$1,
- animationDuration || ANI_DURATION$1,
+ animationType || ANI_SHOW,
+ animationDuration || ANI_DURATION,
() => {
console.log('show.callback');
}
@@ -6866,7 +2713,7 @@ function navigateBack$1 ({
} else {
pages.splice(len, 1);
if (animationType) {
- page.$getAppWebview().close(animationType, animationDuration || ANI_DURATION$1);
+ page.$getAppWebview().close(animationType, animationDuration || ANI_DURATION);
} else {
page.$getAppWebview().close('auto');
}
@@ -6911,10 +2758,11 @@ function switchTab$1 ({
-var nvueApi = /*#__PURE__*/Object.freeze({
+var api$1 = /*#__PURE__*/Object.freeze({
createLivePusherContext: createLivePusherContext,
createMapContext: createMapContext$1,
createVideoContext: createVideoContext$1,
+ requireNativePlugin: requireNativePlugin,
navigateBack: navigateBack$1,
navigateTo: navigateTo$1,
reLaunch: reLaunch$1,
@@ -6922,18 +2770,13 @@ var nvueApi = /*#__PURE__*/Object.freeze({
switchTab: switchTab$1
});
-var platformApi = Object.assign({}, appApi, nvueApi);
-
-const api$1 = Object.create(null);
-
-Object.assign(api$1, api);
-Object.assign(api$1, platformApi);
+const api$2 = Object.assign(Object.create(null), api, api$1);
const uni$1 = Object.create(null);
apis.forEach(name => {
- if (api$1[name]) {
- uni$1[name] = promisify(name, wrapper(name, api$1[name]));
+ if (api$2[name]) {
+ uni$1[name] = promisify(name, wrapper(name, api$2[name]));
} else {
uni$1[name] = wrapperUnimplemented(name);
}
diff --git a/packages/uni-h5/dist/demo.html b/packages/uni-h5/dist/demo.html
deleted file mode 100644
index 62b34ba10f75935ebe2cdee404b64b8f0d1d964e..0000000000000000000000000000000000000000
--- a/packages/uni-h5/dist/demo.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
index demo
-
-
-
-
-
-
diff --git a/packages/uni-h5/dist/index.umd.js b/packages/uni-h5/dist/index.umd.js
deleted file mode 100644
index 4c4d0e5fd3ca78c9b5094de8d93904fe17a8e87f..0000000000000000000000000000000000000000
--- a/packages/uni-h5/dist/index.umd.js
+++ /dev/null
@@ -1,26152 +0,0 @@
-(function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory(require("vue-router"), require("vue"));
- else if(typeof define === 'function' && define.amd)
- define([, ], factory);
- else if(typeof exports === 'object')
- exports["index"] = factory(require("vue-router"), require("vue"));
- else
- root["index"] = factory(root["VueRouter"], root["Vue"]);
-})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__6389__, __WEBPACK_EXTERNAL_MODULE__8bbf__) {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId]) {
-/******/ return installedModules[moduleId].exports;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ i: moduleId,
-/******/ l: false,
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.l = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/
-/******/ // define getter function for harmony exports
-/******/ __webpack_require__.d = function(exports, name, getter) {
-/******/ if(!__webpack_require__.o(exports, name)) {
-/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
-/******/ }
-/******/ };
-/******/
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/
-/******/ // create a fake namespace object
-/******/ // mode & 1: value is a module id, require it
-/******/ // mode & 2: merge all properties of value into the ns
-/******/ // mode & 4: return value when already ns object
-/******/ // mode & 8|1: behave like require
-/******/ __webpack_require__.t = function(value, mode) {
-/******/ if(mode & 1) value = __webpack_require__(value);
-/******/ if(mode & 8) return value;
-/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
-/******/ var ns = Object.create(null);
-/******/ __webpack_require__.r(ns);
-/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
-/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
-/******/ return ns;
-/******/ };
-/******/
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function getDefault() { return module['default']; } :
-/******/ function getModuleExports() { return module; };
-/******/ __webpack_require__.d(getter, 'a', getter);
-/******/ return getter;
-/******/ };
-/******/
-/******/ // Object.prototype.hasOwnProperty.call
-/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
-/******/
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
-/******/
-/******/
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = "fae3");
-/******/ })
-/************************************************************************/
-/******/ ({
-
-/***/ "052f":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return initOn; });
-/* harmony import */ var _plugins_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("a741");
-/* harmony import */ var _api_page_event__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("9eba");
-
-
-function initOn(on, _ref) {
- var getApp = _ref.getApp,
- getCurrentPages = _ref.getCurrentPages;
-
- function onError(err) {
- Object(_plugins_util__WEBPACK_IMPORTED_MODULE_0__[/* callAppHook */ "a"])(getApp(), 'onError', err);
- }
-
- function onPageNotFound(page) {
- Object(_plugins_util__WEBPACK_IMPORTED_MODULE_0__[/* callAppHook */ "a"])(getApp(), 'onPageNotFound', page);
- }
-
- function onPullDownRefresh(args, pageId) {
- var page = getCurrentPages().find(function (page) {
- return page.$page.id === pageId;
- });
-
- if (page) {
- Object(_api_page_event__WEBPACK_IMPORTED_MODULE_1__["setPullDownRefreshPageId"])(pageId);
- Object(_plugins_util__WEBPACK_IMPORTED_MODULE_0__[/* callPageHook */ "b"])(page, 'onPullDownRefresh');
- }
- }
-
- function callCurrentPageHook(hook, args) {
- var pages = getCurrentPages();
-
- if (pages.length) {
- Object(_plugins_util__WEBPACK_IMPORTED_MODULE_0__[/* callPageHook */ "b"])(pages[pages.length - 1], hook, args);
- }
- }
-
- function createCallCurrentPageHook(hook) {
- return function (args) {
- callCurrentPageHook(hook, args);
- };
- }
-
- function onAppEnterBackground() {
- Object(_plugins_util__WEBPACK_IMPORTED_MODULE_0__[/* callAppHook */ "a"])(getApp(), 'onHide');
- callCurrentPageHook('onHide');
- }
-
- function onAppEnterForeground() {
- Object(_plugins_util__WEBPACK_IMPORTED_MODULE_0__[/* callAppHook */ "a"])(getApp(), 'onShow');
- callCurrentPageHook('onShow');
- }
-
- function onWebInvokeAppService(_ref2, pageId) {
- var name = _ref2.name,
- arg = _ref2.arg;
-
- if (name === 'postMessage') {// TODO 小程序后退、组件销毁、分享时通知
- } else {
- uni[name](arg);
- }
- }
-
- var routeHooks = {
- navigateTo: function navigateTo() {
- callCurrentPageHook('onHide');
- },
- navigateBack: function navigateBack() {
- callCurrentPageHook('onShow');
- }
- };
-
- function onAppRoute(_ref3) {
- var type = _ref3.type;
- var routeHook = routeHooks[type];
- routeHook && routeHook();
- }
-
- on('onError', onError);
- on('onPageNotFound', onPageNotFound);
-
- if (false) {}
-
- on('onAppEnterBackground', onAppEnterBackground);
- on('onAppEnterForeground', onAppEnterForeground);
- on('onPullDownRefresh', onPullDownRefresh);
- on('onTabItemTap', createCallCurrentPageHook('onTabItemTap'));
- on('onNavigationBarButtonTap', createCallCurrentPageHook('onNavigationBarButtonTap'));
- on('onNavigationBarSearchInputChanged', createCallCurrentPageHook('onNavigationBarSearchInputChanged'));
- on('onNavigationBarSearchInputConfirmed', createCallCurrentPageHook('onNavigationBarSearchInputConfirmed'));
- on('onNavigationBarSearchInputClicked', createCallCurrentPageHook('onNavigationBarSearchInputClicked'));
- on('onWebInvokeAppService', onWebInvokeAppService);
-}
-
-/***/ }),
-
-/***/ "0554":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function(UniServiceJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocation", function() { return getLocation; });
-/* harmony import */ var _helpers_get_jsonp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("ffdc");
-
-/**
- * wgs84坐标转Gcj02坐标
- * @param {object} coords
- * @param {Function} success
- * @param {Function} error
- */
-
-function wgs84ToGcj02(coords, success, error) {
- /**
- * uniapp 内置key
- */
- var key = __uniConfig.qqMapKey;
- var url = "https://apis.map.qq.com/ws/coord/v1/translate?locations=".concat(coords.latitude, ",").concat(coords.longitude, "&type=1&key=").concat(key, "&output=jsonp");
- Object(_helpers_get_jsonp__WEBPACK_IMPORTED_MODULE_0__[/* getJSONP */ "a"])(url, {}, function (res) {
- if ('locations' in res && res.locations.length) {
- success({
- longitude: res.locations[0].lng,
- latitude: res.locations[0].lat
- });
- } else {
- error(res);
- }
- }, error);
-}
-/**
- * 获取定位信息
- * @param {*} param0
- * @param {*} callbackId
- */
-
-
-function getLocation(_ref, callbackId) {
- var type = _ref.type,
- altitude = _ref.altitude;
- var _UniServiceJSBridge = UniServiceJSBridge,
- invoke = _UniServiceJSBridge.invokeCallbackHandler;
-
- function callback(coords) {
- invoke(callbackId, Object.assign(coords, {
- errMsg: 'getLocation:ok',
- verticalAccuracy: coords.altitudeAccuracy || 0,
- // 无专门水平精度,使用位置精度替代
- horizontalAccuracy: coords.accuracy
- }));
- }
-
- if (navigator.geolocation) {
- navigator.geolocation.getCurrentPosition(function (position) {
- var coords = position.coords;
-
- if (type === 'WGS84') {
- callback(coords);
- } else {
- wgs84ToGcj02(coords, callback, function (err) {
- invoke(callbackId, {
- errMsg: 'getLocation:fail ' + JSON.stringify(err)
- });
- });
- }
- }, function () {
- invoke(callbackId, {
- errMsg: 'getLocation:fail'
- });
- }, {
- enableHighAccuracy: altitude,
- timeout: 1000 * 60 * 5
- });
- } else {
- invoke(callbackId, {
- errMsg: 'getLocation:fail device nonsupport geolocation'
- });
- }
-}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("0dd1")))
-
-/***/ }),
-
-/***/ "066f":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTabBarItem", function() { return setTabBarItem; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTabBarStyle", function() { return setTabBarStyle; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hideTabBar", function() { return hideTabBar; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "showTabBar", function() { return showTabBar; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hideTabBarRedDot", function() { return hideTabBarRedDot; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "showTabBarRedDot", function() { return showTabBarRedDot; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeTabBarBadge", function() { return removeTabBarBadge; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTabBarBadge", function() { return setTabBarBadge; });
-/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("f2b3");
-
-var indexValidator = {
- type: Number,
- required: true
-};
-var setTabBarItem = {
- index: indexValidator,
- text: {
- type: String
- },
- iconPath: {
- type: String
- },
- selectedIconPath: {
- type: String
- }
-};
-var setTabBarStyle = {
- color: {
- type: String
- },
- selectedColor: {
- type: String
- },
- backgroundColor: {
- type: String
- },
- borderStyle: {
- type: String,
- validator: function validator(borderStyle, params) {
- if (borderStyle) {
- params.borderStyle = borderStyle === 'black' ? 'black' : 'white';
- }
- }
- }
-};
-var hideTabBar = {
- animation: {
- type: Boolean,
- default: false
- }
-};
-var showTabBar = {
- animation: {
- type: Boolean,
- default: false
- }
-};
-var hideTabBarRedDot = {
- index: indexValidator
-};
-var showTabBarRedDot = {
- index: indexValidator
-};
-var removeTabBarBadge = {
- index: indexValidator
-};
-var setTabBarBadge = {
- index: indexValidator,
- text: {
- type: String,
- required: true,
- validator: function validator(text, params) {
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* getLen */ "b"])(text) >= 4) {
- params.text = '...';
- }
- }
- }
-};
-
-/***/ }),
-
-/***/ "0741":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("9a72");
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
-/* unused harmony reexport * */
- /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
-
-/***/ }),
-
-/***/ "0784":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-
-// EXTERNAL MODULE: ./src/core/service/plugins/util.js
-var util = __webpack_require__("a741");
-
-// CONCATENATED MODULE: ./src/core/service/plugins/page/create-page.js
-function createPage(pageVm) {
- var $route = pageVm.$route;
- pageVm.route = $route.meta.pagePath;
- pageVm.__page__ = {
- id: $route.params.__id__,
- path: $route.path,
- route: $route.meta.pagePath,
- meta: Object.assign({}, $route.meta) // 兼容 mpvue
-
- };
- pageVm.$vm = pageVm;
- pageVm.$root = pageVm;
- pageVm.$holder = pageVm.$parent.$parent; // 补充 mp 相关属性
-
- pageVm.$mp = {
- mpType: 'page',
- page: pageVm,
- query: {},
- // 暂不支持
- status: ''
- };
-}
-// CONCATENATED MODULE: ./src/core/service/plugins/page/index.js
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createPageMixin; });
-
- // 与小程序保持一致,尝试decodeURIComponent一次参数
-
-function getDecodedQuery() {
- var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var decodedQuery = {};
- Object.keys(query).forEach(function (name) {
- try {
- decodedQuery[name] = decodeURIComponent(query[name]);
- } catch (e) {
- decodedQuery[name] = query[name];
- }
- });
- return decodedQuery;
-}
-
-function createPageMixin() {
- return {
- created: function pageCreated() {
- createPage(this);
- Object(util["b" /* callPageHook */])(this, 'onLoad', getDecodedQuery(this.$route.query));
- Object(util["b" /* callPageHook */])(this, 'onShow');
- }
- };
-}
-
-/***/ }),
-
-/***/ "08c9":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "0950":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "0998":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("4509");
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
-/* unused harmony reexport * */
- /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
-
-/***/ }),
-
-/***/ "0a32":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_system_header_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("17ac");
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_system_header_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_system_header_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
-/* unused harmony reexport * */
- /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_system_header_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
-
-/***/ }),
-
-/***/ "0c7c":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
-/* globals __VUE_SSR_CONTEXT__ */
-
-// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
-// This module is a runtime utility for cleaner component module output and will
-// be included in the final webpack user bundle.
-
-function normalizeComponent (
- scriptExports,
- render,
- staticRenderFns,
- functionalTemplate,
- injectStyles,
- scopeId,
- moduleIdentifier, /* server only */
- shadowMode /* vue-cli only */
-) {
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
-
- // render functions
- if (render) {
- options.render = render
- options.staticRenderFns = staticRenderFns
- options._compiled = true
- }
-
- // functional template
- if (functionalTemplate) {
- options.functional = true
- }
-
- // scopedId
- if (scopeId) {
- options._scopeId = 'data-v-' + scopeId
- }
-
- var hook
- if (moduleIdentifier) { // server build
- hook = function (context) {
- // 2.3 injection
- context =
- context || // cached call
- (this.$vnode && this.$vnode.ssrContext) || // stateful
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
- // 2.2 with runInNewContext: true
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
- context = __VUE_SSR_CONTEXT__
- }
- // inject component styles
- if (injectStyles) {
- injectStyles.call(this, context)
- }
- // register component module identifier for async chunk inferrence
- if (context && context._registeredComponents) {
- context._registeredComponents.add(moduleIdentifier)
- }
- }
- // used by ssr in case component is cached and beforeCreate
- // never gets called
- options._ssrRegister = hook
- } else if (injectStyles) {
- hook = shadowMode
- ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
- : injectStyles
- }
-
- if (hook) {
- if (options.functional) {
- // for template-only hot-reload because in that case the render fn doesn't
- // go through the normalizer
- options._injectStyles = hook
- // register for functioal component in vue file
- var originalRender = options.render
- options.render = function renderWithStyleInjection (h, context) {
- hook.call(context)
- return originalRender(h, context)
- }
- } else {
- // inject component registration as beforeCreate hook
- var existing = options.beforeCreate
- options.beforeCreate = existing
- ? [].concat(existing, hook)
- : [hook]
- }
- }
-
- return {
- exports: scriptExports,
- options: options
- }
-}
-
-
-/***/ }),
-
-/***/ "0dba":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "0dd1":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "on", function() { return on; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "off", function() { return off; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return once; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "emit", function() { return emit; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribe", function() { return subscribe; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unsubscribe", function() { return unsubscribe; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeHandler", function() { return subscribeHandler; });
-/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("8bbf");
-/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var uni_helpers_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("27a7");
-/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "invokeCallbackHandler", function() { return uni_helpers_api__WEBPACK_IMPORTED_MODULE_1__["a"]; });
-
-/* harmony import */ var uni_platform_service_bridge__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("b865");
-/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishHandler", function() { return uni_platform_service_bridge__WEBPACK_IMPORTED_MODULE_2__["a"]; });
-
-
-var Emitter = new vue__WEBPACK_IMPORTED_MODULE_0___default.a();
-var on = Emitter.$on.bind(Emitter);
-var off = Emitter.$off.bind(Emitter);
-var once = Emitter.$once.bind(Emitter);
-var emit = Emitter.$emit.bind(Emitter);
-
-function subscribe(event, callback) {
- return on('view.' + event, callback);
-}
-function unsubscribe(event, callback) {
- return off('view.' + event, callback);
-}
-function subscribeHandler(event, args, pageId) {
- return emit('view.' + event, args, pageId);
-}
-
-
-/***/ }),
-
-/***/ "0f55":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("eaa4");
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
-/* unused harmony reexport * */
- /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
-
-/***/ }),
-
-/***/ "0f74":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getRealRoute; });
-function getRealRoute(fromRoute, toRoute) {
- if (!toRoute) {
- toRoute = fromRoute;
-
- if (toRoute.indexOf('/') === 0) {
- return toRoute;
- }
-
- var pages = getCurrentPages();
-
- if (pages.length) {
- fromRoute = pages[pages.length - 1].$page.route;
- } else {
- fromRoute = '';
- }
- } else {
- if (toRoute.indexOf('/') === 0) {
- return toRoute;
- }
- }
-
- if (toRoute.indexOf('./') === 0) {
- return getRealRoute(fromRoute, toRoute.substr(2));
- }
-
- var toRouteArray = toRoute.split('/');
- var toRouteLength = toRouteArray.length;
- var i = 0;
-
- for (; i < toRouteLength && toRouteArray[i] === '..'; i++) {// noop
- }
-
- toRouteArray.splice(0, i);
- toRoute = toRouteArray.join('/');
- var fromRouteArray = fromRoute.length > 0 ? fromRoute.split('/') : [];
- fromRouteArray.splice(fromRouteArray.length - i - 1, i + 1);
- return '/' + fromRouteArray.concat(toRouteArray).join('/');
-}
-
-/***/ }),
-
-/***/ "1047":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "1067":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "1082":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"120ddde1-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/image/index.vue?vue&type=template&id=3d6bbdb4&
-var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('uni-image',_vm._g({},_vm.$listeners),[_c('div',{ref:"content",style:(_vm.modeStyle)}),_c('img',{attrs:{"src":_vm.realImagePath}}),(_vm.mode === 'widthFix')?_c('v-uni-resize-sensor',{ref:"sensor",on:{"resize":_vm._resize}}):_vm._e()],1)}
-var staticRenderFns = []
-
-
-// CONCATENATED MODULE: ./src/core/view/components/image/index.vue?vue&type=template&id=3d6bbdb4&
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/image/index.vue?vue&type=script&lang=js&
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-/* harmony default export */ var imagevue_type_script_lang_js_ = ({
- name: 'Image',
- props: {
- src: {
- type: String,
- default: ''
- },
- mode: {
- type: String,
- default: 'scaleToFill'
- },
- // TODO 懒加载
- lazyLoad: {
- type: [Boolean, String],
- default: false
- }
- },
- data: function data() {
- return {
- originalWidth: 0,
- originalHeight: 0,
- availHeight: '',
- sizeFixed: false
- };
- },
- computed: {
- ratio: function ratio() {
- return this.originalWidth && this.originalHeight ? this.originalWidth / this.originalHeight : 0;
- },
- realImagePath: function realImagePath() {
- return this.src && this.$getRealPath(this.src);
- },
- modeStyle: function modeStyle() {
- var size = 'auto';
- var position = '';
- var repeat = 'no-repeat';
-
- switch (this.mode) {
- case 'aspectFit':
- size = 'contain';
- position = 'center center';
- break;
-
- case 'aspectFill':
- size = 'cover';
- position = 'center center';
- break;
-
- case 'widthFix':
- size = '100% 100%';
- break;
-
- case 'top':
- position = 'center top';
- break;
-
- case 'bottom':
- position = 'center bottom';
- break;
-
- case 'center':
- position = 'center center';
- break;
-
- case 'left':
- position = 'left center';
- break;
-
- case 'right':
- position = 'right center';
- break;
-
- case 'top left':
- position = 'left top';
- break;
-
- case 'top right':
- position = 'right top';
- break;
-
- case 'bottom left':
- position = 'left bottom';
- break;
-
- case 'bottom right':
- position = 'right bottom';
- break;
-
- default:
- size = '100% 100%';
- position = '0% 0%';
- break;
- }
-
- return "background-position:".concat(position, ";background-size:").concat(size, ";background-repeat:").concat(repeat, ";");
- }
- },
- watch: {
- src: function src(newValue, oldValue) {
- this._loadImage();
- },
- mode: function mode(newValue, oldValue) {
- if (oldValue === 'widthFix') {
- this.$el.style.height = this.availHeight;
- this.sizeFixed = false;
- }
-
- if (newValue === 'widthFix' && this.ratio) {
- this._fixSize();
- }
- }
- },
- mounted: function mounted() {
- this.availHeight = this.$el.style.height || '';
-
- this._loadImage();
- },
- methods: {
- _resize: function _resize() {
- if (this.mode === 'widthFix' && !this.sizeFixed) {
- this._fixSize();
- }
- },
- _fixSize: function _fixSize() {
- var elWidth = this._getWidth();
-
- if (elWidth) {
- this.$el.style.height = elWidth / this.ratio + 'px';
- this.sizeFixed = true;
- }
- },
- _loadImage: function _loadImage() {
- this.$refs.content.style.backgroundImage = this.src ? "url(".concat(this.realImagePath, ")") : 'none';
-
- var _self = this;
-
- var img = new Image();
-
- img.onload = function ($event) {
- _self.originalWidth = this.width;
- _self.originalHeight = this.height;
-
- if (_self.mode === 'widthFix') {
- _self._fixSize();
- }
-
- _self.$trigger('load', $event, {
- width: this.width,
- height: this.height
- });
- };
-
- img.onerror = function ($event) {
- _self.$trigger('error', $event, {
- errMsg: "GET ".concat(_self.src, " 404 (Not Found)")
- });
- };
-
- img.src = this.realImagePath;
- },
- _getWidth: function _getWidth() {
- var computedStyle = window.getComputedStyle(this.$el);
- var borderWidth = (parseFloat(computedStyle.borderLeftWidth, 10) || 0) + (parseFloat(computedStyle.borderRightWidth, 10) || 0);
- var paddingWidth = (parseFloat(computedStyle.paddingLeft, 10) || 0) + (parseFloat(computedStyle.paddingRight, 10) || 0);
- return this.$el.offsetWidth - borderWidth - paddingWidth;
- }
- }
-});
-// CONCATENATED MODULE: ./src/core/view/components/image/index.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_imagevue_type_script_lang_js_ = (imagevue_type_script_lang_js_);
-// EXTERNAL MODULE: ./src/core/view/components/image/index.vue?vue&type=style&index=0&lang=css&
-var imagevue_type_style_index_0_lang_css_ = __webpack_require__("db18");
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js
-var componentNormalizer = __webpack_require__("0c7c");
-
-// CONCATENATED MODULE: ./src/core/view/components/image/index.vue
-
-
-
-
-
-
-/* normalize component */
-
-var component = Object(componentNormalizer["a" /* default */])(
- components_imagevue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- null,
- null,
- null
-
-)
-
-/* harmony default export */ var components_image = __webpack_exports__["default"] = (component.exports);
-
-/***/ }),
-
-/***/ "1164":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(console) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getApp; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getCurrentPages; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createApp; });
-/* harmony import */ var _router_guard__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("23e5");
-
-var appVm = false;
-function getApp() {
- return appVm;
-}
-function getCurrentPages() {
- var isAll = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var pages = [];
- var app = getApp();
-
- if (!app) {
- console.error('app is not ready');
- return [];
- }
-
- var childrenVm = app.$children[0];
-
- if (childrenVm && childrenVm.$children.length) {
- var tabBarVm = childrenVm.$children.find(function (vm) {
- return vm.$options.name === 'TabBar';
- });
- childrenVm.$children.forEach(function (vm) {
- if (tabBarVm !== vm && vm.$children.length && vm.$children[0].$options.name === 'Page' && vm.$children[0].$slots.page) {
- // vm.$children[0]=Page->PageBody->RealPage
- var pageVm = vm.$children[0].$children.find(function (vm) {
- return vm.$options.name === 'PageBody';
- }).$children.find(function (vm) {
- return !!vm.$page;
- });
-
- if (pageVm) {
- var isActive = true;
-
- if (!isAll && tabBarVm && pageVm.$page && pageVm.$page.meta.isTabBar) {
- // 选项卡仅列出活动的
- if (app.$route.meta && app.$route.meta.isTabBar) {
- // 当前页面路由是 tabBar
- if (app.$route.path !== pageVm.$page.path) {
- isActive = false;
- }
- } else {
- if (tabBarVm.__path__ !== pageVm.$page.path) {
- isActive = false;
- }
- }
- }
-
- if (isActive) {
- pages.push(pageVm);
- }
- } else {// TODO
- // console.error('pageVm is undefined')
- }
- }
- });
- } // 当页面返回过程中,请求 getCurrentPages 时,可能会获取到前一个已经准备销毁的 page
-
-
- var length = pages.length;
-
- if (length > 1) {
- var currentPage = pages[length - 1];
-
- if (currentPage.$page.path !== app.$route.path) {
- // 删除已经准备销毁的上个页面
- pages.splice(length - 1, 1);
- }
- }
-
- return pages;
-}
-function createApp(vm, routes) {
- appVm = vm;
- appVm.globalData = appVm.$options.globalData || {}; // initEvents(appVm)
-
- Object(_router_guard__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(appVm, routes);
-}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("3ad9")["default"]))
-
-/***/ }),
-
-/***/ "11fb":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "previewImage", function() { return previewImage; });
-/* harmony import */ var uni_platform_helpers_get_real_path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cb0f");
-
-var previewImage = {
- urls: {
- type: Array,
- required: true,
- validator: function validator(value, params) {
- var typeError;
- params.urls = value.map(function (url) {
- if (typeof url === 'string') {
- return Object(uni_platform_helpers_get_real_path__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(url);
- } else {
- typeError = true;
- }
- });
-
- if (typeError) {
- return 'url is not string';
- }
- }
- },
- current: {
- type: [String, Number],
- validator: function validator(value, params) {
- if (typeof value === 'number') {
- params.current = value > 0 && value < params.urls.length ? value : 0;
- } else if (typeof value === 'string' && value) {
- params.current = Object(uni_platform_helpers_get_real_path__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(value);
- }
- },
- default: 0
- }
-};
-
-/***/ }),
-
-/***/ "1360":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "15bb":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("f2b3");
-
-/* harmony default export */ __webpack_exports__["a"] = ({
- mounted: function mounted() {
- var _this = this;
-
- if (this.type === 'transparent') {
- var transparentElemStyle = this.$el.querySelector('.uni-page-head-transparent').style;
- var titleElem = this.$el.querySelector('.uni-page-head__title');
- var iconElems = this.$el.querySelectorAll('.uni-btn-icon');
- var iconElemsStyles = [];
- var textColor = this.textColor;
-
- for (var i = 0; i < iconElems.length; i++) {
- iconElemsStyles.push(iconElems[i].style);
- }
-
- var borderRadiusElems = this.$el.querySelectorAll('.uni-page-head-btn');
- var oldColors = [];
- var borderRadiusElemsStyles = [];
-
- for (var _i = 0; _i < borderRadiusElems.length; _i++) {
- var borderRadiusElem = borderRadiusElems[_i];
- oldColors.push(getComputedStyle(borderRadiusElem).backgroundColor);
- borderRadiusElemsStyles.push(borderRadiusElem.style);
- }
-
- this._A = 0;
- UniViewJSBridge.on('onPageScroll', function (_ref) {
- var scrollTop = _ref.scrollTop;
- var alpha = Math.min(scrollTop / _this.offset, 1);
-
- if (alpha === 1 && _this._A === 1) {
- return;
- }
-
- if (alpha > 0.5 && _this._A <= 0.5) {
- iconElemsStyles.forEach(function (iconElemStyle) {
- iconElemStyle.color = textColor;
- });
- } else if (alpha <= 0.5 && _this._A > 0.5) {
- iconElemsStyles.forEach(function (iconElemStyle) {
- iconElemStyle.color = '#fff';
- });
- }
-
- _this._A = alpha; // TODO 暂时仅处理背景色
-
- if (titleElem) {
- titleElem.style.opacity = alpha;
- }
-
- transparentElemStyle.backgroundColor = "rgba(".concat(_this._R, ",").concat(_this._G, ",").concat(_this._B, ",").concat(alpha, ")");
- borderRadiusElemsStyles.forEach(function (borderRadiusElemStyle, index) {
- var oldColor = oldColors[index]; // eslint-disable-next-line
-
- var rgba = oldColor.match(/[\d+\.]+/g);
- rgba[3] = (1 - alpha) * (rgba.length === 4 ? rgba[3] : 1);
- borderRadiusElemStyle.backgroundColor = "rgba(".concat(rgba, ")");
- });
- });
- }
- },
- computed: {
- color: function color() {
- return this.type === 'transparent' ? '#fff' : this.textColor;
- },
- offset: function offset() {
- return parseInt(this.coverage);
- },
- bgColor: function bgColor() {
- if (this.type === 'transparent') {
- var _hexToRgba = Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* hexToRgba */ "d"])(this.backgroundColor),
- r = _hexToRgba.r,
- g = _hexToRgba.g,
- b = _hexToRgba.b;
-
- this._R = r;
- this._G = g;
- this._B = b;
- return "rgba(".concat(r, ",").concat(g, ",").concat(b, ",0)");
- }
-
- return this.backgroundColor;
- }
- }
-});
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("501c")))
-
-/***/ }),
-
-/***/ "167a":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_pageBody_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("deaf");
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_pageBody_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_pageBody_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
-/* unused harmony reexport * */
- /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_pageBody_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
-
-/***/ }),
-
-/***/ "17ac":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "17fd":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"120ddde1-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/navigator/index.vue?vue&type=template&id=d8d61df6&
-var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.hoverClass && _vm.hoverClass !== 'none')?_c('uni-navigator',_vm._g({class:[_vm.hovering ? _vm.hoverClass : ''],on:{"touchstart":_vm._hoverTouchStart,"touchend":_vm._hoverTouchEnd,"touchcancel":_vm._hoverTouchCancel,"click":_vm._onClick}},_vm.$listeners),[_vm._t("default")],2):_c('uni-navigator',_vm._g({on:{"click":_vm._onClick}},_vm.$listeners),[_vm._t("default")],2)}
-var staticRenderFns = []
-
-
-// CONCATENATED MODULE: ./src/core/view/components/navigator/index.vue?vue&type=template&id=d8d61df6&
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/navigator/index.vue?vue&type=script&lang=js&
-var navigatorvue_type_script_lang_js_ = __webpack_require__("eecc");
-
-// CONCATENATED MODULE: ./src/core/view/components/navigator/index.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_navigatorvue_type_script_lang_js_ = (navigatorvue_type_script_lang_js_["a" /* default */]);
-// EXTERNAL MODULE: ./src/core/view/components/navigator/index.vue?vue&type=style&index=0&lang=css&
-var navigatorvue_type_style_index_0_lang_css_ = __webpack_require__("f7fd");
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js
-var componentNormalizer = __webpack_require__("0c7c");
-
-// CONCATENATED MODULE: ./src/core/view/components/navigator/index.vue
-
-
-
-
-
-
-/* normalize component */
-
-var component = Object(componentNormalizer["a" /* default */])(
- components_navigatorvue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- null,
- null,
- null
-
-)
-
-/* harmony default export */ var components_navigator = __webpack_exports__["default"] = (component.exports);
-
-/***/ }),
-
-/***/ "18fd":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HTMLParser; });
-/*
- * HTML5 Parser By Sam Blowes
- *
- * Designed for HTML5 documents
- *
- * Original code by John Resig (ejohn.org)
- * http://ejohn.org/blog/pure-javascript-html-parser/
- * Original code by Erik Arvidsson, Mozilla Public License
- * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
- *
- * ----------------------------------------------------------------------------
- * License
- * ----------------------------------------------------------------------------
- *
- * This code is triple licensed using Apache Software License 2.0,
- * Mozilla Public License or GNU Public License
- *
- * ////////////////////////////////////////////////////////////////////////////
- *
- * 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
- *
- * ////////////////////////////////////////////////////////////////////////////
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- * License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is Simple HTML Parser.
- *
- * The Initial Developer of the Original Code is Erik Arvidsson.
- * Portions created by Erik Arvidssson are Copyright (C) 2004. All Rights
- * Reserved.
- *
- * ////////////////////////////////////////////////////////////////////////////
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ----------------------------------------------------------------------------
- * Usage
- * ----------------------------------------------------------------------------
- *
- * // Use like so:
- * HTMLParser(htmlString, {
- * start: function(tag, attrs, unary) {},
- * end: function(tag) {},
- * chars: function(text) {},
- * comment: function(text) {}
- * });
- *
- * // or to get an XML string:
- * HTMLtoXML(htmlString);
- *
- * // or to get an XML DOM Document
- * HTMLtoDOM(htmlString);
- *
- * // or to inject into an existing document/DOM node
- * HTMLtoDOM(htmlString, document);
- * HTMLtoDOM(htmlString, document.body);
- *
- */
-// Regular Expressions for parsing tags and attributes
-var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
-var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
-var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; // Empty Elements - HTML 5
-
-var empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr'); // Block Elements - HTML 5
-// fixed by xxx 将 ins 标签从块级名单中移除
-
-var block = makeMap('a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video'); // Inline Elements - HTML 5
-
-var inline = makeMap('abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'); // Elements that you can, intentionally, leave open
-// (and which close themselves)
-
-var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'); // Attributes that have their values filled in disabled="disabled"
-
-var fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'); // Special Elements (can contain anything)
-
-var special = makeMap('script,style');
-function HTMLParser(html, handler) {
- var index;
- var chars;
- var match;
- var stack = [];
- var last = html;
-
- stack.last = function () {
- return this[this.length - 1];
- };
-
- while (html) {
- chars = true; // Make sure we're not in a script or style element
-
- if (!stack.last() || !special[stack.last()]) {
- // Comment
- if (html.indexOf('');
-
- if (index >= 0) {
- if (handler.comment) {
- handler.comment(html.substring(4, index));
- }
-
- html = html.substring(index + 3);
- chars = false;
- } // end tag
-
- } else if (html.indexOf('') == 0) {
- match = html.match(endTag);
-
- if (match) {
- html = html.substring(match[0].length);
- match[0].replace(endTag, parseEndTag);
- chars = false;
- } // start tag
-
- } else if (html.indexOf('<') == 0) {
- match = html.match(startTag);
-
- if (match) {
- html = html.substring(match[0].length);
- match[0].replace(startTag, parseStartTag);
- chars = false;
- }
- }
-
- if (chars) {
- index = html.indexOf('<');
- var text = index < 0 ? html : html.substring(0, index);
- html = index < 0 ? '' : html.substring(index);
-
- if (handler.chars) {
- handler.chars(text);
- }
- }
- } else {
- html = html.replace(new RegExp('([\\s\\S]*?)<\/' + stack.last() + '[^>]*>'), function (all, text) {
- text = text.replace(/|/g, '$1$2');
-
- if (handler.chars) {
- handler.chars(text);
- }
-
- return '';
- });
- parseEndTag('', stack.last());
- }
-
- if (html == last) {
- throw 'Parse Error: ' + html;
- }
-
- last = html;
- } // Clean up any remaining tags
-
-
- parseEndTag();
-
- function parseStartTag(tag, tagName, rest, unary) {
- tagName = tagName.toLowerCase();
-
- if (block[tagName]) {
- while (stack.last() && inline[stack.last()]) {
- parseEndTag('', stack.last());
- }
- }
-
- if (closeSelf[tagName] && stack.last() == tagName) {
- parseEndTag('', tagName);
- }
-
- unary = empty[tagName] || !!unary;
-
- if (!unary) {
- stack.push(tagName);
- }
-
- if (handler.start) {
- var attrs = [];
- rest.replace(attr, function (match, name) {
- var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : '';
- attrs.push({
- name: name,
- value: value,
- escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') // "
-
- });
- });
-
- if (handler.start) {
- handler.start(tagName, attrs, unary);
- }
- }
- }
-
- function parseEndTag(tag, tagName) {
- // If no tag name is provided, clean shop
- if (!tagName) {
- var pos = 0;
- } // Find the closest opened tag of the same type
- else {
- for (var pos = stack.length - 1; pos >= 0; pos--) {
- if (stack[pos] == tagName) {
- break;
- }
- }
- }
-
- if (pos >= 0) {
- // Close all the open elements, up the stack
- for (var i = stack.length - 1; i >= pos; i--) {
- if (handler.end) {
- handler.end(stack[i]);
- }
- } // Remove the open elements from the stack
-
-
- stack.length = pos;
- }
- }
-}
-;
-
-function makeMap(str) {
- var obj = {};
- var items = str.split(',');
-
- for (var i = 0; i < items.length; i++) {
- obj[items[i]] = true;
- }
-
- return obj;
-}
-
-/***/ }),
-
-/***/ "1955":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// EXTERNAL MODULE: ./src/core/view/mixins/touchtrack.js
-var touchtrack = __webpack_require__("ba15");
-
-// EXTERNAL MODULE: ./src/core/view/mixins/scroller/index.js + 2 modules
-var scroller = __webpack_require__("8aec");
-
-// EXTERNAL MODULE: ./src/core/view/mixins/scroller/Friction.js
-var Friction = __webpack_require__("5363");
-
-// EXTERNAL MODULE: ./src/core/view/mixins/scroller/Spring.js
-var Spring = __webpack_require__("72b3");
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/picker-view-column/index.vue?vue&type=script&lang=js&
-
-
-
-
-/* harmony default export */ var picker_view_columnvue_type_script_lang_js_ = ({
- name: 'PickerViewColumn',
- mixins: [touchtrack["a" /* default */], scroller["a" /* default */]],
- data: function data() {
- return {
- scope: "picker-view-column-".concat(Date.now()),
- inited: false,
- indicatorStyle: '',
- indicatorClass: '',
- indicatorHeight: 34,
- maskStyle: '',
- maskClass: '',
- current: this.$parent.getItemValue(this),
- length: 0
- };
- },
- computed: {
- height: function height() {
- return this.$parent.height;
- },
- maskSize: function maskSize() {
- return (this.height - this.indicatorHeight) / 2;
- }
- },
- watch: {
- indicatorHeight: function indicatorHeight(val) {
- this._setItemHeight(val);
-
- if (this.inited) {
- this.update();
- }
- },
- current: function current(val) {
- this.$parent.setItemValue(this, val);
- },
- length: function length(val) {
- if (this.inited) {
- this.update(val);
- }
- }
- },
- created: function created() {
- var $parent = this.$parent;
- this.indicatorStyle = $parent.indicatorStyle;
- this.indicatorClass = $parent.indicatorClass;
- this.maskStyle = $parent.maskStyle;
- this.maskClass = $parent.maskClass; // this.__pageRerender = this._pageRerender.bind(this)
- },
- mounted: function mounted() {
- var _this = this;
-
- this.touchtrack(this.$refs.main, '_handleTrack', true);
- this.setCurrent(this.current);
- this.$nextTick(function () {
- _this.init();
-
- _this.update();
- });
- },
- methods: {
- _setItemHeight: function _setItemHeight(height) {
- var style = document.createElement('style');
- style.innerText = ".uni-picker-view-content.".concat(this.scope, ">*{height: ").concat(height, "px;overflow: hidden;}");
- document.head.appendChild(style);
- },
- _handleTrack: function _handleTrack(e) {
- if (this._scroller) {
- switch (e.detail.state) {
- case 'start':
- this._handleTouchStart(e);
-
- break;
-
- case 'move':
- this._handleTouchMove(e);
-
- break;
-
- case 'end':
- case 'cancel':
- this._handleTouchEnd(e);
-
- }
- }
- },
- _handleTap: function _handleTap(e) {
- if (e.target !== e.currentTarget && !this._scroller.isScrolling()) {
- var t = e.touches && e.touches[0] && e.touches[0].clientY;
- var n = typeof t === 'number' ? t : e.detail.y - document.body.scrollTop;
- var i = this.$el.getBoundingClientRect();
- var r = n - i.top - this._height / 2;
- var o = this.indicatorHeight / 2;
-
- if (!(Math.abs(r) <= o)) {
- var a = Math.ceil((Math.abs(r) - o) / this.indicatorHeight);
- var s = r < 0 ? -a : a;
- this.current += s;
-
- this._scroller.scrollTo(this.current * this.indicatorHeight);
- }
- }
- },
- setCurrent: function setCurrent(current) {
- if (current !== this.current) {
- this.current = current;
-
- if (this.inited) {
- this.update();
- }
- }
- },
- init: function init() {
- var _this2 = this;
-
- this.initScroller(this.$refs.content, {
- enableY: true,
- enableX: false,
- enableSnap: true,
- itemSize: this.indicatorHeight,
- friction: new Friction["a" /* Friction */](0.0001),
- spring: new Spring["a" /* Spring */](2, 90, 20),
- onSnap: function onSnap(index) {
- if (!isNaN(index) && index !== _this2.current) {
- _this2.current = index;
- }
- }
- });
- this.inited = true;
- },
- update: function update() {
- var _this3 = this;
-
- this.$nextTick(function () {
- var index = Math.max(_this3.length - 1, 0);
- var current = Math.min(_this3.current, index);
-
- _this3._scroller.update(current * _this3.indicatorHeight, undefined, _this3.indicatorHeight);
- });
- },
- _resize: function _resize(_ref) {
- var height = _ref.height;
- this.indicatorHeight = height;
- }
- },
- render: function render(createElement) {
- this.length = this.$slots.default && this.$slots.default.length || 0;
- return createElement('uni-picker-view-column', {
- on: {
- tap: this._handleTap
- }
- }, [createElement('div', {
- ref: 'main',
- staticClass: 'uni-picker-view-group'
- }, [createElement('div', {
- ref: 'mask',
- staticClass: 'uni-picker-view-mask',
- class: this.maskClass,
- style: "background-size: 100% ".concat(this.maskSize, "px;").concat(this.maskStyle)
- }), createElement('div', {
- ref: 'indicator',
- staticClass: 'uni-picker-view-indicator',
- class: this.indicatorClass,
- style: this.indicatorStyle
- }, [createElement('v-uni-resize-sensor', {
- attrs: {
- initial: true
- },
- on: {
- resize: this._resize
- }
- })]), createElement('div', {
- ref: 'content',
- staticClass: 'uni-picker-view-content',
- class: this.scope,
- style: "padding: ".concat(this.maskSize, "px 0;")
- }, [this.$slots.default])])]);
- }
-});
-// CONCATENATED MODULE: ./src/core/view/components/picker-view-column/index.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_picker_view_columnvue_type_script_lang_js_ = (picker_view_columnvue_type_script_lang_js_);
-// EXTERNAL MODULE: ./src/core/view/components/picker-view-column/index.vue?vue&type=style&index=0&lang=css&
-var picker_view_columnvue_type_style_index_0_lang_css_ = __webpack_require__("edfa");
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js
-var componentNormalizer = __webpack_require__("0c7c");
-
-// CONCATENATED MODULE: ./src/core/view/components/picker-view-column/index.vue
-var render, staticRenderFns
-
-
-
-
-
-/* normalize component */
-
-var component = Object(componentNormalizer["a" /* default */])(
- components_picker_view_columnvue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- null,
- null,
- null
-
-)
-
-/* harmony default export */ var picker_view_column = __webpack_exports__["default"] = (component.exports);
-
-/***/ }),
-
-/***/ "19c4":
-/***/ (function(module, exports, __webpack_require__) {
-
-var map = {
- "./base.js": "22ec",
- "./base64.js": "a8fd",
- "./canvas.js": "a041",
- "./context.js": "9fef",
- "./device/make-phone-call.js": "f102",
- "./file/open-document.js": "2604",
- "./location.js": "c439",
- "./media/choose-image.js": "f1b2",
- "./media/choose-video.js": "ed9f",
- "./media/get-image-info.js": "b866",
- "./media/preview-image.js": "11fb",
- "./navigation-bar.js": "4043",
- "./network/download-file.js": "439a",
- "./network/request.js": "a201",
- "./network/socket.js": "abb2",
- "./network/upload-file.js": "9a3e",
- "./page-scroll-to.js": "e8e6",
- "./plugins.js": "cef5",
- "./popup.js": "d68b",
- "./route.js": "40ab",
- "./storage.js": "3858",
- "./tab-bar.js": "066f"
-};
-
-
-function webpackContext(req) {
- var id = webpackContextResolve(req);
- return __webpack_require__(id);
-}
-function webpackContextResolve(req) {
- var id = map[req];
- if(!(id + 1)) { // check for number or string
- var e = new Error("Cannot find module '" + req + "'");
- e.code = 'MODULE_NOT_FOUND';
- throw e;
- }
- return id;
-}
-webpackContext.keys = function webpackContextKeys() {
- return Object.keys(map);
-};
-webpackContext.resolve = webpackContextResolve;
-module.exports = webpackContext;
-webpackContext.id = "19c4";
-
-/***/ }),
-
-/***/ "1a12":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function(UniServiceJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "request", function() { return request; });
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
-
-function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
-
-function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-
-/**
- * 请求任务类
- */
-var RequestTask =
-/*#__PURE__*/
-function () {
- function RequestTask(xhr) {
- _classCallCheck(this, RequestTask);
-
- _defineProperty(this, "_xhr", void 0);
-
- this._xhr = xhr;
- }
-
- _createClass(RequestTask, [{
- key: "abort",
- value: function abort() {
- if (this._xhr) {
- this._xhr.abort();
-
- delete this._xhr;
- }
- }
- }]);
-
- return RequestTask;
-}();
-/**
- * 拼接网址和参数
- * @param {string} url 网址
- * @param {any} data 参数
- * @return {string}
- */
-
-
-function setUrl(url, data) {
- var str = url.split('#');
- var hash = str[1] || '';
- str = str[0].split('?');
- var query = str[1] || '';
- url = str[0];
- var search = query.split('&').filter(function (item) {
- return item;
- });
- query = {};
- search.forEach(function (item) {
- item = item.split('=');
- query[item[0]] = item[1];
- });
-
- for (var key in data) {
- if (data.hasOwnProperty(key)) {
- query[encodeURIComponent(key)] = encodeURIComponent(data[key]);
- }
- }
-
- query = Object.keys(query).map(function (item) {
- return "".concat(item, "=").concat(query[item]);
- }).join('&');
- return url + (query ? '?' + query : '') + (hash ? '#' + hash : '');
-}
-/**
- * 解析响应头
- * @param {string} headers
- * @return {object}
- */
-
-
-function parseHeaders(headers) {
- var headersObject = {};
- var headersArray = headers.split('\n');
- headersArray.forEach(function (header) {
- var find = header.match(/(\S+\s*):\s*(.*)/);
-
- if (!find || find.length !== 3) {
- return;
- }
-
- var key = find[1];
- var val = find[2];
- headersObject[key] = val;
- });
- return headersObject;
-}
-/**
- * 发起网络请求
- * @param {object} param0
- * @param {string} callbackId
- * @return {RequestTask}
- */
-
-
-function request(_ref, callbackId) {
- var url = _ref.url,
- data = _ref.data,
- header = _ref.header,
- method = _ref.method,
- dataType = _ref.dataType,
- responseType = _ref.responseType;
- var _UniServiceJSBridge = UniServiceJSBridge,
- invoke = _UniServiceJSBridge.invokeCallbackHandler;
- var body = null;
- var timeout = __uniConfig.networkTimeout && __uniConfig.networkTimeout.request || 60 * 1000; // 根据请求类型处理数据
-
- var contentType;
-
- for (var _key in header) {
- if (header.hasOwnProperty(_key)) {
- if (_key.toLowerCase() === 'content-type') {
- contentType = header[_key];
-
- if (contentType.indexOf('application/json') === 0) {
- contentType = 'json';
- } else if (contentType.indexOf('application/x-www-form-urlencoded') === 0) {
- contentType = 'urlencoded';
- } else {
- contentType = 'string';
- }
-
- break;
- }
- }
- }
-
- if (method === 'GET') {
- url = setUrl(url, data);
- } else {
- if (!contentType) {
- /**
- * 跨域时部分服务器OPTION响应头Access-Control-Allow-Headers未包含Content-Type会请求失败
- */
- header['Content-Type'] = 'application/json';
- contentType = 'json';
- }
-
- if (typeof data === 'string' || data instanceof ArrayBuffer) {
- body = data;
- } else {
- if (contentType === 'json') {
- try {
- body = JSON.stringify(data);
- } catch (error) {
- body = data.toString();
- }
- } else if (contentType === 'urlencoded') {
- var bodyArray = [];
-
- for (var _key2 in data) {
- if (data.hasOwnProperty(_key2)) {
- bodyArray.push(encodeURIComponent(_key2) + '=' + encodeURIComponent(data[_key2]));
- }
- }
-
- body = bodyArray.join('&');
- } else {
- body = data.toString();
- }
- }
- }
-
- var xhr = new XMLHttpRequest();
- var requestTask = new RequestTask(xhr);
- xhr.open(method, url);
-
- for (var key in header) {
- if (header.hasOwnProperty(key)) {
- xhr.setRequestHeader(key, header[key]);
- }
- }
-
- var timer = setTimeout(function () {
- xhr.onload = xhr.onabort = xhr.onerror = null;
- requestTask.abort();
- invoke(callbackId, {
- errMsg: 'request:fail timeout'
- });
- }, timeout);
- xhr.responseType = responseType.toLowerCase();
-
- xhr.onload = function () {
- clearTimeout(timer);
- var statusCode = xhr.status;
- var res = responseType === 'TEXT' ? xhr.responseText : xhr.response;
-
- if (responseType === 'TEXT' && dataType === 'JSON') {
- try {
- res = JSON.parse(res);
- } catch (error) {// 和微信一致解析失败不抛出错误
- // invoke(callbackId, {
- // errMsg: 'request:fail json parse error'
- // })
- // return
- }
- }
-
- invoke(callbackId, {
- data: res,
- statusCode: statusCode,
- header: parseHeaders(xhr.getAllResponseHeaders()),
- errMsg: 'request:ok'
- });
- };
-
- xhr.onabort = function () {
- clearTimeout(timer);
- invoke(callbackId, {
- errMsg: 'request:fail abort'
- });
- };
-
- xhr.onerror = function () {
- clearTimeout(timer);
- invoke(callbackId, {
- errMsg: 'request:fail'
- });
- };
-
- xhr.send(body);
- return requestTask;
-}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("0dd1")))
-
-/***/ }),
-
-/***/ "1a33":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "1b6f":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("f2b3");
-
-/* harmony default export */ __webpack_exports__["a"] = ({
- // 取消id的定义,某些组件(canvas)内不在props内定义id
- // props: {
- // id: {
- // type: String,
- // default: ''
- // }
- // },
- mounted: function mounted() {
- var _this = this;
-
- this._toggleListeners('subscribe', this.id); // 初始化监听
-
-
- this.$watch('id', function (newId, oldId) {
- // watch id
- _this._toggleListeners('unsubscribe', oldId, true);
-
- _this._toggleListeners('subscribe', newId, true);
- });
- },
- beforeDestroy: function beforeDestroy() {
- // 销毁时移除
- this._toggleListeners('unsubscribe', this.id);
- },
- methods: {
- _toggleListeners: function _toggleListeners(type, id, watch) {
- if (watch && !id) {
- // id被置空
- return;
- }
-
- if (!Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(this._handleSubscribe)) {
- return;
- } // 纠正VUniVideo等组件命名为Video
-
-
- UniViewJSBridge[type](this.$page.id + '-' + this.$options.name.replace(/VUni([A-Z])/, '$1').toLowerCase() + '-' + id, this._handleSubscribe);
- }
- }
-});
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("501c")))
-
-/***/ }),
-
-/***/ "1c64":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("9613");
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
-/* unused harmony reexport * */
- /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
-
-/***/ }),
-
-/***/ "1ef7":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "interceptors", function() { return interceptors; });
-/* harmony import */ var uni_helpers_interceptor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("8542");
-/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addInterceptor", function() { return uni_helpers_interceptor__WEBPACK_IMPORTED_MODULE_0__["a"]; });
-
-/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeInterceptor", function() { return uni_helpers_interceptor__WEBPACK_IMPORTED_MODULE_0__["d"]; });
-
-
-
-var interceptors = {
- promiseInterceptor: uni_helpers_interceptor__WEBPACK_IMPORTED_MODULE_0__[/* promiseInterceptor */ "c"]
-};
-
-/***/ }),
-
-/***/ "1efd":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
-var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf");
-var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
-
-// EXTERNAL MODULE: ./src/platforms/h5/helpers/get-real-path.js
-var get_real_path = __webpack_require__("cb0f");
-
-// EXTERNAL MODULE: ./src/core/view/plugins/events.js
-var events = __webpack_require__("d4b6");
-
-// CONCATENATED MODULE: ./src/core/view/mixins/base.js
-
-
-/* harmony default export */ var base = ({
- methods: {
- $getRealPath: function $getRealPath(src) {
- return Object(get_real_path["a" /* default */])(src);
- },
- $trigger: function $trigger(name, $event, detail) {
- this.$emit(name, events["b" /* processEvent */].call(this, name, $event, detail, this.$el, this.$el));
- }
- }
-});
-// CONCATENATED MODULE: ./src/core/view/mixins/animation.js
-function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
-
-function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
-
-function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
-
-function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
-
-function converPx(value) {
- if (/\d+[ur]px$/i.test(value)) {
- value.replace(/\d+[ur]px$/i, function (text) {
- return "".concat(uni.upx2px(parseFloat(text)), "px");
- }); // eslint-disable-next-line no-useless-escape
- } else if (/^-?[\d\.]+$/.test(value)) {
- return "".concat(value, "px");
- }
-
- return value || '';
-}
-
-function converType(type) {
- return type.replace(/[A-Z]/g, function (text) {
- return "-".concat(text.toLowerCase());
- }).replace('webkit', '-webkit');
-}
-
-function getStyle(action) {
- var animateTypes1 = ['matrix', 'matrix3d', 'scale', 'scale3d', 'rotate3d', 'skew', 'translate', 'translate3d'];
- var animateTypes2 = ['scaleX', 'scaleY', 'scaleZ', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'skewX', 'skewY', 'translateX', 'translateY', 'translateZ'];
- var animateTypes3 = ['opacity', 'backgroundColor'];
- var animateTypes4 = ['width', 'height', 'left', 'right', 'top', 'bottom'];
- var animates = action.animates;
- var option = action.option;
- var transition = option.transition;
- var style = {};
- var transform = [];
- animates.forEach(function (animate) {
- var type = animate.type;
-
- var args = _toConsumableArray(animate.args);
-
- if (animateTypes1.concat(animateTypes2).includes(type)) {
- if (type.startsWith('rotate') || type.startsWith('skew')) {
- args = args.map(function (value) {
- return parseFloat(value) + 'deg';
- });
- } else if (type.startsWith('translate')) {
- args = args.map(converPx);
- }
-
- if (animateTypes2.indexOf(type)) {
- args.length = 1;
- }
-
- transform.push("".concat(type, "(").concat(args.join(','), ")"));
- } else if (animateTypes3.concat(animateTypes4).includes(type)) {
- var value = args[0];
- style[type] = animateTypes4.includes(type) ? converPx(value) : value;
- }
- });
- style.transform = style.webkitTransform = transform.join(' ');
- style.transition = style.webkitTransition = Object.keys(style).map(function (type) {
- return "".concat(converType(type), " ").concat(transition.duration, "ms ").concat(transition.timingFunction, " ").concat(transition.delay, "ms");
- }).join(',');
- style.transformOrigin = style.webkitTransformOrigin = option.transformOrigin;
- return style;
-}
-
-function startAnimation(context) {
- var animation = context.animation;
-
- if (!animation || !animation.actions || !animation.actions.length) {
- return;
- }
-
- var index = 0;
- var actions = animation.actions;
- var length = animation.actions.length;
-
- function animate() {
- var action = actions[index];
- var transition = action.option.transition;
- var style = getStyle(action);
- Object.keys(style).forEach(function (key) {
- context.$el.style[key] = style[key];
- });
- index += 1;
-
- if (index < length) {
- setTimeout(animate, transition.duration + transition.delay);
- }
- }
-
- animate();
-}
-
-/* harmony default export */ var animation = ({
- props: ['animation'],
- watch: {
- animation: function animation() {
- startAnimation(this);
- }
- },
- mounted: function mounted() {
- startAnimation(this);
- }
-});
-// CONCATENATED MODULE: ./src/core/view/components/index.js
-
-
-
-var requireComponents = [// baseComponents
-__webpack_require__("5408"), __webpack_require__("93a5")];
-requireComponents.forEach(function (components, index) {
- components.keys().forEach(function (fileName) {
- // 获取组件配置
- var componentModule = components(fileName);
- var componentConfig = componentModule.default || componentModule;
- componentConfig.mixins = componentConfig.mixins ? [].concat(base, componentConfig.mixins) : [base];
- componentConfig.mixins.push(animation);
- componentConfig.name = 'VUni' + componentConfig.name; // 全局注册组件
-
- external_commonjs_vue_commonjs2_vue_root_Vue_default.a.component(componentConfig.name, componentConfig);
- });
-});
-
-/***/ }),
-
-/***/ "22ec":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "canIUse", function() { return canIUse; });
-var canIUse = [{
- name: 'schema',
- type: String,
- required: true
-}];
-
-/***/ }),
-
-/***/ "23af":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "23e5":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getTabBarScrollPosition; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return initRouterGuard; });
-/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("a741");
-
-
-function addKeepAliveInclude(componentName) {
- if (this.keepAliveInclude.indexOf(componentName) === -1) {
- // 目标页面,自动 include
- this.keepAliveInclude.push(componentName);
- }
-}
-
-var deltaIds = [];
-
-function removeKeepAliveInclude(componentNameOrDelta) {
- if (typeof componentNameOrDelta === 'number') {
- deltaIds = this.keepAliveInclude.splice(-(componentNameOrDelta - 1)).map(function (name) {
- return parseInt(name.split('-').pop());
- });
- } else {
- var index = this.keepAliveInclude.indexOf(componentNameOrDelta);
-
- if (index !== -1) {
- this.keepAliveInclude.splice(index, 1);
- }
- }
-}
-
-var positionStore = Object.create(null);
-function getTabBarScrollPosition(id) {
- return positionStore[id];
-}
-
-function saveTabBarScrollPosition(id) {
- positionStore[id] = {
- x: window.pageXOffset,
- y: window.pageYOffset
- };
-}
-
-function switchTab(routes, to, from) {
- if (to && from && to.meta.isTabBar && from.meta.isTabBar) {
- // tabbar 跳 tabbar
- saveTabBarScrollPosition(from.params.__id__);
- } // 关闭非 tabBar 页面
-
-
- var pages = getCurrentPages();
-
- for (var i = pages.length - 1; i >= 0; i--) {
- var pageVm = pages[i];
- var meta = pageVm.$page.meta;
-
- if (!meta.isTabBar) {
- removeKeepAliveInclude.call(this, meta.name + '-' + pageVm.$page.id);
- Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* callPageHook */ "b"])(pageVm, 'onUnload');
- }
- }
-}
-
-function reLaunch(toName) {
- __uniConfig.reLaunch = (__uniConfig.reLaunch || 1) + 1; // 关闭所有页面
-
- var pages = getCurrentPages(true);
-
- for (var i = pages.length - 1; i >= 0; i--) {
- Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* callPageHook */ "b"])(pages[i], 'onUnload'); // 重新reLaunch至首页可能会被keepAlive,先手动强制destroy
-
- pages[i].$destroy();
- }
-
- this.keepAliveInclude = []; // 清空 positionStore
-
- positionStore = Object.create(null);
-}
-
-var currentPages = [];
-
-function beforeEach(to, from, next, routes) {
- currentPages = getCurrentPages(true); // 每次 beforeEach 时获取当前currentPages,因为 afterEach 之后,获取不到上一个 page 了,导致无法调用 onUnload
-
- var fromId = from.params.__id__;
- var toId = to.params.__id__;
- var toName = to.meta.name + '-' + toId;
-
- if (toId === fromId) {
- // 相同页面阻止
- // 处理外部修改 history 导致卡在当前页面的问题
- if (to.fullPath !== from.fullPath) {
- removeKeepAliveInclude.call(this, toName);
- next();
- } else {
- next(false);
- }
- } else if (to.meta.id && to.meta.id !== toId) {
- // id 不妥,replace跳转
- next({
- path: to.path,
- replace: true
- });
- } else {
- var fromName = from.meta.name + '-' + fromId;
-
- switch (to.type) {
- case 'navigateTo':
- break;
-
- case 'redirectTo':
- // 关闭前一个页面
- removeKeepAliveInclude.call(this, fromName);
-
- if (from.meta) {
- if (from.meta.isQuit) {
- // 如果 redirectTo 的前一个页面是 quit 类型,则新打开的页面也是 quit
- to.meta.isQuit = true;
- to.meta.isEntry = !!from.meta.isEntry;
- }
-
- if (from.meta.isTabBar) {
- // 如果是 tabBar,需要更新系统组件 tabBar 内的 list 数据
- to.meta.isTabBar = true;
- to.meta.tabBarIndex = from.meta.tabBarIndex;
- var appVm = getApp().$children[0];
- appVm.$set(appVm.tabBar.list[to.meta.tabBarIndex], 'pagePath', to.meta.pagePath);
- }
- }
-
- break;
-
- case 'switchTab':
- switchTab.call(this, routes, to, from);
- break;
-
- case 'reLaunch':
- reLaunch.call(this, toName);
- to.meta.isQuit = true; // reLaunch后,该页面为 quit 类型
-
- break;
-
- default:
- // 后退或非 API 访问
- if (fromId && fromId > toId) {
- // back
- removeKeepAliveInclude.call(this, fromName);
-
- if (this.$router._$delta > 1) {
- removeKeepAliveInclude.call(this, this.$router._$delta);
- }
- }
-
- break;
- }
-
- if (to.type !== 'reLaunch' && from.meta.id) {
- // 如果不是 reLaunch,且 meta 指定了 id
- addKeepAliveInclude.call(this, fromName);
- } // if (to.type !== 'reLaunch') { // TODO 如果 reLaunch,1.keepAlive的话,无法触发页面生命周期,并刷新页面,2.不 keepAlive 的话,页面状态无法再次保留,且 routeView 的 cache 有问题
-
-
- addKeepAliveInclude.call(this, toName); // }
-
- if (false) {}
- /* eslint-disable no-undef */
-
-
- if (true) {
- if (to.meta && to.meta.name) {
- document.body.className = 'uni-body ' + to.meta.name;
- var nvueDirKey = 'nvue-dir-' + __uniConfig.nvue['flex-direction'];
-
- if (to.meta.isNVue) {
- document.body.setAttribute('nvue', '');
- document.body.setAttribute(nvueDirKey, '');
- } else {
- document.body.removeAttribute('nvue');
- document.body.removeAttribute(nvueDirKey);
- }
- }
- }
-
- next();
- }
-}
-
-function afterEach(to, from) {
- var fromId = from.params.__id__;
- var toId = to.params.__id__;
- var fromVm = currentPages.find(function (pageVm) {
- return pageVm.$page.id === fromId;
- }); // 使用 beforeEach 时的 pages
-
- switch (to.type) {
- case 'navigateTo':
- // 前一个页面触发 onHide
- fromVm && Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* callPageHook */ "b"])(fromVm, 'onHide');
- break;
-
- case 'redirectTo':
- // 前一个页面触发 onUnload
- fromVm && Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* callPageHook */ "b"])(fromVm, 'onUnload');
- break;
-
- case 'switchTab':
- if (from.meta.isTabBar) {
- // 前一个页面是 tabBar 触发 onHide,非 tabBar 页面在 beforeEach 中已触发 onUnload
- fromVm && Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* callPageHook */ "b"])(fromVm, 'onHide');
- }
-
- break;
-
- case 'reLaunch':
- break;
-
- default:
- if (fromId && fromId > toId) {
- // history back
- fromVm && Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* callPageHook */ "b"])(fromVm, 'onUnload');
-
- if (this.$router._$delta > 1) {
- deltaIds.reverse().forEach(function (deltaId) {
- var pageVm = currentPages.find(function (pageVm) {
- return pageVm.$page.id === deltaId;
- });
- pageVm && Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* callPageHook */ "b"])(pageVm, 'onUnload');
- });
- }
- }
-
- break;
- }
-
- delete this.$router._$delta;
- deltaIds.length = 0;
-
- if (to.type !== 'reLaunch') {
- // 因为 reLaunch 会重置 id,故不触发 onShow,switchTab 在 beforeRouteEnter 中触发
- // 直接获取所有 pages,getCurrentPages 正常情况下仅返回页面栈内,传 true 则返回所有已存在(主要是 tabBar 页面)
- var toVm = getCurrentPages(true).find(function (pageVm) {
- return pageVm.$page.id === toId;
- }); // 使用最新的 pages
-
- if (toVm) {
- // 目标页面若已存在,则触发 onShow
- // 延迟执行 onShow,防止与 UniServiceJSBridge.emit('onHidePopup') 冲突。
- setTimeout(function () {
- Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* callPageHook */ "b"])(toVm, 'onShow');
- }, 0);
-
- if (true) {
- document.title = toVm.$parent.$parent.navigationBar.titleText;
- }
- }
- }
-}
-
-function initRouterGuard(appVm, routes) {
- // 处理keepAliveInclude
- appVm.$router.beforeEach(function (to, from, next) {
- beforeEach.call(appVm, to, from, next, routes);
- }); // 处理前进时的 onUnload,onHide 和后退时的 onShow
-
- appVm.$router.afterEach(function (to, from) {
- afterEach.call(appVm, to, from);
- });
-}
-
-/***/ }),
-
-/***/ "24aa":
-/***/ (function(module, exports) {
-
-var g;
-
-// This works in non-strict mode
-g = (function() {
- return this;
-})();
-
-try {
- // This works if eval is allowed (see CSP)
- g = g || new Function("return this")();
-} catch (e) {
- // This works if the window reference is available
- if (typeof window === "object") g = window;
-}
-
-// g can still be undefined, but nothing to do about it...
-// We return undefined, instead of nothing here, so it's
-// easier to handle this case. if(!global) { ...}
-
-module.exports = g;
-
-
-/***/ }),
-
-/***/ "24d9":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return wrapperMPEvent; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return mergeTitleNView; });
-/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("f2b3");
-function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
-
-
-/**
- * mpvue event
- */
-
-function wrapperMPEvent(event) {
- return Object.assign({
- mp: event,
- _processed: true
- }, event);
-}
-/**
- * app-plus titleNView
- */
-
-function mergeTitleNView(navigationBar, titleNView) {
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isPlainObject */ "f"])(titleNView)) {
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* hasOwn */ "c"])(titleNView, 'backgroundColor')) {
- navigationBar.backgroundColor = titleNView.backgroundColor;
- }
-
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* hasOwn */ "c"])(titleNView, 'buttons')) {
- navigationBar.buttons = titleNView.buttons;
- }
-
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* hasOwn */ "c"])(titleNView, 'titleColor')) {
- navigationBar.textColor = titleNView.titleColor;
- }
-
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* hasOwn */ "c"])(titleNView, 'titleText')) {
- navigationBar.titleText = titleNView.titleText;
- }
-
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* hasOwn */ "c"])(titleNView, 'titleSize')) {
- navigationBar.titleSize = titleNView.titleSize;
- }
-
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* hasOwn */ "c"])(titleNView, 'type')) {
- navigationBar.type = titleNView.type;
- }
-
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* hasOwn */ "c"])(titleNView, 'searchInput') && _typeof(titleNView.searchInput) === 'object') {
- navigationBar.searchInput = Object.assign({
- autoFocus: false,
- align: 'center',
- color: '#000000',
- backgroundColor: 'rgba(255,255,255,0.5)',
- borderRadius: '0px',
- placeholder: '',
- placeholderColor: '#CCCCCC',
- disabled: false
- }, titleNView.searchInput);
- }
- }
-
- return navigationBar;
-}
-
-/***/ }),
-
-/***/ "250d":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"120ddde1-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/input/index.vue?vue&type=template&id=6a171a59&
-var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('uni-input',_vm._g({},_vm.$listeners),[_c('div',{ref:"wrapper",staticClass:"uni-input-wrapper"},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(!(_vm.composing || _vm.inputValue.length)),expression:"!(composing || inputValue.length)"}],ref:"placeholder",staticClass:"uni-input-placeholder",class:_vm.placeholderClass,style:(_vm.placeholderStyle)},[_vm._v(_vm._s(_vm.placeholder))]),((_vm.inputType)==='checkbox')?_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.inputValue),expression:"inputValue"}],ref:"input",staticClass:"uni-input-input",attrs:{"disabled":_vm.disabled,"maxlength":_vm.maxlength,"step":_vm.step,"autocomplete":"off","type":"checkbox"},domProps:{"checked":Array.isArray(_vm.inputValue)?_vm._i(_vm.inputValue,null)>-1:(_vm.inputValue)},on:{"focus":_vm._onFocus,"blur":_vm._onBlur,"input":function($event){$event.stopPropagation();return _vm._onInput($event)},"compositionstart":_vm._onComposition,"compositionend":_vm._onComposition,"keyup":function($event){$event.stopPropagation();return _vm._onKeyup($event)},"change":function($event){var $$a=_vm.inputValue,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.inputValue=$$a.concat([$$v]))}else{$$i>-1&&(_vm.inputValue=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{_vm.inputValue=$$c}}}}):((_vm.inputType)==='radio')?_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.inputValue),expression:"inputValue"}],ref:"input",staticClass:"uni-input-input",attrs:{"disabled":_vm.disabled,"maxlength":_vm.maxlength,"step":_vm.step,"autocomplete":"off","type":"radio"},domProps:{"checked":_vm._q(_vm.inputValue,null)},on:{"focus":_vm._onFocus,"blur":_vm._onBlur,"input":function($event){$event.stopPropagation();return _vm._onInput($event)},"compositionstart":_vm._onComposition,"compositionend":_vm._onComposition,"keyup":function($event){$event.stopPropagation();return _vm._onKeyup($event)},"change":function($event){_vm.inputValue=null}}}):_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.inputValue),expression:"inputValue"}],ref:"input",staticClass:"uni-input-input",attrs:{"disabled":_vm.disabled,"maxlength":_vm.maxlength,"step":_vm.step,"autocomplete":"off","type":_vm.inputType},domProps:{"value":(_vm.inputValue)},on:{"focus":_vm._onFocus,"blur":_vm._onBlur,"input":[function($event){if($event.target.composing){ return; }_vm.inputValue=$event.target.value},function($event){$event.stopPropagation();return _vm._onInput($event)}],"compositionstart":_vm._onComposition,"compositionend":_vm._onComposition,"keyup":function($event){$event.stopPropagation();return _vm._onKeyup($event)}}})])])}
-var staticRenderFns = []
-
-
-// CONCATENATED MODULE: ./src/core/view/components/input/index.vue?vue&type=template&id=6a171a59&
-
-// EXTERNAL MODULE: ./src/core/view/mixins/index.js + 1 modules
-var mixins = __webpack_require__("8af1");
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/input/index.vue?vue&type=script&lang=js&
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-
-var INPUT_TYPES = ['text', 'number', 'idcard', 'digit', 'password'];
-var NUMBER_TYPES = ['number', 'digit'];
-/* harmony default export */ var inputvue_type_script_lang_js_ = ({
- name: 'Input',
- mixins: [mixins["a" /* emitter */]],
- model: {
- prop: 'value',
- event: 'update:value'
- },
- props: {
- name: {
- type: String,
- default: ''
- },
- value: {
- type: [String, Number],
- default: ''
- },
- type: {
- type: String,
- default: 'text'
- },
- password: {
- type: [Boolean, String],
- default: false
- },
- placeholder: {
- type: String,
- default: ''
- },
- placeholderStyle: {
- type: String,
- default: ''
- },
- placeholderClass: {
- type: String,
- default: ''
- },
- disabled: {
- type: [Boolean, String],
- default: false
- },
- maxlength: {
- type: [Number, String],
- default: 140
- },
- focus: {
- type: [Boolean, String],
- default: false
- },
- confirmType: {
- type: String,
- default: 'done'
- }
- },
- data: function data() {
- return {
- inputValue: this.value + '',
- composing: false,
- wrapperHeight: 0,
- cachedValue: ''
- };
- },
- computed: {
- inputType: function inputType() {
- var type = '';
-
- switch (this.type) {
- case 'text':
- this.confirmType === 'search' && (type = 'search');
- break;
-
- case 'idcard':
- // TODO 可能要根据不同平台进行区分处理
- type = 'text';
- break;
-
- case 'digit':
- type = 'number';
- break;
-
- default:
- type = ~INPUT_TYPES.indexOf(this.type) ? this.type : 'text';
- break;
- }
-
- return this.password ? 'password' : type;
- },
- step: function step() {
- // 处理部分设备中无法输入小数点的问题
- return ~NUMBER_TYPES.indexOf(this.type) ? '0.000000000000000001' : '';
- }
- },
- watch: {
- focus: function focus(value) {
- value && this._focusInput();
- },
- value: function value(_value) {
- this.inputValue = _value + '';
- },
- inputValue: function inputValue(value) {
- this.$emit('update:value', value);
- },
- maxlength: function maxlength(value) {
- var realValue = this.inputValue.slice(0, parseInt(value, 10));
- realValue !== this.inputValue && (this.inputValue = realValue);
- }
- },
- created: function created() {
- this.$dispatch('Form', 'uni-form-group-update', {
- type: 'add',
- vm: this
- });
- },
- mounted: function mounted() {
- if (this.confirmType === 'search') {
- var formElem = document.createElement('form');
- formElem.action = '';
-
- formElem.onsubmit = function () {
- return false;
- };
-
- formElem.className = 'uni-input-form';
- formElem.appendChild(this.$refs.input);
- this.$refs.wrapper.appendChild(formElem);
- }
-
- var $vm = this;
-
- while ($vm) {
- var scopeId = $vm.$options._scopeId;
-
- if (scopeId) {
- this.$refs.placeholder.setAttribute(scopeId, '');
- }
-
- $vm = $vm.$parent;
- }
-
- this.focus && this._focusInput();
- },
- beforeDestroy: function beforeDestroy() {
- this.$dispatch('Form', 'uni-form-group-update', {
- type: 'remove',
- vm: this
- });
- },
- methods: {
- _onKeyup: function _onKeyup($event) {
- if ($event.keyCode === 13) {
- this.$trigger('confirm', $event, {
- value: $event.target.value
- });
- }
- },
- _onInput: function _onInput($event) {
- if (this.composing) {
- return;
- } // 处理部分输入法可以输入其它字符的情况
-
-
- if (~NUMBER_TYPES.indexOf(this.type)) {
- if (this.$refs.input.validity && !this.$refs.input.validity.valid) {
- $event.target.value = this.cachedValue;
- this.inputValue = $event.target.value; // 输入非法字符不触发 input 事件
-
- return;
- } else {
- this.cachedValue = this.inputValue;
- }
- } // type="number" 不支持 maxlength 属性,因此需要主动限制长度。
-
-
- if (this.inputType === 'number') {
- var maxlength = parseInt(this.maxlength, 10);
-
- if (maxlength > 0 && $event.target.value.length > maxlength) {
- $event.target.value = $event.target.value.slice(0, maxlength);
- this.inputValue = $event.target.value; // 字符长度超出范围不触发 input 事件
-
- return;
- }
- }
-
- this.$trigger('input', $event, {
- value: this.inputValue
- });
- },
- _onFocus: function _onFocus($event) {
- this.$trigger('focus', $event, {
- value: $event.target.value
- });
- },
- _onBlur: function _onBlur($event) {
- this.$trigger('blur', $event, {
- value: $event.target.value
- });
- },
- _focusInput: function _focusInput() {
- var _this = this;
-
- setTimeout(function () {
- _this.$refs.input.focus();
- }, 350);
- },
- _blurInput: function _blurInput() {
- var _this2 = this;
-
- setTimeout(function () {
- _this2.$refs.input.blur();
- }, 350);
- },
- _onComposition: function _onComposition($event) {
- if ($event.type === 'compositionstart') {
- this.composing = true;
- } else {
- this.composing = false;
- }
- },
- _resetFormData: function _resetFormData() {
- this.inputValue = '';
- },
- _getFormData: function _getFormData() {
- return this.name ? {
- value: this.inputValue,
- key: this.name
- } : {};
- }
- }
-});
-// CONCATENATED MODULE: ./src/core/view/components/input/index.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_inputvue_type_script_lang_js_ = (inputvue_type_script_lang_js_);
-// EXTERNAL MODULE: ./src/core/view/components/input/index.vue?vue&type=style&index=0&lang=css&
-var inputvue_type_style_index_0_lang_css_ = __webpack_require__("0f55");
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js
-var componentNormalizer = __webpack_require__("0c7c");
-
-// CONCATENATED MODULE: ./src/core/view/components/input/index.vue
-
-
-
-
-
-
-/* normalize component */
-
-var component = Object(componentNormalizer["a" /* default */])(
- components_inputvue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- null,
- null,
- null
-
-)
-
-/* harmony default export */ var input = __webpack_exports__["default"] = (component.exports);
-
-/***/ }),
-
-/***/ "25ce":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"120ddde1-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/checkbox-group/index.vue?vue&type=template&id=6fa043c2&
-var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('uni-checkbox-group',_vm._g({},_vm.$listeners),[_vm._t("default")],2)}
-var staticRenderFns = []
-
-
-// CONCATENATED MODULE: ./src/core/view/components/checkbox-group/index.vue?vue&type=template&id=6fa043c2&
-
-// EXTERNAL MODULE: ./src/core/view/mixins/index.js + 1 modules
-var mixins = __webpack_require__("8af1");
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/checkbox-group/index.vue?vue&type=script&lang=js&
-//
-//
-//
-//
-//
-//
-
-/* harmony default export */ var checkbox_groupvue_type_script_lang_js_ = ({
- name: 'CheckboxGroup',
- mixins: [mixins["a" /* emitter */], mixins["c" /* listeners */]],
- props: {
- name: {
- type: String,
- default: ''
- }
- },
- data: function data() {
- return {
- checkboxList: []
- };
- },
- listeners: {
- '@checkbox-change': '_changeHandler',
- '@checkbox-group-update': '_checkboxGroupUpdateHandler'
- },
- created: function created() {
- this.$dispatch('Form', 'uni-form-group-update', {
- type: 'add',
- vm: this
- });
- },
- beforeDestroy: function beforeDestroy() {
- this.$dispatch('Form', 'uni-form-group-update', {
- type: 'remove',
- vm: this
- });
- },
- methods: {
- _changeHandler: function _changeHandler($event) {
- var value = [];
- this.checkboxList.forEach(function (vm) {
- if (vm.checkboxChecked) {
- value.push(vm.value);
- }
- });
- this.$trigger('change', $event, {
- value: value
- });
- },
- _checkboxGroupUpdateHandler: function _checkboxGroupUpdateHandler($event) {
- if ($event.type === 'add') {
- this.checkboxList.push($event.vm);
- } else {
- var index = this.checkboxList.indexOf($event.vm);
- this.checkboxList.splice(index, 1);
- }
- },
- _getFormData: function _getFormData() {
- var data = {};
-
- if (this.name !== '') {
- var value = [];
- this.checkboxList.forEach(function (vm) {
- if (vm.checkboxChecked) {
- value.push(vm.value);
- }
- });
- data['value'] = value;
- data['key'] = this.name;
- }
-
- return data;
- }
- }
-});
-// CONCATENATED MODULE: ./src/core/view/components/checkbox-group/index.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_checkbox_groupvue_type_script_lang_js_ = (checkbox_groupvue_type_script_lang_js_);
-// EXTERNAL MODULE: ./src/core/view/components/checkbox-group/index.vue?vue&type=style&index=0&lang=css&
-var checkbox_groupvue_type_style_index_0_lang_css_ = __webpack_require__("0998");
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js
-var componentNormalizer = __webpack_require__("0c7c");
-
-// CONCATENATED MODULE: ./src/core/view/components/checkbox-group/index.vue
-
-
-
-
-
-
-/* normalize component */
-
-var component = Object(componentNormalizer["a" /* default */])(
- components_checkbox_groupvue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- null,
- null,
- null
-
-)
-
-/* harmony default export */ var checkbox_group = __webpack_exports__["default"] = (component.exports);
-
-/***/ }),
-
-/***/ "2604":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "openDocument", function() { return openDocument; });
-var openDocument = {
- filePath: {
- type: String,
- required: true
- },
- fileType: {
- type: String
- }
-};
-
-/***/ }),
-
-/***/ "2608":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(console) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return tryCatchFramework; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return tryCatch; });
-/**
- * 框架内 try-catch
- */
-function tryCatchFramework(fn) {
- return function () {
- try {
- return fn.apply(fn, arguments);
- } catch (e) {
- // TODO
- console.error(e);
- }
- };
-}
-/**
- * 开发者 try-catch
- */
-
-function tryCatch(fn) {
- return function () {
- try {
- return fn.apply(fn, arguments);
- } catch (e) {
- // TODO
- console.error(e);
- }
- };
-}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("3ad9")["default"]))
-
-/***/ }),
-
-/***/ "26d3":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTabBarItem", function() { return setTabBarItem; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTabBarStyle", function() { return setTabBarStyle; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hideTabBar", function() { return hideTabBar; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "showTabBar", function() { return showTabBar; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hideTabBarRedDot", function() { return hideTabBarRedDot; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "showTabBarRedDot", function() { return showTabBarRedDot; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeTabBarBadge", function() { return removeTabBarBadge; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTabBarBadge", function() { return setTabBarBadge; });
-/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("f2b3");
-
-var setTabBarItemProps = ['text', 'iconPath', 'selectedIconPath'];
-var setTabBarStyleProps = ['color', 'selectedColor', 'backgroundColor', 'borderStyle'];
-var setTabBarBadgeProps = ['badge', 'redDot'];
-
-function setTabBar(type) {
- var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var app = getApp();
-
- if (app) {
- var isTabBar = false;
- var pages = getCurrentPages();
-
- if (pages.length) {
- if (pages[pages.length - 1].$page.meta.isTabBar) {
- isTabBar = true;
- }
- } else if (app.$children[0].hasTabBar) {
- isTabBar = true;
- }
-
- if (!isTabBar) {
- return {
- errMsg: "".concat(type, ":fail not TabBar page")
- };
- }
-
- var index = args.index;
- var tabBar = app.$children[0].tabBar;
-
- if (index >= __uniConfig.tabBar.list.length) {
- return {
- errMsg: "".concat(type, ":fail tabbar item not found")
- };
- }
-
- switch (type) {
- case 'showTabBar':
- app.$children[0].hideTabBar = false;
- break;
-
- case 'hideTabBar':
- app.$children[0].hideTabBar = true;
- break;
-
- case 'setTabBarItem':
- Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* setProperties */ "g"])(tabBar.list[index], setTabBarItemProps, args);
- break;
-
- case 'setTabBarStyle':
- Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* setProperties */ "g"])(tabBar, setTabBarStyleProps, args);
- break;
-
- case 'showTabBarRedDot':
- Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* setProperties */ "g"])(tabBar.list[index], setTabBarBadgeProps, {
- badge: '',
- redDot: true
- });
- break;
-
- case 'setTabBarBadge':
- Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* setProperties */ "g"])(tabBar.list[index], setTabBarBadgeProps, {
- badge: args.text,
- redDot: true
- });
- break;
-
- case 'hideTabBarRedDot':
- case 'removeTabBarBadge':
- Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* setProperties */ "g"])(tabBar.list[index], setTabBarBadgeProps, {
- badge: '',
- redDot: false
- });
- break;
- }
- }
-
- return {};
-}
-
-function setTabBarItem(args) {
- return setTabBar('setTabBarItem', args);
-}
-function setTabBarStyle(args) {
- return setTabBar('setTabBarStyle', args);
-}
-function hideTabBar(args) {
- return setTabBar('hideTabBar', args);
-}
-function showTabBar(args) {
- return setTabBar('showTabBar', args);
-}
-function hideTabBarRedDot(args) {
- return setTabBar('hideTabBarRedDot', args);
-}
-function showTabBarRedDot(args) {
- return setTabBar('showTabBarRedDot', args);
-}
-function removeTabBarBadge(args) {
- return setTabBar('removeTabBarBadge', args);
-}
-function setTabBarBadge(args) {
- return setTabBar('setTabBarBadge', args);
-}
-
-/***/ }),
-
-/***/ "2765":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_modal_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("91ce");
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_modal_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_modal_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
-/* unused harmony reexport * */
- /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_modal_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
-
-/***/ }),
-
-/***/ "27a7":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(console) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return invokeCallbackHandler; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return wrapperUnimplemented; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return wrapper; });
-/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("f2b3");
-/* harmony import */ var _catch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("2608");
-/* harmony import */ var _promise__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("ed1a");
-/* harmony import */ var _protocol__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("cc76");
-/* harmony import */ var _params__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("de29");
-
-
-
-
-
-
-function invokeCallbackHandlerFail(err, apiName, callbackId) {
- var errMsg = "".concat(apiName, ":fail ").concat(err);
- console.error(errMsg);
-
- if (callbackId === -1) {
- throw new Error(errMsg);
- }
-
- if (typeof callbackId === 'number') {
- invokeCallbackHandler(callbackId, {
- errMsg: errMsg
- });
- }
-
- return false;
-}
-
-var callbackApiParamTypes = [{
- name: 'callback',
- type: Function,
- required: true
-}];
-
-function validateParams(apiName, paramsData, callbackId) {
- var paramTypes = _protocol__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"][apiName];
-
- if (!paramTypes && Object(_promise__WEBPACK_IMPORTED_MODULE_2__[/* isCallbackApi */ "a"])(apiName)) {
- paramTypes = callbackApiParamTypes;
- }
-
- if (paramTypes) {
- if (Array.isArray(paramTypes) && Array.isArray(paramsData)) {
- var paramTypeObj = Object.create(null);
- var paramsDataObj = Object.create(null);
- var paramsDataLength = paramsData.length;
- paramTypes.forEach(function (paramType, index) {
- paramTypeObj[paramType.name] = paramType;
-
- if (paramsDataLength > index) {
- paramsDataObj[paramType.name] = paramsData[index];
- }
- });
- paramTypes = paramTypeObj;
- paramsData = paramsDataObj;
- }
-
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(paramTypes.beforeValidate)) {
- var err = paramTypes.beforeValidate(paramsData);
-
- if (err) {
- return invokeCallbackHandlerFail(err, apiName, callbackId);
- }
- }
-
- var keys = Object.keys(paramTypes);
-
- for (var i = 0; i < keys.length; i++) {
- if (keys[i] === 'beforeValidate') {
- continue;
- }
-
- var _err = Object(_params__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(keys[i], paramTypes, paramsData);
-
- if (_err) {
- return invokeCallbackHandlerFail(_err, apiName, callbackId);
- }
- }
- }
-
- return true;
-}
-
-var invokeCallbackId = 1;
-var invokeCallbacks = {};
-
-function createKeepAliveApiCallback(apiName, callback) {
- var callbackId = invokeCallbackId++;
- var invokeCallbackName = 'api.' + apiName + '.' + callbackId;
-
- var invokeCallback = function invokeCallback(res) {
- callback(res);
- };
-
- invokeCallbacks[callbackId] = {
- name: invokeCallbackName,
- keepAlive: true,
- callback: invokeCallback
- };
- return callbackId;
-}
-
-function createApiCallback(apiName) {
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var extras = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
-
- if (!Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isPlainObject */ "f"])(params)) {
- return {
- params: params
- };
- }
-
- params = Object.assign({}, params);
- var apiCallbacks = {};
-
- for (var name in params) {
- var param = params[name];
-
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(param)) {
- apiCallbacks[name] = Object(_catch__WEBPACK_IMPORTED_MODULE_1__[/* tryCatch */ "a"])(param);
- delete params[name];
- }
- }
-
- var success = apiCallbacks.success,
- fail = apiCallbacks.fail,
- cancel = apiCallbacks.cancel,
- complete = apiCallbacks.complete;
- var hasSuccess = Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(success);
- var hasFail = Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(fail);
- var hasCancel = Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(cancel);
- var hasComplete = Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(complete);
-
- if (!hasSuccess && !hasFail && !hasCancel && !hasComplete) {
- // 无回调
- return {
- params: params
- };
- }
-
- var wrapperCallbacks = {};
-
- for (var _name in extras) {
- var extra = extras[_name];
-
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(extra)) {
- wrapperCallbacks[_name] = Object(_catch__WEBPACK_IMPORTED_MODULE_1__[/* tryCatchFramework */ "b"])(extra);
- delete extras[_name];
- }
- }
-
- var beforeSuccess = wrapperCallbacks.beforeSuccess,
- afterSuccess = wrapperCallbacks.afterSuccess,
- beforeFail = wrapperCallbacks.beforeFail,
- afterFail = wrapperCallbacks.afterFail,
- beforeCancel = wrapperCallbacks.beforeCancel,
- afterCancel = wrapperCallbacks.afterCancel,
- afterAll = wrapperCallbacks.afterAll;
- var callbackId = invokeCallbackId++;
- var invokeCallbackName = 'api.' + apiName + '.' + callbackId;
-
- var invokeCallback = function invokeCallback(res) {
- res.errMsg = res.errMsg || apiName + ':ok';
- var errMsg = res.errMsg;
-
- if (errMsg.indexOf(apiName + ':ok') === 0) {
- Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(beforeSuccess) && beforeSuccess(res);
- hasSuccess && success(res);
- Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(afterSuccess) && afterSuccess(res);
- } else if (errMsg.indexOf(apiName + ':cancel') === 0) {
- res.errMsg = res.errMsg.replace(apiName + ':cancel', apiName + ':fail cancel');
- hasFail && fail(res);
- Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(beforeCancel) && beforeCancel(res);
- hasCancel && cancel(res);
- Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(afterCancel) && afterCancel(res);
- } else if (errMsg.indexOf(apiName + ':fail') === 0) {
- Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(beforeFail) && beforeFail(res);
- hasFail && fail(res);
- Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(afterFail) && afterFail(res);
- }
-
- hasComplete && complete(res);
- Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(afterAll) && afterAll(res);
- };
-
- invokeCallbacks[callbackId] = {
- name: invokeCallbackName,
- callback: invokeCallback
- };
- return {
- params: params,
- callbackId: callbackId
- };
-}
-
-function createInvokeCallback(apiName) {
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var extras = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
-
- var _createApiCallback = createApiCallback(apiName, params, extras),
- args = _createApiCallback.params,
- callbackId = _createApiCallback.callbackId;
-
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isPlainObject */ "f"])(args) && !validateParams(apiName, args, callbackId)) {
- return {
- params: args,
- callbackId: false
- };
- }
-
- return {
- params: args,
- callbackId: callbackId
- };
-}
-
-function invokeCallbackHandler(invokeCallbackId, res) {
- if (typeof invokeCallbackId === 'number') {
- var invokeCallback = invokeCallbacks[invokeCallbackId];
-
- if (invokeCallback) {
- if (!invokeCallback.keepAlive) {
- delete invokeCallbacks[invokeCallbackId];
- }
-
- return invokeCallback.callback(res);
- }
- }
-
- return res;
-}
-function wrapperUnimplemented(name) {
- return function (args) {
- console.error('API `' + name + '` is not yet implemented');
- };
-}
-function wrapper(name, invokeMethod, extras) {
- if (!Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(invokeMethod)) {
- return invokeMethod;
- }
-
- return function () {
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
-
- if (Object(_promise__WEBPACK_IMPORTED_MODULE_2__[/* isSyncApi */ "b"])(name)) {
- if (validateParams(name, args, -1)) {
- return invokeMethod.apply(null, args);
- }
- } else if (Object(_promise__WEBPACK_IMPORTED_MODULE_2__[/* isCallbackApi */ "a"])(name)) {
- if (validateParams(name, args, -1)) {
- return invokeMethod(createKeepAliveApiCallback(name, args[0]));
- }
- } else {
- var argsObj = {};
-
- if (args.length) {
- argsObj = args[0];
- }
-
- var _createInvokeCallback = createInvokeCallback(name, argsObj, extras),
- params = _createInvokeCallback.params,
- callbackId = _createInvokeCallback.callbackId;
-
- if (callbackId !== false) {
- var res;
-
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "e"])(params)) {
- res = invokeMethod(callbackId);
- } else {
- res = invokeMethod(params, callbackId);
- }
-
- if (res && !Object(_promise__WEBPACK_IMPORTED_MODULE_2__[/* isTaskApi */ "c"])(name)) {
- res = invokeCallbackHandler(callbackId, res);
-
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isPlainObject */ "f"])(res)) {
- res.errMsg = res.errMsg || name + ':ok';
- }
- }
-
- return res;
- }
- }
- };
-}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("3ad9")["default"]))
-
-/***/ }),
-
-/***/ "27ab":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/picker-view/index.vue?vue&type=script&lang=js&
-function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
-
-function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
-
-function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
-
-function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
-
-/* harmony default export */ var picker_viewvue_type_script_lang_js_ = ({
- name: 'PickerView',
- props: {
- value: {
- type: Array,
- default: function _default() {
- return [];
- },
- validator: function validator(val) {
- return Array.isArray(val) && val.filter(function (val) {
- return typeof val === 'number';
- }).length === val.length;
- }
- },
- indicatorStyle: {
- type: String,
- default: ''
- },
- indicatorClass: {
- type: String,
- default: ''
- },
- maskStyle: {
- type: String,
- default: ''
- },
- maskClass: {
- type: String,
- default: ''
- }
- },
- data: function data() {
- return {
- valueSync: _toConsumableArray(this.value),
- height: 34,
- items: [],
- changeSource: ''
- };
- },
- watch: {
- value: function value(val) {
- var _this = this;
-
- this.valueSync.length = val.length;
- val.forEach(function (val, index) {
- if (val !== _this.valueSync[index]) {
- _this.$set(_this.valueSync, index, val);
- }
- });
- },
- valueSync: {
- deep: true,
- handler: function handler(val, oldVal) {
- if (this.changeSource === '') {
- this._valueChanged(val);
- } else {
- this.changeSource = ''; // 避免外部直接对此值进行修改
-
- var value = val.map(function (val) {
- return val;
- });
- this.$emit('update:value', value);
- this.$trigger('change', {}, {
- value: value
- });
- }
- }
- }
- },
- methods: {
- getItemIndex: function getItemIndex(vnode) {
- return this.items.indexOf(vnode);
- },
- getItemValue: function getItemValue(vm) {
- return this.valueSync[this.getItemIndex(vm.$vnode)] || 0;
- },
- setItemValue: function setItemValue(vm, val) {
- var index = this.getItemIndex(vm.$vnode);
- var oldVal = this.valueSync[index];
-
- if (oldVal !== val) {
- this.changeSource = 'touch';
- this.$set(this.valueSync, index, val);
- }
- },
- _valueChanged: function _valueChanged(val) {
- this.items.forEach(function (item, index) {
- item.componentInstance.setCurrent(val[index] || 0);
- });
- },
- _resize: function _resize(_ref) {
- var height = _ref.height;
- this.height = height;
- }
- },
- render: function render(createElement) {
- var items = [];
-
- if (this.$slots.default) {
- this.$slots.default.forEach(function (vnode) {
- if (vnode.componentOptions && vnode.componentOptions.tag === 'v-uni-picker-view-column') {
- items.push(vnode);
- }
- });
- }
-
- this.items = items;
- return createElement('uni-picker-view', {
- on: this.$listeners
- }, [createElement('v-uni-resize-sensor', {
- attrs: {
- initial: true
- },
- on: {
- resize: this._resize
- }
- }), createElement('div', {
- ref: 'wrapper',
- 'class': 'uni-picker-view-wrapper'
- }, items)]);
- }
-});
-// CONCATENATED MODULE: ./src/core/view/components/picker-view/index.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_picker_viewvue_type_script_lang_js_ = (picker_viewvue_type_script_lang_js_);
-// EXTERNAL MODULE: ./src/core/view/components/picker-view/index.vue?vue&type=style&index=0&lang=css&
-var picker_viewvue_type_style_index_0_lang_css_ = __webpack_require__("6062");
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js
-var componentNormalizer = __webpack_require__("0c7c");
-
-// CONCATENATED MODULE: ./src/core/view/components/picker-view/index.vue
-var render, staticRenderFns
-
-
-
-
-
-/* normalize component */
-
-var component = Object(componentNormalizer["a" /* default */])(
- components_picker_viewvue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- null,
- null,
- null
-
-)
-
-/* harmony default export */ var picker_view = __webpack_exports__["default"] = (component.exports);
-
-/***/ }),
-
-/***/ "2829":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function(UniServiceJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocation", function() { return getLocation; });
-/* harmony import */ var _helpers_get_jsonp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("ffdc");
-
-/**
- * wgs84坐标转Gcj02坐标
- * @param {object} coords
- * @param {Function} success
- * @param {Function} error
- */
-
-function wgs84ToGcj02(coords, success, error) {
- /**
- * uniapp 内置key
- */
- var key = __uniConfig.qqMapKey;
- var url = "https://apis.map.qq.com/ws/coord/v1/translate?locations=".concat(coords.latitude, ",").concat(coords.longitude, "&type=1&key=").concat(key, "&output=jsonp");
- Object(_helpers_get_jsonp__WEBPACK_IMPORTED_MODULE_0__[/* getJSONP */ "a"])(url, {}, function (res) {
- if ('locations' in res && res.locations.length) {
- success({
- longitude: res.locations[0].lng,
- latitude: res.locations[0].lat
- });
- } else {
- error(res);
- }
- }, error);
-}
-/**
- * 获取定位信息
- * @param {*} param0
- * @param {*} callbackId
- */
-
-
-function getLocation(_ref, callbackId) {
- var type = _ref.type,
- altitude = _ref.altitude;
- var _UniServiceJSBridge = UniServiceJSBridge,
- invoke = _UniServiceJSBridge.invokeCallbackHandler;
-
- function callback(coords) {
- invoke(callbackId, Object.assign(coords, {
- errMsg: 'getLocation:ok',
- verticalAccuracy: coords.altitudeAccuracy || 0,
- // 无专门水平精度,使用位置精度替代
- horizontalAccuracy: coords.accuracy
- }));
- }
-
- if (navigator.geolocation) {
- navigator.geolocation.getCurrentPosition(function (position) {
- var coords = position.coords;
-
- if (type === 'WGS84') {
- callback(coords);
- } else {
- wgs84ToGcj02(coords, callback, function (err) {
- invoke(callbackId, {
- errMsg: 'getLocation:fail ' + JSON.stringify(err)
- });
- });
- }
- }, function () {
- invoke(callbackId, {
- errMsg: 'getLocation:fail'
- });
- }, {
- enableHighAccuracy: altitude,
- timeout: 1000 * 60 * 5
- });
- } else {
- invoke(callbackId, {
- errMsg: 'getLocation:fail device nonsupport geolocation'
- });
- }
-}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("0dd1")))
-
-/***/ }),
-
-/***/ "2bbe":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"120ddde1-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/view/index.vue?vue&type=template&id=164058a7&
-var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.hoverClass && _vm.hoverClass !== 'none')?_c('uni-view',_vm._g({class:[_vm.hovering?_vm.hoverClass:''],on:{"touchstart":_vm._hoverTouchStart,"touchend":_vm._hoverTouchEnd,"touchcancel":_vm._hoverTouchCancel}},_vm.$listeners),[_vm._t("default")],2):_c('uni-view',_vm._g({},_vm.$listeners),[_vm._t("default")],2)}
-var staticRenderFns = []
-
-
-// CONCATENATED MODULE: ./src/core/view/components/view/index.vue?vue&type=template&id=164058a7&
-
-// EXTERNAL MODULE: ./src/core/view/mixins/hover.js
-var hover = __webpack_require__("83a6");
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/view/index.vue?vue&type=script&lang=js&
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-
-/* harmony default export */ var viewvue_type_script_lang_js_ = ({
- name: 'View',
- mixins: [hover["a" /* default */]],
- listeners: {
- 'label-click': 'clickHandler'
- }
-});
-// CONCATENATED MODULE: ./src/core/view/components/view/index.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_viewvue_type_script_lang_js_ = (viewvue_type_script_lang_js_);
-// EXTERNAL MODULE: ./src/core/view/components/view/index.vue?vue&type=style&index=0&lang=css&
-var viewvue_type_style_index_0_lang_css_ = __webpack_require__("e865");
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js
-var componentNormalizer = __webpack_require__("0c7c");
-
-// CONCATENATED MODULE: ./src/core/view/components/view/index.vue
-
-
-
-
-
-
-/* normalize component */
-
-var component = Object(componentNormalizer["a" /* default */])(
- components_viewvue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- null,
- null,
- null
-
-)
-
-/* harmony default export */ var view = __webpack_exports__["default"] = (component.exports);
-
-/***/ }),
-
-/***/ "2bdd":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function(UniServiceJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onAccelerometerChange", function() { return onAccelerometerChange; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "startAccelerometer", function() { return startAccelerometer; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stopAccelerometer", function() { return stopAccelerometer; });
-var callbacks = [];
-var listener;
-/**
- * 监听加速度
- * @param {*} callbackId
- */
-
-function onAccelerometerChange(callbackId) {
- callbacks.push(callbackId);
-
- if (!listener) {
- startAccelerometer();
- }
-}
-/**
- * 开始监听加速度数据
- */
-
-function startAccelerometer() {
- var _UniServiceJSBridge = UniServiceJSBridge,
- invoke = _UniServiceJSBridge.invokeCallbackHandler;
-
- if (window.DeviceMotionEvent) {
- listener = function listener(event) {
- callbacks.forEach(function (callbackId) {
- var acceleration = event.acceleration || event.accelerationIncludingGravity;
- invoke(callbackId, {
- x: acceleration.x || 0,
- y: acceleration.y || 0,
- z: acceleration.z || 0,
- errMsg: 'onAccelerometerChange:ok'
- });
- });
- };
-
- window.addEventListener('devicemotion', listener, false);
- return {};
- } else {
- throw new Error('device nonsupport devicemotion');
- }
-}
-/**
- * 停止监听加速度数据
- */
-
-function stopAccelerometer() {
- if (listener) {
- window.removeEventListener('devicemotion', listener, false);
- listener = null;
- }
-
- return {};
-}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("0dd1")))
-
-/***/ }),
-
-/***/ "2ef3":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(UniViewJSBridge, global, UniServiceJSBridge) {/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("8bbf");
-/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
-/**
- * 1.导出全局对象(UniViewJSBridge,UniServiceJSBridge,uni,getApp,getCurrentPages)
- * 2.引入 Vue 插件(uniVueServicePlugin,uniVueServicePlugin)
- * 3.引入 Vue 组件
- */
-
-global.UniViewJSBridge = {
- subscribeHandler: UniViewJSBridge.subscribeHandler
-};
-global.UniServiceJSBridge = {
- subscribeHandler: UniServiceJSBridge.subscribeHandler
-};
-
-var _require = __webpack_require__("b7b5"),
- uni = _require.default,
- getApp = _require.getApp,
- getCurrentPages = _require.getCurrentPages;
-
-global.uni = uni;
-global.wx = global.uni;
-global.getApp = getApp;
-global.getCurrentPages = getCurrentPages;
-vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(__webpack_require__("4ca9").default, {
- routes: __uniRoutes
-});
-vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(__webpack_require__("8c15").default, {
- routes: __uniRoutes
-});
-
-__webpack_require__("442e");
-
-__webpack_require__("8f7e");
-
-__webpack_require__("1efd");
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("501c"), __webpack_require__("24aa"), __webpack_require__("0dd1")))
-
-/***/ }),
-
-/***/ "2fb0":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "3042":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "redirectTo", function() { return redirectTo; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "navigateTo", function() { return navigateTo; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "navigateBack", function() { return navigateBack; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reLaunch", function() { return reLaunch; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "switchTab", function() { return switchTab; });
-/* harmony import */ var uni_helpers_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("85b6");
-
-
-function onAppRoute(type) {
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- url = _ref.url,
- delta = _ref.delta,
- animationType = _ref.animationType,
- animationDuration = _ref.animationDuration,
- _ref$from = _ref.from,
- from = _ref$from === void 0 ? 'navigateBack' : _ref$from,
- detail = _ref.detail;
-
- var router = getApp().$router;
-
- switch (type) {
- case 'redirectTo':
- router.replace({
- type: type,
- path: url
- });
- break;
-
- case 'navigateTo':
- router.push({
- type: type,
- path: url,
- animationType: animationType,
- animationDuration: animationDuration
- });
- break;
-
- case 'navigateBack':
- var canBack = true;
- var pages = getCurrentPages();
-
- if (pages.length) {
- var page = pages[pages.length - 1];
-
- if (Object(uni_helpers_index__WEBPACK_IMPORTED_MODULE_0__[/* hasLifecycleHook */ "a"])(page.$options, 'onBackPress') && page.__call_hook('onBackPress', {
- from: from
- }) === true) {
- canBack = false;
- }
- }
-
- if (canBack) {
- if (delta > 1) {
- router._$delta = delta;
- }
-
- router.go(-delta, {
- animationType: animationType,
- animationDuration: animationDuration
- });
- }
-
- break;
-
- case 'reLaunch':
- router.replace({
- type: type,
- path: url
- });
- break;
-
- case 'switchTab':
- router.replace({
- type: type,
- path: url,
- params: {
- detail: detail
- }
- });
- break;
- }
-
- return {
- errMsg: type + ':ok'
- };
-}
-
-function redirectTo(args) {
- return onAppRoute('redirectTo', args);
-}
-function navigateTo(args) {
- return onAppRoute('navigateTo', args);
-}
-function navigateBack(args) {
- return onAppRoute('navigateBack', args);
-}
-function reLaunch(args) {
- return onAppRoute('reLaunch', args);
-}
-function switchTab(args) {
- return onAppRoute('switchTab', args);
-}
-
-/***/ }),
-
-/***/ "31e2":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"120ddde1-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/platforms/h5/view/components/video/index.vue?vue&type=template&id=f38201f6&
-var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('uni-video',_vm._g({attrs:{"id":_vm.id,"src":_vm.src,"initial-time":_vm.initialTime,"duration":_vm.duration,"controls":_vm.controls,"danmu-list":_vm.danmuList,"danmu-btn":_vm.danmuBtn,"enable-danmu":_vm.enableDanmu,"autoplay":_vm.autoplay,"loop":_vm.loop,"muted":_vm.muted,"page-gesture":_vm.pageGesture,"direction":_vm.direction,"show-progress":_vm.showProgress,"show-fullscreen-btn":_vm.showFullscreenBtn,"show-play-btn":_vm.showPlayBtn,"show-center-play-btn":_vm.showCenterPlayBtn,"enable-progress-gesture":_vm.enableProgressGesture,"object-fit":_vm.objectFit,"poster":_vm.poster,"x5-video-player-type":_vm.x5VideoPlayerType,"x5-video-player-fullscreen":_vm.x5VideoPlayerFullscren,"x5-video-orientation":_vm.x5VideoOrientation,"x5-playsinline":_vm.x5Playsinline}},_vm.$listeners),[_c('div',{ref:"container",staticClass:"uni-video-container",class:{'uni-video-type-fullscreen':_vm.fullscreen,'uni-video-type-rotate-left':_vm.rotateType==='left','uni-video-type-rotate-right':_vm.rotateType==='right'},style:({width:_vm.fullscreen?_vm.width:'100%',height:_vm.fullscreen?_vm.height:'100%'}),on:{"click":_vm.triggerControls,"touchstart":function($event){return _vm.touchstart($event)},"touchend":function($event){return _vm.touchend($event)},"touchmove":function($event){return _vm.touchmove($event)}}},[_c('video',{ref:"video",staticClass:"uni-video-video",style:({opacity:!_vm.start?0.8:1,objectFit:_vm.objectFit}),attrs:{"loop":_vm.loop,"src":_vm.srcSync,"poster":_vm.poster,"x5-video-player-type":_vm.x5VideoPlayerType,"x5-video-player-fullscreen":_vm.x5VideoPlayerFullscren,"x5-video-orientation":_vm.x5VideoOrientation,"x5-playsinline":_vm.x5Playsinline,"webkit-playsinline":"","playsinline":""},domProps:{"muted":_vm.muted}}),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.controlsShow),expression:"controlsShow"}],staticClass:"uni-video-bar uni-video-bar-full",on:{"click":function($event){$event.stopPropagation();}}},[_c('div',{staticClass:"uni-video-controls"},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.showPlayBtn),expression:"showPlayBtn"}],staticClass:"uni-video-control-button",class:{'uni-video-control-button-play':!_vm.playing,'uni-video-control-button-pause':_vm.playing},on:{"click":function($event){$event.stopPropagation();return _vm.trigger($event)}}}),_c('div',{staticClass:"uni-video-current-time"},[_vm._v(_vm._s(_vm._f("getTime")(_vm.currentTime)))]),_c('div',{ref:"progress",staticClass:"uni-video-progress-container",on:{"click":function($event){$event.stopPropagation();return _vm.clickProgress($event)}}},[_c('div',{staticClass:"uni-video-progress"},[_c('div',{staticClass:"uni-video-progress-buffered",style:({width:_vm.buffered*100+'%'})}),_c('div',{ref:"ball",staticClass:"uni-video-ball",style:({left:_vm.progress+'%'})},[_c('div',{staticClass:"uni-video-inner"})])])]),_c('div',{staticClass:"uni-video-duration"},[_vm._v(_vm._s(_vm._f("getTime")((_vm.duration||_vm.durationTime))))])]),(_vm.danmuBtn)?_c('div',{staticClass:"uni-video-danmu-button",class:{'uni-video-danmu-button-active':_vm.enableDanmuSync},on:{"click":function($event){$event.stopPropagation();return _vm.triggerDanmu($event)}}},[_vm._v("弹幕")]):_vm._e(),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.showFullscreenBtn),expression:"showFullscreenBtn"}],staticClass:"uni-video-fullscreen",class:{'uni-video-type-fullscreen':_vm.fullscreen},on:{"click":function($event){$event.stopPropagation();return _vm.triggerFullscreen($event)}}})]),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.start&&_vm.enableDanmuSync),expression:"start&&enableDanmuSync"}],ref:"danmu",staticClass:"uni-video-danmu",staticStyle:{"z-index":"0"}}),(!_vm.start)?_c('div',{staticClass:"uni-video-cover",on:{"click":function($event){$event.stopPropagation();}}},[_c('div',{staticClass:"uni-video-cover-play-button",on:{"click":function($event){$event.stopPropagation();return _vm.play($event)}}}),_c('p',{staticClass:"uni-video-cover-duration"},[_vm._v(_vm._s(_vm._f("getTime")((_vm.duration||_vm.durationTime))))])]):_vm._e(),_c('div',{staticClass:"uni-video-toast",class:{'uni-video-toast-volume':_vm.gestureType==='volume'}},[_c('div',{staticClass:"uni-video-toast-title"},[_vm._v("音量")]),_c('svg',{staticClass:"uni-video-toast-icon",attrs:{"width":"200px","height":"200px","viewBox":"0 0 1024 1024","version":"1.1","xmlns":"http://www.w3.org/2000/svg"}},[_c('path',{attrs:{"d":"M475.400704 201.19552l0 621.674496q0 14.856192-10.856448 25.71264t-25.71264 10.856448-25.71264-10.856448l-190.273536-190.273536-149.704704 0q-14.856192 0-25.71264-10.856448t-10.856448-25.71264l0-219.414528q0-14.856192 10.856448-25.71264t25.71264-10.856448l149.704704 0 190.273536-190.273536q10.856448-10.856448 25.71264-10.856448t25.71264 10.856448 10.856448 25.71264zm219.414528 310.837248q0 43.425792-24.28416 80.851968t-64.2816 53.425152q-5.71392 2.85696-14.2848 2.85696-14.856192 0-25.71264-10.570752t-10.856448-25.998336q0-11.999232 6.856704-20.284416t16.570368-14.2848 19.427328-13.142016 16.570368-20.284416 6.856704-32.569344-6.856704-32.569344-16.570368-20.284416-19.427328-13.142016-16.570368-14.2848-6.856704-20.284416q0-15.427584 10.856448-25.998336t25.71264-10.570752q8.57088 0 14.2848 2.85696 39.99744 15.427584 64.2816 53.139456t24.28416 81.137664zm146.276352 0q0 87.422976-48.56832 161.41824t-128.5632 107.707392q-7.428096 2.85696-14.2848 2.85696-15.427584 0-26.284032-10.856448t-10.856448-25.71264q0-22.284288 22.284288-33.712128 31.997952-16.570368 43.425792-25.141248 42.283008-30.855168 65.995776-77.423616t23.712768-99.136512-23.712768-99.136512-65.995776-77.423616q-11.42784-8.57088-43.425792-25.141248-22.284288-11.42784-22.284288-33.712128 0-14.856192 10.856448-25.71264t25.71264-10.856448q7.428096 0 14.856192 2.85696 79.99488 33.712128 128.5632 107.707392t48.56832 161.41824zm146.276352 0q0 131.42016-72.566784 241.41312t-193.130496 161.989632q-7.428096 2.85696-14.856192 2.85696-14.856192 0-25.71264-10.856448t-10.856448-25.71264q0-20.570112 22.284288-33.712128 3.999744-2.285568 12.85632-5.999616t12.85632-5.999616q26.284032-14.2848 46.854144-29.140992 70.281216-51.996672 109.707264-129.705984t39.426048-165.132288-39.426048-165.132288-109.707264-129.705984q-20.570112-14.856192-46.854144-29.140992-3.999744-2.285568-12.85632-5.999616t-12.85632-5.999616q-22.284288-13.142016-22.284288-33.712128 0-14.856192 10.856448-25.71264t25.71264-10.856448q7.428096 0 14.856192 2.85696 120.563712 51.996672 193.130496 161.989632t72.566784 241.41312z"}})]),_c('div',{staticClass:"uni-video-toast-value"},[_c('div',{staticClass:"uni-video-toast-value-content",style:({width:_vm.volumeNew*100+'%'})},[_c('div',{staticClass:"uni-video-toast-volume-grids"},_vm._l((10),function(item,index){return _c('div',{key:index,staticClass:"uni-video-toast-volume-grids-item"})}),0)])])]),_c('div',{staticClass:"uni-video-toast",class:{'uni-video-toast-progress':_vm.gestureType=='progress'}},[_c('div',{staticClass:"uni-video-toast-title"},[_vm._v(_vm._s(_vm._f("getTime")(_vm.currentTimeNew))+" / "+_vm._s(_vm._f("getTime")(_vm.durationTime)))])])]),_c('div',{staticStyle:{"position":"absolute","top":"0","width":"100%","height":"100%","overflow":"hidden","pointer-events":"none"}},[_vm._t("default")],2)])}
-var staticRenderFns = []
-
-
-// CONCATENATED MODULE: ./src/platforms/h5/view/components/video/index.vue?vue&type=template&id=f38201f6&
-
-// EXTERNAL MODULE: ./src/core/view/mixins/index.js + 1 modules
-var mixins = __webpack_require__("8af1");
-
-// EXTERNAL MODULE: ./src/shared/index.js + 3 modules
-var shared = __webpack_require__("f2b3");
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/platforms/h5/view/components/video/index.vue?vue&type=script&lang=js&
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-
-
-var passiveOptions = shared["h" /* supportsPassive */] ? {
- passive: false
-} : false;
-var GestureType = {
- NONE: 'none',
- STOP: 'stop',
- VOLUME: 'volume',
- PROGRESS: 'progress'
-};
-/* harmony default export */ var videovue_type_script_lang_js_ = ({
- name: 'Video',
- filters: {
- getTime: function getTime(time) {
- var h = Math.floor(time / 3600);
- var m = Math.floor(time % 3600 / 60);
- var s = Math.floor(time % 3600 % 60);
- h = (h < 10 ? '0' : '') + h;
- m = (m < 10 ? '0' : '') + m;
- s = (s < 10 ? '0' : '') + s;
- var str = m + ':' + s;
-
- if (h !== '00') {
- str = h + ':' + str;
- }
-
- return str;
- }
- },
- mixins: [mixins["d" /* subscriber */]],
- props: {
- id: {
- type: String,
- default: ''
- },
- src: {
- type: String,
- default: ''
- },
- duration: {
- type: [Number, String],
- default: ''
- },
- controls: {
- type: [Boolean, String],
- default: true
- },
- danmuList: {
- type: Array,
- default: function _default() {
- return [];
- }
- },
- danmuBtn: {
- type: [Boolean, String],
- default: false
- },
- enableDanmu: {
- type: [Boolean, String],
- default: false
- },
- autoplay: {
- type: [Boolean, String],
- default: false
- },
- loop: {
- type: [Boolean, String],
- default: false
- },
- muted: {
- type: [Boolean, String],
- default: false
- },
- objectFit: {
- type: String,
- default: 'contain'
- },
- poster: {
- type: String,
- default: ''
- },
- direction: {
- type: [String, Number],
- default: 360
- },
- showProgress: {
- type: Boolean,
- default: true
- },
- initialTime: {
- type: [String, Number],
- default: 0
- },
- showFullscreenBtn: {
- type: [Boolean, String],
- default: true
- },
- pageGesture: {
- type: [Boolean, String],
- default: false
- },
- enableProgressGesture: {
- type: [Boolean, String],
- default: true
- },
- showPlayBtn: {
- type: [Boolean, String],
- default: true
- },
- x5VideoPlayerType: {
- type: [Boolean, String],
- default: false
- },
- x5VideoPlayerFullscren: {
- type: [Boolean, String],
- default: false
- },
- x5VideoOrientation: {
- type: [Boolean, String],
- default: false
- },
- x5Playsinline: {
- type: [Boolean, String],
- default: false
- }
- },
- data: function data() {
- return {
- start: false,
- playing: false,
- currentTime: 0,
- durationTime: 0,
- progress: 0,
- touching: false,
- enableDanmuSync: Boolean(this.enableDanmu),
- controlsVisible: true,
- fullscreen: false,
- width: '0',
- height: '0',
- fullscreenTriggering: false,
- controlsTouching: false,
- directionSync: Number(this.direction),
- touchStartOrigin: {
- x: 0,
- y: 0
- },
- gestureType: GestureType.NONE,
- currentTimeOld: 0,
- currentTimeNew: 0,
- volumeOld: null,
- volumeNew: null,
- isIOS: false,
- buffered: 0,
- rotateType: ''
- };
- },
- computed: {
- controlsShow: function controlsShow() {
- return this.start && this.controls && this.controlsVisible;
- },
- autoHideContorls: function autoHideContorls() {
- return this.controlsShow && this.playing && !this.controlsTouching;
- },
- srcSync: function srcSync() {
- return this.$getRealPath(this.src);
- }
- },
- watch: {
- enableDanmuSync: function enableDanmuSync(val) {
- this.$emit('update:enableDanmu', val);
- },
- autoHideContorls: function autoHideContorls(val) {
- if (val) {
- this.autoHideStart();
- } else {
- this.autoHideEnd();
- }
- },
- fullscreen: function fullscreen(val) {
- var _this = this;
-
- var container = this.$refs.container;
- var playing = this.playing;
- this.fullscreenTriggering = true;
- container.remove();
-
- if (val) {
- this.resize();
- document.body.appendChild(container);
- } else {
- this.$el.appendChild(container);
- }
-
- this.$trigger('fullscreenchange', {}, {
- fullScreen: val
- });
-
- if (playing) {
- this.play();
- }
-
- setTimeout(function () {
- _this.fullscreenTriggering = false;
- }, 0);
- },
- direction: function direction(val) {
- this.directionSync = Number(val);
- },
- srcSync: function srcSync(val) {
- var _this2 = this;
-
- this.playing = false;
- this.currentTime = 0;
-
- if (val && this.autoplay) {
- this.$nextTick(function () {
- _this2.$refs.video.play();
- });
- }
- },
- currentTime: function currentTime() {
- this.updateProgress();
- },
- duration: function duration() {
- this.updateProgress();
- }
- },
- created: function created() {
- this.otherData = {
- danmuList: [],
- danmuIndex: {
- time: 0,
- index: -1
- },
- hideTiming: null
- };
- var danmuList = this.otherData.danmuList = JSON.parse(JSON.stringify(this.danmuList || []));
- danmuList.sort(function (a, b) {
- return (a.time || 0) - (a.time || 0);
- });
- this.width = window.innerWidth + 'px';
- this.height = window.innerHeight + 'px';
- },
- mounted: function mounted() {
- var self = this;
- var otherData = this.otherData;
- var video = this.$refs.video;
- var ball = this.$refs.ball;
- video.addEventListener('durationchange', function (event) {
- self.durationTime = video.duration;
- });
- video.addEventListener('loadedmetadata', function (event) {
- var initialTime = Number(self.initialTime) || 0;
-
- if (initialTime > 0) {
- video.currentTime = initialTime;
- }
- });
- video.addEventListener('progress', function (event) {
- var buffered = video.buffered;
-
- if (buffered.length) {
- self.buffered = buffered.end(buffered.length - 1) / video.duration;
- }
- });
- video.addEventListener('waiting', function ($event) {
- self.$trigger('waiting', $event, {});
- });
- video.addEventListener('error', function ($event) {
- self.playing = false;
- self.$trigger('error', $event, {});
- });
- video.addEventListener('play', function ($event) {
- self.start = true;
- self.playing = true;
-
- if (self.fullscreenTriggering) {
- return;
- }
-
- self.$trigger('play', $event, {});
- });
- video.addEventListener('pause', function ($event) {
- self.playing = false;
-
- if (self.fullscreenTriggering) {
- return;
- }
-
- self.$trigger('pause', $event, {});
- });
- video.addEventListener('ended', function ($event) {
- self.playing = false;
- self.$trigger('ended', $event, {});
- });
- video.addEventListener('timeupdate', function ($event) {
- var currentTime = self.currentTime = video.currentTime;
- var duration = video.duration;
- var oldDanmuIndex = otherData.danmuIndex;
- var danmuIndex = {
- time: currentTime,
- index: oldDanmuIndex.index
- };
- var danmuList = otherData.danmuList;
-
- if (currentTime > oldDanmuIndex.time) {
- for (var index = oldDanmuIndex.index + 1; index < danmuList.length; index++) {
- var element = danmuList[index];
-
- if (currentTime >= (element.time || 0)) {
- danmuIndex.index = index;
-
- if (self.playing && self.enableDanmuSync) {
- self.playDanmu(element);
- }
- } else {
- break;
- }
- }
- } else if (currentTime < oldDanmuIndex.time) {
- for (var _index = oldDanmuIndex.index - 1; _index > -1; _index--) {
- var _element = danmuList[_index];
-
- if (currentTime <= (_element.time || 0)) {
- danmuIndex.index = _index - 1;
- } else {
- break;
- }
- }
- }
-
- otherData.danmuIndex = danmuIndex;
- self.$trigger('timeupdate', $event, {
- currentTime: currentTime,
- duration: duration
- });
- });
- video.addEventListener('x5videoenterfullscreen', function ($event) {
- self.$trigger('fullscreenchange', $event, {
- fullScreen: true
- });
- });
- video.addEventListener('x5videoexitfullscreen', function ($event) {
- self.$trigger('fullscreenchange', $event, {
- fullScreen: false
- });
- });
- var originX;
- var originY;
- var moveOnce = true;
- var originProgress;
- ball.addEventListener('touchstart', function (event) {
- self.controlsTouching = true;
- var toucher = self.getScreenXY(event.targetTouches[0]);
- originX = toucher.pageX;
- originY = toucher.pageY;
- originProgress = self.progress;
- moveOnce = true;
- self.touching = true;
- ball.addEventListener('touchmove', touchmove, passiveOptions);
- });
-
- function touchmove(event) {
- var toucher = self.getScreenXY(event.targetTouches[0]);
- var pageX = toucher.pageX;
- var pageY = toucher.pageY;
-
- if (moveOnce && Math.abs(pageX - originX) < Math.abs(pageY - originY)) {
- touchend();
- return;
- }
-
- moveOnce = false;
- var w = self.$refs.progress.offsetWidth;
- var progress = originProgress + (pageX - originX) / w * 100;
-
- if (progress < 0) {
- progress = 0;
- } else if (progress > 100) {
- progress = 100;
- }
-
- self.progress = progress;
- event.preventDefault();
- event.stopPropagation();
- }
-
- function touchend(event) {
- self.controlsTouching = false;
-
- if (self.touching) {
- ball.removeEventListener('touchmove', touchmove, passiveOptions);
-
- if (!moveOnce) {
- event.preventDefault();
- event.stopPropagation();
- self.seek(self.$refs.video.duration * self.progress / 100);
- }
-
- self.touching = false;
- }
- }
-
- ball.addEventListener('touchend', touchend);
- ball.addEventListener('touchcancel', touchend);
-
- if (String(this.srcSync).length && this.autoplay) {
- video.play();
- }
- },
- beforeDestroy: function beforeDestroy() {
- this.$refs.container.remove();
- clearTimeout(this.otherData.hideTiming);
- },
- methods: {
- _handleSubscribe: function _handleSubscribe(_ref) {
- var type = _ref.type,
- _ref$data = _ref.data,
- data = _ref$data === void 0 ? {} : _ref$data;
-
- switch (type) {
- case 'play':
- this.play();
- break;
-
- case 'pause':
- this.pause();
- break;
-
- case 'seek':
- this.seek(data.position);
- break;
-
- case 'sendDanmu':
- this.sendDanmu(data);
- break;
-
- case 'playbackRate':
- this.$refs.video.playbackRate = data.rate;
- break;
-
- case 'requestFullScreen':
- this.enterFullscreen();
- break;
-
- case 'exitFullScreen':
- this.leaveFullscreen();
- break;
- }
- },
- resize: function resize() {
- var w = window.innerWidth;
- var h = window.innerHeight;
- var direction = Math.abs(this.directionSync);
-
- if (direction === 0) {
- if (w > h) {
- this.rotateType = 'left';
- } else {
- this.rotateType = '';
- }
- } else if (direction === 90) {
- if (w > h) {
- this.rotateType = '';
- } else {
- this.rotateType = 'right';
- }
- } else {
- this.rotateType = '';
- }
-
- if (!this.rotateType) {
- this.width = w + 'px';
- this.height = h + 'px';
- } else {
- this.width = h + 'px';
- this.height = w + 'px';
- }
- },
- trigger: function trigger() {
- if (this.playing) {
- this.$refs.video.pause();
- } else {
- this.$refs.video.play();
- }
- },
- play: function play() {
- this.start = true;
- this.$refs.video.play();
- },
- pause: function pause() {
- this.$refs.video.pause();
- },
- seek: function seek(position) {
- position = Number(position);
-
- if (typeof position === 'number' && !isNaN(position)) {
- this.$refs.video.currentTime = position;
- }
- },
- clickProgress: function clickProgress(event) {
- var x = event.offsetX;
- var _progress = this.$refs.progress;
- var element = event.target;
-
- while (element !== _progress) {
- x += element.offsetLeft;
- element = element.parentNode;
- }
-
- var w = _progress.offsetWidth;
- var progress = 0;
-
- if (x >= 0 && x <= w) {
- progress = x / w;
- this.seek(this.$refs.video.duration * progress);
- }
- },
- triggerDanmu: function triggerDanmu() {
- this.enableDanmuSync = !this.enableDanmuSync;
- },
- playDanmu: function playDanmu(danmu) {
- var p = document.createElement('p');
- p.className = 'uni-video-danmu-item';
- p.innerText = danmu.text;
- var style = "bottom: ".concat(Math.random() * 100, "%;color: ").concat(danmu.color, ";");
- p.setAttribute('style', style);
- this.$refs.danmu.appendChild(p);
- setTimeout(function () {
- style += 'left: 0;-webkit-transform: translateX(-100%);transform: translateX(-100%);';
- p.setAttribute('style', style);
- setTimeout(function () {
- p.remove();
- }, 4000);
- }, 17);
- },
- sendDanmu: function sendDanmu(danmu) {
- var otherData = this.otherData;
- otherData.danmuList.splice(otherData.danmuIndex.index + 1, 0, {
- text: String(danmu.text),
- color: danmu.color,
- time: this.$refs.video.currentTime || 0
- });
- },
- triggerFullscreen: function triggerFullscreen() {
- this.fullscreen = !this.fullscreen;
- },
- enterFullscreen: function enterFullscreen(direction) {
- var directionSync = Number(direction);
-
- if (!isNaN(NaN)) {
- this.directionSync = directionSync;
- }
-
- this.fullscreen = true;
- },
- leaveFullscreen: function leaveFullscreen() {
- this.fullscreen = false;
- },
- triggerControls: function triggerControls() {
- this.controlsVisible = !this.controlsVisible;
- },
- touchstart: function touchstart(event) {
- var toucher = this.getScreenXY(event.targetTouches[0]);
- this.touchStartOrigin = {
- x: toucher.pageX,
- y: toucher.pageY
- };
- this.gestureType = GestureType.NONE;
- this.volumeOld = null;
- this.currentTimeOld = this.currentTimeNew = 0;
- },
- touchmove: function touchmove(event) {
- function stop() {
- event.stopPropagation();
- event.preventDefault();
- }
-
- if (this.fullscreen) {
- stop();
- }
-
- var gestureType = this.gestureType;
-
- if (gestureType === GestureType.STOP) {
- return;
- }
-
- var toucher = this.getScreenXY(event.targetTouches[0]);
- var pageX = toucher.pageX;
- var pageY = toucher.pageY;
- var origin = this.touchStartOrigin;
-
- if (gestureType === GestureType.PROGRESS) {
- this.changeProgress(pageX - origin.x);
- } else if (gestureType === GestureType.VOLUME) {
- this.changeVolume(pageY - origin.y);
- }
-
- if (gestureType !== GestureType.NONE) {
- return;
- }
-
- if (Math.abs(pageX - origin.x) > Math.abs(pageY - origin.y)) {
- if (!this.enableProgressGesture) {
- this.gestureType = GestureType.STOP;
- return;
- }
-
- this.gestureType = GestureType.PROGRESS;
- this.currentTimeOld = this.currentTimeNew = this.$refs.video.currentTime;
-
- if (!this.fullscreen) {
- stop();
- }
- } else {
- if (!this.pageGesture) {
- this.gestureType = GestureType.STOP;
- return;
- }
-
- this.gestureType = GestureType.VOLUME;
- this.volumeOld = this.$refs.video.volume;
-
- if (!this.fullscreen) {
- stop();
- }
- }
- },
- touchend: function touchend(event) {
- if (this.gestureType !== GestureType.NONE && this.gestureType !== GestureType.STOP) {
- event.stopPropagation();
- event.preventDefault();
- }
-
- if (this.gestureType === GestureType.PROGRESS && this.currentTimeOld !== this.currentTimeNew) {
- this.$refs.video.currentTime = this.currentTimeNew;
- }
-
- this.gestureType = GestureType.NONE;
- },
- changeProgress: function changeProgress(x) {
- var duration = this.$refs.video.duration;
- var currentTimeNew = x / 600 * duration + this.currentTimeOld;
-
- if (currentTimeNew < 0) {
- currentTimeNew = 0;
- } else if (currentTimeNew > duration) {
- currentTimeNew = duration;
- }
-
- this.currentTimeNew = currentTimeNew;
- },
- changeVolume: function changeVolume(y) {
- var valueOld = this.volumeOld;
- var value;
-
- if (typeof valueOld === 'number') {
- value = valueOld - y / 200;
-
- if (value < 0) {
- value = 0;
- } else if (value > 1) {
- value = 1;
- }
-
- this.$refs.video.volume = value;
- this.volumeNew = value;
- }
- },
- autoHideStart: function autoHideStart() {
- var _this3 = this;
-
- this.otherData.hideTiming = setTimeout(function () {
- _this3.controlsVisible = false;
- }, 3000);
- },
- autoHideEnd: function autoHideEnd() {
- var otherData = this.otherData;
-
- if (otherData.hideTiming) {
- clearTimeout(otherData.hideTiming);
- otherData.hideTiming = null;
- }
- },
- getScreenXY: function getScreenXY(dataOrigin) {
- var rotateType = this.rotateType;
-
- if (!this.fullscreen || !rotateType) {
- return dataOrigin;
- }
-
- var w = screen.width;
- var h = screen.height;
- var x = dataOrigin.pageX;
- var y = dataOrigin.pageY;
- var pageX;
- var pageY;
-
- if (rotateType === 'left') {
- pageX = h - y;
- pageY = x;
- } else {
- pageX = y;
- pageY = w - x;
- }
-
- return {
- pageX: pageX,
- pageY: pageY
- };
- },
- updateProgress: function updateProgress() {
- if (!this.touching) {
- this.progress = this.currentTime / this.durationTime * 100;
- }
- }
- }
-});
-// CONCATENATED MODULE: ./src/platforms/h5/view/components/video/index.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_videovue_type_script_lang_js_ = (videovue_type_script_lang_js_);
-// EXTERNAL MODULE: ./src/platforms/h5/view/components/video/index.vue?vue&type=style&index=0&lang=css&
-var videovue_type_style_index_0_lang_css_ = __webpack_require__("856e");
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js
-var componentNormalizer = __webpack_require__("0c7c");
-
-// CONCATENATED MODULE: ./src/platforms/h5/view/components/video/index.vue
-
-
-
-
-
-
-/* normalize component */
-
-var component = Object(componentNormalizer["a" /* default */])(
- components_videovue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- null,
- null,
- null
-
-)
-
-/* harmony default export */ var video = __webpack_exports__["default"] = (component.exports);
-
-/***/ }),
-
-/***/ "33ab":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "33ed":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return disableScroll; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return pageScrollTo; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createScrollListener; });
-/* harmony import */ var uni_platform_view_bridge__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("4a59");
-
-function disableScroll(evt) {
- evt.preventDefault();
-}
-function pageScrollTo(_ref) {
- var scrollTop = _ref.scrollTop,
- duration = _ref.duration;
- var documentElement = document.documentElement;
- var clientHeight = documentElement.clientHeight,
- scrollHeight = documentElement.scrollHeight;
- scrollTop = Math.min(scrollTop, scrollHeight - clientHeight);
-
- if (duration === 0) {
- // 部分浏览器(比如微信)中 scrollTop 的值需要通过 document.body 来控制
- documentElement.scrollTop = document.body.scrollTop = scrollTop;
- return;
- }
-
- if (window.scrollY === scrollTop) {
- return;
- }
-
- function scrollTo(duration) {
- if (duration <= 0) {
- window.scrollTo(0, scrollTop);
- return;
- }
-
- var distaince = scrollTop - window.scrollY;
- requestAnimationFrame(function () {
- window.scrollTo(0, window.scrollY + distaince / duration * 10);
- scrollTo(duration - 10);
- });
- }
-
- scrollTo(duration); // TODO 暂不使用 transform 会导致 fixed 元素不可见
- // const body = document.body
- // const bodyStyle = body.style
- //
- // function webkitTransitionEnd() {
- // bodyStyle.webkitTransition = ''
- // bodyStyle.webkitTransform = ''
- // documentElement.scrollTop = scrollTop
- // body.removeEventListener('webkitTransitionEnd', webkitTransitionEnd)
- // }
- //
- // body.addEventListener('webkitTransitionEnd', webkitTransitionEnd)
- // bodyStyle.webkitTransition = `-webkit-transform ${duration}ms ease-out`
- // bodyStyle.webkitTransform = `translateY(${documentElement.scrollTop}px) translateZ(0)`
-}
-function createScrollListener(pageId, _ref2) {
- var enablePageScroll = _ref2.enablePageScroll,
- enablePageReachBottom = _ref2.enablePageReachBottom,
- onReachBottomDistance = _ref2.onReachBottomDistance,
- enableTransparentTitleNView = _ref2.enableTransparentTitleNView;
- var ticking = false;
- var hasReachBottom = false;
- var onReachBottom = true;
-
- function isReachBottom() {
- var _document$documentEle = document.documentElement,
- clientHeight = _document$documentEle.clientHeight,
- scrollHeight = _document$documentEle.scrollHeight;
- var scrollY = window.scrollY;
- var isBottom = scrollY > 0 && scrollHeight > clientHeight && scrollY + clientHeight + onReachBottomDistance >= scrollHeight;
-
- if (isBottom && !hasReachBottom) {
- hasReachBottom = true;
- return true;
- }
-
- if (!isBottom && hasReachBottom) {
- hasReachBottom = false;
- }
-
- return false;
- }
-
- function trigger() {
- // publish
- var scrollTop = window.pageYOffset;
-
- if (enablePageScroll) {
- // 向 Service 发送 onPageScroll 事件
- Object(uni_platform_view_bridge__WEBPACK_IMPORTED_MODULE_0__[/* publishHandler */ "a"])('onPageScroll', {
- scrollTop: scrollTop
- }, pageId);
- }
-
- if (enableTransparentTitleNView) {
- UniViewJSBridge.emit('onPageScroll', {
- scrollTop: scrollTop
- });
- }
-
- if (enablePageReachBottom && onReachBottom && isReachBottom()) {
- Object(uni_platform_view_bridge__WEBPACK_IMPORTED_MODULE_0__[/* publishHandler */ "a"])('onReachBottom', {}, pageId);
- onReachBottom = false;
- setTimeout(function () {
- onReachBottom = true;
- }, 350);
- }
-
- ticking = false;
- }
-
- return function onScroll() {
- if (!ticking) {
- requestAnimationFrame(trigger);
- }
-
- ticking = true;
- };
-}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("501c")))
-
-/***/ }),
-
-/***/ "347e":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(console) {/* harmony import */ var uni_mixins_scroller_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("8aec");
-/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("f2b3");
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-
-
-var passiveOptions = uni_shared__WEBPACK_IMPORTED_MODULE_1__[/* supportsPassive */ "h"] ? {
- passive: true
-} : false;
-/* harmony default export */ __webpack_exports__["a"] = ({
- name: 'ScrollView',
- mixins: [uni_mixins_scroller_index__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]],
- props: {
- scrollX: {
- type: [Boolean, String],
- default: false
- },
- scrollY: {
- type: [Boolean, String],
- default: false
- },
- upperThreshold: {
- type: [Number, String],
- default: 50
- },
- lowerThreshold: {
- type: [Number, String],
- default: 50
- },
- scrollTop: {
- type: [Number, String],
- default: 0
- },
- scrollLeft: {
- type: [Number, String],
- default: 0
- },
- scrollIntoView: {
- type: String,
- default: ''
- },
- scrollWithAnimation: {
- type: [Boolean, String],
- default: false
- },
- enableBackToTop: {
- type: [Boolean, String],
- default: false
- }
- },
- data: function data() {
- return {
- lastScrollTop: this.scrollTopNumber,
- lastScrollLeft: this.scrollLeftNumber,
- lastScrollToUpperTime: 0,
- lastScrollToLowerTime: 0
- };
- },
- computed: {
- upperThresholdNumber: function upperThresholdNumber() {
- var val = Number(this.upperThreshold);
- return isNaN(val) ? 50 : val;
- },
- lowerThresholdNumber: function lowerThresholdNumber() {
- var val = Number(this.lowerThreshold);
- return isNaN(val) ? 50 : val;
- },
- scrollTopNumber: function scrollTopNumber() {
- return Number(this.scrollTop) || 0;
- },
- scrollLeftNumber: function scrollLeftNumber() {
- return Number(this.scrollLeft) || 0;
- }
- },
- watch: {
- scrollTopNumber: function scrollTopNumber(val) {
- this._scrollTopChanged(val);
- },
- scrollLeftNumber: function scrollLeftNumber(val) {
- this._scrollLeftChanged(val);
- },
- scrollIntoView: function scrollIntoView(val) {
- this._scrollIntoViewChanged(val);
- }
- },
- mounted: function mounted() {
- var self = this;
- this._attached = true;
-
- this._scrollTopChanged(this.scrollTopNumber);
-
- this._scrollLeftChanged(this.scrollLeftNumber);
-
- this._scrollIntoViewChanged(this.scrollIntoView);
-
- this.__handleScroll = function (e) {
- event.preventDefault();
- event.stopPropagation();
-
- self._handleScroll.bind(self, event)();
- };
-
- var touchStart = null;
- var needStop = null;
-
- this.__handleTouchMove = function (event) {
- var x = event.touches[0].pageX;
- var y = event.touches[0].pageY;
- var main = self.$refs.main;
-
- if (needStop === null) {
- if (Math.abs(x - touchStart.x) > Math.abs(y - touchStart.y)) {
- // 横向滑动
- if (self.scrollX) {
- if (main.scrollLeft === 0 && x > touchStart.x) {
- needStop = false;
- return;
- } else if (main.scrollWidth === main.offsetWidth + main.scrollLeft && x < touchStart.x) {
- needStop = false;
- return;
- }
-
- needStop = true;
- } else {
- needStop = false;
- }
- } else {
- // 纵向滑动
- if (self.scrollY) {
- if (main.scrollTop === 0 && y > touchStart.y) {
- needStop = false;
- return;
- } else if (main.scrollHeight === main.offsetHeight + main.scrollTop && y < touchStart.y) {
- needStop = false;
- return;
- }
-
- needStop = true;
- } else {
- needStop = false;
- }
- }
- }
-
- if (needStop) {
- event.stopPropagation();
- }
- };
-
- this.__handleTouchStart = function (event) {
- if (event.touches.length === 1) {
- needStop = null;
- touchStart = {
- x: event.touches[0].pageX,
- y: event.touches[0].pageY
- };
- }
- };
-
- this.$refs.main.addEventListener('touchstart', this.__handleTouchStart, passiveOptions);
- this.$refs.main.addEventListener('touchmove', this.__handleTouchMove, passiveOptions);
- this.$refs.main.addEventListener('scroll', this.__handleScroll, uni_shared__WEBPACK_IMPORTED_MODULE_1__[/* supportsPassive */ "h"] ? {
- passive: false
- } : false);
- },
- activated: function activated() {
- // 还原 scroll-view 滚动位置
- this.scrollY && (this.$refs.main.scrollTop = this.lastScrollTop);
- this.scrollX && (this.$refs.main.scrollLeft = this.lastScrollLeft);
- },
- beforeDestroy: function beforeDestroy() {
- this.$refs.main.removeEventListener('touchstart', this.__handleTouchStart, passiveOptions);
- this.$refs.main.removeEventListener('touchmove', this.__handleTouchMove, passiveOptions);
- this.$refs.main.removeEventListener('scroll', this.__handleScroll, uni_shared__WEBPACK_IMPORTED_MODULE_1__[/* supportsPassive */ "h"] ? {
- passive: false
- } : false);
- },
- methods: {
- scrollTo: function scrollTo(t, n) {
- var i = this.$refs.main;
- t < 0 ? t = 0 : n === 'x' && t > i.scrollWidth - i.offsetWidth ? t = i.scrollWidth - i.offsetWidth : n === 'y' && t > i.scrollHeight - i.offsetHeight && (t = i.scrollHeight - i.offsetHeight);
- var r = 0;
- var o = '';
- n === 'x' ? r = i.scrollLeft - t : n === 'y' && (r = i.scrollTop - t);
-
- if (r !== 0) {
- this.$refs.content.style.transition = 'transform .3s ease-out';
- this.$refs.content.style.webkitTransition = '-webkit-transform .3s ease-out';
-
- if (n === 'x') {
- o = 'translateX(' + r + 'px) translateZ(0)';
- } else {
- n === 'y' && (o = 'translateY(' + r + 'px) translateZ(0)');
- }
-
- this.$refs.content.removeEventListener('transitionend', this.__transitionEnd);
- this.$refs.content.removeEventListener('webkitTransitionEnd', this.__transitionEnd);
- this.__transitionEnd = this._transitionEnd.bind(this, t, n);
- this.$refs.content.addEventListener('transitionend', this.__transitionEnd);
- this.$refs.content.addEventListener('webkitTransitionEnd', this.__transitionEnd);
-
- if (n === 'x') {
- // if (e !== 'ios') {
- i.style.overflowX = 'hidden'; // }
- } else if (n === 'y') {
- i.style.overflowY = 'hidden';
- }
-
- this.$refs.content.style.transform = o;
- this.$refs.content.style.webkitTransform = o;
- }
- },
- _handleTrack: function _handleTrack($event) {
- if ($event.detail.state === 'start') {
- this._x = $event.detail.x;
- this._y = $event.detail.y;
- this._noBubble = null;
- return;
- }
-
- if ($event.detail.state === 'end') {
- this._noBubble = false;
- }
-
- if (this._noBubble === null && this.scrollY) {
- if (Math.abs(this._y - $event.detail.y) / Math.abs(this._x - $event.detail.x) > 1) {
- this._noBubble = true;
- } else {
- this._noBubble = false;
- }
- }
-
- if (this._noBubble === null && this.scrollX) {
- if (Math.abs(this._x - $event.detail.x) / Math.abs(this._y - $event.detail.y) > 1) {
- this._noBubble = true;
- } else {
- this._noBubble = false;
- }
- }
-
- this._x = $event.detail.x;
- this._y = $event.detail.y;
-
- if (this._noBubble) {
- $event.stopPropagation();
- }
- },
- _handleScroll: function _handleScroll($event) {
- if (!($event.timeStamp - this._lastScrollTime < 20)) {
- this._lastScrollTime = $event.timeStamp;
- var target = $event.target;
- this.$trigger('scroll', $event, {
- scrollLeft: target.scrollLeft,
- scrollTop: target.scrollTop,
- scrollHeight: target.scrollHeight,
- scrollWidth: target.scrollWidth,
- deltaX: this.lastScrollLeft - target.scrollLeft,
- deltaY: this.lastScrollTop - target.scrollTop
- });
-
- if (this.scrollY) {
- if (target.scrollTop <= this.upperThresholdNumber && this.lastScrollTop - target.scrollTop > 0 && $event.timeStamp - this.lastScrollToUpperTime > 200) {
- this.$trigger('scrolltoupper', $event, {
- direction: 'top'
- });
- this.lastScrollToUpperTime = $event.timeStamp;
- }
-
- if (target.scrollTop + target.offsetHeight + this.lowerThresholdNumber >= target.scrollHeight && this.lastScrollTop - target.scrollTop < 0 && $event.timeStamp - this.lastScrollToLowerTime > 200) {
- this.$trigger('scrolltolower', $event, {
- direction: 'bottom'
- });
- this.lastScrollToLowerTime = $event.timeStamp;
- }
- }
-
- if (this.scrollX) {
- if (target.scrollLeft <= this.upperThresholdNumber && this.lastScrollLeft - target.scrollLeft > 0 && $event.timeStamp - this.lastScrollToUpperTime > 200) {
- this.$trigger('scrolltoupper', $event, {
- direction: 'left'
- });
- this.lastScrollToUpperTime = $event.timeStamp;
- }
-
- if (target.scrollLeft + target.offsetWidth + this.lowerThresholdNumber >= target.scrollWidth && this.lastScrollLeft - target.scrollLeft < 0 && $event.timeStamp - this.lastScrollToLowerTime > 200) {
- this.$trigger('scrolltolower', $event, {
- direction: 'right'
- });
- this.lastScrollToLowerTime = $event.timeStamp;
- }
- }
-
- this.lastScrollTop = target.scrollTop;
- this.lastScrollLeft = target.scrollLeft;
- }
- },
- _scrollTopChanged: function _scrollTopChanged(val) {
- if (this.scrollY) {
- if (this._innerSetScrollTop) {
- this._innerSetScrollTop = false;
- } else {
- if (this.scrollWithAnimation) {
- this.scrollTo(val, 'y');
- } else {
- this.$refs.main.scrollTop = val;
- }
- }
- }
- },
- _scrollLeftChanged: function _scrollLeftChanged(val) {
- if (this.scrollX) {
- if (this._innerSetScrollLeft) {
- this._innerSetScrollLeft = false;
- } else {
- if (this.scrollWithAnimation) {
- this.scrollTo(val, 'x');
- } else {
- this.$refs.main.scrollLeft = val;
- }
- }
- }
- },
- _scrollIntoViewChanged: function _scrollIntoViewChanged(val) {
- if (val) {
- if (!/^[_a-zA-Z][-_a-zA-Z0-9:]*$/.test(val)) {
- console.group('scroll-into-view="' + val + '" 有误');
- console.error('id 属性值格式错误。如不能以数字开头。');
- console.groupEnd();
- return;
- }
-
- var element = this.$el.querySelector('#' + val);
-
- if (element) {
- var mainRect = this.$refs.main.getBoundingClientRect();
- var elRect = element.getBoundingClientRect();
-
- if (this.scrollX) {
- var left = elRect.left - mainRect.left;
- var scrollLeft = this.$refs.main.scrollLeft;
- var x = scrollLeft + left;
-
- if (this.scrollWithAnimation) {
- this.scrollTo(x, 'x');
- } else {
- this.$refs.main.scrollLeft = x;
- }
- }
-
- if (this.scrollY) {
- var top = elRect.top - mainRect.top;
- var scrollTop = this.$refs.main.scrollTop;
- var y = scrollTop + top;
-
- if (this.scrollWithAnimation) {
- this.scrollTo(y, 'y');
- } else {
- this.$refs.main.scrollTop = y;
- }
- }
- }
- }
- },
- _transitionEnd: function _transitionEnd(val, type) {
- this.$refs.content.style.transition = '';
- this.$refs.content.style.webkitTransition = '';
- this.$refs.content.style.transform = '';
- this.$refs.content.style.webkitTransform = '';
- var main = this.$refs.main;
-
- if (type === 'x') {
- main.style.overflowX = this.scrollX ? 'auto' : 'hidden';
- main.scrollLeft = val;
- } else if (type === 'y') {
- main.style.overflowY = this.scrollY ? 'auto' : 'hidden';
- main.scrollTop = val;
- }
-
- this.$refs.content.removeEventListener('transitionend', this.__transitionEnd);
- this.$refs.content.removeEventListener('webkitTransitionEnd', this.__transitionEnd);
- },
- getScrollPosition: function getScrollPosition() {
- var main = this.$refs.main;
- return {
- scrollLeft: main.scrollLeft,
- scrollTop: main.scrollTop
- };
- }
- }
-});
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("3ad9")["default"]))
-
-/***/ }),
-
-/***/ "34b2":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function(UniServiceJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getImageInfo", function() { return getImageInfo; });
-/* harmony import */ var uni_platform_helpers_get_real_path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cb0f");
-
-
-function _getServiceAddress() {
- return window.location.protocol + '//' + window.location.host;
-}
-
-function getImageInfo(_ref, callbackId) {
- var src = _ref.src;
- var _UniServiceJSBridge = UniServiceJSBridge,
- invoke = _UniServiceJSBridge.invokeCallbackHandler;
- var img = new Image();
- var realPath = Object(uni_platform_helpers_get_real_path__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(src);
-
- img.onload = function () {
- invoke(callbackId, {
- errMsg: 'getImageInfo:ok',
- width: img.naturalWidth,
- height: img.naturalHeight,
- path: realPath.indexOf('/') === 0 ? _getServiceAddress() + realPath : realPath
- });
- };
-
- img.onerror = function (e) {
- invoke(callbackId, {
- errMsg: 'getImageInfo:fail'
- });
- };
-
- img.src = src;
-}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("0dd1")))
-
-/***/ }),
-
-/***/ "3858":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setStorage", function() { return setStorage; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setStorageSync", function() { return setStorageSync; });
-var setStorage = {
- 'key': {
- type: String,
- required: true
- },
- 'data': {
- required: true
- }
-};
-var setStorageSync = [{
- name: 'key',
- type: String,
- required: true
-}, {
- name: 'data',
- required: true
-}];
-
-/***/ }),
-
-/***/ "3ad9":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function(global) {var unshift = Array.prototype.unshift;
-
-function format(args) {
- unshift.call(args, '[system]');
- return args;
-}
-
-function createLog(method) {
- return function () {
- var printLog = true;
-
- if (method === 'debug' && !__uniConfig.debug) {
- printLog = false;
- }
-
- printLog && global.console[method].apply(global.console, format(arguments));
- };
-}
-
-/* harmony default export */ __webpack_exports__["default"] = ({
- log: createLog('log'),
- info: createLog('info'),
- warn: createLog('warn'),
- debug: createLog('debug'),
- error: createLog('error')
-});
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("24aa")))
-
-/***/ }),
-
-/***/ "3d1f":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(console) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return initSubscribe; });
-/* harmony import */ var uni_helpers_callbacks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("62b5");
-/* harmony import */ var _plugins_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("a741");
-
-
-function initSubscribe(subscribe, _ref) {
- var getApp = _ref.getApp,
- getCurrentPages = _ref.getCurrentPages;
-
- function createPageEvent(eventType) {
- return function (args, pageId) {
- var pages = getCurrentPages();
- var page = pages.find(function (page) {
- return page.$page.id === pageId;
- });
-
- if (page) {
- Object(_plugins_util__WEBPACK_IMPORTED_MODULE_1__[/* callPageHook */ "b"])(page, eventType, args);
- } else {
- console.error("Not Found\uFF1APage[".concat(pageId, "]"));
- }
- };
- }
-
- var requestComponentInfoCallbacks = Object(uni_helpers_callbacks__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])('requestComponentInfo');
-
- function onRequestComponentInfo(_ref2) {
- var reqId = _ref2.reqId,
- res = _ref2.res;
- var callback = requestComponentInfoCallbacks.pop(reqId);
-
- if (callback) {
- callback(res);
- }
- }
-
- var requestComponentObserverCallbacks = Object(uni_helpers_callbacks__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])('requestComponentObserver');
-
- function onRequestComponentObserver(_ref3) {
- var reqId = _ref3.reqId,
- reqEnd = _ref3.reqEnd,
- res = _ref3.res;
- var callback = requestComponentObserverCallbacks.get(reqId);
-
- if (callback) {
- if (reqEnd) {
- requestComponentObserverCallbacks.pop(reqId);
- return;
- }
-
- callback(res);
- }
- }
-
- subscribe('onPageReady', createPageEvent('onReady'));
- subscribe('onPageScroll', createPageEvent('onPageScroll'));
- subscribe('onReachBottom', createPageEvent('onReachBottom'));
- subscribe('onRequestComponentInfo', onRequestComponentInfo);
- subscribe('onRequestComponentObserver', onRequestComponentObserver);
-}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("3ad9")["default"]))
-
-/***/ }),
-
-/***/ "3d64":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function(UniServiceJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onNetworkStatusChange", function() { return onNetworkStatusChange; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNetworkType", function() { return getNetworkType; });
-var _UniServiceJSBridge = UniServiceJSBridge,
- invoke = _UniServiceJSBridge.invokeCallbackHandler;
-var callbackIds = [];
-
-function _getEffectiveNetworkType() {
- var connectionType = navigator.connection.type;
- var networkType = '';
-
- if (~['none', 'wifi', 'unknown'].indexOf(connectionType)) {
- networkType = connectionType;
- } else {
- var effectiveType = navigator.connection.effectiveType;
-
- if (effectiveType === 'slow-2g') {
- effectiveType = '2g';
- }
-
- networkType = effectiveType;
- }
-
- return networkType;
-}
-
-function changeHandler() {
- var isConnected = true;
-
- var networkType = _getEffectiveNetworkType();
-
- if (networkType === 'none') {
- isConnected = false;
- }
-
- callbackIds.forEach(function (callbackId) {
- callbackId && invoke(callbackId, {
- errMsg: 'onNetworkStatusChange:ok',
- isConnected: isConnected,
- networkType: networkType
- });
- });
-}
-
-function onNetworkStatusChange(callbackId) {
- if (window.NetworkInformation) {
- callbackIds.push(callbackId);
- navigator.connection.onchange = changeHandler;
- } else {
- callbackId && invoke(callbackId, {
- errMsg: 'onNetworkStatusChange:fail'
- });
- }
-}
-function getNetworkType() {
- if (window.NetworkInformation) {
- return {
- errMsg: 'getNetworkType:ok',
- networkType: _getEffectiveNetworkType()
- };
- } else {
- return {
- errMsg: 'getNetworkType:fail'
- };
- }
-}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("0dd1")))
-
-/***/ }),
-
-/***/ "3da9":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("33ab");
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
-/* unused harmony reexport * */
- /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
-
-/***/ }),
-
-/***/ "3e8c":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/resize-sensor/index.vue?vue&type=script&lang=js&
-/* harmony default export */ var resize_sensorvue_type_script_lang_js_ = ({
- name: 'ResizeSensor',
- props: {
- initial: {
- type: [Boolean, String],
- default: false
- }
- },
- data: function data() {
- return {
- size: {
- width: -1,
- height: -1
- }
- };
- },
- watch: {
- size: {
- deep: true,
- handler: function handler(size) {
- this.$emit('resize', Object.assign({}, size));
- }
- }
- },
- mounted: function mounted() {
- if (this.initial === true) {
- this.$nextTick(this.update);
- }
-
- if (this.$el.offsetParent !== this.$el.parentNode) {
- this.$el.parentNode.style.position = 'relative';
- }
-
- if (!('AnimationEvent' in window)) {
- this.reset();
- }
- },
- methods: {
- reset: function reset() {
- var expand = this.$el.firstChild;
- var shrink = this.$el.lastChild;
- expand.scrollLeft = 100000;
- expand.scrollTop = 100000;
- shrink.scrollLeft = 100000;
- shrink.scrollTop = 100000;
- },
- update: function update() {
- this.size.width = this.$el.offsetWidth;
- this.size.height = this.$el.offsetHeight;
- this.reset();
- }
- },
- render: function render(create) {
- return create('uni-resize-sensor', {
- on: {
- '~animationstart': this.update
- }
- }, [create('div', {
- on: {
- scroll: this.update
- }
- }, [create('div')]), create('div', {
- on: {
- scroll: this.update
- }
- }, [create('div')])]);
- }
-});
-// CONCATENATED MODULE: ./src/core/view/components/resize-sensor/index.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_resize_sensorvue_type_script_lang_js_ = (resize_sensorvue_type_script_lang_js_);
-// EXTERNAL MODULE: ./src/core/view/components/resize-sensor/index.vue?vue&type=style&index=0&lang=css&
-var resize_sensorvue_type_style_index_0_lang_css_ = __webpack_require__("64d0");
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js
-var componentNormalizer = __webpack_require__("0c7c");
-
-// CONCATENATED MODULE: ./src/core/view/components/resize-sensor/index.vue
-var render, staticRenderFns
-
-
-
-
-
-/* normalize component */
-
-var component = Object(componentNormalizer["a" /* default */])(
- components_resize_sensorvue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- null,
- null,
- null
-
-)
-
-/* harmony default export */ var resize_sensor = __webpack_exports__["default"] = (component.exports);
-
-/***/ }),
-
-/***/ "3f7e":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("1a33");
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
-/* unused harmony reexport * */
- /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
-
-/***/ }),
-
-/***/ "4043":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setNavigationBarColor", function() { return setNavigationBarColor; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setNavigationBarTitle", function() { return setNavigationBarTitle; });
-var FRONT_COLORS = ['#ffffff', '#000000'];
-var setNavigationBarColor = {
- 'frontColor': {
- type: String,
- required: true,
- validator: function validator(frontColor, params) {
- if (FRONT_COLORS.indexOf(frontColor) === -1) {
- return "invalid frontColor \"".concat(frontColor, "\"");
- }
- }
- },
- 'backgroundColor': {
- type: String,
- required: true
- },
- 'animation': {
- type: Object,
- default: function _default() {
- return {
- duration: 0,
- timingFunc: 'linear'
- };
- },
- validator: function validator() {
- var animation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var params = arguments.length > 1 ? arguments[1] : undefined;
- params.animation = {
- duration: animation.duration || 0,
- timingFunc: animation.timingFunc || 'linear'
- };
- }
- }
-};
-var setNavigationBarTitle = {
- 'title': {
- type: String,
- required: true
- }
-};
-
-/***/ }),
-
-/***/ "40ab":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "redirectTo", function() { return redirectTo; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reLaunch", function() { return reLaunch; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "navigateTo", function() { return navigateTo; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "switchTab", function() { return switchTab; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "navigateBack", function() { return navigateBack; });
-/* harmony import */ var _get_real_route__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("0f74");
-
-
-function encodeQueryString(url) {
- if (typeof url !== 'string') {
- return url;
- }
-
- var index = url.indexOf('?');
-
- if (index === -1) {
- return url;
- }
-
- var query = url.substr(index + 1).trim().replace(/^(\?|#|&)/, '');
-
- if (!query) {
- return url;
- }
-
- url = url.substr(0, index);
- var params = [];
- query.split('&').forEach(function (param) {
- var parts = param.replace(/\+/g, ' ').split('=');
- var key = parts.shift();
- var val = parts.length > 0 ? parts.join('=') : '';
- params.push(key + '=' + encodeURIComponent(val));
- });
- return params.length ? url + '?' + params.join('&') : url;
-}
-
-function createValidator(type) {
- return function validator(url, params) {
- // 格式化为绝对路径路由
- url = Object(_get_real_route__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(url);
- var pagePath = url.split('?')[0]; // 匹配路由是否存在
-
- var routeOptions = __uniRoutes.find(function (_ref) {
- var path = _ref.path,
- alias = _ref.alias;
- return path === pagePath || alias === pagePath;
- });
-
- if (!routeOptions) {
- return 'page `' + url + '` is not found';
- } // 检测不同类型跳转
-
-
- if (type === 'navigateTo' || type === 'redirectTo') {
- if (routeOptions.meta.isTabBar) {
- return "can not ".concat(type, " a tabbar page");
- }
- } else if (type === 'switchTab') {
- if (!routeOptions.meta.isTabBar) {
- return 'can not switch to no-tabBar page';
- }
- } // tabBar不允许传递参数
-
-
- if (routeOptions.meta.isTabBar) {
- url = pagePath;
- } // 首页自动格式化为`/`
-
-
- if (routeOptions.meta.isEntry) {
- url = url.replace(routeOptions.alias, '/');
- } // 参数格式化
-
-
- params.url = encodeQueryString(url);
- };
-}
-
-function createProtocol(type) {
- var extras = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- return Object.assign({
- url: {
- type: String,
- required: true,
- validator: createValidator(type)
- }
- }, extras);
-}
-
-function createAnimationProtocol(animationTypes) {
- return {
- animationType: {
- type: String,
- validator: function validator(type) {
- if (type && animationTypes.indexOf(type) === -1) {
- return '`' + type + '` is not supported for `animationType` (supported values are: `' + animationTypes.join('`|`') + '`)';
- }
- }
- },
- animationDuration: {
- type: Number
- }
- };
-}
-
-var redirectTo = createProtocol('redirectTo');
-var reLaunch = createProtocol('reLaunch');
-var navigateTo = createProtocol('navigateTo', createAnimationProtocol(['slide-in-right', 'slide-in-left', 'slide-in-top', 'slide-in-bottom', 'fade-in', 'zoom-out', 'zoom-fade-out', 'pop-in', 'none']));
-var switchTab = createProtocol('switchTab');
-var navigateBack = Object.assign({
- delta: {
- type: Number,
- validator: function validator(delta, params) {
- delta = parseInt(delta) || 1;
- params.delta = Math.min(getCurrentPages().length - 1, delta);
- }
- }
-}, createAnimationProtocol(['slide-out-right', 'slide-out-left', 'slide-out-top', 'slide-out-bottom', 'fade-out', 'zoom-in', 'zoom-fade-in', 'pop-out', 'none']));
-
-/***/ }),
-
-/***/ "42fb":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function(UniServiceJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createIntersectionObserver", function() { return createIntersectionObserver; });
-/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("8bbf");
-/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var uni_helpers_callbacks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("62b5");
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
-
-function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
-
-
-
-var createIntersectionObserverCallbacks = Object(uni_helpers_callbacks__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])('requestComponentObserver');
-var defaultOptions = {
- thresholds: [0],
- initialRatio: 0,
- observeAll: false
-};
-
-var MPIntersectionObserver =
-/*#__PURE__*/
-function () {
- function MPIntersectionObserver(pageId, options) {
- _classCallCheck(this, MPIntersectionObserver);
-
- this.pageId = pageId;
- this.options = Object.assign({}, defaultOptions, options);
- }
-
- _createClass(MPIntersectionObserver, [{
- key: "_makeRootMargin",
- value: function _makeRootMargin() {
- var margins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- this.options.rootMargin = ['top', 'right', 'bottom', 'left'].map(function (name) {
- return "".concat(Number(margins[name]) || 0, "px");
- }).join(' ');
- }
- }, {
- key: "relativeTo",
- value: function relativeTo(selector, margins) {
- this.options.relativeToSelector = selector;
-
- this._makeRootMargin(margins);
-
- return this;
- }
- }, {
- key: "relativeToViewport",
- value: function relativeToViewport(margins) {
- this.options.relativeToSelector = null;
-
- this._makeRootMargin(margins);
-
- return this;
- }
- }, {
- key: "observe",
- value: function observe(selector, callback) {
- if (typeof callback !== 'function') {
- return;
- }
-
- this.options.selector = selector;
- this.reqId = createIntersectionObserverCallbacks.push(callback);
- UniServiceJSBridge.publishHandler('requestComponentObserver', {
- reqId: this.reqId,
- options: this.options
- }, this.pageId);
- }
- }, {
- key: "disconnect",
- value: function disconnect() {
- UniServiceJSBridge.publishHandler('destroyComponentObserver', {
- reqId: this.reqId
- }, this.pageId);
- }
- }]);
-
- return MPIntersectionObserver;
-}();
-
-function createIntersectionObserver(context, options) {
- if (!(context instanceof vue__WEBPACK_IMPORTED_MODULE_0___default.a)) {
- options = context;
- context = null;
- }
-
- if (context) {
- return new MPIntersectionObserver(context.$page.id, options);
- }
-
- var app = getApp();
-
- if (app.$route && app.$route.params.__id__) {
- return new MPIntersectionObserver(app.$route.params.__id__, options);
- } else {
- UniServiceJSBridge.emit('onError', 'createIntersectionObserver:fail');
- }
-}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("0dd1")))
-
-/***/ }),
-
-/***/ "439a":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "downloadFile", function() { return downloadFile; });
-var downloadFile = {
- url: {
- type: String,
- required: true
- },
- header: {
- type: Object,
- validator: function validator(value, params) {
- params.header = value || {};
- }
- }
-};
-
-/***/ }),
-
-/***/ "442e":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function(UniServiceJSBridge) {/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("8bbf");
-/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var uni_helpers_tags__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("5129");
-/* harmony import */ var uni_helpers_tags__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(uni_helpers_tags__WEBPACK_IMPORTED_MODULE_1__);
- // 使用白名单过滤(前期有一批自定义组件使用了 uni-)
-
-
-var oldIsReservedTag = vue__WEBPACK_IMPORTED_MODULE_0___default.a.config.isReservedTag;
-
-vue__WEBPACK_IMPORTED_MODULE_0___default.a.config.isReservedTag = function (tag) {
- return uni_helpers_tags__WEBPACK_IMPORTED_MODULE_1___default.a.indexOf(tag) !== -1 || oldIsReservedTag(tag);
-};
-
-vue__WEBPACK_IMPORTED_MODULE_0___default.a.config.ignoredElements = uni_helpers_tags__WEBPACK_IMPORTED_MODULE_1___default.a;
-var oldGetTagNamespace = vue__WEBPACK_IMPORTED_MODULE_0___default.a.config.getTagNamespace;
-var conflictTags = ['switch', 'image', 'text', 'view'];
-
-vue__WEBPACK_IMPORTED_MODULE_0___default.a.config.getTagNamespace = function (tag) {
- if (~conflictTags.indexOf(tag)) {
- // svg 部分标签名称与 uni 标签冲突
- return false;
- }
-
- return oldGetTagNamespace(tag) || false;
-};
-
-vue__WEBPACK_IMPORTED_MODULE_0___default.a.config.errorHandler = function (err, vm, info) {
- UniServiceJSBridge.emit('onError', err);
-};
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("0dd1")))
-
-/***/ }),
-
-/***/ "44de":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "vibrateLong", function() { return vibrateLong; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "vibrateShort", function() { return vibrateShort; });
-var _isSupport = !!window.navigator.vibrate;
-
-function vibrateLong() {
- if (_isSupport && window.navigator.vibrate(400)) {
- return {
- errMsg: 'vibrateLong:ok'
- };
- } else {
- return {
- errMsg: 'vibrateLong:fail'
- };
- }
-}
-function vibrateShort() {
- if (_isSupport && window.navigator.vibrate(15)) {
- return {
- errMsg: 'vibrateShort:ok'
- };
- } else {
- return {
- errMsg: 'vibrateShort:fail'
- };
- }
-}
-
-/***/ }),
-
-/***/ "4509":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "4656":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "4871":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "488c":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "4a59":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return publishHandler; });
-function publishHandler(event, args, pageId) {
- // h5 平台直接调用UniServiceJSBridge
- global.UniServiceJSBridge.subscribeHandler(event, args, pageId);
-}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("24aa")))
-
-/***/ }),
-
-/***/ "4c68":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return requestComponentObserver; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return destroyComponentObserver; });
-/* harmony import */ var intersection_observer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("5abe");
-/* harmony import */ var intersection_observer__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(intersection_observer__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var uni_helpers_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("85b6");
-
-
-
-function getRect(rect) {
- return {
- bottom: rect.bottom,
- height: rect.height,
- left: rect.left,
- right: rect.right,
- top: rect.top,
- width: rect.width
- };
-}
-
-var intersectionObservers = {};
-function requestComponentObserver(_ref, pageId) {
- var reqId = _ref.reqId,
- options = _ref.options;
- var pages = getCurrentPages();
- var pageVm = pages.find(function (page) {
- return page.$page.id === pageId;
- });
-
- if (!pageVm) {
- throw new Error("Not Found\uFF1APage[".concat(pageId, "]"));
- }
-
- var $el = pageVm.$el;
- var root = options.relativeToSelector ? $el.querySelector(options.relativeToSelector) : null;
- var intersectionObserver = intersectionObservers[reqId] = new IntersectionObserver(function (entries, observer) {
- entries.forEach(function (entrie) {
- UniViewJSBridge.publishHandler('onRequestComponentObserver', {
- reqId: reqId,
- res: {
- intersectionRatio: entrie.intersectionRatio,
- intersectionRect: getRect(entrie.intersectionRect),
- boundingClientRect: getRect(entrie.boundingClientRect),
- relativeRect: getRect(entrie.rootBounds),
- time: Date.now(),
- dataset: Object(uni_helpers_index__WEBPACK_IMPORTED_MODULE_1__[/* normalizeDataset */ "c"])(entrie.target.dataset || {}),
- id: entrie.target.id
- }
- }, pageVm.$page.id);
- });
- }, {
- root: root,
- rootMargin: options.rootMargin,
- threshold: options.thresholds
- });
-
- if (options.observeAll) {
- intersectionObserver.USE_MUTATION_OBSERVER = true;
- Array.prototype.map.call($el.querySelectorAll(options.selector), function (el) {
- intersectionObserver.observe(el);
- });
- } else {
- intersectionObserver.USE_MUTATION_OBSERVER = false;
- intersectionObserver.observe($el.querySelector(options.selector));
- }
-}
-function destroyComponentObserver(_ref2) {
- var reqId = _ref2.reqId;
- var intersectionObserver = intersectionObservers[reqId];
-
- if (intersectionObserver) {
- intersectionObserver.disconnect();
- UniViewJSBridge.publishHandler('onRequestComponentObserver', {
- reqId: reqId,
- reqEnd: true
- });
- }
-}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("501c")))
-
-/***/ }),
-
-/***/ "4ca9":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function(console) {/* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("6389");
-/* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue_router__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var uni_helpers_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("85b6");
-/* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("abbf");
-/* harmony import */ var _page__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("0784");
-/* harmony import */ var _lifecycle__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("aa92");
-/* harmony import */ var _app_router_guard__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("23e5");
-
-
-
-
-
-
-
-function getMinId(routes) {
- var minId = 0;
- routes.forEach(function (route) {
- if (route.meta.id) {
- minId++;
- }
- });
- return minId;
-}
-
-function getHash() {
- var href = window.location.href;
- var index = href.indexOf('#');
- return index === -1 ? '' : decodeURI(href.slice(index + 1));
-}
-
-function getLocation() {
- var base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '/';
- var path = decodeURI(window.location.pathname);
-
- if (base && path.indexOf(base) === 0) {
- path = path.slice(base.length);
- }
-
- return (path || '/') + window.location.search + window.location.hash;
-}
-/**
- * Service 层 Vue 插件
- * 1.init keepAliveInclude?
- * 2.init router
- * 3.init entryRoute
- * 4.hack vue _init (app)
- * 5.use router
- */
-
-
-/* harmony default export */ __webpack_exports__["default"] = ({
- install: function install(Vue) {
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- routes = _ref.routes;
-
- Object(_lifecycle__WEBPACK_IMPORTED_MODULE_4__[/* lifecycleMixin */ "a"])(Vue);
- var minId = getMinId(routes);
- var router = new vue_router__WEBPACK_IMPORTED_MODULE_0___default.a({
- id: minId,
- mode: __uniConfig.router.mode,
- base: __uniConfig.router.base,
- routes: routes,
- scrollBehavior: function scrollBehavior(to, from, savedPosition) {
- if (savedPosition) {
- return savedPosition;
- } else {
- if (to && from && to.meta.isTabBar && from.meta.isTabBar) {
- // tabbar 跳 tabbar
- var position = Object(_app_router_guard__WEBPACK_IMPORTED_MODULE_5__[/* getTabBarScrollPosition */ "b"])(to.params.__id__);
-
- if (position) {
- return position;
- }
- }
-
- return {
- x: 0,
- y: 0
- };
- }
- }
- });
- var keepAliveInclude = []; // 需跨平台,根据用户配置 hash 或 history 来调用
-
- var entryRoute = router.match(__uniConfig.router.mode === 'history' ? getLocation(__uniConfig.router.base) : getHash());
-
- if (entryRoute.meta.name) {
- if (entryRoute.meta.id) {
- keepAliveInclude.push(entryRoute.meta.name + '-' + entryRoute.meta.id);
- } else {
- keepAliveInclude.push(entryRoute.meta.name + '-' + (minId + 1));
- }
- }
- /* eslint-disable no-undef */
-
-
- if (true) {
- if (entryRoute.meta && entryRoute.meta.name) {
- document.body.className = 'uni-body ' + entryRoute.meta.name;
-
- if (entryRoute.meta.isNVue) {
- var nvueDirKey = 'nvue-dir-' + __uniConfig.nvue['flex-direction'];
- document.body.setAttribute('nvue', '');
- document.body.setAttribute(nvueDirKey, '');
- }
- }
- }
-
- Vue.mixin({
- beforeCreate: function beforeCreate() {
- var options = this.$options;
-
- if (options.mpType === 'app') {
- options.data = function () {
- return {
- keepAliveInclude: keepAliveInclude
- };
- };
-
- var appMixin = Object(_app__WEBPACK_IMPORTED_MODULE_2__[/* createAppMixin */ "a"])(routes, entryRoute); // mixin app hooks
-
- Object.keys(appMixin).forEach(function (hook) {
- options[hook] = options[hook] ? [].concat(appMixin[hook], options[hook]) : [appMixin[hook]];
- }); // router
-
- options.router = router; // onError
-
- if (!Array.isArray(options.onError) || options.onError.length === 0) {
- options.onError = [function (err) {
- console.error(err);
- }];
- }
- } else if (Object(uni_helpers_index__WEBPACK_IMPORTED_MODULE_1__[/* isPage */ "b"])(this)) {
- var pageMixin = Object(_page__WEBPACK_IMPORTED_MODULE_3__[/* createPageMixin */ "a"])(); // mixin page hooks
-
- Object.keys(pageMixin).forEach(function (hook) {
- options[hook] = options[hook] ? [].concat(pageMixin[hook], options[hook]) : [pageMixin[hook]];
- });
- } else {
- if (this.$parent && this.$parent.__page__) {
- this.__page__ = this.$parent.__page__;
- }
- }
- }
- });
- Object.defineProperty(Vue.prototype, '$page', {
- get: function get() {
- return this.__page__;
- }
- });
-
- Vue.prototype.createSelectorQuery = function createSelectorQuery() {
- return uni.createSelectorQuery().in(this);
- };
-
- Vue.prototype.createIntersectionObserver = function createIntersectionObserver(args) {
- return uni.createIntersectionObserver(this, args);
- };
-
- Vue.use(vue_router__WEBPACK_IMPORTED_MODULE_0___default.a);
- }
-});
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("3ad9")["default"]))
-
-/***/ }),
-
-/***/ "4da7":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/text/index.vue?vue&type=script&lang=js&
-var textvue_type_script_lang_js_ = __webpack_require__("4f97");
-
-// CONCATENATED MODULE: ./src/core/view/components/text/index.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_textvue_type_script_lang_js_ = (textvue_type_script_lang_js_["a" /* default */]);
-// EXTERNAL MODULE: ./src/core/view/components/text/index.vue?vue&type=style&index=0&lang=css&
-var textvue_type_style_index_0_lang_css_ = __webpack_require__("c8ed");
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js
-var componentNormalizer = __webpack_require__("0c7c");
-
-// CONCATENATED MODULE: ./src/core/view/components/text/index.vue
-var render, staticRenderFns
-
-
-
-
-
-/* normalize component */
-
-var component = Object(componentNormalizer["a" /* default */])(
- components_textvue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- null,
- null,
- null
-
-)
-
-/* harmony default export */ var components_text = __webpack_exports__["default"] = (component.exports);
-
-/***/ }),
-
-/***/ "4ebb":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "base64ToArrayBuffer", function() { return base64ToArrayBuffer; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "arrayBufferToBase64", function() { return arrayBufferToBase64; });
-/* harmony import */ var base64_arraybuffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("8390");
-/* harmony import */ var base64_arraybuffer__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(base64_arraybuffer__WEBPACK_IMPORTED_MODULE_0__);
-
-var base64ToArrayBuffer = base64_arraybuffer__WEBPACK_IMPORTED_MODULE_0__["decode"];
-var arrayBufferToBase64 = base64_arraybuffer__WEBPACK_IMPORTED_MODULE_0__["encode"];
-
-/***/ }),
-
-/***/ "4ec0":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(UniServiceJSBridge, console) {/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("f2b3");
-/* harmony import */ var uni_helpers_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("65a8");
-/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("81ea");
-/* harmony import */ var _popup_mixins__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("f1ea");
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-
-
-
-
-/* harmony default export */ __webpack_exports__["a"] = ({
- name: 'App',
- components: _components__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"],
- mixins: _popup_mixins__WEBPACK_IMPORTED_MODULE_3__["default"],
- props: {
- keepAliveInclude: {
- type: Array,
- default: function _default() {
- return [];
- }
- }
- },
- data: function data() {
- return {
- transitionName: 'fade',
- hideTabBar: false,
- tabBar: __uniConfig.tabBar || {}
- };
- },
- computed: {
- key: function key() {
- return this.$route.meta.name + '-' + this.$route.params.__id__ + '-' + (__uniConfig.reLaunch || 1);
- },
- hasTabBar: function hasTabBar() {
- return __uniConfig.tabBar && __uniConfig.tabBar.list && __uniConfig.tabBar.list.length;
- },
- showTabBar: function showTabBar() {
- return this.$route.meta.isTabBar && !this.hideTabBar;
- }
- },
- watch: {
- $route: function $route(newRoute, oldRoute) {
- UniServiceJSBridge.emit('onHidePopup');
- },
- hideTabBar: function hideTabBar(newVal, oldVal) {
- // TODO 不支持 css 变量时
- if (uni.canIUse('css.var')) {
- var windowBottom = !newVal ? uni_helpers_constants__WEBPACK_IMPORTED_MODULE_1__[/* TABBAR_HEIGHT */ "b"] + 'px' : '0px';
- document.documentElement.style.setProperty('--window-bottom', windowBottom);
- console.debug("uni.".concat(windowBottom ? 'showTabBar' : 'hideTabBar', "\uFF1A--window-bottom=").concat(windowBottom));
- } // 触发 resize 事件
-
-
- window.dispatchEvent(new CustomEvent('resize'));
- }
- },
- created: function created() {
- if (uni.canIUse('css.var')) {
- document.documentElement.style.setProperty('--status-bar-height', '0px');
- }
- },
- mounted: function mounted() {
- window.addEventListener('message', function (evt) {
- if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isPlainObject */ "f"])(evt.data) && evt.data.type === 'WEB_INVOKE_APPSERVICE') {
- UniServiceJSBridge.emit('onWebInvokeAppService', evt.data.data, evt.data.pageId);
- }
- });
- document.addEventListener('visibilitychange', function () {
- if (document.visibilityState === 'visible') {
- UniServiceJSBridge.emit('onAppEnterForeground');
- } else {
- UniServiceJSBridge.emit('onAppEnterBackground');
- }
- });
- }
-});
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("0dd1"), __webpack_require__("3ad9")["default"]))
-
-/***/ }),
-
-/***/ "4f1c":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"120ddde1-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/switch/index.vue?vue&type=template&id=4b47fc1e&
-var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('uni-switch',_vm._g({on:{"click":_vm._onClick}},_vm.$listeners),[_c('div',{staticClass:"uni-switch-wrapper"},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.type === 'switch'),expression:"type === 'switch'"}],staticClass:"uni-switch-input",class:[_vm.switchChecked ? 'uni-switch-input-checked' : ''],style:({backgroundColor: _vm.switchChecked ? _vm.color : '#DFDFDF',borderColor:_vm.switchChecked ? _vm.color : '#DFDFDF'})}),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.type === 'checkbox'),expression:"type === 'checkbox'"}],staticClass:"uni-checkbox-input",class:[_vm.switchChecked ? 'uni-checkbox-input-checked' : ''],style:({color: _vm.color})})])])}
-var staticRenderFns = []
-
-
-// CONCATENATED MODULE: ./src/core/view/components/switch/index.vue?vue&type=template&id=4b47fc1e&
-
-// EXTERNAL MODULE: ./src/core/view/mixins/index.js + 1 modules
-var mixins = __webpack_require__("8af1");
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/switch/index.vue?vue&type=script&lang=js&
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-
-/* harmony default export */ var switchvue_type_script_lang_js_ = ({
- name: 'Switch',
- mixins: [mixins["a" /* emitter */], mixins["c" /* listeners */]],
- props: {
- name: {
- type: String,
- default: ''
- },
- checked: {
- type: [Boolean, String],
- default: false
- },
- type: {
- type: String,
- default: 'switch'
- },
- id: {
- type: String,
- default: ''
- },
- disabled: {
- type: [Boolean, String],
- default: false
- },
- color: {
- type: String,
- default: '#007aff'
- }
- },
- data: function data() {
- return {
- switchChecked: this.checked
- };
- },
- watch: {
- checked: function checked(val) {
- this.switchChecked = val;
- }
- },
- created: function created() {
- this.$dispatch('Form', 'uni-form-group-update', {
- type: 'add',
- vm: this
- });
- },
- beforeDestroy: function beforeDestroy() {
- this.$dispatch('Form', 'uni-form-group-update', {
- type: 'remove',
- vm: this
- });
- },
- listeners: {
- 'label-click': '_onClick',
- '@label-click': '_onClick'
- },
- methods: {
- _onClick: function _onClick($event) {
- if (this.disabled) {
- return;
- }
-
- this.switchChecked = !this.switchChecked;
- this.$trigger('change', $event, {
- value: this.switchChecked
- });
- },
- _resetFormData: function _resetFormData() {
- this.switchChecked = false;
- },
- _getFormData: function _getFormData() {
- var data = {};
-
- if (this.name !== '') {
- data['value'] = this.switchChecked;
- data['key'] = this.name;
- }
-
- return data;
- }
- }
-});
-// CONCATENATED MODULE: ./src/core/view/components/switch/index.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_switchvue_type_script_lang_js_ = (switchvue_type_script_lang_js_);
-// EXTERNAL MODULE: ./src/core/view/components/switch/index.vue?vue&type=style&index=0&lang=css&
-var switchvue_type_style_index_0_lang_css_ = __webpack_require__("a5ec");
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js
-var componentNormalizer = __webpack_require__("0c7c");
-
-// CONCATENATED MODULE: ./src/core/view/components/switch/index.vue
-
-
-
-
-
-
-/* normalize component */
-
-var component = Object(componentNormalizer["a" /* default */])(
- components_switchvue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- null,
- null,
- null
-
-)
-
-/* harmony default export */ var components_switch = __webpack_exports__["default"] = (component.exports);
-
-/***/ }),
-
-/***/ "4f43":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function(UniServiceJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "downloadFile", function() { return downloadFile; });
-/* harmony import */ var uni_platform_helpers_file__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("e2e2");
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
-
-function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
-
-function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-
-
-/**
- * 下载任务
- */
-
-var DownloadTask =
-/*#__PURE__*/
-function () {
- function DownloadTask(xhr) {
- _classCallCheck(this, DownloadTask);
-
- _defineProperty(this, "_xhr", void 0);
-
- _defineProperty(this, "_callbacks", []);
-
- this._xhr = xhr;
- }
- /**
- * 监听下载进度
- * @param {Function} callback 回调
- */
-
-
- _createClass(DownloadTask, [{
- key: "onProgressUpdate",
- value: function onProgressUpdate(callback) {
- if (typeof callback !== 'function') {
- return;
- }
-
- this._callbacks.push(callback);
- }
- /**
- * 停止任务
- */
-
- }, {
- key: "abort",
- value: function abort() {
- if (this._xhr) {
- this._xhr.abort();
-
- delete this._xhr;
- }
- }
- }]);
-
- return DownloadTask;
-}();
-/**
- * 下载文件
- * @param {*} param0
- * @param {string} callbackId
- * @return {DownloadTask}
- */
-
-
-function downloadFile(_ref, callbackId) {
- var url = _ref.url,
- header = _ref.header;
- var timeout = __uniConfig.networkTimeout && __uniConfig.networkTimeout.downloadFile || 60 * 1000;
- var _UniServiceJSBridge = UniServiceJSBridge,
- invoke = _UniServiceJSBridge.invokeCallbackHandler;
- var timer;
- var xhr = new XMLHttpRequest();
- var downloadTask = new DownloadTask(xhr);
- xhr.open('GET', url, true);
- Object.keys(header).forEach(function (key) {
- xhr.setRequestHeader(key, header[key]);
- });
- xhr.responseType = 'blob';
-
- xhr.onload = function () {
- clearTimeout(timer);
- var statusCode = xhr.status;
- var blob = this.response;
- invoke(callbackId, {
- errMsg: 'downloadFile:ok',
- statusCode: statusCode,
- tempFilePath: Object(uni_platform_helpers_file__WEBPACK_IMPORTED_MODULE_0__[/* fileToUrl */ "a"])(blob)
- });
- };
-
- xhr.onabort = function () {
- clearTimeout(timer);
- invoke(callbackId, {
- errMsg: 'downloadFile:fail abort'
- });
- };
-
- xhr.onerror = function () {
- clearTimeout(timer);
- invoke(callbackId, {
- errMsg: 'downloadFile:fail'
- });
- };
-
- xhr.onprogress = function (event) {
- downloadTask._callbacks.forEach(function (callback) {
- var totalBytesWritten = event.loaded;
- var totalBytesExpectedToWrite = event.total;
- var progress = Math.round(totalBytesWritten / totalBytesExpectedToWrite * 100);
- callback({
- progress: progress,
- totalBytesWritten: totalBytesWritten,
- totalBytesExpectedToWrite: totalBytesExpectedToWrite
- });
- });
- };
-
- xhr.send();
- timer = setTimeout(function () {
- xhr.onprogress = xhr.onload = xhr.onabort = xhr.onerror = null;
- downloadTask.abort();
- invoke(callbackId, {
- errMsg: 'downloadFile:fail timeout'
- });
- }, timeout);
- return downloadTask;
-}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("0dd1")))
-
-/***/ }),
-
-/***/ "4f97":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(console) {var SPACE_UNICODE = {
- 'ensp': "\u2002",
- 'emsp': "\u2003",
- 'nbsp': "\xA0"
-};
-/* harmony default export */ __webpack_exports__["a"] = ({
- name: 'Text',
- props: {
- selectable: {
- type: [Boolean, String],
- default: false
- },
- space: {
- type: String,
- default: ''
- },
- decode: {
- type: [Boolean, String],
- default: false
- }
- },
- methods: {
- _decodeHtml: function _decodeHtml(htmlString) {
- if (this.space && SPACE_UNICODE[this.space]) {
- htmlString = htmlString.replace(/ /g, SPACE_UNICODE[this.space]);
- }
-
- if (this.decode) {
- htmlString = htmlString.replace(/ /g, SPACE_UNICODE.nbsp).replace(/ /g, SPACE_UNICODE.ensp).replace(/ /g, SPACE_UNICODE.emsp).replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, "'");
- }
-
- return htmlString;
- }
- },
- render: function render(createElement) {
- var _this = this;
-
- var nodeList = [];
- this.$slots.default && this.$slots.default.forEach(function (vnode) {
- if (vnode.text) {
- // 处理可能出现的多余的转义字符
- var nodeText = vnode.text.replace(/\\n/g, '\n');
- var texts = nodeText.split('\n');
- texts.forEach(function (text, index) {
- nodeList.push(_this._decodeHtml(text));
-
- if (index !== texts.length - 1) {
- nodeList.push(createElement('br'));
- }
- });
- } else {
- if (vnode.componentOptions && vnode.componentOptions.tag !== 'v-uni-text') {
- console.warn(' 组件内只支持嵌套 ,不支持其它组件或自定义组件,否则会引发在不同平台的渲染差异。');
- }
-
- nodeList.push(vnode);
- }
- });
- return createElement('uni-text', {
- on: this.$listeners,
- attrs: {
- selectable: !!this.selectable
- }
- }, [createElement('span', {}, nodeList)]);
- }
-});
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("3ad9")["default"]))
-
-/***/ }),
-
-/***/ "4fef":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_actionSheet_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("2fb0");
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_actionSheet_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_actionSheet_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
-/* unused harmony reexport * */
- /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_actionSheet_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
-
-/***/ }),
-
-/***/ "500a":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "501c":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "on", function() { return on; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "off", function() { return off; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return once; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "emit", function() { return emit; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribe", function() { return subscribe; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unsubscribe", function() { return unsubscribe; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeHandler", function() { return subscribeHandler; });
-/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("8bbf");
-/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var _subscribe__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("8ecd");
-/* harmony import */ var uni_platform_view_bridge__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("4a59");
-/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishHandler", function() { return uni_platform_view_bridge__WEBPACK_IMPORTED_MODULE_2__["a"]; });
-
-
-
-var Emitter = new vue__WEBPACK_IMPORTED_MODULE_0___default.a();
-var on = Emitter.$on.bind(Emitter);
-var off = Emitter.$off.bind(Emitter);
-var once = Emitter.$once.bind(Emitter);
-var emit = Emitter.$emit.bind(Emitter);
-function subscribe(event, callback) {
- return on('service.' + event, callback);
-}
-function unsubscribe(event, callback) {
- return off('service.' + event, callback);
-}
-function subscribeHandler(event, args, pageId) {
- emit('service.' + event, args, pageId);
-}
-
-Object(_subscribe__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(subscribe);
-
-/***/ }),
-
-/***/ "5129":
-/***/ (function(module, exports) {
-
-module.exports = ['uni-app', 'uni-tabbar', 'uni-page', 'uni-page-head', 'uni-page-wrapper', 'uni-page-body', 'uni-page-refresh', 'uni-actionsheet', 'uni-modal', 'uni-picker', 'uni-toast', 'uni-resize-sensor', 'uni-ad', 'uni-audio', 'uni-button', 'uni-camera', 'uni-canvas', 'uni-checkbox', 'uni-checkbox-group', 'uni-cover-image', 'uni-cover-view', 'uni-form', 'uni-functional-page-navigator', // 'uni-icon',
-'uni-image', 'uni-input', 'uni-label', 'uni-live-player', 'uni-live-pusher', 'uni-map', 'uni-movable-area', 'uni-movable-view', 'uni-navigator', 'uni-official-account', 'uni-open-data', 'uni-picker', 'uni-picker-view', 'uni-picker-view-column', 'uni-progress', 'uni-radio', 'uni-radio-group', 'uni-rich-text', 'uni-scroll-view', 'uni-slider', 'uni-swiper', 'uni-swiper-item', 'uni-switch', 'uni-text', 'uni-textarea', 'uni-video', 'uni-view', 'uni-web-view'];
-
-/***/ }),
-
-/***/ "5363":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Friction; });
-function Friction(e) {
- this._drag = e;
- this._dragLog = Math.log(e);
- this._x = 0;
- this._v = 0;
- this._startTime = 0;
-}
-
-Friction.prototype.set = function (e, t) {
- this._x = e;
- this._v = t;
- this._startTime = new Date().getTime();
-};
-
-Friction.prototype.setVelocityByEnd = function (e) {
- this._v = (e - this._x) * this._dragLog / (Math.pow(this._drag, 100) - 1);
-};
-
-Friction.prototype.x = function (e) {
- if (e === undefined) {
- e = (new Date().getTime() - this._startTime) / 1e3;
- }
-
- var t;
- t = e === this._dt && this._powDragDt ? this._powDragDt : this._powDragDt = Math.pow(this._drag, e);
- this._dt = e;
- return this._x + this._v * t / this._dragLog - this._v / this._dragLog;
-};
-
-Friction.prototype.dx = function (e) {
- if (e === undefined) {
- e = (new Date().getTime() - this._startTime) / 1e3;
- }
-
- var t;
- t = e === this._dt && this._powDragDt ? this._powDragDt : this._powDragDt = Math.pow(this._drag, e);
- this._dt = e;
- return this._v * t;
-};
-
-Friction.prototype.done = function () {
- return Math.abs(this.dx()) < 3;
-};
-
-Friction.prototype.reconfigure = function (e) {
- var t = this.x();
- var n = this.dx();
- this._drag = e;
- this._dragLog = Math.log(e);
- this.set(t, n);
-};
-
-Friction.prototype.configuration = function () {
- var e = this;
- return [{
- label: 'Friction',
- read: function read() {
- return e._drag;
- },
- write: function write(t) {
- e.reconfigure(t);
- },
- min: 0.001,
- max: 0.1,
- step: 0.001
- }];
-};
-
-/***/ }),
-
-/***/ "53f0":
-/***/ (function(module, exports, __webpack_require__) {
-
-// extracted by mini-css-extract-plugin
-
-/***/ }),
-
-/***/ "5408":
-/***/ (function(module, exports, __webpack_require__) {
-
-var map = {
- "./button/index.vue": "d3bd",
- "./canvas/index.vue": "bacd",
- "./checkbox-group/index.vue": "25ce",
- "./checkbox/index.vue": "7bb3",
- "./form/index.vue": "b34d",
- "./image/index.vue": "1082",
- "./input/index.vue": "250d",
- "./label/index.vue": "70f4",
- "./movable-area/index.vue": "c61c",
- "./movable-view/index.vue": "8842",
- "./navigator/index.vue": "17fd",
- "./picker-view-column/index.vue": "1955",
- "./picker-view/index.vue": "27ab",
- "./picker/index.vue": "c35d",
- "./progress/index.vue": "9b1f",
- "./radio-group/index.vue": "d5ec",
- "./radio/index.vue": "6491",
- "./resize-sensor/index.vue": "3e8c",
- "./rich-text/index.vue": "b705",
- "./scroll-view/index.vue": "f1ef",
- "./slider/index.vue": "9f96",
- "./swiper-item/index.vue": "9213",
- "./swiper/index.vue": "5513",
- "./switch/index.vue": "4f1c",
- "./text/index.vue": "4da7",
- "./textarea/index.vue": "5768",
- "./view/index.vue": "2bbe"
-};
-
-
-function webpackContext(req) {
- var id = webpackContextResolve(req);
- return __webpack_require__(id);
-}
-function webpackContextResolve(req) {
- var id = map[req];
- if(!(id + 1)) { // check for number or string
- var e = new Error("Cannot find module '" + req + "'");
- e.code = 'MODULE_NOT_FOUND';
- throw e;
- }
- return id;
-}
-webpackContext.keys = function webpackContextKeys() {
- return Object.keys(map);
-};
-webpackContext.resolve = webpackContextResolve;
-module.exports = webpackContext;
-webpackContext.id = "5408";
-
-/***/ }),
-
-/***/ "5513":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// EXTERNAL MODULE: ./src/core/view/mixins/touchtrack.js
-var touchtrack = __webpack_require__("ba15");
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/swiper/index.vue?vue&type=script&lang=js&
-//
-
-/* harmony default export */ var swipervue_type_script_lang_js_ = ({
- name: 'Swiper',
- mixins: [touchtrack["a" /* default */]],
- props: {
- indicatorDots: {
- type: [Boolean, String],
- default: false
- },
- vertical: {
- type: [Boolean, String],
- default: false
- },
- autoplay: {
- type: [Boolean, String],
- default: false
- },
- circular: {
- type: [Boolean, String],
- default: false
- },
- interval: {
- type: [Number, String],
- default: 5e3
- },
- duration: {
- type: [Number, String],
- default: 500
- },
- current: {
- type: [Number, String],
- default: 0
- },
- indicatorColor: {
- type: String,
- default: ''
- },
- indicatorActiveColor: {
- type: String,
- default: ''
- },
- previousMargin: {
- type: String,
- default: ''
- },
- nextMargin: {
- type: String,
- default: ''
- },
- currentItemId: {
- type: String,
- default: ''
- },
- skipHiddenItemLayout: {
- type: [Boolean, String],
- default: false
- },
- displayMultipleItems: {
- type: [Number, String],
- default: 1
- }
- },
- data: function data() {
- return {
- currentSync: Math.round(this.current) || 0,
- currentItemIdSync: this.currentItemId || '',
- userTracking: false,
- currentChangeSource: '',
- items: []
- };
- },
- computed: {
- intervalNumber: function intervalNumber() {
- var interval = Number(this.interval);
- return isNaN(interval) ? 5e3 : interval;
- },
- durationNumber: function durationNumber() {
- var duration = Number(this.duration);
- return isNaN(duration) ? 500 : duration;
- },
- displayMultipleItemsNumber: function displayMultipleItemsNumber() {
- var displayMultipleItems = Math.round(this.displayMultipleItems);
- return isNaN(displayMultipleItems) ? 1 : displayMultipleItems;
- },
- slidesStyle: function slidesStyle() {
- var style = {};
-
- if (this.nextMargin || this.previousMargin) {
- style = this.vertical ? {
- left: 0,
- right: 0,
- top: this._upx2px(this.previousMargin),
- bottom: this._upx2px(this.nextMargin)
- } : {
- top: 0,
- bottom: 0,
- left: this._upx2px(this.previousMargin),
- right: this._upx2px(this.nextMargin)
- };
- }
-
- return style;
- },
- slideFrameStyle: function slideFrameStyle() {
- var value = Math.abs(100 / this.displayMultipleItemsNumber) + '%';
- return {
- width: this.vertical ? '100%' : value,
- height: !this.vertical ? '100%' : value
- };
- },
- circularEnabled: function circularEnabled() {
- return this.circular && this.items.length > this.displayMultipleItemsNumber;
- }
- },
- watch: {
- vertical: function vertical() {
- this._resetLayout();
- },
- circular: function circular() {
- this._resetLayout();
- },
- intervalNumber: function intervalNumber(val) {
- if (this._timer) {
- this._cancelSchedule();
-
- this._scheduleAutoplay();
- }
- },
- current: function current(val) {
- this._currentCheck();
- },
- currentSync: function currentSync(val) {
- this._currentChanged(val);
-
- this.$emit('update:current', val);
- },
- currentItemId: function currentItemId(val) {
- this._currentCheck();
- },
- currentItemIdSync: function currentItemIdSync(val) {
- this.$emit('update:currentItemId', val);
- },
- displayMultipleItemsNumber: function displayMultipleItemsNumber() {
- this._resetLayout();
- }
- },
- created: function created() {
- this._invalid = true;
- this._viewportPosition = 0;
- this._viewportMoveRatio = 1;
- this._animating = null;
- this._requestedAnimation = false;
- this._userDirectionChecked = false;
- this._contentTrackViewport = 0;
- this._contentTrackSpeed = 0;
- this._contentTrackT = 0;
- },
- mounted: function mounted() {
- var _this = this;
-
- this._currentCheck();
-
- this.touchtrack(this.$refs.slidesWrapper, '_handleContentTrack', true);
-
- this._resetLayout();
-
- this.$watch(function () {
- return _this.autoplay && !_this.userTracking;
- }, this._inintAutoplay);
-
- this._inintAutoplay(this.autoplay && !this.userTracking);
-
- this.$watch('items.length', this._resetLayout);
- },
- beforeDestroy: function beforeDestroy() {
- this._cancelSchedule();
- },
- methods: {
- _inintAutoplay: function _inintAutoplay(enable) {
- if (enable) {
- this._scheduleAutoplay();
- } else {
- this._cancelSchedule();
- }
- },
-
- /**
- * 页面变更检查和同步
- */
- _currentCheck: function _currentCheck() {
- var current = -1;
-
- if (this.currentItemId) {
- for (var i = 0, items = this.items; i < items.length; i++) {
- var componentInstance = items[i].componentInstance;
-
- if (componentInstance && componentInstance.itemId === this.currentItemId) {
- current = i;
- break;
- }
- }
- }
-
- if (current < 0) {
- current = Math.round(this.current) || 0;
- }
-
- current = current < 0 ? 0 : current;
-
- if (this.currentSync !== current) {
- this.currentChangeSource = '';
- this.currentSync = current;
- }
- },
- _itemReady: function _itemReady(vnode, callback) {
- if (vnode.componentInstance && vnode.componentInstance._isMounted) {
- callback();
- } else {
- vnode._callbacks = vnode._callbacks || [];
-
- vnode._callbacks.push(callback);
- }
- },
-
- /**
- * 当前页面变更
- */
- _currentChanged: function _currentChanged(current) {
- var _this2 = this;
-
- var source = this.currentChangeSource;
- this.currentChangeSource = '';
-
- if (!source) {
- this._animateViewport(current, '', 0);
- }
-
- var item = this.items[current];
-
- if (item) {
- this._itemReady(item, function () {
- var currentItemId = _this2.currentItemIdSync = item.componentInstance.itemId || '';
-
- _this2.$trigger('change', {}, {
- current: _this2.currentSync,
- currentItemId: currentItemId,
- source: source
- });
- });
- }
- },
-
- /**
- * 自动播放
- */
- _scheduleAutoplay: function _scheduleAutoplay() {
- var self = this;
-
- this._cancelSchedule();
-
- function timer() {
- self._timer = null;
- self.currentChangeSource = 'autoplay';
-
- if (self.circularEnabled) {
- self.currentSync = self._normalizeCurrentValue(self.currentSync + 1);
- } else {
- self.currentSync = self.currentSync + self.displayMultipleItemsNumber < self.items.length ? self.currentSync + 1 : 0;
- }
-
- self._animateViewport(self.currentSync, 'autoplay', self.circularEnabled ? 1 : 0);
-
- self._timer = setTimeout(timer, self.intervalNumber);
- }
-
- if (!(!this._isMounted || this._invalid || this.items.length <= this.displayMultipleItemsNumber)) {
- this._timer = setTimeout(timer, this.intervalNumber);
- }
- },
-
- /**
- * 清除定时器
- */
- _cancelSchedule: function _cancelSchedule() {
- if (this._timer) {
- clearTimeout(this._timer);
- this._timer = null;
- }
- },
-
- /**
- * 检查当前页值
- */
- _normalizeCurrentValue: function _normalizeCurrentValue(current) {
- var length = this.items.length;
-
- if (!length) {
- return -1;
- }
-
- var index = (Math.round(current) % length + length) % length;
-
- if (this.circularEnabled) {
- if (length <= this.displayMultipleItemsNumber) {
- return 0;
- }
- } else if (index > length - this.displayMultipleItemsNumber) {
- return length - this.displayMultipleItemsNumber;
- }
-
- return index;
- },
- _upx2px: function _upx2px(val) {
- if (/\d+[ur]px$/i.test(val)) {
- val.replace(/\d+[ur]px$/i, function (text) {
- return "".concat(uni.upx2px(parseFloat(text)), "px");
- });
- }
-
- return val || '';
- },
-
- /**
- * 重新布局
- */
- _resetLayout: function _resetLayout() {
- if (this._isMounted) {
- this._cancelSchedule();
-
- this._endViewportAnimation();
-
- var items = this.items;
-
- for (var i = 0; i < items.length; i++) {
- this._updateItemPos(i, i);
- }
-
- this._viewportMoveRatio = 1;
-
- if (this.displayMultipleItemsNumber === 1 && items.length) {
- var itemRect = items[0].componentInstance.$el.getBoundingClientRect();
- var slideFrameRect = this.$refs.slideFrame.getBoundingClientRect();
- this._viewportMoveRatio = itemRect.width / slideFrameRect.width;
-
- if (!(this._viewportMoveRatio > 0 && this._viewportMoveRatio < 1)) {
- this._viewportMoveRatio = 1;
- }
- }
-
- var position = this._viewportPosition;
- this._viewportPosition = -2;
- var current = this.currentSync;
-
- if (current >= 0) {
- this._invalid = false;
-
- if (this.userTracking) {
- this._updateViewport(position + current - this._contentTrackViewport);
-
- this._contentTrackViewport = current;
- } else {
- this._updateViewport(current);
-
- if (this.autoplay) {
- this._scheduleAutoplay();
- }
- }
- } else {
- this._invalid = true;
-
- this._updateViewport(-this.displayMultipleItemsNumber - 1);
- }
- }
- },
- _checkCircularLayout: function _checkCircularLayout(e) {
- if (!this._invalid) {
- for (var items = this.items, n = items.length, i = e + this.displayMultipleItemsNumber, r = 0; r < n; r++) {
- var item = items[r];
- var _position = item._position;
- var s = Math.floor(e / n) * n + r;
- var l = s + n;
- var c = s - n;
- var u = Math.max(e - (s + 1), s - i, 0);
- var d = Math.max(e - (l + 1), l - i, 0);
- var h = Math.max(e - (c + 1), c - i, 0);
- var p = Math.min(u, d, h);
- var f = [s, l, c][[u, d, h].indexOf(p)];
-
- if (_position !== f) {
- this._updateItemPos(r, f);
- }
- }
- }
- },
- _updateItemPos: function _updateItemPos(current, position) {
- var x = this.vertical ? '0' : 100 * position + '%';
- var y = this.vertical ? 100 * position + '%' : '0';
- var transform = 'translate(' + x + ', ' + y + ') translateZ(0)';
- var item = this.items[current];
-
- this._itemReady(item, function () {
- var el = item.componentInstance.$el;
- el.style['-webkit-transform'] = transform;
- el.style.transform = transform;
- el._position = position;
- });
- },
- _updateViewport: function _updateViewport(index) {
- if (!(Math.floor(2 * this._viewportPosition) === Math.floor(2 * index) && Math.ceil(2 * this._viewportPosition) === Math.ceil(2 * index))) {
- if (this.circularEnabled) {
- this._checkCircularLayout(index);
- }
- }
-
- var x = this.vertical ? '0' : 100 * -index * this._viewportMoveRatio + '%';
- var y = this.vertical ? 100 * -index * this._viewportMoveRatio + '%' : '0';
- var transform = 'translate(' + x + ', ' + y + ') translateZ(0)';
- var slideFrame = this.$refs.slideFrame;
-
- if (slideFrame) {
- slideFrame.style['-webkit-transform'] = transform;
- slideFrame.style.transform = transform;
- }
-
- this._viewportPosition = index;
- },
- _animateFrameFuncProto: function _animateFrameFuncProto() {
- var _this3 = this;
-
- if (!this._animating) {
- this._requestedAnimation = false;
- return;
- }
-
- var _animating = this._animating;
- var toPos = _animating.toPos;
- var acc = _animating.acc;
- var endTime = _animating.endTime;
- var source = _animating.source;
- var time = endTime - Date.now();
-
- if (time <= 0) {
- this._updateViewport(toPos);
-
- this._animating = null;
- this._requestedAnimation = false;
- var item = this.items[this.currentSync];
-
- if (item) {
- this._itemReady(item, function () {
- var currentItemId = item.componentInstance.itemId || '';
-
- _this3.$trigger('animationfinish', {}, {
- current: _this3.currentSync,
- currentItemId: currentItemId,
- source: source
- });
- });
- }
-
- return;
- }
-
- var s = acc * time * time / 2;
- var l = toPos + s;
-
- this._updateViewport(l);
-
- requestAnimationFrame(this._animateFrameFuncProto.bind(this));
- },
- _animateViewport: function _animateViewport(current, source, n) {
- this._cancelViewportAnimation();
-
- var duration = this.durationNumber;
- var length = this.items.length;
- var position = this._viewportPosition;
-
- if (this.circularEnabled) {
- if (n < 0) {
- for (; position < current;) {
- position += length;
- }
-
- for (; position - length > current;) {
- position -= length;
- }
- } else if (n > 0) {
- for (; position > current;) {
- position -= length;
- }
-
- for (; position + length < current;) {
- position += length;
- }
- } else {
- for (; position + length < current;) {
- position += length;
- }
-
- for (; position - length > current;) {
- position -= length;
- }
-
- if (position + length - current < current - position) {
- position += length;
- }
- }
- }
-
- this._animating = {
- toPos: current,
- acc: 2 * (position - current) / (duration * duration),
- endTime: Date.now() + duration,
- source: source
- };
-
- if (!this._requestedAnimation) {
- this._requestedAnimation = true;
- requestAnimationFrame(this._animateFrameFuncProto.bind(this));
- }
- },
- _cancelViewportAnimation: function _cancelViewportAnimation() {
- this._animating = null;
- },
-
- /**
- * 结束动画
- */
- _endViewportAnimation: function _endViewportAnimation() {
- if (this._animating) {
- this._updateViewport(this._animating.toPos);
-
- this._animating = null;
- }
- },
- _handleTrackStart: function _handleTrackStart() {
- this._cancelSchedule();
-
- this._contentTrackViewport = this._viewportPosition;
- this._contentTrackSpeed = 0;
- this._contentTrackT = Date.now();
-
- this._cancelViewportAnimation();
- },
- _handleTrackMove: function _handleTrackMove(data) {
- var self = this;
- var contentTrackT = this._contentTrackT;
- this._contentTrackT = Date.now();
- var length = this.items.length;
- var other = length - this.displayMultipleItemsNumber;
-
- function calc(val) {
- return 0.5 - 0.25 / (val + 0.5);
- }
-
- function move(oldVal, newVal) {
- var val = self._contentTrackViewport + oldVal;
- self._contentTrackSpeed = 0.6 * self._contentTrackSpeed + 0.4 * newVal;
-
- if (!self.circularEnabled) {
- if (val < 0 || val > other) {
- if (val < 0) {
- val = -calc(-val);
- } else {
- if (val > other) {
- val = other + calc(val - other);
- }
- }
-
- self._contentTrackSpeed = 0;
- }
- }
-
- self._updateViewport(val);
- }
-
- var time = this._contentTrackT - contentTrackT || 1;
-
- if (this.vertical) {
- move(-data.dy / this.$refs.slideFrame.offsetHeight, -data.ddy / time);
- } else {
- move(-data.dx / this.$refs.slideFrame.offsetWidth, -data.ddx / time);
- }
- },
- _handleTrackEnd: function _handleTrackEnd(isCancel) {
- this.userTracking = false;
- var t = this._contentTrackSpeed / Math.abs(this._contentTrackSpeed);
- var n = 0;
-
- if (!isCancel && Math.abs(this._contentTrackSpeed) > 0.2) {
- n = 0.5 * t;
- }
-
- var current = this._normalizeCurrentValue(this._viewportPosition + n);
-
- if (isCancel) {
- this._updateViewport(this._contentTrackViewport);
- } else {
- this.currentChangeSource = 'touch';
- this.currentSync = current;
-
- this._animateViewport(current, 'touch', n !== 0 ? n : current === 0 && this.circularEnabled && this._viewportPosition >= 1 ? 1 : 0);
- }
- },
- _handleContentTrack: function _handleContentTrack(e) {
- if (!this._invalid) {
- if (e.detail.state === 'start') {
- this.userTracking = true;
- this._userDirectionChecked = false;
- return this._handleTrackStart();
- } // fixed by xxxxxx
-
-
- if (e.detail.state === 'end') {
- return this._handleTrackEnd(false);
- }
-
- if (e.detail.state === 'cancel') {
- return this._handleTrackEnd(true);
- }
-
- if (this.userTracking) {
- if (!this._userDirectionChecked) {
- this._userDirectionChecked = true;
- var t = Math.abs(e.detail.dx);
- var n = Math.abs(e.detail.dy);
-
- if (t >= n && this.vertical) {
- this.userTracking = false;
- } else {
- if (t <= n && !this.vertical) {
- this.userTracking = false;
- }
- }
-
- if (!this.userTracking) {
- if (this.autoplay) {
- this._scheduleAutoplay();
- }
-
- return;
- }
- }
-
- this._handleTrackMove(e.detail);
-
- return false;
- }
- }
- }
- },
- render: function render(createElement) {
- var slidesDots = [];
- var swiperItems = [];
-
- if (this.$slots.default) {
- this.$slots.default.forEach(function (vnode) {
- if (vnode.componentOptions && vnode.componentOptions.tag === 'v-uni-swiper-item') {
- swiperItems.push(vnode);
- }
- });
- }
-
- for (var index = 0, length = swiperItems.length; index < length; index++) {
- var currentSync = this.currentSync;
- slidesDots.push(createElement('div', {
- class: {
- 'uni-swiper-dot': true,
- 'uni-swiper-dot-active': index < currentSync + this.displayMultipleItemsNumber && index >= currentSync || index < currentSync + this.displayMultipleItemsNumber - length
- },
- style: {
- 'background': index === currentSync ? this.indicatorActiveColor : this.indicatorColor
- }
- }));
- }
-
- this.items = swiperItems;
- var slidesWrapperChild = [createElement('div', {
- ref: 'slides',
- style: this.slidesStyle,
- 'class': 'uni-swiper-slides'
- }, [createElement('div', {
- ref: 'slideFrame',
- class: 'uni-swiper-slide-frame',
- style: this.slideFrameStyle
- }, swiperItems)])];
-
- if (this.indicatorDots) {
- slidesWrapperChild.push(createElement('div', {
- ref: 'slidesDots',
- 'class': ['uni-swiper-dots', this.vertical ? 'uni-swiper-dots-vertical' : 'uni-swiper-dots-horizontal']
- }, slidesDots));
- }
-
- return createElement('uni-swiper', [createElement('div', {
- ref: 'slidesWrapper',
- 'class': 'uni-swiper-wrapper',
- on: this.$listeners
- }, slidesWrapperChild)]);
- }
-});
-// CONCATENATED MODULE: ./src/core/view/components/swiper/index.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_swipervue_type_script_lang_js_ = (swipervue_type_script_lang_js_);
-// EXTERNAL MODULE: ./src/core/view/components/swiper/index.vue?vue&type=style&index=0&lang=css&
-var swipervue_type_style_index_0_lang_css_ = __webpack_require__("1c64");
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js
-var componentNormalizer = __webpack_require__("0c7c");
-
-// CONCATENATED MODULE: ./src/core/view/components/swiper/index.vue
-var render, staticRenderFns
-
-
-
-
-
-/* normalize component */
-
-var component = Object(componentNormalizer["a" /* default */])(
- components_swipervue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- null,
- null,
- null
-
-)
-
-/* harmony default export */ var swiper = __webpack_exports__["default"] = (component.exports);
-
-/***/ }),
-
-/***/ "5676":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("0950");
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
-/* unused harmony reexport * */
- /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
-
-/***/ }),
-
-/***/ "5727":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("d60d");
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
-/* unused harmony reexport * */
- /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
-
-/***/ }),
-
-/***/ "5768":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"120ddde1-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/textarea/index.vue?vue&type=template&id=28361ab8&
-var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('uni-textarea',_vm._g({attrs:{"value":_vm._checkEmpty(_vm.value),"maxlength":_vm.maxlengthNumber,"placeholder":_vm._checkEmpty(_vm.placeholder),"disabled":_vm.disabled,"focus":_vm.focus,"auto-focus":_vm.autoFocus,"placeholder-class":_vm._checkEmpty(_vm.placeholderClass),"placeholder-style":_vm._checkEmpty(_vm.placeholderStyle),"auto-height":_vm.autoHeight,"cursor":_vm.cursorNumber,"selection-start":_vm.selectionStartNumber,"selection-end":_vm.selectionEndNumber}},_vm.$listeners),[_c('div',{staticClass:"uni-textarea-wrapper"},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(!(_vm.composition||_vm.valueSync.length)),expression:"!(composition||valueSync.length)"}],ref:"placeholder",staticClass:"uni-textarea-placeholder",class:_vm.placeholderClass,style:(_vm.placeholderStyle)},[_vm._v(_vm._s(_vm.placeholder))]),_c('div',{staticClass:"uni-textarea-compute"},[_vm._l((_vm.valueCompute),function(item,index){return _c('div',{key:index},[_vm._v(_vm._s(item.trim() ? item : '.'))])}),_c('v-uni-resize-sensor',{ref:"sensor",on:{"resize":_vm._resize}})],2),_c('textarea',{directives:[{name:"model",rawName:"v-model",value:(_vm.valueSync),expression:"valueSync"}],ref:"textarea",staticClass:"uni-textarea-textarea",class:{'uni-textarea-textarea-ios': _vm.isIOS},attrs:{"disabled":_vm.disabled,"maxlength":_vm.maxlengthNumber,"autofocus":_vm.autoFocus},domProps:{"value":(_vm.valueSync)},on:{"compositionstart":_vm._compositionstart,"compositionend":_vm._compositionend,"input":[function($event){if($event.target.composing){ return; }_vm.valueSync=$event.target.value},function($event){$event.stopPropagation();return _vm._input($event)}],"focus":_vm._focus,"blur":_vm._blur,"&touchstart":function($event){return _vm._touchstart($event)}}})])])}
-var staticRenderFns = []
-
-
-// CONCATENATED MODULE: ./src/core/view/components/textarea/index.vue?vue&type=template&id=28361ab8&
-
-// EXTERNAL MODULE: ./src/core/view/mixins/index.js + 1 modules
-var mixins = __webpack_require__("8af1");
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/core/view/components/textarea/index.vue?vue&type=script&lang=js&
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-
-/* harmony default export */ var textareavue_type_script_lang_js_ = ({
- name: 'Textarea',
- mixins: [mixins["a" /* emitter */]],
- model: {
- prop: 'value',
- event: 'update:value'
- },
- props: {
- name: {
- type: String,
- default: ''
- },
- value: {
- type: [String, Number],
- default: ''
- },
- maxlength: {
- type: [Number, String],
- default: 140
- },
- placeholder: {
- type: String,
- default: ''
- },
- disabled: {
- type: [Boolean, String],
- default: false
- },
- focus: {
- type: [Boolean, String],
- default: false
- },
- autoFocus: {
- type: [Boolean, String],
- default: false
- },
- placeholderClass: {
- type: String,
- default: ''
- },
- placeholderStyle: {
- type: String,
- default: ''
- },
- autoHeight: {
- type: [Boolean, String],
- default: false
- },
- cursor: {
- type: [Number, String],
- default: -1
- },
- selectionStart: {
- type: [Number, String],
- default: -1
- },
- selectionEnd: {
- type: [Number, String],
- default: -1
- }
- },
- data: function data() {
- return {
- valueSync: String(this.value),
- valueComposition: '',
- composition: false,
- focusSync: this.focus,
- height: 0,
- focusChangeSource: '',
- isIOS: String(navigator.platform).indexOf('iP') === 0 && String(navigator.vendor).indexOf('Apple') === 0
- };
- },
- computed: {
- maxlengthNumber: function maxlengthNumber() {
- var maxlength = Number(this.maxlength);
- return isNaN(maxlength) ? 140 : maxlength;
- },
- cursorNumber: function cursorNumber() {
- var cursor = Number(this.cursor);
- return isNaN(cursor) ? -1 : cursor;
- },
- selectionStartNumber: function selectionStartNumber() {
- var selectionStart = Number(this.selectionStart);
- return isNaN(selectionStart) ? -1 : selectionStart;
- },
- selectionEndNumber: function selectionEndNumber() {
- var selectionEnd = Number(this.selectionEnd);
- return isNaN(selectionEnd) ? -1 : selectionEnd;
- },
- valueCompute: function valueCompute() {
- return (this.composition ? this.valueComposition : this.valueSync).split('\n');
- }
- },
- watch: {
- value: function value(val) {
- this.valueSync = String(val);
- },
- valueSync: function valueSync(val) {
- if (val !== this._oldValue) {
- this._oldValue = val;
- this.$trigger('input', {}, {
- value: val,
- cursor: this.$refs.textarea.selectionEnd
- });
- this.$emit('update:value', val);
- }
- },
- focus: function focus(val) {
- if (val) {
- this.focusChangeSource = 'focus';
-
- if (this.$refs.textarea) {
- this.$refs.textarea.focus();
- }
- } else {
- if (this.$refs.textarea) {
- this.$refs.textarea.blur();
- }
- }
- },
- focusSync: function focusSync(val) {
- this.$emit('update:focus', val);
-
- this._checkSelection();
-
- this._checkCursor();
- },
- cursorNumber: function cursorNumber() {
- this._checkCursor();
- },
- selectionStartNumber: function selectionStartNumber() {
- this._checkSelection();
- },
- selectionEndNumber: function selectionEndNumber() {
- this._checkSelection();
- },
- height: function height(_height) {
- var lineHeight = getComputedStyle(this.$el).lineHeight.replace('px', '');
- var lineCount = Math.round(_height / lineHeight);
- this.$trigger('linechange', {}, {
- height: _height,
- heightRpx: 750 / window.innerWidth * _height,
- lineCount: lineCount
- });
-
- if (this.autoHeight) {
- this.$el.style.height = this.height + 'px';
- }
- }
- },
- created: function created() {
- this.$dispatch('Form', 'uni-form-group-update', {
- type: 'add',
- vm: this
- });
- },
- mounted: function mounted() {
- this._oldValue = this.$refs.textarea.value = this.valueSync;
-
- this._resize({
- height: this.$refs.sensor.$el.offsetHeight
- });
- },
- beforeDestroy: function beforeDestroy() {
- this.$dispatch('Form', 'uni-form-group-update', {
- type: 'remove',
- vm: this
- });
- },
- methods: {
- _focus: function _focus($event) {
- this.focusSync = true;
- this.$trigger('focus', $event, {
- value: this.valueSync
- });
- },
- _checkSelection: function _checkSelection() {
- if (this.focusSync && !this.focusChangeSource && this.selectionStartNumber > -1 && this.selectionEndNumber > -1) {
- this.$refs.textarea.selectionStart = this.selectionStartNumber;
- this.$refs.textarea.selectionEnd = this.selectionEndNumber;
- }
- },
- _checkCursor: function _checkCursor() {
- if (this.focusSync && (this.focusChangeSource === 'focus' || !this.focusChangeSource && this.selectionStartNumber < 0 && this.selectionEndNumber < 0) && this.cursorNumber > -1) {
- this.$refs.textarea.selectionEnd = this.$refs.textarea.selectionStart = this.cursorNumber;
- }
- },
- _blur: function _blur($event) {
- this.focusSync = false;
- this.$trigger('blur', $event, {
- value: this.valueSync,
- cursor: this.$refs.textarea.selectionEnd
- });
- },
- _compositionstart: function _compositionstart($event) {
- this.composition = true;
- },
- _compositionend: function _compositionend($event) {
- this.composition = false;
- },
- // 暂无完成按钮,此功能未实现
- _confirm: function _confirm($event) {
- this.$trigger('confirm', $event, {
- value: this.valueSync
- });
- },
- _linechange: function _linechange($event) {
- this.$trigger('linechange', $event, {
- value: this.valueSync
- });
- },
- _touchstart: function _touchstart() {
- this.focusChangeSource = 'touch';
- },
- _resize: function _resize(_ref) {
- var height = _ref.height;
- this.height = height;
- },
- _input: function _input($event) {
- if (this.composition) {
- this.valueComposition = $event.target.value;
- }
- },
- _getFormData: function _getFormData() {
- return {
- value: this.valueSync,
- key: this.name
- };
- },
- _resetFormData: function _resetFormData() {
- this.valueSync = '';
- },
- _checkEmpty: function _checkEmpty(str) {
- return str || false;
- }
- }
-});
-// CONCATENATED MODULE: ./src/core/view/components/textarea/index.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_textareavue_type_script_lang_js_ = (textareavue_type_script_lang_js_);
-// EXTERNAL MODULE: ./src/core/view/components/textarea/index.vue?vue&type=style&index=0&lang=css&
-var textareavue_type_style_index_0_lang_css_ = __webpack_require__("9400");
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js
-var componentNormalizer = __webpack_require__("0c7c");
-
-// CONCATENATED MODULE: ./src/core/view/components/textarea/index.vue
-
-
-
-
-
-
-/* normalize component */
-
-var component = Object(componentNormalizer["a" /* default */])(
- components_textareavue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- null,
- null,
- null
-
-)
-
-/* harmony default export */ var components_textarea = __webpack_exports__["default"] = (component.exports);
-
-/***/ }),
-
-/***/ "580e":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var _system_header__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("bab8");
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-
-/* harmony default export */ __webpack_exports__["a"] = ({
- name: 'SystemChooseLocation',
- components: {
- SystemHeader: _system_header__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]
- },
- data: function data() {
- return {
- src: '',
- data: null
- };
- },
- mounted: function mounted() {
- var _this = this;
-
- var key = __uniConfig.qqMapKey;
- this.src = "https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=".concat(key, "&referer=uniapp");
- window.addEventListener('message', function (event) {
- var loc = event.data;
-
- if (loc && loc.module === 'locationPicker') {
- _this.data = {
- name: loc.poiname,
- address: loc.poiaddress,
- latitude: loc.latlng.lat,
- longitude: loc.latlng.lng
- };
- }
- }, false);
- },
- methods: {
- _choose: function _choose() {
- if (this.data) {
- UniViewJSBridge.publishHandler('onChooseLocation', this.data);
- getApp().$router.back();
- }
- },
- _back: function _back() {
- UniViewJSBridge.publishHandler('onChooseLocation', null);
- getApp().$router.back();
- }
- }
-});
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("501c")))
-
-/***/ }),
-
-/***/ "594d":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"120ddde1-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/platforms/h5/view/components/map/index.vue?vue&type=template&id=a133ab6e&
-var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('uni-map',{attrs:{"id":_vm.id}},[_c('div',{ref:"map",staticStyle:{"width":"100%","height":"100%","position":"relative","overflow":"hidden"}}),_c('div',{staticStyle:{"position":"absolute","top":"0","width":"100%","height":"100%","overflow":"hidden","pointer-events":"none"}},[_vm._t("default")],2)])}
-var staticRenderFns = []
-
-
-// CONCATENATED MODULE: ./src/platforms/h5/view/components/map/index.vue?vue&type=template&id=a133ab6e&
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-service/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/platforms/h5/view/components/map/index.vue?vue&type=script&lang=js&
-var mapvue_type_script_lang_js_ = __webpack_require__("635e");
-
-// CONCATENATED MODULE: ./src/platforms/h5/view/components/map/index.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_mapvue_type_script_lang_js_ = (mapvue_type_script_lang_js_["a" /* default */]);
-// EXTERNAL MODULE: ./src/platforms/h5/view/components/map/index.vue?vue&type=style&index=0&lang=css&
-var mapvue_type_style_index_0_lang_css_ = __webpack_require__("3f7e");
-
-// EXTERNAL MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js
-var componentNormalizer = __webpack_require__("0c7c");
-
-// CONCATENATED MODULE: ./src/platforms/h5/view/components/map/index.vue
-
-
-
-
-
-
-/* normalize component */
-
-var component = Object(componentNormalizer["a" /* default */])(
- components_mapvue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- null,
- null,
- null
-
-)
-
-/* harmony default export */ var map = __webpack_exports__["default"] = (component.exports);
-
-/***/ }),
-
-/***/ "5a56":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony default export */ __webpack_exports__["default"] = ({
- methods: {
- beforeTransition: function beforeTransition() {},
- afterTransition: function afterTransition() {}
- }
-});
-
-/***/ }),
-
-/***/ "5ab3":
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("fcd8");
-/* harmony import */ var _node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
-/* unused harmony reexport * */
- /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_cli_service_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_vue_cli_service_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_cli_service_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_cli_service_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
-
-/***/ }),
-
-/***/ "5abe":
-/***/ (function(module, exports) {
-
-/**
- * Copyright 2016 Google Inc. All Rights Reserved.
- *
- * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.
- *
- * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
- *
- */
-(function() {
-'use strict';
-
-// Exit early if we're not running in a browser.
-if (typeof window !== 'object') {
- return;
-}
-
-// Exit early if all IntersectionObserver and IntersectionObserverEntry
-// features are natively supported.
-if ('IntersectionObserver' in window &&
- 'IntersectionObserverEntry' in window &&
- 'intersectionRatio' in window.IntersectionObserverEntry.prototype) {
-
- // Minimal polyfill for Edge 15's lack of `isIntersecting`
- // See: https://github.com/w3c/IntersectionObserver/issues/211
- if (!('isIntersecting' in window.IntersectionObserverEntry.prototype)) {
- Object.defineProperty(window.IntersectionObserverEntry.prototype,
- 'isIntersecting', {
- get: function () {
- return this.intersectionRatio > 0;
- }
- });
- }
- return;
-}
-
-
-/**
- * A local reference to the document.
- */
-var document = window.document;
-
-
-/**
- * An IntersectionObserver registry. This registry exists to hold a strong
- * reference to IntersectionObserver instances currently observing a target
- * element. Without this registry, instances without another reference may be
- * garbage collected.
- */
-var registry = [];
-
-
-/**
- * Creates the global IntersectionObserverEntry constructor.
- * https://w3c.github.io/IntersectionObserver/#intersection-observer-entry
- * @param {Object} entry A dictionary of instance properties.
- * @constructor
- */
-function IntersectionObserverEntry(entry) {
- this.time = entry.time;
- this.target = entry.target;
- this.rootBounds = entry.rootBounds;
- this.boundingClientRect = entry.boundingClientRect;
- this.intersectionRect = entry.intersectionRect || getEmptyRect();
- this.isIntersecting = !!entry.intersectionRect;
-
- // Calculates the intersection ratio.
- var targetRect = this.boundingClientRect;
- var targetArea = targetRect.width * targetRect.height;
- var intersectionRect = this.intersectionRect;
- var intersectionArea = intersectionRect.width * intersectionRect.height;
-
- // Sets intersection ratio.
- if (targetArea) {
- // Round the intersection ratio to avoid floating point math issues:
- // https://github.com/w3c/IntersectionObserver/issues/324
- this.intersectionRatio = Number((intersectionArea / targetArea).toFixed(4));
- } else {
- // If area is zero and is intersecting, sets to 1, otherwise to 0
- this.intersectionRatio = this.isIntersecting ? 1 : 0;
- }
-}
-
-
-/**
- * Creates the global IntersectionObserver constructor.
- * https://w3c.github.io/IntersectionObserver/#intersection-observer-interface
- * @param {Function} callback The function to be invoked after intersection
- * changes have queued. The function is not invoked if the queue has
- * been emptied by calling the `takeRecords` method.
- * @param {Object=} opt_options Optional configuration options.
- * @constructor
- */
-function IntersectionObserver(callback, opt_options) {
-
- var options = opt_options || {};
-
- if (typeof callback != 'function') {
- throw new Error('callback must be a function');
- }
-
- if (options.root && options.root.nodeType != 1) {
- throw new Error('root must be an Element');
- }
-
- // Binds and throttles `this._checkForIntersections`.
- this._checkForIntersections = throttle(
- this._checkForIntersections.bind(this), this.THROTTLE_TIMEOUT);
-
- // Private properties.
- this._callback = callback;
- this._observationTargets = [];
- this._queuedEntries = [];
- this._rootMarginValues = this._parseRootMargin(options.rootMargin);
-
- // Public properties.
- this.thresholds = this._initThresholds(options.threshold);
- this.root = options.root || null;
- this.rootMargin = this._rootMarginValues.map(function(margin) {
- return margin.value + margin.unit;
- }).join(' ');
-}
-
-
-/**
- * The minimum interval within which the document will be checked for
- * intersection changes.
- */
-IntersectionObserver.prototype.THROTTLE_TIMEOUT = 100;
-
-
-/**
- * The frequency in which the polyfill polls for intersection changes.
- * this can be updated on a per instance basis and must be set prior to
- * calling `observe` on the first target.
- */
-IntersectionObserver.prototype.POLL_INTERVAL = null;
-
-/**
- * Use a mutation observer on the root element
- * to detect intersection changes.
- */
-IntersectionObserver.prototype.USE_MUTATION_OBSERVER = true;
-
-
-/**
- * Starts observing a target element for intersection changes based on
- * the thresholds values.
- * @param {Element} target The DOM element to observe.
- */
-IntersectionObserver.prototype.observe = function(target) {
- var isTargetAlreadyObserved = this._observationTargets.some(function(item) {
- return item.element == target;
- });
-
- if (isTargetAlreadyObserved) {
- return;
- }
-
- if (!(target && target.nodeType == 1)) {
- throw new Error('target must be an Element');
- }
-
- this._registerInstance();
- this._observationTargets.push({element: target, entry: null});
- this._monitorIntersections();
- this._checkForIntersections();
-};
-
-
-/**
- * Stops observing a target element for intersection changes.
- * @param {Element} target The DOM element to observe.
- */
-IntersectionObserver.prototype.unobserve = function(target) {
- this._observationTargets =
- this._observationTargets.filter(function(item) {
-
- return item.element != target;
- });
- if (!this._observationTargets.length) {
- this._unmonitorIntersections();
- this._unregisterInstance();
- }
-};
-
-
-/**
- * Stops observing all target elements for intersection changes.
- */
-IntersectionObserver.prototype.disconnect = function() {
- this._observationTargets = [];
- this._unmonitorIntersections();
- this._unregisterInstance();
-};
-
-
-/**
- * Returns any queue entries that have not yet been reported to the
- * callback and clears the queue. This can be used in conjunction with the
- * callback to obtain the absolute most up-to-date intersection information.
- * @return {Array} The currently queued entries.
- */
-IntersectionObserver.prototype.takeRecords = function() {
- var records = this._queuedEntries.slice();
- this._queuedEntries = [];
- return records;
-};
-
-
-/**
- * Accepts the threshold value from the user configuration object and
- * returns a sorted array of unique threshold values. If a value is not
- * between 0 and 1 and error is thrown.
- * @private
- * @param {Array|number=} opt_threshold An optional threshold value or
- * a list of threshold values, defaulting to [0].
- * @return {Array} A sorted list of unique and valid threshold values.
- */
-IntersectionObserver.prototype._initThresholds = function(opt_threshold) {
- var threshold = opt_threshold || [0];
- if (!Array.isArray(threshold)) threshold = [threshold];
-
- return threshold.sort().filter(function(t, i, a) {
- if (typeof t != 'number' || isNaN(t) || t < 0 || t > 1) {
- throw new Error('threshold must be a number between 0 and 1 inclusively');
- }
- return t !== a[i - 1];
- });
-};
-
-
-/**
- * Accepts the rootMargin value from the user configuration object
- * and returns an array of the four margin values as an object containing
- * the value and unit properties. If any of the values are not properly
- * formatted or use a unit other than px or %, and error is thrown.
- * @private
- * @param {string=} opt_rootMargin An optional rootMargin value,
- * defaulting to '0px'.
- * @return {Array