From 5db0b5a4ae6124624d197bcebff28b3a9ed46400 Mon Sep 17 00:00:00 2001
From: zuoxiao <zuoxiao>
Date: 星期一, 12 五月 2025 16:48:53 +0800
Subject: [PATCH] 添加账号密码登录页面的跳转逻辑,优化登录方式选择;更新项目配置以支持不同登录方式,提升用户体验。

---
 app.json                             |    1 
 pages/home/home.js                   |  324 +++++++++++++++++---
 pages/accountLogin/accountLogin.js   |  315 +++++++++++++++++++
 pages/accountLogin/accountLogin.json |    4 
 pages/login/login.js                 |   42 ++
 pages/login/login.wxss               |    2 
 pages/login/login.wxml               |    5 
 pages/accountLogin/accountLogin.wxss |  159 +++++++++
 utils/projectConfig.js               |   30 +
 pages/accountLogin/accountLogin.wxml |   36 ++
 10 files changed, 862 insertions(+), 56 deletions(-)

diff --git a/app.json b/app.json
index 4d1ea1c..aa6ca15 100644
--- a/app.json
+++ b/app.json
@@ -6,6 +6,7 @@
     "pages/feedback/feedback",
     "pages/wxlogin/wxlogin",
     "pages/login/login",
+    "pages/accountLogin/accountLogin",
     "pages/wxbind/wxbind",
     "pages/rechargeList/rechargeList",
     "pages/wallet/wallet",
diff --git a/pages/accountLogin/accountLogin.js b/pages/accountLogin/accountLogin.js
new file mode 100644
index 0000000..6f0d495
--- /dev/null
+++ b/pages/accountLogin/accountLogin.js
@@ -0,0 +1,315 @@
+const app = getApp();
+const storage = require('../../utils/storage.js');
+const {
+  post
+} = require('../../api/request.js');
+const { PROJECT_CONFIG } = require('../../utils/projectConfig.js');
+const { setBaseUrl } = require('../../api/config.js');
+
+Page({
+
+  /**
+   * 椤甸潰鐨勫垵濮嬫暟鎹�
+   */
+  data: {
+    username: '',
+    password: '',
+    passwordVisible: false,
+    projectName: '鍢夊唱鍏抽」鐩�', // 榛樿椤圭洰鍚嶇О
+    selectedProject: 'JYG', // 榛樿椤圭洰浠g爜
+    showErrorDialog: false,
+    fromBack: false,  // 鏍囪鏄惁鏄粠杩斿洖鎸夐挳杩斿洖鐨�
+    manualNavigate: false // 鏍囪鏄惁鏄�氳繃缂栫▼鏂瑰紡瀵艰埅鐨�
+  },
+
+  /**
+   * 缁戝畾鐢ㄦ埛鍚嶈緭鍏�
+   */
+  bindUsernameInput: function (e) {
+    this.setData({
+      username: e.detail.value
+    });
+  },
+
+  /**
+   * 缁戝畾瀵嗙爜杈撳叆
+   */
+  bindPasswordInput: function (e) {
+    this.setData({
+      password: e.detail.value
+    });
+  },
+
+  /**
+   * 鍒囨崲瀵嗙爜鏄剧ず鐘舵��
+   */
+  togglePasswordVisibility: function () {
+    this.setData({
+      passwordVisible: !this.data.passwordVisible
+    });
+  },
+
+  /**
+   * 鐧诲綍
+   */
+  login: function () {
+    const {
+      username,
+      password
+    } = this.data;
+
+    // 楠岃瘉鐢ㄦ埛鍚嶅拰瀵嗙爜
+    if (!username.trim()) {
+      wx.showToast({
+        title: '璇疯緭鍏ョ敤鎴峰悕',
+        icon: 'none'
+      });
+      return;
+    }
+
+    if (!password.trim()) {
+      wx.showToast({
+        title: '璇疯緭鍏ュ瘑鐮�',
+        icon: 'none'
+      });
+      return;
+    }
+
+    // 鏄剧ず鍔犺浇涓�
+    wx.showLoading({
+      title: '鐧诲綍涓�...',
+      mask: true
+    });
+    
+    // 鏍囪涓烘墜鍔ㄥ鑸紝纭繚涓嶄細瑙﹀彂杩斿洖閫昏緫
+    console.log('鐧诲綍鎸夐挳鐐瑰嚮锛岃缃甿anualNavigate=true');
+    this.setData({
+      manualNavigate: true
+    });
+    
+    this.accountLogin();
+  },
+
+  /**
+   * 璺宠浆鍒版敞鍐岄〉闈�
+   */
+  goToRegister: function () {
+    wx.showToast({
+      title: '娉ㄥ唽鍔熻兘鏆傛湭寮�鏀�',
+      icon: 'none',
+      duration: 2000
+    });
+  },
+
+  /**
+   * 璺宠浆鍒板繕璁板瘑鐮侀〉闈�
+   */
+  goToForgetPassword: function () {
+    wx.showToast({
+      title: '鎵惧洖瀵嗙爜鍔熻兘鏆傛湭寮�鏀�',
+      icon: 'none',
+      duration: 2000
+    });
+  },
+
+
+  /**
+   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
+   */
+  onLoad: function (options) {
+    console.log('accountLogin椤甸潰鍔犺浇锛宱ptions:', options);
+    
+    // 璁剧疆椤甸潰鏁版嵁
+    this.setData({
+      fromBack: false,  // 鏍囪鏄惁鏄粠杩斿洖鎸夐挳杩斿洖鐨�
+      manualNavigate: false // 鏍囪鏄惁鏄�氳繃缂栫▼鏂瑰紡瀵艰埅鐨�
+    });
+    
+    // 浠嶶RL鍙傛暟鑾峰彇椤圭洰淇℃伅
+    if (options && options.project) {
+      const project = options.project;
+      // 鐩存帴浣跨敤浼犲叆鐨勯」鐩悕绉帮紝涓嶅啀鎵嬪姩杞崲
+      const projectName = options.projectName || '榛樿椤圭洰';
+      
+      console.log(`浠嶶RL鍙傛暟鑾峰彇椤圭洰淇℃伅: ${project} (${projectName})`);
+      
+      this.setData({
+        selectedProject: project,
+        projectName: projectName
+      });
+      
+      // 鍚屾鏇存柊鍏ㄥ眬椤圭洰璁剧疆
+      if (getApp().globalData) {
+        getApp().globalData.selectedProject = project;
+        
+        // 璁剧疆瀵瑰簲鐨則ag
+        if (project === 'JYG') {
+          getApp().globalData.tag = 'ym';
+        } else if (project === 'MQ') {
+          getApp().globalData.tag = 'mq';
+        }
+        
+        // 鏇存柊 BASEURL
+        try {
+          // 浣跨敤瀵煎叆鐨剆etBaseUrl鍑芥暟璁剧疆baseUrl
+          setBaseUrl(project);
+          
+          // 浠嶱ROJECT_CONFIG涓幏鍙杝erverUrl
+          const serverUrl = PROJECT_CONFIG[project]?.serverUrl;
+          if (serverUrl) {
+            getApp().globalData.baseUrl = serverUrl;
+            console.log('璁剧疆baseUrl鎴愬姛:', serverUrl);
+          }
+        } catch (e) {
+          console.error('璁剧疆baseUrl澶辫触:', e);
+        }
+      }
+      
+      // 妫�鏌ラ」鐩厤缃殑鐧诲綍鏂瑰紡鏄惁涓庡綋鍓嶉〉闈㈠尮閰�
+      const projectConfig = PROJECT_CONFIG[project];
+      if (projectConfig && projectConfig.loginType !== 'account') {
+        console.log(`褰撳墠椤圭洰閰嶇疆鐨勭櫥褰曟柟寮忎负${projectConfig.loginType}锛岃嚜鍔ㄨ烦杞埌楠岃瘉鐮佺櫥褰曢〉闈);
+        
+        // 璁剧疆鎵嬪姩瀵艰埅鏍囪锛岄伩鍏嶈Е鍙戣繑鍥為�昏緫
+        this.setData({ manualNavigate: true });
+        
+        // 寤惰繜鎵ц璺宠浆锛岀‘淇濋〉闈㈠畬鍏ㄥ姞杞�
+        setTimeout(() => {
+          wx.redirectTo({
+            url: `/pages/login/login?project=${project}&projectName=${projectName}`
+          });
+        }, 100);
+      }
+    } else {
+      console.log('鏈粠URL鑾峰彇鍒伴」鐩俊鎭紝浣跨敤榛樿鍊�');
+    }
+  },
+
+  /**
+   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌
+   */
+  onHide() {
+    // 濡傛灉涓嶆槸閫氳繃缂栫▼鏂瑰紡瀵艰埅锛屽垯鍙兘鏄偣鍑讳簡杩斿洖鎸夐挳
+    // 娉ㄦ剰锛氬湪鏌愪簺鎯呭喌涓嬶紝寰俊鍙兘浼氱洿鎺ヨ皟鐢╫nUnload鑰岃烦杩噊nHide
+    if (!this.data.manualNavigate) {
+      console.log('椤甸潰闅愯棌锛屽彲鑳芥槸鐐瑰嚮浜嗚繑鍥炴寜閽�');
+      this.setData({
+        fromBack: true
+      });
+    }
+  },
+
+  /**
+   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇
+   */
+  onUnload() {
+    console.log('椤甸潰鍗歌浇锛宖romBack=', this.data.fromBack);
+    console.log('椤甸潰鍗歌浇锛宮anualNavigate=', this.data.manualNavigate);
+    
+    // 濡傛灉鏄粠杩斿洖鎸夐挳杩斿洖鐨勶紝涓斾笉鏄�氳繃缂栫▼鏂瑰紡瀵艰埅
+    if (this.data.fromBack && !this.data.manualNavigate) {
+      console.log('妫�娴嬪埌浠庤繑鍥炴寜閽繑鍥烇紝璺宠浆鍒伴椤�');
+      wx.reLaunch({
+        url: '/pages/index/index'
+      });
+    }
+  },
+
+  /**
+   * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
+   */
+  onShareAppMessage() {
+    return {
+      title: '澶х鑺傛按鐏屾簤绯荤粺',
+      path: '/pages/index/index',
+      imageUrl: '/images/share-img.jpg' // 鑷畾涔夊垎浜浘鐗�
+    };
+  },
+
+  /**
+   * 璐﹀彿瀵嗙爜鐧诲綍
+   */
+  accountLogin() {
+    const { username, password, selectedProject } = this.data;
+    
+    // 鏋勫缓璇锋眰鍙傛暟
+    const data = {
+      username: username,
+      password: password
+    };
+    
+    // 鍙戦�佺櫥褰曡姹�
+    post({
+      url: '/wx/user/passwordLogin',
+      data: data,
+      isShowLoding: true
+    }).then(res => {
+      // 闅愯棌鍔犺浇鎻愮ず
+      wx.hideLoading();
+      
+      if (res && res.success) {
+        // 鐧诲綍鎴愬姛锛屼繚瀛榯oken绛変俊鎭�
+        storage.set('token', res.content.token);
+        storage.set('userInfo', res.content);
+        
+        // 鏇存柊鍏ㄥ眬鏁版嵁
+        if (app.globalData) {
+          app.globalData.token = res.content.token;
+          app.globalData.userInfo = res.content;
+        }
+        
+        // 璺宠浆鍒伴椤�
+        wx.switchTab({
+          url: '/pages/home/home'
+        });
+      } else {
+        // 鐧诲綍澶辫触
+        wx.showToast({
+          title: res.msg || '鐧诲綍澶辫触锛岃妫�鏌ヨ处鍙峰瘑鐮�',
+          icon: 'none',
+          duration: 2000
+        });
+      }
+    }).catch(err => {
+      // 闅愯棌鍔犺浇鎻愮ず
+      wx.hideLoading();
+      
+      // 鏄剧ず閿欒淇℃伅
+      wx.showToast({
+        title: '缃戠粶閿欒锛岃绋嶅悗閲嶈瘯',
+        icon: 'none',
+        duration: 2000
+      });
+      
+      console.error('鐧诲綍澶辫触锛�', err);
+    });
+  }
+}); 
\ No newline at end of file
diff --git a/pages/accountLogin/accountLogin.json b/pages/accountLogin/accountLogin.json
new file mode 100644
index 0000000..154e084
--- /dev/null
+++ b/pages/accountLogin/accountLogin.json
@@ -0,0 +1,4 @@
+{
+  "navigationBarTitleText": "璐﹀彿瀵嗙爜鐧诲綍",
+  "navigationBarTextStyle": "white"
+} 
\ No newline at end of file
diff --git a/pages/accountLogin/accountLogin.wxml b/pages/accountLogin/accountLogin.wxml
new file mode 100644
index 0000000..444b4a1
--- /dev/null
+++ b/pages/accountLogin/accountLogin.wxml
@@ -0,0 +1,36 @@
+<!--pages/accountLogin/accountLogin.wxml-->
+<view class="login-container">
+  <view class="logo-container">
+    
+  </view>
+  
+  <view class="form-container">
+    <view class="title">璐﹀彿瀵嗙爜鐧诲綍</view>
+    
+    <view class="input-wrapper">
+      <view class="input-icon user-icon"></view>
+      <input class="input" type="text" placeholder="璇疯緭鍏ョ敤鎴峰悕" bindinput="bindUsernameInput" />
+    </view>
+    
+    <view class="input-wrapper">
+      <view class="input-icon lock-icon"></view>
+      <input class="input" password="{{!passwordVisible}}" placeholder="璇疯緭鍏ュ瘑鐮�" bindinput="bindPasswordInput" />
+      <view class="eye-button" bindtap="togglePasswordVisibility">
+        <view class="{{passwordVisible ? 'eye-open-icon' : 'eye-close-icon'}}"></view>
+      </view>
+    </view>
+    
+    <view class="login-btn-container">
+      <button class="login-button" bindtap="login">鐧诲綍</button>
+    </view>
+    
+    <view class="footer-links">
+      <view class="link" bindtap="goToForgetPassword">蹇樿瀵嗙爜</view>
+    </view>
+  </view>
+  
+  <view class="project-info">
+    <text>褰撳墠椤圭洰: {{projectName}}</text>
+  </view>
+
+</view> 
\ No newline at end of file
diff --git a/pages/accountLogin/accountLogin.wxss b/pages/accountLogin/accountLogin.wxss
new file mode 100644
index 0000000..4d916c8
--- /dev/null
+++ b/pages/accountLogin/accountLogin.wxss
@@ -0,0 +1,159 @@
+/* pages/accountLogin/accountLogin.wxss */
+
+.login-container {
+  display: flex;
+  flex-direction: column;
+  height: 100vh;
+  width: 100%;
+  background-color: #f5f5f5;
+}
+
+.logo-container {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  padding: 60rpx 0;
+}
+
+.logo-circle {
+  width: 200rpx;
+  height: 200rpx;
+  border-radius: 50%;
+  background: #1890FF;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  color: white;
+  font-size: 80rpx;
+  font-weight: bold;
+}
+
+.form-container {
+  background-color: #fff;
+  border-radius: 20rpx;
+  margin: 0 40rpx;
+  padding: 40rpx;
+  box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
+}
+
+.title {
+  font-size: 40rpx;
+  font-weight: bold;
+  color: #333;
+  margin-bottom: 40rpx;
+  text-align: center;
+}
+
+.input-wrapper {
+  display: flex;
+  align-items: center;
+  border-bottom: 1rpx solid #e0e0e0;
+  margin-bottom: 40rpx;
+  padding-bottom: 20rpx;
+}
+
+.input-icon {
+  width: 40rpx;
+  height: 40rpx;
+  margin-right: 20rpx;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  color: #1890FF;
+  font-weight: bold;
+  font-size: 32rpx;
+}
+
+.user-icon::before {
+  content: "馃懁";
+}
+
+.lock-icon::before {
+  content: "馃敀";
+}
+
+.eye-open-icon::before {
+  content: "馃憗锔�";
+}
+
+.eye-close-icon::before {
+  content: "馃憗锔忊�嶐煑笍";
+}
+
+.input {
+  flex: 1;
+  height: 60rpx;
+  font-size: 32rpx;
+  color: #333;
+}
+
+.eye-button {
+  padding: 10rpx;
+  font-size: 32rpx;
+  width: 60rpx;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+
+.login-btn-container {
+  margin-top: 60rpx;
+}
+
+.login-button {
+  height: 90rpx;
+  background-color: #1890FF;
+  color: #fff;
+  font-size: 34rpx;
+  border-radius: 45rpx;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+
+.footer-links {
+  display: flex;
+  justify-content: space-between;
+  margin-top: 40rpx;
+  font-size: 28rpx;
+}
+
+.link {
+  color: #1890FF;
+}
+
+.project-info {
+  position: fixed;
+  bottom: 40rpx;
+  width: 100%;
+  text-align: center;
+  font-size: 32rpx;
+  padding: 16rpx 0;
+  background-color: rgba(255, 255, 255, 0.8);
+  backdrop-filter: blur(5px);
+  box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.1);
+}
+
+.project-info text {
+  display: inline-block;
+  padding: 8rpx 24rpx;
+  color: #fff;
+  border-radius: 30rpx;
+  font-weight: 500;
+  box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.2);
+  background: linear-gradient(45deg, #1890FF, #36a9fc);
+}
+
+.project-info.mq text {
+  background: linear-gradient(45deg, #18c063, #36d486);
+}
+
+image {
+  position: fixed;
+  left: 0;
+  bottom: 0;
+  display: block;
+  width: 100%;
+  height: 100%;
+  z-index: -999;
+} 
\ No newline at end of file
diff --git a/pages/home/home.js b/pages/home/home.js
index 6e1eda7..a7d4ac1 100644
--- a/pages/home/home.js
+++ b/pages/home/home.js
@@ -50,17 +50,45 @@
 
   openValve: function (e) {
     const app = getApp();
-    if (app.globalData.isLoggedIn) {
-      wx.navigateTo({
-        url: '/pages/waterIntake/waterIntake',
-      })
-    } else {
-      wx.showToast({
-        title: '璇峰厛鐧诲綍',
-        icon: 'error'
-      })
+    // 妫�鏌ュ綋鍓嶉」鐩槸鍚﹂渶瑕佺櫥褰�
+    const currentProject = app.globalData.selectedProject;
+    if (currentProject && PROJECT_CONFIG[currentProject] && PROJECT_CONFIG[currentProject].needLogin) {
+      // 闇�瑕佺櫥褰曠殑椤圭洰锛屾鏌ユ槸鍚﹀凡鐧诲綍
+      if (!app.globalData.isLoggedIn) {
+        // 鏈櫥褰曪紝鏄剧ず鎻愮ず骞堕樆姝㈡搷浣�
+        wx.showToast({
+          title: '璇峰厛鐧诲綍',
+          icon: 'error',
+          duration: 2000
+        });
+        
+        // 鑾峰彇椤圭洰閰嶇疆
+        const projectConfig = PROJECT_CONFIG[currentProject];
+        if (projectConfig) {
+          // 璇㈤棶鐢ㄦ埛鏄惁鍓嶅線鐧诲綍
+          wx.showModal({
+            title: '鎻愮ず',
+            content: '鎮ㄩ渶瑕佺櫥褰曞悗鎵嶈兘浣跨敤寮�闃�鍔熻兘锛屾槸鍚︾珛鍗崇櫥褰曪紵',
+            confirmText: '鍓嶅線鐧诲綍',
+            cancelText: '鍙栨秷',
+            success: (res) => {
+              if (res.confirm) {
+                // 鐢ㄦ埛鐐瑰嚮纭锛岀洿鎺ヨ皟鐢╳xLogin鏂规硶
+                this.wxLogin();
+              }
+            }
+          });
+        }
+        return;
+      }
     }
+    
+    // 宸茬櫥褰曟垨涓嶉渶瑕佺櫥褰曠殑椤圭洰锛屾墽琛屽紑闃�鎿嶄綔
+    wx.navigateTo({
+      url: '/pages/waterIntake/waterIntake',
+    })
   },
+
   // calculateScrollViewHeight: function () {
   //     wx.createSelectorQuery().selectAll('.list-item').boundingClientRect((rects) => {
   //         let totalHeight = rects.reduce((sum, rect) => sum + rect.height, 0);
@@ -424,16 +452,43 @@
   },
   openValveList() {
     const app = getApp();
-    if (app.globalData.isLoggedIn) {
-      wx.navigateTo({
-        url: '/pages/valveList/valveList',
-      })
-    } else {
-      wx.showToast({
-        title: '璇峰厛鐧诲綍',
-        icon: 'error'
-      })
+    // 妫�鏌ュ綋鍓嶉」鐩槸鍚﹂渶瑕佺櫥褰�
+    const currentProject = app.globalData.selectedProject;
+    if (currentProject && PROJECT_CONFIG[currentProject] && PROJECT_CONFIG[currentProject].needLogin) {
+      // 闇�瑕佺櫥褰曠殑椤圭洰锛屾鏌ユ槸鍚﹀凡鐧诲綍
+      if (!app.globalData.isLoggedIn) {
+        // 鏈櫥褰曪紝鏄剧ず鎻愮ず骞堕樆姝㈡搷浣�
+        wx.showToast({
+          title: '璇峰厛鐧诲綍',
+          icon: 'error',
+          duration: 2000
+        });
+        
+        // 鑾峰彇椤圭洰閰嶇疆
+        const projectConfig = PROJECT_CONFIG[currentProject];
+        if (projectConfig) {
+          // 璇㈤棶鐢ㄦ埛鏄惁鍓嶅線鐧诲綍
+          wx.showModal({
+            title: '鎻愮ず',
+            content: '鎮ㄩ渶瑕佺櫥褰曞悗鎵嶈兘鏌ョ湅寮�鍏抽榾璁板綍锛屾槸鍚︾珛鍗崇櫥褰曪紵',
+            confirmText: '鍓嶅線鐧诲綍',
+            cancelText: '鍙栨秷',
+            success: (res) => {
+              if (res.confirm) {
+                // 鐢ㄦ埛鐐瑰嚮纭锛岀洿鎺ヨ皟鐢╳xLogin鏂规硶
+                this.wxLogin();
+              }
+            }
+          });
+        }
+        return;
+      }
     }
+    
+    // 宸茬櫥褰曟垨涓嶉渶瑕佺櫥褰曠殑椤圭洰锛屾墽琛屾煡鐪嬭褰曟搷浣�
+    wx.navigateTo({
+      url: '/pages/valveList/valveList',
+    })
   },
   feedBack() {
     wx.showToast({
@@ -487,18 +542,45 @@
       });
     }
   },
-  //杞亴
   irrigation() {
-    if (getApp().globalData.isLoggedIn) {
-      wx.navigateTo({
-        url: '/pages/irrigation/irrigation',
-      })
-    } else {
-      wx.showToast({
-        title: '璇峰厛鐧诲綍',
-        icon: 'error'
-      })
+    const app = getApp();
+    // 妫�鏌ュ綋鍓嶉」鐩槸鍚﹂渶瑕佺櫥褰�
+    const currentProject = app.globalData.selectedProject;
+    if (currentProject && PROJECT_CONFIG[currentProject] && PROJECT_CONFIG[currentProject].needLogin) {
+      // 闇�瑕佺櫥褰曠殑椤圭洰锛屾鏌ユ槸鍚﹀凡鐧诲綍
+      if (!app.globalData.isLoggedIn) {
+        // 鏈櫥褰曪紝鏄剧ず鎻愮ず骞堕樆姝㈡搷浣�
+        wx.showToast({
+          title: '璇峰厛鐧诲綍',
+          icon: 'error',
+          duration: 2000
+        });
+        
+        // 鑾峰彇椤圭洰閰嶇疆
+        const projectConfig = PROJECT_CONFIG[currentProject];
+        if (projectConfig) {
+          // 璇㈤棶鐢ㄦ埛鏄惁鍓嶅線鐧诲綍
+          wx.showModal({
+            title: '鎻愮ず',
+            content: '鎮ㄩ渶瑕佺櫥褰曞悗鎵嶈兘浣跨敤杞亴鍔熻兘锛屾槸鍚︾珛鍗崇櫥褰曪紵',
+            confirmText: '鍓嶅線鐧诲綍',
+            cancelText: '鍙栨秷',
+            success: (res) => {
+              if (res.confirm) {
+                // 鐢ㄦ埛鐐瑰嚮纭锛岀洿鎺ヨ皟鐢╳xLogin鏂规硶
+                this.wxLogin();
+              }
+            }
+          });
+        }
+        return;
+      }
     }
+    
+    // 宸茬櫥褰曟垨涓嶉渶瑕佺櫥褰曠殑椤圭洰锛屾墽琛岃疆鐏屾搷浣�
+    wx.navigateTo({
+      url: '/pages/irrigation/irrigation',
+    })
   },
   handleChange(e) {
     const item = e.currentTarget.dataset.item;
@@ -747,6 +829,41 @@
    * 鎵爜寮�闃�
    */
   scenCode() {
+    const app = getApp();
+    // 妫�鏌ュ綋鍓嶉」鐩槸鍚﹂渶瑕佺櫥褰�
+    const currentProject = app.globalData.selectedProject;
+    if (currentProject && PROJECT_CONFIG[currentProject] && PROJECT_CONFIG[currentProject].needLogin) {
+      // 闇�瑕佺櫥褰曠殑椤圭洰锛屾鏌ユ槸鍚﹀凡鐧诲綍
+      if (!app.globalData.isLoggedIn) {
+        // 鏈櫥褰曪紝鏄剧ず鎻愮ず骞堕樆姝㈡壂鐮�
+        wx.showToast({
+          title: '璇峰厛鐧诲綍',
+          icon: 'error',
+          duration: 2000
+        });
+        
+        // 鑾峰彇椤圭洰閰嶇疆
+        const projectConfig = PROJECT_CONFIG[currentProject];
+        if (projectConfig) {
+          // 璇㈤棶鐢ㄦ埛鏄惁鍓嶅線鐧诲綍
+          wx.showModal({
+            title: '鎻愮ず',
+            content: '鎮ㄩ渶瑕佺櫥褰曞悗鎵嶈兘浣跨敤鎵爜寮�闃�鍔熻兘锛屾槸鍚︾珛鍗崇櫥褰曪紵',
+            confirmText: '鍓嶅線鐧诲綍',
+            cancelText: '鍙栨秷',
+            success: (res) => {
+              if (res.confirm) {
+                // 鐢ㄦ埛鐐瑰嚮纭锛岀洿鎺ヨ皟鐢╳xLogin鏂规硶
+                this.wxLogin();
+              }
+            }
+          });
+        }
+        return;
+      }
+    }
+    
+    // 宸茬櫥褰曟垨涓嶉渶瑕佺櫥褰曠殑椤圭洰锛屾墽琛屾壂鐮佹搷浣�
     const that = this;
     wx.scanCode({
       success(res) {
@@ -1309,7 +1426,7 @@
     }
 
     // 濡傛灉褰撳墠宸插湪鐧诲綍椤碉紝涓嶅啀璺宠浆
-    if (currentRoute === 'pages/login/login') {
+    if (currentRoute === 'pages/login/login' || currentRoute === 'pages/accountLogin/accountLogin') {
       console.log('褰撳墠宸插湪鐧诲綍椤碉紝涓嶅啀璺宠浆');
       return;
     }
@@ -1364,11 +1481,26 @@
             wx.setStorageSync('_attempted_login_redirect', 'true');
           } catch (e) {}
 
-          // wx.navigateTo({
-          //   url: `/pages/login/login?project=${this.data.selectedProject}`,
-          //   success: () => console.log('鎴愬姛璺宠浆鍒扮櫥褰曢〉'),
-          //   fail: (err) => console.error('璺宠浆鍒扮櫥褰曢〉澶辫触:', err)
-          // });
+          // 鏍规嵁椤圭洰閰嶇疆鐨刲oginType鍐冲畾璺宠浆鍒板摢涓櫥褰曢〉闈�
+          // 姝ゅ涓嶅仛璺宠浆锛屾敞閲婃帀鍘熸湁浠g爜
+          // const projectInfo = PROJECT_CONFIG[currentProject];
+          // const loginType = projectInfo?.loginType || 'code'; // 榛樿浣跨敤楠岃瘉鐮佺櫥褰�
+          
+          // if (loginType === 'account') {
+          //   // 璐﹀彿瀵嗙爜鐧诲綍
+          //   wx.navigateTo({
+          //     url: `/pages/accountLogin/accountLogin?project=${currentProject}`,
+          //     success: () => console.log('鎴愬姛璺宠浆鍒拌处鍙峰瘑鐮佺櫥褰曢〉'),
+          //     fail: (err) => console.error('璺宠浆鍒拌处鍙峰瘑鐮佺櫥褰曢〉澶辫触:', err)
+          //   });
+          // } else {
+          //   // 楠岃瘉鐮佺櫥褰�
+          //   wx.navigateTo({
+          //     url: `/pages/login/login?project=${currentProject}`,
+          //     success: () => console.log('鎴愬姛璺宠浆鍒伴獙璇佺爜鐧诲綍椤�'),
+          //     fail: (err) => console.error('璺宠浆鍒伴獙璇佺爜鐧诲綍椤靛け璐�:', err)
+          //   });
+          // }
         }
       })
       .catch(err => {
@@ -1391,12 +1523,26 @@
           return;
         }
 
-        // 鍑洪敊鏃朵篃璺宠浆鍒扮櫥褰曢〉
-        // wx.navigateTo({
-        //   url: `/pages/login/login?project=${this.data.selectedProject}`,
-        //   success: () => console.log('閿欒鍚庢垚鍔熻烦杞埌鐧诲綍椤�'),
-        //   fail: (err) => console.error('閿欒鍚庤烦杞埌鐧诲綍椤靛け璐�:', err)
-        // });
+        // 鍑洪敊鏃朵篃璺宠浆鍒扮櫥褰曢〉锛屾牴鎹甽oginType鍐冲畾璺宠浆鐩爣
+        // 姝ゅ涓嶅仛璺宠浆锛屾敞閲婃帀鍘熸湁浠g爜
+        // const projectInfo = PROJECT_CONFIG[currentProject];
+        // const loginType = projectInfo?.loginType || 'code'; // 榛樿浣跨敤楠岃瘉鐮佺櫥褰�
+        
+        // if (loginType === 'account') {
+        //   // 璐﹀彿瀵嗙爜鐧诲綍
+        //   wx.navigateTo({
+        //     url: `/pages/accountLogin/accountLogin?project=${currentProject}`,
+        //     success: () => console.log('閿欒鍚庢垚鍔熻烦杞埌璐﹀彿瀵嗙爜鐧诲綍椤�'),
+        //     fail: (err) => console.error('閿欒鍚庤烦杞埌璐﹀彿瀵嗙爜鐧诲綍椤靛け璐�:', err)
+        //   });
+        // } else {
+        //   // 楠岃瘉鐮佺櫥褰�
+        //   wx.navigateTo({
+        //     url: `/pages/login/login?project=${currentProject}`,
+        //     success: () => console.log('閿欒鍚庢垚鍔熻烦杞埌楠岃瘉鐮佺櫥褰曢〉'),
+        //     fail: (err) => console.error('閿欒鍚庤烦杞埌楠岃瘉鐮佺櫥褰曢〉澶辫触:', err)
+        //   });
+        // }
       });
   },
 
@@ -1503,11 +1649,21 @@
               wx.hideLoading();
               if (response.code === "0001") {
                 if (response.content.client.clientId === "") {
-                  // 鏈粦瀹氳处鍙凤紝璺宠浆鍒扮櫥褰曢〉闈㈠苟浼犻�掑綋鍓嶉」鐩俊鎭�
+                  // 鏈粦瀹氳处鍙凤紝鏍规嵁椤圭洰閰嶇疆鐨刲oginType璺宠浆鍒扮浉搴旂殑鐧诲綍椤甸潰
                   const projectInfo = PROJECT_CONFIG[this.data.selectedProject];
-                  wx.navigateTo({
-                    url: `/pages/login/login?project=${this.data.selectedProject}&projectName=${projectInfo.displayName}`
-                  });
+                  const loginType = projectInfo?.loginType || 'code'; // 榛樿浣跨敤楠岃瘉鐮佺櫥褰�
+                  
+                  if (loginType === 'account') {
+                    // 璐﹀彿瀵嗙爜鐧诲綍
+                    wx.navigateTo({
+                      url: `/pages/accountLogin/accountLogin?project=${this.data.selectedProject}&projectName=${projectInfo.displayName}`
+                    });
+                  } else {
+                    // 楠岃瘉鐮佺櫥褰�
+                    wx.navigateTo({
+                      url: `/pages/login/login?project=${this.data.selectedProject}&projectName=${projectInfo.displayName}`
+                    });
+                  }
                 } else {
                   this.setData({
                     userName: response.content.client.clientName,
@@ -1553,11 +1709,21 @@
 
                 }
               } else if (response.code === "1003") {
-                // 鏈粦瀹氳处鍙凤紝璺宠浆鍒扮櫥褰曢〉闈㈠苟浼犻�掑綋鍓嶉」鐩俊鎭�
+                // 鏈粦瀹氳处鍙凤紝鏍规嵁椤圭洰閰嶇疆鐨刲oginType璺宠浆鍒扮浉搴旂殑鐧诲綍椤甸潰
                 const projectInfo = PROJECT_CONFIG[this.data.selectedProject];
-                wx.navigateTo({
-                  url: `/pages/login/login?project=${this.data.selectedProject}&projectName=${projectInfo.displayName}`
-                });
+                const loginType = projectInfo?.loginType || 'code'; // 榛樿浣跨敤楠岃瘉鐮佺櫥褰�
+                
+                if (loginType === 'account') {
+                  // 璐﹀彿瀵嗙爜鐧诲綍
+                  wx.navigateTo({
+                    url: `/pages/accountLogin/accountLogin?project=${this.data.selectedProject}&projectName=${projectInfo.displayName}`
+                  });
+                } else {
+                  // 楠岃瘉鐮佺櫥褰�
+                  wx.navigateTo({
+                    url: `/pages/login/login?project=${this.data.selectedProject}&projectName=${projectInfo.displayName}`
+                  });
+                }
               } else {
                 wx.showToast({
                   title: '鐧诲綍澶辫触',
@@ -1569,11 +1735,21 @@
               wx.hideLoading();
               console.error('鐧诲綍璇锋眰澶辫触:', error);
               if(error.code==="1003"){
-                // 鏈粦瀹氳处鍙凤紝璺宠浆鍒扮櫥褰曢〉闈㈠苟浼犻�掑綋鍓嶉」鐩俊鎭�
+                // 鏈粦瀹氳处鍙凤紝鏍规嵁椤圭洰閰嶇疆鐨刲oginType璺宠浆鍒扮浉搴旂殑鐧诲綍椤甸潰
                 const projectInfo = PROJECT_CONFIG[this.data.selectedProject];
-                wx.navigateTo({
-                  url: `/pages/login/login?project=${this.data.selectedProject}&projectName=${projectInfo.displayName}`
-                });
+                const loginType = projectInfo?.loginType || 'code'; // 榛樿浣跨敤楠岃瘉鐮佺櫥褰�
+                
+                if (loginType === 'account') {
+                  // 璐﹀彿瀵嗙爜鐧诲綍
+                  wx.navigateTo({
+                    url: `/pages/accountLogin/accountLogin?project=${this.data.selectedProject}&projectName=${projectInfo.displayName}`
+                  });
+                } else {
+                  // 楠岃瘉鐮佺櫥褰�
+                  wx.navigateTo({
+                    url: `/pages/login/login?project=${this.data.selectedProject}&projectName=${projectInfo.displayName}`
+                  });
+                }
               }else{
                 wx.showToast({
                   title: '鐧诲綍澶辫触锛岃閲嶈瘯',
@@ -1833,4 +2009,48 @@
       }
     });
   },
+
+  // 娣诲姞鐢ㄦ埛鐐瑰嚮澶村儚鎴栫敤鎴峰悕鐧诲綍鐨勫鐞嗛�昏緫
+  handleUserTap() {
+    const app = getApp();
+    // 濡傛灉宸茬櫥褰曪紝涓嶉渶瑕佽烦杞埌鐧诲綍椤甸潰
+    if (app.globalData.isLoggedIn) {
+      return;
+    }
+
+    // 妫�鏌ュ綋鍓嶉」鐩槸鍚﹂渶瑕佺櫥褰�
+    const currentProject = app.globalData.selectedProject;
+    if (currentProject && PROJECT_CONFIG[currentProject]) {
+      const projectConfig = PROJECT_CONFIG[currentProject];
+      
+      if (!projectConfig.needLogin) {
+        console.log('handleUserTap: 褰撳墠椤圭洰涓嶉渶瑕佺櫥褰�:', currentProject);
+        // 涓嶉渶瑕佺櫥褰曠殑椤圭洰锛屾樉绀洪」鐩悕绉�
+        this.setData({
+          userName: projectConfig.displayName
+        });
+        return;
+      }
+      
+      // 鏍规嵁椤圭洰閰嶇疆鐨刲oginType鍐冲畾璺宠浆鍒板摢涓櫥褰曢〉闈�
+      const loginType = projectConfig.loginType || 'code'; // 榛樿浣跨敤楠岃瘉鐮佺櫥褰�
+      
+      if (loginType === 'account') {
+        // 璐﹀彿瀵嗙爜鐧诲綍
+        wx.navigateTo({
+          url: `/pages/accountLogin/accountLogin?project=${currentProject}&projectName=${projectConfig.displayName}`
+        });
+      } else {
+        // 楠岃瘉鐮佺櫥褰�
+        wx.navigateTo({
+          url: `/pages/login/login?project=${currentProject}&projectName=${projectConfig.displayName}`
+        });
+      }
+    } else {
+      // 濡傛灉娌℃湁褰撳墠椤圭洰閰嶇疆锛岄粯璁よ烦杞埌楠岃瘉鐮佺櫥褰�
+      wx.navigateTo({
+        url: '/pages/login/login'
+      });
+    }
+  },
 })
\ No newline at end of file
diff --git a/pages/login/login.js b/pages/login/login.js
index f5c4db2..5100e0d 100644
--- a/pages/login/login.js
+++ b/pages/login/login.js
@@ -3,6 +3,8 @@
 const {
   post
 } = require('../../api/request.js');
+const { PROJECT_CONFIG } = require('../../utils/projectConfig.js');
+const { setBaseUrl } = require('../../api/config.js');
 
 Page({
 
@@ -174,6 +176,19 @@
   },
 
   /**
+   * 璺宠浆鍒拌处鍙峰瘑鐮佺櫥褰曢〉闈�
+   */
+  goToAccountLogin: function() {
+    // 鑾峰彇褰撳墠椤圭洰淇℃伅锛屼紶閫掔粰accountLogin椤甸潰
+    const { selectedProject, projectName } = this.data;
+    
+    // 璺宠浆鍒拌处鍙峰瘑鐮佺櫥褰曢〉闈�
+    wx.navigateTo({
+      url: `/pages/accountLogin/accountLogin?project=${selectedProject}&projectName=${projectName}`
+    });
+  },
+
+  /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
    */
   onLoad: function (options) {
@@ -211,12 +226,35 @@
         
         // 鏇存柊 BASEURL
         try {
-          const { PROJECT_URLS } = require('../../api/config.js');
-          getApp().globalData.baseUrl = PROJECT_URLS[project];
+          // 浣跨敤瀵煎叆鐨剆etBaseUrl鍑芥暟璁剧疆baseUrl
+          setBaseUrl(project);
+          
+          // 浠嶱ROJECT_CONFIG涓幏鍙杝erverUrl
+          const serverUrl = PROJECT_CONFIG[project]?.serverUrl;
+          if (serverUrl) {
+            getApp().globalData.baseUrl = serverUrl;
+            console.log('璁剧疆baseUrl鎴愬姛:', serverUrl);
+          }
         } catch (e) {
           console.error('璁剧疆baseUrl澶辫触:', e);
         }
       }
+      
+      // 妫�鏌ラ」鐩厤缃殑鐧诲綍鏂瑰紡鏄惁涓庡綋鍓嶉〉闈㈠尮閰�
+      const projectConfig = PROJECT_CONFIG[project];
+      if (projectConfig && projectConfig.loginType === 'account') {
+        console.log(`褰撳墠椤圭洰閰嶇疆鐨勭櫥褰曟柟寮忎负account锛岃嚜鍔ㄨ烦杞埌璐﹀彿瀵嗙爜鐧诲綍椤甸潰`);
+        
+        // 璁剧疆鎵嬪姩瀵艰埅鏍囪锛岄伩鍏嶈Е鍙戣繑鍥為�昏緫
+        this.setData({ manualNavigate: true });
+        
+        // 寤惰繜鎵ц璺宠浆锛岀‘淇濋〉闈㈠畬鍏ㄥ姞杞�
+        setTimeout(() => {
+          wx.redirectTo({
+            url: `/pages/accountLogin/accountLogin?project=${project}&projectName=${projectName}`
+          });
+        }, 100);
+      }
     } else {
       console.log('鏈粠URL鑾峰彇鍒伴」鐩俊鎭紝浣跨敤榛樿鍊�');
     }
diff --git a/pages/login/login.wxml b/pages/login/login.wxml
index b45afd7..44f34ef 100644
--- a/pages/login/login.wxml
+++ b/pages/login/login.wxml
@@ -23,6 +23,11 @@
     <view class="login-btn-container">
       <button class="login-button" bindtap="login">鐧诲綍</button>
     </view>
+    
+    <view class="footer-links">
+      <view class="link" bindtap="goToForgetPassword">蹇樿瀵嗙爜</view>
+      <view class="link" bindtap="goToAccountLogin">璐﹀彿瀵嗙爜鐧诲綍</view>
+    </view>
   </view>
   
   <view class="project-info">
diff --git a/pages/login/login.wxss b/pages/login/login.wxss
index 2f94d3c..8e20f99 100644
--- a/pages/login/login.wxss
+++ b/pages/login/login.wxss
@@ -115,7 +115,7 @@
 }
 
 .link {
-  color: #1aad19;
+  color: #1890FF;
 }
 
 .project-info {
diff --git a/utils/projectConfig.js b/utils/projectConfig.js
index 8bae1d0..36c2c7c 100644
--- a/utils/projectConfig.js
+++ b/utils/projectConfig.js
@@ -4,7 +4,8 @@
   URL_233: 'https://sp.dayuyanjiuyuan.top/',
   URL_55: 'https://irrigate.dayuyanjiuyuan.top/',
   URL_166: 'https://no253541tf71.vicp.fun/',
-  URL_121: 'https://shifanqu1.dayuyanjiuyuan.top/'
+  URL_121: 'https://shifanqu1.dayuyanjiuyuan.top/',
+  URL_87:'http://192.168.10.87:54321/'
 };
 
 const PROJECT_CONFIG = {
@@ -13,6 +14,7 @@
     displayName: '鍢夊唱鍏抽」鐩�',
     operatorId: '2025040415305200007', // 缁熶竴ID鐢ㄤ簬operator鍜宑lientId
     needLogin: false, // 涓嶉渶瑕佺櫥褰�
+    loginType: 'code', // 楠岃瘉鐮佺櫥褰�
     serverId: '55',
     get serverUrl() {
       return SERVER_INFO.URL_55;
@@ -23,6 +25,7 @@
     displayName: '姘戝嫟椤圭洰',
     operatorId: '2025033115305200006', // 缁熶竴ID鐢ㄤ簬operator鍜宑lientId
     needLogin: false, // 涓嶉渶瑕佺櫥褰�
+    loginType: 'code', // 楠岃瘉鐮佺櫥褰�
     serverId: '121',
     get serverUrl() {
       return SERVER_INFO.URL_121;
@@ -33,6 +36,7 @@
     displayName: '娴嬭瘯椤圭洰',
     operatorId: '', // 缁熶竴ID鐢ㄤ簬operator鍜宑lientId
     needLogin: true, // 闇�瑕佺櫥褰�
+    loginType: 'account', // 璐﹀彿瀵嗙爜鐧诲綍
     serverId: '166',
     get serverUrl() {
       return SERVER_INFO.URL_166;
@@ -43,6 +47,18 @@
     displayName: '閲戞槍椤圭洰',
     operatorId: '', // 缁熶竴ID鐢ㄤ簬operator鍜宑lientId 2025041710412400006
     needLogin: true, // 闇�瑕佺櫥褰�
+    loginType: 'code', // 璐﹀彿瀵嗙爜鐧诲綍
+    serverId: '121',
+    get serverUrl() {
+      return SERVER_INFO.URL_121;
+    }
+  },
+  LZXM: {
+    tag: 'lz',
+    displayName: '鍑夊窞椤圭洰',
+    operatorId: '', // 缁熶竴ID鐢ㄤ簬operator鍜宑lientId
+    needLogin: true, // 涓嶉渶瑕佺櫥褰�
+    loginType: 'code', // 楠岃瘉鐮佺櫥褰�
     serverId: '121',
     get serverUrl() {
       return SERVER_INFO.URL_121;
@@ -53,11 +69,23 @@
     displayName: '鐢樿們鍐滅闄�',
     operatorId: '', // 缁熶竴ID鐢ㄤ簬operator鍜宑lientId
     needLogin: true, // 涓嶉渶瑕佺櫥褰�
+    loginType: 'code', // 璐﹀彿瀵嗙爜鐧诲綍
     serverId: '233',
     get serverUrl() {
       return SERVER_INFO.URL_233;
     }
   }
+  // ,
+  // LOCTEST:{
+  //   tag: 'ym',
+  //   displayName: '鏈満娴嬭瘯椤圭洰',
+  //   operatorId: '', // 缁熶竴ID鐢ㄤ簬operator鍜宑lientId
+  //   needLogin: true, // 闇�瑕佺櫥褰�
+  //   serverId: '87',
+  //   get serverUrl() {
+  //     return SERVER_INFO.URL_87;
+  //   }
+  // }
 };
 
 module.exports = {

--
Gitblit v1.8.0