diff --git a/packages/uni-mp-alipay/dist/index.js b/packages/uni-mp-alipay/dist/index.js index 8916f8377a8c4a52906c6ecf45fe5bef9b9ff66e..8cf89cd6ccf3edc2ea22076e28d458fd285253bf 100644 --- a/packages/uni-mp-alipay/dist/index.js +++ b/packages/uni-mp-alipay/dist/index.js @@ -89,14 +89,14 @@ function checkDeviceWidth () { platform, pixelRatio, windowWidth - } = uni.getSystemInfoSync(); + } = my.getSystemInfoSync(); // runtime 编译目标是 uni 对象,内部不允许直接使用 uni deviceWidth = windowWidth; deviceDPR = pixelRatio; isIOS = platform === 'ios'; } -function upx2px (number, newDeviceWidth) { +function upx2px (number, newDeviceWidth) { if (deviceWidth === 0) { checkDeviceWidth(); } @@ -406,6 +406,18 @@ const protocols = { // 需要做转换的 API 列表 args: { orderInfo: 'orderStr' } + }, + getBLEDeviceServices: { + returnValue (result) { + result.services.forEach((item) => { + item.uuid = item.serviceId; + }); + } + }, + makePhoneCall: { + args: { + phoneNumber: 'number' + } } }; @@ -578,10 +590,10 @@ var api = /*#__PURE__*/Object.freeze({ removeStorageSync: removeStorageSync }); -let uni$1 = {}; +let uni = {}; if (typeof Proxy !== 'undefined') { - uni$1 = new Proxy({}, { + uni = new Proxy({}, { get (target, name) { if (name === 'upx2px') { return upx2px @@ -602,27 +614,27 @@ if (typeof Proxy !== 'undefined') { } }); } else { - uni$1.upx2px = upx2px; + uni.upx2px = upx2px; Object.keys(todoApis).forEach(name => { - uni$1[name] = promisify(name, todoApis[name]); + uni[name] = promisify(name, todoApis[name]); }); Object.keys(extraApi).forEach(name => { - uni$1[name] = promisify(name, todoApis[name]); + uni[name] = promisify(name, todoApis[name]); }); Object.keys(api).forEach(name => { - uni$1[name] = promisify(name, api[name]); + uni[name] = promisify(name, api[name]); }); Object.keys(my).forEach(name => { if (hasOwn(my, name) || hasOwn(protocols, name)) { - uni$1[name] = promisify(name, wrapper(name, my[name])); + uni[name] = promisify(name, wrapper(name, my[name])); } }); } -var uni$2 = uni$1; +var uni$1 = uni; -export default uni$2; +export default uni$1; diff --git a/packages/uni-mp-alipay/package.json b/packages/uni-mp-alipay/package.json index bbd08088fe8dd63443b6703e5082af7f6d7aa335..7f9a79cf7347c48328350540311f4094f73d43d0 100644 --- a/packages/uni-mp-alipay/package.json +++ b/packages/uni-mp-alipay/package.json @@ -1,6 +1,6 @@ { "name": "@dcloudio/uni-mp-alipay", - "version": "0.0.5", + "version": "0.0.6", "description": "uni-app mp-alipay", "main": "dist/index.js", "scripts": { diff --git a/packages/uni-mp-baidu/dist/index.js b/packages/uni-mp-baidu/dist/index.js index f0a8b6ab4eba504fbcd1d34e91910df5b744c990..baeadefcccc0be2bb3478c7ddbc50a2c9d663874 100644 --- a/packages/uni-mp-baidu/dist/index.js +++ b/packages/uni-mp-baidu/dist/index.js @@ -89,14 +89,14 @@ function checkDeviceWidth () { platform, pixelRatio, windowWidth - } = uni.getSystemInfoSync(); + } = swan.getSystemInfoSync(); // uni=>swan runtime 编译目标是 uni 对象,内部不允许直接使用 uni deviceWidth = windowWidth; deviceDPR = pixelRatio; isIOS = platform === 'ios'; } -function upx2px (number, newDeviceWidth) { +function upx2px (number, newDeviceWidth) { if (deviceWidth === 0) { checkDeviceWidth(); } @@ -332,10 +332,10 @@ var api = /*#__PURE__*/Object.freeze({ requestPayment: requestPayment }); -let uni$1 = {}; +let uni = {}; if (typeof Proxy !== 'undefined') { - uni$1 = new Proxy({}, { + uni = new Proxy({}, { get (target, name) { if (name === 'upx2px') { return upx2px @@ -356,27 +356,27 @@ if (typeof Proxy !== 'undefined') { } }); } else { - uni$1.upx2px = upx2px; + uni.upx2px = upx2px; Object.keys(todoApis).forEach(name => { - uni$1[name] = promisify(name, todoApis[name]); + uni[name] = promisify(name, todoApis[name]); }); Object.keys(extraApi).forEach(name => { - uni$1[name] = promisify(name, todoApis[name]); + uni[name] = promisify(name, todoApis[name]); }); Object.keys(api).forEach(name => { - uni$1[name] = promisify(name, api[name]); + uni[name] = promisify(name, api[name]); }); Object.keys(swan).forEach(name => { if (hasOwn(swan, name) || hasOwn(protocols, name)) { - uni$1[name] = promisify(name, wrapper(name, swan[name])); + uni[name] = promisify(name, wrapper(name, swan[name])); } }); } -var uni$2 = uni$1; +var uni$1 = uni; -export default uni$2; +export default uni$1; diff --git a/packages/uni-mp-baidu/package.json b/packages/uni-mp-baidu/package.json index 157ddffda2fe7d8fda6439faf8ccdbf04f02e674..8989d24e6d6dec89cad5799ea12ce8344f437403 100644 --- a/packages/uni-mp-baidu/package.json +++ b/packages/uni-mp-baidu/package.json @@ -1,6 +1,6 @@ { "name": "@dcloudio/uni-mp-baidu", - "version": "0.0.4", + "version": "0.0.5", "description": "uni-app mp-baidu", "main": "dist/index.js", "scripts": { diff --git a/packages/uni-mp-weixin/dist/index.js b/packages/uni-mp-weixin/dist/index.js index b681c8613075abadaca7542e6d529aca6ebc30ee..fd8a5cc0cdfc872e317b400995e004c55f4c7393 100644 --- a/packages/uni-mp-weixin/dist/index.js +++ b/packages/uni-mp-weixin/dist/index.js @@ -89,14 +89,14 @@ function checkDeviceWidth () { platform, pixelRatio, windowWidth - } = uni.getSystemInfoSync(); + } = wx.getSystemInfoSync(); // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni deviceWidth = windowWidth; deviceDPR = pixelRatio; isIOS = platform === 'ios'; } -function upx2px (number, newDeviceWidth) { +function upx2px (number, newDeviceWidth) { if (deviceWidth === 0) { checkDeviceWidth(); } @@ -261,10 +261,10 @@ var api = /*#__PURE__*/Object.freeze({ }); -let uni$1 = {}; +let uni = {}; if (typeof Proxy !== 'undefined') { - uni$1 = new Proxy({}, { + uni = new Proxy({}, { get (target, name) { if (name === 'upx2px') { return upx2px @@ -285,27 +285,27 @@ if (typeof Proxy !== 'undefined') { } }); } else { - uni$1.upx2px = upx2px; + uni.upx2px = upx2px; Object.keys(todoApis).forEach(name => { - uni$1[name] = promisify(name, todoApis[name]); + uni[name] = promisify(name, todoApis[name]); }); Object.keys(extraApi).forEach(name => { - uni$1[name] = promisify(name, todoApis[name]); + uni[name] = promisify(name, todoApis[name]); }); Object.keys(api).forEach(name => { - uni$1[name] = promisify(name, api[name]); + uni[name] = promisify(name, api[name]); }); Object.keys(wx).forEach(name => { if (hasOwn(wx, name) || hasOwn(protocols, name)) { - uni$1[name] = promisify(name, wrapper(name, wx[name])); + uni[name] = promisify(name, wrapper(name, wx[name])); } }); } -var uni$2 = uni$1; +var uni$1 = uni; -export default uni$2; +export default uni$1; diff --git a/packages/uni-mp-weixin/package.json b/packages/uni-mp-weixin/package.json index 43a4cd2da36f466f5231200f2e9b39622907be83..541be565a3965a4f375a7805c4f7f496026e2f42 100644 --- a/packages/uni-mp-weixin/package.json +++ b/packages/uni-mp-weixin/package.json @@ -1,6 +1,6 @@ { "name": "@dcloudio/uni-mp-weixin", - "version": "0.0.3", + "version": "0.0.4", "description": "uni-app mp-weixin", "main": "dist/index.js", "scripts": { diff --git a/src/core/runtime/index.js b/src/core/runtime/index.js index 6c8fbb142fcabb4c54d454cfd3d63d260f3e1116..045d33e1fa10335cbc0bab811f351987d7801e50 100644 --- a/src/core/runtime/index.js +++ b/src/core/runtime/index.js @@ -8,7 +8,7 @@ import { import { upx2px -} from '../service/api/upx2px' +} from './upx2px' import wrapper from './wrapper' diff --git a/src/core/runtime/upx2px.js b/src/core/runtime/upx2px.js new file mode 100644 index 0000000000000000000000000000000000000000..38785161d9846ed28800966eaa6319159708ef99 --- /dev/null +++ b/src/core/runtime/upx2px.js @@ -0,0 +1,38 @@ +const EPS = 1e-4 +const BASE_DEVICE_WIDTH = 750 +let isIOS = false +let deviceWidth = 0 +let deviceDPR = 0 + +export function checkDeviceWidth () { + const { + platform, + pixelRatio, + windowWidth + } = __GLOBAL__.getSystemInfoSync() // uni=>__GLOBAL__ runtime 编译目标是 uni 对象,内部不允许直接使用 uni + + deviceWidth = windowWidth + deviceDPR = pixelRatio + isIOS = platform === 'ios' +} + +export function upx2px (number, newDeviceWidth) { + if (deviceWidth === 0) { + checkDeviceWidth() + } + + number = Number(number) + if (number === 0) { + return 0 + } + number = (number / BASE_DEVICE_WIDTH) * (newDeviceWidth || deviceWidth) + number = Math.floor(number + EPS) + if (number === 0) { + if (deviceDPR === 1 || !isIOS) { + return 1 + } else { + return 0.5 + } + } + return number +}