Commit 50e4e625 by 高淑倩

modify: 适配

parent 470e3f0e
......@@ -3,11 +3,36 @@ import { cEvent } from './utils/event.js'
const Promise = require('lib/bluebird')
var utils = require('utils/util.js')
var wxService = require('utils/wxService')
let config = require('./configScreen/configScreen');
const envInfo = require('config/index').envInfo
App({
onLaunch: function (e) {
// this.checkFullSucreen()
try {
let res = wx.getSystemInfoSync();
config.pixelRate = res.windowWidth / 750;
config.platform = res.platform;
config.statusBarHeight = res.statusBarHeight;
if (res.platform.toLowerCase() == 'devtools') {
config.capsuleHeight = 44;
}
if (res.platform.toLowerCase() == 'android') {
config.capsuleHeight = 48;
}
config.titleHeight = (config.capsuleHeight + config.statusBarHeight) / config.pixelRate;
if (res.statusBarHeight >= 44) {
config.isHighHead = true;
}
if (res.windowHeight > 750) config.isAllScreen = true;
config.systemHeight = res.windowHeight;
console.log('config', config)
} catch (e) {
console.log(e);
}
},
onShow: function (options = {}) {
console.log('app-onshow', options)
......@@ -38,9 +63,6 @@ App({
onHide: function () {
this.globalData.loginFirst = false
},
getUserInfo() {
return new Promise((resolve, reject) => {
const _baseUserInfo = wx.getStorageSync('_baseUserInfo')
......@@ -51,6 +73,18 @@ App({
}
})
},
checkFullSucreen () {
const self = this
wxService.getSystemInfo().then(res => {
debugger
if ((res.screenHeight - res.windowHeight - res.statusBarHeight - 32) > 72) {
     // 处理相关逻辑
self.globalData.isFullSucreen = true
// setGlobalData('fullScreen', true)
}
})
},
globalData: {
userInfo: null,
userBaseInfo: null, // openid
......@@ -61,6 +95,7 @@ App({
storeId: '',
storeName: '',
loginFirst: false,
imageUrl:"" //图片地址
imageUrl:"", //图片地址
isFullSucreen: false, // 当前设备是否为 FullSucreen
}
})
module.exports = {
pixelRate: 0.5, //px与rpx换算关系
platform: 'ios', //操作平台 用于适配胶囊高度
capsuleHeight: 40, //胶囊高度
statusBarHeight: 20, //手机顶部状态栏高度
titleHeight: 136, //整个导航头高度
systemHeight: 0, //手机屏幕高度
isAllScreen: false, //是否是全面屏手机
isHighHead: false, //是否是刘海屏手机
};
\ No newline at end of file
......@@ -8,7 +8,7 @@
<image src='/assets/imgs/qr-code.png'></image>
</view>
<view class='coupon-info'>
<view class='coupon-name fs-28'>{{item.couponName}}</view>
<view class='coupon-name fs-28'>{{item.title}}</view>
<view class='coupon-time fs-24'>{{item.startTime}}</view>
<view class='coupon-desc fs-24' data-id="{{item.id}}" bindtap="goCouponDetail">查看详情</view>
</view>
......
......@@ -5,6 +5,8 @@ const utils = require('../../utils/util')
const envInfo = require('../../config/index').envInfo
let renderPage = null // 渲染页面数据对象(安全渲染)
let handlerDataOnPage = null
let config = require('../../configScreen/configScreen');
const logger = utils.logger
wxService.page({
......@@ -18,7 +20,9 @@ wxService.page({
startX: 0,
startY: 0,
integralNum: 0,
couponNum: 0
couponNum: 0,
// isAllScreen: fullSucreen.isAllScreen
isAllScreen: config.isAllScreen
},
/**
......@@ -60,7 +64,6 @@ wxService.page({
this.getMemberPointInfo()
// 优惠券数量
this.getMemberCouponInfo()
},
// 查询积分信息
getMemberPointInfo(){
......
{
"disableScroll": true,
"navigationBarTitleText": "广东7-Eleven会员专区",
"usingComponents": {
"image-swiper": "/component/imageSwiper/imageSwiper",
......
......@@ -62,11 +62,11 @@ function getTouchData(endX, endY, startX, startY) {
}
/**
* 全面屏
* view宽高比
*/
function aspectRatio(h,w) {
let viewStyle = {}
let originalScale = h/w // view宽高比
let originalScale = h/w
wxService.getSystemInfo().then(res=>{
let windowscale = res.windowHeight/res.windowWidth
if(originalScale < windowscale){
......@@ -80,6 +80,20 @@ function aspectRatio(h,w) {
return viewStyle;
}
/**
* 全面屏
*/
// function checkFullSucreen () {
// const self = this
// wxService.getSystemInfo().then(res => {
// debugger
// if ((res.screenHeight - res.windowHeight - res.statusBarHeight - 32) > 72) {
//      // 处理相关逻辑
// self.globalData.isFullSucreen = true
// // setGlobalData('fullScreen', true)
// }
// })
// }
/**
* 解析 url 参数
......@@ -262,5 +276,6 @@ module.exports = {
logger: new Logger(),
getTouchData,
getAccountInfo,
aspectRatio
aspectRatio,
// checkFullSucreen
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment