fix-contract.ps1 991 B

123456789101112
  1. $path = 'd:\Users\chenjun\kyj-yanglao-web-new\src\views\elderly\apply\check-in\ContractForm.vue'
  2. $content = Get-Content $path -Raw -Encoding UTF8
  3. $badPattern1 = '<template v-if="isTextMode"><span class="fill"><template v-if="isTextMode">(\{\{\s*contractForm\.\w+\s*\|\|\s*''[^'']*''\s*\}\})</template><input v-else v-model="(contractForm\.\w+)" class="text-input" placeholder="请输入" style="max-width: 180px;" /></span></template><input v-else v-model="contractForm\.\w+" class="text-input" placeholder="请输入" style="max-width: 180px;" />'
  4. $goodReplace1 = '<template v-if="isTextMode"><span class="fill">$1</span></template><input v-else v-model="$2" class="text-input" placeholder="请输入" style="max-width: 180px;" />'
  5. $matches1 = [regex]::Matches($content, $badPattern1)
  6. Write-Host "Fixing nested pattern 1: $($matches1.Count) places"
  7. $content = [regex]::Replace($content, $badPattern1, $goodReplace1)
  8. Set-Content $path $content -Encoding UTF8 -NoNewline
  9. Write-Host "Done"