Commit 50e4e625 by 高淑倩

modify: 适配

parent 470e3f0e
...@@ -3,10 +3,35 @@ import { cEvent } from './utils/event.js' ...@@ -3,10 +3,35 @@ import { cEvent } from './utils/event.js'
const Promise = require('lib/bluebird') const Promise = require('lib/bluebird')
var utils = require('utils/util.js') var utils = require('utils/util.js')
var wxService = require('utils/wxService') var wxService = require('utils/wxService')
let config = require('./configScreen/configScreen');
const envInfo = require('config/index').envInfo const envInfo = require('config/index').envInfo
App({ App({
onLaunch: function (e) { 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 = {}) { onShow: function (options = {}) {
...@@ -38,9 +63,6 @@ App({ ...@@ -38,9 +63,6 @@ App({
onHide: function () { onHide: function () {
this.globalData.loginFirst = false this.globalData.loginFirst = false
}, },
getUserInfo() { getUserInfo() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const _baseUserInfo = wx.getStorageSync('_baseUserInfo') const _baseUserInfo = wx.getStorageSync('_baseUserInfo')
...@@ -51,6 +73,18 @@ App({ ...@@ -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: { globalData: {
userInfo: null, userInfo: null,
userBaseInfo: null, // openid userBaseInfo: null, // openid
...@@ -61,6 +95,7 @@ App({ ...@@ -61,6 +95,7 @@ App({
storeId: '', storeId: '',
storeName: '', storeName: '',
loginFirst: false, 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 @@ ...@@ -8,7 +8,7 @@
<image src='/assets/imgs/qr-code.png'></image> <image src='/assets/imgs/qr-code.png'></image>
</view> </view>
<view class='coupon-info'> <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-time fs-24'>{{item.startTime}}</view>
<view class='coupon-desc fs-24' data-id="{{item.id}}" bindtap="goCouponDetail">查看详情</view> <view class='coupon-desc fs-24' data-id="{{item.id}}" bindtap="goCouponDetail">查看详情</view>
</view> </view>
......
...@@ -5,6 +5,8 @@ const utils = require('../../utils/util') ...@@ -5,6 +5,8 @@ const utils = require('../../utils/util')
const envInfo = require('../../config/index').envInfo const envInfo = require('../../config/index').envInfo
let renderPage = null // 渲染页面数据对象(安全渲染) let renderPage = null // 渲染页面数据对象(安全渲染)
let handlerDataOnPage = null let handlerDataOnPage = null
let config = require('../../configScreen/configScreen');
const logger = utils.logger const logger = utils.logger
wxService.page({ wxService.page({
...@@ -18,7 +20,9 @@ wxService.page({ ...@@ -18,7 +20,9 @@ wxService.page({
startX: 0, startX: 0,
startY: 0, startY: 0,
integralNum: 0, integralNum: 0,
couponNum: 0 couponNum: 0,
// isAllScreen: fullSucreen.isAllScreen
isAllScreen: config.isAllScreen
}, },
/** /**
...@@ -60,7 +64,6 @@ wxService.page({ ...@@ -60,7 +64,6 @@ wxService.page({
this.getMemberPointInfo() this.getMemberPointInfo()
// 优惠券数量 // 优惠券数量
this.getMemberCouponInfo() this.getMemberCouponInfo()
}, },
// 查询积分信息 // 查询积分信息
getMemberPointInfo(){ getMemberPointInfo(){
......
{ {
"disableScroll": true,
"navigationBarTitleText": "广东7-Eleven会员专区", "navigationBarTitleText": "广东7-Eleven会员专区",
"usingComponents": { "usingComponents": {
"image-swiper": "/component/imageSwiper/imageSwiper", "image-swiper": "/component/imageSwiper/imageSwiper",
......
...@@ -62,11 +62,11 @@ function getTouchData(endX, endY, startX, startY) { ...@@ -62,11 +62,11 @@ function getTouchData(endX, endY, startX, startY) {
} }
/** /**
* 全面屏 * view宽高比
*/ */
function aspectRatio(h,w) { function aspectRatio(h,w) {
let viewStyle = {} let viewStyle = {}
let originalScale = h/w // view宽高比 let originalScale = h/w
wxService.getSystemInfo().then(res=>{ wxService.getSystemInfo().then(res=>{
let windowscale = res.windowHeight/res.windowWidth let windowscale = res.windowHeight/res.windowWidth
if(originalScale < windowscale){ if(originalScale < windowscale){
...@@ -80,6 +80,20 @@ function aspectRatio(h,w) { ...@@ -80,6 +80,20 @@ function aspectRatio(h,w) {
return viewStyle; 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 参数 * 解析 url 参数
...@@ -262,5 +276,6 @@ module.exports = { ...@@ -262,5 +276,6 @@ module.exports = {
logger: new Logger(), logger: new Logger(),
getTouchData, getTouchData,
getAccountInfo, 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