在准备环境前提交次全部更改。
This commit is contained in:
75
scripts/ops/batch_h5_updates.py
Normal file
75
scripts/ops/batch_h5_updates.py
Normal file
@@ -0,0 +1,75 @@
|
||||
"""批量更新 H5 原型页面"""
|
||||
import re
|
||||
|
||||
def read(path):
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
return f.read()
|
||||
|
||||
def write(path, content):
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
f.write(content)
|
||||
print(f" ✅ {path}")
|
||||
|
||||
# ============================================================
|
||||
# 1. notes.html — 合并"任务备注"和"客户备注"为"客户备注"
|
||||
# ============================================================
|
||||
print("1. notes.html — 合并备注类型")
|
||||
c = read("docs/h5_ui/pages/notes.html")
|
||||
# 把标题改为"客户备注"
|
||||
c = c.replace(">备注记录</h1>", ">客户备注</h1>")
|
||||
c = c.replace("<title>备注记录 - 球房运营助手</title>", "<title>客户备注 - 球房运营助手</title>")
|
||||
# 把所有"任务:xxx"标签改为"客户:xxx"样式
|
||||
c = c.replace('bg-gradient-to-r from-orange-50 to-amber-50 text-warning', 'bg-gradient-to-r from-blue-50 to-indigo-50 text-primary')
|
||||
c = c.replace('border border-orange-100">任务:高优先召回', 'border border-blue-100">客户:王先生')
|
||||
c = c.replace('border border-orange-100">任务:关系构建', 'border border-blue-100">客户:张先生')
|
||||
# 把"助教:xxx"标签也改为客户标签
|
||||
c = c.replace('bg-gradient-to-r from-green-50 to-emerald-50 text-success', 'bg-gradient-to-r from-blue-50 to-indigo-50 text-primary')
|
||||
c = c.replace('border border-green-100">助教:泡芙', 'border border-blue-100">客户:陈女士')
|
||||
c = c.replace('border border-green-100">助教:Amy', 'border border-blue-100">客户:李女士')
|
||||
write("docs/h5_ui/pages/notes.html", c)
|
||||
|
||||
# ============================================================
|
||||
# 2. performance-records.html — 统计概览改为:总记录|总业绩时长|收入
|
||||
# ============================================================
|
||||
print("2. performance-records.html — 统计概览")
|
||||
c = read("docs/h5_ui/pages/performance-records.html")
|
||||
# 替换"折算扣减"为"收入"
|
||||
old_stats = ''' <div class="text-center flex-1">
|
||||
<p class="text-[10px] text-gray-6 mb-0.5">折算扣减</p>
|
||||
<p class="text-lg font-bold text-error perf-value" id="totalPenalty">-1.5h</p>
|
||||
</div>'''
|
||||
new_stats = ''' <div class="text-center flex-1">
|
||||
<p class="text-[10px] text-gray-6 mb-0.5">收入</p>
|
||||
<p class="text-lg font-bold text-success perf-value" id="totalIncome">¥4,720</p>
|
||||
<p class="text-[10px] text-warning">预估</p>
|
||||
</div>'''
|
||||
c = c.replace(old_stats, new_stats)
|
||||
# 在"总业绩时长"数据旁标注折算前时长
|
||||
old_hours = ''' <div class="text-center flex-1">
|
||||
<p class="text-[10px] text-gray-6 mb-0.5">总业绩时长</p>
|
||||
<p class="text-lg font-bold text-primary perf-value" id="totalMinutes">59.0h</p>
|
||||
</div>'''
|
||||
new_hours = ''' <div class="text-center flex-1">
|
||||
<p class="text-[10px] text-gray-6 mb-0.5">总业绩时长</p>
|
||||
<p class="text-lg font-bold text-primary perf-value" id="totalMinutes">59.0h</p>
|
||||
<p class="text-[10px] text-gray-5">折算前 60.5h</p>
|
||||
<p class="text-[10px] text-warning">预估</p>
|
||||
</div>'''
|
||||
c = c.replace(old_hours, new_hours)
|
||||
write("docs/h5_ui/pages/performance-records.html", c)
|
||||
|
||||
# ============================================================
|
||||
# 3. performance.html — 所有灰色字黑30%
|
||||
# ============================================================
|
||||
print("3. performance.html — 灰色字加深")
|
||||
c = read("docs/h5_ui/pages/performance.html")
|
||||
# text-gray-5 → text-gray-7, text-gray-6 → text-gray-8, text-gray-7 → text-gray-9
|
||||
# 只替换非 CSS 定义部分(即 HTML body 中的 class 引用)
|
||||
# 用正则精确替换 class 属性中的灰色值
|
||||
c = c.replace('text-gray-5 ', 'text-gray-7 ')
|
||||
c = c.replace('text-gray-5"', 'text-gray-7"')
|
||||
c = c.replace('text-gray-6 ', 'text-gray-8 ')
|
||||
c = c.replace('text-gray-6"', 'text-gray-8"')
|
||||
write("docs/h5_ui/pages/performance.html", c)
|
||||
|
||||
print("\n批量更新完成!")
|
||||
Reference in New Issue
Block a user