Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
mehaotian committed May 9, 2019
2 parents c862b32 + 08e7d54 commit 9221157
Show file tree
Hide file tree
Showing 17 changed files with 185 additions and 190 deletions.
68 changes: 33 additions & 35 deletions packages/uni-mp-baidu/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,33 +144,39 @@ function upx2px (number, newDeviceWidth) {
return number < 0 ? -result : result
}

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];
var previewImage = {
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
}
}
}
};

// 不支持的 API 列表
const todos = [
Expand Down Expand Up @@ -232,15 +238,7 @@ const protocols = {
method: false
}
},
previewImage: {
args (fromArgs) {
normalize(fromArgs);
return {
indicator: false,
loop: false
}
}
},
previewImage,
getRecorderManager: {
returnValue (fromRet) {
fromRet.onFrameRecorded = createTodoMethod('RecorderManager', 'onFrameRecorded');
Expand Down
2 changes: 1 addition & 1 deletion packages/uni-mp-baidu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dcloudio/uni-mp-baidu",
"version": "0.0.829",
"version": "0.0.830",
"description": "uni-app mp-baidu",
"main": "dist/index.js",
"scripts": {
Expand Down
68 changes: 33 additions & 35 deletions packages/uni-mp-toutiao/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,33 +144,39 @@ function upx2px (number, newDeviceWidth) {
return number < 0 ? -result : result
}

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];
var previewImage = {
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
}
}
}
};

// 不支持的 API 列表
const todos = [
Expand Down Expand Up @@ -265,15 +271,7 @@ const protocols = {
sizeType: false
}
},
previewImage: {
args (fromArgs) {
normalize(fromArgs);
return {
indicator: false,
loop: false
}
}
},
previewImage,
connectSocket: {
args: {
method: false
Expand Down
2 changes: 1 addition & 1 deletion packages/uni-mp-toutiao/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dcloudio/uni-mp-toutiao",
"version": "0.0.327",
"version": "0.0.328",
"description": "uni-app mp-toutiao",
"main": "dist/index.js",
"scripts": {
Expand Down
62 changes: 33 additions & 29 deletions packages/uni-mp-weixin/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,38 +144,42 @@ function upx2px (number, newDeviceWidth) {
return number < 0 ? -result : result
}

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];
var previewImage = {
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
}
}
}
};

const protocols = {
previewImage: {
args: normalize
}
previewImage
};
const todos = [];
const canIUses = [];
Expand Down
2 changes: 1 addition & 1 deletion packages/uni-mp-weixin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dcloudio/uni-mp-weixin",
"version": "0.0.951",
"version": "0.0.952",
"description": "uni-app mp-weixin",
"main": "dist/index.js",
"scripts": {
Expand Down
6 changes: 4 additions & 2 deletions src/core/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ export function isPage (vm) {
return false
}

export function normalizeDataset (dataset = {}) {
const result = Object.assign({}, dataset)
export function normalizeDataset (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') {
const keys = Object.keys(result)
const len = keys.length
Expand Down
28 changes: 14 additions & 14 deletions src/platforms/h5/components/system-routes/choose-location/index.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<template>
<div class="uni-system-choose-location">
<system-header
:confirm="!!data"
@back="_back"
<system-header
:confirm="!!data"
@back="_back"
@confirm="_choose">选择位置</system-header>
<div class="map-content">
<iframe
:src="src"
allow="geolocation"
seamless
sandbox="allow-scripts allow-same-origin allow-forms"
<iframe
:src="src"
allow="geolocation"
seamless
sandbox="allow-scripts allow-same-origin allow-forms"
frameborder="0" />
</div>
</div>
</template>
<script>
import SystemHeader from '../system-header'
import SystemHeader from '../system-header'
export default {
name: 'SystemChooseLocation',
components: {
SystemHeader
name: 'SystemChooseLocation',
components: {
SystemHeader
},
data () {
return {
Expand All @@ -29,7 +29,7 @@ export default {
}
},
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`
window.addEventListener('message', (event) => {
var loc = event.data
Expand Down Expand Up @@ -81,4 +81,4 @@ export default {
width: 100%;
height: 100%;
}
</style>
</style>
20 changes: 10 additions & 10 deletions src/platforms/h5/components/system-routes/open-location/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
<div class="uni-system-open-location">
<system-header @back="_back">位置</system-header>
<div class="map-content">
<iframe
ref="map"
:src="src"
allow="geolocation"
sandbox="allow-scripts allow-same-origin allow-forms"
<iframe
ref="map"
:src="src"
allow="geolocation"
sandbox="allow-scripts allow-same-origin allow-forms"
frameborder="0"
@load="_load" />
<!-- 去这里 -->
<div
v-if="isPoimarkerSrc"
class="actTonav"
<div
v-if="isPoimarkerSrc"
class="actTonav"
@click="_nav" />
</div>
</div>
</template>
<script>
import SystemHeader from '../system-header'
const key = 'WXTBZ-6WERU-ECCVS-BZJCK-LW5OJ-SIBOS'
const key = __uniConfig.qqMapKey
const referer = 'uniapp'
const poimarkerSrc = 'https://apis.map.qq.com/tools/poimarker'
Expand Down Expand Up @@ -110,4 +110,4 @@ export default {
height: 60px;
border-radius: 60px;
}
</style>
</style>
8 changes: 4 additions & 4 deletions src/platforms/h5/service/api/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function wgs84ToGcj02 (coords, success, error) {
/**
* 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`
getJSONP(url, {}, (res) => {
if ('locations' in res && res.locations.length) {
Expand All @@ -18,7 +18,7 @@ function wgs84ToGcj02 (coords, success, error) {
latitude: res.locations[0].lat
})
} else {
error()
error(res)
}
}, error)
}
Expand Down Expand Up @@ -48,9 +48,9 @@ export function getLocation ({
if (type === 'WGS84') {
callback(coords)
} else {
wgs84ToGcj02(coords, callback, () => {
wgs84ToGcj02(coords, callback, (err) => {
invoke(callbackId, {
errMsg: 'getLocation:fail'
errMsg: 'getLocation:fail ' + JSON.stringify(err)
})
})
}
Expand Down
Loading

0 comments on commit 9221157

Please sign in to comment.