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 | 62 ++++++++++++++----------------
1 files changed, 29 insertions(+), 33 deletions(-)
diff --git a/wechat_jiaxuan/pages/auth/auth.js b/wechat_jiaxuan/pages/auth/auth.js
index 7557404..e15e1e1 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: '',
@@ -19,6 +19,10 @@
activeHtml: ''
},
initData(){
+ var app = getApp().globalData
+ this.setData({
+ bottomLift: app.bottomLift
+ })
getDictData({
code: 'ZBOM_CUSTOMIZED',
label: 'SERVER_AGREEMENT'
@@ -36,16 +40,10 @@
})
})
},
- 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
@@ -54,27 +52,25 @@
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);
+ },
+ 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()
}
- },
- fail: (err) => {
- console.error('璋冪敤 wx.login 澶辫触', err);
- },
+ })
})
},
onOpen(e){
--
Gitblit v1.9.3