Files
admin9webs f5720ad613 店小秘多平台铺货配方:7 平台建品脚本 + 静默拦截诊断法 + 项目状态
- TikTok/Shopee/速卖通/Walmart 各 46-47 条已在待发布
- Ozon 47 条已建、改价 40/47
- SHEIN 配方跑通第一条;Temu 差「预览图」一步
- 核心产出:MYJ.message.error 钩子诊断法(解开了三个平台的保存静默拦截)
- 含下一轮提示词 NEXT-ROUND-PROMPT.md
2026-09-20 17:29:38 +08:00

35 lines
2.6 KiB
JavaScript

import { attach } from '/tmp/cdp3.mjs';
const wait = ms => new Promise(z => setTimeout(z, ms));
const c = await attach('/web/sheinProduct/add') || await attach('dianxiaomi.com');
console.log('url:', await c.evalJS('location.href'));
// 探测可用的消息库
const probe = await c.evalJS(`(()=>{const keys=['MYJ','Vue','antd','$message','ELEMENT'];
const found={};
keys.forEach(k=>{ try{ found[k]=typeof window[k]; }catch(e){ found[k]='err'; } });
return JSON.stringify(found);})()`);
console.log('全局对象:', String(probe));
// 埋钩子(尽量广)
const hook = await c.evalJS(`(()=>{window.__cap=[]; let n=0;
function wrap(obj,name,label){ try{ if(!obj||!obj[name])return; const o=obj[name];
obj[name]=function(){ try{ window.__cap.push(label+': '+Array.prototype.slice.call(arguments).map(function(a){return typeof a==='string'?a:JSON.stringify(a);}).join(' ').slice(0,200)); }catch(e){}
return o.apply(obj,arguments); }; n++; }catch(e){} }
try{ if(window.MYJ&&window.MYJ.message){ ['error','warning','info','success'].forEach(k=>wrap(window.MYJ.message,k,'MYJ.'+k)); } }catch(e){}
try{ if(window.antd&&window.antd.message){ ['error','warning','info','success'].forEach(k=>wrap(window.antd.message,k,'antd.'+k)); } }catch(e){}
try{ if(window.$message){ ['error','warning','info','success'].forEach(k=>wrap(window.$message,k,'$message.'+k)); } }catch(e){}
return 'wrapped '+n;})()`);
console.log('钩子:', String(hook));
// 点保存
await c.evalJS(`window.scrollTo(0,0)`); await wait(600);
await c.evalJS(`(()=>{const x=[...document.querySelectorAll('button')].filter(e=>e.offsetParent!==null).find(e=>/^\\s*保存\\s*$/.test((e.innerText||'').trim()));
if(x) for(const ev of ['mousedown','mouseup','click']) x.dispatchEvent(new MouseEvent(ev,{bubbles:true,cancelable:true,view:window})); return 1;})()`);
await wait(9000);
const cap = await c.evalJS(`JSON.stringify(window.__cap||[])`);
console.log('★ 捕获:', String(cap).slice(0,600));
const errs = await c.evalJS(`JSON.stringify([].slice.call(document.querySelectorAll('.ant-form-item-explain-error')).map(function(e){
var p=e.closest?e.closest('.ant-form-item'):null; var l=p?(p.querySelector('label')||{}).innerText||'':'';
return l.replace(/\\s+/g,' ').trim().slice(0,30)+' → '+(e.innerText||'').trim();}).filter(Boolean))`);
console.log('行内错误:', String(errs).slice(0,400));
const errItems = await c.evalJS(`JSON.stringify([].slice.call(document.querySelectorAll('.ant-form-item-has-error')).map(function(x){var l=x.querySelector('label');return l?(l.innerText||'').replace(/\\s+/g,' ').trim().slice(0,36):'?';}))`);
console.log('出错字段:', String(errItems).slice(0,300));
process.exit(0);