From 39613118a5bae23c45498c4f5a939e83595f99f5 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 16 七月 2024 16:05:00 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
wechat_jiaxuan/app.js | 37 +++++++++++++++++++++++++++++++++++--
1 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/wechat_jiaxuan/app.js b/wechat_jiaxuan/app.js
index bcf5be3..bf87c72 100644
--- a/wechat_jiaxuan/app.js
+++ b/wechat_jiaxuan/app.js
@@ -1,4 +1,4 @@
-// app.js
+import { wxLoginCustomer } from './api/index'
App({
globalData: {
primary: '#B08771',
@@ -10,5 +10,38 @@
if (WindowInfo.safeArea.top > 20) {
this.globalData.bottomLift = WindowInfo.screenHeight - WindowInfo.safeArea.bottom;
}
+ //
+ const res = wx.getStorageSync('member')
+ if (res) {
+ this.globalData.userInfo = res
+ } else {
+ // 鐧诲綍
+ wx.login({
+ timeout: 5000,
+ success(res) {
+ if (res.code) {
+ //鍙戣捣缃戠粶璇锋眰
+ wxLoginCustomer({
+ code: res.code
+ }).then(res => {
+ console.log(res)
+ if (res && res.data.member) {
+ wx.setStorageSync('member', res.data.member)
+ wx.setStorageSync('openid', res.data.member.openid)
+ wx.setStorageSync('sessionKey', res.data.sessionKey)
+ wx.setStorageSync('token', res.data.token)
+ } else {
+ console.log('鐧诲綍澶辫触锛�')
+ }
+ })
+ } else {
+ console.log('鐧诲綍澶辫触锛�' + res)
+ }
+ },
+ fail(err) {
+ console.log(err)
+ }
+ })
+ }
}
-})
+})
\ No newline at end of file
--
Gitblit v1.9.3