From 917252ef3ea2b63c74d162cc67a6fbe103cb9b4d Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期五, 25 十月 2024 14:06:09 +0800
Subject: [PATCH] 1.开关阀记录界面。2.虚拟卡充值相关。3.问题反馈相关
---
pages/wxlogin/wxlogin.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/pages/wxlogin/wxlogin.js b/pages/wxlogin/wxlogin.js
index 2669ff4..81782fe 100644
--- a/pages/wxlogin/wxlogin.js
+++ b/pages/wxlogin/wxlogin.js
@@ -1,26 +1,68 @@
// pages/wxlogin/wxlogin.js
+const {
+ get,
+ post
+} = require('../../api/request.js');
Page({
data: {
userInfo: null
},
- /**
+ /**
* 鑾峰彇寰俊code
*/
getCode: function (e) {
+ const that = this;
wx.login({
success: function (res) {
if (res.code) {
var code = res.code;
console.log(code);
- wx.navigateTo({
- url: '/pages/wxbind/wxbind'
- })
// 灏哻ode鍙戦�佸埌鏈嶅姟鍣ㄨ幏鍙杘penid
+ that.codeLogin(code);
} else {
console.log('鐧诲綍澶辫触锛�' + res.errMsg);
}
}
});
+ },
+ //寰俊code鐧诲綍
+ codeLogin(codeData) {
+ wx.showLoading({
+ title: '姝e湪鐧诲綍璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧
+ mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
+ });
+ const data = {
+ code: codeData, //涓存椂鐧诲綍鍑瘉
+ };
+ post({
+ url: "wx/client/code_login",
+ data: data,
+ }).then(response => {
+ // 澶勭悊鎴愬姛鍝嶅簲
+ console.log('璇锋眰鎴愬姛:', response);
+ // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+ wx.hideLoading();
+ //閲嶆柊鑾峰彇鍒楄〃鍒锋柊鏁版嵁
+ if (response.code === "0001") {
+ if (response.content.client.clientId === "") {
+ wx.navigateTo({
+ url: '/pages/wxbind/wxbind'
+ })
+ } else {
+ wx.navigateTo({
+ url: '/pages/home/home'
+ })
+ }
+ } else {
+
+ }
+ }).catch(error => {
+ // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+ wx.hideLoading();
+ // 澶勭悊閿欒鍝嶅簲
+ console.error('璇锋眰澶辫触:', error);
+ });
}
+
})
\ No newline at end of file
--
Gitblit v1.8.0