This commit is contained in:
zhangjianjun 2026-04-01 17:22:35 +08:00
parent 91a40abb73
commit 116b567194
4 changed files with 100 additions and 59 deletions

View File

@ -1,3 +1,4 @@
import { useStore } from "@/store";
import styles from "./index.module.css"; import styles from "./index.module.css";
@ -14,34 +15,46 @@ type Data = {
} }
export default function JobPage({ data }: { data: 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 ( return (
<div className={styles.jobPage}> <div className={styles.jobPage}>
<div className={styles.jobPageHeaderLine}> <div className={styles.jobPageHeaderLine}>
<div className={styles.jobPageHeaderLineBack} onClick={() => window.history.back()}> <div className={styles.jobPageHeaderLineBack} onClick={() => window.history.back()}>
<img src="/images/icons/icon-arrowleft.png" alt="arrowleft" style={{ width: "1.25rem", height: "1.25rem" }} /> <img src="/images/icons/icon-arrowleft.png" alt="arrowleft" style={{ width: "1.25rem", height: "1.25rem" }} />
<span></span> <span>{back}</span>
</div> </div>
</div> </div>
<div className={styles.jobPageHeader}> <div className={styles.jobPageHeader}>
<div className={styles.jobPageHeaderTitle}>{data.title}</div> <div className={styles.jobPageHeaderTitle}>{data.title}</div>
<div className={styles.jobPageHeaderTimeLine}> <div className={styles.jobPageHeaderTimeLine}>
<span>{data.jobType}</span> <span>{jobType}{data.jobType}</span>
<span>{data.businessArea}</span> <span>{businessArea}{data.businessArea}</span>
<span>{data.businessPlate}</span> <span>{businessPlate}{data.businessPlate}</span>
<span>{data.recruitNumber}</span> <span>{recruitNumber}{data.recruitNumber}</span>
<span>{data.jobLocation}</span> <span>{jobLocation}{data.jobLocation}</span>
</div> </div>
</div> </div>
<div className={styles.jobPageContent}> <div className={styles.jobPageContent}>
<div className={styles.jobPageContentTitle}></div> <div className={styles.jobPageContentTitle}>{jobDescription}</div>
<p className={styles.jobPageContentText} dangerouslySetInnerHTML={{ __html: data.content }}></p> <p className={styles.jobPageContentText} dangerouslySetInnerHTML={{ __html: data.content }}></p>
</div> </div>
<div className={styles.jobPageContent} style={{ marginTop: "3.125rem" }}> <div className={styles.jobPageContent} style={{ marginTop: "3.125rem" }}>
<div className={styles.jobPageContentTitle}></div> <div className={styles.jobPageContentTitle}>{requirement}</div>
<p className={styles.jobPageContentText} dangerouslySetInnerHTML={{ __html: data.requirement }}></p> <p className={styles.jobPageContentText} dangerouslySetInnerHTML={{ __html: data.requirement }}></p>
</div> </div>
<div className={styles.jobPageContent} style={{ marginTop: "3.125rem" }}> <div className={styles.jobPageContent} style={{ marginTop: "3.125rem" }}>
<div className={styles.jobPageContentTitle}></div> <div className={styles.jobPageContentTitle}>{contact}</div>
<p className={styles.jobPageContentText}>{data.contact}</p> <p className={styles.jobPageContentText}>{data.contact}</p>
</div> </div>
</div> </div>

View File

@ -9,24 +9,28 @@ import Pagination from "@/components/Pagination";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { debounce } from "@/utils"; import { debounce } from "@/utils";
import appApi from "@/api/app"; import appApi from "@/api/app";
import { LocaleKey } from "@/type";
type JobItem = { type JobItem = {
id: number; id: number;
title: string; title: string;
content: string; content: string;
labels: string[]; labels: string[];
lang: string lang: string;
city: string;
}; };
type SelectOption = { label: string; value: string }; type SelectOption = { label: string; value: string };
export default function JoinCampus() { export default function JoinCampus() {
const appConfig = useStore((s) => s.appConfig); 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 supportLocales = useStore((s) => s.supportLocales);
const categoryList = useStore((s) => s.categoryList); const categoryList = useStore((s) => s.categoryList);
const locale = useStore((s) => s.locale); const locale = useStore((s) => s.locale);
const data = appConfig?.join?.campus; const data = appConfig?.join?.campus;
const cityMapList = appConfig?.cityMap.citys;
const banner = data?.banner; const banner = data?.banner;
const others = data?.others; const others = data?.others;
@ -66,6 +70,7 @@ export default function JoinCampus() {
content: item.description, content: item.description,
labels, labels,
lang: item.lang, lang: item.lang,
city: item.city,
}; };
}); });
setJobList(items || []); setJobList(items || []);
@ -73,16 +78,20 @@ export default function JoinCampus() {
}); });
}, 500), []); }, 500), []);
const getTypes = useCallback(() => {
const getTypes = useCallback((locale: string) => {
const isZh = locale.startsWith('zh');
const jobTypeOptions: SelectOption[] = 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[] = 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[] = const businessPlateOptions: SelectOption[] =
categoryList?.filter((item: any) => item.type === 'job_unit').map((item: any) => ({ label: item.name, value: String(item.id) })) ?? []; categoryList?.filter((item: any) => item.type === 'job_unit').map((item: any) => ({ label: isZh ? item.name : item.name_en, value: String(item.id) })) ?? [];
setJobTypeOptions([{ label: '全部', value: '' }, ...jobTypeOptions]); const allText = i18nData?.[locale as LocaleKey]?.__global__?.others?.all;
setBusinessAreaOptions([{ label: '全部', value: '' }, ...businessAreaOptions]); setJobTypeOptions([{ label: allText, value: '' }, ...jobTypeOptions]);
setBusinessPlateOptions([{ label: '全部', value: '' }, ...businessPlateOptions]); setBusinessAreaOptions([{ label: allText, value: '' }, ...businessAreaOptions]);
setBusinessPlateOptions([{ label: allText, value: '' }, ...businessPlateOptions]);
}, [categoryList]); }, [categoryList]);
useEffect(() => { useEffect(() => {
@ -90,8 +99,8 @@ export default function JoinCampus() {
}, [searchValue, jobType, businessArea, businessPlate, page, size]); }, [searchValue, jobType, businessArea, businessPlate, page, size]);
useEffect(() => { useEffect(() => {
getTypes(); getTypes(locale);
}, []); }, [locale, categoryList]);
const handleReset = useCallback(() => { const handleReset = useCallback(() => {
setSearchValue(''); setSearchValue('');
@ -140,6 +149,9 @@ export default function JoinCampus() {
{item.labels.map((label, index) => ( {item.labels.map((label, index) => (
<div key={index} className={styles.jobItemLabel}>&nbsp;&nbsp;&nbsp;{label}</div> <div key={index} className={styles.jobItemLabel}>&nbsp;&nbsp;&nbsp;{label}</div>
))} ))}
&nbsp;&nbsp;&nbsp;{
cityMapList.find((city: any) => city.untranslate_title === item.city)?.showName ?? item.city
}
</div> </div>
<div className={styles.jobItemContent}>{others?.jobDuty ?? "工作职责"}{item.content}</div> <div className={styles.jobItemContent}>{others?.jobDuty ?? "工作职责"}{item.content}</div>
</div></Link> </div></Link>
@ -190,6 +202,8 @@ type SelectFormItemProps = {
onChange: (value: string) => void; onChange: (value: string) => void;
} }
function SelectFormItem({ value, options, label, onChange }: SelectFormItemProps) { 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 [open, setOpen] = useState(false);
const selectId = `select-${label.replace(/\s/g, "-")}`; const selectId = `select-${label.replace(/\s/g, "-")}`;
@ -203,8 +217,8 @@ function SelectFormItem({ value, options, label, onChange }: SelectFormItemProps
open={open} open={open}
onOpenChange={setOpen} onOpenChange={setOpen}
showSearch showSearch
placeholder="全部" placeholder={all}
notFoundContent="无数据" notFoundContent={noData}
optionFilterProp="label" optionFilterProp="label"
filterOption={(input, opt) => filterOption={(input, opt) =>
(opt?.label ?? "").toString().toLowerCase().includes(input.toLowerCase()) (opt?.label ?? "").toString().toLowerCase().includes(input.toLowerCase())

View File

@ -8,6 +8,7 @@ import { Link } from "react-router-dom";
import { useStore } from "@/store"; import { useStore } from "@/store";
import appApi from "@/api/app"; import appApi from "@/api/app";
import ScrollReveal from "@/components/ScrollReveal"; import ScrollReveal from "@/components/ScrollReveal";
import { dateFormat } from "@/utils";
type NewsItem = { type NewsItem = {
id: number; id: number;
title: string; title: string;
@ -33,7 +34,8 @@ export default function NewsPublic() {
const videoRefs = useRef<(HTMLVideoElement | null)[]>([]); const videoRefs = useRef<(HTMLVideoElement | null)[]>([]);
const [searchValue, setSearchValue] = useState(""); const [searchValue, setSearchValue] = useState("");
const handleSearch = useCallback(() => { 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, category_id: categoryId,
}).then((res) => { }).then((res) => {
const data = res.data.items.map((item: any) => { const data = res.data.items.map((item: any) => {
@ -119,7 +121,9 @@ export default function NewsPublic() {
)} )}
<div className={styles.newItemContent}> <div className={styles.newItemContent}>
<div className={styles.newItemTitle}>{item.title}</div> <div className={styles.newItemTitle}>{item.title}</div>
<div className={styles.newItemCreateTime}>{item.createTime}</div> <div className={styles.newItemCreateTime}>
{dateFormat(item.createTime, "yyyy-MM-dd")}
</div>
</div> </div>
</Link> </Link>
</ScrollReveal> </ScrollReveal>

View File

@ -168,7 +168,15 @@ export function parsePageConfig(items: RawPageItem[]): {
} catch(err) { } catch(err) {
console.error('parse topMenuConfig error', 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 zhNavItems = buildNavItems(menuItems, "ZH", parsedContentMap);
// const enNavItems = buildNavItems(menuItems, "EN", parsedContentMap); // const enNavItems = buildNavItems(menuItems, "EN", parsedContentMap);
@ -202,6 +210,8 @@ export function parsePageConfig(items: RawPageItem[]): {
zhConfig.navItems = topMenuJson.ZH.items; zhConfig.navItems = topMenuJson.ZH.items;
enConfig.navItems = topMenuJson.EN.items; enConfig.navItems = topMenuJson.EN.items;
zhConfig.cityMap = cityMapJson.ZH;
enConfig.cityMap = cityMapJson.EN;
deepFallback(enConfig, zhConfig); deepFallback(enConfig, zhConfig);
return { "zh-CN": zhConfig, "en-US": enConfig }; return { "zh-CN": zhConfig, "en-US": enConfig };