/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
For commercial licensing, please contact support@quantumnous.com
*/
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
import {
Button,
Card,
Form,
Typography,
Spin,
Modal,
Popover,
Radio,
} from '@douyinfe/semi-ui';
import {
IconUserGroup,
IconAlertTriangle,
IconInfoCircle,
IconTick,
} from '@douyinfe/semi-icons';
import { useTranslation } from 'react-i18next';
import { API, showError, showSuccess, userIsDistributorUser } from '../helpers';
import { StatusContext } from '../context/Status';
import { UserContext } from '../context/User';
import DOMPurify from 'dompurify';
import DistributorApplyFileUpload from '../components/distributor/DistributorApplyFileUpload';
const { Text } = Typography;
/** 代理申请:必填项标题(红 * + 加粗),与资格证书区块一致 */
function ApplyRequiredLabel({ children, className = '' }) {
return (
*
{children}
);
}
const applyTrimmedRequiredRule = (t) => ({
validator: (rule, value) => {
const v = value == null ? '' : String(value).trim();
if (!v) return Promise.reject(t('必填'));
return Promise.resolve();
},
});
const iconLg = 22;
/**
* 自研圆角提示条(与主卡片 `rounded-2xl` 一致,替代 Semi Banner 直角/风格差异问题)
* @param {'danger' | 'info' | 'success'} variant
*/
function ApplyStatusNotice({
variant = 'info',
title,
className = '',
children,
}) {
const tone =
variant === 'danger'
? {
frame:
'border-[var(--semi-color-danger-light-hover)] bg-[var(--semi-color-danger-light-default)]',
icon: (
),
}
: variant === 'success'
? {
frame:
'border-[var(--semi-color-success-light-hover)] bg-[var(--semi-color-success-light-default)]',
icon: (
),
}
: {
frame:
'border-[var(--semi-color-info-light-hover)] bg-[var(--semi-color-info-light-default)]',
icon: (
),
};
return (