From 116b5671940de7d07646f191984a9f29c5d78c5e Mon Sep 17 00:00:00 2001 From: zhangjianjun Date: Wed, 1 Apr 2026 17:22:35 +0800 Subject: [PATCH] ud --- src/components/layout/JobPage/index.tsx | 31 ++++++++--- src/pages/Join/Campus.tsx | 42 +++++++++----- src/pages/News/NewsPublic.tsx | 74 +++++++++++++------------ src/utils/parsePageConfig.ts | 12 +++- 4 files changed, 100 insertions(+), 59 deletions(-) diff --git a/src/components/layout/JobPage/index.tsx b/src/components/layout/JobPage/index.tsx index 44ebc38..a033af7 100644 --- a/src/components/layout/JobPage/index.tsx +++ b/src/components/layout/JobPage/index.tsx @@ -1,3 +1,4 @@ +import { useStore } from "@/store"; import styles from "./index.module.css"; @@ -14,34 +15,46 @@ type Data = { } export default function JobPage({ data }: { data: Data }) { + const appConfig = useStore((s) => s.appConfig); + const { + jobType = "职位类别", + businessArea = "业务领域", + businessPlate = "所属板块", + recruitNumber = "招聘人数", + jobLocation = "工作地点", + jobDescription = "岗位描述", + requirement = "任职需求", + contact = "联系方式", + } = appConfig?.join?.campus.others || {}; + const { back = "返回" } = appConfig?.__global__?.others return (
window.history.back()}> arrowleft - 返回 + {back}
{data.title}
- 职位类别:{data.jobType} - 业务领域:{data.businessArea} - 所属板块:{data.businessPlate} - 招聘人数:{data.recruitNumber} - 工作地点:{data.jobLocation} + {jobType}:{data.jobType} + {businessArea}:{data.businessArea} + {businessPlate}:{data.businessPlate} + {recruitNumber}:{data.recruitNumber} + {jobLocation}:{data.jobLocation}
-
岗位描述
+
{jobDescription}

-
任职需求
+
{requirement}

-
联系方式
+
{contact}

{data.contact}

diff --git a/src/pages/Join/Campus.tsx b/src/pages/Join/Campus.tsx index cc38657..0a66559 100644 --- a/src/pages/Join/Campus.tsx +++ b/src/pages/Join/Campus.tsx @@ -9,24 +9,28 @@ import Pagination from "@/components/Pagination"; import { Link } from "react-router-dom"; import { debounce } from "@/utils"; import appApi from "@/api/app"; +import { LocaleKey } from "@/type"; type JobItem = { id: number; title: string; content: string; labels: string[]; - lang: string + lang: string; + city: string; }; type SelectOption = { label: string; value: string }; export default function JoinCampus() { const appConfig = useStore((s) => s.appConfig); - const { viewDetail = "查看详情", noData = "暂无数据" } = appConfig?.__global__?.others + const i18nData = useStore((s) => s.i18nData); + const { viewDetail = "查看详情", noData = "暂无数据", all = "全部" } = appConfig?.__global__?.others const supportLocales = useStore((s) => s.supportLocales); const categoryList = useStore((s) => s.categoryList); const locale = useStore((s) => s.locale); const data = appConfig?.join?.campus; + const cityMapList = appConfig?.cityMap.citys; const banner = data?.banner; const others = data?.others; @@ -66,6 +70,7 @@ export default function JoinCampus() { content: item.description, labels, lang: item.lang, + city: item.city, }; }); setJobList(items || []); @@ -73,16 +78,20 @@ export default function JoinCampus() { }); }, 500), []); - const getTypes = useCallback(() => { + + const getTypes = useCallback((locale: string) => { + const isZh = locale.startsWith('zh'); + const jobTypeOptions: SelectOption[] = - categoryList?.filter((item: any) => item.type === 'job_type').map((item: any) => ({ label: item.name, value: String(item.id) })) ?? []; + categoryList?.filter((item: any) => item.type === 'job_type').map((item: any) => ({ label: isZh ? item.name : item.name_en, value: String(item.id) })) ?? []; const businessAreaOptions: SelectOption[] = - categoryList?.filter((item: any) => item.type === 'job_area').map((item: any) => ({ label: item.name, value: String(item.id) })) ?? []; + categoryList?.filter((item: any) => item.type === 'job_area').map((item: any) => ({ label: isZh ? item.name : item.name_en, value: String(item.id) })) ?? []; const businessPlateOptions: SelectOption[] = - categoryList?.filter((item: any) => item.type === 'job_unit').map((item: any) => ({ label: item.name, value: String(item.id) })) ?? []; - setJobTypeOptions([{ label: '全部', value: '' }, ...jobTypeOptions]); - setBusinessAreaOptions([{ label: '全部', value: '' }, ...businessAreaOptions]); - setBusinessPlateOptions([{ label: '全部', value: '' }, ...businessPlateOptions]); + categoryList?.filter((item: any) => item.type === 'job_unit').map((item: any) => ({ label: isZh ? item.name : item.name_en, value: String(item.id) })) ?? []; + const allText = i18nData?.[locale as LocaleKey]?.__global__?.others?.all; + setJobTypeOptions([{ label: allText, value: '' }, ...jobTypeOptions]); + setBusinessAreaOptions([{ label: allText, value: '' }, ...businessAreaOptions]); + setBusinessPlateOptions([{ label: allText, value: '' }, ...businessPlateOptions]); }, [categoryList]); useEffect(() => { @@ -90,8 +99,8 @@ export default function JoinCampus() { }, [searchValue, jobType, businessArea, businessPlate, page, size]); useEffect(() => { - getTypes(); - }, []); + getTypes(locale); + }, [locale, categoryList]); const handleReset = useCallback(() => { setSearchValue(''); @@ -140,6 +149,9 @@ export default function JoinCampus() { {item.labels.map((label, index) => (
 •  {label}
))} +  •  { + cityMapList.find((city: any) => city.untranslate_title === item.city)?.showName ?? item.city + }
{others?.jobDuty ?? "工作职责"}:{item.content}
@@ -190,6 +202,8 @@ type SelectFormItemProps = { onChange: (value: string) => void; } function SelectFormItem({ value, options, label, onChange }: SelectFormItemProps) { + const appConfig = useStore((s) => s.appConfig); + const { noData = "暂无数据", all = "全部" } = appConfig?.__global__?.others const [open, setOpen] = useState(false); const selectId = `select-${label.replace(/\s/g, "-")}`; @@ -203,8 +217,8 @@ function SelectFormItem({ value, options, label, onChange }: SelectFormItemProps open={open} onOpenChange={setOpen} showSearch - placeholder="全部" - notFoundContent="无数据" + placeholder={all} + notFoundContent={noData} optionFilterProp="label" filterOption={(input, opt) => (opt?.label ?? "").toString().toLowerCase().includes(input.toLowerCase()) @@ -213,7 +227,7 @@ function SelectFormItem({ value, options, label, onChange }: SelectFormItemProps value={value} onChange={v => onChange(v ?? "")} prefix={ -
+
} diff --git a/src/pages/News/NewsPublic.tsx b/src/pages/News/NewsPublic.tsx index 3731d65..77ddfde 100644 --- a/src/pages/News/NewsPublic.tsx +++ b/src/pages/News/NewsPublic.tsx @@ -8,6 +8,7 @@ import { Link } from "react-router-dom"; import { useStore } from "@/store"; import appApi from "@/api/app"; import ScrollReveal from "@/components/ScrollReveal"; +import { dateFormat } from "@/utils"; type NewsItem = { id: number; title: string; @@ -33,10 +34,11 @@ export default function NewsPublic() { const videoRefs = useRef<(HTMLVideoElement | null)[]>([]); const [searchValue, setSearchValue] = useState(""); const handleSearch = useCallback(() => { - appApi.getNewsList({ page, size, sort: "create_time DESC", title: searchValue, + appApi.getNewsList({ + page, size, sort: "create_time DESC", title: searchValue, category_id: categoryId, - }).then((res) => { - const data = res.data.items.map((item:any) => { + }).then((res) => { + const data = res.data.items.map((item: any) => { return { id: item.id, title: item.title, @@ -90,38 +92,40 @@ export default function NewsPublic() {
{localNewsList.map((item, index) => ( - - - {item.image ? ( - {item.title} - ) : ( -
diff --git a/src/utils/parsePageConfig.ts b/src/utils/parsePageConfig.ts index 33cb2e6..7b5f04a 100644 --- a/src/utils/parsePageConfig.ts +++ b/src/utils/parsePageConfig.ts @@ -168,7 +168,15 @@ export function parsePageConfig(items: RawPageItem[]): { } catch(err) { console.error('parse topMenuConfig error', err) } - console.log('topMenuJson', topMenuJson) + + const cityMapConfig = filtered.find((it) => it.tags === "city-map"); + let cityMapJson: any = null + try { + cityMapJson = JSON.parse(cityMapConfig?.content ?? "[]"); + } catch(err) { + console.error('parse cityMapConfig error', err) + } + // const zhNavItems = buildNavItems(menuItems, "ZH", parsedContentMap); // const enNavItems = buildNavItems(menuItems, "EN", parsedContentMap); @@ -202,6 +210,8 @@ export function parsePageConfig(items: RawPageItem[]): { zhConfig.navItems = topMenuJson.ZH.items; enConfig.navItems = topMenuJson.EN.items; + zhConfig.cityMap = cityMapJson.ZH; + enConfig.cityMap = cityMapJson.EN; deepFallback(enConfig, zhConfig); return { "zh-CN": zhConfig, "en-US": enConfig };