diff --git a/src/dicts/friendLinkDict.ts b/src/dicts/friendLinkDict.ts new file mode 100644 index 0000000..25a3838 --- /dev/null +++ b/src/dicts/friendLinkDict.ts @@ -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, + }; +}; diff --git a/src/dicts/helpManageDict.ts b/src/dicts/helpManageDict.ts index 8622267..c0375b2 100644 --- a/src/dicts/helpManageDict.ts +++ b/src/dicts/helpManageDict.ts @@ -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' }) + }, ]; diff --git a/src/dicts/policyManageDict.ts b/src/dicts/policyManageDict.ts index 5d02272..a766363 100644 --- a/src/dicts/policyManageDict.ts +++ b/src/dicts/policyManageDict.ts @@ -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' }), }; // 政策状态标签颜色 diff --git a/src/locales/en-US.ts b/src/locales/en-US.ts index 30e456e..a2e1dcd 100644 --- a/src/locales/en-US.ts +++ b/src/locales/en-US.ts @@ -1,17 +1,19 @@ -import userQuestion from './en-US/userQuestion'; -import register from './en-US/register'; -import login from './en-US/login'; -import helpCenter from './en-US/helpCenter'; -import friendLink from './en-US/friendLink'; -import about from './en-US/about'; import common from './en-US/common'; +import login from './en-US/login'; +import register from './en-US/register'; +import helpManage from './en-US/helpManage'; +import aboutManage from './en-US/aboutManage'; +import policyManage from './en-US/policyManage'; +import userQuestion from './en-US/userQuestion'; +import friendLink from './en-US/friendLink'; export default { ...common, - ...userQuestion, - ...register, ...login, - ...helpCenter, + ...register, + ...helpManage, + ...aboutManage, + ...policyManage, + ...userQuestion, ...friendLink, - ...about, }; diff --git a/src/locales/en-US/about.ts b/src/locales/en-US/about.ts deleted file mode 100644 index 797470f..0000000 --- a/src/locales/en-US/about.ts +++ /dev/null @@ -1,14 +0,0 @@ -export default { - // About page - 'about.title': 'About Us', - 'about.company.title': 'Company Profile', - 'about.advantages.title': 'Platform Advantages', - 'about.history.title': 'Development History', - 'about.contact.title': 'Contact Us', - 'about.address': 'Headquarters Address', - 'about.phone': 'Phone', - 'about.hotline': 'Service Hotline', - 'about.email': 'Email', - 'about.worktime': 'Working Hours', - 'about.copyright': '© 2024 COSCO SHIPPING E-Bidding Platform. All Rights Reserved.', -}; diff --git a/src/locales/en-US/aboutManage.ts b/src/locales/en-US/aboutManage.ts new file mode 100644 index 0000000..a0931a3 --- /dev/null +++ b/src/locales/en-US/aboutManage.ts @@ -0,0 +1,52 @@ +export default { + // About Us Management Page + 'aboutManage.title': 'About Us Management', + 'aboutManage.save': 'Save', + 'aboutManage.saveSuccess': 'Save successful', + 'aboutManage.saveFailed': 'Save failed', + 'aboutManage.fetchFailed': 'Failed to fetch data', + + // Form Tabs + 'aboutManage.form.chineseTab': 'Chinese', + 'aboutManage.form.englishTab': 'English', + + // Chinese Form Items + 'aboutManage.form.title': 'Title (Chinese)', + 'aboutManage.form.titleRequired': 'Please enter Chinese title', + 'aboutManage.form.titlePlaceholder': 'Please enter Chinese title', + 'aboutManage.form.content': 'Content (Chinese)', + 'aboutManage.form.contentRequired': 'Please enter Chinese content', + 'aboutManage.form.contentPlaceholder': 'Please enter Chinese content...', + 'aboutManage.form.address': 'Address (Chinese)', + 'aboutManage.form.addressRequired': 'Please enter Chinese address', + 'aboutManage.form.addressPlaceholder': 'Please enter Chinese address', + 'aboutManage.form.contactsPhone': 'Contact Phone (Chinese)', + 'aboutManage.form.contactsPhoneRequired': 'Please enter Chinese contact phone', + 'aboutManage.form.contactsPhonePlaceholder': 'Please enter Chinese contact phone', + 'aboutManage.form.contactsEmail': 'Contact Email (Chinese)', + 'aboutManage.form.contactsEmailRequired': 'Please enter Chinese contact email', + 'aboutManage.form.contactsEmailPlaceholder': 'Please enter Chinese contact email', + 'aboutManage.form.contactsConsult': 'Consultation Method (Chinese)', + 'aboutManage.form.contactsConsultRequired': 'Please enter Chinese consultation method', + 'aboutManage.form.contactsConsultPlaceholder': 'Please enter Chinese consultation method', + + // English Form Items + 'aboutManage.form.titleEn': 'Title (English)', + 'aboutManage.form.titleEnRequired': 'Please enter English title', + 'aboutManage.form.titleEnPlaceholder': 'Please enter English title', + 'aboutManage.form.contentEn': 'Content (English)', + 'aboutManage.form.contentEnRequired': 'Please enter English content', + 'aboutManage.form.contentEnPlaceholder': 'Please enter English content...', + 'aboutManage.form.addressEn': 'Address (English)', + 'aboutManage.form.addressEnRequired': 'Please enter English address', + 'aboutManage.form.addressEnPlaceholder': 'Please enter English address', + 'aboutManage.form.contactsPhoneEn': 'Contact Phone (English)', + 'aboutManage.form.contactsPhoneEnRequired': 'Please enter English contact phone', + 'aboutManage.form.contactsPhoneEnPlaceholder': 'Please enter English contact phone', + 'aboutManage.form.contactsEmailEn': 'Contact Email (English)', + 'aboutManage.form.contactsEmailEnRequired': 'Please enter English contact email', + 'aboutManage.form.contactsEmailEnPlaceholder': 'Please enter English contact email', + 'aboutManage.form.contactsConsultEn': 'Consultation Method (English)', + 'aboutManage.form.contactsConsultEnRequired': 'Please enter English consultation method', + 'aboutManage.form.contactsConsultEnPlaceholder': 'Please enter English consultation method', +}; diff --git a/src/locales/en-US/common.ts b/src/locales/en-US/common.ts index 0d1e071..24b7896 100644 --- a/src/locales/en-US/common.ts +++ b/src/locales/en-US/common.ts @@ -27,4 +27,8 @@ export default { "采购失败(流标)公告": "Failed Procurement Announcement", "加载更多": "Load More", "登录/注册": "Login/Register", + + // Buttons + "common.confirm": "Confirm", + "common.cancel": "Cancel", }; diff --git a/src/locales/en-US/friendLink.ts b/src/locales/en-US/friendLink.ts index 5072958..93adb01 100644 --- a/src/locales/en-US/friendLink.ts +++ b/src/locales/en-US/friendLink.ts @@ -2,14 +2,94 @@ export default { // Friendly Links Management page 'friendLink.title': 'Friendly Links Management', 'friendLink.name': 'Name', + 'friendLink.nameEn': 'English Name', 'friendLink.url': 'URL', 'friendLink.logo': 'Logo', + 'friendLink.thumbnail': 'Thumbnail', 'friendLink.sort': 'Sort Order', 'friendLink.status': 'Status', + 'friendLink.category': 'Category', 'friendLink.operation': 'Operation', 'friendLink.add': 'Add Link', 'friendLink.edit': 'Edit Link', 'friendLink.delete': 'Delete Link', + 'friendLink.batchDelete': 'Batch Delete', + 'friendLink.enable': 'Enable', + 'friendLink.disable': 'Disable', 'friendLink.enabled': 'Enabled', 'friendLink.disabled': 'Disabled', + 'friendLink.selectedCount': '{count} items selected', + + // Form related + 'friendLink.form.name.required': 'Please enter link name', + 'friendLink.form.name.placeholder': 'Please enter link name', + 'friendLink.form.nameEn.required': 'Please enter English name', + 'friendLink.form.nameEn.placeholder': 'Please enter English name', + 'friendLink.form.category.required': 'Please select category', + 'friendLink.form.category.placeholder': 'Please select category', + 'friendLink.form.url.required': 'Please enter URL', + 'friendLink.form.url.invalid': 'Please enter a valid URL', + 'friendLink.form.url.placeholder': 'Please enter URL starting with http:// or https://', + 'friendLink.form.thumbnail.required': 'Please upload thumbnail', + 'friendLink.form.thumbnail.upload': 'Upload Thumbnail', + 'friendLink.form.sort.required': 'Please enter sort order', + 'friendLink.form.sort.placeholder': 'Please enter sort order, smaller number comes first', + + // Operation tips + 'friendLink.delete.confirm.title': 'Delete Confirmation', + 'friendLink.delete.confirm.content': 'Are you sure you want to delete this link?', + 'friendLink.delete.success': 'Deleted successfully', + 'friendLink.batchDelete.empty': 'Please select items to delete', + 'friendLink.batchDelete.confirm.title': 'Batch Delete Confirmation', + 'friendLink.batchDelete.confirm.content': 'Are you sure you want to delete {count} selected items?', + 'friendLink.batchDelete.success': 'Batch delete successful', + 'friendLink.add.success': 'Added successfully', + 'friendLink.update.success': 'Updated successfully', + 'friendLink.enable.success': 'Enabled successfully', + 'friendLink.disable.success': 'Disabled successfully', + 'friendLink.enable.confirm.title': 'Enable Confirmation', + 'friendLink.enable.confirm.content': 'Are you sure you want to enable this link?', + 'friendLink.disable.confirm.title': 'Disable Confirmation', + 'friendLink.disable.confirm.content': 'Are you sure you want to disable this link?', + + // Friendly Link Category Management + 'friendLink.category.title': 'Friendly Link Category Management', + 'friendLink.category.name': 'Category Name', + 'friendLink.category.level': 'Level', + 'friendLink.category.sort': 'Sort Order', + 'friendLink.category.parentCategory': 'Parent Category', + 'friendLink.category.operation': 'Operation', + 'friendLink.category.add': 'Add Category', + 'friendLink.category.addChild': 'Add Subcategory', + 'friendLink.category.edit': 'Edit', + 'friendLink.category.delete': 'Delete', + 'friendLink.category.form.title.add': 'Add Category', + 'friendLink.category.form.title.addChild': 'Add Subcategory', + 'friendLink.category.form.title.edit': 'Edit Category', + 'friendLink.category.form.name': 'Category Name', + 'friendLink.category.form.name.placeholder': 'Please enter category name', + 'friendLink.category.form.name.required': 'Please enter category name', + 'friendLink.category.form.parentCategory': 'Parent Category', + 'friendLink.category.form.parentCategory.placeholder': 'Please select parent category', + 'friendLink.category.form.parentCategory.required': 'Please select parent category', + 'friendLink.category.form.sort': 'Sort Order', + 'friendLink.category.form.sort.placeholder': 'Please enter sort value, smaller number comes first', + 'friendLink.category.form.sort.required': 'Please enter sort value', + 'friendLink.category.delete.confirm.title': 'Delete Category', + 'friendLink.category.delete.confirm.content': 'Are you sure you want to delete category "{name}"?', + 'friendLink.category.delete.hasChildren': 'This category has subcategories and cannot be deleted directly', + 'friendLink.category.delete.success': 'Deleted successfully', + 'friendLink.category.add.success': 'Added successfully', + 'friendLink.category.update.success': 'Updated successfully', + + // Category Type + 'friendLink.category.type': 'Type', + 'friendLink.category.type.normal': 'Normal Display', + 'friendLink.category.type.featured': 'Featured Display', + 'friendLink.category.form.type': 'Category Type', + 'friendLink.category.form.type.placeholder': 'Please select category type', + 'friendLink.category.form.type.required': 'Please select category type', + 'friendLink.category.form.remark': 'Remark', + 'friendLink.category.form.remark.placeholder': 'Please enter remark', + 'friendLink.category.form.remark.required': 'Please enter remark', }; diff --git a/src/locales/en-US/helpCenter.ts b/src/locales/en-US/helpCenter.ts deleted file mode 100644 index 2cd7bfe..0000000 --- a/src/locales/en-US/helpCenter.ts +++ /dev/null @@ -1,22 +0,0 @@ -export default { - // Help Center Management - 'helpCenter.title': 'Help Center Management', - 'helpCenter.question': 'Question', - 'helpCenter.category': 'Category', - 'helpCenter.createTime': 'Create Time', - 'helpCenter.updateTime': 'Update Time', - 'helpCenter.status': 'Status', - 'helpCenter.operation': 'Operation', - 'helpCenter.edit': 'Edit', - 'helpCenter.delete': 'Delete', - 'helpCenter.add': 'Add', - 'helpCenter.search': 'Search', - 'helpCenter.all': 'All', - 'helpCenter.published': 'Published', - 'helpCenter.unpublished': 'Unpublished', - 'helpCenter.draft': 'Draft', - 'helpCenter.publish': 'Publish', - 'helpCenter.unpublish': 'Unpublish', - 'helpCenter.confirmDelete': 'Are you sure you want to delete this help item?', - 'helpCenter.batchDelete': 'Are you sure you want to delete selected help items?', -}; diff --git a/src/locales/en-US/helpManage.ts b/src/locales/en-US/helpManage.ts new file mode 100644 index 0000000..904e6b4 --- /dev/null +++ b/src/locales/en-US/helpManage.ts @@ -0,0 +1,108 @@ +export default { + // Help Center Management List Page + 'helpManage.title': 'Help Center Management', + 'helpManage.serialNumber': 'No.', + 'helpManage.title.label': 'Title', + 'helpManage.category': 'Category', + 'helpManage.date': 'Date', + 'helpManage.status': 'Status', + 'helpManage.publisher': 'Publisher', + 'helpManage.operation': 'Operation', + 'helpManage.view': 'View', + 'helpManage.edit': 'Edit', + 'helpManage.publish': 'Publish', + 'helpManage.unpublish': 'Unpublish', + 'helpManage.delete': 'Delete', + 'helpManage.top': 'Top', + 'helpManage.untop': 'Untop', + 'helpManage.add': 'Add', + 'helpManage.search': 'Search', + 'helpManage.reset': 'Reset', + 'helpManage.submit': 'Submit', + 'helpManage.cancel': 'Cancel', + 'helpManage.confirmDelete': 'Are you sure you want to delete this help item?', + 'helpManage.batchDelete': 'Are you sure you want to delete the selected help items?', + 'helpManage.confirmPublish': 'Are you sure you want to publish this help item?', + 'helpManage.confirmUnpublish': 'Are you sure you want to unpublish this help item?', + 'helpManage.confirmTop': 'Are you sure you want to top this help item?', + 'helpManage.confirmUntop': 'Are you sure you want to untop this help item?', + 'helpManage.publishSuccess': 'Publish successful', + 'helpManage.unpublishSuccess': 'Unpublish successful', + 'helpManage.publishFailed': 'Publish failed', + 'helpManage.unpublishFailed': 'Unpublish failed', + 'helpManage.topSuccess': 'Top successful', + 'helpManage.untopSuccess': 'Untop successful', + 'helpManage.topFailed': 'Top failed', + 'helpManage.untopFailed': 'Untop failed', + 'helpManage.deleteSuccess': 'Delete successful', + 'helpManage.deleteFailed': 'Delete failed', + 'helpManage.batchDeleteSuccess': 'Batch delete successful', + 'helpManage.batchDeleteFailed': 'Batch delete failed', + 'helpManage.addSuccess': 'Add successful', + 'helpManage.addFailed': 'Add failed', + 'helpManage.updateSuccess': 'Update successful', + 'helpManage.updateFailed': 'Update failed', + 'helpManage.fetchFailed': 'Failed to fetch help center list', + 'helpManage.fetchDetailFailed': 'Failed to fetch details', + 'helpManage.noDeleteItems': 'No items to delete', + 'helpManage.selectedCount': '{count} items selected', + 'helpManage.publishedNoEdit': 'Published help items cannot be edited', + 'helpManage.publishedNoDelete': 'Published help items cannot be deleted', + 'helpManage.deleteConfirmTitle': 'Title', + 'helpManage.deleteConfirmContent': 'This action cannot be undone', + 'helpManage.searchTitlePlaceholder': 'Enter title keywords', + 'helpManage.searchCategoryPlaceholder': 'Select category', + 'helpManage.searchStatusPlaceholder': 'Select status', + + // Help Center Form + 'helpManage.form.isTop': 'Top', + 'helpManage.form.category': 'Category', + 'helpManage.form.categoryRequired': 'Please select a category', + 'helpManage.form.categoryPlaceholder': 'Please select a category', + 'helpManage.form.chineseTab': 'Chinese', + 'helpManage.form.englishTab': 'English', + 'helpManage.form.titleZh': 'Title (Chinese)', + 'helpManage.form.titleZhRequired': 'Please enter Chinese title', + 'helpManage.form.titleZhPlaceholder': 'Please enter Chinese title', + 'helpManage.form.contentZh': 'Content (Chinese)', + 'helpManage.form.contentZhRequired': 'Please enter Chinese content', + 'helpManage.form.contentZhPlaceholder': 'Please enter help content...', + 'helpManage.form.answerContentZh': 'Answer Content (Chinese)', + 'helpManage.form.answerContentZhPlaceholder': 'Please enter answer content...', + 'helpManage.form.titleEn': 'Title (English)', + 'helpManage.form.titleEnRequired': 'Please enter English title', + 'helpManage.form.titleEnPlaceholder': 'Please enter English title', + 'helpManage.form.contentEn': 'Content (English)', + 'helpManage.form.contentEnRequired': 'Please enter English content', + 'helpManage.form.contentEnPlaceholder': 'Please enter help content...', + 'helpManage.form.answerContentEn': 'Answer Content (English)', + 'helpManage.form.answerContentEnPlaceholder': 'Please enter answer content...', + + // Help Center Detail + 'helpManage.detail.title': 'Title', + 'helpManage.detail.titleEn': 'English Title', + 'helpManage.detail.category': 'Category', + 'helpManage.detail.isTop': 'Is Top', + 'helpManage.detail.status': 'Status', + 'helpManage.detail.creator': 'Creator', + 'helpManage.detail.createTime': 'Create Time', + 'helpManage.detail.updateTime': 'Update Time', + 'helpManage.detail.contentZh': 'Content (Chinese)', + 'helpManage.detail.contentEn': 'Content (English)', + 'helpManage.detail.answerContentZh': 'Answer Content (Chinese)', + 'helpManage.detail.answerContentEn': 'Answer Content (English)', + 'helpManage.detail.yes': 'Yes', + 'helpManage.detail.no': 'No', + + // Help Status + 'helpManage.status.draft': 'Draft', + 'helpManage.status.published': 'Published', + 'helpManage.status.unpublished': 'Unpublished', + 'helpManage.status.unknown': 'Unknown', + + // Help Categories + 'helpManage.category.registerGuide': 'Registration Guide', + 'helpManage.category.biddingGuide': 'Bidding Guide', + 'helpManage.category.faq': 'FAQ', + 'helpManage.category.contactUs': 'Contact Us', +}; diff --git a/src/locales/en-US/policyManage.ts b/src/locales/en-US/policyManage.ts new file mode 100644 index 0000000..203ddfc --- /dev/null +++ b/src/locales/en-US/policyManage.ts @@ -0,0 +1,86 @@ +export default { + // Policies and Regulations Management List Page + 'policyManage.title': 'Policies & Regulations Management', + 'policyManage.serialNumber': 'No.', + 'policyManage.title.label': 'Title', + 'policyManage.date': 'Date', + 'policyManage.status': 'Status', + 'policyManage.publisher': 'Publisher', + 'policyManage.operation': 'Operation', + 'policyManage.view': 'View', + 'policyManage.edit': 'Edit', + 'policyManage.publish': 'Publish', + 'policyManage.unpublish': 'Unpublish', + 'policyManage.delete': 'Delete', + 'policyManage.top': 'Top', + 'policyManage.add': 'Add', + 'policyManage.search': 'Search', + 'policyManage.reset': 'Reset', + 'policyManage.submit': 'Submit', + 'policyManage.cancel': 'Cancel', + 'policyManage.close': 'Close', + 'policyManage.confirmDelete': 'Are you sure you want to delete this policy?', + 'policyManage.confirmDeleteBatch': 'Are you sure you want to delete the selected policies?', + 'policyManage.confirmPublish': 'Are you sure you want to publish this policy?', + 'policyManage.confirmUnpublish': 'Are you sure you want to unpublish this policy?', + 'policyManage.deleteSuccess': 'Delete successful', + 'policyManage.deleteFailed': 'Delete failed', + 'policyManage.batchDeleteSuccess': 'Delete successful', + 'policyManage.batchDeletePartialFailed': 'Some deletions failed, please refresh and try again', + 'policyManage.batchDeleteFailed': 'Batch delete failed', + 'policyManage.publishSuccess': 'Publish successful', + 'policyManage.unpublishSuccess': 'Unpublish successful', + 'policyManage.publishFailed': 'Publish failed', + 'policyManage.unpublishFailed': 'Unpublish failed', + 'policyManage.fetchFailed': 'Failed to fetch data', + 'policyManage.fetchDetailFailed': 'Failed to fetch details', + 'policyManage.deleteConfirmTitle': 'Title', + 'policyManage.deleteConfirmContent': 'This action cannot be undone', + 'policyManage.selectedCount': '{count} items selected', + 'policyManage.searchTitlePlaceholder': 'Enter title keywords', + 'policyManage.searchStatusPlaceholder': 'Select status', + + // Policy Form Page + 'policyManage.form.title': 'Policy & Regulation', + 'policyManage.form.add': 'Add Policy & Regulation', + 'policyManage.form.edit': 'Edit Policy & Regulation', + 'policyManage.form.view': 'View Policy & Regulation', + 'policyManage.form.isTop': 'Set as Top', + 'policyManage.form.chineseTab': 'Chinese', + 'policyManage.form.englishTab': 'English', + 'policyManage.form.titleZh': 'Title (Chinese)', + 'policyManage.form.titleZhRequired': 'Please enter Chinese title', + 'policyManage.form.titleZhPlaceholder': 'Please enter Chinese title', + 'policyManage.form.contentZh': 'Content (Chinese)', + 'policyManage.form.contentZhRequired': 'Please enter Chinese content', + 'policyManage.form.contentZhPlaceholder': 'Please enter Chinese content...', + 'policyManage.form.titleEn': 'Title (English)', + 'policyManage.form.titleEnRequired': 'Please enter English title', + 'policyManage.form.titleEnPlaceholder': 'Please enter English title', + 'policyManage.form.contentEn': 'Content (English)', + 'policyManage.form.contentEnRequired': 'Please enter English content', + 'policyManage.form.contentEnPlaceholder': 'Please enter English content...', + 'policyManage.form.addSuccess': 'Add successful', + 'policyManage.form.updateSuccess': 'Update successful', + 'policyManage.form.addFailed': 'Add failed', + 'policyManage.form.updateFailed': 'Update failed', + + // Policy Details Page + 'policyManage.detail.title': 'Title', + 'policyManage.detail.titleEn': 'English Title', + 'policyManage.detail.isTop': 'Is Top', + 'policyManage.detail.status': 'Status', + 'policyManage.detail.creator': 'Creator', + 'policyManage.detail.createTime': 'Create Time', + 'policyManage.detail.updateTime': 'Update Time', + 'policyManage.detail.contentZh': 'Chinese Content', + 'policyManage.detail.contentEn': 'English Content', + 'policyManage.detail.yes': 'Yes', + 'policyManage.detail.no': 'No', + + // Policy Status + 'policyManage.status.draft': 'Draft', + 'policyManage.status.published': 'Published', + 'policyManage.status.unpublished': 'Unpublished', + 'policyManage.status.unknown': 'Unknown', +}; diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 879ce6e..4f72490 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -1,17 +1,19 @@ -import userQuestion from './zh-CN/userQuestion'; -import register from './zh-CN/register'; -import login from './zh-CN/login'; -import helpCenter from './zh-CN/helpCenter'; -import friendLink from './zh-CN/friendLink'; -import about from './zh-CN/about'; import common from './zh-CN/common'; +import login from './zh-CN/login'; +import register from './zh-CN/register'; +import helpManage from './zh-CN/helpManage'; +import aboutManage from './zh-CN/aboutManage'; +import policyManage from './zh-CN/policyManage'; +import userQuestion from './zh-CN/userQuestion'; +import friendLink from './zh-CN/friendLink'; export default { ...common, - ...userQuestion, - ...register, ...login, - ...helpCenter, + ...register, + ...helpManage, + ...aboutManage, + ...policyManage, + ...userQuestion, ...friendLink, - ...about, }; diff --git a/src/locales/zh-CN/about.ts b/src/locales/zh-CN/about.ts deleted file mode 100644 index 8e66f9d..0000000 --- a/src/locales/zh-CN/about.ts +++ /dev/null @@ -1,14 +0,0 @@ -export default { - // 关于我们页面 - 'about.title': '关于我们', - 'about.company.title': '公司简介', - 'about.advantages.title': '平台优势', - 'about.history.title': '发展历程', - 'about.contact.title': '联系我们', - 'about.address': '总部地址', - 'about.phone': '联系电话', - 'about.hotline': '服务热线', - 'about.email': '电子邮箱', - 'about.worktime': '工作时间', - 'about.copyright': '© 2024 中远海运电子招投标平台 版权所有', -}; diff --git a/src/locales/zh-CN/aboutManage.ts b/src/locales/zh-CN/aboutManage.ts new file mode 100644 index 0000000..3ee83f9 --- /dev/null +++ b/src/locales/zh-CN/aboutManage.ts @@ -0,0 +1,52 @@ +export default { + // 关于我们管理页面 + 'aboutManage.title': '关于我们管理', + 'aboutManage.save': '保存', + 'aboutManage.saveSuccess': '保存成功', + 'aboutManage.saveFailed': '保存失败', + 'aboutManage.fetchFailed': '获取数据失败', + + // 表单标签 + 'aboutManage.form.chineseTab': '中文版', + 'aboutManage.form.englishTab': '英文版', + + // 中文表单项 + 'aboutManage.form.title': '标题', + 'aboutManage.form.titleRequired': '请输入标题', + 'aboutManage.form.titlePlaceholder': '请输入标题', + 'aboutManage.form.content': '正文内容', + 'aboutManage.form.contentRequired': '请输入正文内容', + 'aboutManage.form.contentPlaceholder': '请输入正文内容...', + 'aboutManage.form.address': '地址', + 'aboutManage.form.addressRequired': '请输入地址', + 'aboutManage.form.addressPlaceholder': '请输入地址', + 'aboutManage.form.contactsPhone': '联系电话', + 'aboutManage.form.contactsPhoneRequired': '请输入联系电话', + 'aboutManage.form.contactsPhonePlaceholder': '请输入联系电话', + 'aboutManage.form.contactsEmail': '联系邮箱', + 'aboutManage.form.contactsEmailRequired': '请输入联系邮箱', + 'aboutManage.form.contactsEmailPlaceholder': '请输入联系邮箱', + 'aboutManage.form.contactsConsult': '咨询方式', + 'aboutManage.form.contactsConsultRequired': '请输入咨询方式', + 'aboutManage.form.contactsConsultPlaceholder': '请输入咨询方式', + + // 英文表单项 + 'aboutManage.form.titleEn': '标题(英文)', + 'aboutManage.form.titleEnRequired': '请输入英文标题', + 'aboutManage.form.titleEnPlaceholder': '请输入英文标题', + 'aboutManage.form.contentEn': '正文内容(英文)', + 'aboutManage.form.contentEnRequired': '请输入英文正文内容', + 'aboutManage.form.contentEnPlaceholder': '请输入英文正文内容...', + 'aboutManage.form.addressEn': '地址(英文)', + 'aboutManage.form.addressEnRequired': '请输入英文地址', + 'aboutManage.form.addressEnPlaceholder': '请输入英文地址', + 'aboutManage.form.contactsPhoneEn': '联系电话(英文)', + 'aboutManage.form.contactsPhoneEnRequired': '请输入英文联系电话', + 'aboutManage.form.contactsPhoneEnPlaceholder': '请输入英文联系电话', + 'aboutManage.form.contactsEmailEn': '联系邮箱(英文)', + 'aboutManage.form.contactsEmailEnRequired': '请输入英文联系邮箱', + 'aboutManage.form.contactsEmailEnPlaceholder': '请输入英文联系邮箱', + 'aboutManage.form.contactsConsultEn': '咨询方式(英文)', + 'aboutManage.form.contactsConsultEnRequired': '请输入英文咨询方式', + 'aboutManage.form.contactsConsultEnPlaceholder': '请输入英文咨询方式', +}; diff --git a/src/locales/zh-CN/common.ts b/src/locales/zh-CN/common.ts index 4cbdde7..b6b6afc 100644 --- a/src/locales/zh-CN/common.ts +++ b/src/locales/zh-CN/common.ts @@ -27,4 +27,8 @@ export default { "采购失败(流标)公告": "采购失败(流标)公告", "加载更多": "加载更多", "登录/注册": "登录/注册", + + // 按钮 + "common.confirm": "确定", + "common.cancel": "取消", }; diff --git a/src/locales/zh-CN/friendLink.ts b/src/locales/zh-CN/friendLink.ts index 28c1de4..97b09b6 100644 --- a/src/locales/zh-CN/friendLink.ts +++ b/src/locales/zh-CN/friendLink.ts @@ -2,14 +2,94 @@ export default { // 友情链接管理页面 'friendLink.title': '友情链接管理', 'friendLink.name': '名称', + 'friendLink.nameEn': '英文名称', 'friendLink.url': '链接地址', 'friendLink.logo': '图标', + 'friendLink.thumbnail': '缩略图', 'friendLink.sort': '排序', 'friendLink.status': '状态', + 'friendLink.category': '所属分类', 'friendLink.operation': '操作', 'friendLink.add': '新增链接', 'friendLink.edit': '编辑链接', 'friendLink.delete': '删除链接', + 'friendLink.batchDelete': '批量删除', + 'friendLink.enable': '启用', + 'friendLink.disable': '禁用', 'friendLink.enabled': '已启用', 'friendLink.disabled': '已禁用', + 'friendLink.selectedCount': '已选择 {count} 项', + + // 表单相关 + 'friendLink.form.name.required': '请输入链接名称', + 'friendLink.form.name.placeholder': '请输入链接名称', + 'friendLink.form.nameEn.required': '请输入英文名称', + 'friendLink.form.nameEn.placeholder': '请输入英文名称', + 'friendLink.form.category.required': '请选择所属分类', + 'friendLink.form.category.placeholder': '请选择所属分类', + 'friendLink.form.url.required': '请输入链接地址', + 'friendLink.form.url.invalid': '请输入有效的URL地址', + 'friendLink.form.url.placeholder': '请输入链接地址,以http://或https://开头', + 'friendLink.form.thumbnail.required': '请上传缩略图', + 'friendLink.form.thumbnail.upload': '上传缩略图', + 'friendLink.form.sort.required': '请输入排序值', + 'friendLink.form.sort.placeholder': '请输入排序值,数字越小越靠前', + + // 操作提示 + 'friendLink.delete.confirm.title': '删除确认', + 'friendLink.delete.confirm.content': '确定要删除该友情链接吗?', + 'friendLink.delete.success': '删除成功', + 'friendLink.batchDelete.empty': '请选择要删除的项', + 'friendLink.batchDelete.confirm.title': '批量删除确认', + 'friendLink.batchDelete.confirm.content': '确定要删除选中的 {count} 项吗?', + 'friendLink.batchDelete.success': '批量删除成功', + 'friendLink.add.success': '添加成功', + 'friendLink.update.success': '更新成功', + 'friendLink.enable.success': '启用成功', + 'friendLink.disable.success': '禁用成功', + 'friendLink.enable.confirm.title': '启用确认', + 'friendLink.enable.confirm.content': '确定要启用该友情链接吗?', + 'friendLink.disable.confirm.title': '禁用确认', + 'friendLink.disable.confirm.content': '确定要禁用该友情链接吗?', + + // 友情链接分类管理 + 'friendLink.category.title': '友情链接分类管理', + 'friendLink.category.name': '分类名称', + 'friendLink.category.level': '层级', + 'friendLink.category.sort': '排序', + 'friendLink.category.parentCategory': '父级分类', + 'friendLink.category.operation': '操作', + 'friendLink.category.add': '新增分类', + 'friendLink.category.addChild': '新增子类', + 'friendLink.category.edit': '编辑', + 'friendLink.category.delete': '删除', + 'friendLink.category.form.title.add': '新增分类', + 'friendLink.category.form.title.addChild': '新增子分类', + 'friendLink.category.form.title.edit': '编辑分类', + 'friendLink.category.form.name': '分类名称', + 'friendLink.category.form.name.placeholder': '请输入分类名称', + 'friendLink.category.form.name.required': '请输入分类名称', + 'friendLink.category.form.parentCategory': '父级分类', + 'friendLink.category.form.parentCategory.placeholder': '请选择父级分类', + 'friendLink.category.form.parentCategory.required': '请选择父级分类', + 'friendLink.category.form.sort': '排序', + 'friendLink.category.form.sort.placeholder': '请输入排序值,数字越小越靠前', + 'friendLink.category.form.sort.required': '请输入排序值', + 'friendLink.category.delete.confirm.title': '删除分类', + 'friendLink.category.delete.confirm.content': '确定要删除分类"{name}"吗?', + 'friendLink.category.delete.hasChildren': '该分类下有子分类,不能直接删除', + 'friendLink.category.delete.success': '删除成功', + 'friendLink.category.add.success': '添加成功', + 'friendLink.category.update.success': '更新成功', + + // 分类类型 + 'friendLink.category.type': '类型', + 'friendLink.category.type.normal': '普通展示', + 'friendLink.category.type.featured': '重点展示', + 'friendLink.category.form.type': '分类类型', + 'friendLink.category.form.type.placeholder': '请选择分类类型', + 'friendLink.category.form.type.required': '请选择分类类型', + 'friendLink.category.form.remark': '备注', + 'friendLink.category.form.remark.placeholder': '请输入备注信息', + 'friendLink.category.form.remark.required': '请输入备注信息', }; diff --git a/src/locales/zh-CN/helpCenter.ts b/src/locales/zh-CN/helpCenter.ts deleted file mode 100644 index ee5830a..0000000 --- a/src/locales/zh-CN/helpCenter.ts +++ /dev/null @@ -1,22 +0,0 @@ -export default { - // 帮助中心页面 - 'helpCenter.title': '帮助中心管理', - 'helpCenter.question': '问题', - 'helpCenter.category': '问题类型', - 'helpCenter.createTime': '创建时间', - 'helpCenter.updateTime': '更新时间', - 'helpCenter.status': '状态', - 'helpCenter.operation': '操作', - 'helpCenter.edit': '编辑', - 'helpCenter.delete': '删除', - 'helpCenter.add': '新增', - 'helpCenter.search': '搜索', - 'helpCenter.all': '全部', - 'helpCenter.published': '已发布', - 'helpCenter.unpublished': '未发布', - 'helpCenter.draft': '草稿', - 'helpCenter.publish': '发布', - 'helpCenter.unpublish': '下架', - 'helpCenter.confirmDelete': '确定要删除该帮助吗?', - 'helpCenter.batchDelete': '确定要批量删除选中的帮助吗?', -}; diff --git a/src/locales/zh-CN/helpManage.ts b/src/locales/zh-CN/helpManage.ts new file mode 100644 index 0000000..0067485 --- /dev/null +++ b/src/locales/zh-CN/helpManage.ts @@ -0,0 +1,108 @@ +export default { + // 帮助中心管理列表页 + 'helpManage.title': '帮助中心管理', + 'helpManage.serialNumber': '序号', + 'helpManage.title.label': '标题', + 'helpManage.category': '问题类型', + 'helpManage.date': '日期', + 'helpManage.status': '状态', + 'helpManage.publisher': '发布人', + 'helpManage.operation': '操作', + 'helpManage.view': '查看', + 'helpManage.edit': '编辑', + 'helpManage.publish': '发布', + 'helpManage.unpublish': '下架', + 'helpManage.delete': '删除', + 'helpManage.top': '置顶', + 'helpManage.untop': '取消置顶', + 'helpManage.add': '新增', + 'helpManage.search': '搜索', + 'helpManage.reset': '重置', + 'helpManage.submit': '提交', + 'helpManage.cancel': '取消', + 'helpManage.confirmDelete': '确定要删除该帮助吗?', + 'helpManage.batchDelete': '确定要批量删除选中的帮助吗?', + 'helpManage.confirmPublish': '确定要发布该帮助吗?', + 'helpManage.confirmUnpublish': '确定要下架该帮助吗?', + 'helpManage.confirmTop': '确定要置顶该帮助吗?', + 'helpManage.confirmUntop': '确定要取消置顶该帮助吗?', + 'helpManage.publishSuccess': '发布成功', + 'helpManage.unpublishSuccess': '下架成功', + 'helpManage.publishFailed': '发布失败', + 'helpManage.unpublishFailed': '下架失败', + 'helpManage.topSuccess': '置顶成功', + 'helpManage.untopSuccess': '取消置顶成功', + 'helpManage.topFailed': '置顶失败', + 'helpManage.untopFailed': '取消置顶失败', + 'helpManage.deleteSuccess': '删除成功', + 'helpManage.deleteFailed': '删除失败', + 'helpManage.batchDeleteSuccess': '批量删除成功', + 'helpManage.batchDeleteFailed': '批量删除失败', + 'helpManage.addSuccess': '添加成功', + 'helpManage.addFailed': '添加失败', + 'helpManage.updateSuccess': '更新成功', + 'helpManage.updateFailed': '更新失败', + 'helpManage.fetchFailed': '获取帮助中心列表失败', + 'helpManage.fetchDetailFailed': '获取详情失败', + 'helpManage.noDeleteItems': '没有可删除的帮助', + 'helpManage.selectedCount': '已选择 {count} 项', + 'helpManage.publishedNoEdit': '已发布的帮助不能编辑', + 'helpManage.publishedNoDelete': '已发布的帮助不能删除', + 'helpManage.deleteConfirmTitle': '标题', + 'helpManage.deleteConfirmContent': '删除后无法恢复', + 'helpManage.searchTitlePlaceholder': '请输入标题关键词', + 'helpManage.searchCategoryPlaceholder': '请选择问题类型', + 'helpManage.searchStatusPlaceholder': '请选择状态', + + // 帮助中心表单 + 'helpManage.form.isTop': '是否置顶', + 'helpManage.form.category': '问题类型', + 'helpManage.form.categoryRequired': '请选择问题类型', + 'helpManage.form.categoryPlaceholder': '请选择问题类型', + 'helpManage.form.chineseTab': '中文版', + 'helpManage.form.englishTab': '英文版', + 'helpManage.form.titleZh': '标题(中文)', + 'helpManage.form.titleZhRequired': '请输入中文标题', + 'helpManage.form.titleZhPlaceholder': '请输入中文标题', + 'helpManage.form.contentZh': '内容(中文)', + 'helpManage.form.contentZhRequired': '请输入中文内容', + 'helpManage.form.contentZhPlaceholder': '请输入帮助内容...', + 'helpManage.form.answerContentZh': '回答内容(中文)', + 'helpManage.form.answerContentZhPlaceholder': '请输入回答内容...', + 'helpManage.form.titleEn': '标题(英文)', + 'helpManage.form.titleEnRequired': '请输入英文标题', + 'helpManage.form.titleEnPlaceholder': '请输入英文标题', + 'helpManage.form.contentEn': '内容(英文)', + 'helpManage.form.contentEnRequired': '请输入英文内容', + 'helpManage.form.contentEnPlaceholder': '请输入英文帮助内容...', + 'helpManage.form.answerContentEn': '回答内容(英文)', + 'helpManage.form.answerContentEnPlaceholder': '请输入英文回答内容...', + + // 帮助中心详情 + 'helpManage.detail.title': '标题', + 'helpManage.detail.titleEn': '英文标题', + 'helpManage.detail.category': '问题类型', + 'helpManage.detail.isTop': '是否置顶', + 'helpManage.detail.status': '状态', + 'helpManage.detail.creator': '创建人', + 'helpManage.detail.createTime': '创建时间', + 'helpManage.detail.updateTime': '更新时间', + 'helpManage.detail.contentZh': '问题内容(中文)', + 'helpManage.detail.contentEn': '问题内容(英文)', + 'helpManage.detail.answerContentZh': '回答内容(中文)', + 'helpManage.detail.answerContentEn': '回答内容(英文)', + 'helpManage.detail.yes': '是', + 'helpManage.detail.no': '否', + + // 帮助状态 + 'helpManage.status.draft': '草稿', + 'helpManage.status.published': '已发布', + 'helpManage.status.unpublished': '已下架', + 'helpManage.status.unknown': '未知', + + // 帮助分类 + 'helpManage.category.registerGuide': '注册指南', + 'helpManage.category.biddingGuide': '投标指南', + 'helpManage.category.faq': '常见问题', + 'helpManage.category.contactUs': '联系我们', +}; diff --git a/src/locales/zh-CN/policyManage.ts b/src/locales/zh-CN/policyManage.ts new file mode 100644 index 0000000..c72b663 --- /dev/null +++ b/src/locales/zh-CN/policyManage.ts @@ -0,0 +1,86 @@ +export default { + // 政策法规管理列表页 + 'policyManage.title': '政策法规管理', + 'policyManage.serialNumber': '序号', + 'policyManage.title.label': '标题', + 'policyManage.date': '日期', + 'policyManage.status': '状态', + 'policyManage.publisher': '发布人', + 'policyManage.operation': '操作', + 'policyManage.view': '查看', + 'policyManage.edit': '编辑', + 'policyManage.publish': '发布', + 'policyManage.unpublish': '下架', + 'policyManage.delete': '删除', + 'policyManage.top': '置顶', + 'policyManage.add': '新增', + 'policyManage.search': '搜索', + 'policyManage.reset': '重置', + 'policyManage.submit': '提交', + 'policyManage.cancel': '取消', + 'policyManage.close': '关闭', + 'policyManage.confirmDelete': '确定要删除该政策吗?', + 'policyManage.confirmDeleteBatch': '确定要删除选中的政策吗?', + 'policyManage.confirmPublish': '确定要发布该政策吗?', + 'policyManage.confirmUnpublish': '确定要下架该政策吗?', + 'policyManage.deleteSuccess': '删除成功', + 'policyManage.deleteFailed': '删除失败', + 'policyManage.batchDeleteSuccess': '删除成功', + 'policyManage.batchDeletePartialFailed': '部分删除失败,请刷新后重试', + 'policyManage.batchDeleteFailed': '批量删除失败', + 'policyManage.publishSuccess': '发布成功', + 'policyManage.unpublishSuccess': '下架成功', + 'policyManage.publishFailed': '发布失败', + 'policyManage.unpublishFailed': '下架失败', + 'policyManage.fetchFailed': '获取数据失败', + 'policyManage.fetchDetailFailed': '获取详情失败', + 'policyManage.deleteConfirmTitle': '标题', + 'policyManage.deleteConfirmContent': '删除后无法恢复', + 'policyManage.selectedCount': '已选择 {count} 项', + 'policyManage.searchTitlePlaceholder': '请输入标题关键词', + 'policyManage.searchStatusPlaceholder': '请选择状态', + + // 政策法规表单页 + 'policyManage.form.title': '政策法规', + 'policyManage.form.add': '新增政策法规', + 'policyManage.form.edit': '编辑政策法规', + 'policyManage.form.view': '查看政策法规', + 'policyManage.form.isTop': '是否置顶', + 'policyManage.form.chineseTab': '中文版', + 'policyManage.form.englishTab': '英文版', + 'policyManage.form.titleZh': '标题(中文)', + 'policyManage.form.titleZhRequired': '请输入中文标题', + 'policyManage.form.titleZhPlaceholder': '请输入中文标题', + 'policyManage.form.contentZh': '正文内容(中文)', + 'policyManage.form.contentZhRequired': '请输入中文正文', + 'policyManage.form.contentZhPlaceholder': '请输入中文正文内容...', + 'policyManage.form.titleEn': '标题(英文)', + 'policyManage.form.titleEnRequired': '请输入英文标题', + 'policyManage.form.titleEnPlaceholder': '请输入英文标题', + 'policyManage.form.contentEn': '正文内容(英文)', + 'policyManage.form.contentEnRequired': '请输入英文正文', + 'policyManage.form.contentEnPlaceholder': '请输入英文正文内容...', + 'policyManage.form.addSuccess': '添加成功', + 'policyManage.form.updateSuccess': '更新成功', + 'policyManage.form.addFailed': '添加失败', + 'policyManage.form.updateFailed': '更新失败', + + // 政策法规详情页 + 'policyManage.detail.title': '标题', + 'policyManage.detail.titleEn': '英文标题', + 'policyManage.detail.isTop': '是否置顶', + 'policyManage.detail.status': '状态', + 'policyManage.detail.creator': '创建人', + 'policyManage.detail.createTime': '创建时间', + 'policyManage.detail.updateTime': '更新时间', + 'policyManage.detail.contentZh': '中文内容', + 'policyManage.detail.contentEn': '英文内容', + 'policyManage.detail.yes': '是', + 'policyManage.detail.no': '否', + + // 政策状态 + 'policyManage.status.draft': '草稿', + 'policyManage.status.published': '已发布', + 'policyManage.status.unpublished': '已下架', + 'policyManage.status.unknown': '未知', +}; diff --git a/src/pages/aboutManage/aboutManage.tsx b/src/pages/aboutManage/aboutManage.tsx index 82ff7fd..24fa78c 100644 --- a/src/pages/aboutManage/aboutManage.tsx +++ b/src/pages/aboutManage/aboutManage.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { useIntl } from 'umi'; +import { useIntl, FormattedMessage } from 'umi'; import { Card, Form, Input, Button, message, Tabs, Spin } from 'antd'; import WangEditor from '@/components/WangEidtor/WangEidtor'; import { getAboutUs, updateAboutUs, AboutUsRequest } from '@/servers/api/about'; @@ -7,6 +7,14 @@ import './aboutManage.less'; const { TabPane } = Tabs; +interface ErrorInfo { + errorFields: { + name: string[]; + errors: string[]; + }[]; + values: Record; +} + const AboutManage: React.FC = () => { const intl = useIntl(); const [form] = Form.useForm(); @@ -38,11 +46,11 @@ const AboutManage: React.FC = () => { contactsConsultEn: response.data.contactsConsultEn, }); } else { - message.error(response.message || '获取数据失败'); + message.error(response.message || intl.formatMessage({ id: 'aboutManage.fetchFailed' })); } } catch (error) { console.error('获取关于我们数据失败:', error); - message.error('获取数据失败'); + message.error(intl.formatMessage({ id: 'aboutManage.fetchFailed' })); } finally { setLoading(false); } @@ -75,12 +83,12 @@ const AboutManage: React.FC = () => { const response = await updateAboutUs(submitData); if (response && response.success) { - message.success('保存成功'); + message.success(intl.formatMessage({ id: 'aboutManage.saveSuccess' })); fetchAboutData(); // 刷新数据 } else { - message.error(response.message || '保存失败'); + message.error(response.message || intl.formatMessage({ id: 'aboutManage.saveFailed' })); } - } catch (errorInfo) { + } catch (errorInfo: any) { // 获取所有字段的错误信息 const errorFields = errorInfo.errorFields || []; @@ -116,14 +124,14 @@ const AboutManage: React.FC = () => { return (
- 保存 + {intl.formatMessage({ id: 'aboutManage.save' })} } > @@ -134,110 +142,110 @@ const AboutManage: React.FC = () => { initialValues={aboutData || {}} > - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/src/pages/friendLinkManage/friendLinkCategory.tsx b/src/pages/friendLinkManage/friendLinkCategory.tsx index 7c44fe8..9076ab0 100644 --- a/src/pages/friendLinkManage/friendLinkCategory.tsx +++ b/src/pages/friendLinkManage/friendLinkCategory.tsx @@ -1,323 +1,201 @@ import React, { useState, useEffect } from 'react'; import { useIntl } from 'umi'; -import { Card, Table, Button, Modal, Form, Input, Space, message, Select, TreeSelect } from 'antd'; +import { Card, Table, Button, Modal, Form, Input, Space, message, Select, TreeSelect, Popconfirm, Tag } from 'antd'; import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined, EditOutlined } from '@ant-design/icons'; +import { getCategoryList, getAllCategories, addCategory, updateCategory, deleteCategory } from '@/servers/api/friendLink'; +import { useFriendLinkDict } from '@/dicts/friendLinkDict'; import './friendLinkManage.less'; const { Option } = Select; +const { TextArea } = Input; -// 友情链接分类类型定义 -interface CategoryType { - id: string; - name: string; - parentId: string | null; - level: number; - sort: number; - children?: CategoryType[]; - key?: string; -} +// 友情链接分类类型定义已移至全局typings.d.ts const FriendLinkCategory: React.FC = () => { const intl = useIntl(); + const { categoryTypeOptions, getCategoryTypeText } = useFriendLinkDict(); const [loading, setLoading] = useState(false); const [modalVisible, setModalVisible] = useState(false); const [isEdit, setIsEdit] = useState(false); - const [isAddChild, setIsAddChild] = useState(false); - const [currentCategory, setCurrentCategory] = useState(null); - const [categoryData, setCategoryData] = useState([]); + const [currentCategory, setCurrentCategory] = useState(null); + const [categoryData, setCategoryData] = useState([]); + const [pagination, setPagination] = useState({ + current: 1, + pageSize: 10, + total: 0, + }); const [form] = Form.useForm(); - // 模拟分类数据 - const mockCategories: CategoryType[] = [ - { - id: '1', - name: '政府机构', - parentId: null, - level: 1, - sort: 1, - children: [ - { - id: '1-1', - name: '中央部委', - parentId: '1', - level: 2, - sort: 1, - }, - { - id: '1-2', - name: '地方政府', - parentId: '1', - level: 2, - sort: 2, - children: [ - { - id: '1-2-1', - name: '省级政府', - parentId: '1-2', - level: 3, - sort: 1, - }, - { - id: '1-2-2', - name: '市级政府', - parentId: '1-2', - level: 3, - sort: 2, - } - ] - } - ] - }, - { - id: '2', - name: '港口集团', - parentId: null, - level: 1, - sort: 2, - children: [ - { - id: '2-1', - name: '沿海港口', - parentId: '2', - level: 2, - sort: 1, - }, - { - id: '2-2', - name: '内河港口', - parentId: '2', - level: 2, - sort: 2, - } - ] - }, - { - id: '3', - name: '航运企业', - parentId: null, - level: 1, - sort: 3, - } - ]; - // 获取分类列表 - const fetchCategoryList = () => { + const fetchCategoryList = async (pageNo = 1, pageSize = 10) => { setLoading(true); - // 实际项目中应调用API - setTimeout(() => { - // 为每个节点添加key属性,用于Table组件 - const processData = (data: CategoryType[]): CategoryType[] => { - return data.map(item => { - const newItem = { ...item, key: item.id }; - if (item.children && item.children.length > 0) { - newItem.children = processData(item.children); - } - return newItem; - }); - }; + try { + const res = await getCategoryList({ + basePageRequest: { + pageNo, + pageSize, + }, + }); - const processedData = processData(mockCategories); - setCategoryData(processedData); + if (res.data && res.success) { + setCategoryData(res.data.records); + setPagination({ + current: res.data.current, + pageSize: res.data.size, + total: res.data.total, + }); + } + } catch (error) { + console.error('Failed to fetch category list', error); + } finally { setLoading(false); - }, 500); + } }; // 首次加载时获取数据 useEffect(() => { fetchCategoryList(); }, []); - - // 获取所有分类(扁平化)用于选择父分类 - const getAllCategories = (categories: CategoryType[] = categoryData, result: CategoryType[] = []): CategoryType[] => { - categories.forEach(category => { - result.push(category); - if (category.children && category.children.length > 0) { - getAllCategories(category.children, result); - } - }); - return result; + // 处理分页变化 + const handleTableChange = (paginationParams: any) => { + fetchCategoryList(paginationParams.current, paginationParams.pageSize); }; // 处理添加分类 const handleAddCategory = () => { setIsEdit(false); - setIsAddChild(false); setCurrentCategory(null); form.resetFields(); - setModalVisible(true); - }; - - // 处理添加子分类 - const handleAddChildCategory = (record: CategoryType) => { - setIsEdit(false); - setIsAddChild(true); - setCurrentCategory(record); - form.resetFields(); form.setFieldsValue({ - parentId: record.id, + parentId: '0', // 设置默认父级为顶级 + type: '0', // 设置默认类型为普通展示 + orderBy: '1', // 设置默认排序为1 }); setModalVisible(true); }; // 处理编辑分类 - const handleEditCategory = (record: CategoryType) => { + const handleEditCategory = (record: API.CategoryType) => { setIsEdit(true); - setIsAddChild(false); setCurrentCategory(record); form.setFieldsValue({ name: record.name, + type: record.type, parentId: record.parentId, - sort: record.sort, + orderBy: record.orderBy, + remark: record.remark, }); setModalVisible(true); }; // 处理删除分类 - const handleDeleteCategory = (record: CategoryType) => { - // 检查是否有子分类 - if (record.children && record.children.length > 0) { - message.error('该分类下有子分类,不能直接删除'); - return; + const handleDeleteCategory = async (id: string) => { + try { + const res = await deleteCategory(id); + if (res.success) { + message.success(intl.formatMessage({ id: 'friendLink.category.delete.success' })); + fetchCategoryList(pagination.current, pagination.pageSize); + } + } catch (error) { + console.error('Failed to delete category', error); } + }; + // 显示删除确认框 + const showDeleteConfirm = (record: API.CategoryType) => { Modal.confirm({ - title: '删除分类', + title: intl.formatMessage({ id: 'friendLink.category.delete.confirm.title' }), icon: , - content: `确定要删除分类"${record.name}"吗?`, - okText: '确定', + content: intl.formatMessage( + { id: 'friendLink.category.delete.confirm.content' }, + { name: record.name } + ), + okText: intl.formatMessage({ id: 'common.confirm' }), okType: 'danger', - cancelText: '取消', + cancelText: intl.formatMessage({ id: 'common.cancel' }), onOk() { - // 实际项目中应调用API - // 递归查找并删除分类 - const deleteCategory = (data: CategoryType[], id: string): CategoryType[] => { - return data.filter(item => { - if (item.id === id) { - return false; - } - if (item.children && item.children.length > 0) { - item.children = deleteCategory(item.children, id); - } - return true; - }); - }; - - const newData = deleteCategory(categoryData, record.id); - setCategoryData(newData); - message.success('删除成功'); + handleDeleteCategory(record.id); }, }); }; // 处理表单提交 const handleModalSubmit = () => { - form.validateFields().then(values => { - // 准备提交数据 - const formData = { - ...values, - level: values.parentId ? (isAddChild ? currentCategory!.level + 1 : 2) : 1, - }; - - if (isEdit && currentCategory) { - // 编辑模式 - // 递归更新分类 - const updateCategory = (data: CategoryType[], id: string, newData: any): CategoryType[] => { - return data.map(item => { - if (item.id === id) { - return { ...item, ...newData }; - } - if (item.children && item.children.length > 0) { - item.children = updateCategory(item.children, id, newData); - } - return item; + form.validateFields().then(async (values) => { + try { + if (isEdit && currentCategory) { + // 编辑模式 + const res = await updateCategory({ + ...values, + id: currentCategory.id, }); - }; - - const newData = updateCategory(categoryData, currentCategory.id, formData); - setCategoryData(newData); - message.success('更新成功'); - } else { - // 新增模式 - const newId = isAddChild - ? `${currentCategory!.id}-${Date.now().toString().substr(-4)}` - : (categoryData.length + 1).toString(); - - const newCategory: CategoryType = { - id: newId, - name: formData.name, - parentId: formData.parentId, - level: formData.level, - sort: formData.sort || 99, - key: newId, - }; - - if (formData.parentId) { - // 有父分类,需要将新分类添加到父分类的children中 - const addChildToParent = (data: CategoryType[], parentId: string, newChild: CategoryType): CategoryType[] => { - return data.map(item => { - if (item.id === parentId) { - if (!item.children) { - item.children = []; - } - item.children.push(newChild); - return item; - } - if (item.children && item.children.length > 0) { - item.children = addChildToParent(item.children, parentId, newChild); - } - return item; - }); - }; - - const newData = addChildToParent(categoryData, formData.parentId, newCategory); - setCategoryData(newData); + if (res.success) { + message.success(intl.formatMessage({ id: 'friendLink.category.update.success' })); + setModalVisible(false); + fetchCategoryList(pagination.current, pagination.pageSize); + } } else { - // 无父分类,直接添加到顶级 - setCategoryData([...categoryData, newCategory]); + // 新增模式 + const res = await addCategory(values); + if (res.success) { + message.success(intl.formatMessage({ id: 'friendLink.category.add.success' })); + setModalVisible(false); + fetchCategoryList(pagination.current, pagination.pageSize); + } } - - message.success('添加成功'); + } catch (error) { + console.error('Submit failed', error); } - - setModalVisible(false); - form.resetFields(); }); }; + // 渲染分类类型标签 + const renderCategoryType = (type: string) => { + const color = type === '1' ? 'blue' : 'default'; + return ( + + {getCategoryTypeText(type)} + + ); + }; + // 表格列定义 const columns = [ { - title: '分类名称', + title: intl.formatMessage({ id: 'friendLink.category.name' }), dataIndex: 'name', key: 'name', }, { - title: '层级', - dataIndex: 'level', - key: 'level', + title: intl.formatMessage({ id: 'friendLink.category.type' }), + dataIndex: 'type', + key: 'type', + render: (type: string) => renderCategoryType(type), + }, + { + title: intl.formatMessage({ id: 'friendLink.category.sort' }), + dataIndex: 'orderBy', + key: 'orderBy', width: 100, }, { - title: '排序', - dataIndex: 'sort', - key: 'sort', - width: 100, - sorter: (a: CategoryType, b: CategoryType) => a.sort - b.sort, + title: intl.formatMessage({ id: 'friendLink.category.form.remark' }), + dataIndex: 'remark', + key: 'remark', + width: 200, + ellipsis: true, }, { - title: '操作', + title: intl.formatMessage({ id: 'friendLink.category.operation' }), key: 'operation', - width: 250, - render: (_: any, record: CategoryType) => ( + width: 150, + render: (_: any, record: API.CategoryType) => ( - - - ), @@ -328,7 +206,7 @@ const FriendLinkCategory: React.FC = () => {
@@ -338,16 +216,18 @@ const FriendLinkCategory: React.FC = () => { columns={columns} dataSource={categoryData} loading={loading} - pagination={false} - expandable={{ - defaultExpandAllRows: true - }} + pagination={pagination} + onChange={handleTableChange} />
{/* 新增/编辑分类模态框 */} setModalVisible(false)} @@ -359,46 +239,63 @@ const FriendLinkCategory: React.FC = () => { > - + - ({ - title: item.name, - value: item.id, - disabled: isEdit && currentCategory ? (item.id === currentCategory.id || item.parentId === currentCategory.id) : false, - children: item.children?.map(child => ({ - title: child.name, - value: child.id, - disabled: isEdit && currentCategory ? (child.id === currentCategory.id || child.parentId === currentCategory.id) : false, - children: child.children?.map(grandChild => ({ - title: grandChild.name, - value: grandChild.id, - disabled: isEdit && currentCategory ? (grandChild.id === currentCategory.id || grandChild.parentId === currentCategory.id) : false, - })) - })) - }))} - disabled={isAddChild} + + + + {/* 父级分类项,已完全隐藏 */} + + + + - +