From d8428fe82cd09c30716dcf2dafc6a82b77d1a300 Mon Sep 17 00:00:00 2001 From: weipengfei <2187978347@qq.com> Date: Fri, 21 Jun 2024 17:56:47 +0800 Subject: [PATCH] 1 --- src/views/store/store_product/index.vue | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/views/store/store_product/index.vue b/src/views/store/store_product/index.vue index 0ea0fcf..f296835 100644 --- a/src/views/store/store_product/index.vue +++ b/src/views/store/store_product/index.vue @@ -47,6 +47,11 @@ + + + {{ cMark(row.manufacturer_information) }} + + { editRef.value?.getTableLists({ product_id: data.product_id, store_id }) } +const cMark = (str: any) => { + if (str) { + return str.replace(/(\d{5,})/g, (match: string) => { + let replacement; + // 判断数字长度,执行不同替换逻辑 + if (match.length >= 11) { + // 对于11位以上的连续数字,替换倒数第四到倒数第八位为星号 + replacement = match.slice(0, -8) + "****" + match.slice(-4); + } else { + // 对于5到11位的数字,替换最后四位为星号 + replacement = match.slice(0, -4) + "****"; + } + return replacement; + }); + } + return '-'; +} const typeLists = reactive([]) @@ -135,5 +157,4 @@ const getTypeLists = async () => { // getTypeLists() getLists() - - \ No newline at end of file + \ No newline at end of file