From 8c728223a1aae91ff37a5326d961ad45823ba865 Mon Sep 17 00:00:00 2001 From: zuoxiao <zuoxiao> Date: 星期五, 08 八月 2025 15:27:19 +0800 Subject: [PATCH] 添加综合站监测功能,更新首页逻辑以支持登录检查并跳转至监测页面;在app.json中添加新页面和插件配置。 --- pages/home/home.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-) diff --git a/pages/home/home.js b/pages/home/home.js index a7d4ac1..9c4b282 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -496,6 +496,47 @@ icon: 'none' }) }, + // 缁煎悎绔欑洃娴� + monitor() { + 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/stationMonitor/stationMonitor', + }) + }, //瑙g粦鐢ㄦ埛 unbind() { // 妫�鏌ュ綋鍓嶉」鐩槸鍚﹂渶瑕佺櫥褰� -- Gitblit v1.8.0