From 2b59f68fd72d34576f4aa6afb9cfb842c9d8b442 Mon Sep 17 00:00:00 2001 From: Ironsp <1522278303@qq.com> Date: Thu, 1 Oct 2026 16:58:22 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E5=AE=8C=E5=96=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cdp.js | 156 ----- diag.js | 19 - docs/prototype/个人中心-演示.html | 922 -------------------------- docs/prototype/合同管理-演示.html | 846 ------------------------ docs/prototype/在线客服-演示.html | 677 ------------------- docs/prototype/案例库-演示.html | 962 --------------------------- docs/prototype/消息中心-演示.html | 847 ------------------------ docs/prototype/登录-演示.html | 800 ---------------------- docs/prototype/财务中心-演示.html | 997 ---------------------------- docs/prototype/需求填报-演示.html | 759 --------------------- docs/prototype/项目中心-演示.html | 944 -------------------------- docs/prototype/首页-演示.html | 1023 ----------------------------- read_prototype.js | 22 - src/views/cases/index.vue | 1 + src/views/contract/index.vue | 1 + src/views/demand/index.vue | 1 + src/views/finance/index.vue | 1 + src/views/home/index.vue | 1 + src/views/login/index.vue | 1 + src/views/message/index.vue | 1 + src/views/profile/index.vue | 1 + src/views/project/index.vue | 1 + src/views/service/index.vue | 1 + tabs.js | 36 - 24 files changed, 10 insertions(+), 9010 deletions(-) delete mode 100644 cdp.js delete mode 100644 diag.js delete mode 100644 docs/prototype/个人中心-演示.html delete mode 100644 docs/prototype/合同管理-演示.html delete mode 100644 docs/prototype/在线客服-演示.html delete mode 100644 docs/prototype/案例库-演示.html delete mode 100644 docs/prototype/消息中心-演示.html delete mode 100644 docs/prototype/登录-演示.html delete mode 100644 docs/prototype/财务中心-演示.html delete mode 100644 docs/prototype/需求填报-演示.html delete mode 100644 docs/prototype/项目中心-演示.html delete mode 100644 docs/prototype/首页-演示.html delete mode 100644 read_prototype.js delete mode 100644 tabs.js diff --git a/cdp.js b/cdp.js deleted file mode 100644 index 342b305..0000000 --- a/cdp.js +++ /dev/null @@ -1,156 +0,0 @@ -// @ts-nocheck -/** - * 无依赖的 headless Chrome 截图 + DOM 测量工具(CDP over WebSocket) - * - * 用法: - * node cdp.js [width] [height] [outPng] [evalExpr] - * - * 环境变量: - * CDP_FULL=1 截整页(captureBeyondViewport) - * CDP_WAIT=2500 导航后等待毫秒 - * CDP_HASH= 路由 hash/附加查询串,直接拼在 url 后面 - * - * 说明:本机 agent-browser 会反复 SIGTERM,故改为此脚本;仅用 Node 内置能力。 - */ -import { spawn } from 'node:child_process' -import { writeFileSync, mkdtempSync, existsSync } from 'node:fs' -import { tmpdir } from 'node:os' -import { join } from 'node:path' - -const CANDIDATES = [ - 'C:/Program Files/Google/Chrome/Application/chrome.exe', - 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe', - 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe', - 'C:/Program Files/Microsoft/Edge/Application/msedge.exe', -] -const CHROME = CANDIDATES.find((p) => existsSync(p)) -if (!CHROME) { - console.error('找不到 Chrome/Edge') - process.exit(1) -} - -const [, , urlArg, wArg, hArg, outArg, exprArg] = process.argv -const url = (urlArg || 'http://localhost:5173/') + (process.env.CDP_HASH || '') -const width = Number(wArg || 1440) -const height = Number(hArg || 900) -const out = outArg || 'shot.png' -const expr = exprArg || '' -const full = process.env.CDP_FULL === '1' -const waitMs = Number(process.env.CDP_WAIT || 2800) - -const PORT = 9300 + Math.floor(Math.random() * 400) -const userDataDir = mkdtempSync(join(tmpdir(), 'cdp-')) - -const child = spawn( - CHROME, - [ - '--headless=new', - `--remote-debugging-port=${PORT}`, - `--user-data-dir=${userDataDir}`, - `--window-size=${width},${height}`, - '--no-first-run', - '--no-default-browser-check', - '--disable-gpu', - '--force-device-scale-factor=1', - 'about:blank', - ], - { stdio: 'ignore' }, -) - -async function findTarget() { - for (let i = 0; i < 100; i += 1) { - try { - const res = await fetch(`http://127.0.0.1:${PORT}/json/list`) - const list = await res.json() - const page = list.find((t) => t.type === 'page' && t.webSocketDebuggerUrl) - if (page) return page.webSocketDebuggerUrl - } - catch { /* 还没起来 */ } - await new Promise((r) => setTimeout(r, 150)) - } - throw new Error('Chrome 调试端口未就绪') -} - -function makeClient(wsUrl) { - const ws = new WebSocket(wsUrl) - let seq = 0 - const pending = new Map() - const events = [] - const ready = new Promise((resolve, reject) => { - ws.onopen = () => resolve() - ws.onerror = (e) => reject(new Error(`ws error ${e.message || ''}`)) - }) - ws.onmessage = (ev) => { - const msg = JSON.parse(ev.data) - if (msg.id && pending.has(msg.id)) { - const { resolve, reject } = pending.get(msg.id) - pending.delete(msg.id) - if (msg.error) reject(new Error(JSON.stringify(msg.error))) - else resolve(msg.result) - } - else if (msg.method) events.push(msg.method) - } - const send = (method, params = {}) => - new Promise((resolve, reject) => { - seq += 1 - pending.set(seq, { resolve, reject }) - ws.send(JSON.stringify({ id: seq, method, params })) - }) - return { ready, send, events, close: () => ws.close() } -} - -const sleep = (ms) => new Promise((r) => setTimeout(r, ms)) - -try { - const wsUrl = await findTarget() - const cdp = makeClient(wsUrl) - await cdp.ready - - await cdp.send('Page.enable') - await cdp.send('Runtime.enable') - await cdp.send('Emulation.setDeviceMetricsOverride', { - width, - height, - deviceScaleFactor: 1, - mobile: false, - }) - - await cdp.send('Page.navigate', { url }) - await sleep(waitMs) - - if (expr) { - const res = await cdp.send('Runtime.evaluate', { - expression: expr, - returnByValue: true, - awaitPromise: true, - }) - if (res.exceptionDetails) { - console.error('EVAL-ERROR:', JSON.stringify(res.exceptionDetails.exception?.description || res.exceptionDetails)) - } - else { - console.log(typeof res.result.value === 'string' ? res.result.value : JSON.stringify(res.result.value)) - } - } - - let clip - if (full) { - const metrics = await cdp.send('Page.getLayoutMetrics') - const size = metrics.cssContentSize || metrics.contentSize - clip = { x: 0, y: 0, width: size.width, height: size.height, scale: 1 } - } - const shot = await cdp.send('Page.captureScreenshot', { - format: 'png', - captureBeyondViewport: full, - ...(clip ? { clip } : {}), - }) - writeFileSync(out, Buffer.from(shot.data, 'base64')) - console.error(`saved ${out} (${width}x${height}${full ? ' fullpage' : ''})`) - cdp.close() -} -catch (err) { - console.error('FAIL:', err.message) - process.exitCode = 1 -} -finally { - try { child.kill() } catch { /* ignore */ } -} diff --git a/diag.js b/diag.js deleted file mode 100644 index f1ff454..0000000 --- a/diag.js +++ /dev/null @@ -1,19 +0,0 @@ -// @ts-nocheck -// 诊断:点页签后输出祖先链几何,定位额外间距来源 -const TAB = Number(process.argv[2] || 2) -const TARGET = process.argv[3] || '.project-files__list' - -const js = `(async function(){ - const tabs = document.querySelectorAll(".project-detail__tab"); - if (${TAB} > 0 && tabs[${TAB} - 1]) { tabs[${TAB} - 1].click(); await new Promise(r => setTimeout(r, 900)); } - let el = document.querySelector(${JSON.stringify(TARGET)}); - const chain = []; - while (el && chain.length < 6) { - const r = el.getBoundingClientRect(); - const cs = getComputedStyle(el); - chain.push({ cls: (el.className || '').toString().slice(0, 40), y: +r.y.toFixed(1), h: +r.height.toFixed(1), mt: cs.marginTop, pt: cs.paddingTop, pb: cs.paddingBottom, gap: cs.gap, rowGap: cs.rowGap }); - el = el.parentElement; - } - return JSON.stringify(chain, null, 0); -})()` -console.log(js) diff --git a/docs/prototype/个人中心-演示.html b/docs/prototype/个人中心-演示.html deleted file mode 100644 index 8523cf1..0000000 --- a/docs/prototype/个人中心-演示.html +++ /dev/null @@ -1,922 +0,0 @@ -个人中心-演示
\ No newline at end of file diff --git a/docs/prototype/合同管理-演示.html b/docs/prototype/合同管理-演示.html deleted file mode 100644 index acf9eac..0000000 --- a/docs/prototype/合同管理-演示.html +++ /dev/null @@ -1,846 +0,0 @@ -合同管理-演示
\ No newline at end of file diff --git a/docs/prototype/在线客服-演示.html b/docs/prototype/在线客服-演示.html deleted file mode 100644 index ba9fae8..0000000 --- a/docs/prototype/在线客服-演示.html +++ /dev/null @@ -1,677 +0,0 @@ -在线客服-演示
\ No newline at end of file diff --git a/docs/prototype/案例库-演示.html b/docs/prototype/案例库-演示.html deleted file mode 100644 index 0fd7075..0000000 --- a/docs/prototype/案例库-演示.html +++ /dev/null @@ -1,962 +0,0 @@ -案例库-演示
\ No newline at end of file diff --git a/docs/prototype/消息中心-演示.html b/docs/prototype/消息中心-演示.html deleted file mode 100644 index 73999cd..0000000 --- a/docs/prototype/消息中心-演示.html +++ /dev/null @@ -1,847 +0,0 @@ -消息中心-演示
\ No newline at end of file diff --git a/docs/prototype/登录-演示.html b/docs/prototype/登录-演示.html deleted file mode 100644 index 62a85f9..0000000 --- a/docs/prototype/登录-演示.html +++ /dev/null @@ -1,800 +0,0 @@ -登录-演示
\ No newline at end of file diff --git a/docs/prototype/财务中心-演示.html b/docs/prototype/财务中心-演示.html deleted file mode 100644 index 5f3ecbd..0000000 --- a/docs/prototype/财务中心-演示.html +++ /dev/null @@ -1,997 +0,0 @@ -财务中心-演示
\ No newline at end of file diff --git a/docs/prototype/需求填报-演示.html b/docs/prototype/需求填报-演示.html deleted file mode 100644 index 1a91b89..0000000 --- a/docs/prototype/需求填报-演示.html +++ /dev/null @@ -1,759 +0,0 @@ -需求填报-演示
\ No newline at end of file diff --git a/docs/prototype/项目中心-演示.html b/docs/prototype/项目中心-演示.html deleted file mode 100644 index 213b59a..0000000 --- a/docs/prototype/项目中心-演示.html +++ /dev/null @@ -1,944 +0,0 @@ -项目中心-演示
\ No newline at end of file diff --git a/docs/prototype/首页-演示.html b/docs/prototype/首页-演示.html deleted file mode 100644 index 35ca76a..0000000 --- a/docs/prototype/首页-演示.html +++ /dev/null @@ -1,1023 +0,0 @@ -首页-演示
\ No newline at end of file diff --git a/read_prototype.js b/read_prototype.js deleted file mode 100644 index 0bffe68..0000000 --- a/read_prototype.js +++ /dev/null @@ -1,22 +0,0 @@ -const fs = require('node:fs') -const path = require('node:path') -const process = require('node:process') - -const filePath = process.argv[2] - -if (!filePath) { - console.error('Error: 请提供原型文件路径') - process.exit(1) -} - -const fullPath = path.resolve(filePath) - -if (fs.existsSync(fullPath)) { - console.log('=== START PROTOTYPE CONTENT ===') - console.log(fs.readFileSync(fullPath, 'utf-8')) - console.log('=== END PROTOTYPE CONTENT ===') -} -else { - console.error(`Error: 未找到原型文件 ${fullPath}`) - process.exit(1) -} diff --git a/src/views/cases/index.vue b/src/views/cases/index.vue index f98b8a3..edb9f23 100644 --- a/src/views/cases/index.vue +++ b/src/views/cases/index.vue @@ -1,3 +1,4 @@ +