From d41f1f707dc643b726a42b9d2a63b186dd9e4f28 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 06 八月 2024 16:12:38 +0800
Subject: [PATCH] ll
---
wechat_jiaxuan/pages/auth/auth.js | 116 +++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 74 insertions(+), 42 deletions(-)
diff --git a/wechat_jiaxuan/pages/auth/auth.js b/wechat_jiaxuan/pages/auth/auth.js
index 7557404..694c102 100644
--- a/wechat_jiaxuan/pages/auth/auth.js
+++ b/wechat_jiaxuan/pages/auth/auth.js
@@ -1,16 +1,16 @@
import {
- wxLoginCustomer,
getDictData,
- getWxMiniPhone
+ getWxMiniPhone,
+ binDingPhone
} from '../../api/index'
Page({
-
/**
* 椤甸潰鐨勫垵濮嬫暟鎹�
*/
data: {
agreementFalg: false,
primary: '',
+ bottomLift: 0,
showModal: false,
serviceHtml: '',
@@ -18,7 +18,11 @@
privacyHtml: '',
activeHtml: ''
},
- initData(){
+ initData() {
+ var app = getApp().globalData
+ this.setData({
+ bottomLift: app.bottomLift
+ })
getDictData({
code: 'ZBOM_CUSTOMIZED',
label: 'SERVER_AGREEMENT'
@@ -36,59 +40,87 @@
})
})
},
- 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'),
+ 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
})
- wx.login({
- success: (res) => {
- if (res.code) {
- // 鑾峰彇鍒扮敤鎴风櫥褰曞嚟璇� code
- const code = res.code;
- wx.setStorageSync('code', res.code)
- // 灏� code 鍙戦�佺粰鍚庣鏈嶅姟鍣�
- wxLoginCustomer({code}).then(ress => {
- wx.setStorageSync('token', ress.data.token)
- wx.setStorageSync('member', ress.data.member)
- wx.redirectTo({
- url: '/pages/index/index',
- })
- })
- } else {
- console.error('鑾峰彇鐢ㄦ埛鐧诲綍鍑瘉澶辫触', res.errMsg);
- }
- },
- fail: (err) => {
- console.error('璋冪敤 wx.login 澶辫触', err);
- },
- })
},
- onOpen(e){
+ getPhoneNumber(e) {
+ console.log(e.detail)
+ console.log(e.detail.iv)
+ console.log(e.detail.encryptedData)
+ 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 = wx.getStorageSync('tempPath') || ''
+ wx.setStorageSync('member', res.data)
+ if (tempPath) {
+ wx.setStorageSync('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) {
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({
--
Gitblit v1.9.3