From 3a310f0b98b27bf362306e3afe137fff936a6297 Mon Sep 17 00:00:00 2001 From: ZF sun <34314687@qq.com> Date: Tue, 19 May 2026 11:56:21 +0800 Subject: [PATCH] refactor(js): rename and adjust login auth check function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整了微信小程序端的登录授权判断逻辑,重命名函数并优化代码结构,补充其他平台的TODO注释 --- pages/index/public/js/index.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pages/index/public/js/index.js b/pages/index/public/js/index.js index c30b5a4..addebae 100644 --- a/pages/index/public/js/index.js +++ b/pages/index/public/js/index.js @@ -66,19 +66,20 @@ export default { this.$refs.officialAccountsPopup.close(); }, // 判断是否需要登录授权 - _needLoginAuth() { + _requireHomeAuth() { + // #ifdef MP-WEIXIN // 检查 index_login_auth 都开启时才需要登录授权 - return this.shopInfo?.index_login_auth == 1; + return this.shopInfo?.index_login_auth === 1; + // #endif + + // TODO: 其他平台, 后面可以根据平台类型判断 + + return false; }, // 统一处理点击及触摸事件 _handleDiyGroupInteractionEvent(payload) { - // #ifdef H5 - // 如果是 H5 环境,直接返回 true 继续传播 - return true; - // #endif - // 如果不需要登录授权,直接返回 true 继续传播 - if (!this._needLoginAuth()) { + if (!this._requireHomeAuth()) { return true; }