diff --git a/JY-Salon-WeChat/pages/login/index.js b/JY-Salon-WeChat/pages/login/index.js index 62ca5a47..c4e73cb3 100644 --- a/JY-Salon-WeChat/pages/login/index.js +++ b/JY-Salon-WeChat/pages/login/index.js @@ -321,6 +321,10 @@ Page({ async openLoginShopSelector() { const shopOptions = await this.loadLoginShopOptions() + if (shopOptions.length === 1) { + await this.loginWithSelectedShop(shopOptions[0].id) + return + } this.setData({ shopOptions, shopSelectVisible: true, @@ -336,15 +340,6 @@ Page({ }) }, - async tryOpenLoginShopSelector() { - try { - await this.openLoginShopSelector() - return true - } catch (error) { - return false - } - }, - async selectLoginShop(event) { if (this.data.switchingShop) { return @@ -437,7 +432,7 @@ Page({ this.saveLoginPreference() wx.reLaunch({ url: '/pages/planning/index' }) } catch (error) { - if (isShopSelectionRequiredError(error) || await this.tryOpenLoginShopSelector()) { + if (isShopSelectionRequiredError(error)) { try { if (!this.data.shopSelectVisible) { await this.openLoginShopSelector() diff --git a/memory/bugs.md b/memory/bugs.md index e161440a..87db0ea5 100644 --- a/memory/bugs.md +++ b/memory/bugs.md @@ -49,3 +49,10 @@ - 原因:`journalctl` 默认会输出提示性文本,直接计数无法区分真实日志和提示行。 - 处理方式:日志计数使用 `journalctl -q ...`,并只输出安全计数或关键词类型,不输出日志正文。 - 以后避免:上线验收中的日志安全计数必须加 `-q`,发现非零后再用脱敏方式定位,不直接打印生产日志全文。 + +## 2026-07-16 店务小程序登录失败不能触发店铺选择 + +- 问题:密码错误后登录页仍弹出“选择店铺”,遮挡表单导致无法重新输入。 +- 原因:登录失败的通用 catch 分支会继续按账号预查店铺;账号存在但密码错误时也能查到绑定店铺,于是误以为需要选店。 +- 处理方式:店铺选择只在登录接口明确返回需要选择登录店铺时触发;只有一个店铺时直接调用选店登录;删除任意错误后的店铺预查兜底。 +- 以后避免:登录失败处理不要调用不依赖登录凭证的店铺预查接口;选店弹窗必须由已通过登录校验的响应或明确的选店错误触发。