aliChoice 侦察档:store 落点与 Joom 的字段名差异(subject vs name),避免下一轮直接照抄 Joom

This commit is contained in:
admin9webs committed 2026-09-20 21:01:46 +08:00
1 parent c275571317
commit acabadffd4
3 files changed
+77 -1

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
# aliChoice(速卖通全托管)侦察 — 未跑通,下一轮从这里接着做
路由:`https://www.dianxiaomi.com/web/smtChoice/add` 列表:`/web/smtChoice/{draft=采集箱, offline=待发布}`
页面标题:`店小秘--添加速卖通全托管产品`
## 已勘明(`alc_probe1.mjs`)
### 店铺
`店铺名称` 是**下拉**,本例只有 **2 家**:`XYZ Store`、`UniStyle Bag Store`。
(上一轮侦察写的「64 家」是平台维度统计,实际可用店铺以后续页面为准。)
### 表单(可见,前 8 项)
`店铺名称 · 备货类型 · 产品标题 · 产品分类(+选择分类/自动识别分类) · 店小秘分类 · 来源URL · 产品属性`
### store 与字段落点(**注意:和 Joom 共用 `smtChoice*`,但字段名不同**)
| store | 关键字段 |
|---|---|
| `smtChoiceAddBasicStore` | `shopId`、`categoryId`、`productType`、**`subject`(产品标题在这里,不是 `name`)** |
| `smtChoiceAddProductStore` | `mainImage[]`(数组)、`whiteBgImg`、`sceneImg`、`productManual`、`installVideo`、`videoData` |
| `smtChoiceSkuDataStore` | `skuDataList[]`(默认已生成 1 行) |
| `smtChoiceSkuAttrStore` | `skuAttrs[]` |
| `smtChoiceAddAttrStore` | `customAttrs[]` + 一大票汽配字段(`motorIds` / `vehicleEuAfids` …) |
| `smtChoiceAddOtherStore` | `packageFormState` / `otherInfoFormState` / `otherBusinessInfoState` |
| `smtChoiceAddStore` | `productInfo` / `attrsInfo` / `describeInfoData`(**没有 formState**) |
⚠️ 和 Joom 的差异:Joom 标题在 `smtChoiceAddBasicStore.name`,这里在 `.subject`。
**别把 Joom 的填法直接抄过来。**
## 下一轮的顺序建议
1. 选店铺(下拉,取第一家 `XYZ Store`)
2. **备货类型**(必填,先探选项)
3. 类目:`选择分类` 弹窗(同 SHEIN/Temu 那套)+ 留意「自动识别分类」
4. 标题 → `smtChoiceAddBasicStore.subject`
5. 图片 → `smtChoiceAddProductStore.mainImage[]`
6. SKU 行 / 属性 / 包装 → 对应 store
7. **挂钩子再保存**(大概率还有层层递进的必填:参考 Temu 的省份→变种→尺寸→净重→预览图)
## 已知可复用的东西
- `shein建品/sh_lib.mjs`(`newPage`/`closePage`/`installHook`/`readHook`)
- `shein建品/sh_build.mjs` 的 `selectCategory` / `fillRequiredSelects`(SHEIN/Temu/Joom 都已验证)
- `joom建品/jmbatch.mjs` 的骨架(换字段名和控件类型即可)
+35
View File
@@ -0,0 +1,35 @@
import { newPage, closePage, wait } from '/home/admin9webs/shein建品/sh_lib.mjs';
import { SAN as S } from '/tmp/cdp3.mjs';
const c = await newPage('https://www.dianxiaomi.com/web/smtChoice/add');
await wait(12000);
const init = await c.evalJS(`(()=>{
const items=[...document.querySelectorAll('.ant-form-item')].filter(e=>e.offsetParent!==null).slice(0,8)
.map(e=>(e.innerText||'').replace(/\\s+/g,' ').trim().slice(0,54));
return JSON.stringify({items});})()`);
console.log('初始表单项:', S(String(init)).slice(0,700));
// 店铺下拉
const pos = JSON.parse(String(await c.evalJS(`(()=>{const it=[...document.querySelectorAll('.ant-form-item')].filter(e=>e.offsetParent!==null).find(e=>/店铺名称/.test((e.querySelector('label')||{}).innerText||''));
const s=it?it.querySelector('.ant-select-selector'):null; if(!s) return '[]'; s.scrollIntoView({block:'center'});
const r=s.getBoundingClientRect(); return JSON.stringify([Math.round(r.x+r.width/2),Math.round(r.y+r.height/2)]);})()`)));
await c.send('Input.dispatchMouseEvent',{type:'mouseMoved',x:pos[0],y:pos[1],buttons:0}); await wait(300);
for(const t of ['mousePressed','mouseReleased']) await c.send('Input.dispatchMouseEvent',{type:t,x:pos[0],y:pos[1],button:'left',clickCount:1,buttons:1});
await wait(2500);
const opts = await c.evalJS(`(()=>{const dd=[...document.querySelectorAll('.ant-select-dropdown')].filter(e=>e.offsetParent!==null).pop();
if(!dd) return 'no-dd';
const items=[...dd.querySelectorAll('.ant-select-item-option')].map(e=>(e.innerText||'').replace(/\\s+/g,' ').trim());
return JSON.stringify({n:items.length, items:items.slice(0,10)});})()`);
console.log('店铺选项:', S(String(opts)).slice(0,600));
await c.evalJS(`(()=>{const dd=[...document.querySelectorAll('.ant-select-dropdown')].filter(e=>e.offsetParent!==null).pop();
const it=[...dd.querySelectorAll('.ant-select-item-option')][0]; const r=it.getBoundingClientRect();
for(const ev of ['mousedown','mouseup','click']) it.dispatchEvent(new MouseEvent(ev,{bubbles:true,cancelable:true,view:window,clientX:r.x+r.width/2,clientY:r.y+r.height/2})); return 1;})()`);
await wait(6000);
const st = await c.evalJS(`(()=>{const p=document.querySelector('#app').__vue_app__.config.globalProperties.$pinia;
const ids=(p._s instanceof Map?[...p._s.keys()]:Object.keys(p._s)).filter(x=>/smtChoice/i.test(x));
const out={};
const fmt=(v,d=0)=>{ if(v===null||v===undefined) return String(v); if(Array.isArray(v)) return '['+v.length+']'+(v[0]?JSON.stringify(v[0]).slice(0,50):'');
if(typeof v==='object'){ if(d>1) return '{...}'; const o={}; let n=0; for(const k of Object.keys(v)){o[k]=fmt(v[k],d+1); if(++n>12){o['…']='';break;}} return o;} return String(v).slice(0,40); };
for(const id of ids){ try{ const s=(p._s.get?p._s.get(id):p._s[id]).$state; out[id]= s.formState?fmt(s.formState):('keys='+Object.keys(s).slice(0,8).join(',')); }catch(e){out[id]='ERR';} }
return JSON.stringify(out);})()`);
console.log('smtChoice stores:', JSON.stringify(JSON.parse(String(st)),null,1).slice(0,1600));
try{ await c.shot('/tmp/alc1.jpg'); console.log('shot ok'); }catch(e){}
await closePage(c); process.exit(0);