From 680028df90e18299ea72d242a28a3ddcd9a0441c Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 24 七月 2024 13:45:36 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 wechat_jiaxuan/pages/sets/index.js |   68 +++++++++++++++++++++++++++------
 1 files changed, 55 insertions(+), 13 deletions(-)

diff --git a/wechat_jiaxuan/pages/sets/index.js b/wechat_jiaxuan/pages/sets/index.js
index 67eae09..7b2701b 100644
--- a/wechat_jiaxuan/pages/sets/index.js
+++ b/wechat_jiaxuan/pages/sets/index.js
@@ -1,4 +1,9 @@
-import { wxLogOff } from '../../api/index'
+import {
+  wxLogOff,
+  wxLoginCustomer
+} from '../../api/index'
+const { HYEventBus } = require('hy-event-store')
+const eventBus = new HYEventBus()
 Page({
 
   /**
@@ -15,26 +20,63 @@
 
   },
   showLogout() {
-    this.setData({show: true})
+    this.setData({
+      show: true
+    })
   },
   onClose() {
-    this.setData({show: false})
+    this.setData({
+      show: false
+    })
   },
   onSubLgout() {
+    let that = this
     wxLogOff().then(res => {
-      wx.removeStorageSync('token')
-      wx.removeStorageSync('member')
-      wx.removeStorageSync('code')
-      wx.showToast({
-        title: '娉ㄩ攢鎴愬姛',
-      })
-      wx.switchTab({
-        url: '/pages/index/index',
+      wx.clearStorage()
+      wx.login({
+        timeout: 5000,
+        success(res) {
+          if (res.code) {
+            //鍙戣捣缃戠粶璇锋眰
+            wxLoginCustomer({
+              code: res.code
+            }).then(res => {
+              console.log(res)
+              if (res && res.data.token) {
+                wx.setStorageSync('sessionKey', res.data.sessionKey)
+                wx.setStorageSync('token', res.data.token)
+                wx.showToast({
+                  title: '娉ㄩ攢鎴愬姛',
+                })
+                setTimeout(() => {
+                  wx.switchTab({
+                    url: '/pages/index/index',
+                  })
+                }, 500)
+                setTimeout(() => {
+                  eventBus.emit("reloadHome")
+                }, 1000) 
+              } else {
+                console.log('鐧诲綍澶辫触锛�')
+              }
+            })
+          } else {}
+        },
+        fail(err) {
+          wx.showToast({
+            title: '娉ㄩ攢澶辫触',
+          })
+          wx.switchTab({
+            url: '/pages/index/index',
+          })
+        }
       })
     })
   },
-  changeDeal(e){
-    const { label } = e.currentTarget.dataset 
+  changeDeal(e) {
+    const {
+      label
+    } = e.currentTarget.dataset
     wx.navigateTo({
       url: '/pages/sets/protocol?label=' + label,
     })

--
Gitblit v1.9.3