维护所有模块的多语言功能,对接友情分类接口和友情链接接口

This commit is contained in:
linxd
2025-06-18 16:37:25 +08:00
parent cc6706b409
commit 2a0532f775
34 changed files with 1828 additions and 1005 deletions

View File

@ -0,0 +1,48 @@
import { useIntl } from 'umi';
export const useFriendLinkDict = () => {
const intl = useIntl();
// 友情链接状态选项
const linkStatusOptions = [
{
label: intl.formatMessage({ id: 'friendLink.enabled' }),
value: '1',
},
{
label: intl.formatMessage({ id: 'friendLink.disabled' }),
value: '0',
},
];
// 获取状态标签
const getLinkStatusText = (status: number) => {
const option = linkStatusOptions.find(item => item.value === status.toString());
return option ? option.label : '-';
};
// 友情链接分类类型选项
const categoryTypeOptions = [
{
label: intl.formatMessage({ id: 'friendLink.category.type.normal' }),
value: 'normal',
},
{
label: intl.formatMessage({ id: 'friendLink.category.type.featured' }),
value: 'featured',
},
];
// 获取分类类型标签
const getCategoryTypeText = (type: string) => {
const option = categoryTypeOptions.find(item => item.value === type);
return option ? option.label : '-';
};
return {
linkStatusOptions,
getLinkStatusText,
categoryTypeOptions,
getCategoryTypeText,
};
};