feat(company): add subscription expiry management and expired company guard
Add validity period fields to company CRUD, display expiry info in table and profile, and block access for expired companies via a full-screen guard component. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import {
|
||||
ProForm,
|
||||
ProFormText,
|
||||
} from '@ant-design/pro-components';
|
||||
import { history } from '@umijs/max';
|
||||
import { history, useAccess } from '@umijs/max';
|
||||
import {
|
||||
App,
|
||||
Button,
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
Space,
|
||||
Tag,
|
||||
} from 'antd';
|
||||
import React from 'react';
|
||||
import React, { useEffect } from 'react';
|
||||
import { clearAccessToken } from '@/access';
|
||||
import PasswordLevel from '@/components/PasswordLevel';
|
||||
import useUserInfo from '@/hooks/useUserInfo';
|
||||
@@ -24,6 +24,7 @@ import { $t } from '@/utils/i18n';
|
||||
|
||||
const Profile: React.FC = () => {
|
||||
const { userInfo, setUserInfo } = useUserInfo();
|
||||
const { isGlobalCompany } = useAccess();
|
||||
const userCompany = userInfo?.company;
|
||||
const { message: antdMessage, modal } = App.useApp();
|
||||
|
||||
@@ -71,6 +72,19 @@ const Profile: React.FC = () => {
|
||||
},
|
||||
];
|
||||
|
||||
useEffect(() => {
|
||||
if (!isGlobalCompany) {
|
||||
items.push({
|
||||
key: '6',
|
||||
span: 'filled',
|
||||
label: $t('pages.company.permanent'),
|
||||
children: userCompany?.validityEndTime
|
||||
? userCompany.validityEndTime
|
||||
: $t('pages.company.permanent'),
|
||||
});
|
||||
}
|
||||
}, [userInfo]);
|
||||
|
||||
const changePasswordSuccessHadle = async () => {
|
||||
let countdown = 5;
|
||||
let timer: NodeJS.Timeout | null = null;
|
||||
|
||||
Reference in New Issue
Block a user