make page
This commit is contained in:
@@ -1,38 +1,38 @@
|
||||
const SYSTEM = uni.getSystemInfoSync()
|
||||
const SYSTEM = uni.getSystemInfoSync();
|
||||
|
||||
|
||||
export const getStatusBarHeight = () => SYSTEM.statusBarHeight || 15
|
||||
export const getStatusBarHeight = () => SYSTEM.statusBarHeight || 15;
|
||||
export const getTitleBarHeight = () => {
|
||||
if(uni.getMenuButtonBoundingClientRect) {
|
||||
const { top, height } = uni.getMenuButtonBoundingClientRect()
|
||||
return height + (top - getStatusBarHeight()) * 2
|
||||
} else {
|
||||
return 40
|
||||
}
|
||||
}
|
||||
if (uni.getMenuButtonBoundingClientRect) {
|
||||
const { top, height } = uni.getMenuButtonBoundingClientRect();
|
||||
return height + (top - getStatusBarHeight()) * 2;
|
||||
} else {
|
||||
return 40;
|
||||
}
|
||||
};
|
||||
|
||||
export const getBavBarHeight = () => getStatusBarHeight() + getTitleBarHeight()
|
||||
export const getBavBarHeight = () => getStatusBarHeight() + getTitleBarHeight();
|
||||
|
||||
export const getLeftIconLeft = () => {
|
||||
// if(tt?.getMenuButtonBoundingClientRect) {
|
||||
// const { leftIcon: {left, width}} = tt.getMenuButtonBoundingClientRect
|
||||
// return left + parseInt(width) + 5
|
||||
// } else {
|
||||
// return 0
|
||||
// }
|
||||
// #ifdef MP-TOUTIAO
|
||||
const { leftIcon: {left, width}} = tt.getCustomButtonBoundingClientRect()
|
||||
return left + parseInt(width)
|
||||
// #endif
|
||||
// #ifndef MP-TOUTIAO
|
||||
return 0
|
||||
// #endif
|
||||
}
|
||||
|
||||
// if(tt?.getMenuButtonBoundingClientRect) {
|
||||
// const { leftIcon: {left, width}} = tt.getMenuButtonBoundingClientRect
|
||||
// return left + parseInt(width) + 5
|
||||
// } else {
|
||||
// return 0
|
||||
// }
|
||||
// #ifdef MP-TOUTIAO
|
||||
const {
|
||||
leftIcon: { left, width },
|
||||
} = tt.getCustomButtonBoundingClientRect();
|
||||
return left + parseInt(width);
|
||||
// #endif
|
||||
// #ifndef MP-TOUTIAO
|
||||
return 0;
|
||||
// #endif
|
||||
};
|
||||
|
||||
export function getPlatformProvider() {
|
||||
const platform = process.env.UNI_PLATFORM
|
||||
return platform ?? 'mp-weixin'
|
||||
const platform = process.env.UNI_PLATFORM;
|
||||
return platform ?? "mp-weixin";
|
||||
// const platform = uni.getSystemInfoSync().platform;
|
||||
// console.log(1111111, platform)
|
||||
// // H5 模拟器调试时使用 __wxConfig 环境变量判断
|
||||
@@ -45,3 +45,19 @@ export function getPlatformProvider() {
|
||||
|
||||
// return typeof tt !== 'undefined' ? 'toutiao' : 'weixin';
|
||||
}
|
||||
|
||||
export function getDeviceInfo() {
|
||||
const info = uni.getSystemInfoSync();
|
||||
return {
|
||||
platform: info.platform,
|
||||
brand: info.brand,
|
||||
model: info.model,
|
||||
system: info.system,
|
||||
screenWidth: info.screenWidth,
|
||||
screenHeight: info.screenHeight,
|
||||
pixelRatio: info.pixelRatio,
|
||||
language: info.language,
|
||||
version: info.version,
|
||||
SDKVersion: info.SDKVersion,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user