一体机放大效果开发

This commit is contained in:
冯辉
2026-03-12 17:10:34 +08:00
parent 0c63175816
commit e7ef23ad5d
83 changed files with 3034 additions and 2899 deletions

53
scale-styles.ps1 Normal file
View File

@@ -0,0 +1,53 @@
# 定义要处理的目录
$pagesDir = "./pages"
$packageADir = "./packageA"
# 定义要排除的文件(首页相关)
$excludePatterns = @("*index*", "*Index*", "*INDEX*")
# 函数:放大样式值
function Scale-Styles($filePath) {
Write-Host "Processing $filePath"
# 读取文件内容
$content = Get-Content -Path $filePath -Raw
# 正则表达式匹配所有数值px 或 rpx 单位)
$pattern = '([:\s])(\d+)(px|rpx)'
# 替换函数
$replacement = {
param($match)
$value = [int]$match.Groups[2].Value
$scaledValue = [math]::Round($value * 1.5)
return "$($match.Groups[1].Value)$scaledValue$($match.Groups[3].Value)"
}
# 执行替换
$newContent = [regex]::Replace($content, $pattern, $replacement)
# 写回文件
Set-Content -Path $filePath -Value $newContent -Force
}
# 处理 pages 目录
Get-ChildItem -Path $pagesDir -Recurse -Filter "*.vue" | Where-Object {
$file = $_
$exclude = $false
foreach ($pattern in $excludePatterns) {
if ($file.FullName -like "*$pattern*") {
$exclude = $true
break
}
}
!$exclude
} | ForEach-Object {
Scale-Styles $_.FullName
}
# 处理 packageA 目录
Get-ChildItem -Path $packageADir -Recurse -Filter "*.vue" | ForEach-Object {
Scale-Styles $_.FullName
}
Write-Host "Processing completed!"