96 lines
2.1 KiB
JavaScript
96 lines
2.1 KiB
JavaScript
import Utils from '../../commons/js/utils/util'
|
|
Component({
|
|
/**
|
|
* 组件的属性列表
|
|
*/
|
|
properties: {
|
|
titleText: {
|
|
type: String,
|
|
value: ''
|
|
},
|
|
txtColor: {
|
|
type: String,
|
|
value: 'transparent'
|
|
},
|
|
bgColor: {
|
|
type: String,
|
|
value: '#1a1a1a'
|
|
},
|
|
isShowBg: {
|
|
type: Boolean,
|
|
value: false
|
|
},
|
|
type: {
|
|
type: String,
|
|
value: ''
|
|
},
|
|
city:{
|
|
type: String,
|
|
value: ''
|
|
},
|
|
homeShowBar:{
|
|
type: Boolean,
|
|
value: true
|
|
},
|
|
homeShowTitle:{
|
|
type: Boolean,
|
|
value: false
|
|
}
|
|
},
|
|
attached: function () {
|
|
this.setNavSize()
|
|
},
|
|
data: {
|
|
isShowRetBtn: false,
|
|
isShowHomeBtn: false,
|
|
homeInfo:{
|
|
placeholder: '搜索城市好店、好评...',
|
|
url: '/pages/search/index'
|
|
}
|
|
},
|
|
pageLifetimes: {
|
|
show: function () {
|
|
let pages = getCurrentPages();
|
|
if (pages.length == 1) {
|
|
this.setData({
|
|
isShowRetBtn: true
|
|
})
|
|
}
|
|
if (Utils.getCurrentPath().url == 'pages/index/index'||Utils.getCurrentPath().url == 'pages/login/index'||Utils.getCurrentPath().url == 'pages/customer/index'||Utils.getCurrentPath().url == 'pages/order/index'||Utils.getCurrentPath().url == 'pages/channel/index'||Utils.getCurrentPath().url == 'pages/dataAnalysis/index') {
|
|
this.setData({
|
|
isShowHomeBtn: true
|
|
})
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
// 通过获取系统信息计算导航栏高度
|
|
setNavSize: function () {
|
|
var that = this,
|
|
sysinfo = wx.getSystemInfoSync(),
|
|
statusHeight = sysinfo.statusBarHeight,
|
|
isiOS = sysinfo.system.indexOf('iOS') > -1,
|
|
navHeight;
|
|
if (!isiOS) {
|
|
navHeight = 48;
|
|
} else {
|
|
navHeight = 44;
|
|
}
|
|
that.setData({
|
|
status: statusHeight,
|
|
navHeight: navHeight
|
|
})
|
|
},
|
|
// 返回事件
|
|
back: function () {
|
|
wx.navigateBack({
|
|
delta: 1
|
|
})
|
|
},
|
|
home: function () {
|
|
wx.switchTab({
|
|
url: '/pages/index/index'
|
|
})
|
|
}
|
|
}
|
|
}) |