From 40f4661cac54cdf0489ffb97fc213ac69df770e4 Mon Sep 17 00:00:00 2001 From: duanxiaohai <1812246227@qq.com> Date: Wed, 13 Nov 2024 17:27:47 +0800 Subject: [PATCH] gx --- src/utils/request.js | 2 +- src/view/js_details.vue | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/utils/request.js b/src/utils/request.js index ab56c12..02a9252 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -2,7 +2,7 @@ import axios from "axios"; import { ElMessage } from "element-plus"; import tools from "@/utils/tools"; import router from "../router"; -// axios.defaults.baseURL = 'https://jzzf.longyou.gov.cn:998/' +axios.defaults.baseURL = 'https://jzzf.longyou.gov.cn:998/' axios.defaults.timeout = 120000; // HTTP request 拦截器 diff --git a/src/view/js_details.vue b/src/view/js_details.vue index cd89e0a..0147c3d 100644 --- a/src/view/js_details.vue +++ b/src/view/js_details.vue @@ -253,6 +253,25 @@ const getData = () => { if (res.code == 200) { data.tableData = res.data; pagination.total = res.count; + function maskName(name) { + if (name.length === 2) { + // 两个字的姓名,第二个字替换为 * + return name[0] + "*"; + } else if (name.length > 2) { + // 三个字或更多的姓名,替换中间的字符 + return ( + name[0] + "*".repeat(name.length - 2) + name[name.length - 1] + ); + } + return name; // 返回原名 + } + data.tableData = data.tableData.map((item) => { + return { + ...item, + xm: maskName(item.xm), + }; + }); + } else { ElMessage.warning({ message: res.message }); }