| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #!/usr/bin/env node
- /**
- * D22: FamilyTianpanCard.vue 家庭天盘卡片清理 (debt 60)
- * 修复 C 批字符串 bug + 五行/方位色收编 BrandColors + canvas 色收编
- */
- const fs = require('fs');
- const F = 'pages/mind-detail/components/FamilyTianpanCard.vue';
- let src = fs.readFileSync(F, 'utf8');
- let replaced = 0;
- function repl(from, to) {
- const cnt = src.split(from).length - 1;
- if (cnt === 0) { console.warn('NOT FOUND: ' + from.slice(0, 100)); return; }
- src = src.split(from).join(to);
- replaced += cnt;
- }
- // ---- 1. 修复 C 批字符串 bug('BrandColors.x' -> BrandColors.x)----
- repl("'BrandColors.success'", "BrandColors.success");
- repl("'BrandColors.body'", "BrandColors.body");
- repl("'BrandColors.wisdom'", "BrandColors.wisdom");
- // ---- 2. themeColor 默认值 ----
- repl("themeColor: '#FF6B9D', // 默认火维度颜色", "themeColor: BrandColors.mind, // 默认火维度颜色");
- repl("self.themeColor = '#FF6B9D'", "self.themeColor = BrandColors.mind");
- // ---- 3. 方位色映射 ----
- repl(" '南': '#FF6B9D',", " '南': BrandColors.mind,");
- repl(" '北': '#3B82F6'", " '北': BrandColors.infoBlue");
- // ---- 4. 五行色映射(3 处对象,统一 fire/water)----
- repl("fire: '#FF6B9D'", "fire: BrandColors.mind");
- repl("火: '#FF6B9D'", "火: BrandColors.mind");
- repl("水: '#3B82F6'", "水: BrandColors.infoBlue");
- repl("water: '#3B82F6'", "water: BrandColors.infoBlue");
- // ---- 5. 兜底色 ----
- repl("colorMap[key] || '#94A3B8'", "colorMap[key] || BrandColors.appTextSubtle");
- repl("ctx.fillStyle = isLucky ? luckyColor : '#9CA3AF'", "ctx.fillStyle = isLucky ? luckyColor : BrandColors.textGray400");
- repl("ctx.fillStyle = '#FFF5F7'", "ctx.fillStyle = BrandColors.blush");
- // ---- 6. 其余残留 ----
- repl("return this.dirColorMap[dir] || '#FF6B9D'", "return this.dirColorMap[dir] || BrandColors.mind");
- repl("var color = this.themeColor || '#FF6B9D'", "var color = this.themeColor || BrandColors.mind");
- repl("confirmColor: self.themeColor || '#FF6B9D'", "confirmColor: self.themeColor || BrandColors.mind");
- fs.writeFileSync(F, src);
- console.log('total replaced:', replaced);
- const lines = src.split('\n');
- let n = 0;
- for (let i = 0; i < lines.length; i++) {
- const L = lines[i].trim();
- if (/#[0-9a-fA-F]{3,8}\b/.test(L) && L.charAt(0) !== '$') { console.log('HEX ' + (i + 1) + ': ' + L.slice(0, 110)); n++; }
- }
- console.log('remaining non-palette hex:', n);
|