修改部份ui

This commit is contained in:
Azmat@qq.com
2026-08-18 18:32:19 +08:00
parent dfe94a923e
commit 18b3927817
19 changed files with 2151 additions and 681 deletions
+23
View File
@@ -0,0 +1,23 @@
import { chromium } from "playwright";
import { mkdirSync } from "node:fs";
const BASE = process.env.BASE || "http://127.0.0.1:5173";
const API = process.env.API || "http://127.0.0.1:8010";
const OUT = process.argv[2] || "shots-proj-yz";
mkdirSync(OUT, { recursive: true });
const login = await (await fetch(`${API}/api/auth/login/`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ username: "airshelf", password: "Restraint2026" })
})).json();
const browser = await chromium.launch();
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 }, deviceScaleFactor: 2 });
await ctx.addInitScript((t) => localStorage.setItem("airshelf_token", t), login.token);
const page = await ctx.newPage();
await page.goto(`${BASE}/projects`, { waitUntil: "networkidle", timeout: 40000 });
await page.waitForTimeout(2000);
await page.screenshot({ path: `${OUT}/projects-yz-preview.png`, fullPage: false });
console.log("shot projects-yz-preview");
await browser.close();
+30
View File
@@ -0,0 +1,30 @@
import { chromium } from 'playwright';
const BASE = process.env.BASE || 'http://127.0.0.1:5173';
const API = process.env.API || 'http://127.0.0.1:8010';
const OUT = process.argv[2] || 'shots-sidebar';
const login = await (await fetch(`${API}/api/auth/login/`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username: 'airshelf', password: 'Restraint2026' })
})).json();
const tok = login.token;
const browser = await chromium.launch();
const ctx = await browser.newContext({ viewport: { width: 440, height: 800 }, deviceScaleFactor: 2 });
await ctx.addInitScript((t) => localStorage.setItem('airshelf_token', t), tok);
const page = await ctx.newPage();
async function shot(url, name) {
await page.goto(`${BASE}${url}`, { waitUntil: 'networkidle', timeout: 40000 });
await page.waitForTimeout(800);
await page.screenshot({ path: `${OUT}-${name}.png`, clip: { x: 0, y: 0, width: 220, height: 780 } });
console.log('shot', name);
}
await shot('/projects', 'projects');
await shot('/team', 'team');
await shot('/settings', 'settings');
await browser.close();