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.
117 lines
2.7 KiB
117 lines
2.7 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('linkman/add')==-1){
|
|
app.globalData.index = app.globalData.index -1
|
|
console.log(app.globalData.index, 'appGlobalIndex')
|
|
}
|
|
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[pages.length-1].route.indexOf('cartlist') != -1){
|
|
// wx.switchTab({
|
|
// url: '/pages/user/user'
|
|
// })
|
|
// }
|
|
else if (pages[pages.length-1].route.indexOf('pages/order/pay/index') != -1){
|
|
wx.redirectTo({
|
|
url:'/pages/user/order/list'
|
|
})
|
|
}
|
|
else if (pages[pages.length-1].route.indexOf('pages/user/order/list') != -1){
|
|
wx.switchTab({
|
|
url: '/pages/user/user'
|
|
})
|
|
} else if (pages[pages.length-1].route.indexOf('pages/user/cartlist/list') != -1){
|
|
wx.switchTab({
|
|
url: '/pages/user/user'
|
|
})
|
|
}
|
|
|
|
|
|
else if (pages[pages.length-1].route.indexOf('orderList') != -1){
|
|
wx.navigateTo({
|
|
url: '/pages/user/cartlist/list'
|
|
})
|
|
}
|
|
// else if (pages[pages.length-1].route.indexOf('scene') != -1){
|
|
// console.log(22222);
|
|
// wx.reLaunch({
|
|
// url: "/pages/user/cartlist/list"
|
|
// })
|
|
// }
|
|
else if (pages.length>1){
|
|
wx.navigateBack({
|
|
delta: 1
|
|
})
|
|
}
|
|
else {
|
|
wx.reLaunch({
|
|
url: "/pages/index/index"
|
|
})
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|