维护所有模块的多语言功能,对接友情分类接口和友情链接接口
This commit is contained in:
48
src/dicts/friendLinkDict.ts
Normal file
48
src/dicts/friendLinkDict.ts
Normal 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,
|
||||
};
|
||||
};
|
@ -1,4 +1,5 @@
|
||||
// 帮助中心字典
|
||||
import { getLocale, getIntl } from 'umi';
|
||||
|
||||
// 帮助状态枚举
|
||||
export enum HelpStatus {
|
||||
@ -9,9 +10,9 @@ export enum HelpStatus {
|
||||
|
||||
// 帮助状态文本映射
|
||||
export const HelpStatusText = {
|
||||
[HelpStatus.DRAFT]: '草稿',
|
||||
[HelpStatus.PUBLISHED]: '已发布',
|
||||
[HelpStatus.UNPUBLISHED]: '已下架',
|
||||
[HelpStatus.DRAFT]: () => getIntl().formatMessage({ id: 'helpManage.status.draft' }),
|
||||
[HelpStatus.PUBLISHED]: () => getIntl().formatMessage({ id: 'helpManage.status.published' }),
|
||||
[HelpStatus.UNPUBLISHED]: () => getIntl().formatMessage({ id: 'helpManage.status.unpublished' }),
|
||||
};
|
||||
|
||||
// 帮助状态标签颜色
|
||||
@ -42,8 +43,20 @@ export enum EnglishSetting {
|
||||
|
||||
// 帮助中心分类选项
|
||||
export const categoryOptions = [
|
||||
{ value: '注册指南', label: '注册指南' },
|
||||
{ value: '投标指南', label: '投标指南' },
|
||||
{ value: '常见问题', label: '常见问题' },
|
||||
{ value: '联系我们', label: '联系我们' },
|
||||
{
|
||||
value: '注册指南',
|
||||
label: () => getIntl().formatMessage({ id: 'helpManage.category.registerGuide' })
|
||||
},
|
||||
{
|
||||
value: '投标指南',
|
||||
label: () => getIntl().formatMessage({ id: 'helpManage.category.biddingGuide' })
|
||||
},
|
||||
{
|
||||
value: '常见问题',
|
||||
label: () => getIntl().formatMessage({ id: 'helpManage.category.faq' })
|
||||
},
|
||||
{
|
||||
value: '联系我们',
|
||||
label: () => getIntl().formatMessage({ id: 'helpManage.category.contactUs' })
|
||||
},
|
||||
];
|
||||
|
@ -1,4 +1,5 @@
|
||||
// 政策法规字典
|
||||
import { getLocale, getIntl } from 'umi';
|
||||
|
||||
// 政策状态枚举
|
||||
export enum PolicyStatus {
|
||||
@ -9,9 +10,9 @@ export enum PolicyStatus {
|
||||
|
||||
// 政策状态文本映射
|
||||
export const PolicyStatusText = {
|
||||
[PolicyStatus.DRAFT]: '草稿',
|
||||
[PolicyStatus.PUBLISHED]: '已发布',
|
||||
[PolicyStatus.UNPUBLISHED]: '已下架',
|
||||
[PolicyStatus.DRAFT]: () => getIntl().formatMessage({ id: 'policyManage.status.draft' }),
|
||||
[PolicyStatus.PUBLISHED]: () => getIntl().formatMessage({ id: 'policyManage.status.published' }),
|
||||
[PolicyStatus.UNPUBLISHED]: () => getIntl().formatMessage({ id: 'policyManage.status.unpublished' }),
|
||||
};
|
||||
|
||||
// 政策状态标签颜色
|
||||
|
Reference in New Issue
Block a user