From 34f9c8d0e6667a9bfc8ef483f71cdb3be12784f7 Mon Sep 17 00:00:00 2001 From: chashaobao Date: Sat, 16 Aug 2025 13:02:46 +0800 Subject: [PATCH] feat: --- src/components/job-card/index.tsx | 14 ++++++------- src/pages/job-detail/index.tsx | 34 ++++++++++++++++--------------- src/pages/job-publish/index.tsx | 22 +++++++++++++------- src/pages/message/index.tsx | 5 ++--- 4 files changed, 42 insertions(+), 33 deletions(-) diff --git a/src/components/job-card/index.tsx b/src/components/job-card/index.tsx index 5b708fc..dfe7525 100644 --- a/src/components/job-card/index.tsx +++ b/src/components/job-card/index.tsx @@ -84,12 +84,12 @@ function JobCard(props: IProps) {
{jobDescription || sourceText}
{jobLocation?.address}
- {distance && ( - <> - -
{calcDistance(distance)}
- - )} + {/*{distance && (*/} + {/* <>*/} + {/* */} + {/*
{calcDistance(distance)}
*/} + {/* */} + {/*)}*/}
@@ -102,7 +102,7 @@ function JobCard(props: IProps) { />
{publisher}
-
{getCityDes(jobLocation)}
+ {/*
{getCityDes(jobLocation)}
*/} ); diff --git a/src/pages/job-detail/index.tsx b/src/pages/job-detail/index.tsx index 8a49ef1..e7b340d 100644 --- a/src/pages/job-detail/index.tsx +++ b/src/pages/job-detail/index.tsx @@ -1,6 +1,7 @@ import { Button, Image, Map, MapProps, Text } from '@tarojs/components'; import Taro, { useLoad, useShareAppMessage } from '@tarojs/taro'; +import { Dialog } from '@taroify/core'; import React, { useCallback, useEffect, useState } from 'react'; import { CertificationStatusIcon } from '@/components/certification-status'; @@ -12,15 +13,19 @@ import LoginButton from '@/components/login-button'; import PageLoading from '@/components/page-loading'; import { PrejobPopup } from '@/components/prejob-popup'; import ProductJobDialog from '@/components/product-dialog/job'; +import CompanyPublishJobBuy from '@/components/product-dialog/steps-ui/company-publish-job-buy'; import { EventName, PageUrl, RoleType } from '@/constants/app'; import { CertificationStatusType } from '@/constants/company'; import { CollectEventName, ReportEventId } from '@/constants/event'; import { EMPLOY_TYPE_TITLE_MAP, GET_CONTACT_TYPE, JobManageStatus } from '@/constants/job'; +import { ProductType } from '@/constants/product'; import useInviteCode from '@/hooks/use-invite-code'; import useUserInfo from '@/hooks/use-user-info'; import useRoleType from '@/hooks/user-role-type'; import { RESPONSE_ERROR_CODE } from '@/http/constant'; import { HttpError } from '@/http/error'; +import store from '@/store'; +import { cacheJobId } from '@/store/actions'; import { JobDetails } from '@/types/job'; import { IMaterialMessage } from '@/types/message'; import { switchRoleType } from '@/utils/app'; @@ -31,6 +36,7 @@ import { calcDistance, isValidLocation } from '@/utils/location'; import { requestProfileDetail } from '@/utils/material'; import { isChatWithSelf, postCreateChat } from '@/utils/message'; import { getInviteCodeFromQueryAndUpdate } from '@/utils/partner'; +import { requestProductBalance, requestProductUseRecord } from '@/utils/product'; import { getJumpUrl, getPageQuery, navigateTo } from '@/utils/route'; import { getCommonShareMessage } from '@/utils/share'; import { formatDate } from '@/utils/time'; @@ -38,12 +44,6 @@ import Toast from '@/utils/toast'; import { isNeedCreateMaterial } from '@/utils/user'; import './index.less'; -import { Dialog } from '@taroify/core'; -import CompanyPublishJobBuy from '@/components/product-dialog/steps-ui/company-publish-job-buy'; -import { requestProductBalance, requestProductUseRecord } from '@/utils/product'; -import { ProductType } from '@/constants/product'; -import store from '@/store'; -import { cacheJobId } from '@/store/actions'; const PREFIX = 'job-detail'; const log = logWithPrefix(PREFIX); @@ -105,16 +105,18 @@ const AnchorFooter = (props: { data: JobDetails }) => { let materialMessage: null | IMaterialMessage = null; if (!needCreateMaterial) { const profile = await requestProfileDetail(); - materialMessage = { - id: profile.id, - name: profile.name, - age: profile.age, - height: profile.height, - weight: profile.weight, - shoeSize: profile.shoeSize, - gender: profile.gender, - workedSecCategoryStr: profile.workedSecCategoryStr, - }; + if (profile) { + materialMessage = { + id: profile.id, + name: profile.name, + age: profile.age, + height: profile.height, + weight: profile.weight, + shoeSize: profile.shoeSize, + gender: profile.gender, + workedSecCategoryStr: profile.workedSecCategoryStr, + }; + } } navigateTo(PageUrl.MessageChat, { chatId: chat.chatId, diff --git a/src/pages/job-publish/index.tsx b/src/pages/job-publish/index.tsx index c2e9218..ed5d823 100644 --- a/src/pages/job-publish/index.tsx +++ b/src/pages/job-publish/index.tsx @@ -144,6 +144,13 @@ export default function JobPublish() { setAddress(value); }, []); + const refreshJobPublishList = useCallback(() => { + Taro.eventCenter.trigger(EventName.COMPANY_JOB_PUBLISH_CHANGED); + setTimeout(() => { + Taro.eventCenter.trigger(EventName.COMPANY_JOB_PUBLISH_CHANGED); + }, 300); + }, []); + const handleClose = useCallback(async () => { if (!job) { Toast.error('数据出错请重试'); @@ -152,7 +159,7 @@ export default function JobPublish() { try { Taro.showLoading(); await postCloseJob(job.id); - Taro.eventCenter.trigger(EventName.COMPANY_JOB_PUBLISH_CHANGED); + refreshJobPublishList(); navigateBack(); } catch (e) { console.error('submit error', e); @@ -161,7 +168,7 @@ export default function JobPublish() { } finally { Taro.hideLoading(); } - }, [job]); + }, [job, refreshJobPublishList]); const getCreateJobInfo = useCallback((): [CreateJobInfo, string[]] => { const cityCodes = city || []; @@ -204,7 +211,7 @@ export default function JobPublish() { } else { const jobId = await postCreateJob(data); createdJobIdRef.current = jobId; - Taro.eventCenter.trigger(EventName.COMPANY_JOB_PUBLISH_CHANGED); + refreshJobPublishList(); if (userInfo.bossAuthStatus !== CertificationStatusType.Success) { // 去认证 @@ -224,7 +231,8 @@ export default function JobPublish() { await postPublishJob(jobId); } - Taro.eventCenter.trigger(EventName.COMPANY_JOB_PUBLISH_CHANGED); + refreshJobPublishList(); + await Toast.success(isUpdateJob ? '更新成功' : '创建并发布成功', 1500, true); navigateBack(); } catch (e) { @@ -235,13 +243,13 @@ export default function JobPublish() { } finally { Taro.hideLoading(); } - }, [getCreateJobInfo, isUpdate, job, userInfo.bossAuthStatus]); + }, [getCreateJobInfo, isUpdate, job, userInfo.bossAuthStatus, refreshJobPublishList]); const handleNext = useCallback(async () => { Taro.showLoading(); try { await postPublishJob(createdJobIdRef.current); - Taro.eventCenter.trigger(EventName.COMPANY_JOB_PUBLISH_CHANGED); + refreshJobPublishList(); await Toast.success('发布成功', 1500, true); navigateBack(); } catch (e) { @@ -251,7 +259,7 @@ export default function JobPublish() { } finally { Taro.hideLoading(); } - }, []); + }, [refreshJobPublishList]); const handleClosePublishJob = useCallback(() => { setShowBuy(false); diff --git a/src/pages/message/index.tsx b/src/pages/message/index.tsx index c0a3b6a..a7d2b69 100644 --- a/src/pages/message/index.tsx +++ b/src/pages/message/index.tsx @@ -8,23 +8,22 @@ import HomePage from '@/components/home-page'; import MessageCard from '@/components/message-card'; import { MessageHelpDialog, MessageNoTimesDialog } from '@/components/message-dialog'; import { APP_TAB_BAR_ID, EventName, PageType } from '@/constants/app'; +import { CollectEventName } from '@/constants/event'; import { REFRESH_CHAT_LIST_TIME } from '@/constants/message'; import { MessageSubscribeIds, SubscribeTempId } from '@/constants/subscribe'; import useListHeight, { IUseListHeightProps } from '@/hooks/use-list-height'; import useRoleType from '@/hooks/user-role-type'; import { MainMessage } from '@/types/message'; import { logWithPrefix } from '@/utils/common'; +import { collectEvent } from '@/utils/event'; import { postAddMessageTimes, requestMessageList, requestRemainPushTime, requestUnreadMessageCount, } from '@/utils/message'; - import { isSubscribeRefused, postSubscribe } from '@/utils/subscribe'; import './index.less'; -import { collectEvent } from '@/utils/event'; -import { CollectEventName } from '@/constants/event'; const PREFIX = 'page-message'; const HEADER_CLASS = `${PREFIX}__header`;