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 { useEffect, useRef, useState, type ReactNode } from "react";
|
||||||
import { Columns3, RotateCcw } from "lucide-react";
|
import { Columns3, RotateCcw } from "lucide-react";
|
||||||
import { fmtDate, maskPhone } from "@/lib/utils";
|
import { fmtDate } from "@/lib/utils";
|
||||||
import { lunarBirthdaySolarThisYear } from "@/lib/lunar";
|
import { lunarBirthdaySolarThisYear } from "@/lib/lunar";
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
import { Table, THead, TR, TH, TD } from "@/components/ui/table";
|
import { Table, THead, TR, TH, TD } from "@/components/ui/table";
|
||||||
@@ -192,14 +192,7 @@ function ColumnPicker({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function BirthdayList({
|
export function BirthdayList({ rows }: { rows: BirthdayRow[] }) {
|
||||||
rows,
|
|
||||||
isAdmin,
|
|
||||||
}: {
|
|
||||||
rows: BirthdayRow[];
|
|
||||||
/** 与商户列表一致:仅管理员看明文手机号 */
|
|
||||||
isAdmin: boolean;
|
|
||||||
}) {
|
|
||||||
const [visible, setVisible] = useState<BirthdayColumnKey[]>(defaultBirthdayColumns);
|
const [visible, setVisible] = useState<BirthdayColumnKey[]>(defaultBirthdayColumns);
|
||||||
const [ready, setReady] = useState(false);
|
const [ready, setReady] = useState(false);
|
||||||
|
|
||||||
@@ -223,9 +216,7 @@ export function BirthdayList({
|
|||||||
const colSpan = Math.max(1, ordered.length);
|
const colSpan = Math.max(1, ordered.length);
|
||||||
|
|
||||||
function phoneFor(v?: string | null) {
|
function phoneFor(v?: string | null) {
|
||||||
const value = v?.trim() || "";
|
return v?.trim() || "";
|
||||||
if (!value) return "";
|
|
||||||
return isAdmin ? value : maskPhone(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -265,13 +256,13 @@ export function BirthdayList({
|
|||||||
<PersonCell
|
<PersonCell
|
||||||
name={row.contacts}
|
name={row.contacts}
|
||||||
phone={phoneFor(row.contactsPhone)}
|
phone={phoneFor(row.contactsPhone)}
|
||||||
callable={isAdmin}
|
callable
|
||||||
/>
|
/>
|
||||||
) : col.key === "balanceUser" ? (
|
) : col.key === "balanceUser" ? (
|
||||||
<PersonCell
|
<PersonCell
|
||||||
name={row.balanceUser}
|
name={row.balanceUser}
|
||||||
phone={phoneFor(row.balanceUserPhone)}
|
phone={phoneFor(row.balanceUserPhone)}
|
||||||
callable={isAdmin}
|
callable
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
renderCell(col.key, row)
|
renderCell(col.key, row)
|
||||||
@@ -316,13 +307,13 @@ export function BirthdayList({
|
|||||||
<PersonCell
|
<PersonCell
|
||||||
name={row.contacts}
|
name={row.contacts}
|
||||||
phone={phoneFor(row.contactsPhone)}
|
phone={phoneFor(row.contactsPhone)}
|
||||||
callable={isAdmin}
|
callable
|
||||||
/>
|
/>
|
||||||
) : col.key === "balanceUser" ? (
|
) : col.key === "balanceUser" ? (
|
||||||
<PersonCell
|
<PersonCell
|
||||||
name={row.balanceUser}
|
name={row.balanceUser}
|
||||||
phone={phoneFor(row.balanceUserPhone)}
|
phone={phoneFor(row.balanceUserPhone)}
|
||||||
callable={isAdmin}
|
callable
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
renderCell(col.key, row)
|
renderCell(col.key, row)
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import { Prisma } from "@prisma/client";
|
import { Prisma } from "@prisma/client";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import { auth } from "@/lib/auth";
|
|
||||||
import { isSuperAdmin } from "@/lib/acl";
|
|
||||||
import { birthdayMatchLists } from "@/lib/lunar";
|
import { birthdayMatchLists } from "@/lib/lunar";
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
import { BirthdayControl } from "./birthday-control";
|
import { BirthdayControl } from "./birthday-control";
|
||||||
@@ -20,8 +18,6 @@ export default async function BirthdayPage({
|
|||||||
}: {
|
}: {
|
||||||
searchParams: Promise<{ mode?: string; date?: string }>;
|
searchParams: Promise<{ mode?: string; date?: string }>;
|
||||||
}) {
|
}) {
|
||||||
const session = await auth();
|
|
||||||
const isAdmin = isSuperAdmin(session?.user?.roles);
|
|
||||||
const sp = await searchParams;
|
const sp = await searchParams;
|
||||||
const mode = sp.mode === "week" ? "week" : "today";
|
const mode = sp.mode === "week" ? "week" : "today";
|
||||||
const dateStr = sp.date ?? "";
|
const dateStr = sp.date ?? "";
|
||||||
@@ -67,7 +63,7 @@ export default async function BirthdayPage({
|
|||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<BirthdayList rows={rows} isAdmin={isAdmin} />
|
<BirthdayList rows={rows} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user