From ce345c73472cbf41d9118ce11ae75b9913da030e Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 24 Jun 2024 09:25:47 +0800 Subject: [PATCH] =?UTF-8?q?HT=E8=AF=AD=E7=A7=8D;=20=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E8=AF=AD=E7=A7=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...seLanguageSets.js => useHTLanguageSets.js} | 2 +- src/hooks/useProductsSets.js | 67 ++++++++++++++----- src/i18n/LanguageSwitcher.jsx | 5 ++ 3 files changed, 56 insertions(+), 18 deletions(-) rename src/hooks/{useLanguageSets.js => useHTLanguageSets.js} (90%) diff --git a/src/hooks/useLanguageSets.js b/src/hooks/useHTLanguageSets.js similarity index 90% rename from src/hooks/useLanguageSets.js rename to src/hooks/useHTLanguageSets.js index 1dab4b1..73b827e 100644 --- a/src/hooks/useLanguageSets.js +++ b/src/hooks/useHTLanguageSets.js @@ -1,4 +1,4 @@ -export const useLanguageSets = () => { +export const useHTLanguageSets = () => { const newData = [ { key: '1', value: '1', label: 'English' }, { key: '2', value: '2', label: 'Chinese (中文)' }, diff --git a/src/hooks/useProductsSets.js b/src/hooks/useProductsSets.js index 5f3a85b..35cd3f5 100644 --- a/src/hooks/useProductsSets.js +++ b/src/hooks/useProductsSets.js @@ -4,20 +4,39 @@ import { useTranslation } from 'react-i18next'; /** * 产品管理 相关的预设数据 * 项目类型 -1 酒店预定 -2 火车 -3 飞机票务 -4 游船 -5 快巴 -6 旅行社(综费) - -7 景点 - -8 特殊项目 - -9 其他 -A 酒店 -B 超公里 - -C 餐费 - -D 包价包 -X 站 +酒店预定 1 +火车 2 +飞机票务 3 +游船 4 +快巴 5 +旅行社(综费) 6 +景点 7 +特殊项目 8 +其他 9 +酒店 A +超公里 B +餐费 C +小包价 D +站 X +购物 S +餐 R +娱乐 E +精华线路 T +客人testimonial F +线路订单 O +省 P +信息 I +国家 G +城市 K +图片 H +地图 M +包价线路 L +节日节庆 V +火车站 N +手机租赁 Z + * * todo: webht 类型 +P 导游 +T 车费 */ export const useProductsTypes = () => { @@ -28,8 +47,8 @@ export const useProductsTypes = () => { const newData = [ { label: t('products:type.Experience'), value: '6', key: '6' }, { label: t('products:type.Overtravel'), value: 'B', key: 'B' }, - { label: t('products:type.Car'), value: 'Car', key: 'Car' }, - { label: t('products:type.Guide'), value: 'Guide', key: 'Guide' }, + { label: t('products:type.Car'), value: 'T', key: 'T' }, + { label: t('products:type.Guide'), value: 'P', key: 'P' }, { label: t('products:type.Package'), value: 'D', key: 'D' }, { label: t('products:type.Attractions'), value: '7', key: '7' }, { label: t('products:type.Meals'), value: 'C', key: 'C' }, @@ -42,7 +61,6 @@ export const useProductsTypes = () => { return types; }; - export const useProductsAuditStates = () => { const [types, setTypes] = useState([]); const { t, i18n } = useTranslation(); @@ -66,3 +84,18 @@ export const useProductsAuditStatesMapVal = (value) => { const stateMapVal = stateSets.reduce((r, c) => ({ ...r, [`${c.value}`]: c }), {}); return stateMapVal; }; + +export const useProductsTypesFieldsets = (type, role) => { + const infoDefault = ['code', 'title']; + const infoAdmin = ['remarks', 'dept']; + const infoTypesMap = { + '6': [], + 'B': ['city_id', 'km'], + '车费': ['description', 'city_id', 'recommends_rate', 'duration', 'display_to_c'], // todo: 包价类型?? + '导游': ['description', 'city_id', 'duration', ], + 'D': [], //todo: 木有图 + '7': ['description', 'city_id', 'recommends_rate', 'duration', 'display_to_c', 'open_weekdays'], // todo: 怎么是2个图 + 'C': ['description', 'city_id',], + '8': [], // todo: ? + }; +}; diff --git a/src/i18n/LanguageSwitcher.jsx b/src/i18n/LanguageSwitcher.jsx index af87005..dd1a743 100644 --- a/src/i18n/LanguageSwitcher.jsx +++ b/src/i18n/LanguageSwitcher.jsx @@ -8,6 +8,11 @@ const i18n_to_htcode = { 'en': 1, }; +export const useLanguage = () => { + const { i18n } = useTranslation(); + return { language: i18n.language, }; +}; + /** * 语言选择组件 */