feat: update tonggao
This commit is contained in:
13
src/components/employ-type-select/index.tsx
Normal file
13
src/components/employ-type-select/index.tsx
Normal file
@ -0,0 +1,13 @@
|
||||
import Select, { ISelectProps } from '@/components/select';
|
||||
import { EmployType, JOB_EMPLOY_TYPE_OPTIONS } from '@/constants/job';
|
||||
|
||||
interface IProps extends Omit<ISelectProps<EmployType>, 'options'> {
|
||||
value: EmployType;
|
||||
}
|
||||
|
||||
function EmployTypeSelect(props: IProps) {
|
||||
const { value: selectValue, onSelect } = props;
|
||||
return <Select options={JOB_EMPLOY_TYPE_OPTIONS} title="类型" value={selectValue} onSelect={onSelect} />;
|
||||
}
|
||||
|
||||
export default EmployTypeSelect;
|
@ -35,6 +35,7 @@ function JobList(props: IJobListProps) {
|
||||
visible = true,
|
||||
cityCode = 'ALL',
|
||||
category = JobType.All,
|
||||
sourceType,
|
||||
employType = EmployType.All,
|
||||
sortType = SortType.RECOMMEND,
|
||||
isFollow = false,
|
||||
@ -114,6 +115,7 @@ function JobList(props: IJobListProps) {
|
||||
category,
|
||||
cityCode,
|
||||
employType,
|
||||
sourceType,
|
||||
sortType,
|
||||
isFollow,
|
||||
isOwner,
|
||||
@ -128,6 +130,7 @@ function JobList(props: IJobListProps) {
|
||||
}, [
|
||||
category,
|
||||
cityCode,
|
||||
sourceType,
|
||||
employType,
|
||||
sortType,
|
||||
isFollow,
|
||||
@ -176,7 +179,7 @@ function JobList(props: IJobListProps) {
|
||||
}
|
||||
};
|
||||
refresh();
|
||||
}, [visible, cityCode, employType, sortType, keyWord, minSalary, maxSalary, blGroupId]);
|
||||
}, [visible, cityCode, employType, sourceType, sortType, keyWord, minSalary, maxSalary, blGroupId]);
|
||||
|
||||
// log('render', `hasMore: ${hasMore}, loadingMore: ${loadingMore}, refreshing: ${refreshing}`);
|
||||
|
||||
|
@ -16,7 +16,6 @@ import { postSubscribe, subscribeMessage } from '@/utils/subscribe';
|
||||
import Toast from '@/utils/toast';
|
||||
|
||||
interface IProps {
|
||||
defaultSelect?: number;
|
||||
onNext: () => void;
|
||||
}
|
||||
|
||||
@ -32,48 +31,48 @@ interface Item {
|
||||
}
|
||||
|
||||
const LIST: Item[] = [
|
||||
// {
|
||||
// id: ProductSpecId.BOSS_VIP_NEW_1,
|
||||
// title: '展示一周',
|
||||
// price: '480播豆',
|
||||
// amt: 48,
|
||||
// badge: '限时体验',
|
||||
// contents: [
|
||||
// { content: '-通告每日优先展示' },
|
||||
// { content: '-每天可查看20个主播详情' },
|
||||
// { content: '-每天可主动联系10个主播' },
|
||||
// // { content: '-播络可代为联系20个主播(高成功率)', highlight: true },
|
||||
// { content: '-有效期一周' },
|
||||
// ],
|
||||
// },
|
||||
{
|
||||
id: ProductSpecId.BOSS_VIP_NEW_1,
|
||||
title: '展示一周',
|
||||
id: ProductSpecId.BOSS_VIP_NEW_2,
|
||||
title: '推荐一月',
|
||||
price: '480播豆',
|
||||
amt: 48,
|
||||
badge: '限时体验',
|
||||
contents: [
|
||||
{ content: '-1个通告' },
|
||||
{ content: '-通告每日优先展示' },
|
||||
{ content: '-每天可查看20个主播详情' },
|
||||
{ content: '-每天可自主联系10个主播' },
|
||||
// { content: '-播络可代为联系20个主播(高成功率)', highlight: true },
|
||||
{ content: '-有效期一周' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: ProductSpecId.BOSS_VIP_NEW_2,
|
||||
title: '展示一月',
|
||||
price: '960播豆',
|
||||
amt: 96,
|
||||
badge: '五折',
|
||||
contents: [
|
||||
{ content: '-1个通告' },
|
||||
{ content: '-每天可查看20个主播详情' },
|
||||
{ content: '-每天可自主联系10个主播' },
|
||||
{ content: '-每天可主动联系10个主播', highlight: true },
|
||||
// { content: '-播络可代为联系20个主播(高成功率)', highlight: true },
|
||||
{ content: '-有效期一个月' },
|
||||
],
|
||||
},
|
||||
// {
|
||||
// id: ProductSpecId.BOSS_VIP_NEW_3,
|
||||
// title: '季会员',
|
||||
// price: '2680播豆',
|
||||
// amt: 268,
|
||||
// badge: '7折',
|
||||
// contents: [
|
||||
// { content: '-1个通告' },
|
||||
// { content: '-每天可查看20个主播详情' },
|
||||
// { content: '-每天可自主联系10个主播' },
|
||||
// { content: '-播络可代为联系60个主播(高成功率)', highlight: true },
|
||||
// { content: '-有效期3个月' },
|
||||
// ],
|
||||
// },
|
||||
{
|
||||
id: ProductSpecId.BOSS_VIP_NEW_3,
|
||||
title: '推荐一季',
|
||||
price: '960播豆',
|
||||
amt: 96,
|
||||
badge: '6.7折',
|
||||
contents: [
|
||||
{ content: '-通告每日优先展示' },
|
||||
{ content: '-每天可查看20个主播详情' },
|
||||
{ content: '-每天可主动联系10个主播' },
|
||||
// { content: '-播络可代为联系60个主播(高成功率)', highlight: true },
|
||||
{ content: '-有效期一个季度' },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const subscribe = async () => {
|
||||
@ -86,8 +85,8 @@ const subscribe = async () => {
|
||||
};
|
||||
|
||||
export default function CompanyPublishJobBuy(props: IProps) {
|
||||
const { onNext, defaultSelect = 0 } = props;
|
||||
const [selectItem, setSelectItem] = useState(LIST[defaultSelect]);
|
||||
const { onNext } = props;
|
||||
const [selectItem, setSelectItem] = useState(LIST[0]);
|
||||
|
||||
const handleClickItem = useCallback((newSelectItem: Item) => setSelectItem(newSelectItem), []);
|
||||
|
||||
|
@ -21,6 +21,12 @@ export enum EmployType {
|
||||
Part = 'PARTY_TIME',
|
||||
}
|
||||
|
||||
export enum JobSourceType {
|
||||
All = 'All',
|
||||
VX = 'vx',
|
||||
BL = 'bl',
|
||||
}
|
||||
|
||||
export enum SortType {
|
||||
RECOMMEND = 'RECOMMEND',
|
||||
DISTANCE = 'DISTANCE',
|
||||
@ -66,6 +72,12 @@ export const EMPLOY_TYPE_TITLE_MAP = {
|
||||
[EmployType.Full]: '全职',
|
||||
};
|
||||
|
||||
export const JOB_SOURCE_TYPE_TITLE_MAP = {
|
||||
[JobSourceType.All]: '全部',
|
||||
[JobSourceType.BL]: '认证通告',
|
||||
[JobSourceType.VX]: '群通告',
|
||||
};
|
||||
|
||||
export const JOB_TYPE_TITLE_MAP: { [key in JobType]: string } = {
|
||||
[JobType.All]: '全部',
|
||||
[JobType.Finery]: '服饰',
|
||||
@ -101,16 +113,31 @@ export const JOB_MANAGE_STATUS_TITLE_MAP = {
|
||||
|
||||
export const JOB_PAGE_TABS = [
|
||||
{
|
||||
type: EmployType.All,
|
||||
title: EMPLOY_TYPE_TITLE_MAP[EmployType.All],
|
||||
type: JobSourceType.All,
|
||||
title: JOB_SOURCE_TYPE_TITLE_MAP[JobSourceType.All],
|
||||
},
|
||||
{
|
||||
type: EmployType.Part,
|
||||
title: EMPLOY_TYPE_TITLE_MAP[EmployType.Part],
|
||||
type: JobSourceType.BL,
|
||||
title: JOB_SOURCE_TYPE_TITLE_MAP[JobSourceType.BL],
|
||||
},
|
||||
{
|
||||
type: EmployType.Full,
|
||||
title: EMPLOY_TYPE_TITLE_MAP[EmployType.Full],
|
||||
type: JobSourceType.VX,
|
||||
title: JOB_SOURCE_TYPE_TITLE_MAP[JobSourceType.VX],
|
||||
},
|
||||
];
|
||||
|
||||
export const JOB_EMPLOY_TYPE_OPTIONS = [
|
||||
{
|
||||
value: EmployType.All,
|
||||
label: EMPLOY_TYPE_TITLE_MAP[EmployType.All],
|
||||
},
|
||||
{
|
||||
value: EmployType.Part,
|
||||
label: EMPLOY_TYPE_TITLE_MAP[EmployType.Part],
|
||||
},
|
||||
{
|
||||
value: EmployType.Full,
|
||||
label: EMPLOY_TYPE_TITLE_MAP[EmployType.Full],
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -54,6 +54,7 @@
|
||||
flex: 1 0;
|
||||
}
|
||||
|
||||
&__employType-select,
|
||||
&__salary-select,
|
||||
&__search-city {
|
||||
display: flex;
|
||||
|
@ -2,10 +2,11 @@ import { Image } from '@tarojs/components';
|
||||
import { NodesRef, useDidHide } from '@tarojs/taro';
|
||||
|
||||
import { Tabs } from '@taroify/core';
|
||||
import { ArrowUp, ArrowDown } from '@taroify/icons';
|
||||
import { ArrowDown, ArrowUp } from '@taroify/icons';
|
||||
import classNames from 'classnames';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import EmployTypeSelect from '@/components/employ-type-select';
|
||||
import JobList, { IJobListProps } from '@/components/job-list';
|
||||
import Overlay from '@/components/overlay';
|
||||
import PartnerBanner from '@/components/partner-banner';
|
||||
@ -13,7 +14,15 @@ import SalarySelect from '@/components/salary-select';
|
||||
import SearchInput from '@/components/search';
|
||||
import { APP_TAB_BAR_ID, PageUrl } from '@/constants/app';
|
||||
import { CITY_CODE_TO_NAME_MAP } from '@/constants/city';
|
||||
import { JOB_TABS, JobType, EmployType, ALL_SORT_TYPES, SORT_TYPE_TITLE_MAP, SortType } from '@/constants/job';
|
||||
import {
|
||||
ALL_SORT_TYPES,
|
||||
EMPLOY_TYPE_TITLE_MAP,
|
||||
EmployType,
|
||||
JOB_TABS, JobSourceType,
|
||||
JobType,
|
||||
SORT_TYPE_TITLE_MAP,
|
||||
SortType,
|
||||
} from '@/constants/job';
|
||||
import useListHeight, { IUseListHeightProps } from '@/hooks/use-list-height';
|
||||
import { SalaryRange } from '@/types/job';
|
||||
import { Coordinate } from '@/types/location';
|
||||
@ -24,9 +33,11 @@ import './index.less';
|
||||
interface IProps {
|
||||
cityCode: string;
|
||||
sortType: SortType;
|
||||
sourceType: JobSourceType;
|
||||
employType: EmployType;
|
||||
coordinate: Coordinate;
|
||||
onClickCity: () => void;
|
||||
onClickEmployType: (type: EmployType) => void;
|
||||
onClickSort: (type: SortType) => void;
|
||||
}
|
||||
|
||||
@ -74,20 +85,35 @@ function ListWrapper(props: IJobListProps) {
|
||||
}
|
||||
|
||||
function JobFragment(props: IProps) {
|
||||
const { cityCode, employType, sortType = SortType.RECOMMEND, coordinate, onClickCity, onClickSort } = props;
|
||||
const {
|
||||
cityCode,
|
||||
employType,
|
||||
sourceType,
|
||||
sortType = SortType.RECOMMEND,
|
||||
coordinate,
|
||||
onClickEmployType,
|
||||
onClickCity,
|
||||
onClickSort,
|
||||
} = props;
|
||||
const listHeight = useListHeight(CALC_LIST_PROPS);
|
||||
const [tabType, setTabType] = useState<JobType>(JobType.All);
|
||||
const [salaryRange, setSalaryRange] = useState<SalaryRange | undefined>();
|
||||
const [showSalarySelect, setShowSalarySelect] = useState<boolean>(false);
|
||||
const [showEmployTypeSelect, setShowEmployTypeSelect] = useState<boolean>(false);
|
||||
const { latitude, longitude } = coordinate;
|
||||
|
||||
const handleClickSearch = useCallback(() => navigateTo(PageUrl.JobSearch, { city: cityCode }), [cityCode]);
|
||||
|
||||
const handleClickSalarySelect = useCallback(() => {
|
||||
setShowSalarySelect(!showSalarySelect);
|
||||
}, [showSalarySelect]);
|
||||
setShowSalarySelect(s => !s);
|
||||
}, []);
|
||||
|
||||
const handleClickEmployTypeSelect = useCallback(() => {
|
||||
setShowEmployTypeSelect(s => !s);
|
||||
}, []);
|
||||
|
||||
const handleHideSalarySelect = useCallback(() => setShowSalarySelect(false), []);
|
||||
const handleHideEmployTypeSelect = useCallback(() => setShowEmployTypeSelect(false), []);
|
||||
|
||||
const handleSelectSalary = useCallback((value?: SalaryRange) => {
|
||||
log('handleSelectSalary', value);
|
||||
@ -95,6 +121,15 @@ function JobFragment(props: IProps) {
|
||||
setShowSalarySelect(false);
|
||||
}, []);
|
||||
|
||||
const handleSelectEmployType = useCallback(
|
||||
(value?: EmployType) => {
|
||||
console.log('哈哈哈', value);
|
||||
setShowEmployTypeSelect(false);
|
||||
onClickEmployType(value!);
|
||||
},
|
||||
[onClickEmployType]
|
||||
);
|
||||
|
||||
const onTypeChange = useCallback(
|
||||
value => {
|
||||
log('onTypeChange', value);
|
||||
@ -108,7 +143,18 @@ function JobFragment(props: IProps) {
|
||||
return (
|
||||
<div className={`${PREFIX}__container`}>
|
||||
<div className={`${PREFIX}__top-search-bar`}>
|
||||
<SearchInput disabled className={`${PREFIX}__search`} placeholder="试试 女装" onClick={handleClickSearch} />
|
||||
<SearchInput
|
||||
disabled
|
||||
className={`${PREFIX}__search`}
|
||||
placeholder="试试 女装"
|
||||
onClick={handleClickSearch}
|
||||
/>
|
||||
<div className={classNames(`${PREFIX}__employType-select`)} onClick={handleClickEmployTypeSelect}>
|
||||
<div className="title">
|
||||
{employType && employType !== EmployType.All ? EMPLOY_TYPE_TITLE_MAP[employType] : '类型'}
|
||||
</div>
|
||||
{showEmployTypeSelect ? <ArrowUp /> : <ArrowDown />}
|
||||
</div>
|
||||
<div className={classNames(`${PREFIX}__search-city`)} onClick={onClickCity}>
|
||||
<div className="title">{CITY_CODE_TO_NAME_MAP.get(cityCode)}</div>
|
||||
<ArrowDown />
|
||||
@ -139,6 +185,7 @@ function JobFragment(props: IProps) {
|
||||
sortType={sortType}
|
||||
latitude={latitude}
|
||||
longitude={longitude}
|
||||
sourceType={sourceType}
|
||||
employType={employType}
|
||||
minSalary={salaryRange?.minSalary}
|
||||
maxSalary={salaryRange?.maxSalary}
|
||||
@ -157,6 +204,15 @@ function JobFragment(props: IProps) {
|
||||
>
|
||||
<SalarySelect type={employType} value={salaryRange} onSelect={handleSelectSalary} />
|
||||
</Overlay>
|
||||
|
||||
<Overlay
|
||||
visible={showEmployTypeSelect}
|
||||
onClickOuter={handleHideEmployTypeSelect}
|
||||
outerClassName={`${PREFIX}__overlay-outer`}
|
||||
innerClassName={`${PREFIX}__overlay-inner`}
|
||||
>
|
||||
<EmployTypeSelect value={employType} onSelect={handleSelectEmployType} />
|
||||
</Overlay>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ const log = logWithPrefix(PREFIX);
|
||||
const realtimeLogger = Taro.getRealtimeLogManager();
|
||||
realtimeLogger.tag(PREFIX);
|
||||
const calcInitCityCodes = (codeString: string = '') => {
|
||||
const codes = codeString.split('、');
|
||||
const codes = (codeString || '').split('、');
|
||||
return codes.filter(code => !!CITY_CODE_TO_NAME_MAP.get(code));
|
||||
};
|
||||
|
||||
|
@ -30,7 +30,7 @@ const log = logWithPrefix(PREFIX);
|
||||
const DEFAULT_TEXT = '未填写';
|
||||
|
||||
const getIndentCity = (codeString: string = '') => {
|
||||
const codes = codeString.split('、');
|
||||
const codes = (codeString||'').split('、');
|
||||
const cityNames: string[] = [];
|
||||
codes.forEach(code => {
|
||||
const cityName = CITY_CODE_TO_NAME_MAP.get(code);
|
||||
|
@ -2,9 +2,9 @@ import { useSelector } from 'react-redux';
|
||||
|
||||
import { selectCreatedJob } from '@/store/selector/job';
|
||||
|
||||
function useCachedJob() {
|
||||
function useCachedJobId() {
|
||||
const data = useSelector(selectCreatedJob);
|
||||
return data;
|
||||
}
|
||||
|
||||
export default useCachedJob;
|
||||
export default useCachedJobId;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// export const DOMAIN = 'http://192.168.60.148:8082';
|
||||
// export const DOMAIN = 'http://192.168.60.191:8082';
|
||||
export const DOMAIN = 'https://neighbourhood.cn';
|
||||
export const BASE_URL = `${DOMAIN}/api`;
|
||||
|
||||
|
@ -90,4 +90,25 @@
|
||||
color: @blColor;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
&__popup {
|
||||
&-content {
|
||||
.flex-column();
|
||||
padding: 40px 32px 64px 32px;
|
||||
}
|
||||
|
||||
&-title {
|
||||
font-weight: 500;
|
||||
font-size: 36px;
|
||||
line-height: 57px;
|
||||
text-align: center;
|
||||
margin-bottom: 48px;
|
||||
}
|
||||
|
||||
&-confirm {
|
||||
.button(@width: 360px, @height: 72px, @fontSize: 28px, @fontWeight: 400, @borderRadius: 44px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Image } from '@tarojs/components';
|
||||
import { Button, Image } from '@tarojs/components';
|
||||
import Taro, { NodesRef, useDidShow, useLoad, useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import { Popup } from '@taroify/core';
|
||||
import { ArrowDown, ArrowUp } from '@taroify/icons';
|
||||
import classNames from 'classnames';
|
||||
import { isEqual } from 'lodash-es';
|
||||
@ -13,9 +14,10 @@ import HomePage from '@/components/home-page';
|
||||
import Overlay from '@/components/overlay';
|
||||
import PageLoading from '@/components/page-loading';
|
||||
import PartnerBanner from '@/components/partner-banner';
|
||||
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
||||
import SwitchBar from '@/components/switch-bar';
|
||||
import { APP_TAB_BAR_ID, EventName, OpenSource, PageType, PageUrl, RoleType } from '@/constants/app';
|
||||
import { EmployType, JobManageStatus } from '@/constants/job';
|
||||
import { EmployType } from '@/constants/job';
|
||||
import { ALL_ANCHOR_SORT_TYPES, ANCHOR_SORT_TYPE_TITLE_MAP, AnchorSortType } from '@/constants/material';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import useListHeight, { IUseListHeightProps } from '@/hooks/use-list-height';
|
||||
@ -32,6 +34,7 @@ import { getInviteCodeFromQueryAndUpdate } from '@/utils/partner';
|
||||
import { getPageQuery, navigateTo } from '@/utils/route';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
import Toast from '@/utils/toast';
|
||||
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'page-anchor';
|
||||
@ -82,6 +85,7 @@ export default function AnchorPage() {
|
||||
const [filters, setFilters] = useState<IAnchorFilters>({ employType: EmployType.All });
|
||||
const [showFilter, setShowFilter] = useState<boolean>(false);
|
||||
const [sortType, setSortType] = useState<AnchorSortType>(AnchorSortType.Active);
|
||||
const [openPopup, setOpenPopup] = useState<boolean>(false);
|
||||
const [coordinate, setCoordinate] = useState<Coordinate>({
|
||||
latitude: location.latitude,
|
||||
longitude: location.longitude,
|
||||
@ -92,6 +96,8 @@ export default function AnchorPage() {
|
||||
const handleChangeSelectJob = useCallback((select?: JobManageInfo) => {
|
||||
log('select job change', select);
|
||||
setSelectJob(select);
|
||||
console.log('哈哈哈', !select);
|
||||
setOpenPopup(!select);
|
||||
setLastSelectMyJobId(select?.id || '');
|
||||
}, []);
|
||||
|
||||
@ -125,7 +131,7 @@ export default function AnchorPage() {
|
||||
);
|
||||
|
||||
const handlePublishJobChange = useCallback(async () => {
|
||||
const { jobResults = [] } = await requestJobManageList({ status: JobManageStatus.Open });
|
||||
const { jobResults = [] } = await requestJobManageList();
|
||||
if (!selectJob) {
|
||||
// 之前没有开发中的通告,自动选中第一个开放中的通告
|
||||
handleChangeSelectJob(jobResults[0]);
|
||||
@ -141,6 +147,10 @@ export default function AnchorPage() {
|
||||
}
|
||||
}, [selectJob, handleChangeSelectJob]);
|
||||
|
||||
const handleGoCreate = useCallback(() => {
|
||||
navigateTo(PageUrl.JobPublish);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
Taro.eventCenter.on(EventName.SELECT_MY_PUBLISH_JOB, handleJobChange);
|
||||
Taro.eventCenter.on(EventName.COMPANY_JOB_PUBLISH_CHANGED, handlePublishJobChange);
|
||||
@ -172,8 +182,9 @@ export default function AnchorPage() {
|
||||
getInviteCodeFromQueryAndUpdate(query);
|
||||
|
||||
try {
|
||||
const { jobResults = [] } = await requestJobManageList({ status: JobManageStatus.Open });
|
||||
const { jobResults = [] } = await requestJobManageList();
|
||||
if (!jobResults.length) {
|
||||
setOpenPopup(true);
|
||||
// Toast.info('当前是根据定位为您展示主播');
|
||||
return;
|
||||
}
|
||||
@ -240,6 +251,21 @@ export default function AnchorPage() {
|
||||
<AnchorPicker value={filters} onConfirm={handleFilterChange} />
|
||||
</Overlay>
|
||||
</div>
|
||||
<Popup
|
||||
rounded
|
||||
open={openPopup}
|
||||
placement="bottom"
|
||||
className={`${PREFIX}__popup`}
|
||||
onClose={() => setOpenPopup(false)}
|
||||
>
|
||||
<div className={`${PREFIX}__popup-content`}>
|
||||
<div className={`${PREFIX}__popup-title`}>创建通告后可根据位置展示主播</div>
|
||||
<Button className={`${PREFIX}__popup-confirm`} onClick={handleGoCreate}>
|
||||
去创建
|
||||
</Button>
|
||||
</div>
|
||||
<SafeBottomPadding />
|
||||
</Popup>
|
||||
</HomePage>
|
||||
);
|
||||
}
|
||||
|
@ -1,33 +1,35 @@
|
||||
import { BaseEventOrig, Button, ButtonProps, Image, InputProps } from '@tarojs/components';
|
||||
import Taro, { UploadTask } from '@tarojs/taro';
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { Dialog } from '@taroify/core';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import BlFormInput from '@/components/bl-form-input';
|
||||
import BlFormItem from '@/components/bl-form-item';
|
||||
import LoadingDialog from '@/components/loading-dialog';
|
||||
import CompanyPublishJobBuy from '@/components/product-dialog/steps-ui/company-publish-job-buy';
|
||||
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
||||
import { EventName, PageUrl } from '@/constants/app';
|
||||
import { CertificationStatusType } from '@/constants/company';
|
||||
import { CollectEventName, ReportEventId } from '@/constants/event';
|
||||
import { ProductType } from '@/constants/product';
|
||||
import useCachedJobId from '@/hooks/use-cached-job';
|
||||
import useUserInfo from '@/hooks/use-user-info';
|
||||
import { ICertificationRequest } from '@/types/company';
|
||||
import { isValidIdCard, isValidPhone, logWithPrefix } from '@/utils/common';
|
||||
import { postCertification, getPhone } from '@/utils/company';
|
||||
import { collectEvent, reportEvent } from '@/utils/event';
|
||||
import { postPublishJob } from '@/utils/job';
|
||||
import { chooseMedia } from '@/utils/material';
|
||||
import { redirectTo } from '@/utils/route';
|
||||
import { requestProductBalance } from '@/utils/product';
|
||||
import { redirectTo } from '@/utils/route';
|
||||
import Toast from '@/utils/toast';
|
||||
import { dispatchUpdateUser, requestUserInfo } from '@/utils/user';
|
||||
import { uploadVideo } from '@/utils/video';
|
||||
|
||||
import './index.less';
|
||||
import { requestProductBalance } from '@/utils/product';
|
||||
import { ProductType } from '@/constants/product';
|
||||
import useCachedJob from '@/hooks/use-cached-job';
|
||||
import { postCreateJob } from '@/utils/job';
|
||||
import { Dialog } from '@taroify/core';
|
||||
import CompanyPublishJobBuy from '@/components/product-dialog/steps-ui/company-publish-job-buy';
|
||||
import { clearCachedJobId } from '@/store/actions';
|
||||
import store from '@/store';
|
||||
|
||||
const PREFIX = 'page-certification';
|
||||
const log = logWithPrefix(PREFIX);
|
||||
@ -107,7 +109,8 @@ export default function Certification() {
|
||||
const [company, setCompany] = useState('');
|
||||
const [open, setOpen] = useState(false);
|
||||
const [showBuy, setShowBuy] = useState(false);
|
||||
const cachedJobData = useCachedJob();
|
||||
const cachedJobId = useCachedJobId();
|
||||
const createdJobIdRef = useRef('');
|
||||
|
||||
const handleClickIdCardLeft = useCallback(async () => {
|
||||
reportEvent(ReportEventId.CLICK_UPLOAD_ID_CARD, { type: 'left' });
|
||||
@ -141,25 +144,28 @@ export default function Certification() {
|
||||
setCompany(value);
|
||||
}, []);
|
||||
|
||||
const handleCreateJob = useCallback(async () => {
|
||||
if (cachedJobData.employType) {
|
||||
const handleCloseBuy = useCallback(() => {
|
||||
setShowBuy(false);
|
||||
redirectTo(PageUrl.CertificationManage);
|
||||
}, []);
|
||||
|
||||
const handlePublishJob = useCallback(async () => {
|
||||
try {
|
||||
Taro.showLoading();
|
||||
try {
|
||||
await postCreateJob(cachedJobData);
|
||||
Taro.eventCenter.trigger(EventName.COMPANY_JOB_PUBLISH_CHANGED);
|
||||
await Toast.success('通告创建成功', 1500, true);
|
||||
redirectTo(PageUrl.CertificationManage);
|
||||
} catch (e) {
|
||||
console.error('submit error', e);
|
||||
Toast.error('通告审核失败请重试');
|
||||
collectEvent(CollectEventName.PUBLISH_JOB_FAILED, e);
|
||||
} finally {
|
||||
Taro.hideLoading();
|
||||
}
|
||||
} else {
|
||||
Toast.error('数据出错');
|
||||
await postPublishJob(cachedJobId!);
|
||||
await Toast.success('通告发布成功', 1500, true);
|
||||
store.dispatch(clearCachedJobId());
|
||||
Taro.eventCenter.trigger(EventName.COMPANY_JOB_PUBLISH_CHANGED);
|
||||
redirectTo(PageUrl.CertificationManage);
|
||||
} catch (e) {
|
||||
console.error('submit error', e);
|
||||
Toast.error('通告发布失败');
|
||||
collectEvent(CollectEventName.PUBLISH_JOB_FAILED, e);
|
||||
redirectTo(PageUrl.CertificationManage);
|
||||
} finally {
|
||||
Taro.hideLoading();
|
||||
}
|
||||
}, [cachedJobData]);
|
||||
}, [cachedJobId]);
|
||||
|
||||
const handleSubmit = useCallback(async () => {
|
||||
reportEvent(ReportEventId.CLICK_CERTIFICATION_SUBMIT);
|
||||
@ -185,15 +191,13 @@ export default function Certification() {
|
||||
return;
|
||||
}
|
||||
dispatchUpdateUser({ bossAuthStatus: CertificationStatusType.Success });
|
||||
// 判断付钱没有
|
||||
|
||||
const [time] = await requestProductBalance(ProductType.CompanyPublishJob);
|
||||
if (time <= 0) {
|
||||
// 付钱
|
||||
setShowBuy(true);
|
||||
Taro.hideLoading();
|
||||
} else {
|
||||
// 获取data创建
|
||||
await handleCreateJob();
|
||||
await handlePublishJob();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('submit error', e);
|
||||
@ -210,6 +214,7 @@ export default function Certification() {
|
||||
try {
|
||||
const { phoneNumber } = await getPhone(e.detail.code);
|
||||
setRevisedPhone(phoneNumber);
|
||||
// eslint-disable-next-line @typescript-eslint/no-shadow
|
||||
} catch (e) {
|
||||
Toast.error('获取手机号失败');
|
||||
}
|
||||
@ -299,9 +304,9 @@ export default function Certification() {
|
||||
<div>
|
||||
<LoadingDialog open={open} text="认证中" />
|
||||
</div>
|
||||
<Dialog open={showBuy} onClose={() => setShowBuy(false)}>
|
||||
<Dialog open={showBuy} onClose={handleCloseBuy}>
|
||||
<Dialog.Content>
|
||||
<CompanyPublishJobBuy onNext={handleCreateJob} defaultSelect={1} />
|
||||
<CompanyPublishJobBuy onNext={handlePublishJob} />
|
||||
</Dialog.Content>
|
||||
</Dialog>
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Map, MapProps, Text, Image, Button } from '@tarojs/components';
|
||||
import { Button, Image, Map, MapProps, Text } from '@tarojs/components';
|
||||
import Taro, { useLoad, useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
@ -12,10 +12,10 @@ 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 { RoleType, EventName, PageUrl } from '@/constants/app';
|
||||
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 } from '@/constants/job';
|
||||
import { EMPLOY_TYPE_TITLE_MAP, GET_CONTACT_TYPE, JobManageStatus } from '@/constants/job';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import useUserInfo from '@/hooks/use-user-info';
|
||||
import useRoleType from '@/hooks/user-role-type';
|
||||
@ -26,7 +26,7 @@ import { IMaterialMessage } from '@/types/message';
|
||||
import { switchRoleType } from '@/utils/app';
|
||||
import { copy, logWithPrefix } from '@/utils/common';
|
||||
import { collectEvent, reportEvent } from '@/utils/event';
|
||||
import { getJobTitle, getJobSalary, postPublishJob, requestJobDetail } from '@/utils/job';
|
||||
import { getJobSalary, getJobTitle, postPublishJob, requestJobDetail } from '@/utils/job';
|
||||
import { calcDistance, isValidLocation } from '@/utils/location';
|
||||
import { requestProfileDetail } from '@/utils/material';
|
||||
import { isChatWithSelf, postCreateChat } from '@/utils/message';
|
||||
@ -38,6 +38,10 @@ 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 } from '@/utils/product';
|
||||
import { ProductType } from '@/constants/product';
|
||||
|
||||
const PREFIX = 'job-detail';
|
||||
const log = logWithPrefix(PREFIX);
|
||||
@ -79,8 +83,11 @@ const AnchorFooter = (props: { data: JobDetails }) => {
|
||||
|
||||
if (data.sourcePlat !== 'bl') {
|
||||
if (needCreateMaterial) {
|
||||
setShowMaterialGuide(true);
|
||||
return;
|
||||
const [time] = await requestProductBalance(ProductType.VIP);
|
||||
if (time <= 0) {
|
||||
setShowMaterialGuide(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (data.isAuthed) {
|
||||
@ -162,6 +169,7 @@ const AnchorFooter = (props: { data: JobDetails }) => {
|
||||
|
||||
const CompanyFooter = (props: { data: JobDetails }) => {
|
||||
const { data } = props;
|
||||
const [showBuy, setShowBuy] = useState(false);
|
||||
|
||||
const handleClickEdit = useCallback(() => navigateTo(PageUrl.JobPublish, { jobId: data.id }), [data]);
|
||||
|
||||
@ -170,17 +178,22 @@ const CompanyFooter = (props: { data: JobDetails }) => {
|
||||
Taro.showLoading();
|
||||
await postPublishJob(data.id);
|
||||
Taro.eventCenter.trigger(EventName.COMPANY_JOB_PUBLISH_CHANGED);
|
||||
setShowBuy(false);
|
||||
Toast.success('发布成功');
|
||||
Taro.hideLoading();
|
||||
} catch (error) {
|
||||
Taro.hideLoading();
|
||||
const e = error as HttpError;
|
||||
const errorCode = e.errorCode;
|
||||
const errorMsg = e.info?.() || e.message;
|
||||
collectEvent(CollectEventName.PUBLISH_OPEN_JOB_FAILED, { jobId: data.id, error: e.info?.() || e.message });
|
||||
if (errorCode === RESPONSE_ERROR_CODE.BOSS_VIP_EXPIRED) {
|
||||
if (errorCode === RESPONSE_ERROR_CODE.INSUFFICIENT_BALANCE) {
|
||||
Toast.info('您购买的产品已耗尽使用次数');
|
||||
setShowBuy(true);
|
||||
} else if (errorCode === RESPONSE_ERROR_CODE.BOSS_VIP_EXPIRED) {
|
||||
Toast.info('该通告已到期,请创建新通告', 3000);
|
||||
} else {
|
||||
Toast.error(e.message || '发布失败请重试', 3000);
|
||||
Toast.error(errorMsg || '发布失败请重试', 3000);
|
||||
}
|
||||
console.error(e);
|
||||
}
|
||||
@ -192,10 +205,19 @@ const CompanyFooter = (props: { data: JobDetails }) => {
|
||||
<Button className={`${PREFIX}__share-button`} onClick={handleClickEdit}>
|
||||
编辑
|
||||
</Button>
|
||||
<Button className={`${PREFIX}__contact-publisher`} onClick={handlePublishJob}>
|
||||
<Button
|
||||
disabled={data.status === JobManageStatus.Open}
|
||||
className={`${PREFIX}__contact-publisher`}
|
||||
onClick={handlePublishJob}
|
||||
>
|
||||
发布通告
|
||||
</Button>
|
||||
</div>
|
||||
<Dialog open={showBuy} onClose={() => setShowBuy(false)}>
|
||||
<Dialog.Content>
|
||||
<CompanyPublishJobBuy onNext={handlePublishJob} />
|
||||
</Dialog.Content>
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
@ -3,7 +3,7 @@ import Taro, { useLoad } from '@tarojs/taro';
|
||||
|
||||
import { Dialog } from '@taroify/core';
|
||||
import classNames from 'classnames';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import BlFormCell from '@/components/bl-form-cell';
|
||||
import BlFormInput from '@/components/bl-form-input';
|
||||
@ -22,7 +22,7 @@ import { EMPLOY_TYPE_TITLE_MAP, EmployType, JOB_TYPE_SELECT_OPTIONS, JobType } f
|
||||
import { ProductType } from '@/constants/product';
|
||||
import useUserInfo from '@/hooks/use-user-info';
|
||||
import store from '@/store';
|
||||
import { cacheCreateJob } from '@/store/actions';
|
||||
import { cacheJobId } from '@/store/actions';
|
||||
import { CreateJobInfo, JobDetails } from '@/types/job';
|
||||
import { logWithPrefix } from '@/utils/common';
|
||||
import { collectEvent } from '@/utils/event';
|
||||
@ -33,6 +33,7 @@ import {
|
||||
requestJobDetail,
|
||||
isFullTimePriceRequired,
|
||||
isPartTimePriceRequired,
|
||||
postPublishJob,
|
||||
} from '@/utils/job';
|
||||
import { getCityValues } from '@/utils/location';
|
||||
import { requestProductBalance } from '@/utils/product';
|
||||
@ -107,6 +108,7 @@ export default function JobPublish() {
|
||||
const [showCityPicker, setShowCityPicker] = useState(false);
|
||||
const [address, setAddress] = useState('');
|
||||
const [showBuy, setShowBuy] = useState(false);
|
||||
const createdJobIdRef = useRef('');
|
||||
const userInfo = useUserInfo();
|
||||
|
||||
const handleEmployTypeChange = useCallback((value: EmployType) => {
|
||||
@ -200,13 +202,18 @@ export default function JobPublish() {
|
||||
await postUpdateJob(data);
|
||||
Taro.eventCenter.trigger(EventName.JOB_UPDATE, job!.id);
|
||||
} else {
|
||||
const jobId = await postCreateJob(data);
|
||||
createdJobIdRef.current = jobId;
|
||||
Taro.eventCenter.trigger(EventName.COMPANY_JOB_PUBLISH_CHANGED);
|
||||
|
||||
if (userInfo.bossAuthStatus !== CertificationStatusType.Success) {
|
||||
// 去认证
|
||||
store.dispatch(cacheCreateJob(data));
|
||||
store.dispatch(cacheJobId(jobId));
|
||||
navigateTo(PageUrl.CertificationStart);
|
||||
Taro.hideLoading();
|
||||
return;
|
||||
}
|
||||
|
||||
const [time] = await requestProductBalance(ProductType.CompanyPublishJob);
|
||||
if (time <= 0) {
|
||||
// 付钱
|
||||
@ -214,12 +221,14 @@ export default function JobPublish() {
|
||||
Taro.hideLoading();
|
||||
return;
|
||||
}
|
||||
await postCreateJob(data);
|
||||
|
||||
await postPublishJob(jobId);
|
||||
}
|
||||
Taro.eventCenter.trigger(EventName.COMPANY_JOB_PUBLISH_CHANGED);
|
||||
await Toast.success(isUpdateJob ? '更新成功' : '创建成功', 1500, true);
|
||||
await Toast.success(isUpdateJob ? '更新成功' : '创建并发布成功', 1500, true);
|
||||
navigateBack();
|
||||
} catch (e) {
|
||||
createdJobIdRef.current = '';
|
||||
console.error('submit error', e);
|
||||
Toast.error('审核失败请重试');
|
||||
collectEvent(CollectEventName.PUBLISH_JOB_FAILED, e);
|
||||
@ -229,18 +238,11 @@ export default function JobPublish() {
|
||||
}, [getCreateJobInfo, isUpdate, job, userInfo.bossAuthStatus]);
|
||||
|
||||
const handleNext = useCallback(async () => {
|
||||
const [data, cityCodes] = getCreateJobInfo();
|
||||
|
||||
const cityValues = getCityValues(cityCodes);
|
||||
if (!data.address.startsWith(cityValues)) {
|
||||
data.address = `${cityValues}${data.address}`;
|
||||
}
|
||||
Taro.showLoading();
|
||||
|
||||
try {
|
||||
await postCreateJob(data);
|
||||
await postPublishJob(createdJobIdRef.current);
|
||||
Taro.eventCenter.trigger(EventName.COMPANY_JOB_PUBLISH_CHANGED);
|
||||
await Toast.success('创建成功', 1500, true);
|
||||
await Toast.success('发布成功', 1500, true);
|
||||
navigateBack();
|
||||
} catch (e) {
|
||||
console.error('submit error', e);
|
||||
@ -249,7 +251,12 @@ export default function JobPublish() {
|
||||
} finally {
|
||||
Taro.hideLoading();
|
||||
}
|
||||
}, [getCreateJobInfo]);
|
||||
}, []);
|
||||
|
||||
const handleClosePublishJob = useCallback(() => {
|
||||
setShowBuy(false);
|
||||
navigateBack(-1);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const callback = (d: string) => setDescribe(d);
|
||||
@ -342,7 +349,7 @@ export default function JobPublish() {
|
||||
<div className={`${PREFIX}__footer__buttons`}>
|
||||
{!isUpdate && (
|
||||
<Button className={`${PREFIX}__footer__button`} onClick={handleSubmit}>
|
||||
创建
|
||||
创建并发布
|
||||
</Button>
|
||||
)}
|
||||
{isUpdate && (
|
||||
@ -365,9 +372,9 @@ export default function JobPublish() {
|
||||
onConfirm={handleConfirmCityPicker}
|
||||
onCancel={() => setShowCityPicker(false)}
|
||||
/>
|
||||
<Dialog open={showBuy} onClose={() => setShowBuy(false)}>
|
||||
<Dialog open={showBuy} onClose={handleClosePublishJob}>
|
||||
<Dialog.Content>
|
||||
<CompanyPublishJobBuy onNext={handleNext} defaultSelect={1}/>
|
||||
<CompanyPublishJobBuy onNext={handleNext} />
|
||||
</Dialog.Content>
|
||||
</Dialog>
|
||||
</div>
|
||||
|
@ -150,7 +150,7 @@ export default function JobSearch() {
|
||||
<SearchInput
|
||||
focus={focus}
|
||||
value={value}
|
||||
placeholder="你想搜什么"
|
||||
placeholder="可以试试地区 品类"
|
||||
searchAction={searchAction}
|
||||
className={`${PREFIX}__search`}
|
||||
onClear={handleSearchClear}
|
||||
|
@ -6,7 +6,6 @@ import classNames from 'classnames';
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
import { EventName, OpenSource } from '@/constants/app';
|
||||
import { JobManageStatus } from '@/constants/job';
|
||||
import { JobManageInfo } from '@/types/job';
|
||||
import { getJobLocation, requestJobManageList } from '@/utils/job';
|
||||
import { getPageQuery, navigateBack } from '@/utils/route';
|
||||
@ -34,7 +33,7 @@ export default function JobSelectMyPublish() {
|
||||
const query = getPageQuery<{ id: string; source: OpenSource }>();
|
||||
query?.id && setJobId(query.id);
|
||||
try {
|
||||
const res = await requestJobManageList({ status: JobManageStatus.Open });
|
||||
const res = await requestJobManageList();
|
||||
setList(res.jobResults);
|
||||
setSource(query.source);
|
||||
} catch (e) {
|
||||
|
@ -7,7 +7,7 @@ import { AgreementPopup } from '@/components/agreement-popup';
|
||||
import HomePage from '@/components/home-page';
|
||||
import MaterialGuide from '@/components/material-guide';
|
||||
import { EventName, OpenSource, PageType, PageUrl, RoleType } from '@/constants/app';
|
||||
import { EmployType, JOB_PAGE_TABS, SortType } from '@/constants/job';
|
||||
import { EmployType, JOB_PAGE_TABS, JobSourceType, SortType } from '@/constants/job';
|
||||
import JobFragment from '@/fragments/job/base';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import useLocation from '@/hooks/use-location';
|
||||
@ -31,7 +31,8 @@ export default function Job() {
|
||||
const location = useLocation();
|
||||
const { barHeight, statusBarHeight } = useNavigation();
|
||||
const inviteCode = useInviteCode();
|
||||
const [tabType, setTabType] = useState<EmployType>(EmployType.All);
|
||||
const [tabType, setTabType] = useState<JobSourceType>(JobSourceType.All);
|
||||
const [employType, setEmployType] = useState<EmployType>(EmployType.All);
|
||||
const [sortType, setSortType] = useState<SortType>(SortType.RECOMMEND);
|
||||
const [cityCode, setCityCode] = useState<string>(location.cityCode);
|
||||
const [coordinate, setCoordinate] = useState<Coordinate>({
|
||||
@ -59,6 +60,10 @@ export default function Job() {
|
||||
[cityCode]
|
||||
);
|
||||
|
||||
const handleClickEmployType = useCallback(type => {
|
||||
setEmployType(type);
|
||||
}, []);
|
||||
|
||||
const handleClickSortType = useCallback(
|
||||
async (type: SortType) => {
|
||||
if (type === SortType.DISTANCE && (!location.latitude || !location.longitude)) {
|
||||
@ -151,8 +156,10 @@ export default function Job() {
|
||||
<JobFragment
|
||||
cityCode={cityCode}
|
||||
sortType={sortType}
|
||||
employType={tab.type}
|
||||
sourceType={tab.type}
|
||||
employType={employType}
|
||||
coordinate={coordinate}
|
||||
onClickEmployType={handleClickEmployType}
|
||||
onClickCity={handleClickCity}
|
||||
onClickSort={handleClickSortType}
|
||||
/>
|
||||
|
@ -190,7 +190,7 @@ export default function MaterialUploadVideo() {
|
||||
onTitleChange={(newTitle: string) => handleTitleChange(video, newTitle)}
|
||||
/>
|
||||
))}
|
||||
{videoList.length < 6 && <MaterialVideoCard videoInfo={TEMP_DATA} onClickUpload={handleClickUpload} isTemp />}
|
||||
{videoList.length < 10 && <MaterialVideoCard videoInfo={TEMP_DATA} onClickUpload={handleClickUpload} isTemp />}
|
||||
</div>
|
||||
<SafeBottomPadding />
|
||||
<div className={`${PREFIX}__footer`}>
|
||||
|
@ -1,13 +1,16 @@
|
||||
import { Button } from '@tarojs/components';
|
||||
import Taro, { useLoad, useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import { Dialog } from '@taroify/core';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import CommonDialog from '@/components/common-dialog';
|
||||
import PageLoading from '@/components/page-loading';
|
||||
import CompanyPublishJobBuy from '@/components/product-dialog/steps-ui/company-publish-job-buy';
|
||||
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
||||
import { EventName, OpenSource, PageUrl, RoleType } from '@/constants/app';
|
||||
import { CollectEventName } from '@/constants/event';
|
||||
import { JobManageStatus } from '@/constants/job';
|
||||
import { MaterialViewSource } from '@/constants/material';
|
||||
import ProfileViewFragment from '@/fragments/profile/view';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
@ -19,7 +22,7 @@ import { IJobMessage } from '@/types/message';
|
||||
import { switchRoleType } from '@/utils/app';
|
||||
import { copy } from '@/utils/common';
|
||||
import { collectEvent } from '@/utils/event';
|
||||
import { requestHasPublishedJob, requestJobDetail } from '@/utils/job';
|
||||
import { postPublishJob, requestHasPublishedJob, requestJobDetail } from '@/utils/job';
|
||||
import { getMaterialShareMessage, requestReadProfile, requestShareProfile } from '@/utils/material';
|
||||
import { isChatWithSelf, postCreateChat } from '@/utils/message';
|
||||
import { getInviteCodeFromQueryAndUpdate } from '@/utils/partner';
|
||||
@ -67,15 +70,16 @@ export default function MaterialViewPage() {
|
||||
const [jobId, setJobId] = useState<string>();
|
||||
const [errorTips, setErrorTips] = useState<string>('');
|
||||
const [publishDialogVisible, setPublishDialogVisible] = useState(false);
|
||||
const [certificationDialogVisible, setCertificationDialogVisible] = useState(false);
|
||||
const [noTimeDialogVisible, setNoTimeDialogVisible] = useState(false);
|
||||
const [noVipLimitVisible, setNoVipLimitVisible] = useState(false);
|
||||
const [vipExpiredVisible, setVipExpiredVisible] = useState(false);
|
||||
const inviteCode = useInviteCode();
|
||||
const [showBuy, setShowBuy] = useState(false);
|
||||
|
||||
const onDev = useCallback(async () => profile && copy(profile.userId), [profile]);
|
||||
|
||||
const handleClickContact = useCallback(async () => {
|
||||
setShowBuy(false);
|
||||
if (!profile) {
|
||||
return;
|
||||
}
|
||||
@ -87,6 +91,10 @@ export default function MaterialViewPage() {
|
||||
return;
|
||||
}
|
||||
const jobDetail = await requestJobDetail(jobId);
|
||||
if (jobDetail.status !== JobManageStatus.Open) {
|
||||
setShowBuy(true);
|
||||
return;
|
||||
}
|
||||
const chat = await postCreateChat(toUserId);
|
||||
const jobMessage: IJobMessage = {
|
||||
id: jobDetail.id,
|
||||
@ -116,7 +124,16 @@ export default function MaterialViewPage() {
|
||||
}
|
||||
}
|
||||
}, [profile, jobId]);
|
||||
|
||||
const handleNext = useCallback(async () => {
|
||||
setShowBuy(false);
|
||||
try {
|
||||
await postPublishJob(jobId!);
|
||||
await handleClickContact();
|
||||
} catch (e) {
|
||||
Toast.error('通告发布失败');
|
||||
collectEvent(CollectEventName.PUBLISH_JOB_FAILED, e);
|
||||
}
|
||||
}, [handleClickContact, jobId]);
|
||||
const handleClickNoViewTimes = useCallback(() => {
|
||||
setNoTimeDialogVisible(false);
|
||||
navigateBack();
|
||||
@ -127,11 +144,6 @@ export default function MaterialViewPage() {
|
||||
redirectTo(PageUrl.CertificationManage);
|
||||
}, []);
|
||||
|
||||
const handleClickGoCertification = useCallback(() => {
|
||||
setCertificationDialogVisible(false);
|
||||
redirectTo(PageUrl.CertificationStart);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const callback = (select: JobManageInfo, source: OpenSource) =>
|
||||
source === OpenSource.MaterialViewPage && setJobId(select.id);
|
||||
@ -162,9 +174,7 @@ export default function MaterialViewPage() {
|
||||
const errorCode = e.errorCode;
|
||||
collectEvent(CollectEventName.VIEW_MATERIAL_FAILED, { context, error: e.info?.() || e.message });
|
||||
console.error(e);
|
||||
if (errorCode === RESPONSE_ERROR_CODE.BOSS_NOT_AUTH) {
|
||||
setCertificationDialogVisible(true);
|
||||
} else if (errorCode === RESPONSE_ERROR_CODE.NO_PUBLISHED_JOB) {
|
||||
if (errorCode === RESPONSE_ERROR_CODE.NO_PUBLISHED_JOB) {
|
||||
setPublishDialogVisible(true);
|
||||
} else if (errorCode === RESPONSE_ERROR_CODE.INSUFFICIENT_BALANCE) {
|
||||
setNoTimeDialogVisible(true);
|
||||
@ -179,7 +189,7 @@ export default function MaterialViewPage() {
|
||||
});
|
||||
|
||||
useShareAppMessage(async () => {
|
||||
const shareMessage = await getMaterialShareMessage(profile, true, inviteCode);
|
||||
const shareMessage = await getMaterialShareMessage(profile, true, inviteCode, jobId);
|
||||
return shareMessage as BL.Anything;
|
||||
});
|
||||
|
||||
@ -187,13 +197,6 @@ export default function MaterialViewPage() {
|
||||
return (
|
||||
<>
|
||||
<PageLoading />
|
||||
<CommonDialog
|
||||
content="要查看主播详情,请先完成实人认证"
|
||||
confirm="去认证"
|
||||
visible={certificationDialogVisible}
|
||||
onClose={() => setCertificationDialogVisible(false)}
|
||||
onClick={handleClickGoCertification}
|
||||
/>
|
||||
<CommonDialog
|
||||
content="请先发布一个认证通告"
|
||||
confirm="去发布"
|
||||
@ -260,6 +263,11 @@ export default function MaterialViewPage() {
|
||||
onClose={() => setErrorTips('')}
|
||||
onClick={() => setErrorTips('')}
|
||||
/>
|
||||
<Dialog open={showBuy} onClose={() => setShowBuy(false)}>
|
||||
<Dialog.Content>
|
||||
<CompanyPublishJobBuy onNext={handleNext} />
|
||||
</Dialog.Content>
|
||||
</Dialog>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -1,7 +1,5 @@
|
||||
import { CreateJobInfo } from '@/types/job';
|
||||
import { SET_JOB_ID } from '../constants';
|
||||
|
||||
import { CREATE_JOB } from '../constants';
|
||||
export const cacheJobId = (value: string) => ({ type: SET_JOB_ID, value });
|
||||
|
||||
export const cacheCreateJob = (value: CreateJobInfo) => ({ type: CREATE_JOB, value });
|
||||
|
||||
export const clearCachedJob = () => ({ type: CREATE_JOB, value: {} });
|
||||
export const clearCachedJobId = () => ({ type: SET_JOB_ID, value: null });
|
||||
|
@ -5,4 +5,4 @@ export const SET_USER_INFO = 'SET_USER_INFO';
|
||||
export const SET_BIND_PHONE = 'SET_BIND_PHONE';
|
||||
export const SET_USER_MESSAGE = 'SET_USER_MESSAGE';
|
||||
export const SET_INVITE_CODE = 'SET_INVITE_CODE';
|
||||
export const CREATE_JOB = 'CREATE_JOB';
|
||||
export const SET_JOB_ID = 'SET_JOB_ID';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { combineReducers } from 'redux';
|
||||
|
||||
import appState from './app';
|
||||
import jobState from './job';
|
||||
import jobInfo from './job';
|
||||
import message from './message';
|
||||
import partnerInfo from './partner';
|
||||
import userInfo from './user';
|
||||
@ -11,5 +11,5 @@ export default combineReducers({
|
||||
userInfo,
|
||||
message,
|
||||
partnerInfo,
|
||||
jobState,
|
||||
jobInfo,
|
||||
});
|
||||
|
@ -1,19 +1,15 @@
|
||||
import { Action } from 'redux';
|
||||
|
||||
import { CreateJobInfo } from '@/types/job';
|
||||
import { SET_JOB_ID } from '../constants';
|
||||
|
||||
import { CREATE_JOB } from '../constants';
|
||||
|
||||
const INIT_STATE: Partial<CreateJobInfo> = {};
|
||||
|
||||
const userInfo = (state: Partial<CreateJobInfo> = INIT_STATE, action: Action): Partial<CreateJobInfo> => {
|
||||
const jobInfo = (state: Partial<string | null> = null, action: Action): Partial<string | null> => {
|
||||
const { type, value } = action as BL.Anything;
|
||||
switch (type) {
|
||||
case CREATE_JOB:
|
||||
case SET_JOB_ID:
|
||||
return value;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export default userInfo;
|
||||
export default jobInfo;
|
||||
|
@ -1,3 +1,3 @@
|
||||
import { IState } from '@/types/store';
|
||||
|
||||
export const selectCreatedJob = (state: IState) => state.jobState;
|
||||
export const selectCreatedJob = (state: IState) => state.jobInfo;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { JobType, EmployType, SortType, UserJobType, JobManageStatus } from '@/constants/job';
|
||||
import { JobType, EmployType, SortType, UserJobType, JobManageStatus, JobSourceType } from '@/constants/job';
|
||||
import { DeclarationType } from '@/constants/product';
|
||||
import type { IPaginationRequest, IPaginationResponse } from '@/types/common';
|
||||
import { LocationInfo } from '@/types/location';
|
||||
@ -50,6 +50,7 @@ export type JobDetails = JobInfo &
|
||||
userId: string; // 发布人的 userId
|
||||
verifyFailReason?: string; // 审核不通过的原因
|
||||
sourcePlat?: string;
|
||||
status: JobManageStatus
|
||||
};
|
||||
|
||||
export interface JobManageInfo {
|
||||
@ -83,6 +84,7 @@ export interface GetJobsRequest extends IPaginationRequest {
|
||||
minSalary?: number;
|
||||
maxSalary?: number;
|
||||
blGroupId?: string; // 播络群 id
|
||||
sourceType?: JobSourceType;
|
||||
}
|
||||
|
||||
// 获取通告列表响应接口
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { RoleType, PageType } from '@/constants/app';
|
||||
import { CreateJobInfo } from '@/types/job';
|
||||
import { UserMessage } from '@/types/message';
|
||||
import { PartnerInfo } from '@/types/partner';
|
||||
|
||||
@ -11,7 +10,7 @@ export interface IState {
|
||||
userInfo: UserInfo;
|
||||
message: UserMessage;
|
||||
partnerInfo: PartnerInfo;
|
||||
jobState: CreateJobInfo;
|
||||
jobInfo: string | null;
|
||||
}
|
||||
|
||||
export interface AppState {
|
||||
|
@ -2,7 +2,7 @@ import Taro from '@tarojs/taro';
|
||||
|
||||
import { CacheKey } from '@/constants/cache-key';
|
||||
import { CollectEventName } from '@/constants/event';
|
||||
import { EmployType, JobManageStatus, UserJobType } from '@/constants/job';
|
||||
import { EmployType, JobManageStatus, JobSourceType, UserJobType } from '@/constants/job';
|
||||
import http from '@/http';
|
||||
import { API } from '@/http/api';
|
||||
import store from '@/store';
|
||||
@ -80,6 +80,7 @@ async function requestMyBrowsedJobList(data: GetUserJobRequest) {
|
||||
|
||||
export async function requestJobList(data: GetJobsRequest = {}) {
|
||||
const isGetMyJob = data.isOwner || data.isFollow;
|
||||
data.sourceType = data.sourceType === JobSourceType.All ? undefined : data.sourceType;
|
||||
const url = isGetMyJob ? API.GET_MY_JOB_LIST_V2 : API.GET_JOB_LIST;
|
||||
return await http.post<GetJobsResponse>(url, { data });
|
||||
}
|
||||
@ -116,8 +117,9 @@ export async function requestHasPublishedJob() {
|
||||
return data.jobResults.length > 0;
|
||||
}
|
||||
|
||||
export function postCreateJob(data: CreateJobInfo) {
|
||||
return http.post(API.CREATE_JOB, { data });
|
||||
export async function postCreateJob(data: CreateJobInfo): Promise<string> {
|
||||
const jobId = await http.post(API.CREATE_JOB, { data });
|
||||
return jobId;
|
||||
}
|
||||
|
||||
export function postUpdateJob(data: CreateJobInfo) {
|
||||
|
@ -89,9 +89,9 @@ export const requestReadProfile = async (data: GetReadProfileRequest) => {
|
||||
return http.post<MaterialProfile>(API.READ_PROFILE, { data });
|
||||
};
|
||||
|
||||
export const requestProfileShareCode = async (resumeId: string) => {
|
||||
export const requestProfileShareCode = async (resumeId: string, jobId?: string) => {
|
||||
return http.post<MaterialProfile>(API.GET_PROFILE_SHARE_CODE, {
|
||||
data: { resumeId },
|
||||
data: { resumeId, jobId },
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
});
|
||||
};
|
||||
@ -142,14 +142,15 @@ export const requestAnchorList = async (data: GetAnchorListRequest) => {
|
||||
export const getMaterialShareMessage = async (
|
||||
profile?: MaterialProfile | null,
|
||||
needShareCode: boolean = true,
|
||||
inviteCode?: string
|
||||
inviteCode?: string,
|
||||
jobId?: string
|
||||
) => {
|
||||
if (!profile) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
const { id, name = '', workedSecCategoryStr } = profile;
|
||||
const shareCode = needShareCode ? await requestProfileShareCode(id) : undefined;
|
||||
const shareCode = needShareCode ? await requestProfileShareCode(id, jobId) : undefined;
|
||||
const title = `${name} ${workedSecCategoryStr ? `播过 ${workedSecCategoryStr}` : ''}`.trim();
|
||||
return {
|
||||
title,
|
||||
|
@ -9,7 +9,7 @@ import {
|
||||
GetProductIsUnlockRequest,
|
||||
PostUseProductRequest,
|
||||
GetProductIsUnlockResponse,
|
||||
CustomerServiceInfo,
|
||||
// CustomerServiceInfo,
|
||||
CreatePayInfoRequest,
|
||||
CreatePayInfoResponse,
|
||||
CreatePayOrderParams,
|
||||
@ -74,7 +74,7 @@ export async function requestAllBuyProduct(productCode: ProductType) {
|
||||
}
|
||||
|
||||
export async function requestCsQrCode(_type: QrCodeType) {
|
||||
const result = await http.post<CustomerServiceInfo>(API.CS_QR_CODE);
|
||||
// const result = await http.post<CustomerServiceInfo>(API.CS_QR_CODE);
|
||||
return 'https://publiccdn.neighbourhood.com.cn/img/bzQrcode.jpg';
|
||||
// return `${DOMAIN}/${result.vxQrCode}`;
|
||||
}
|
||||
|
Reference in New Issue
Block a user