test: 26项功能落地性复查(综合冒烟52项+23页巡检, 修复6处缺陷)

This commit is contained in:
HHY
2026-09-25 07:11:37 -07:00
parent 543a94609c
commit 7320ac6240
16 changed files with 348 additions and 20 deletions
+53
View File
@@ -0,0 +1,53 @@
// 全页面巡检: 逐页打开收集 JS 异常 + 关键页截图
// 用法: node verify-pages.mjs <token>
import puppeteer from 'puppeteer-core'
const browser = await puppeteer.launch({
executablePath: 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',
headless: 'new',
args: ['--window-size=1440,900', '--enable-unsafe-swiftshader'],
defaultViewport: { width: 1440, height: 900 },
})
const page = await browser.newPage()
const errors = []
page.on('pageerror', e => errors.push(String(e).slice(0, 150)))
page.on('console', m => { if (m.type() === 'error' && !m.text().includes('favicon')) errors.push('[console] ' + m.text().slice(0, 120)) })
const token = process.argv[2]
const PAGES = [
['dashboard', '/dashboard'],
['orders', '/orders'],
['quotations', '/quotations'],
['contracts', '/contracts'],
['financial', '/financial'],
['customers', '/customers'],
['aftersale', '/aftersale'],
['templates', '/templates'],
['combine', '/combine'],
['rendering', '/rendering'],
['ai_render', '/ai_render'],
['threed', '/threed'],
['measure', '/measure'],
['optimize', '/optimize'],
['cut_solution', '/cut_solution'],
['workshop', '/workshop'],
['printer', '/printer'],
['warehouse', '/warehouse'],
['products', '/products'],
['devices', '/devices'],
['market', '/market'],
['chart', '/chart'],
['personal', '/personal'],
]
for (const [name, path] of PAGES) {
const before = errors.length
await page.goto(`http://localhost:8000${path}?token=${encodeURIComponent(token)}`, { waitUntil: 'networkidle2' })
await new Promise(r => setTimeout(r, 900))
const add = errors.length - before
console.log(`${add ? '✗' : '✓'} ${name}${add ? ` (${add} 个异常)` : ''}`)
if (['financial', 'workshop', 'templates', 'cut_solution', 'report', 'chart'].includes(name)) {
await page.screenshot({ path: `D:/Code/huamenchuang/shots/patrol-${name}.png` })
}
}
console.log(`\n==== 巡检完成: ${PAGES.length - (errors.length ? 1 : 0)} 页正常, 共 ${errors.length} 条异常 ====`)
errors.slice(0, 8).forEach(e => console.log(' ', e))
await browser.close()
+6 -1
View File
@@ -243,13 +243,18 @@ async function generateCloud(mode: 'quick' | 'photo') {
}, 1500)
try {
let photo_b64: string | undefined
let rectPayload: any = null
if (mode === 'photo') {
photo_b64 = photoB64()
// 附洞口坐标+照片尺寸(后端转方位描述引导 AI 装窗位置)
if (rect.value && photo.value) {
rectPayload = { ...rect.value, photo_w: photo.value.naturalWidth, photo_h: photo.value.naturalHeight }
}
}
const d = await api<any>('post', '/api/ai-render/generate', {
template_id: templateId.value, mode,
style: form.ai_style, time: form.ai_time,
scene: mode === 'photo' ? scene.value : form.scene, photo_b64,
scene: mode === 'photo' ? scene.value : form.scene, photo_b64, rect: rectPayload,
}, { timeout: 200000 })
aiImage.value = `data:image/png;base64,${d.image_b64}`
aiPrompt.value = d.prompt
+6 -1
View File
@@ -218,8 +218,13 @@ function setBarcodeRef(el: SVGElement | null) {
async function renderBarcodes() {
if (!current.value) return
await nextTick()
// 只保留当前仍在 DOM 中的 svg(模板重建会遗留旧引用)
const live = barcodeRefs.filter(el => el.isConnected)
barcodeRefs.length = 0
barcodeRefs.push(...live)
if (!live.length) return
const JsBarcode = (await import('jsbarcode')).default
for (const svg of barcodeRefs) {
for (const svg of live) {
try { JsBarcode(svg, current.value.order_no || '0000', { format: 'CODE128', height: 44, fontSize: 13, margin: 4 }) } catch { /* 忽略 */ }
}
}