修正 aliChoice 失败根因:类目弹窗没关(遮罩挡住所有必填属性)+ 新增文本型必填兜底 fillRequiredTextInputs
This commit is contained in:
1 parent
de9d988f4c
commit
14214862e6
3 files changed
+145
-5
No files matched your search
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
import { readFileSync, writeFileSync, appendFileSync } from 'fs';
|
||||
import { newPage, closePage, wait, installHook, readHook } from '/home/admin9webs/shein建品/sh_lib.mjs';
|
||||
import { selectCategory, fillRequiredSelects } from '/home/admin9webs/shein建品/sh_build.mjs';
|
||||
import { selectCategory, fillRequiredSelects, fillRequiredTextInputs } from '/home/admin9webs/shein建品/sh_build.mjs';
|
||||
|
||||
const DIR = '/home/admin9webs/alichoice建品';
|
||||
const P = `document.querySelector('#app').__vue_app__.config.globalProperties.$pinia`;
|
||||
@@ -139,6 +139,12 @@ for (const t of tasks) {
|
||||
const attrs = await fillRequiredSelects(c);
|
||||
if (attrs !== 'none') log(` 必填属性: ${String(attrs).slice(0, 150)}`);
|
||||
await wait(1200);
|
||||
// 文本型必填(aliChoice 的「材质(Material)」是 input,不是 select):按标题里的材质词兜底
|
||||
const matHit = String(it.title || '').match(/plastic|cotton|polyester|stainless steel|metal|silicone|wood|resin|aluminum|alloy|fabric|nylon|glass|ceramic|leather/i);
|
||||
const matVals = [...new Set([matHit ? matHit[0] : null, 'Polyester', 'Other'].filter(Boolean))];
|
||||
const txtAttrs = await fillRequiredTextInputs(c, matVals);
|
||||
if (txtAttrs !== 'none') log(` 文本必填: ${String(txtAttrs).slice(0, 120)}`);
|
||||
await wait(1200);
|
||||
log(` PC端描述: ${await fillDescription(c, (it.bullets || []).join('<br/>') || it.title)}`);
|
||||
await wait(1500);
|
||||
if (dry) { delete done[t.pid]; log(' ✓ dry 构建完成(未保存)'); await closePage(c); continue; }
|
||||
|
||||
Reference in new issue
Block a user