diff --git a/README.md b/README.md index 9b8b343..c035f63 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# GLM Coding 抢购助手 v4.5 +# GLM Coding 抢购助手 v4.6 智谱 GLM Coding Plan 限时抢购自动化脚本(Tampermonkey 油猴脚本) @@ -87,6 +87,10 @@ ## 更新日志 +### v4.6 (2026-04-10) +- **修复** clickButton 直接调用 Vue 组件的 `gotoPayFn()` 方法,彻底绕过 disabled 按钮限制 +- **验证** Playwright 实测确认 `gotoPayFn()` 能触发完整的 preview + check 流程 + ### v4.5 (2026-04-10) - **修复** 支付弹窗不弹出的核心问题:改用"先抢再喂"策略,retry 独立抢到 bizId 后缓存响应,再点击按钮让前端正常处理 - **修复** `findBuyButton` 找错按钮(匹配到"即刻订阅"导航按钮),现在按优先级排序,优先找特惠/购买按钮 diff --git a/glm-rush-v4.user.js b/glm-rush-v4.user.js index 1e9f9db..dee9546 100644 --- a/glm-rush-v4.user.js +++ b/glm-rush-v4.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name 智谱 GLM Coding 抢购助手 v4.0 // @namespace http://tampermonkey.net/ -// @version 4.5 +// @version 4.6 // @description 并发重试 + 自适应间隔 + 反检测 + check校验 + 弹窗恢复 + 定时触发 + 配置持久化 // @author Assistant // @match *://www.bigmodel.cn/* @@ -649,15 +649,24 @@ }, true); function clickButton(btn) { - // 强制解除 disabled 状态(售罄按钮需要解锁才能触发事件) + // 优先方案: 直接调用 Vue 组件的 gotoPayFn(绕过 disabled 限制) + let el = btn; + for (let i = 0; i < 20 && el; i++) { + if (el.__vue__ && el.__vue__.gotoPayFn) { + log('直接调用 Vue gotoPayFn()'); + el.__vue__.gotoPayFn(); + return; + } + el = el.parentElement; + } + + // 降级方案: 强制解除 disabled + DOM 点击 + log('未找到 Vue 实例, 降级为 DOM 点击'); if (btn.disabled) { btn.disabled = false; btn.classList.remove('is-disabled', 'disabled'); - log('已解除按钮 disabled 状态'); } - // 确保 pointer-events 可交互 btn.style.pointerEvents = 'auto'; - // 多种方式触发点击,确保前端框架(Vue/Element UI)能响应 btn.focus(); btn.dispatchEvent(new MouseEvent('mousedown', { bubbles: true, cancelable: true })); btn.dispatchEvent(new MouseEvent('mouseup', { bubbles: true, cancelable: true }));