Browse Source

修改登录专区后进入首页问题

sharp-agezi 5 years ago
parent
commit
cc5b029018
3 changed files with 14 additions and 7 deletions
  1. 12 5
      pages/login/login.js
  2. 1 1
      pages/momo/momo.wxml
  3. 1 1
      readme.md

+ 12 - 5
pages/login/login.js

@@ -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,

+ 1 - 1
pages/momo/momo.wxml

@@ -7,7 +7,7 @@
 <view class='gift-box'>
   <!-- goodsList -->
     <view class='f-box f-flex-wrap f-justify-content-between'>
-      <view class='goods-list' wx:for="{{goodsList}}" data-id="{{item.id}}" bindtap='toGoodsDetail'>
+      <view class='goods-list' wx:for="{{goodsList}}" wx:key="id" data-id="{{item.id}}" bindtap='toGoodsDetail'>
         <image src='{{host}}/images/{{item.logo[0]}}' class='goods-img' mode='aspectFit'></image>
         <!-- <view class='goods-summary'></view> -->
         <view class='goods-title'>{{item.commodity_name}}</view>

+ 1 - 1
readme.md

@@ -17,4 +17,4 @@
       y = -高度/2
       fillRect(x,y,宽度,高度)
 ### 缺少详情页,字体加粗、字体定制
-v:3.2.3
+v:3.2.5