1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- var businessT = require('business-tool.js')
- var _isLongScreen = false
- var _suffixOfClass = ''
- var _sysInfo = {}
- var _rpxToPx = 0
- var _isIphoneX = false
- function adaptor() {
- var res = wx.getSystemInfoSync()
- businessT.debugLog(res)
- _sysInfo = res
- _rpxToPx = res.screenWidth / 750
- var start = res.model.indexOf('iPhone X')
- if (start == 0) {
- _suffixOfClass = '-X'
- _isIphoneX = true
- }
- if (res.screenHeight / res.screenWidth >= 1.85) {
- _isLongScreen = true
- }
- }
- //返回rpx
- function usableHeight(remove) {
- var h = 750 / _sysInfo.windowWidth * _sysInfo.windowHeight
- if (_isIphoneX) {
- return h - remove - 68
- } else {
- return h - remove
- }
- }
- function suffixOfClass() {
- return _suffixOfClass
- }
- function isLongScreen() {
- return _isLongScreen
- }
- function sysInfo() {
- return _sysInfo
- }
- function rpxToPx() {
- return _rpxToPx
- }
- module.exports = {
- adaptor: adaptor,
- suffixOfClass: suffixOfClass,
- isLongScreen: isLongScreen,
- sysInfo: sysInfo,
- rpxToPx: rpxToPx,
- usableHeight: usableHeight
- }
|