From 0358677c06e86f05c992f406c9714a32b30a235d Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期四, 18 七月 2024 18:42:21 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/zbomyoujia

---
 wechat_jiaxuan/app.js |   31 +++++++++++++++++++++++++++++--
 1 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/wechat_jiaxuan/app.js b/wechat_jiaxuan/app.js
index bcf5be3..e56016f 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,32 @@
     if (WindowInfo.safeArea.top > 20) {
       this.globalData.bottomLift = WindowInfo.screenHeight - WindowInfo.safeArea.bottom;
     }
+    // 
+    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