From ebc6e7ee67f13e7aa311e737dfcb4c5caed112ee Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期四, 15 八月 2024 18:23:57 +0800
Subject: [PATCH] ll

---
 wechat_jiaxuan/pages/auth/auth.js |  108 +++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 75 insertions(+), 33 deletions(-)

diff --git a/wechat_jiaxuan/pages/auth/auth.js b/wechat_jiaxuan/pages/auth/auth.js
index 15defe7..be2b2d0 100644
--- a/wechat_jiaxuan/pages/auth/auth.js
+++ b/wechat_jiaxuan/pages/auth/auth.js
@@ -4,13 +4,14 @@
   binDingPhone
 } from '../../api/index'
 Page({
-
   /**
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
     agreementFalg: false,
+    tempPath: '',
     primary: '',
+    bottomLift: 0,
 
     showModal: false,
     serviceHtml: '',
@@ -18,7 +19,11 @@
     privacyHtml: '',
     activeHtml: ''
   },
-  initData(){
+  initData() {
+    var app = getApp().globalData
+    this.setData({
+      bottomLift: app.bottomLift
+    })
     getDictData({
       code: 'ZBOM_CUSTOMIZED',
       label: 'SERVER_AGREEMENT'
@@ -36,48 +41,86 @@
       })
     })
   },
+  handleJudge(e) {
+    const flag = e.currentTarget.dataset.flag
+    console.log(e);
+    this.setData({
+      agreementFalg: flag,
+      showModal: false
+    })
+  },
   loginIn() {
-    const { agreementFalg } = this.data
-    if(!agreementFalg) return wx.showToast({
+    const {
+      agreementFalg
+    } = this.data
+    if (!agreementFalg) return wx.showToast({
       title: '璇峰厛闃呰骞跺悓鎰忕浉鍏冲崗璁�',
       icon: 'none',
       duration: 2000
     })
   },
-  getPhoneNumber (e) {
+  getPhoneNumber(e) {
     console.log(e.detail)
     console.log(e.detail.iv)
     console.log(e.detail.encryptedData)
-    const data = { ...e.detail }
-    getWxMiniPhone({
-      encryptedData: data.encryptedData,
-      iv: data.iv,
-      sessionKey: wx.getStorageSync('sessionKey') || data.iv,
-    }).then(res => {
-      binDingPhone({
-        phone: res.data
-      }).then((res) => {
-        if(res.code == 200){
-          wx.setStorageSync('member', res.data)
-          wx.switchTab({
-            url: '/pages/index/index',
-          })
-        }
+    const data = {
+      ...e.detail
+    }
+    if (e.detail && e.detail.iv) {
+      getWxMiniPhone({
+        encryptedData: data.encryptedData,
+        iv: data.iv,
+        sessionKey: wx.getStorageSync('sessionKey') || data.iv,
+      }).then(res => {
+        binDingPhone({
+          phone: res.data
+        }).then((res) => {
+          if (res.code == 200) {
+            const { tempPath } = this.data
+            wx.setStorageSync('member', res.data)
+            if (tempPath) {
+              if (tempPath == '/pages/webView/index') {
+                wx.navigateTo({
+                  url: '/pages/webView/index',
+                  success: function (res) {
+                    res.eventChannel.emit('acceptDataFromOpenerPage', {
+                      link: wx.getStorageSync('testUrl')
+                    })
+                  }
+                })
+                return
+              }
+              wx.redirectTo({
+                url: tempPath,
+              })
+            } else {
+              wx.navigateBack()
+            }
+          }
+        })
       })
-    })
+    }
+
   },
-  onOpen(e){
+  onOpen(e) {
     console.log('e', e);
-    const { serviceHtml, privacyHtml } = this.data
-    const { index } = e.target.dataset
+    const {
+      serviceHtml,
+      privacyHtml
+    } = this.data
+    const {
+      index
+    } = e.target.dataset
     let activeHtml = index == '0' ? serviceHtml : privacyHtml
     this.setData({
       activeHtml,
       showModal: true
     })
   },
-  onClose(){
-    this.setData({showModal: false})
+  onClose() {
+    this.setData({
+      showModal: false
+    })
   },
   agreementChange(e) {
     this.setData({
@@ -86,23 +129,22 @@
   },
   onLoad(options) {
     var app = getApp().globalData
+    
     this.setData({
       primary: app.primary
     })
     this.initData()
   },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
-   */
   onReady() {
 
   },
 
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
-   */
   onShow() {
+    const tempPath = wx.getStorageSync('tempPath') || ''
+    this.setData({tempPath})
+    setTimeout(() => {
+      wx.setStorageSync('tempPath', '')
+    })
 
   },
 

--
Gitblit v1.9.3