You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.4 KiB
34 lines
1.4 KiB
|
6 days ago
|
// 下钻新增商机页原始 HTML:dump 表单客户信息区(u550-u600)与需求批注区(u650-u695)的控件原始片段
|
||
|
|
import fs from 'node:fs';
|
||
|
|
|
||
|
|
const OSS = 'https://lanhu-axure-file.oss-cn-beijing.aliyuncs.com/';
|
||
|
|
const manifest = JSON.parse(fs.readFileSync('e:/code/crm-backend-matt/.scratch/lanhu-latest/axure-v29.json', 'utf8'));
|
||
|
|
const page = 'a3-1-1-2-1__新增_编辑商机.html';
|
||
|
|
const url = OSS + manifest.pages[page].html.sign_md5;
|
||
|
|
const html = await (await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0' } })).text();
|
||
|
|
fs.writeFileSync('e:/code/crm-backend-matt/.scratch/lanhu-latest/v29-customer-pages/a3-1-1-2-1_raw.html', html, 'utf8');
|
||
|
|
console.log('saved raw html, size =', html.length);
|
||
|
|
|
||
|
|
// 提取所有控件注释块 <!-- 名称 (类型) --> + div id
|
||
|
|
const re = /<!--\s*(.*?)\s*-->\s*<div id="(u\d+)"[^>]*>/g;
|
||
|
|
const byId = new Map();
|
||
|
|
let m;
|
||
|
|
while ((m = re.exec(html)) !== null) byId.set(m[2], { comment: m[1], index: m.index });
|
||
|
|
|
||
|
|
// dump 指定 id 区间的控件:注释 + 后续 350 字符(截断)
|
||
|
|
const dump = (from, to) => {
|
||
|
|
for (let i = from; i <= to; i++) {
|
||
|
|
const id = 'u' + i;
|
||
|
|
const e = byId.get(id);
|
||
|
|
if (!e) continue;
|
||
|
|
const seg = html.slice(e.index, e.index + 350).replace(/\s+/g, ' ');
|
||
|
|
console.log(`\n--- ${id} :: ${e.comment}`);
|
||
|
|
console.log(seg);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
console.log('\n===== 客户信息表单区 u560-u600 =====');
|
||
|
|
dump(560, 600);
|
||
|
|
console.log('\n===== 需求批注区 u645-u695 =====');
|
||
|
|
dump(645, 695);
|