first commit

This commit is contained in:
2026-05-08 03:06:24 +08:00
commit 8da6567178
146 changed files with 82014 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
const fs = require('fs');
const path = require('path');
function walkDir(dir, files = []) {
const entries = fs.readdirSync(dir, { withFileTypes: true });
for (const entry of entries) {
const full = path.join(dir, entry.name);
if (entry.isDirectory()) walkDir(full, files);
else if (entry.name.endsWith('.vue') && !entry.name.includes('_fixed')) files.push(full);
}
return files;
}
const viewsDir = path.join(__dirname, 'src', 'views');
const files = walkDir(viewsDir);
let fixedFiles = [];
for (const filePath of files) {
let content = fs.readFileSync(filePath, 'utf8');
let modified = false;
// Find the root div class in template
const templateMatch = content.match(/<template>[\s\S]*?^(\s*)<div\s+class="([^"]+)"/m);
if (!templateMatch) continue;
const rootClass = templateMatch[2];
const indent = templateMatch[1];
const pageSpecificClass = rootClass.split(/\s+/).find(c => c !== 'page-container');
// If root doesn't have page-container, add it
if (!rootClass.includes('page-container')) {
const oldLine = `${indent}<div class="${rootClass}"`;
const newLine = `${indent}<div class="page-container ${rootClass}"`;
content = content.replace(oldLine, newLine);
modified = true;
console.log(`[ADD page-container] ${path.relative(viewsDir, filePath)} : "${rootClass}" -> "page-container ${rootClass}"`);
}
// Remove padding: 0 from the page-specific root class in scoped style
if (pageSpecificClass) {
// Match something like: .order-list { padding: 0; } or .order-list {\n padding: 0;\n}
const paddingZeroRegex = new RegExp(
`(\\.${pageSpecificClass}\\s*\\{[^}]*?)padding:\\s*0\\s*;?\\s*([^}]*\\})`,
's'
);
if (paddingZeroRegex.test(content)) {
content = content.replace(paddingZeroRegex, (match, before, after) => {
let result = before + after;
// If the rule is now empty like .class { }, remove it entirely
result = result.replace(
new RegExp(`\\.${pageSpecificClass}\\s*\\{\\s*\\}`, 's'),
''
);
return result;
});
modified = true;
console.log(`[REMOVE padding:0] ${path.relative(viewsDir, filePath)} : .${pageSpecificClass}`);
}
}
if (modified) {
fs.writeFileSync(filePath, content, 'utf8');
fixedFiles.push(filePath);
} else {
console.log(`[SKIP] ${path.relative(viewsDir, filePath)} : already has page-container`);
}
}
console.log(`\n=== Summary ===`);
console.log(`Total files: ${files.length}`);
console.log(`Fixed files: ${fixedFiles.length}`);
fixedFiles.forEach(f => console.log(` - ${path.relative(viewsDir, f)}`));