Files
akmon/doc_zhipao/fix_specific_css.ps1
2026-01-20 08:04:15 +08:00

50 lines
2.1 KiB
PowerShell

# Fix specific CSS issues in sport/index.uvue and other critical files
# Fix main sport index page
$sportIndexPath = "pages\sport\index.uvue"
if (Test-Path $sportIndexPath) {
Write-Host "Fixing $sportIndexPath" -ForegroundColor Yellow
$content = Get-Content $sportIndexPath -Raw -Encoding UTF8
# Already fixed the main issues, this is for verification
Write-Host "Sport index already fixed" -ForegroundColor Green
}
# Fix text-align: center on view elements by finding specific problematic classes
$problematicFiles = @(
"pages\sport\student\profile.uvue",
"pages\user\center.uvue",
"pages\user\login.uvue",
"pages\user\register.uvue"
)
foreach ($filePath in $problematicFiles) {
if (Test-Path $filePath) {
Write-Host "Processing $filePath" -ForegroundColor Yellow
$content = Get-Content $filePath -Raw -Encoding UTF8
$originalContent = $content
# Common patterns that need fixing:
# .stat-item { text-align: center; } -> should use flex
$content = $content -replace '(\.stat-item\s*\{[^}]*?)text-align:\s*center;', '$1display: flex; flex-direction: column; align-items: center;'
# .empty-state { text-align: center; } -> should use flex
$content = $content -replace '(\.empty-state\s*\{[^}]*?)text-align:\s*center;', '$1display: flex; flex-direction: column; align-items: center;'
# .header { text-align: center; } -> should use flex
$content = $content -replace '(\.header\s*\{[^}]*?)text-align:\s*center;', '$1display: flex; flex-direction: column; align-items: center;'
# .card-content { text-align: center; } -> should use flex
$content = $content -replace '(\.card-content\s*\{[^}]*?)text-align:\s*center;', '$1display: flex; flex-direction: column; align-items: center;'
if ($content -ne $originalContent) {
Set-Content -Path $filePath -Value $content -NoNewline -Encoding UTF8
Write-Host "Fixed: $filePath" -ForegroundColor Green
}
}
}
Write-Host "CSS restrictions fix completed!" -ForegroundColor Green