提交 cd1f517f 编写于 作者: fxy060608's avatar fxy060608

Merge branch 'dev' of https://github.com/dcloudio/uni-app into dev-quickapp

......@@ -8,7 +8,7 @@ const genConfig = require('./rollup.config.qa')
const filename = 'vue.' + (process.env.NODE_ENV === 'production' ? 'prod' : 'dev') + '.js'
async function build() {
async function build () {
const bridgeBundle = await rollup.rollup(genConfig('bridge'))
const {
output: bridgeOutput
......@@ -66,7 +66,7 @@ dsl.onInitApp(function({
del.sync([componentsDest])
copy(componentsSrc, componentsDest, function(err, file) {
copy(componentsSrc, componentsDest, function (err, file) {
if (err) {
throw err
}
......
......@@ -12,7 +12,7 @@ const external = []
const resolve = dir => path.resolve(__dirname, '../', dir)
function replaceModuleImport(str) {
function replaceModuleImport (str) {
return str.replace(
/require\s*\(\s*(['"])@([\w$_][\w$-.]*?)\1\)/gm,
(e, r, p) => `$app_require$(${r}@app-module/${p}${r})`
......@@ -23,37 +23,37 @@ function replaceModuleImport(str) {
}
const plugins = [{
name: 'replaceModuleImport',
transform(source) {
return {
code: replaceModuleImport(source)
}
name: 'replaceModuleImport',
transform (source) {
return {
code: replaceModuleImport(source)
}
},
alias({
'uni-core': resolve('src/core'),
'uni-platform': resolve('src/platforms/quickapp-vue'),
'uni-platforms': resolve('src/platforms'),
'uni-shared': resolve('src/shared/index.js'),
'uni-helpers': resolve('src/core/helpers'),
'uni-invoke-api': resolve('src/platforms/quickapp-vue/service/invoke-api'),
'uni-service-api': resolve('src/platforms/quickapp-vue/service/api'),
'uni-api-protocol': resolve('src/core/helpers/protocol')
}),
nodeResolve(),
requireContext(),
commonjs(),
replace({
__PLATFORM__: JSON.stringify(process.env.UNI_PLATFORM),
__PLATFORM_TITLE__: '快应用(Vue)版'
})
}
},
alias({
'uni-core': resolve('src/core'),
'uni-platform': resolve('src/platforms/quickapp-vue'),
'uni-platforms': resolve('src/platforms'),
'uni-shared': resolve('src/shared/index.js'),
'uni-helpers': resolve('src/core/helpers'),
'uni-invoke-api': resolve('src/platforms/quickapp-vue/service/invoke-api'),
'uni-service-api': resolve('src/platforms/quickapp-vue/service/api'),
'uni-api-protocol': resolve('src/core/helpers/protocol')
}),
nodeResolve(),
requireContext(),
commonjs(),
replace({
__PLATFORM__: JSON.stringify(process.env.UNI_PLATFORM),
__PLATFORM_TITLE__: '快应用(Vue)版'
})
]
// if (process.env.NODE_ENV === 'production') {
plugins.push(terser.terser())
// }
module.exports = function(type) {
module.exports = function (type) {
let input = ''
if (type === 'bridge') {
......
......@@ -27,7 +27,7 @@
"build:mp-weixin:mp": "npm run lint && cross-env UNI_PLATFORM=mp-weixin UNI_MP=true rollup -c build/rollup.config.mp.js",
"build:mp-weixin:wxs": "rollup -c build/rollup.config.wxs.js",
"build:quickapp-vue": "cross-env NODE_ENV=development node build/build.qa.js && cross-env NODE_ENV=production node build/build.qa.js",
"build:runtime": "npm run lint && npm run build:mp-weixin && npm run build:mp-qq && npm run build:mp-alipay && npm run build:mp-baidu && npm run build:mp-toutiao && npm run build:app-plus",
"build:runtime": "npm run lint && npm run build:mp-weixin && npm run build:mp-qq && npm run build:mp-alipay && npm run build:mp-baidu && npm run build:mp-toutiao && npm run build:app-plus && npm run build:quickapp-light",
"build:stat": "npm run lint && rollup -c build/rollup.config.stat.js",
"build:web-view": "npm run lint && rollup -c build/rollup.config.web-view.js",
"test:cli": "cross-env NODE_ENV=test jest",
......
......@@ -231,13 +231,13 @@ const promiseInterceptor = {
};
const SYNC_API_RE =
/^\$|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
/^\$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/;
const ASYNC_API = ['createBLEConnection'];
const CALLBACK_API_RE = /^on/;
const CALLBACK_API_RE = /^on|^off/;
function isContextApi (name) {
return CONTEXT_API_RE.test(name)
......
......@@ -1415,6 +1415,9 @@ var serviceContext = (function () {
value = (value || '').toLowerCase();
params.responseType = Object.values(responseType).indexOf(value) < 0 ? responseType.TEXT : value;
}
},
withCredentials: {
type: Boolean
}
};
......@@ -3020,7 +3023,7 @@ var serviceContext = (function () {
function createAudioInstance () {
const audioId = `${Date.now()}${Math.random()}`;
const audio = audios[audioId] = plus.audio.createPlayer('');
const audio = audios[audioId] = plus.audio.createPlayer('');
audio.src = '';
audio.volume = 1;
audio.startTime = 0;
......@@ -3094,7 +3097,7 @@ var serviceContext = (function () {
errMsg: 'getAudioState:ok',
duration: 1e3 * (audio.getDuration() || 0),
currentTime: audio.isStopped ? 0 : 1e3 * audio.getPosition(),
paused: audio.isPaused,
paused: audio.isPaused(),
src,
volume,
startTime: 1e3 * startTime,
......@@ -3110,7 +3113,7 @@ var serviceContext = (function () {
const audio = audios[audioId];
const operationTypes = ['play', 'pause', 'stop'];
if (operationTypes.indexOf(operationType) >= 0) {
audio[operationType === operationTypes[0] && audio.isPaused ? 'resume' : operationType]();
audio[operationType === operationTypes[0] && audio.isPaused() ? 'resume' : operationType]();
} else if (operationType === 'seek') {
audio.seekTo(currentTime / 1e3);
}
......@@ -3119,9 +3122,9 @@ var serviceContext = (function () {
}
}
let audio;
let timeUpdateTimer = null;
let audio;
let timeUpdateTimer = null;
const TIME_UPDATE = 250;
const publishBackgroundAudioStateChange = (state, res = {}) => publish('onBackgroundAudioStateChange', Object.assign({
......@@ -3144,15 +3147,15 @@ var serviceContext = (function () {
audio.addEventListener(event, () => {
// 添加 isStopped 属性是为了解决 安卓设备停止播放后获取播放进度不正确的问题
if (event === 'play') {
audio.isStopped = false;
audio.isStopped = false;
startTimeUpdateTimer();
} else if (event === 'stop') {
audio.isStopped = true;
}
if (event === 'pause' || event === 'ended' || event === 'stop') {
stopTimeUpdateTimer();
}
}
if (event === 'pause' || event === 'ended' || event === 'stop') {
stopTimeUpdateTimer();
}
const eventName = `onMusic${event[0].toUpperCase() + event.substr(1)}`;
publish(eventName, {
......@@ -3164,13 +3167,13 @@ var serviceContext = (function () {
});
});
});
audio.addEventListener('waiting', () => {
audio.addEventListener('waiting', () => {
stopTimeUpdateTimer();
publishBackgroundAudioStateChange('waiting', {
dataUrl: audio.src
});
});
audio.addEventListener('error', err => {
audio.addEventListener('error', err => {
stopTimeUpdateTimer();
publish('onMusicError', {
dataUrl: audio.src,
......@@ -3184,20 +3187,20 @@ var serviceContext = (function () {
});
audio.addEventListener('prev', () => publish('onBackgroundAudioPrev'));
audio.addEventListener('next', () => publish('onBackgroundAudioNext'));
}
function startTimeUpdateTimer () {
stopTimeUpdateTimer();
timeUpdateTimer = setInterval(() => {
publishBackgroundAudioStateChange('timeUpdate', {});
}, TIME_UPDATE);
}
}
function stopTimeUpdateTimer () {
if (timeUpdateTimer !== null) {
clearInterval(timeUpdateTimer);
}
}
function startTimeUpdateTimer () {
stopTimeUpdateTimer();
timeUpdateTimer = setInterval(() => {
publishBackgroundAudioStateChange('timeUpdate', {});
}, TIME_UPDATE);
}
function stopTimeUpdateTimer () {
if (timeUpdateTimer !== null) {
clearInterval(timeUpdateTimer);
}
}
function setMusicState (args) {
initMusic();
......@@ -3226,7 +3229,7 @@ var serviceContext = (function () {
dataUrl: audio.src,
duration: audio.getDuration() || 0,
currentPosition: audio.getPosition(),
status: audio.isPaused ? 0 : 1,
status: audio.isPaused() ? 0 : 1,
downloadPercent: Math.round(100 * audio.getBuffered() / audio.getDuration()),
errMsg: `getMusicPlayerState:ok`
}
......@@ -3302,7 +3305,7 @@ var serviceContext = (function () {
let newData = {
duration: audio.getDuration() || 0,
currentTime: audio.isStopped ? 0 : audio.getPosition(),
paused: audio.isPaused,
paused: audio.isPaused(),
src: audio.src,
buffered: audio.getBuffered(),
title: audio.title,
......@@ -11402,7 +11405,7 @@ var serviceContext = (function () {
success,
fail,
complete
}, errMsg) {
} = {}, errMsg) {
var data = {
errMsg
};
......@@ -12274,13 +12277,13 @@ var serviceContext = (function () {
getCurrentPages
}) {
function createPageEvent (eventType) {
return function (args, pageId) {
return function (args, pageId) {
pageId = parseInt(pageId);
const pages = getCurrentPages();
const page = pages.find(page => page.$page.id === pageId);
if (page) {
callPageHook(page, eventType, args);
} else {
} else if (process.env.NODE_ENV !== 'production') {
console.error(`Not Found:Page[${pageId}]`);
}
}
......@@ -12313,7 +12316,7 @@ var serviceContext = (function () {
}
callback(res);
}
}
}
subscribe('onPageScroll', createPageEvent('onPageScroll'));
subscribe('onReachBottom', createPageEvent('onReachBottom'));
......
此差异已折叠。
此差异已折叠。
......@@ -231,13 +231,13 @@ const promiseInterceptor = {
};
const SYNC_API_RE =
/^\$|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
/^\$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/;
const ASYNC_API = ['createBLEConnection'];
const CALLBACK_API_RE = /^on/;
const CALLBACK_API_RE = /^on|^off/;
function isContextApi (name) {
return CONTEXT_API_RE.test(name)
......
......@@ -231,13 +231,13 @@ const promiseInterceptor = {
};
const SYNC_API_RE =
/^\$|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
/^\$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/;
const ASYNC_API = ['createBLEConnection'];
const CALLBACK_API_RE = /^on/;
const CALLBACK_API_RE = /^on|^off/;
function isContextApi (name) {
return CONTEXT_API_RE.test(name)
......
......@@ -231,13 +231,13 @@ const promiseInterceptor = {
};
const SYNC_API_RE =
/^\$|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
/^\$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/;
const ASYNC_API = ['createBLEConnection'];
const CALLBACK_API_RE = /^on/;
const CALLBACK_API_RE = /^on|^off/;
function isContextApi (name) {
return CONTEXT_API_RE.test(name)
......
......@@ -231,13 +231,13 @@ const promiseInterceptor = {
};
const SYNC_API_RE =
/^\$|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
/^\$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/;
const ASYNC_API = ['createBLEConnection'];
const CALLBACK_API_RE = /^on/;
const CALLBACK_API_RE = /^on|^off/;
function isContextApi (name) {
return CONTEXT_API_RE.test(name)
......
......@@ -20,7 +20,7 @@ module.exports = {
console.warn('manifest.json->quickapp-light 缺少 package 配置')
}
if (!platformOptions.icon) {
console.error('manifest.json->quickapp-light 缺少 icon 配置')
console.warn('manifest.json->quickapp-light 缺少 icon 配置')
}
},
copyWebpackOptions (platformOptions, vueOptions) {
......
......@@ -9,21 +9,23 @@ module.exports = (api, options, rootOptions) => {
'info': 'node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js',
'serve': 'npm run dev:h5',
'build': 'npm run build:h5',
'serve:quickapp': 'node node_modules/@dcloudio/uni-quickapp/bin/serve.js',
'serve:quickapp-vue': 'node node_modules/@dcloudio/uni-quickapp-vue/bin/serve.js',
'dev:h5': 'cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve',
'dev:mp-qq': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-qq vue-cli-service uni-build --watch',
'dev:mp-weixin': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch',
'dev:mp-baidu': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch',
'dev:mp-alipay': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch',
'dev:mp-toutiao': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch',
'dev:quickapp': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp vue-cli-service uni-build --watch',
'dev:quickapp-vue': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-vue vue-cli-service uni-build --watch',
'dev:quickapp-light': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-light vue-cli-service uni-build --watch',
'build:h5': 'cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build',
'build:mp-qq': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build',
'build:mp-weixin': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build',
'build:mp-baidu': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build',
'build:mp-alipay': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build',
'build:mp-toutiao': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build',
'build:quickapp': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp vue-cli-service uni-build',
'build:quickapp-vue': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-vue vue-cli-service uni-build',
'build:quickapp-light': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-light vue-cli-service uni-build',
'dev:custom': 'cross-env NODE_ENV=development uniapp-cli custom',
'build:custom': 'cross-env NODE_ENV=production uniapp-cli custom'
},
......
......@@ -9,9 +9,6 @@ export const uploadFile = {
files: {
type: Array
},
file: {
type: File
},
filePath: {
type: String,
validator (value, params) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册