diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 8ed1854..c87b7cd 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -26,8 +26,9 @@ "Export": "Export", "Copy": "Copy", - "sureCancel": "Sure you want to cancel?", - "sureDelete":"Sure you want to delete?", + "sureCancel": "Are you sure to cancel?", + "sureDelete":"Are you sure to delete?", + "Yes": "Yes", "Success": "Success", "Failed": "Failed", diff --git a/public/locales/en/products.json b/public/locales/en/products.json index 4997e31..79bb594 100644 --- a/public/locales/en/products.json +++ b/public/locales/en/products.json @@ -39,6 +39,13 @@ "CreateDate": "Create Date", "AuditedBy": "Audited By", "AuditDate": "Audit Date", + "OpenHours": "Open Hours", + "Duration": "Duration", + "KM": "KM", + "RecommendsRate": "RecommendsRate", + "OpenWeekdays": "Open Weekdays", + "DisplayToC": "DisplayToC", + "Dept": "Dept", "productProject": "Product project", "Code": "Code", diff --git a/public/locales/zh/common.json b/public/locales/zh/common.json index 82b43f9..459ff35 100644 --- a/public/locales/zh/common.json +++ b/public/locales/zh/common.json @@ -28,6 +28,7 @@ "sureCancel": "确定取消?", "sureDelete":"确定删除?", + "Yes": "是", "Success": "成功", "Failed": "失败", @@ -62,13 +63,13 @@ "thisYear": "今年" }, "weekdays": { - "1": "一", - "2": "二", - "3": "三", - "4": "四", - "5": "五", - "6": "六", - "7": "日" + "1": "周一", + "2": "周二", + "3": "周三", + "4": "周四", + "5": "周五", + "6": "周六", + "7": "周日" }, "weekdaysShort": { "1": "一", diff --git a/public/locales/zh/products.json b/public/locales/zh/products.json index 55005ce..65cb019 100644 --- a/public/locales/zh/products.json +++ b/public/locales/zh/products.json @@ -37,11 +37,18 @@ "AuState": "审核状态", "CreatedBy": "提交人员", "CreateDate": "提交时间", - - "AuditedBy": "审核人员", "AuditDate": "审核时间", + "OpenHours": "游览时间", + "Duration": "游览时长", + "KM": "公里数", + "RecommendsRate": "推荐指数", + "OpenWeekdays": "周开放日", + "DisplayToC": "报价信显示", + "Dept": "小组", + + "productProject": "产品项目", "Code": "代码", "City": "城市", diff --git a/src/components/SearchForm.jsx b/src/components/SearchForm.jsx index 9f985b9..f896792 100644 --- a/src/components/SearchForm.jsx +++ b/src/components/SearchForm.jsx @@ -3,7 +3,7 @@ import { Form, Input, Row, Col, Select, DatePicker, Space, Button } from 'antd'; import { objectMapper, at } from '@/utils/commons'; import { DATE_FORMAT, SMALL_DATETIME_FORMAT } from '@/config'; import useFormStore from '@/stores/Form'; -import useDatePresets from '@/hooks/useDatePresets'; +import {useDatePresets} from '@/hooks/useDatePresets'; import { useTranslation } from 'react-i18next'; import { fetchJSON } from '@/utils/request'; diff --git a/src/hooks/useDatePresets.js b/src/hooks/useDatePresets.js index 87397b9..2eb4c7d 100644 --- a/src/hooks/useDatePresets.js +++ b/src/hooks/useDatePresets.js @@ -1,8 +1,9 @@ import { useEffect, useState } from 'react'; import dayjs from "dayjs"; import { useTranslation } from 'react-i18next'; +import i18n from '@/i18n'; -const useDatePresets = () => { +export const useDatePresets = () => { const [presets, setPresets] = useState([]); const { t, i18n } = useTranslation(); @@ -39,4 +40,21 @@ const useDatePresets = () => { return presets; } -export default useDatePresets; +export const useWeekdays = () => { + const [data, setData] = useState([]); + const { t, i18n } = useTranslation(); + useEffect(() => { + const newData = [ + { value: '1', label: t('weekdays.1') }, + { value: '2', label: t('weekdays.2') }, + { value: '3', label: t('weekdays.3') }, + { value: '4', label: t('weekdays.4') }, + { value: '5', label: t('weekdays.5') }, + { value: '6', label: t('weekdays.6') }, + { value: '7', label: t('weekdays.7') }, + ]; + setData(newData); + return () => {}; + }, [i18n.language]); + return data; +}; diff --git a/src/views/products/Detail/Extras.jsx b/src/views/products/Detail/Extras.jsx index b5e0f1b..4caf981 100644 --- a/src/views/products/Detail/Extras.jsx +++ b/src/views/products/Detail/Extras.jsx @@ -1,9 +1,9 @@ -import { createContext, useContext, useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import { useParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { App, Table, Button, Modal, Popconfirm } from 'antd'; -import useProductsStore, { getAgencyProductExtrasAction, getAgencyProductsAction, addProductExtraAction, delProductExtrasAction } from '@/stores/Products/Index'; -import { isEmpty, cloneDeep } from '@/utils/commons'; +import { getAgencyProductExtrasAction, getAgencyProductsAction, addProductExtraAction, delProductExtrasAction } from '@/stores/Products/Index'; +import { cloneDeep } from '@/utils/commons'; import SearchForm from '@/components/SearchForm'; import RequireAuth from '@/components/RequireAuth'; @@ -63,7 +63,7 @@ const NewAddonModal = ({ onPick, ...props }) => { return ( <> setOpen(false)} destroyOnClose> @@ -119,14 +119,14 @@ const Extras = ({ productId, onChange, ...props }) => { setExtrasData(prev => [].concat(prev, [item])); // todo: 提交后端; 重复绑定同一个 const newSuccess = await addProductExtraAction({ travel_agency_id, id: productId, extras: [2] }); - newSuccess ? message.success(t('Success')) : message.error(t('Failed')); + newSuccess ? message.success(t('Action')+t('Success')) : message.error(t('Action')+t('Failed')); await handleGetAgencyProductExtras(); } const handleDelAddon = async (item) => { // todo: 提交后端 const delSuccess = await delProductExtrasAction({ travel_agency_id, id: productId, extras: [2] }); - delSuccess ? message.success(t('Success')) : message.error(t('Failed')); + delSuccess ? message.success(t('Action')+t('Success')) : message.error(t('Action')+t('Failed')); await handleGetAgencyProductExtras(); }; @@ -151,7 +151,7 @@ const Extras = ({ productId, onChange, ...props }) => { dataIndex: 'operation', width: '4rem', render: (_, r) => ( - handleDelAddon(r)} > + handleDelAddon(r)} okText={t('Yes')} >