feat(web): hide phone number info (#1111)

This commit is contained in:
allence 2023-05-06 11:21:21 +08:00 committed by GitHub
parent 425b782374
commit e4d8141de2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -4,7 +4,7 @@ import clsx from "clsx";
import { t } from "i18next";
import { COLOR_MODE } from "@/constants";
import { formatDate } from "@/utils/format";
import { formatDate, hidePhoneNumber } from "@/utils/format";
import AuthDetail from "./AuthDetail";
@ -57,7 +57,7 @@ export default function UserInfo() {
<Box className="mb-20 mt-8 text-lg">
<HStack spacing={8}>
<span className="w-[80px] text-grayModern-500">{t("SettingPanel.Tel")}:</span>
<span>{userInfo?.phone ? userInfo.phone : t("NoInfo")}</span>
<span>{userInfo?.phone ? hidePhoneNumber(userInfo.phone) : t("NoInfo")}</span>
</HStack>
<HStack spacing={8} className="mt-2">
<span className="w-[80px] text-grayModern-500">{t("SettingPanel.Registered")}:</span>

View File

@ -4,6 +4,7 @@ import { Button, useColorMode } from "@chakra-ui/react";
import clsx from "clsx";
import { COLOR_MODE } from "@/constants";
import { hidePhoneNumber } from "@/utils/format";
import CreateAppModal from "../CreateAppModal";
@ -31,7 +32,8 @@ function Empty() {
<div style={{ height: "75vh", minHeight: "500px" }}>
<div className="flex h-full flex-col items-center justify-center">
<h2 className="text-3xl font-bold">
{t("HomePanel.Hello")} 👋 {userInfo?.profile?.name || userInfo?.username} {" "}
{t("HomePanel.Hello")} 👋 {" "}
{hidePhoneNumber(userInfo?.profile?.name || userInfo?.username || "")}
{t("HomePanel.Welcome")}
</h2>
<p className="mx-auto mb-8 mt-10 w-[460px] text-xl">{t("HomePanel.Introduction")}</p>

View File

@ -87,3 +87,7 @@ export function formatPrice(price: number) {
export function convertMoney(money: number) {
return money * 100;
}
export function hidePhoneNumber(phone: string) {
return phone.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
}