Commit 4570476bad446fbed1d1e6ec402829c9dce1c9cd

Authored by wangfan
1 parent 83d35bc9

导航修复

... ... @@ -4,31 +4,31 @@ Component({
* 组件的属性列表
*/
properties: {
backgroundColor:{
type:String,
value:'#ffffff'
backgroundColor: {
type: String,
value: '#ffffff'
},
color:{
type:String,
value:'#000000'
},
hasHome:{
type:Boolean,
value:false
}
color: {
type: String,
value: '#000000'
},
hasHome: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
disHome:false,
disBack:false,
disHome: false,
disBack: false,
},
attached(){
this.init();
},
attached(){
this.init();
},
/**
* 组件的方法列表
*/
... ... @@ -37,38 +37,47 @@ Component({
this.triggerEvent('NavEvent');
wx.navigateBack();
},
home(){
if(!this.data.disHome) return;
wx.reLaunch({
url:'/pages/customer/index'
})
},
init(){
let wxBarHeight=68;
let disBack = false;
let disHome = false;
let pages = getCurrentPages();
console.log('pages.length',pages[0]);
if (pages.length > 1) {
disBack = true;
} else {
//if (getApp().shareTicket && this.data.hasHome) {
if (this.data.hasHome && pages[0].route!="pages/customer/list") {
disHome = true;
}
}
let statusBarHeight=40;
if(getApp().system.system){
statusBarHeight=getApp().system.statusBarHeight
*(getApp().system.system.toLowerCase().indexOf('ios')>-1?2:getApp().system.pixelRatio);
}
this.setData({
statusBarHeight: statusBarHeight,
disHome: disHome,
disBack: disBack,
statusBarHeightFull:wxBarHeight + statusBarHeight,
})
console.log('this.setData',this.data);
},
home(){
if (!this.data.disHome) return;
wx.reLaunch({
url: '/pages/customer/index'
})
},
init(){
let disBack = false;
let disHome = false;
let pages = getCurrentPages();
console.log('pages.length', pages[0]);
if (pages.length > 1) {
disBack = true;
} else {
//if (getApp().shareTicket && this.data.hasHome) {
if (this.data.hasHome && pages[0].route != "pages/customer/list") {
disHome = true;
}
}
//导航栏自适应
let systemInfo = wx.getSystemInfoSync();
let reg = /ios/i;
let pt = 20;//导航状态栏上内边距
let h = 44;//导航状态栏高度
if(reg.test(systemInfo.system)){
pt = systemInfo.statusBarHeight;
h = 44;
}else{
pt = systemInfo.statusBarHeight;
h = 48;
}
this.setData({
statusBarHeight: pt,
disHome: disHome,
disBack: disBack,
statusBarHeightFull: pt + h,
titleBarHeight:h,
})
console.log('this.setData', this.data);
},
}
})
... ...
<!--components/nav/nav.wxml-->
<view class="nav-main-space" style="height: {{statusBarHeightFull}}rpx;">
<view class="nav-main-space" style="height: {{statusBarHeightFull}}px;">
<view class="nav-main" style="background-color: {{backgroundColor}};color:{{color}};">
<view class="nav" style="margin-top: {{statusBarHeight}}rpx;">
<view class="flex-lr part">
<view class="nav" style="margin-top: {{statusBarHeight}}px;">
<view class="flex-lr part" style="height: {{titleBarHeight}}px; line-height: {{titleBarHeight}}px">
<view class="opt flex-ll">
<view class="back flex-vc" bindtap="back" wx:if="{{disBack}}">
<image class="back-image"
... ...
... ... @@ -10,8 +10,6 @@
font-weight: bold;
}
.nav .part{
line-height: 68rpx;
height: 68rpx;
text-align: center;
}
... ... @@ -22,10 +20,11 @@
}
.nav .part .opt{
min-width: 188rpx;
height: 100%;
}
.nav .part .opt view{
width: 68rpx;
height: 68rpx;
height: 100%;
margin-left: 26rpx;
}
.nav .part .opt .back-image{
... ...