#!/usr/bin/env python # -*- coding: utf-8 -*- """C-2a-4a 续跑:gates 补修(#3A7CC2 漏网)+ 剩余 10 文件 前 8 文件(teacher 7 + gates 主体)已在首跑完成,本脚本不重复。 gate-lock 新增:锁面板 on-dark accent 文字随品牌族迁移(#8FC5E8 → $brand-primary-light, rgba(143,197,232,0.7) → rgba(251,146,60,0.7));reward-energy material 蓝徽章非旧蓝族保留。 """ import io import re import sys ORANGE = '$brand-primary' ORANGE_DARK = '$brand-primary-dark' ORANGE_LIGHT = '$brand-primary-light' INFO = '$uni-info' PALE = '$uni-primary-pale' GRAD_DARK = 'linear-gradient(135deg, #5B9BD5, #3A7CC4)' GRAD_DARK2 = 'linear-gradient(135deg, #5B9BD5, #3A7CC2)' GRAD_LIGHT = 'linear-gradient(135deg, #5B9BD5, #8FC5E8)' # ---- 前置补修:gates.vue reward-energy 徽章(首跑漏网 #3A7CC2 + rgba(66,165,245,0.15))---- PRE_FIX = [ ('pages/profile-extra/gates.vue', [ ('color: #3A7CC2; background: rgba(66,165,245,0.15);', 'color: %s; background: rgba(14,165,233,0.15);' % INFO, 1), ]), ] PAGES = { 'pages/profile/report-detail.vue': { 'blocks': [], 'global': [('#5B9BD5', ORANGE)], 'script': [], }, 'pages/profile/components/ProfileMenu.vue': { 'blocks': [], 'global': [('#5B9BD5', INFO)], 'script': [('color="#5B9BD5"', 'color="#F97316"', 1)], }, 'pages/profile-extra/coupons.vue': { 'blocks': [], 'global': [ ('color: #5B9BD5', 'color: ' + INFO), ('background: #5B9BD5', 'background: ' + ORANGE), ], 'script': [], }, 'pages/profile/report-management.vue': { 'blocks': [], 'global': [('#5B9BD5', ORANGE)], 'script': [], }, 'pages/profile/index.vue': { 'blocks': [], 'global': [(GRAD_DARK, 'linear-gradient(135deg, %s, %s)' % (ORANGE, ORANGE_DARK))], 'script': [], }, 'pages/home-pages/member-home-detail.vue': { 'blocks': [], 'global': [ (GRAD_DARK, 'linear-gradient(135deg, %s, %s)' % (ORANGE, ORANGE_DARK)), ('#5B9BD5', ORANGE), ], 'script': [], }, 'pages/article-center/article-edit.vue': { 'blocks': [], 'global': [ ('#E8F4FD', PALE), ('#5B9BD5', ORANGE), ], 'script': [], }, 'components/gate-lock.vue': { 'blocks': [], 'global': [ (GRAD_DARK2, 'linear-gradient(135deg, %s, %s)' % (ORANGE, ORANGE_DARK)), ('color: #8FC5E8;', 'color: %s;' % ORANGE_LIGHT), ('color: rgba(143,197,232,0.7);', 'color: rgba(251,146,60,0.7);'), ], 'script': [], }, 'components/FamilyRelationGraph.vue': { 'blocks': [], 'global': [], 'script': [("home: '#5B9BD5',", "home: '#F97316',", 1)], }, 'components/DimensionArticles.vue': { 'blocks': [], 'global': [], 'script': [(GRAD_LIGHT, "'linear-gradient(135deg, %s, %s)'" % (ORANGE, ORANGE_LIGHT), 1)], }, } RESIDUAL_RE = re.compile(r'(?]*>[\s\S]*?', re.M) def apply_global(block, pairs, page): for old, new in pairs: n = block.count(old) if n == 0: raise RuntimeError('%s: 全局替换 hit=0 :: %s' % (page, old)) block = block.replace(old, new) print(' %-52s -> %-30s x%d' % (old, new, n)) return block def fix_lang(block, page): first, rest = block.split('\n', 1) if 'lang="scss"' not in first: if '