chore: wx.getSystemInfoSync is deprecated
wx.getSystemInfoSync is deprecated.Please use wx.getSystemSetting/wx.getAppAuthorizeSetting/wx.getDeviceInfo/wx.getWindowInfo/wx.getAppBaseInfo instead.
This commit is contained in:
2
App.vue
2
App.vue
@@ -40,7 +40,7 @@
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
if (uni.getSystemInfoSync().platform == 'ios') {
|
||||
if (this.$util.getDeviceInfo().platform == 'ios') {
|
||||
uni.setStorageSync('initUrl', location.href);
|
||||
}
|
||||
// #endif
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import WxMap from 'common/js/map-wx-jssdk.js';
|
||||
import Config from '@/common/js/config.js';
|
||||
import util from '@/common/js/util.js';
|
||||
|
||||
let systemInfo = util.getDeviceInfo();
|
||||
|
||||
let systemInfo = uni.getSystemInfoSync();
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import util from '@/common/js/util.js'
|
||||
import TransformCoordinate from './transformCoordinate.js'
|
||||
|
||||
function openMapByDefault(latitude, longitude, name) {
|
||||
@@ -85,7 +86,8 @@ export default {
|
||||
openMap(latitude, longitude, name, coord_type = 'gcj02') {
|
||||
let arr = getCoordByType(longitude, latitude, coord_type)
|
||||
// #ifdef APP-PLUS
|
||||
switch (uni.getSystemInfoSync().platform) {
|
||||
let platform = util.getDeviceInfo().platform;
|
||||
switch (platform) {
|
||||
case 'android':
|
||||
console.log('运行Android上')
|
||||
openMapByAndroid(arr[1], arr[0], name)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EventSafety } from './event-safety'
|
||||
import { EventSafety } from '@/common/js/event-safety.js'
|
||||
import util from '@/common/js/util.js'
|
||||
|
||||
export class NavigationHelper {
|
||||
constructor() {
|
||||
@@ -59,7 +60,7 @@ export class NavigationHelper {
|
||||
// 微信小程序精确计算
|
||||
try {
|
||||
const menuButtonInfo = wx.getMenuButtonBoundingClientRect()
|
||||
const systemInfo = uni.getSystemInfoSync()
|
||||
let systemInfo = util.getDeviceInfo();
|
||||
|
||||
const height = menuButtonInfo.bottom +
|
||||
(menuButtonInfo.top - systemInfo.statusBarHeight)
|
||||
@@ -119,7 +120,7 @@ export class NavigationHelper {
|
||||
// 获取状态栏高度
|
||||
getStatusBarHeight() {
|
||||
// #ifdef MP-WEIXIN
|
||||
const systemInfo = uni.getSystemInfoSync()
|
||||
let systemInfo = util.getDeviceInfo();
|
||||
return systemInfo.statusBarHeight || 20
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
@@ -138,7 +139,7 @@ export class NavigationHelper {
|
||||
// 获取安全区域
|
||||
getSafeAreaInsets() {
|
||||
try {
|
||||
const systemInfo = uni.getSystemInfoSync()
|
||||
let systemInfo = util.getDeviceInfo();
|
||||
return systemInfo.safeArea || {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
|
||||
@@ -518,7 +518,7 @@ export default {
|
||||
* 检测苹果X以上的手机
|
||||
*/
|
||||
isIPhoneX() {
|
||||
let res = uni.getSystemInfoSync();
|
||||
let res = this.getDeviceInfo();
|
||||
if (res.model.search('iPhone X') != -1) {
|
||||
return true;
|
||||
}
|
||||
@@ -526,13 +526,33 @@ export default {
|
||||
},
|
||||
//判断安卓还是iOS
|
||||
isAndroid() {
|
||||
let platform = uni.getSystemInfoSync().platform
|
||||
let platform = this.getDeviceInfo().platform;
|
||||
if (platform == 'ios') {
|
||||
return false;
|
||||
} else if (platform == 'android') {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获取设备信息(包含降级处理)
|
||||
*/
|
||||
getDeviceInfo() {
|
||||
try {
|
||||
return uni.getDeviceInfo();
|
||||
} catch (e) {
|
||||
return uni.getSystemInfoSync();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获取窗口信息(包含降级处理)
|
||||
*/
|
||||
getWindowInfo() {
|
||||
try {
|
||||
return uni.getWindowInfo();
|
||||
} catch (e) {
|
||||
return uni.getSystemInfoSync();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 深度拷贝对象
|
||||
* @param {Object} obj
|
||||
@@ -677,7 +697,7 @@ export default {
|
||||
*/
|
||||
uniappIsIPhoneX() {
|
||||
let isIphoneX = false;
|
||||
let systemInfo = uni.getSystemInfoSync();
|
||||
let systemInfo = this.getDeviceInfo();
|
||||
// #ifdef MP
|
||||
if (systemInfo.model.search('iPhone X') != -1 || systemInfo.model.search('iPhone 11') != -1 || systemInfo.model.search('iPhone 12') != -1 || systemInfo.model.search('iPhone 13') != -1) {
|
||||
isIphoneX = true;
|
||||
@@ -704,7 +724,7 @@ export default {
|
||||
*/
|
||||
uniappIsIPhone11() {
|
||||
let isIphone11 = false;
|
||||
let systemInfo = uni.getSystemInfoSync();
|
||||
let systemInfo = this.getDeviceInfo();
|
||||
// #ifdef MP
|
||||
if (systemInfo.model.search('iPhone 11') != -1) {
|
||||
isIphone11 = true;
|
||||
@@ -715,7 +735,7 @@ export default {
|
||||
// #ifdef H5
|
||||
//判断该浏览器是否为safaria浏览器
|
||||
isSafari() {
|
||||
let res = uni.getSystemInfoSync();
|
||||
let res = this.getDeviceInfo();
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
if (ua.indexOf('applewebkit') > -1 && ua.indexOf('mobile') > -1 && ua.indexOf('safari') > -1 &&
|
||||
ua.indexOf('linux') === -1 && ua.indexOf('android') === -1 && ua.indexOf('chrome') === -1 &&
|
||||
|
||||
@@ -254,6 +254,7 @@
|
||||
|
||||
<script>
|
||||
import DiyMinx from './minx.js'
|
||||
import util from '@/common/js/util.js'
|
||||
|
||||
// 自定义商品列表展示
|
||||
export default {
|
||||
@@ -327,7 +328,7 @@ export default {
|
||||
if (this.goodsValue.ornament.type == 'stroke') {
|
||||
obj += 'border:' + '2rpx solid ' + this.goodsValue.ornament.color + ';';
|
||||
}
|
||||
const screenWidth = uni.getSystemInfoSync().windowWidth;
|
||||
let screenWidth = util.getWindowInfo().windowWidth;
|
||||
if (this.value.template == 'horizontal-slide') {
|
||||
var width = '';
|
||||
if (this.value.slideMode == 'scroll' && this.value.goodsMarginType == 'diy') width = this.rpxUpPx(
|
||||
@@ -407,7 +408,7 @@ export default {
|
||||
}
|
||||
},
|
||||
rpxUpPx(res) {
|
||||
const screenWidth = uni.getSystemInfoSync().windowWidth;
|
||||
const screenWidth = util.getWindowInfo().windowWidth;
|
||||
var data = (screenWidth * parseInt(res)) / 750;
|
||||
return Math.floor(data);
|
||||
},
|
||||
|
||||
@@ -124,7 +124,7 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.systemInfo = uni.getSystemInfoSync();
|
||||
this.systemInfo = this.$util.getDeviceInfo();
|
||||
},
|
||||
watch: {
|
||||
pointLimit(newNum, oldNum) {
|
||||
|
||||
@@ -266,7 +266,7 @@
|
||||
},
|
||||
created() {
|
||||
this.isIphoneX = this.$util.uniappIsIPhoneX();
|
||||
this.systemInfo = uni.getSystemInfoSync();
|
||||
this.systemInfo = this.$util.getDeviceInfo();
|
||||
this.isLoad = true;
|
||||
if (this.goodsId && this.goodsDetail.goods_spec_format) {
|
||||
this.skuId = this.goodsDetail.sku_id;
|
||||
|
||||
Reference in New Issue
Block a user