Просмотр исходного кода

fix: sanitize bill ledger text

main
leiyun 1 месяц назад
Родитель
Сommit
aac46ef00c
1 измененных файлов: 17 добавлений и 2 удалений
  1. +17
    -2
      app/pages/bill.vue

+ 17
- 2
app/pages/bill.vue Просмотреть файл

@@ -236,7 +236,7 @@
<div class="min-w-0 flex-1"> <div class="min-w-0 flex-1">
<div class="flex min-w-0 flex-wrap items-center gap-2"> <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]"> <h3 class="min-w-0 truncate text-sm font-extrabold text-[var(--c-172033)] sm:text-[15px]">
{{ item.title || '点数变动' }}
{{ displayTitle(item) }}
</h3> </h3>
<span <span
class="shrink-0 rounded-full px-2 py-0.5 text-[10px] font-extrabold" class="shrink-0 rounded-full px-2 py-0.5 text-[10px] font-extrabold"
@@ -246,7 +246,7 @@
</span> </span>
</div> </div>
<p v-if="item.desc" class="mt-1.5 line-clamp-2 text-xs leading-5 text-[var(--c-66758a)] sm:truncate"> <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> </p>
<div class="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-[var(--c-9aa5b5)]"> <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"> <span class="inline-flex items-center gap-1">
@@ -510,6 +510,21 @@ function formatAmount(value) {
return num > 0 ? `+${formatNumber(num)}` : formatNumber(num) 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(消费存的是计费流水号,不展示)。 * 后端 point_log.biz_no 在充值时存的就是 point_order.order_no(消费存的是计费流水号,不展示)。


Загрузка…
Отмена
Сохранить