提交 92211571 编写于 作者: M mehaotian

Merge branch 'dev'

...@@ -144,33 +144,39 @@ function upx2px (number, newDeviceWidth) { ...@@ -144,33 +144,39 @@ function upx2px (number, newDeviceWidth) {
return number < 0 ? -result : result return number < 0 ? -result : result
} }
function normalize (fromArgs) { var previewImage = {
let currentIndex = parseInt(fromArgs.current); args (fromArgs) {
if (isNaN(currentIndex)) { let currentIndex = parseInt(fromArgs.current);
return if (isNaN(currentIndex)) {
} return
const urls = fromArgs.urls; }
if (!Array.isArray(urls)) { const urls = fromArgs.urls;
return if (!Array.isArray(urls)) {
} return
const len = urls.length; }
if (!len) { const len = urls.length;
return if (!len) {
} return
if (currentIndex < 0) { }
currentIndex = 0; if (currentIndex < 0) {
} else if (currentIndex >= len) { currentIndex = 0;
currentIndex = len - 1; } else if (currentIndex >= len) {
} currentIndex = len - 1;
if (currentIndex > 0) { }
fromArgs.current = urls[currentIndex]; if (currentIndex > 0) {
fromArgs.urls = urls.filter( fromArgs.current = urls[currentIndex];
(item, index) => index < currentIndex ? item !== urls[currentIndex] : true fromArgs.urls = urls.filter(
); (item, index) => index < currentIndex ? item !== urls[currentIndex] : true
} else { );
fromArgs.current = urls[0]; } else {
fromArgs.current = urls[0];
}
return {
indicator: false,
loop: false
}
} }
} };
// 不支持的 API 列表 // 不支持的 API 列表
const todos = [ const todos = [
...@@ -232,15 +238,7 @@ const protocols = { ...@@ -232,15 +238,7 @@ const protocols = {
method: false method: false
} }
}, },
previewImage: { previewImage,
args (fromArgs) {
normalize(fromArgs);
return {
indicator: false,
loop: false
}
}
},
getRecorderManager: { getRecorderManager: {
returnValue (fromRet) { returnValue (fromRet) {
fromRet.onFrameRecorded = createTodoMethod('RecorderManager', 'onFrameRecorded'); fromRet.onFrameRecorded = createTodoMethod('RecorderManager', 'onFrameRecorded');
......
{ {
"name": "@dcloudio/uni-mp-baidu", "name": "@dcloudio/uni-mp-baidu",
"version": "0.0.829", "version": "0.0.830",
"description": "uni-app mp-baidu", "description": "uni-app mp-baidu",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -144,33 +144,39 @@ function upx2px (number, newDeviceWidth) { ...@@ -144,33 +144,39 @@ function upx2px (number, newDeviceWidth) {
return number < 0 ? -result : result return number < 0 ? -result : result
} }
function normalize (fromArgs) { var previewImage = {
let currentIndex = parseInt(fromArgs.current); args (fromArgs) {
if (isNaN(currentIndex)) { let currentIndex = parseInt(fromArgs.current);
return if (isNaN(currentIndex)) {
} return
const urls = fromArgs.urls; }
if (!Array.isArray(urls)) { const urls = fromArgs.urls;
return if (!Array.isArray(urls)) {
} return
const len = urls.length; }
if (!len) { const len = urls.length;
return if (!len) {
} return
if (currentIndex < 0) { }
currentIndex = 0; if (currentIndex < 0) {
} else if (currentIndex >= len) { currentIndex = 0;
currentIndex = len - 1; } else if (currentIndex >= len) {
} currentIndex = len - 1;
if (currentIndex > 0) { }
fromArgs.current = urls[currentIndex]; if (currentIndex > 0) {
fromArgs.urls = urls.filter( fromArgs.current = urls[currentIndex];
(item, index) => index < currentIndex ? item !== urls[currentIndex] : true fromArgs.urls = urls.filter(
); (item, index) => index < currentIndex ? item !== urls[currentIndex] : true
} else { );
fromArgs.current = urls[0]; } else {
fromArgs.current = urls[0];
}
return {
indicator: false,
loop: false
}
} }
} };
// 不支持的 API 列表 // 不支持的 API 列表
const todos = [ const todos = [
...@@ -265,15 +271,7 @@ const protocols = { ...@@ -265,15 +271,7 @@ const protocols = {
sizeType: false sizeType: false
} }
}, },
previewImage: { previewImage,
args (fromArgs) {
normalize(fromArgs);
return {
indicator: false,
loop: false
}
}
},
connectSocket: { connectSocket: {
args: { args: {
method: false method: false
......
{ {
"name": "@dcloudio/uni-mp-toutiao", "name": "@dcloudio/uni-mp-toutiao",
"version": "0.0.327", "version": "0.0.328",
"description": "uni-app mp-toutiao", "description": "uni-app mp-toutiao",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -144,38 +144,42 @@ function upx2px (number, newDeviceWidth) { ...@@ -144,38 +144,42 @@ function upx2px (number, newDeviceWidth) {
return number < 0 ? -result : result return number < 0 ? -result : result
} }
function normalize (fromArgs) { var previewImage = {
let currentIndex = parseInt(fromArgs.current); args (fromArgs) {
if (isNaN(currentIndex)) { let currentIndex = parseInt(fromArgs.current);
return if (isNaN(currentIndex)) {
} return
const urls = fromArgs.urls; }
if (!Array.isArray(urls)) { const urls = fromArgs.urls;
return if (!Array.isArray(urls)) {
} return
const len = urls.length; }
if (!len) { const len = urls.length;
return if (!len) {
} return
if (currentIndex < 0) { }
currentIndex = 0; if (currentIndex < 0) {
} else if (currentIndex >= len) { currentIndex = 0;
currentIndex = len - 1; } else if (currentIndex >= len) {
} currentIndex = len - 1;
if (currentIndex > 0) { }
fromArgs.current = urls[currentIndex]; if (currentIndex > 0) {
fromArgs.urls = urls.filter( fromArgs.current = urls[currentIndex];
(item, index) => index < currentIndex ? item !== urls[currentIndex] : true fromArgs.urls = urls.filter(
); (item, index) => index < currentIndex ? item !== urls[currentIndex] : true
} else { );
fromArgs.current = urls[0]; } else {
fromArgs.current = urls[0];
}
return {
indicator: false,
loop: false
}
} }
} };
const protocols = { const protocols = {
previewImage: { previewImage
args: normalize
}
}; };
const todos = []; const todos = [];
const canIUses = []; const canIUses = [];
......
{ {
"name": "@dcloudio/uni-mp-weixin", "name": "@dcloudio/uni-mp-weixin",
"version": "0.0.951", "version": "0.0.952",
"description": "uni-app mp-weixin", "description": "uni-app mp-weixin",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -9,8 +9,10 @@ export function isPage (vm) { ...@@ -9,8 +9,10 @@ export function isPage (vm) {
return false return false
} }
export function normalizeDataset (dataset = {}) { export function normalizeDataset (dataset = {}) {
const result = Object.assign({}, dataset) // ios8.x,9.x Object.assign({},dataset) 始终返回 {}
// http://ask.dcloud.net.cn/question/70246
const result = JSON.parse(JSON.stringify(dataset))
if (__PLATFORM__ === 'h5') { if (__PLATFORM__ === 'h5') {
const keys = Object.keys(result) const keys = Object.keys(result)
const len = keys.length const len = keys.length
......
<template> <template>
<div class="uni-system-choose-location"> <div class="uni-system-choose-location">
<system-header <system-header
:confirm="!!data" :confirm="!!data"
@back="_back" @back="_back"
@confirm="_choose">选择位置</system-header> @confirm="_choose">选择位置</system-header>
<div class="map-content"> <div class="map-content">
<iframe <iframe
:src="src" :src="src"
allow="geolocation" allow="geolocation"
seamless seamless
sandbox="allow-scripts allow-same-origin allow-forms" sandbox="allow-scripts allow-same-origin allow-forms"
frameborder="0" /> frameborder="0" />
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import SystemHeader from '../system-header' import SystemHeader from '../system-header'
export default { export default {
name: 'SystemChooseLocation', name: 'SystemChooseLocation',
components: { components: {
SystemHeader SystemHeader
}, },
data () { data () {
return { return {
...@@ -29,7 +29,7 @@ export default { ...@@ -29,7 +29,7 @@ export default {
} }
}, },
mounted () { mounted () {
var key = 'WXTBZ-6WERU-ECCVS-BZJCK-LW5OJ-SIBOS' var key = __uniConfig.qqMapKey
this.src = `https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=${key}&referer=uniapp` this.src = `https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=${key}&referer=uniapp`
window.addEventListener('message', (event) => { window.addEventListener('message', (event) => {
var loc = event.data var loc = event.data
...@@ -81,4 +81,4 @@ export default { ...@@ -81,4 +81,4 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
</style> </style>
...@@ -2,17 +2,17 @@ ...@@ -2,17 +2,17 @@
<div class="uni-system-open-location"> <div class="uni-system-open-location">
<system-header @back="_back">位置</system-header> <system-header @back="_back">位置</system-header>
<div class="map-content"> <div class="map-content">
<iframe <iframe
ref="map" ref="map"
:src="src" :src="src"
allow="geolocation" allow="geolocation"
sandbox="allow-scripts allow-same-origin allow-forms" sandbox="allow-scripts allow-same-origin allow-forms"
frameborder="0" frameborder="0"
@load="_load" /> @load="_load" />
<!-- 去这里 --> <!-- 去这里 -->
<div <div
v-if="isPoimarkerSrc" v-if="isPoimarkerSrc"
class="actTonav" class="actTonav"
@click="_nav" /> @click="_nav" />
</div> </div>
</div> </div>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<script> <script>
import SystemHeader from '../system-header' import SystemHeader from '../system-header'
const key = 'WXTBZ-6WERU-ECCVS-BZJCK-LW5OJ-SIBOS' const key = __uniConfig.qqMapKey
const referer = 'uniapp' const referer = 'uniapp'
const poimarkerSrc = 'https://apis.map.qq.com/tools/poimarker' const poimarkerSrc = 'https://apis.map.qq.com/tools/poimarker'
...@@ -110,4 +110,4 @@ export default { ...@@ -110,4 +110,4 @@ export default {
height: 60px; height: 60px;
border-radius: 60px; border-radius: 60px;
} }
</style> </style>
...@@ -9,7 +9,7 @@ function wgs84ToGcj02 (coords, success, error) { ...@@ -9,7 +9,7 @@ function wgs84ToGcj02 (coords, success, error) {
/** /**
* uniapp 内置key * uniapp 内置key
*/ */
var key = 'WXTBZ-6WERU-ECCVS-BZJCK-LW5OJ-SIBOS' var key = __uniConfig.qqMapKey
var url = `https://apis.map.qq.com/ws/coord/v1/translate?locations=${coords.latitude},${coords.longitude}&type=1&key=${key}&output=jsonp` var url = `https://apis.map.qq.com/ws/coord/v1/translate?locations=${coords.latitude},${coords.longitude}&type=1&key=${key}&output=jsonp`
getJSONP(url, {}, (res) => { getJSONP(url, {}, (res) => {
if ('locations' in res && res.locations.length) { if ('locations' in res && res.locations.length) {
...@@ -18,7 +18,7 @@ function wgs84ToGcj02 (coords, success, error) { ...@@ -18,7 +18,7 @@ function wgs84ToGcj02 (coords, success, error) {
latitude: res.locations[0].lat latitude: res.locations[0].lat
}) })
} else { } else {
error() error(res)
} }
}, error) }, error)
} }
...@@ -48,9 +48,9 @@ export function getLocation ({ ...@@ -48,9 +48,9 @@ export function getLocation ({
if (type === 'WGS84') { if (type === 'WGS84') {
callback(coords) callback(coords)
} else { } else {
wgs84ToGcj02(coords, callback, () => { wgs84ToGcj02(coords, callback, (err) => {
invoke(callbackId, { invoke(callbackId, {
errMsg: 'getLocation:fail' errMsg: 'getLocation:fail ' + JSON.stringify(err)
}) })
}) })
} }
......
...@@ -54,13 +54,18 @@ export function chooseVideo ({ ...@@ -54,13 +54,18 @@ export function chooseVideo ({
} }
const video = document.createElement('video') const video = document.createElement('video')
video.addEventListener('loadedmetadata', function () { if (video.onloadedmetadata) {
callbackResult.duration = video.duration || 0 // 尝试获取视频的宽高信息
callbackResult.width = video.videoWidth || 0 video.onloadedmetadata = function () {
callbackResult.height = video.videoHeight || 0 callbackResult.duration = video.duration || 0
callbackResult.width = video.videoWidth || 0
callbackResult.height = video.videoHeight || 0
invoke(callbackId, callbackResult)
}
video.src = filePath
} else {
invoke(callbackId, callbackResult) invoke(callbackId, callbackResult)
}) }
video.src = filePath
// TODO 用户取消选择时,触发 fail,目前尚未找到合适的方法。 // TODO 用户取消选择时,触发 fail,目前尚未找到合适的方法。
}) })
......
...@@ -791,7 +791,7 @@ export default { ...@@ -791,7 +791,7 @@ export default {
maps = window.qq.maps maps = window.qq.maps
callback() callback()
} else { } else {
let key = 'XVXBZ-NDMC4-JOGUS-XGIEE-QVHDZ-AMFV2' let key = __uniConfig.qqMapKey
let callbackName = '_callback' + Date.now() let callbackName = '_callback' + Date.now()
window[callbackName] = function () { window[callbackName] = function () {
delete window[callbackName] delete window[callbackName]
......
import normalizePreviewImageArgs from '../../../mp-weixin/helpers/normalize-preview-image-args' import previewImage from '../../../mp-weixin/helpers/normalize-preview-image'
// 不支持的 API 列表 // 不支持的 API 列表
const todos = [ const todos = [
'hideKeyboard', 'hideKeyboard',
...@@ -59,15 +59,7 @@ const protocols = { ...@@ -59,15 +59,7 @@ const protocols = {
method: false method: false
} }
}, },
previewImage: { previewImage,
args (fromArgs) {
normalizePreviewImageArgs(fromArgs)
return {
indicator: false,
loop: false
}
}
},
getRecorderManager: { getRecorderManager: {
returnValue (fromRet) { returnValue (fromRet) {
fromRet.onFrameRecorded = createTodoMethod('RecorderManager', 'onFrameRecorded') fromRet.onFrameRecorded = createTodoMethod('RecorderManager', 'onFrameRecorded')
......
import normalizePreviewImageArgs from '../../../mp-weixin/helpers/normalize-preview-image-args' import previewImage from '../../../mp-weixin/helpers/normalize-preview-image'
// 不支持的 API 列表 // 不支持的 API 列表
const todos = [ const todos = [
...@@ -93,15 +93,7 @@ const protocols = { ...@@ -93,15 +93,7 @@ const protocols = {
sizeType: false sizeType: false
} }
}, },
previewImage: { previewImage,
args (fromArgs) {
normalizePreviewImageArgs(fromArgs)
return {
indicator: false,
loop: false
}
}
},
connectSocket: { connectSocket: {
args: { args: {
method: false method: false
......
export default function normalize (fromArgs) {
let currentIndex = parseInt(fromArgs.current)
if (isNaN(currentIndex)) {
return
}
const urls = fromArgs.urls
if (!Array.isArray(urls)) {
return
}
const len = urls.length
if (!len) {
return
}
if (currentIndex < 0) {
currentIndex = 0
} else if (currentIndex >= len) {
currentIndex = len - 1
}
if (currentIndex > 0) {
fromArgs.current = urls[currentIndex]
fromArgs.urls = urls.filter(
(item, index) => index < currentIndex ? item !== urls[currentIndex] : true
)
} else {
fromArgs.current = urls[0]
}
}
export default {
args (fromArgs) {
let currentIndex = parseInt(fromArgs.current)
if (isNaN(currentIndex)) {
return
}
const urls = fromArgs.urls
if (!Array.isArray(urls)) {
return
}
const len = urls.length
if (!len) {
return
}
if (currentIndex < 0) {
currentIndex = 0
} else if (currentIndex >= len) {
currentIndex = len - 1
}
if (currentIndex > 0) {
fromArgs.current = urls[currentIndex]
fromArgs.urls = urls.filter(
(item, index) => index < currentIndex ? item !== urls[currentIndex] : true
)
} else {
fromArgs.current = urls[0]
}
return {
indicator: false,
loop: false
}
}
}
import normalizePreviewImageArgs from '../../helpers/normalize-preview-image-args' import previewImage from '../../helpers/normalize-preview-image'
export const protocols = { export const protocols = {
previewImage: { previewImage
args: normalizePreviewImageArgs
}
} }
export const todos = [] export const todos = []
export const canIUses = [] export const canIUses = []
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册