Files
Neo-ZQYY/scripts/ops/update_coach_detail.py

292 lines
17 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""coach-detail.html 多项改动"""
from _env_paths import ensure_repo_root
ensure_repo_root()
filepath = "docs/h5_ui/pages/coach-detail.html"
with open(filepath, "r", encoding="utf-8") as f:
c = f.read()
# 1. "当前档位:星级" → "绩效档位进度",去掉"星级""皇冠"字样
c = c.replace(
'<span class="text-xs text-gray-9 font-medium">当前档位:星级</span>',
'<span class="text-xs text-gray-9 font-medium">绩效档位进度</span>'
)
c = c.replace(
'<span>星级 80h</span>',
'<span>当前 80h</span>'
)
c = c.replace(
'<span>皇冠 100h</span>',
'<span>目标 100h</span>'
)
# 2. 工龄客户信息放大
c = c.replace(
''' <div class="flex-shrink-0 text-right space-y-1">
<div class="text-white/60 text-[10px]">工龄 <span class="text-white font-medium text-xs">3年</span></div>
<div class="text-white/60 text-[10px]">客户 <span class="text-white font-medium text-xs">68人</span></div>
</div>''',
''' <div class="flex-shrink-0 text-right space-y-1.5">
<div class="text-white/70 text-xs">工龄 <span class="text-white font-bold text-base">3年</span></div>
<div class="text-white/70 text-xs">客户 <span class="text-white font-bold text-base">68人</span></div>
</div>'''
)
# 3. 全页文字放大2-3号把关键的 text-sm → text-base, text-xs → text-sm, text-[10px] → text-xs
# 只在 body 内容区域做(不动 banner 和 style
# 用更精确的替换
# 绩效概览 4-grid 数值放大
c = c.replace('text-xl font-bold text-primary pv">87.5', 'text-2xl font-bold text-primary pv">87.5')
c = c.replace('text-xl font-bold text-success pv">¥6,950', 'text-2xl font-bold text-success pv">¥6,950')
c = c.replace('text-xl font-bold text-warning pv">¥86,200', 'text-2xl font-bold text-warning pv">¥86,200')
c = c.replace('text-xl font-bold text-purple-600 pv">38', 'text-2xl font-bold text-purple-600 pv">38')
# section 标题放大
c = c.replace('text-sm font-semibold text-gray-13 mb-4">绩效概览', 'text-base font-semibold text-gray-13 mb-4">绩效概览')
c = c.replace('text-sm font-semibold text-gray-13 mb-4">收入明细', 'text-base font-semibold text-gray-13 mb-4">收入明细')
c = c.replace('text-sm font-semibold text-gray-13 mb-4">任务执行', 'text-base font-semibold text-gray-13 mb-4">任务执行')
c = c.replace('text-sm font-semibold text-gray-13 mb-4">客户关系 TOP5', 'text-base font-semibold text-gray-13 mb-4">客户关系 TOP5')
c = c.replace('text-sm font-semibold text-gray-13 mb-4">近期服务明细', 'text-base font-semibold text-gray-13 mb-4">近期服务明细')
c = c.replace('text-sm font-semibold text-gray-13 mb-4">更多信息', 'text-base font-semibold text-gray-13 mb-4">更多信息')
# 收入明细项目名放大
c = c.replace('text-sm text-gray-9">基础课时费', 'text-base text-gray-9">基础课时费')
c = c.replace('text-sm text-gray-9">激励课时费', 'text-base text-gray-9">激励课时费')
c = c.replace('text-sm text-gray-9">充值提成', 'text-base text-gray-9">充值提成')
c = c.replace('text-sm text-gray-9">酒水提成', 'text-base text-gray-9">酒水提成')
c = c.replace('text-sm font-semibold text-gray-9">合计', 'text-base font-semibold text-gray-9">合计')
# 收入金额放大
c = c.replace('text-sm font-bold text-gray-13 pv">¥3,500', 'text-base font-bold text-gray-13 pv">¥3,500')
c = c.replace('text-sm font-bold text-gray-13 pv">¥1,800', 'text-base font-bold text-gray-13 pv">¥1,800')
c = c.replace('text-sm font-bold text-gray-13 pv">¥1,200', 'text-base font-bold text-gray-13 pv">¥1,200')
c = c.replace('text-sm font-bold text-gray-13 pv">¥450', 'text-base font-bold text-gray-13 pv">¥450')
# 更多信息行放大
c = c.replace('text-sm text-gray-7">入职日期', 'text-base text-gray-7">入职日期')
c = c.replace('text-sm text-gray-13">2023-03-15', 'text-base text-gray-13">2023-03-15')
c = c.replace('text-sm text-gray-7">上月工资', 'text-base text-gray-7">上月工资')
c = c.replace('text-sm font-medium text-gray-13 pv">¥7,200', 'text-base font-medium text-gray-13 pv">¥7,200')
c = c.replace('text-sm text-gray-7">上月业绩时长', 'text-base text-gray-7">上月业绩时长')
c = c.replace('text-sm text-gray-13 pv">92.0h', 'text-base text-gray-13 pv">92.0h')
c = c.replace('text-sm text-gray-7">累计服务客户', 'text-base text-gray-7">累计服务客户')
c = c.replace('text-sm text-gray-13 pv">68人', 'text-base text-gray-13 pv">68人')
c = c.replace('text-sm text-gray-7">累计服务时长', 'text-base text-gray-7">累计服务时长')
c = c.replace('text-sm text-gray-13 pv">2,860h', 'text-base text-gray-13 pv">2,860h')
# 4. 任务执行:替换进度条为任务简报
old_task = ''' <!-- 任务执行 -->
<div class="bg-white rounded-2xl p-5 shadow-sm">
<h2 class="st orange text-base font-semibold text-gray-13 mb-4">任务执行</h2>
<div class="flex items-center justify-between mb-3 text-xs text-gray-6">
<span>本月完成 38 个任务</span>
<span>待处理 12 个</span>
</div>
<div class="space-y-3">
<!-- 回访任务 -->
<div>
<div class="flex items-center justify-between mb-1">
<span class="text-xs text-gray-9">回访任务</span>
<span class="text-xs text-gray-7 pv">15/18</span>
</div>
<div class="progress-sm">
<div class="fill bg-gradient-to-r from-primary to-blue-400" style="width:83%"></div>
</div>
</div>
<!-- 充值任务 -->
<div>
<div class="flex items-center justify-between mb-1">
<span class="text-xs text-gray-9">充值任务</span>
<span class="text-xs text-gray-7 pv">8/10</span>
</div>
<div class="progress-sm">
<div class="fill bg-gradient-to-r from-success to-emerald-400" style="width:80%"></div>
</div>
</div>
<!-- 激活任务 -->
<div>
<div class="flex items-center justify-between mb-1">
<span class="text-xs text-gray-9">激活任务</span>
<span class="text-xs text-gray-7 pv">10/15</span>
</div>
<div class="progress-sm">
<div class="fill bg-gradient-to-r from-warning to-amber-400" style="width:67%"></div>
</div>
</div>
<!-- 关怀任务 -->
<div>
<div class="flex items-center justify-between mb-1">
<span class="text-xs text-gray-9">关怀任务</span>
<span class="text-xs text-gray-7 pv">5/7</span>
</div>
<div class="progress-sm">
<div class="fill bg-gradient-to-r from-pink-400 to-rose-400" style="width:71%"></div>
</div>
</div>
</div>
</div>'''
# 检查是否已经被放大过text-base
if old_task not in c:
# 可能还是 text-sm 版本
old_task = old_task.replace('text-base font-semibold', 'text-sm font-semibold')
new_task = ''' <!-- 任务执行 -->
<div class="bg-white rounded-2xl p-5 shadow-sm">
<h2 class="st orange text-base font-semibold text-gray-13 mb-4">任务执行</h2>
<!-- 当前任务概况 -->
<div class="grid grid-cols-3 gap-2 mb-4">
<div class="bg-red-50 rounded-xl p-3 text-center border border-red-100/50">
<p class="text-2xl font-bold text-error pv">3</p>
<p class="text-xs text-gray-7 mt-0.5">置顶任务</p>
</div>
<div class="bg-blue-50 rounded-xl p-3 text-center border border-blue-100/50">
<p class="text-2xl font-bold text-primary pv">9</p>
<p class="text-xs text-gray-7 mt-0.5">普通待办</p>
</div>
<div class="bg-gray-50 rounded-xl p-3 text-center border border-gray-200">
<p class="text-2xl font-bold text-gray-5 pv">2</p>
<p class="text-xs text-gray-7 mt-0.5">已放弃</p>
</div>
</div>
<!-- 已完成任务简报 -->
<p class="text-sm font-medium text-gray-9 mb-2">已完成 <span class="text-primary font-bold">38</span> 个</p>
<div class="space-y-2">
<div class="flex items-center gap-3 p-2.5 bg-gray-50 rounded-lg border border-gray-100">
<span class="text-xs">✅</span>
<div class="flex-1 min-w-0">
<span class="text-sm text-gray-13">回访王先生</span>
<span class="text-xs text-gray-6 ml-2">2月7日</span>
</div>
<span class="text-xs text-success font-medium">已完成</span>
</div>
<div class="flex items-center gap-3 p-2.5 bg-gray-50 rounded-lg border border-gray-100">
<span class="text-xs">✅</span>
<div class="flex-1 min-w-0">
<span class="text-sm text-gray-13">充值跟进李女士</span>
<span class="text-xs text-gray-6 ml-2">2月6日</span>
</div>
<span class="text-xs text-success font-medium">已完成</span>
</div>
<div class="flex items-center gap-3 p-2.5 bg-gray-50 rounded-lg border border-gray-100">
<span class="text-xs">✅</span>
<div class="flex-1 min-w-0">
<span class="text-sm text-gray-13">激活陈女士</span>
<span class="text-xs text-gray-6 ml-2">2月5日</span>
</div>
<span class="text-xs text-success font-medium">已完成</span>
</div>
<div class="flex items-center gap-3 p-2.5 bg-gray-50 rounded-lg border border-gray-100">
<span class="text-xs">✅</span>
<div class="flex-1 min-w-0">
<span class="text-sm text-gray-13">关怀张先生</span>
<span class="text-xs text-gray-6 ml-2">2月4日</span>
</div>
<span class="text-xs text-success font-medium">已完成</span>
</div>
</div>
<div class="mt-3 text-center">
<button class="text-sm text-primary font-medium">查看全部任务 →</button>
</div>
</div>'''
if old_task in c:
c = c.replace(old_task, new_task)
print(" ✅ 任务执行替换成功")
else:
print(" ❌ 任务执行未找到匹配,尝试原始版本")
# 5. 更多信息:去掉擅长项目,服务客户/业绩时长/工资做成表格
old_more = ''' <!-- 更多信息 -->
<div class="bg-white rounded-2xl p-5 shadow-sm">
<h2 class="st teal text-base font-semibold text-gray-13 mb-4">更多信息</h2>
<div class="space-y-3">
<div class="flex items-center justify-between py-2 border-b border-gray-100">
<span class="text-base text-gray-7">入职日期</span>
<span class="text-base text-gray-13">2023-03-15</span>
</div>
<div class="flex items-center justify-between py-2 border-b border-gray-100">
<span class="text-sm text-gray-7">擅长项目</span>
<span class="text-sm text-gray-13">中🎱、斯诺克、花式</span>
</div>
<div class="flex items-center justify-between py-2 border-b border-gray-100">
<span class="text-base text-gray-7">上月工资</span>
<span class="text-base font-medium text-gray-13 pv">¥7,200</span>
</div>
<div class="flex items-center justify-between py-2 border-b border-gray-100">
<span class="text-base text-gray-7">上月业绩时长</span>
<span class="text-base text-gray-13 pv">92.0h</span>
</div>
<div class="flex items-center justify-between py-2 border-b border-gray-100">
<span class="text-base text-gray-7">累计服务客户</span>
<span class="text-base text-gray-13 pv">68人</span>
</div>
<div class="flex items-center justify-between py-2">
<span class="text-base text-gray-7">累计服务时长</span>
<span class="text-base text-gray-13 pv">2,860h</span>
</div>
</div>
</div>'''
new_more = ''' <!-- 更多信息 -->
<div class="bg-white rounded-2xl p-5 shadow-sm">
<h2 class="st teal text-base font-semibold text-gray-13 mb-4">更多信息</h2>
<div class="flex items-center justify-between py-2 border-b border-gray-100 mb-4">
<span class="text-base text-gray-7">入职日期</span>
<span class="text-base text-gray-13">2023-03-15</span>
</div>
<!-- 月度数据表格 -->
<div class="overflow-x-auto -mx-1">
<table class="w-full text-sm">
<thead>
<tr class="border-b border-gray-200">
<th class="text-left py-2 px-2 text-gray-7 font-medium text-xs">月份</th>
<th class="text-right py-2 px-2 text-gray-7 font-medium text-xs">服务客户</th>
<th class="text-right py-2 px-2 text-gray-7 font-medium text-xs">业绩时长</th>
<th class="text-right py-2 px-2 text-gray-7 font-medium text-xs">工资</th>
</tr>
</thead>
<tbody>
<tr class="border-b border-gray-50 bg-blue-50/30">
<td class="py-2.5 px-2 text-gray-13 font-medium">本月<span class="text-[10px] text-warning ml-1">预估</span></td>
<td class="py-2.5 px-2 text-right text-gray-13 pv font-medium">22人</td>
<td class="py-2.5 px-2 text-right text-primary pv font-bold">87.5h</td>
<td class="py-2.5 px-2 text-right text-success pv font-bold">¥6,950</td>
</tr>
<tr class="border-b border-gray-50">
<td class="py-2.5 px-2 text-gray-13">上月</td>
<td class="py-2.5 px-2 text-right text-gray-13 pv">25人</td>
<td class="py-2.5 px-2 text-right text-gray-13 pv">92.0h</td>
<td class="py-2.5 px-2 text-right text-gray-13 pv">¥7,200</td>
</tr>
<tr class="border-b border-gray-50">
<td class="py-2.5 px-2 text-gray-13">4月</td>
<td class="py-2.5 px-2 text-right text-gray-13 pv">20人</td>
<td class="py-2.5 px-2 text-right text-gray-13 pv">85.0h</td>
<td class="py-2.5 px-2 text-right text-gray-13 pv">¥6,600</td>
</tr>
<tr class="border-b border-gray-50">
<td class="py-2.5 px-2 text-gray-13">3月</td>
<td class="py-2.5 px-2 text-right text-gray-13 pv">18人</td>
<td class="py-2.5 px-2 text-right text-gray-13 pv">78.5h</td>
<td class="py-2.5 px-2 text-right text-gray-13 pv">¥6,100</td>
</tr>
<tr>
<td class="py-2.5 px-2 text-gray-13">2月</td>
<td class="py-2.5 px-2 text-right text-gray-13 pv">15人</td>
<td class="py-2.5 px-2 text-right text-gray-13 pv">65.0h</td>
<td class="py-2.5 px-2 text-right text-gray-13 pv">¥5,200</td>
</tr>
</tbody>
</table>
</div>
</div>'''
if old_more in c:
c = c.replace(old_more, new_more)
print(" ✅ 更多信息替换成功")
else:
print(" ❌ 更多信息未找到匹配")
with open(filepath, "w", encoding="utf-8") as f:
f.write(c)
print("coach-detail.html 更新完成")