From a75b18a4157ab486e0b51c438ac165ab3a08e3e0 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期四, 25 七月 2024 18:10:00 +0800
Subject: [PATCH] 代码提交
---
wechat_jiaxuan/app.js | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 50 insertions(+), 6 deletions(-)
diff --git a/wechat_jiaxuan/app.js b/wechat_jiaxuan/app.js
index 746a9f2..1cc3c46 100644
--- a/wechat_jiaxuan/app.js
+++ b/wechat_jiaxuan/app.js
@@ -1,16 +1,60 @@
-// app.js
+import {
+ wxLoginCustomer
+} from './api/index'
App({
globalData: {
primary: '#B08771',
bottomLift: ''
},
- onLaunch: function () {
+ onLaunch: function (op) {
+ console.log('options', op.query.scene)
+ let pathMap = [
+ '/pages/detailDis/product',
+ '/pages/detailDis/case',
+ '/pages/detailDis/realpic',
+ '/pages/consult/detail',
+ '/pages/productVideo/index',
+ ]
//鑾峰彇褰撳墠璁惧淇℃伅
const WindowInfo = wx.getWindowInfo()
- console.log('WindowInfo', WindowInfo);
if (WindowInfo.safeArea.top > 20) {
- this.globalData.bottomLift = WindowInfo.screenHeight - WindowInfo.safeArea.bottom;
- console.log(this.globalData.bottomLift);
+ 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)
+ if (op.query.scene) {
+ let temp = op.query.scene.split('_')
+ wx.navigateTo({
+ url: `${pathMap[temp[1]]}?id=${temp[0]}&userId=${temp[2]}`,
+ })
+ }
+ } else {
+ console.log('鐧诲綍澶辫触锛�')
+ }
+ })
+ } else {
+ console.log('鐧诲綍澶辫触锛�' + res)
+ }
+ },
+ fail(err) {
+ console.log(err)
+ }
+ })
+
+
+
}
-})
+})
\ No newline at end of file
--
Gitblit v1.9.3