Browse Source

fix: sanitize bill ledger text

main
leiyun 1 month ago
parent
commit
aac46ef00c
1 changed files with 17 additions and 2 deletions
  1. +17
    -2
      app/pages/bill.vue

+ 17
- 2
app/pages/bill.vue View File

@@ -236,7 +236,7 @@
<div class="min-w-0 flex-1">
<div class="flex min-w-0 flex-wrap items-center gap-2">
<h3 class="min-w-0 truncate text-sm font-extrabold text-[var(--c-172033)] sm:text-[15px]">
{{ item.title || '点数变动' }}
{{ displayTitle(item) }}
</h3>
<span
class="shrink-0 rounded-full px-2 py-0.5 text-[10px] font-extrabold"
@@ -246,7 +246,7 @@
</span>
</div>
<p v-if="item.desc" class="mt-1.5 line-clamp-2 text-xs leading-5 text-[var(--c-66758a)] sm:truncate">
{{ item.desc }}
{{ displayDesc(item) }}
</p>
<div class="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-[var(--c-9aa5b5)]">
<span class="inline-flex items-center gap-1">
@@ -510,6 +510,21 @@ function formatAmount(value) {
return num > 0 ? `+${formatNumber(num)}` : formatNumber(num)
}

function displayTitle(item = {}) {
const text = String(item.title || '').trim().replace(/\s*第\s*1\s*张\s*$/g, '').trim()
return text || item.title || '点数变动'
}

function displayDesc(item = {}) {
const raw = String(item.desc || '').trim()
const text = raw
.replace(/(?:,|,|、|\s)*(混元生图\s*3\.0|腾讯混元大模型|腾讯混元|混元大模型|混元模型|高精模型|高清模型)\s*/gi, '')
.replace(/(?:,|,|、)\s*(生成模型|模型)\s*[::]?\s*[^,,、]+/g, '')
.replace(/[,,、\s]+$/g, '')
.trim()
return text || raw
}

/**
* 充值流水的订单号。
* 后端 point_log.biz_no 在充值时存的就是 point_order.order_no(消费存的是计费流水号,不展示)。


Loading…
Cancel
Save