diff --git a/app/admin/_components/TemplateManager.tsx b/app/admin/_components/TemplateManager.tsx index caf7a41..66dc46d 100644 --- a/app/admin/_components/TemplateManager.tsx +++ b/app/admin/_components/TemplateManager.tsx @@ -2011,7 +2011,7 @@ export default function TemplateManager({ showToast }: { showToast: ToastFn }) { onClose={() => setShowUpgradeModal(false)} featureKey="customTemplates" featureName="自定义模板" - featureDescription="创建、复制、编辑和迁移自定义模板需要升级后才能使用。" + featureDescription="当前许可证未包含创建、复制、编辑和迁移自定义模板的授权。" /> {/* 素材迁移弹窗 */} diff --git a/app/admin/_components/template-manager/BuiltInTemplateGrid.tsx b/app/admin/_components/template-manager/BuiltInTemplateGrid.tsx index c3661dd..8b32c33 100644 --- a/app/admin/_components/template-manager/BuiltInTemplateGrid.tsx +++ b/app/admin/_components/template-manager/BuiltInTemplateGrid.tsx @@ -117,12 +117,12 @@ export default function BuiltInTemplateGrid({ 'inline-flex items-center gap-1.5 shadow-none', !canQuickCreate && 'opacity-75' )} - title={canQuickCreate ? '快速创建副本' : '需要升级后才能创建自定义模板'} + title={canQuickCreate ? '快速创建副本' : '当前许可证未包含自定义模板功能'} > - {canQuickCreate ? '快速创建副本' : '升级后创建'} + {canQuickCreate ? '快速创建副本' : '授权后创建'} diff --git a/app/admin/_components/template-manager/CustomTemplateSection.tsx b/app/admin/_components/template-manager/CustomTemplateSection.tsx index 3d8e081..d15e450 100644 --- a/app/admin/_components/template-manager/CustomTemplateSection.tsx +++ b/app/admin/_components/template-manager/CustomTemplateSection.tsx @@ -58,7 +58,7 @@ export default function CustomTemplateSection({

{canManageCustomTemplates ? '这里列出你自己创建的模板,可继续编辑、复制或删除' - : '当前许可证未开放自定义模板功能,升级后可新建、复制、编辑和迁移模板'} + : '当前许可证未包含自定义模板功能,请联系管理员处理授权'}

@@ -90,12 +90,12 @@ export default function CustomTemplateSection({

- {canManageCustomTemplates ? '新建自定义模板' : '升级后新建模板'} + {canManageCustomTemplates ? '新建自定义模板' : '授权后可新建'}

{canManageCustomTemplates ? '从空白模板起步,按照业务需求配置字段' - : '升级后可新建、复制和迁移自定义模板'} + : '当前不可新建、复制或迁移自定义模板'}

diff --git a/app/admin/_components/template-manager/__tests__/CustomTemplateSection.test.tsx b/app/admin/_components/template-manager/__tests__/CustomTemplateSection.test.tsx index 126dbc7..26ae95c 100644 --- a/app/admin/_components/template-manager/__tests__/CustomTemplateSection.test.tsx +++ b/app/admin/_components/template-manager/__tests__/CustomTemplateSection.test.tsx @@ -79,10 +79,10 @@ describe('CustomTemplateSection 授权提示', () => { it('许可证不包含自定义模板时应显示前置授权提示并拦截新建入口', () => { renderSection(false) - expect(screen.getByText('当前许可证未开放自定义模板功能,升级后可新建、复制、编辑和迁移模板')).toBeInTheDocument() + expect(screen.getByText('当前许可证未包含自定义模板功能,请联系管理员处理授权')).toBeInTheDocument() expect(screen.getByTestId('pro-badge')).toBeInTheDocument() - fireEvent.click(screen.getByText('升级后新建模板')) + fireEvent.click(screen.getByText('授权后可新建')) expect(callbacks.onRequestUpgrade).toHaveBeenCalledTimes(1) expect(callbacks.onCreate).not.toHaveBeenCalled() diff --git a/app/api/admin/upload-templates/[id]/migrate/route.ts b/app/api/admin/upload-templates/[id]/migrate/route.ts index 07ae0e0..b3583ae 100644 --- a/app/api/admin/upload-templates/[id]/migrate/route.ts +++ b/app/api/admin/upload-templates/[id]/migrate/route.ts @@ -321,7 +321,7 @@ export async function POST( if (!(await canUseCustomTemplates())) { return NextResponse.json({ - error: '自定义模板功能需要标准版或专业版许可证,请升级后使用', + error: '当前许可证未包含自定义模板功能,请联系管理员处理授权', errorCode: 'LICENSE_REQUIRED', }, { status: 403 }) } diff --git a/app/api/admin/upload-templates/[id]/route.ts b/app/api/admin/upload-templates/[id]/route.ts index f2149e5..df18a45 100644 --- a/app/api/admin/upload-templates/[id]/route.ts +++ b/app/api/admin/upload-templates/[id]/route.ts @@ -384,7 +384,7 @@ export async function PUT(req: NextRequest, { params }: { params: { id: string } if (!(await canUseCustomTemplates())) { return NextResponse.json({ - error: '自定义模板功能需要标准版或专业版许可证,请升级后使用', + error: '当前许可证未包含自定义模板功能,请联系管理员处理授权', errorCode: 'LICENSE_REQUIRED', }, { status: 403 }) } @@ -713,7 +713,7 @@ export async function DELETE(_: NextRequest, { params }: { params: { id: string if (!(await canUseCustomTemplates())) { return NextResponse.json({ - error: '自定义模板功能需要标准版或专业版许可证,请升级后使用', + error: '当前许可证未包含自定义模板功能,请联系管理员处理授权', errorCode: 'LICENSE_REQUIRED', }, { status: 403 }) } diff --git a/app/api/admin/upload-templates/route.ts b/app/api/admin/upload-templates/route.ts index 9c5d4c1..c3bcf00 100644 --- a/app/api/admin/upload-templates/route.ts +++ b/app/api/admin/upload-templates/route.ts @@ -108,7 +108,7 @@ export async function POST(req: NextRequest) { // 检查自定义模板功能是否可用 if (!(await canUseCustomTemplates())) { return NextResponse.json({ - error: '自定义模板功能需要标准版或专业版许可证,请升级后使用', + error: '当前许可证未包含自定义模板功能,请联系管理员处理授权', errorCode: 'LICENSE_REQUIRED', }, { status: 403 }) } diff --git a/app/api/departments/__tests__/route.test.ts b/app/api/departments/__tests__/route.test.ts index ad594b9..c5970fd 100644 --- a/app/api/departments/__tests__/route.test.ts +++ b/app/api/departments/__tests__/route.test.ts @@ -93,7 +93,7 @@ describe('departments route license guard', () => { const data = await response.json() expect(response.status).toBe(403) - expect(data.error).toContain('部门隔离功能需要专业版许可证') + expect(data.error).toContain('当前许可证未包含部门隔离功能') expect(prisma.department.findUnique).not.toHaveBeenCalled() }) @@ -128,7 +128,7 @@ describe('departments route license guard', () => { const data = await response.json() expect(response.status).toBe(403) - expect(data.error).toContain('部门隔离功能需要专业版许可证') + expect(data.error).toContain('当前许可证未包含部门隔离功能') expect(prisma.department.findUnique).not.toHaveBeenCalled() }) diff --git a/app/api/departments/route.ts b/app/api/departments/route.ts index 4935350..fb26be0 100644 --- a/app/api/departments/route.ts +++ b/app/api/departments/route.ts @@ -39,7 +39,7 @@ export async function POST(req: NextRequest) { // 检查部门隔离功能是否可用 if (!(await canUseDepartmentIsolation())) { return NextResponse.json( - { error: '部门隔离功能需要专业版许可证,请升级后使用' }, + { error: '当前许可证未包含部门隔离功能,请联系管理员处理授权' }, { status: 403 } ) } @@ -93,7 +93,7 @@ export async function PATCH(req: NextRequest) { if (!(await canUseDepartmentIsolation())) { return NextResponse.json( - { error: '部门隔离功能需要专业版许可证,请升级后使用' }, + { error: '当前许可证未包含部门隔离功能,请联系管理员处理授权' }, { status: 403 } ) } @@ -257,7 +257,7 @@ export async function DELETE(req: NextRequest) { if (!(await canUseDepartmentIsolation())) { return NextResponse.json( - { error: '部门隔离功能需要专业版许可证,请升级后使用' }, + { error: '当前许可证未包含部门隔离功能,请联系管理员处理授权' }, { status: 403 } ) } diff --git a/app/api/system-settings/route.ts b/app/api/system-settings/route.ts index bad5fb9..0362ab1 100644 --- a/app/api/system-settings/route.ts +++ b/app/api/system-settings/route.ts @@ -209,7 +209,7 @@ export async function PUT(request: NextRequest) { // 检查系统设置功能是否可用(免费版只能查看,不能修改) if (!(await canUseSystemSettings())) { return NextResponse.json( - { error: '系统设置功能需要标准版或专业版许可证,请升级后使用' }, + { error: '当前许可证未包含系统设置功能,请联系管理员处理授权' }, { status: 403 } ) } diff --git a/components/ui/RestrictedToggle.tsx b/components/ui/RestrictedToggle.tsx index 342d053..77e23d7 100644 --- a/components/ui/RestrictedToggle.tsx +++ b/components/ui/RestrictedToggle.tsx @@ -4,7 +4,7 @@ * RestrictedToggle 组件 * * 受限功能开关组件,集成 PRO 徽章和点击拦截逻辑 - * 当功能受限时显示禁用状态,点击时触发升级弹窗 + * 当功能受限时显示禁用状态,点击时触发授权提示弹窗 * * @created 2025-12-16 * @component @@ -96,7 +96,7 @@ export default function RestrictedToggle({ )} data-testid="restricted-hint" > - 升级到付费版解锁此功能 + 当前许可证未包含此功能

)} @@ -142,7 +142,7 @@ export default function RestrictedToggle({ - {/* 升级弹窗 */} + {/* 授权提示弹窗 */} setShowUpgradeModal(false)} diff --git a/components/ui/UpgradeModal.tsx b/components/ui/UpgradeModal.tsx index 4098103..8e21888 100644 --- a/components/ui/UpgradeModal.tsx +++ b/components/ui/UpgradeModal.tsx @@ -3,8 +3,8 @@ /** * UpgradeModal 组件 * - * 升级提示弹窗,当免费版用户点击受限功能时显示 - * 基于现有 Modal 组件构建,显示功能名称、限制说明和升级好处 + * 授权提示弹窗,当当前许可证不包含某个功能时显示 + * 基于现有 Modal 组件构建,显示功能名称和限制说明 * * @created 2025-12-16 * @component @@ -41,9 +41,8 @@ export default function UpgradeModal({ const displayName = featureName || feature.name const displayDescription = featureDescription || feature.description - const handleUpgradeClick = () => { - // TODO: 跳转到升级页面或显示联系方式 - // 目前先关闭弹窗 + const handleContactAdminClick = () => { + // 目前先关闭弹窗,后续可接入客户自己的授权处理入口。 onClose() } @@ -112,7 +111,7 @@ export default function UpgradeModal({