From f4f2891ac617aca6e2a5f1dc8f86ba3f054e3392 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 01 八月 2024 08:52:35 +0800
Subject: [PATCH] aa

---
 wechat_jiaxuan/pages/detailDis/product.js |   37 ++++++++++++++++++++++++++++---------
 1 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/wechat_jiaxuan/pages/detailDis/product.js b/wechat_jiaxuan/pages/detailDis/product.js
index ba7ac8f..beb90e7 100644
--- a/wechat_jiaxuan/pages/detailDis/product.js
+++ b/wechat_jiaxuan/pages/detailDis/product.js
@@ -1,7 +1,9 @@
 import {
   getProductInfo,
-  actionDo
+  actionDo,
+  getMemberInfo
 } from '../../api/index'
+import { eventBus } from '../../utils/eventBus'
 Page({
   /**
    * 椤甸潰鐨勫垵濮嬫暟鎹�
@@ -25,6 +27,28 @@
       actionType: 'view',
       id: options.id
     })
+    const member = wx.getStorageSync('member') || {}
+    if(!member.id){
+      getMemberInfo().then(res => {
+        this.setData({
+          member: res.data
+        })
+      })
+    }
+  },
+  onShow() {
+    const member = wx.getStorageSync('member') || {}
+    if(member && member.id){
+      this.setData({
+        member
+      })
+    }
+  },
+  onUnload() {
+    console.log('璇︽儏杩涜浜嗛攢姣�');
+    setTimeout(() => {
+      eventBus.emit('productDeBack', this.data.info)
+    }, 500)
   },
   onLoad(options) {
     var app = getApp().globalData
@@ -34,10 +58,8 @@
     if (options.origin && options.origin == 'b') {
       this.setData({ origin: 'b' })
     }
-    const member = wx.getStorageSync('member')
     this.setData({
-      id: options.id,
-      member
+      id: options.id
     })
   },
   bindchange(e) {
@@ -66,9 +88,8 @@
   handleAction(e) {
     const actionType = e.currentTarget.dataset.code
     const {
-      info
+      info, member
     } = this.data
-    const member = wx.getStorageSync('member')
     if (member.authStatus == '0') {
       return wx.navigateTo({
         url: '/pages/auth/auth',
@@ -84,6 +105,7 @@
       })
       wx.showToast({
         title: actionType == 'collect' ? '鏀惰棌鎴愬姛' : '鍙栨秷鏀惰棌',
+        icon: "none"
       })
     })
   },
@@ -189,9 +211,6 @@
     })
   },
   onHide() {
-
-  },
-  onUnload() {
 
   },
   onPullDownRefresh() {

--
Gitblit v1.9.3