86 lines
2.5 KiB
JavaScript
86 lines
2.5 KiB
JavaScript
const fs = require('fs');
|
|
|
|
// 修复破碎的 HTML 标签
|
|
const files = [
|
|
'src/views/order/OrderList.vue',
|
|
'src/views/order/OrderFollow.vue',
|
|
'src/views/order/OrderRecheck.vue',
|
|
'src/views/order/OrderTracking.vue',
|
|
'src/views/quote/QuoteGenerate.vue'
|
|
];
|
|
|
|
let fixed = 0;
|
|
files.forEach(file => {
|
|
try {
|
|
let content = fs.readFileSync(file, 'utf8');
|
|
let modified = false;
|
|
|
|
// 修复破碎的 option 标签
|
|
const optionMatches = content.match(/>[^<]*\/option>/g);
|
|
if (optionMatches) {
|
|
optionMatches.forEach(match => {
|
|
const text = match.substring(1, match.length - 9); // 提取文本内容
|
|
const fixed = '>' + text + '</option>';
|
|
content = content.split(match).join(fixed);
|
|
modified = true;
|
|
});
|
|
}
|
|
|
|
// 修复破碎的 th 标签
|
|
const thMatches = content.match(/>[^<]*\/th>/g);
|
|
if (thMatches) {
|
|
thMatches.forEach(match => {
|
|
const text = match.substring(1, match.length - 5);
|
|
const fixed = '>' + text + '</th>';
|
|
content = content.split(match).join(fixed);
|
|
modified = true;
|
|
});
|
|
}
|
|
|
|
// 修复破碎的 td 标签
|
|
const tdMatches = content.match(/>[^<]*\/td>/g);
|
|
if (tdMatches) {
|
|
tdMatches.forEach(match => {
|
|
const text = match.substring(1, match.length - 5);
|
|
const fixed = '>' + text + '</td>';
|
|
content = content.split(match).join(fixed);
|
|
modified = true;
|
|
});
|
|
}
|
|
|
|
// 修复破碎的 button 标签
|
|
const buttonMatches = content.match(/>[^<]*\/button>/g);
|
|
if (buttonMatches) {
|
|
buttonMatches.forEach(match => {
|
|
const text = match.substring(1, match.length - 10);
|
|
const fixed = '>' + text + '</button>';
|
|
content = content.split(match).join(fixed);
|
|
modified = true;
|
|
});
|
|
}
|
|
|
|
// 修复破碎的 label 标签
|
|
const labelMatches = content.match(/>[^<]*\/label>/g);
|
|
if (labelMatches) {
|
|
labelMatches.forEach(match => {
|
|
const text = match.substring(1, match.length - 8);
|
|
const fixed = '>' + text + '</label>';
|
|
content = content.split(match).join(fixed);
|
|
modified = true;
|
|
});
|
|
}
|
|
|
|
if (modified) {
|
|
fs.writeFileSync(file, content, 'utf8');
|
|
console.log('Fixed: ' + file);
|
|
fixed++;
|
|
} else {
|
|
console.log('No changes: ' + file);
|
|
}
|
|
} catch(e) {
|
|
console.log('Error fixing ' + file + ': ' + e.message);
|
|
}
|
|
});
|
|
|
|
console.log('\nTotal fixed: ' + fixed + ' files');
|