You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

81 lines
1.6 KiB

// pages/component/TitleHeader.js
var app = getApp()
Component({
options: {
styleIsolation: 'apply-shared',
addGlobalClass: true
},
/**
* 组件的属性列表
*/
properties: {
title:{
type:String,
value:""
},
transparent:{
type:String,
value:"0"
},
clickid:{
type:String,
value:""
}
},
/**
* 组件的初始数据
*/
data: {
height: 90,
padHeight:0,
right:0
},
lifetimes:{
attached:function(){
let systemInfo = wx.getSystemInfoSync(),rect = wx.getMenuButtonBoundingClientRect();
let height = (rect.top - systemInfo.statusBarHeight) * 2 + rect.height;
this.setData({
height:height,
padHeight:systemInfo.statusBarHeight,
right:(systemInfo.screenWidth - rect.right) + rect.width
})
}
},
/**
* 组件的方法列表
*/
methods: {
back:function(){
// if(this.properties.clickid){
// wx.uma.trackEvent(this.properties.clickid)
// }
const pages = getCurrentPages();
if(pages[pages.length-1].route.indexOf('login')!=-1 || pages[pages.length-1].route.indexOf('bindTel')!=-1){
// 如果是登录页面的返回需要返回两层
if(pages.length>2){
wx.navigateBack({
delta: 2
})
}
else {
wx.reLaunch({
url: "/pages/index/index"
})
}
}
else if (pages.length>1){
wx.navigateBack({
delta: 1
})
}
else {
wx.reLaunch({
url: "/pages/index/index"
})
}
}
}
})