feat: update
This commit is contained in:
@ -1,18 +1,21 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import BaseTabBar from '@/components/tab-bar';
|
import BaseTabBar from '@/components/tab-bar';
|
||||||
|
import { PageType } from '@/constants/app';
|
||||||
|
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
interface IProps extends React.PropsWithChildren {}
|
interface IProps extends React.PropsWithChildren {
|
||||||
|
type: PageType;
|
||||||
|
}
|
||||||
|
|
||||||
export default function HomePage(props: IProps) {
|
export default function HomePage(props: IProps) {
|
||||||
const { children } = props;
|
const { children, type } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{children}
|
{children}
|
||||||
<BaseTabBar />
|
<BaseTabBar type={type} />
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -80,4 +80,8 @@
|
|||||||
margin-top: 24px;
|
margin-top: 24px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__no-subscription {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
@ -57,7 +57,9 @@ export function MessageNoTimesDialog(props: INoTimesProps) {
|
|||||||
<Dialog className={NO_TIMES} onClose={onClose} open={open}>
|
<Dialog className={NO_TIMES} onClose={onClose} open={open}>
|
||||||
<Dialog.Content>
|
<Dialog.Content>
|
||||||
<div className={`${NO_TIMES}__title`}>未读消息提醒次数不够了!</div>
|
<div className={`${NO_TIMES}__title`}>未读消息提醒次数不够了!</div>
|
||||||
<div className={`${NO_TIMES}__tips`}>有通知次数才能<span className="highlight">及时收到</span>招聘邀请,快点击“点我增加”吧~</div>
|
<div className={`${NO_TIMES}__tips`}>
|
||||||
|
有通知次数才能<span className="highlight">及时收到</span>招聘邀请,快点击“点我增加”吧~
|
||||||
|
</div>
|
||||||
<div className={`${NO_TIMES}__body`}>
|
<div className={`${NO_TIMES}__body`}>
|
||||||
<div className={`${NO_TIMES}__times`}>{`未读消息提醒剩余:${times}次`}</div>
|
<div className={`${NO_TIMES}__times`}>{`未读消息提醒剩余:${times}次`}</div>
|
||||||
<Button className={`${NO_TIMES}__btn`} onClick={onClick}>
|
<Button className={`${NO_TIMES}__btn`} onClick={onClick}>
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
import { Tabbar } from '@taroify/core';
|
import { Tabbar } from '@taroify/core';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
|
||||||
|
|
||||||
import { APP_TAB_BAR_ID, RoleType, PageType, PageUrl } from '@/constants/app';
|
import { APP_TAB_BAR_ID, RoleType, PageType, PageUrl } from '@/constants/app';
|
||||||
import { ANCHOR_TAB_LIST, COMPANY_TAB_LIST, TabItemType } from '@/hooks/use-config';
|
import { ANCHOR_TAB_LIST, COMPANY_TAB_LIST, TabItemType } from '@/hooks/use-config';
|
||||||
import useMessage from '@/hooks/use-message';
|
import useMessage from '@/hooks/use-message';
|
||||||
import useRoleType from '@/hooks/user-role-type';
|
import useRoleType from '@/hooks/user-role-type';
|
||||||
import { changeHomePage } from '@/store/actions';
|
|
||||||
import { selectHomePageType } from '@/store/selector';
|
|
||||||
import { logWithPrefix } from '@/utils/common';
|
import { logWithPrefix } from '@/utils/common';
|
||||||
import { switchTab } from '@/utils/route';
|
import { switchTab } from '@/utils/route';
|
||||||
|
|
||||||
@ -16,6 +13,7 @@ import './index.less';
|
|||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
|
type: PageType;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PREFIX = 'base-tab-bar';
|
const PREFIX = 'base-tab-bar';
|
||||||
@ -40,25 +38,21 @@ const TabItem = (props: { item: TabItemType }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function BaseTabBar(props: IProps) {
|
function BaseTabBar({ className, type }: IProps) {
|
||||||
const { className } = props;
|
|
||||||
const roleType = useRoleType();
|
const roleType = useRoleType();
|
||||||
const currentPage = useSelector(selectHomePageType);
|
|
||||||
const dispatch = useDispatch();
|
|
||||||
|
|
||||||
const tabs = roleType === RoleType.Anchor ? ANCHOR_TAB_LIST : COMPANY_TAB_LIST;
|
const tabs = roleType === RoleType.Anchor ? ANCHOR_TAB_LIST : COMPANY_TAB_LIST;
|
||||||
|
|
||||||
const handleTabClick = useCallback(
|
const handleTabClick = useCallback(
|
||||||
(value: PageType) => {
|
(value: PageType) => {
|
||||||
if (value === currentPage) {
|
if (value === type) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dispatch(changeHomePage(value));
|
|
||||||
const item = tabs.find((i: TabItemType) => i.type === value);
|
const item = tabs.find((i: TabItemType) => i.type === value);
|
||||||
log('tab bar changed', value, item?.pagePath);
|
log('tab bar changed', value, item?.pagePath);
|
||||||
item && switchTab(item.pagePath as PageUrl);
|
item && switchTab(item.pagePath as PageUrl);
|
||||||
},
|
},
|
||||||
[tabs, currentPage, dispatch]
|
[tabs, type]
|
||||||
);
|
);
|
||||||
|
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
@ -72,14 +66,14 @@ function BaseTabBar(props: IProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(`${PREFIX}__wrapper`, className)} id={APP_TAB_BAR_ID}>
|
<div className={classNames(`${PREFIX}__wrapper`, className)} id={APP_TAB_BAR_ID}>
|
||||||
<Tabbar className={PREFIX} defaultValue={currentPage}>
|
<Tabbar className={PREFIX} value={type}>
|
||||||
{tabs.map((item: TabItemType) => {
|
{tabs.map((item: TabItemType) => {
|
||||||
return (
|
return (
|
||||||
<Tabbar.TabItem
|
<Tabbar.TabItem
|
||||||
key={item.pagePath}
|
key={item.pagePath}
|
||||||
value={item.type}
|
value={item.type}
|
||||||
onClick={() => handleTabClick(item.type)}
|
onClick={() => handleTabClick(item.type)}
|
||||||
className={classNames(`${PREFIX}__item`, { selected: item.type === currentPage })}
|
className={classNames(`${PREFIX}__item`, { selected: item.type === type })}
|
||||||
>
|
>
|
||||||
<TabItem item={item} />
|
<TabItem item={item} />
|
||||||
</Tabbar.TabItem>
|
</Tabbar.TabItem>
|
||||||
|
@ -35,7 +35,7 @@ const AnchorTabs: TabItemType[] = [
|
|||||||
{
|
{
|
||||||
type: PageType.GroupV2,
|
type: PageType.GroupV2,
|
||||||
pagePath: PageUrl.GroupV2,
|
pagePath: PageUrl.GroupV2,
|
||||||
text: '通告群',
|
text: '主播群',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
13
src/hooks/use-previous.ts
Normal file
13
src/hooks/use-previous.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { useEffect, useRef } from 'react';
|
||||||
|
|
||||||
|
function usePrevious<T>(value: T) {
|
||||||
|
const ref = useRef<T>();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
ref.current = value;
|
||||||
|
}, [value]);
|
||||||
|
|
||||||
|
return ref.current;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default usePrevious;
|
@ -1,7 +1,7 @@
|
|||||||
import { Image } from '@tarojs/components';
|
import { Image } from '@tarojs/components';
|
||||||
import Taro, { NodesRef, useDidShow, useLoad, useShareAppMessage } from '@tarojs/taro';
|
import Taro, { NodesRef, useDidShow, useLoad, useShareAppMessage } from '@tarojs/taro';
|
||||||
|
|
||||||
import { ArrowUp, ArrowDown } from '@taroify/icons';
|
import { ArrowDown, ArrowUp } from '@taroify/icons';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { isEqual } from 'lodash-es';
|
import { isEqual } from 'lodash-es';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
@ -14,7 +14,7 @@ import Overlay from '@/components/overlay';
|
|||||||
import PageLoading from '@/components/page-loading';
|
import PageLoading from '@/components/page-loading';
|
||||||
import PartnerBanner from '@/components/partner-banner';
|
import PartnerBanner from '@/components/partner-banner';
|
||||||
import SwitchBar from '@/components/switch-bar';
|
import SwitchBar from '@/components/switch-bar';
|
||||||
import { APP_TAB_BAR_ID, EventName, OpenSource, PageUrl } from '@/constants/app';
|
import { APP_TAB_BAR_ID, EventName, OpenSource, PageType, PageUrl, RoleType } from '@/constants/app';
|
||||||
import { EmployType, JobManageStatus } from '@/constants/job';
|
import { EmployType, JobManageStatus } from '@/constants/job';
|
||||||
import { ALL_ANCHOR_SORT_TYPES, ANCHOR_SORT_TYPE_TITLE_MAP, AnchorSortType } from '@/constants/material';
|
import { ALL_ANCHOR_SORT_TYPES, ANCHOR_SORT_TYPE_TITLE_MAP, AnchorSortType } from '@/constants/material';
|
||||||
import useInviteCode from '@/hooks/use-invite-code';
|
import useInviteCode from '@/hooks/use-invite-code';
|
||||||
@ -23,6 +23,7 @@ import useLocation from '@/hooks/use-location';
|
|||||||
import { JobManageInfo } from '@/types/job';
|
import { JobManageInfo } from '@/types/job';
|
||||||
import { Coordinate } from '@/types/location';
|
import { Coordinate } from '@/types/location';
|
||||||
import { IAnchorFilters } from '@/types/material';
|
import { IAnchorFilters } from '@/types/material';
|
||||||
|
import { switchRoleType } from '@/utils/app';
|
||||||
import { logWithPrefix } from '@/utils/common';
|
import { logWithPrefix } from '@/utils/common';
|
||||||
import { getLastSelectMyJobId, requestJobManageList, setLastSelectMyJobId } from '@/utils/job';
|
import { getLastSelectMyJobId, requestJobManageList, setLastSelectMyJobId } from '@/utils/job';
|
||||||
import { getWxLocation } from '@/utils/location';
|
import { getWxLocation } from '@/utils/location';
|
||||||
@ -165,8 +166,11 @@ export default function AnchorPage() {
|
|||||||
}, [location]);
|
}, [location]);
|
||||||
|
|
||||||
useLoad(async () => {
|
useLoad(async () => {
|
||||||
|
switchRoleType(RoleType.Company);
|
||||||
|
|
||||||
const query = getPageQuery();
|
const query = getPageQuery();
|
||||||
getInviteCodeFromQueryAndUpdate(query);
|
getInviteCodeFromQueryAndUpdate(query);
|
||||||
|
console.log('哈哈哈 useLoad');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { jobResults = [] } = await requestJobManageList({ status: JobManageStatus.Open });
|
const { jobResults = [] } = await requestJobManageList({ status: JobManageStatus.Open });
|
||||||
@ -186,13 +190,13 @@ export default function AnchorPage() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useShareAppMessage(() => {
|
useShareAppMessage(() => {
|
||||||
return getCommonShareMessage({ useCapture: true, inviteCode, title: '数万名优质主播等你来挑' });
|
return getCommonShareMessage({ inviteCode, title: '数万名优质主播等你来挑', path: PageUrl.Anchor });
|
||||||
});
|
});
|
||||||
|
|
||||||
useDidShow(() => requestUnreadMessageCount());
|
useDidShow(() => requestUnreadMessageCount());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HomePage>
|
<HomePage type={PageType.Anchor}>
|
||||||
{!!loading && <PageLoading className={`${PREFIX}__loading`} />}
|
{!!loading && <PageLoading className={`${PREFIX}__loading`} />}
|
||||||
<CustomNavigationBar className={`${PREFIX}__navigation-bar`}>
|
<CustomNavigationBar className={`${PREFIX}__navigation-bar`}>
|
||||||
{selectJob && <SwitchBar title={selectJob.title.substring(0, 4)} onClick={handleClickSwitch} />}
|
{selectJob && <SwitchBar title={selectJob.title.substring(0, 4)} onClick={handleClickSwitch} />}
|
||||||
|
@ -4,7 +4,7 @@ import { Button } from '@taroify/core';
|
|||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
import HomePage from '@/components/home-page';
|
import HomePage from '@/components/home-page';
|
||||||
import { PageUrl } from '@/constants/app';
|
import { PageType, PageUrl } from '@/constants/app';
|
||||||
import { copy, logWithPrefix } from '@/utils/common';
|
import { copy, logWithPrefix } from '@/utils/common';
|
||||||
import { navigateTo } from '@/utils/route';
|
import { navigateTo } from '@/utils/route';
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ export default function DevDebug() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HomePage>
|
<HomePage type={PageType.DEV}>
|
||||||
<div className={PREFIX}>
|
<div className={PREFIX}>
|
||||||
{/* <div>{`最近一次的订单 ID: ${lastOrderNo}`}</div>
|
{/* <div>{`最近一次的订单 ID: ${lastOrderNo}`}</div>
|
||||||
<Button onClick={() => handleCreateOrder(OrderType.Group)} style={marginTopStyle} color="primary">
|
<Button onClick={() => handleCreateOrder(OrderType.Group)} style={marginTopStyle} color="primary">
|
||||||
|
@ -4,8 +4,10 @@ import { useCallback } from 'react';
|
|||||||
|
|
||||||
import HomePage from '@/components/home-page';
|
import HomePage from '@/components/home-page';
|
||||||
import SearchCity from '@/components/search-city';
|
import SearchCity from '@/components/search-city';
|
||||||
|
import { PageType, PageUrl, RoleType } from '@/constants/app';
|
||||||
import { GROUPS } from '@/constants/group';
|
import { GROUPS } from '@/constants/group';
|
||||||
import useInviteCode from '@/hooks/use-invite-code';
|
import useInviteCode from '@/hooks/use-invite-code';
|
||||||
|
import { switchRoleType } from '@/utils/app';
|
||||||
import { openCustomerServiceChat } from '@/utils/common';
|
import { openCustomerServiceChat } from '@/utils/common';
|
||||||
import { getCurrentCityCode } from '@/utils/location';
|
import { getCurrentCityCode } from '@/utils/location';
|
||||||
import { getInviteCodeFromQueryAndUpdate } from '@/utils/partner';
|
import { getInviteCodeFromQueryAndUpdate } from '@/utils/partner';
|
||||||
@ -20,11 +22,15 @@ export default function GroupV2() {
|
|||||||
const inviteCode = useInviteCode();
|
const inviteCode = useInviteCode();
|
||||||
|
|
||||||
useLoad(() => {
|
useLoad(() => {
|
||||||
|
switchRoleType(RoleType.Anchor);
|
||||||
|
|
||||||
const query = getPageQuery();
|
const query = getPageQuery();
|
||||||
getInviteCodeFromQueryAndUpdate(query);
|
getInviteCodeFromQueryAndUpdate(query);
|
||||||
});
|
});
|
||||||
|
|
||||||
useShareAppMessage(() => getCommonShareMessage({ inviteCode }));
|
useShareAppMessage(() =>
|
||||||
|
getCommonShareMessage({ inviteCode, title: '邀请你加入本地主播求职招聘群', path: PageUrl.GroupV2 })
|
||||||
|
);
|
||||||
|
|
||||||
const handleSelectCity = useCallback(cityCode => {
|
const handleSelectCity = useCallback(cityCode => {
|
||||||
if (!checkCityCode(cityCode)) {
|
if (!checkCityCode(cityCode)) {
|
||||||
@ -37,14 +43,14 @@ export default function GroupV2() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HomePage>
|
<HomePage type={PageType.GroupV2}>
|
||||||
<div className={PREFIX}>
|
<div className={PREFIX}>
|
||||||
<SearchCity
|
<SearchCity
|
||||||
onSelectCity={handleSelectCity}
|
onSelectCity={handleSelectCity}
|
||||||
currentCity={getCurrentCityCode()}
|
currentCity={getCurrentCityCode()}
|
||||||
forGroup
|
forGroup
|
||||||
offset={72}
|
offset={72}
|
||||||
banner="点击城市加入本地通告群,高薪工作早知道"
|
banner="点击城市加入本地主播招聘群,高薪职位早知道"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</HomePage>
|
</HomePage>
|
||||||
|
@ -4,6 +4,7 @@ import { Tabs } from '@taroify/core';
|
|||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
import HomePage from '@/components/home-page';
|
import HomePage from '@/components/home-page';
|
||||||
|
import { PageType } from '@/constants/app';
|
||||||
import { GroupType, GROUP_PAGE_TABS } from '@/constants/group';
|
import { GroupType, GROUP_PAGE_TABS } from '@/constants/group';
|
||||||
import GroupFragment from '@/fragments/group';
|
import GroupFragment from '@/fragments/group';
|
||||||
import useNavigation from '@/hooks/use-navigation';
|
import useNavigation from '@/hooks/use-navigation';
|
||||||
@ -22,7 +23,7 @@ export default function Group() {
|
|||||||
useShareAppMessage(() => getCommonShareMessage());
|
useShareAppMessage(() => getCommonShareMessage());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HomePage>
|
<HomePage type={PageType.Group}>
|
||||||
<Tabs
|
<Tabs
|
||||||
swipeable
|
swipeable
|
||||||
value={tabType}
|
value={tabType}
|
||||||
|
@ -22,6 +22,7 @@ import { RESPONSE_ERROR_CODE } from '@/http/constant';
|
|||||||
import { HttpError } from '@/http/error';
|
import { HttpError } from '@/http/error';
|
||||||
import { JobDetails } from '@/types/job';
|
import { JobDetails } from '@/types/job';
|
||||||
import { IMaterialMessage } from '@/types/message';
|
import { IMaterialMessage } from '@/types/message';
|
||||||
|
import { switchRoleType } from '@/utils/app';
|
||||||
import { copy, logWithPrefix } from '@/utils/common';
|
import { copy, logWithPrefix } from '@/utils/common';
|
||||||
import { collectEvent, reportEvent } from '@/utils/event';
|
import { collectEvent, reportEvent } from '@/utils/event';
|
||||||
import { getJobTitle, getJobSalary, postPublishJob, requestJobDetail } from '@/utils/job';
|
import { getJobTitle, getJobSalary, postPublishJob, requestJobDetail } from '@/utils/job';
|
||||||
@ -218,6 +219,8 @@ export default function JobDetail() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useLoad(async () => {
|
useLoad(async () => {
|
||||||
|
switchRoleType(RoleType.Anchor);
|
||||||
|
|
||||||
const query = getPageQuery<Pick<JobDetails, 'id'> & { c: string }>();
|
const query = getPageQuery<Pick<JobDetails, 'id'> & { c: string }>();
|
||||||
getInviteCodeFromQueryAndUpdate(query);
|
getInviteCodeFromQueryAndUpdate(query);
|
||||||
const jobId = query?.id;
|
const jobId = query?.id;
|
||||||
@ -237,6 +240,7 @@ export default function JobDetail() {
|
|||||||
if (!data) {
|
if (!data) {
|
||||||
return getCommonShareMessage({ inviteCode });
|
return getCommonShareMessage({ inviteCode });
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: getJobTitle(data) || '',
|
title: getJobTitle(data) || '',
|
||||||
path: getJumpUrl(PageUrl.JobDetail, { id: data.id, share: true, c: inviteCode }),
|
path: getJumpUrl(PageUrl.JobDetail, { id: data.id, share: true, c: inviteCode }),
|
||||||
|
@ -6,13 +6,14 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|||||||
import HomePage from '@/components/home-page';
|
import HomePage from '@/components/home-page';
|
||||||
import { LoginGuide } from '@/components/login-guide';
|
import { LoginGuide } from '@/components/login-guide';
|
||||||
import MaterialGuide from '@/components/material-guide';
|
import MaterialGuide from '@/components/material-guide';
|
||||||
import { EventName, OpenSource, PageUrl } from '@/constants/app';
|
import { EventName, OpenSource, PageType, PageUrl, RoleType } from '@/constants/app';
|
||||||
import { EmployType, JOB_PAGE_TABS, SortType } from '@/constants/job';
|
import { EmployType, JOB_PAGE_TABS, SortType } from '@/constants/job';
|
||||||
import JobFragment from '@/fragments/job/base';
|
import JobFragment from '@/fragments/job/base';
|
||||||
import useInviteCode from '@/hooks/use-invite-code';
|
import useInviteCode from '@/hooks/use-invite-code';
|
||||||
import useLocation from '@/hooks/use-location';
|
import useLocation from '@/hooks/use-location';
|
||||||
import useNavigation from '@/hooks/use-navigation';
|
import useNavigation from '@/hooks/use-navigation';
|
||||||
import { Coordinate } from '@/types/location';
|
import { Coordinate } from '@/types/location';
|
||||||
|
import { switchRoleType } from '@/utils/app';
|
||||||
import { logWithPrefix } from '@/utils/common';
|
import { logWithPrefix } from '@/utils/common';
|
||||||
import { getWxLocation, isNotNeedAuthorizeLocation, requestLocation } from '@/utils/location';
|
import { getWxLocation, isNotNeedAuthorizeLocation, requestLocation } from '@/utils/location';
|
||||||
import { requestUnreadMessageCount } from '@/utils/message';
|
import { requestUnreadMessageCount } from '@/utils/message';
|
||||||
@ -96,6 +97,7 @@ export default function Job() {
|
|||||||
}, [location]);
|
}, [location]);
|
||||||
|
|
||||||
useLoad(async () => {
|
useLoad(async () => {
|
||||||
|
switchRoleType(RoleType.Anchor);
|
||||||
const query = getPageQuery<{ sortType: SortType; c?: string; scene?: string }>();
|
const query = getPageQuery<{ sortType: SortType; c?: string; scene?: string }>();
|
||||||
const type = query.sortType;
|
const type = query.sortType;
|
||||||
if (type === SortType.CREATE_TIME) {
|
if (type === SortType.CREATE_TIME) {
|
||||||
@ -121,11 +123,11 @@ export default function Job() {
|
|||||||
path: getJumpUrl(PageUrl.Job, { sortType, c: inviteCode }),
|
path: getJumpUrl(PageUrl.Job, { sortType, c: inviteCode }),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return getCommonShareMessage({ inviteCode });
|
return getCommonShareMessage({ inviteCode, path: PageUrl.Job });
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HomePage>
|
<HomePage type={PageType.JOB}>
|
||||||
<Tabs
|
<Tabs
|
||||||
swipeable
|
swipeable
|
||||||
value={tabType}
|
value={tabType}
|
||||||
|
@ -6,7 +6,7 @@ import { useCallback, useEffect, useState } from 'react';
|
|||||||
import MaterialManagePopup from '@/components/material-manage-popup';
|
import MaterialManagePopup from '@/components/material-manage-popup';
|
||||||
import PageLoading from '@/components/page-loading';
|
import PageLoading from '@/components/page-loading';
|
||||||
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
||||||
import { EventName } from '@/constants/app';
|
import { EventName, RoleType } from '@/constants/app';
|
||||||
import { CollectEventName } from '@/constants/event';
|
import { CollectEventName } from '@/constants/event';
|
||||||
import { MaterialStatus } from '@/constants/material';
|
import { MaterialStatus } from '@/constants/material';
|
||||||
import ProfileViewFragment from '@/fragments/profile/view';
|
import ProfileViewFragment from '@/fragments/profile/view';
|
||||||
@ -17,6 +17,7 @@ import { getCommonShareMessage } from '@/utils/share';
|
|||||||
import Toast from '@/utils/toast';
|
import Toast from '@/utils/toast';
|
||||||
|
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
import { switchRoleType } from '@/utils/app';
|
||||||
|
|
||||||
const PREFIX = 'page-material-profile';
|
const PREFIX = 'page-material-profile';
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import { useCallback, useEffect, useState } from 'react';
|
|||||||
import CommonDialog from '@/components/common-dialog';
|
import CommonDialog from '@/components/common-dialog';
|
||||||
import PageLoading from '@/components/page-loading';
|
import PageLoading from '@/components/page-loading';
|
||||||
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
||||||
import { EventName, OpenSource, PageUrl } from '@/constants/app';
|
import { EventName, OpenSource, PageUrl, RoleType } from '@/constants/app';
|
||||||
import { CollectEventName } from '@/constants/event';
|
import { CollectEventName } from '@/constants/event';
|
||||||
import { MaterialViewSource } from '@/constants/material';
|
import { MaterialViewSource } from '@/constants/material';
|
||||||
import ProfileViewFragment from '@/fragments/profile/view';
|
import ProfileViewFragment from '@/fragments/profile/view';
|
||||||
@ -16,6 +16,7 @@ import { HttpError } from '@/http/error';
|
|||||||
import { JobManageInfo } from '@/types/job';
|
import { JobManageInfo } from '@/types/job';
|
||||||
import { MaterialProfile } from '@/types/material';
|
import { MaterialProfile } from '@/types/material';
|
||||||
import { IJobMessage } from '@/types/message';
|
import { IJobMessage } from '@/types/message';
|
||||||
|
import { switchRoleType } from '@/utils/app';
|
||||||
import { copy } from '@/utils/common';
|
import { copy } from '@/utils/common';
|
||||||
import { collectEvent } from '@/utils/event';
|
import { collectEvent } from '@/utils/event';
|
||||||
import { requestHasPublishedJob, requestJobDetail } from '@/utils/job';
|
import { requestHasPublishedJob, requestJobDetail } from '@/utils/job';
|
||||||
@ -141,6 +142,8 @@ export default function MaterialViewPage() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useLoad(async () => {
|
useLoad(async () => {
|
||||||
|
switchRoleType(RoleType.Company);
|
||||||
|
|
||||||
const context = getPageQuery<IViewContext | IShareContext>();
|
const context = getPageQuery<IViewContext | IShareContext>();
|
||||||
getInviteCodeFromQueryAndUpdate(context as BL.Anything);
|
getInviteCodeFromQueryAndUpdate(context as BL.Anything);
|
||||||
try {
|
try {
|
||||||
|
@ -175,6 +175,7 @@ export default function MessageChat() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleClickReject = useCallback(async () => {
|
const handleClickReject = useCallback(async () => {
|
||||||
|
await postAddMessageTimes('message_chat_page');
|
||||||
if (!chat || !receiver || reject) {
|
if (!chat || !receiver || reject) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,9 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|||||||
import HomePage from '@/components/home-page';
|
import HomePage from '@/components/home-page';
|
||||||
import MessageCard from '@/components/message-card';
|
import MessageCard from '@/components/message-card';
|
||||||
import { MessageHelpDialog, MessageNoTimesDialog } from '@/components/message-dialog';
|
import { MessageHelpDialog, MessageNoTimesDialog } from '@/components/message-dialog';
|
||||||
import { APP_TAB_BAR_ID, EventName } from '@/constants/app';
|
import { APP_TAB_BAR_ID, EventName, PageType } from '@/constants/app';
|
||||||
import { REFRESH_CHAT_LIST_TIME } from '@/constants/message';
|
import { REFRESH_CHAT_LIST_TIME } from '@/constants/message';
|
||||||
|
import { MessageSubscribeIds, SubscribeTempId } from '@/constants/subscribe';
|
||||||
import useListHeight, { IUseListHeightProps } from '@/hooks/use-list-height';
|
import useListHeight, { IUseListHeightProps } from '@/hooks/use-list-height';
|
||||||
import useRoleType from '@/hooks/user-role-type';
|
import useRoleType from '@/hooks/user-role-type';
|
||||||
import { MainMessage } from '@/types/message';
|
import { MainMessage } from '@/types/message';
|
||||||
@ -20,7 +21,10 @@ import {
|
|||||||
requestUnreadMessageCount,
|
requestUnreadMessageCount,
|
||||||
} from '@/utils/message';
|
} from '@/utils/message';
|
||||||
|
|
||||||
|
import { isSubscribeRefused, postSubscribe } from '@/utils/subscribe';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
import { collectEvent } from '@/utils/event';
|
||||||
|
import { CollectEventName } from '@/constants/event';
|
||||||
|
|
||||||
const PREFIX = 'page-message';
|
const PREFIX = 'page-message';
|
||||||
const HEADER_CLASS = `${PREFIX}__header`;
|
const HEADER_CLASS = `${PREFIX}__header`;
|
||||||
@ -58,12 +62,52 @@ export default function Message() {
|
|||||||
|
|
||||||
const handleClickHelp = useCallback(() => setShowHelp(true), []);
|
const handleClickHelp = useCallback(() => setShowHelp(true), []);
|
||||||
|
|
||||||
const handleClickAddMessageTimes = useCallback(async () => {
|
const addMessageTimes = useCallback(async () => {
|
||||||
await postAddMessageTimes('message_page');
|
await postAddMessageTimes('message_page');
|
||||||
const remain = await requestRemainPushTime();
|
const remain = await requestRemainPushTime();
|
||||||
setTimes(remain);
|
setTimes(remain);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const handleClickAddMessageTimes = useCallback(async () => {
|
||||||
|
const [hasRefused, acceptIds] = await isSubscribeRefused(MessageSubscribeIds);
|
||||||
|
if (hasRefused) {
|
||||||
|
await Taro.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content:
|
||||||
|
'您未订阅消息提醒,不能及时获得招聘消息,请前往“设置”,将“新聊天消息”、“未读消息”“面试邀请”均设置为“接收”',
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: '打开设置',
|
||||||
|
});
|
||||||
|
await Taro.openSetting({
|
||||||
|
withSubscriptions: true,
|
||||||
|
});
|
||||||
|
const { subscriptionsSetting: { mainSwitch, itemSettings = {} } = {} } = await Taro.getSetting({
|
||||||
|
withSubscriptions: true,
|
||||||
|
});
|
||||||
|
console.log('subscriptionsSetting:', mainSwitch, itemSettings);
|
||||||
|
const successIds = mainSwitch
|
||||||
|
? MessageSubscribeIds.reduce<SubscribeTempId[]>((acc, id) => {
|
||||||
|
if ((!itemSettings[id] || itemSettings[id] === 'accept') && !acceptIds.includes(id)) {
|
||||||
|
acc.push(id);
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, [])
|
||||||
|
: [];
|
||||||
|
if (!successIds.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log('successIds:', successIds);
|
||||||
|
collectEvent(CollectEventName.MESSAGE_DEV_LOG, {
|
||||||
|
action: 'subscribe_new_message_reminder',
|
||||||
|
source: 'message_page',
|
||||||
|
successIds,
|
||||||
|
});
|
||||||
|
await postSubscribe(MessageSubscribeIds, successIds);
|
||||||
|
} else {
|
||||||
|
await addMessageTimes();
|
||||||
|
}
|
||||||
|
}, [addMessageTimes]);
|
||||||
|
|
||||||
useDidHide(() => (pageVisibleRef.current = false));
|
useDidHide(() => (pageVisibleRef.current = false));
|
||||||
|
|
||||||
useDidShow(() => {
|
useDidShow(() => {
|
||||||
@ -101,7 +145,7 @@ export default function Message() {
|
|||||||
}, [roleType]);
|
}, [roleType]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HomePage>
|
<HomePage type={PageType.Message}>
|
||||||
<div className={PREFIX}>
|
<div className={PREFIX}>
|
||||||
<div className={HEADER_CLASS}>
|
<div className={HEADER_CLASS}>
|
||||||
<div className={`${HEADER_CLASS}__times`}>
|
<div className={`${HEADER_CLASS}__times`}>
|
||||||
|
@ -1,27 +1,30 @@
|
|||||||
import { Image } from '@tarojs/components';
|
import { Image } from '@tarojs/components';
|
||||||
import Taro, { useShareAppMessage } from '@tarojs/taro';
|
import Taro, { useLoad, useShareAppMessage } from '@tarojs/taro';
|
||||||
|
|
||||||
import { Button, Tabs } from '@taroify/core';
|
import { Button, Tabs } from '@taroify/core';
|
||||||
import { useCallback } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
import HomePage from '@/components/home-page';
|
import HomePage from '@/components/home-page';
|
||||||
import SearchCity from '@/components/search-city';
|
import SearchCity from '@/components/search-city';
|
||||||
import { PageUrl } from '@/constants/app';
|
import { PageType, PageUrl, RoleType } from '@/constants/app';
|
||||||
import { GROUPS } from '@/constants/group';
|
import { GROUPS } from '@/constants/group';
|
||||||
import useInviteCode from '@/hooks/use-invite-code';
|
import useInviteCode from '@/hooks/use-invite-code';
|
||||||
|
import { switchRoleType } from '@/utils/app';
|
||||||
import { openCustomerServiceChat } from '@/utils/common';
|
import { openCustomerServiceChat } from '@/utils/common';
|
||||||
import { getCurrentCityCode } from '@/utils/location';
|
import { getCurrentCityCode } from '@/utils/location';
|
||||||
import { navigateTo } from '@/utils/route';
|
import { getPageQuery, navigateTo } from '@/utils/route';
|
||||||
import { getCommonShareMessage } from '@/utils/share';
|
import { getCommonShareMessage } from '@/utils/share';
|
||||||
import { checkCityCode } from '@/utils/user';
|
import { checkCityCode } from '@/utils/user';
|
||||||
|
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
import { SortType } from '@/constants/job';
|
||||||
|
|
||||||
const PREFIX = 'page-biz-service';
|
const PREFIX = 'page-biz-service';
|
||||||
const EXAMPLE_IMAGE = 'https://publiccdn.neighbourhood.com.cn/img/delegate-example.png';
|
const EXAMPLE_IMAGE = 'https://publiccdn.neighbourhood.com.cn/img/delegate-example.png';
|
||||||
const COMMENT_IMAGE = 'https://publiccdn.neighbourhood.com.cn/img/delegate-comments.png';
|
const COMMENT_IMAGE = 'https://publiccdn.neighbourhood.com.cn/img/delegate-comments.png';
|
||||||
export default function BizService() {
|
export default function BizService() {
|
||||||
const inviteCode = useInviteCode();
|
const inviteCode = useInviteCode();
|
||||||
|
const [value, setValue] = useState('0');
|
||||||
|
|
||||||
const handleClickDelegate = useCallback(() => {
|
const handleClickDelegate = useCallback(() => {
|
||||||
navigateTo(PageUrl.GroupDelegatePublish);
|
navigateTo(PageUrl.GroupDelegatePublish);
|
||||||
@ -44,13 +47,33 @@ export default function BizService() {
|
|||||||
openCustomerServiceChat(group.serviceUrl);
|
openCustomerServiceChat(group.serviceUrl);
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
useShareAppMessage(() => getCommonShareMessage({ inviteCode }));
|
const handleChange = useCallback(v => {
|
||||||
|
setValue(v);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useLoad(() => {
|
||||||
|
switchRoleType(RoleType.Company);
|
||||||
|
|
||||||
|
const query = getPageQuery<{ tab?: string }>();
|
||||||
|
if (query.tab) {
|
||||||
|
handleChange(query.tab);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
useShareAppMessage(() =>
|
||||||
|
getCommonShareMessage({
|
||||||
|
inviteCode,
|
||||||
|
path: PageUrl.UserBatchPublish,
|
||||||
|
title: '邀请你加入本地主播求职招聘群',
|
||||||
|
params: { tab: '1' },
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HomePage>
|
<HomePage type={PageType.BatchPublish}>
|
||||||
<div className={PREFIX}>
|
<div className={PREFIX}>
|
||||||
<Tabs className={`${PREFIX}__tabs`} defaultValue={0}>
|
<Tabs className={`${PREFIX}__tabs`} value={value} onChange={handleChange}>
|
||||||
<Tabs.TabPane value={0} title="群代发">
|
<Tabs.TabPane value="0" title="群代发">
|
||||||
<div className={`${PREFIX}__delegate`}>
|
<div className={`${PREFIX}__delegate`}>
|
||||||
<Image
|
<Image
|
||||||
mode="widthFix"
|
mode="widthFix"
|
||||||
@ -80,7 +103,7 @@ export default function BizService() {
|
|||||||
</div>
|
</div>
|
||||||
</Tabs.TabPane>
|
</Tabs.TabPane>
|
||||||
<Tabs.TabPane
|
<Tabs.TabPane
|
||||||
value={1}
|
value="1"
|
||||||
title={
|
title={
|
||||||
<>
|
<>
|
||||||
免费招
|
免费招
|
||||||
@ -96,7 +119,7 @@ export default function BizService() {
|
|||||||
banner="点击城市名称,进本地通告群,免费招主播"
|
banner="点击城市名称,进本地通告群,免费招主播"
|
||||||
/>
|
/>
|
||||||
</Tabs.TabPane>
|
</Tabs.TabPane>
|
||||||
<Tabs.TabPane value={2} title="代招">
|
<Tabs.TabPane value="2" title="代招">
|
||||||
<div className={`${PREFIX}__recruitment`}>
|
<div className={`${PREFIX}__recruitment`}>
|
||||||
<div className={`${PREFIX}__recruitment-card`}>
|
<div className={`${PREFIX}__recruitment-card`}>
|
||||||
<div className={`${PREFIX}__recruitment-h5`}>服务城市</div>
|
<div className={`${PREFIX}__recruitment-h5`}>服务城市</div>
|
||||||
|
@ -9,7 +9,7 @@ import LoginButton from '@/components/login-button';
|
|||||||
import PartnerEntry from '@/components/partner-entry';
|
import PartnerEntry from '@/components/partner-entry';
|
||||||
import Slogan from '@/components/slogan';
|
import Slogan from '@/components/slogan';
|
||||||
import SwitchBar from '@/components/switch-bar';
|
import SwitchBar from '@/components/switch-bar';
|
||||||
import { RoleType, PageUrl } from '@/constants/app';
|
import { RoleType, PageUrl, PageType } from '@/constants/app';
|
||||||
import AnchorFragment from '@/fragments/user/anchor';
|
import AnchorFragment from '@/fragments/user/anchor';
|
||||||
import CompanyFragment from '@/fragments/user/company';
|
import CompanyFragment from '@/fragments/user/company';
|
||||||
import useUserInfo from '@/hooks/use-user-info';
|
import useUserInfo from '@/hooks/use-user-info';
|
||||||
@ -41,7 +41,7 @@ export default function User() {
|
|||||||
useShareAppMessage(() => getCommonShareMessage({ useCapture: false }));
|
useShareAppMessage(() => getCommonShareMessage({ useCapture: false }));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HomePage>
|
<HomePage type={PageType.User}>
|
||||||
<CustomNavigationBar className={`${PREFIX}__navigation-bar`}>
|
<CustomNavigationBar className={`${PREFIX}__navigation-bar`}>
|
||||||
<SwitchBar title={roleType === RoleType.Anchor ? '切换为企业' : '切换为主播'} onClick={handleSwitchRoleType} />
|
<SwitchBar title={roleType === RoleType.Anchor ? '切换为企业' : '切换为主播'} onClick={handleSwitchRoleType} />
|
||||||
</CustomNavigationBar>
|
</CustomNavigationBar>
|
||||||
|
@ -37,12 +37,19 @@ export const switchDefaultTab = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const switchRoleType = async (appMode?: RoleType) => {
|
export const switchRoleType = async (appMode?: RoleType) => {
|
||||||
if (!appMode) {
|
|
||||||
const curMode = getRoleType();
|
const curMode = getRoleType();
|
||||||
|
|
||||||
|
if (curMode && appMode === curMode) {
|
||||||
|
console.log('[utils:app] skip switch role because of role type is equal to that of local');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!appMode) {
|
||||||
|
console.log('[utils:app] no app mode from arguments');
|
||||||
appMode = curMode === RoleType.Anchor ? RoleType.Company : RoleType.Anchor;
|
appMode = curMode === RoleType.Anchor ? RoleType.Company : RoleType.Anchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('switchRoleType', appMode);
|
console.log('[utils:app] switchRoleType', appMode);
|
||||||
try {
|
try {
|
||||||
await postSwitchRoleType(appMode);
|
await postSwitchRoleType(appMode);
|
||||||
store.dispatch(changeRoleType(appMode));
|
store.dispatch(changeRoleType(appMode));
|
||||||
|
@ -4,12 +4,12 @@ export const isDev = () => process.env.NODE_ENV === 'development';
|
|||||||
// export const isDev = () => true;
|
// export const isDev = () => true;
|
||||||
|
|
||||||
export const isIPhone = (() => {
|
export const isIPhone = (() => {
|
||||||
const info = Taro.getSystemInfoSync();
|
const info = Taro.getDeviceInfo();
|
||||||
return info.platform === 'ios';
|
return info.platform === 'ios';
|
||||||
})();
|
})();
|
||||||
|
|
||||||
export const isDesktop = (() => {
|
export const isDesktop = (() => {
|
||||||
const info = Taro.getSystemInfoSync();
|
const info = Taro.getDeviceInfo();
|
||||||
return info.platform === 'windows' || info.platform === 'mac';
|
return info.platform === 'windows' || info.platform === 'mac';
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ export const postAddMessageTimes = async (source: string) => {
|
|||||||
await postSubscribe(MessageSubscribeIds, successIds);
|
await postSubscribe(MessageSubscribeIds, successIds);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const postCreateChat = (toUserId: string) => {
|
export const postCreateChat = (toUserId: string) => {
|
||||||
return http.post<IChatInfo>(API.MESSAGE_CREATE_CHAT, { data: { toUserId } });
|
return http.post<IChatInfo>(API.MESSAGE_CREATE_CHAT, { data: { toUserId } });
|
||||||
};
|
};
|
||||||
|
@ -7,24 +7,35 @@ import { logWithPrefix } from '@/utils/common';
|
|||||||
|
|
||||||
const log = logWithPrefix('subscribe-utils');
|
const log = logWithPrefix('subscribe-utils');
|
||||||
|
|
||||||
export const isSubscribeRefused = async (tempId: SubscribeTempId | SubscribeTempId[]) => {
|
export const isSubscribeRefused = async (
|
||||||
|
tempId: SubscribeTempId | SubscribeTempId[]
|
||||||
|
): Promise<[boolean, SubscribeTempId[]]> => {
|
||||||
tempId = Array.isArray(tempId) ? tempId : [tempId];
|
tempId = Array.isArray(tempId) ? tempId : [tempId];
|
||||||
const { subscriptionsSetting } = await Taro.getSetting({ withSubscriptions: true });
|
const { subscriptionsSetting } = await Taro.getSetting({ withSubscriptions: true });
|
||||||
log('isSubscribeRefuse subscriptionsSetting:', subscriptionsSetting);
|
log('isSubscribeRefuse subscriptionsSetting:', subscriptionsSetting);
|
||||||
if (!subscriptionsSetting) {
|
if (!subscriptionsSetting) {
|
||||||
return false;
|
return [false, []];
|
||||||
}
|
}
|
||||||
const { mainSwitch, itemSettings = {} } = subscriptionsSetting;
|
const { mainSwitch, itemSettings = {} } = subscriptionsSetting;
|
||||||
if (!mainSwitch) {
|
if (!mainSwitch) {
|
||||||
return true;
|
return [true, []];
|
||||||
}
|
}
|
||||||
return tempId.some(id => {
|
const acceptedIds: SubscribeTempId[] = [];
|
||||||
|
let refused = false;
|
||||||
|
tempId.some(id => {
|
||||||
const item = itemSettings[id];
|
const item = itemSettings[id];
|
||||||
if (!item) {
|
if (item === 'accept') {
|
||||||
return false;
|
acceptedIds.push(id);
|
||||||
}
|
}
|
||||||
return item === 'reject';
|
|
||||||
|
if (refused) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
refused = item === 'reject';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return [refused || false, acceptedIds];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const subscribeMessage = async (tempIds: SubscribeTempId[]) => {
|
export const subscribeMessage = async (tempIds: SubscribeTempId[]) => {
|
||||||
|
Reference in New Issue
Block a user