|
@@ -12,6 +12,7 @@ Page({
|
|
|
url:null,
|
|
|
type:0, //默认nav 为1表示switch
|
|
|
back:1,
|
|
|
+ onUnload:true,//默认为true,表示头部返回操作
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -50,8 +51,9 @@ Page({
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
- onUnload: function () {
|
|
|
- if(this.data.back == 2){ //表示需要返回2级,给首页
|
|
|
+ onUnload: function (e) {
|
|
|
+ console.log(e,"监听页面卸载")
|
|
|
+ if (this.data.back == 2 && this.data.onUnload){ //表示需要返回2级,给首页
|
|
|
wx.reLaunch({
|
|
|
url: '/pages/index/index'
|
|
|
})
|
|
@@ -122,10 +124,15 @@ Page({
|
|
|
},
|
|
|
success(res) {
|
|
|
wx.setStorageSync('channelName', res.data.channel.channelName)
|
|
|
+ console.log(that.data.type, "that.data.type")
|
|
|
+ that.setData({
|
|
|
+ onUnload:false, //表示离开,不是返回操作
|
|
|
+ })
|
|
|
if(that.data.type ==1){
|
|
|
- wx.switchTab({
|
|
|
- url:that.data.url,
|
|
|
- })
|
|
|
+ console.log(that.data.url,"that.data.url")
|
|
|
+ wx.switchTab({
|
|
|
+ url: that.data.url,
|
|
|
+ })
|
|
|
} else {
|
|
|
wx.redirectTo({
|
|
|
url:that.data.url,
|