fix(birthday): 提醒页全员展示明文手机号
生日提醒用于联系商户,不再按角色脱敏;商户管理列表权限保持不变。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useEffect, useRef, useState, type ReactNode } from "react";
|
||||
import { Columns3, RotateCcw } from "lucide-react";
|
||||
import { fmtDate, maskPhone } from "@/lib/utils";
|
||||
import { fmtDate } from "@/lib/utils";
|
||||
import { lunarBirthdaySolarThisYear } from "@/lib/lunar";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { Table, THead, TR, TH, TD } from "@/components/ui/table";
|
||||
@@ -192,14 +192,7 @@ function ColumnPicker({
|
||||
);
|
||||
}
|
||||
|
||||
export function BirthdayList({
|
||||
rows,
|
||||
isAdmin,
|
||||
}: {
|
||||
rows: BirthdayRow[];
|
||||
/** 与商户列表一致:仅管理员看明文手机号 */
|
||||
isAdmin: boolean;
|
||||
}) {
|
||||
export function BirthdayList({ rows }: { rows: BirthdayRow[] }) {
|
||||
const [visible, setVisible] = useState<BirthdayColumnKey[]>(defaultBirthdayColumns);
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -223,9 +216,7 @@ export function BirthdayList({
|
||||
const colSpan = Math.max(1, ordered.length);
|
||||
|
||||
function phoneFor(v?: string | null) {
|
||||
const value = v?.trim() || "";
|
||||
if (!value) return "";
|
||||
return isAdmin ? value : maskPhone(value);
|
||||
return v?.trim() || "";
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -265,13 +256,13 @@ export function BirthdayList({
|
||||
<PersonCell
|
||||
name={row.contacts}
|
||||
phone={phoneFor(row.contactsPhone)}
|
||||
callable={isAdmin}
|
||||
callable
|
||||
/>
|
||||
) : col.key === "balanceUser" ? (
|
||||
<PersonCell
|
||||
name={row.balanceUser}
|
||||
phone={phoneFor(row.balanceUserPhone)}
|
||||
callable={isAdmin}
|
||||
callable
|
||||
/>
|
||||
) : (
|
||||
renderCell(col.key, row)
|
||||
@@ -316,13 +307,13 @@ export function BirthdayList({
|
||||
<PersonCell
|
||||
name={row.contacts}
|
||||
phone={phoneFor(row.contactsPhone)}
|
||||
callable={isAdmin}
|
||||
callable
|
||||
/>
|
||||
) : col.key === "balanceUser" ? (
|
||||
<PersonCell
|
||||
name={row.balanceUser}
|
||||
phone={phoneFor(row.balanceUserPhone)}
|
||||
callable={isAdmin}
|
||||
callable
|
||||
/>
|
||||
) : (
|
||||
renderCell(col.key, row)
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { auth } from "@/lib/auth";
|
||||
import { isSuperAdmin } from "@/lib/acl";
|
||||
import { birthdayMatchLists } from "@/lib/lunar";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { BirthdayControl } from "./birthday-control";
|
||||
@@ -20,8 +18,6 @@ export default async function BirthdayPage({
|
||||
}: {
|
||||
searchParams: Promise<{ mode?: string; date?: string }>;
|
||||
}) {
|
||||
const session = await auth();
|
||||
const isAdmin = isSuperAdmin(session?.user?.roles);
|
||||
const sp = await searchParams;
|
||||
const mode = sp.mode === "week" ? "week" : "today";
|
||||
const dateStr = sp.date ?? "";
|
||||
@@ -67,7 +63,7 @@ export default async function BirthdayPage({
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<BirthdayList rows={rows} isAdmin={isAdmin} />
|
||||
<BirthdayList rows={rows} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user