From 2da083225417ef7007842b84e7276242faeb0e35 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期一, 05 八月 2024 16:18:58 +0800
Subject: [PATCH] lll
---
wechat_jiaxuan/pages/sets/index.js | 89 +++++++++++++++++++++++++-------------------
1 files changed, 50 insertions(+), 39 deletions(-)
diff --git a/wechat_jiaxuan/pages/sets/index.js b/wechat_jiaxuan/pages/sets/index.js
index 2aacd81..f0012fe 100644
--- a/wechat_jiaxuan/pages/sets/index.js
+++ b/wechat_jiaxuan/pages/sets/index.js
@@ -2,14 +2,17 @@
wxLogOff,
wxLoginCustomer
} from '../../api/index'
-import { eventBus } from '../../utils/eventBus'
+import {
+ eventBus
+} from '../../utils/eventBus'
Page({
/**
* 椤甸潰鐨勫垵濮嬫暟鎹�
*/
data: {
- show: false
+ show: false,
+ showLogout: false
},
/**
@@ -32,44 +35,52 @@
let that = this
wxLogOff().then(res => {
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(() => {
- eventBus.emit("reloadHome")
- }, 1000)
- setTimeout(() => {
- wx.switchTab({
- url: '/pages/index/index',
- })
- }, 500)
- } else {
- console.log('鐧诲綍澶辫触锛�')
- }
- })
- } else {}
- },
- fail(err) {
- wx.showToast({
- title: '娉ㄩ攢澶辫触',
- })
- wx.switchTab({
- url: '/pages/index/index',
- })
- }
+ wx.showToast({
+ title: '娉ㄩ攢鎴愬姛',
})
+ that.setData({
+ showLogout: true
+ })
+ })
+ },
+ appClose() {
+ 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)
+ this.setData({
+ showLogout: false
+ })
+ setTimeout(() => {
+ eventBus.emit("reloadHome")
+ }, 1000)
+ setTimeout(() => {
+ wx.switchTab({
+ url: '/pages/index/index',
+ })
+ }, 500)
+ } else {
+ console.log('鐧诲綍澶辫触锛�')
+ }
+ })
+ } else {}
+ },
+ fail(err) {
+ wx.showToast({
+ title: '娉ㄩ攢澶辫触',
+ })
+ wx.switchTab({
+ url: '/pages/index/index',
+ })
+ }
})
},
changeDeal(e) {
--
Gitblit v1.9.3