From bf9ff43046b860bcab7e5653c8799bb95e539945 Mon Sep 17 00:00:00 2001
From: zuoxiao <zuoxiao>
Date: 星期四, 07 八月 2025 10:09:12 +0800
Subject: [PATCH] 更新项目配置,将登录方式从账号密码登录改为验证码登录,以支持新的登录策略。
---
pages/groupDetail/groupDetail.js | 114 +++++----------------------------------------------------
1 files changed, 10 insertions(+), 104 deletions(-)
diff --git a/pages/groupDetail/groupDetail.js b/pages/groupDetail/groupDetail.js
index 600a6b4..edec131 100644
--- a/pages/groupDetail/groupDetail.js
+++ b/pages/groupDetail/groupDetail.js
@@ -1,4 +1,5 @@
const app = getApp();
+const { get } = require('../../api/request');
Page({
/**
@@ -46,112 +47,15 @@
refreshing: true
});
- console.log('寮�濮嬪姞杞借疆鐏岀粍璇︽儏锛実roupId:', this.data.groupId);
-
- // 妫�鏌piBaseUrl鏄惁瀛樺湪
- if (!app.globalData.apiBaseUrl) {
- try {
- // 浠巆onfig妯″潡鑾峰彇鍩虹URL
- const config = require('../../api/config');
- const { PROJECT_CONFIG } = require('../../utils/projectConfig');
-
- // 鑾峰彇褰撳墠閫変腑鐨勯」鐩爣璇�
- const tag = wx.getStorageSync('projectTag') || app.globalData.tag || 'mq';
-
- // 鏍规嵁tag鎵惧埌瀵瑰簲椤圭洰閰嶇疆
- let selectedProject = 'MQ'; // 榛樿涓烘皯鍕ら」鐩�
- for (const key in PROJECT_CONFIG) {
- if (PROJECT_CONFIG[key].tag === tag) {
- selectedProject = key;
- break;
- }
- }
-
- // 璁剧疆apiBaseUrl
- app.globalData.apiBaseUrl = PROJECT_CONFIG[selectedProject].serverUrl;
- console.log('浠庨厤缃腑鑾峰彇apiBaseUrl:', app.globalData.apiBaseUrl);
- } catch (error) {
- console.error('鑾峰彇apiBaseUrl澶辫触:', error);
- // 浣跨敤璇锋眰搴撲腑鐨勬柟娉�
- const { get } = require('../../api/request');
-
- get({
- url: '/wx/irrigation/getGroupDetails',
- data: { groupId: this.data.groupId },
- isShowLoding: true
- }).then(res => {
- if (res.success) {
- this.handleGroupDetailsResponse(res);
- } else {
- wx.showToast({
- title: res.msg || '鑾峰彇鏁版嵁澶辫触',
- icon: 'none'
- });
- }
- }).catch(err => {
- console.error('璇锋眰澶辫触:', err);
- wx.showToast({
- title: '缃戠粶閿欒',
- icon: 'none'
- });
- }).finally(() => {
- this.setData({
- refreshing: false
- });
- });
-
- return; // 宸茬粡浣跨敤璇锋眰搴撳鐞嗭紝鐩存帴杩斿洖
- }
- }
-
- // 浣跨敤wx.request鍙戦�佽姹�
- wx.request({
- url: `${app.globalData.apiBaseUrl}/wx/irrigation/getGroupDetails`,
- method: 'GET',
+ get({
+ url: '/wx/irrigation/getGroupDetails',
data: {
groupId: this.data.groupId
},
- header: {
- 'content-type': 'application/json',
- 'Authorization': wx.getStorageSync('token') || '',
- 'tag': wx.getStorageSync('projectTag') || app.globalData.tag || '',
- 'appId': app.globalData.AppID || ''
- },
- success: (res) => {
- console.log('杞亴缁勮鎯呮帴鍙h繑鍥�:', res.data);
-
- if (res.data && res.data.success) {
- this.handleGroupDetailsResponse(res.data);
- } else {
- wx.showToast({
- title: res.data.msg || '鑾峰彇鏁版嵁澶辫触',
- icon: 'none'
- });
- this.setData({
- refreshing: false
- });
- }
- },
- fail: (err) => {
- console.error('璇锋眰澶辫触:', err);
- // 灏濊瘯浣跨敤璇锋眰搴撻噸璇�
- this.retryUsingRequestLib();
- }
- });
- },
-
- /**
- * 浣跨敤璇锋眰搴撻噸璇曡幏鍙栨暟鎹�
- */
- retryUsingRequestLib: function() {
- console.log('浣跨敤璇锋眰搴撻噸璇曡幏鍙栨暟鎹�');
- const { get } = require('../../api/request');
-
- get({
- url: '/wx/irrigation/getGroupDetails',
- data: { groupId: this.data.groupId },
isShowLoding: true
}).then(res => {
+ console.log('杞亴缁勮鎯呮帴鍙h繑鍥�:', res);
+
if (res.success) {
this.handleGroupDetailsResponse(res);
} else {
@@ -159,20 +63,22 @@
title: res.msg || '鑾峰彇鏁版嵁澶辫触',
icon: 'none'
});
+ this.setData({
+ refreshing: false
+ });
}
}).catch(err => {
- console.error('璇锋眰搴撻噸璇曞け璐�:', err);
+ console.error('璇锋眰澶辫触:', err);
wx.showToast({
title: '缃戠粶閿欒',
icon: 'none'
});
- }).finally(() => {
this.setData({
refreshing: false
});
});
},
-
+
/**
* 澶勭悊杞亴缁勮鎯呭搷搴旀暟鎹�
*/
--
Gitblit v1.8.0