path = r'c:\NeoZQYY\apps\miniprogram\miniprogram\pages\board-finance\board-finance.wxss' with open(path, 'r', encoding='utf-8') as f: content = f.read() # Fix the broken block bad = '''.flow-detail-right { display: flex; align-items: center; gap: 0; .flow-detail-val { .flow-detail-val { font-size: 26rpx; line-height: 36rpx; font-weight: 500; color: #4b4b4b; min-width: 120rpx; text-align: right; .flow-detail-val--red {''' good = '''.flow-detail-right { display: flex; align-items: center; gap: 0; } .flow-detail-val { font-size: 26rpx; line-height: 36rpx; font-weight: 500; color: #4b4b4b; min-width: 120rpx; text-align: right; } .flow-detail-val--red {''' if bad in content: content = content.replace(bad, good, 1) print('fixed detail-right') else: print('detail-right pattern not found') bad2 = '''.flow-total-right { .flow-total-right { display: flex; align-items: center; gap: 0; .flow-total-value { .flow-total-value { font-size: 33rpx; line-height: 51rpx; font-weight: 600; color: #242424; min-width: 140rpx; text-align: right; /* ===== 现金流入 - 流水项 ===== */''' good2 = '''.flow-total-right { display: flex; align-items: center; gap: 0; } .flow-total-value { font-size: 33rpx; line-height: 51rpx; font-weight: 600; color: #242424; min-width: 140rpx; text-align: right; } /* ===== 现金流入 - 流水项 ===== */''' if bad2 in content: content = content.replace(bad2, good2, 1) print('fixed total-right') else: print('total-right pattern not found') with open(path, 'w', encoding='utf-8') as f: f.write(content) print('done')