|
|
@@ -4,8 +4,10 @@ import fs from "fs";
|
|
|
import { fileURLToPath } from "url";
|
|
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
-const root = path.resolve(__dirname, "..");
|
|
|
-const outDir = path.join(root, "建设方案", "images");
|
|
|
+const proposalDir = path.resolve(__dirname, "..");
|
|
|
+const repoRoot = path.resolve(proposalDir, "..");
|
|
|
+const prototypeRoot = path.join(repoRoot, "原型图");
|
|
|
+const outDir = path.join(proposalDir, "images");
|
|
|
const chrome = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
|
|
|
fs.mkdirSync(outDir, { recursive: true });
|
|
|
|
|
|
@@ -19,7 +21,7 @@ async function shotMobile(hash, name, { expand = false, prep = null } = {}) {
|
|
|
const page = await browser.newPage();
|
|
|
await page.setViewport({ width: 390, height: 844, deviceScaleFactor: 2 });
|
|
|
await page.goto(
|
|
|
- "file://" + path.join(root, "index.html") + "?t=" + Date.now() + "#" + hash,
|
|
|
+ "file://" + path.join(prototypeRoot, "index.html") + "?t=" + Date.now() + "#" + hash,
|
|
|
{ waitUntil: "networkidle0", timeout: 30000 }
|
|
|
);
|
|
|
await page.evaluate(() => {
|
|
|
@@ -58,7 +60,7 @@ async function shotMobile(hash, name, { expand = false, prep = null } = {}) {
|
|
|
async function shotAdmin(panel, name, detailId = null) {
|
|
|
const page = await browser.newPage();
|
|
|
await page.setViewport({ width: 1440, height: 900, deviceScaleFactor: 1.5 });
|
|
|
- await page.goto("file://" + path.join(root, "admin.html") + "?t=" + Date.now(), {
|
|
|
+ await page.goto("file://" + path.join(prototypeRoot, "admin.html") + "?t=" + Date.now(), {
|
|
|
waitUntil: "networkidle0",
|
|
|
});
|
|
|
await page.evaluate(
|