From 7d1f18053bb7d0bdd55a38f44b0979615d00936b Mon Sep 17 00:00:00 2001 From: zuoxiao <zuoxiao> Date: 星期二, 02 九月 2025 13:46:45 +0800 Subject: [PATCH] 更新首页,新增模型计算功能并添加登录检查逻辑;修改app.json以包含新页面配置;更新项目配置以支持大包体积;优化样式以提升用户体验。 --- pages/home/home.js | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 57 insertions(+), 0 deletions(-) diff --git a/pages/home/home.js b/pages/home/home.js index 2f960f6..9035b54 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -639,6 +639,63 @@ url: '/pages/irrigation/irrigation', }) }, + //璺宠浆妯″瀷璁$畻 + modeCompute(){ + 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; + } else if (!PROJECT_CONFIG[currentProject].monitor) { + // 鏈櫥褰曪紝鏄剧ず鎻愮ず骞堕樆姝㈡搷浣� + wx.showToast({ + title: '褰撳墠椤圭洰涓嶅彲鐢�', + icon: 'error', + duration: 2000 + }); + return; + } + } else if (!PROJECT_CONFIG[currentProject].monitor) { + // 鏈櫥褰曪紝鏄剧ず鎻愮ず骞堕樆姝㈡搷浣� + wx.showToast({ + title: '褰撳墠椤圭洰涓嶅彲鐢�', + icon: 'error', + duration: 2000 + }); + return; + } + + // 宸茬櫥褰曟垨涓嶉渶瑕佺櫥褰曠殑椤圭洰锛屾墽琛岃疆鐏屾搷浣� + wx.navigateTo({ + url: '/pages/modeCompute/modeCompute', + }) + }, handleChange(e) { const item = e.currentTarget.dataset.item; console.log(item); -- Gitblit v1.8.0