From d9a89d83c2048a964f16ca179feb2b7f21b9d33a Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 29 七月 2024 16:28:47 +0800
Subject: [PATCH] 提交

---
 wechat_jiaxuan/pages/auth/auth.js |   86 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 82 insertions(+), 4 deletions(-)

diff --git a/wechat_jiaxuan/pages/auth/auth.js b/wechat_jiaxuan/pages/auth/auth.js
index 208eec1..e15e1e1 100644
--- a/wechat_jiaxuan/pages/auth/auth.js
+++ b/wechat_jiaxuan/pages/auth/auth.js
@@ -1,14 +1,91 @@
-// pages/auth/auth.js
+import {
+  getDictData,
+  getWxMiniPhone,
+  binDingPhone
+} from '../../api/index'
 Page({
-
   /**
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
     agreementFalg: false,
-    primary: ''
-  },
+    primary: '',
+    bottomLift: 0,
 
+    showModal: false,
+    serviceHtml: '',
+    title: '',
+    privacyHtml: '',
+    activeHtml: ''
+  },
+  initData(){
+    var app = getApp().globalData
+    this.setData({
+      bottomLift: app.bottomLift
+    })
+    getDictData({
+      code: 'ZBOM_CUSTOMIZED',
+      label: 'SERVER_AGREEMENT'
+    }).then(res => {
+      this.setData({
+        serviceHtml: res.data.code
+      })
+    })
+    getDictData({
+      code: 'ZBOM_CUSTOMIZED',
+      label: 'PRIVACY_AGREEMENT'
+    }).then(res => {
+      this.setData({
+        privacyHtml: res.data.code
+      })
+    })
+  },
+  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({
+      title: '璇峰厛闃呰骞跺悓鎰忕浉鍏冲崗璁�',
+      icon: 'none',
+      duration: 2000
+    })
+  },
+  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.navigateBack()
+        }
+      })
+    })
+  },
+  onOpen(e){
+    console.log('e', e);
+    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})
+  },
   agreementChange(e) {
     this.setData({
       agreementFalg: e.detail,
@@ -19,6 +96,7 @@
     this.setData({
       primary: app.primary
     })
+    this.initData()
   },
 
   /**

--
Gitblit v1.9.3