Compare commits
21 Commits
5acc25c8c9
...
trunk
Author | SHA1 | Date | |
---|---|---|---|
260e543fe6 | |||
0cd1a46762 | |||
1ddc8b46c9 | |||
5820fa8d25 | |||
80846d507f | |||
42d1208ee4 | |||
2c48a70b6d | |||
e8cf28b6e9 | |||
de7f0e14fe | |||
de2f380cd9 | |||
0020eb8dbe | |||
b0dd660dde | |||
56cf10c768 | |||
0ec366cc2e | |||
828497fcd6 | |||
fd5b3dab97 | |||
1b782ee82c | |||
80c0d71921 | |||
c76027b4d9 | |||
c08b0bef95 | |||
96eb46821e |
@ -109,5 +109,6 @@
|
||||
"ignoredBuiltDependencies": [
|
||||
"@tarojs/binding"
|
||||
]
|
||||
}
|
||||
},
|
||||
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Button } from '@tarojs/components';
|
||||
import { Button, ITouchEvent } from '@tarojs/components';
|
||||
|
||||
import { Popup } from '@taroify/core';
|
||||
import { useCallback } from 'react';
|
||||
@ -8,23 +8,23 @@ import PhoneButton from '@/components/phone-button';
|
||||
import { ProtocolPrivacy } from '@/components/protocol-privacy';
|
||||
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
||||
|
||||
|
||||
import './index.less';
|
||||
|
||||
interface IProps {
|
||||
open: boolean;
|
||||
onCancel: () => void;
|
||||
onConfirm: () => void;
|
||||
onConfirm: (e: ITouchEvent) => void;
|
||||
needPhone?: boolean;
|
||||
needBindPhone?: boolean;
|
||||
}
|
||||
|
||||
const PREFIX = 'agreement-popup';
|
||||
|
||||
export function AgreementPopup({ open, onCancel, onConfirm, needPhone }: IProps) {
|
||||
export function AgreementPopup({ open, onCancel, onConfirm, needPhone, needBindPhone }: IProps) {
|
||||
const handleBindPhone = useCallback(
|
||||
status => {
|
||||
(status: BindPhoneStatus, e: ITouchEvent) => {
|
||||
if (status === BindPhoneStatus.Success) {
|
||||
onConfirm();
|
||||
onConfirm(e);
|
||||
} else {
|
||||
onCancel();
|
||||
}
|
||||
@ -49,8 +49,8 @@ export function AgreementPopup({ open, onCancel, onConfirm, needPhone }: IProps)
|
||||
<Button className={`${PREFIX}__cancel-button`} onClick={onCancel}>
|
||||
拒绝
|
||||
</Button>
|
||||
{needPhone ? (
|
||||
<PhoneButton className={`${PREFIX}__confirm-button`} needPhone onBindPhone={handleBindPhone}>
|
||||
{needBindPhone ? (
|
||||
<PhoneButton className={`${PREFIX}__confirm-button`} needPhone={needPhone} onBindPhone={handleBindPhone}>
|
||||
同意
|
||||
</PhoneButton>
|
||||
) : (
|
||||
|
@ -7,13 +7,14 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import AnchorCard from '@/components/anchor-card';
|
||||
import ListPlaceholder from '@/components/list-placeholder';
|
||||
import LoginDialog from '@/components/login-dialog';
|
||||
import { EventName } from '@/constants/app';
|
||||
import { AnchorSortType } from '@/constants/material';
|
||||
import useUserInfo from '@/hooks/use-user-info';
|
||||
import { AnchorInfo, GetAnchorListRequest, IAnchorFilters } from '@/types/material';
|
||||
import { logWithPrefix } from '@/utils/common';
|
||||
import { requestAnchorList as requestData } from '@/utils/material';
|
||||
import { getAgreementSigned, isNeedPhone, setAgreementSigned } from '@/utils/user';
|
||||
import { getAgreementSigned, isNeedLogin, setAgreementSigned } from '@/utils/user';
|
||||
|
||||
import { AgreementPopup } from '../agreement-popup';
|
||||
|
||||
@ -59,10 +60,11 @@ function AnchorList(props: IAnchorListProps) {
|
||||
const requestProps = useRef<IRequestProps>({});
|
||||
const prevRequestProps = useRef<IRequestProps>({});
|
||||
const onListEmptyRef = useRef(onListEmpty);
|
||||
const [open, setOpen] = useState(false);
|
||||
const [openLogin, setLoginOpen] = useState(false);
|
||||
const [openAssignment, setAssignmentOpen] = useState(false);
|
||||
const successCallback = useRef<() => void>(() => {});
|
||||
const userInfo = useUserInfo();
|
||||
const needPhone = isNeedPhone(userInfo);
|
||||
const needLogin = isNeedLogin(userInfo);
|
||||
|
||||
const handleRefresh = useCallback(async () => {
|
||||
log('start pull refresh');
|
||||
@ -129,23 +131,33 @@ function AnchorList(props: IAnchorListProps) {
|
||||
);
|
||||
|
||||
const handleCancel = useCallback(() => {
|
||||
setOpen(false);
|
||||
setAssignmentOpen(false);
|
||||
setAgreementSigned(false);
|
||||
}, []);
|
||||
|
||||
const handleConfirm = useCallback(() => {
|
||||
setOpen(false);
|
||||
setAssignmentOpen(false);
|
||||
setAgreementSigned(true);
|
||||
//TODO 没手机号要授权一下; 必须要开弹窗才可以,与需求不符
|
||||
successCallback.current();
|
||||
}, []);
|
||||
|
||||
const handleLoginSuccess = useCallback(() => {
|
||||
setLoginOpen(false);
|
||||
successCallback.current();
|
||||
}, []);
|
||||
|
||||
const handleLoginCancel = useCallback(() => {
|
||||
setLoginOpen(false);
|
||||
}, []);
|
||||
|
||||
const validator = (onSuccess: () => void) => {
|
||||
if (getAgreementSigned()) {
|
||||
onSuccess();
|
||||
successCallback.current = onSuccess;
|
||||
if (!getAgreementSigned()) {
|
||||
setAssignmentOpen(true);
|
||||
} else if (needLogin) {
|
||||
setLoginOpen(true);
|
||||
} else {
|
||||
successCallback.current = onSuccess;
|
||||
setOpen(true);
|
||||
onSuccess();
|
||||
}
|
||||
};
|
||||
|
||||
@ -233,7 +245,13 @@ function AnchorList(props: IAnchorListProps) {
|
||||
<ListPlaceholder hasMore={hasMore} loadingMore={loadingMore} loadMoreError={loadMoreError} />
|
||||
</List>
|
||||
</PullRefresh>
|
||||
<AgreementPopup open={open} onCancel={handleCancel} onConfirm={handleConfirm} needPhone={needPhone} />
|
||||
<AgreementPopup
|
||||
open={openAssignment}
|
||||
onCancel={handleCancel}
|
||||
onConfirm={handleConfirm}
|
||||
needBindPhone={needLogin}
|
||||
/>
|
||||
{openLogin && <LoginDialog onCancel={handleLoginCancel} onSuccess={handleLoginSuccess} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -1,18 +1,21 @@
|
||||
import React from 'react';
|
||||
|
||||
import BaseTabBar from '@/components/tab-bar';
|
||||
import { PageType } from '@/constants/app';
|
||||
|
||||
import './index.less';
|
||||
|
||||
interface IProps extends React.PropsWithChildren {}
|
||||
interface IProps extends React.PropsWithChildren {
|
||||
type: PageType;
|
||||
}
|
||||
|
||||
export default function HomePage(props: IProps) {
|
||||
const { children } = props;
|
||||
const { children, type } = props;
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
{children}
|
||||
<BaseTabBar />
|
||||
<BaseTabBar type={type} />
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ function JobRecommendList(props: IJobListProps) {
|
||||
setDataList([]);
|
||||
setLoading(true);
|
||||
setLoadError(false);
|
||||
const { jobResults = [] } = await requestMyRecommendJobList({ ...requestProps.current });
|
||||
setDataList(jobResults);
|
||||
const { jobResults } = await requestMyRecommendJobList({ ...requestProps.current });
|
||||
setDataList(jobResults || []);
|
||||
} catch (e) {
|
||||
setDataList([]);
|
||||
setLoadError(true);
|
||||
|
41
src/components/join-group-hint/index.less
Normal file
41
src/components/join-group-hint/index.less
Normal file
@ -0,0 +1,41 @@
|
||||
@import '@/styles/common.less';
|
||||
@import '@/styles/variables.less';
|
||||
|
||||
.join-group-hint {
|
||||
.flex-row();
|
||||
background: #FFFFFF;
|
||||
border-radius: 16px;
|
||||
padding: 32px 24px;
|
||||
margin-top: 24px;
|
||||
margin-bottom: 24px;
|
||||
|
||||
&__icon {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
margin-right: 32px;
|
||||
}
|
||||
|
||||
&__left {
|
||||
flex: 1;
|
||||
padding-left: 8px;
|
||||
&-title {
|
||||
font-weight: 500;
|
||||
font-size: 32px;
|
||||
line-height: 40px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
&-desc {
|
||||
font-weight: 400;
|
||||
font-size: 28px;
|
||||
line-height: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
&__right {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
&__button {
|
||||
.button(@width: 186px, @height: 64px, @fontSize: 28px, @fontWeight: 400, @borderRadius: 32px, @highlight: 0);
|
||||
}
|
||||
}
|
63
src/components/join-group-hint/index.tsx
Normal file
63
src/components/join-group-hint/index.tsx
Normal file
@ -0,0 +1,63 @@
|
||||
import { Button, Image } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
|
||||
import { Plus } from '@taroify/icons';
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
import { RoleType } from '@/constants/app';
|
||||
import { CacheKey } from '@/constants/cache-key';
|
||||
import { CITY_CODE_TO_NAME_MAP } from '@/constants/city';
|
||||
import { GROUPS } from '@/constants/group';
|
||||
import { getRoleTypeWithDefault } from '@/utils/app';
|
||||
import { openCustomerServiceChat } from '@/utils/common';
|
||||
import { getCurrentCityCode } from '@/utils/location';
|
||||
import { checkCityCode, validCityCode } from '@/utils/user';
|
||||
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'join-group-hint';
|
||||
|
||||
const DEFAULT_GROUP = {
|
||||
name: '播络主播招聘群',
|
||||
serviceUrl: 'https://work.weixin.qq.com/kfid/kfcc60ac7b6420787a8',
|
||||
};
|
||||
|
||||
export function JoinGroupHint() {
|
||||
const cityCode = getCurrentCityCode();
|
||||
const roleType = getRoleTypeWithDefault();
|
||||
const group = GROUPS.find(g => String(g.cityCode) === cityCode);
|
||||
const [clicked, setClicked] = useState(!!Taro.getStorageSync(CacheKey.JOIN_GROUP_CARD_CLICKED));
|
||||
const handleClick = useCallback(() => {
|
||||
if (group && !checkCityCode(cityCode)) {
|
||||
return;
|
||||
}
|
||||
openCustomerServiceChat(group ? group.serviceUrl : DEFAULT_GROUP.serviceUrl);
|
||||
Taro.setStorageSync(CacheKey.JOIN_GROUP_CARD_CLICKED, true);
|
||||
setClicked(true);
|
||||
}, [cityCode, group]);
|
||||
if (!validCityCode(cityCode) || clicked) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={PREFIX}>
|
||||
<Image
|
||||
className={`${PREFIX}__icon`}
|
||||
src="https://publiccdn.neighbourhood.com.cn/img/group-avatar.png"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<div className={`${PREFIX}__left`}>
|
||||
<div className={`${PREFIX}__left-title`}>
|
||||
{group ? `${CITY_CODE_TO_NAME_MAP.get(cityCode)}主播招聘群` : DEFAULT_GROUP.name}
|
||||
</div>
|
||||
<div className={`${PREFIX}__left-desc`}>{roleType === RoleType.Anchor ? '高薪工作早知道' : '免费招主播'}</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__right`}>
|
||||
<Button className={`${PREFIX}__button`} onClick={handleClick}>
|
||||
<Plus />
|
||||
加入该群
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
import { Button, ButtonProps } from '@tarojs/components';
|
||||
import { Button, ButtonProps, ITouchEvent } from '@tarojs/components';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
import { AgreementPopup } from '@/components/agreement-popup';
|
||||
import LoginDialog from '@/components/login-dialog';
|
||||
import useUserInfo from '@/hooks/use-user-info';
|
||||
import { isNeedLogin } from '@/utils/user';
|
||||
import { getAgreementSigned, isNeedLogin, setAgreementSigned } from '@/utils/user';
|
||||
|
||||
import './index.less';
|
||||
|
||||
@ -17,6 +18,7 @@ export enum BindPhoneStatus {
|
||||
|
||||
export interface ILoginButtonProps extends ButtonProps {
|
||||
needPhone?: boolean;
|
||||
needAssignment?: boolean;
|
||||
}
|
||||
|
||||
const PREFIX = 'login-button';
|
||||
@ -24,12 +26,50 @@ const PREFIX = 'login-button';
|
||||
function LoginButton(props: ILoginButtonProps) {
|
||||
const { className, children, needPhone, onClick, ...otherProps } = props;
|
||||
const userInfo = useUserInfo();
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [loginVisible, setLoginVisible] = useState(false);
|
||||
const [assignVisible, setAssignVisible] = useState(false);
|
||||
const needLogin = isNeedLogin(userInfo);
|
||||
// 点击按钮时,协议同意也手机也授权了 -> 下一步
|
||||
//
|
||||
// 点击按钮时,协议同意但是手机授权没给 -> 弹登录
|
||||
// -> 如果授权了手机号就进行下一步
|
||||
// -> 不给授权没下一步
|
||||
//
|
||||
// 点击按钮时,协议不同意 -> 弹协议窗口
|
||||
// -> 如果同意就进行下一步
|
||||
// -> 不同意没下一步
|
||||
const handleClick = useCallback(
|
||||
(e: ITouchEvent) => {
|
||||
if (!getAgreementSigned()) {
|
||||
setAssignVisible(true);
|
||||
} else if (needLogin) {
|
||||
setLoginVisible(true);
|
||||
} else if (onClick) {
|
||||
onClick(e);
|
||||
}
|
||||
},
|
||||
[needLogin, onClick]
|
||||
);
|
||||
|
||||
const onSuccess = useCallback(
|
||||
const handleConfirm = useCallback(
|
||||
(e: ITouchEvent) => {
|
||||
setAssignVisible(false);
|
||||
setAgreementSigned(true);
|
||||
if (onClick) {
|
||||
onClick(e);
|
||||
}
|
||||
},
|
||||
[onClick]
|
||||
);
|
||||
|
||||
const handleCancel = useCallback(() => {
|
||||
setAgreementSigned(false);
|
||||
setAssignVisible(false);
|
||||
}, []);
|
||||
|
||||
const handleLoginSuccess = useCallback(
|
||||
e => {
|
||||
setVisible(false);
|
||||
setLoginVisible(false);
|
||||
onClick?.(e);
|
||||
},
|
||||
[onClick]
|
||||
@ -37,14 +77,18 @@ function LoginButton(props: ILoginButtonProps) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
{...otherProps}
|
||||
className={classNames(PREFIX, className)}
|
||||
onClick={needLogin ? () => setVisible(true) : onClick}
|
||||
>
|
||||
<Button {...otherProps} className={classNames(PREFIX, className)} onClick={handleClick}>
|
||||
{children}
|
||||
</Button>
|
||||
{visible && <LoginDialog onCancel={() => setVisible(false)} onSuccess={onSuccess} needPhone={needPhone} />}
|
||||
<AgreementPopup
|
||||
open={assignVisible}
|
||||
onCancel={handleCancel}
|
||||
onConfirm={handleConfirm}
|
||||
needBindPhone={needLogin}
|
||||
/>
|
||||
{loginVisible && (
|
||||
<LoginDialog onCancel={() => setLoginVisible(false)} onSuccess={handleLoginSuccess} needPhone={needPhone} />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -17,22 +17,4 @@
|
||||
.button(@width: 360px, @height: 72px, @fontSize: 28px, @fontWeight: 400, @borderRadius: 44px);
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
&__cancel-button {
|
||||
min-width: fit-content;
|
||||
font-size: 28px;
|
||||
line-height: 32px;
|
||||
color: @blHighlightColor;
|
||||
background: transparent;
|
||||
border: none;
|
||||
margin-top: 40px;
|
||||
|
||||
&::after {
|
||||
border-color: transparent
|
||||
}
|
||||
}
|
||||
|
||||
&__checkbox {
|
||||
margin-top: 40px;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,6 @@
|
||||
import { Button } from '@tarojs/components';
|
||||
|
||||
import { Dialog } from '@taroify/core';
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
import PhoneButton, { IPhoneButtonProps } from '@/components/phone-button';
|
||||
import { ProtocolPrivacyCheckbox } from '@/components/protocol-privacy';
|
||||
import Toast from '@/utils/toast';
|
||||
|
||||
import './index.less';
|
||||
|
||||
@ -21,36 +16,20 @@ const PREFIX = 'login-dialog';
|
||||
|
||||
export default function LoginDialog(props: IProps) {
|
||||
const { title = '使用播络服务前,请先登录', needPhone, onSuccess, onCancel, onBindPhone } = props;
|
||||
const [checked, setChecked] = useState(false);
|
||||
|
||||
const handleTipCheck = useCallback(() => {
|
||||
Toast.info('请先阅读并同意协议');
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Dialog open onClose={onCancel}>
|
||||
<Dialog.Content>
|
||||
<div className={`${PREFIX}__container`}>
|
||||
<div className={`${PREFIX}__title`}>{title}</div>
|
||||
{!checked && (
|
||||
<Button className={`${PREFIX}__confirm-button`} onClick={handleTipCheck}>
|
||||
登录
|
||||
</Button>
|
||||
)}
|
||||
{checked && (
|
||||
<PhoneButton
|
||||
className={`${PREFIX}__confirm-button`}
|
||||
onSuccess={onSuccess}
|
||||
onBindPhone={onBindPhone}
|
||||
needPhone={needPhone}
|
||||
>
|
||||
登录
|
||||
</PhoneButton>
|
||||
)}
|
||||
<Button className={`${PREFIX}__cancel-button`} onClick={onCancel}>
|
||||
跳过,暂不登录
|
||||
</Button>
|
||||
<ProtocolPrivacyCheckbox checked={checked} onChange={setChecked} className={`${PREFIX}__checkbox`} />
|
||||
<PhoneButton
|
||||
className={`${PREFIX}__confirm-button`}
|
||||
onSuccess={onSuccess}
|
||||
onBindPhone={onBindPhone}
|
||||
needPhone={needPhone}
|
||||
>
|
||||
登录
|
||||
</PhoneButton>
|
||||
</div>
|
||||
</Dialog.Content>
|
||||
</Dialog>
|
||||
|
@ -2,13 +2,13 @@ import { Image } from '@tarojs/components';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import { PropsWithChildren, useEffect, useState, useCallback } from 'react';
|
||||
import { MaterialViewSource } from '@/constants/material';
|
||||
|
||||
import { PageUrl } from '@/constants/app';
|
||||
import { MaterialViewSource } from '@/constants/material';
|
||||
import useUserInfo from '@/hooks/use-user-info';
|
||||
import { IChatMessage } from '@/types/message';
|
||||
import { getScrollItemId } from '@/utils/common';
|
||||
import { navigateTo } from '@/utils/route';
|
||||
import { PageUrl } from '@/constants/app';
|
||||
|
||||
import './index.less';
|
||||
|
||||
@ -19,12 +19,13 @@ export interface IBaseMessageProps {
|
||||
|
||||
export interface IUserMessageProps extends PropsWithChildren, IBaseMessageProps {
|
||||
isRead?: boolean;
|
||||
resumeId?: string;
|
||||
}
|
||||
|
||||
const PREFIX = 'base-message';
|
||||
|
||||
function BaseMessage(props: IUserMessageProps) {
|
||||
const { id, message, isRead: isReadProps, children } = props;
|
||||
const { id, message, isRead: isReadProps, children, resumeId } = props;
|
||||
const { userId } = useUserInfo();
|
||||
const [isRead, setIsRead] = useState(message.isRead);
|
||||
const isSender = message.senderUserId === userId;
|
||||
@ -37,10 +38,12 @@ function BaseMessage(props: IUserMessageProps) {
|
||||
// const timer = setTimeout(() => setIsRead(true), 1200);
|
||||
// return () => clearTimeout(timer);
|
||||
// }, [isSender]);
|
||||
const handleClick = useCallback(
|
||||
() => navigateTo(PageUrl.MaterialView, { resumeId: message.jobId, source: MaterialViewSource.Chat }),
|
||||
[message.jobId]
|
||||
);
|
||||
const handleClick = useCallback(() => {
|
||||
if (!resumeId || isSender) {
|
||||
return;
|
||||
}
|
||||
navigateTo(PageUrl.MaterialView, { resumeId: resumeId, source: MaterialViewSource.Chat });
|
||||
}, [resumeId, isSender]);
|
||||
useEffect(() => {
|
||||
if (isRead) {
|
||||
return;
|
||||
@ -53,6 +56,7 @@ function BaseMessage(props: IUserMessageProps) {
|
||||
<Image
|
||||
mode="aspectFit"
|
||||
className={`${PREFIX}__avatar`}
|
||||
onClick={handleClick}
|
||||
src={message.senderAvatarUrl || require('@/statics/png/default_avatar.png')}
|
||||
/>
|
||||
<div className={`${PREFIX}__content-container`}>
|
||||
|
@ -80,4 +80,8 @@
|
||||
margin-top: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
&__no-subscription {
|
||||
|
||||
}
|
||||
}
|
@ -57,7 +57,9 @@ export function MessageNoTimesDialog(props: INoTimesProps) {
|
||||
<Dialog className={NO_TIMES} onClose={onClose} open={open}>
|
||||
<Dialog.Content>
|
||||
<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}__times`}>{`未读消息提醒剩余:${times}次`}</div>
|
||||
<Button className={`${NO_TIMES}__btn`} onClick={onClick}>
|
||||
|
@ -60,7 +60,9 @@ export default function PartnerBanner() {
|
||||
)}
|
||||
<div className={`${PREFIX}__close`} onClick={handlePartnerBannerClose} />
|
||||
</div>
|
||||
{visible && <LoginDialog onCancel={() => setVisible(false)} onSuccess={handleBind} needPhone={needPhone} />}
|
||||
{visible && (
|
||||
<LoginDialog disableCheck onCancel={() => setVisible(false)} onSuccess={handleBind} needPhone={needPhone} />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -39,7 +39,9 @@ function JoinEntry({ onBindSuccess }: JoinEntryProps) {
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
{visible && <LoginDialog onCancel={() => setVisible(false)} onSuccess={onBindSuccess} needPhone={needPhone} />}
|
||||
{visible && (
|
||||
<LoginDialog disableCheck onCancel={() => setVisible(false)} onSuccess={onBindSuccess} needPhone={needPhone} />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ function PartnerList(props: {
|
||||
hasMore={hasMore}
|
||||
onLoad={handleLoadMore}
|
||||
loading={loadingMore || refreshing}
|
||||
disabled={loadMoreError}
|
||||
disabled={loadMoreError || !visible}
|
||||
fixedHeight={typeof listHeight !== 'undefined'}
|
||||
style={listHeight ? { height: `${listHeight}px` } : undefined}
|
||||
>
|
||||
|
@ -1,14 +1,16 @@
|
||||
import { Button, Image } from '@tarojs/components';
|
||||
import Taro, { useDidShow } from '@tarojs/taro';
|
||||
|
||||
import { Dialog } from '@taroify/core';
|
||||
import { Question } from '@taroify/icons';
|
||||
import { useCallback, useState, useEffect } from 'react';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { PageUrl } from '@/constants/app';
|
||||
import { PartnerProfitsState } from '@/types/partner';
|
||||
import { formatMoney, getPartnerProfitStat } from '@/utils/partner';
|
||||
import { formatMoney, getPartnerProfitStat, withdrawMoney } from '@/utils/partner';
|
||||
import { navigateTo } from '@/utils/route';
|
||||
import Toast from '@/utils/toast';
|
||||
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'partner-kanban';
|
||||
@ -31,17 +33,48 @@ function TipDialog(props: { open: boolean; onClose: () => void }) {
|
||||
}
|
||||
|
||||
function WithdrawDialog(props: { open: boolean; onClose: () => void; count: number }) {
|
||||
const handleWithdraw = useCallback(() => {}, []);
|
||||
const handleWithdraw = useCallback(async () => {
|
||||
if (Taro.canIUse('requestMerchantTransfer')) {
|
||||
try {
|
||||
const result = await withdrawMoney();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
wx.requestMerchantTransfer({
|
||||
mchId: '1642470088',
|
||||
appId: 'wxf0724a83f8e377d2',
|
||||
package: result.packageInfo,
|
||||
success: (res: never) => {
|
||||
// res.err_msg将在页面展示成功后返回应用时返回ok,并不代表付款成功
|
||||
console.log('success:', res);
|
||||
Toast.success('提现成功');
|
||||
props.onClose();
|
||||
},
|
||||
fail: (res: never) => {
|
||||
Toast.error('提现失败');
|
||||
console.log('fail:', res);
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
Toast.error('提现订单创建失败');
|
||||
console.log(e);
|
||||
}
|
||||
} else {
|
||||
await Taro.showModal({
|
||||
content: '你的微信版本过低,请更新至最新版本。',
|
||||
showCancel: false,
|
||||
});
|
||||
}
|
||||
}, [props]);
|
||||
return (
|
||||
<Dialog open={props.open} onClose={props.onClose}>
|
||||
<Dialog.Content>
|
||||
<div className={`${PREFIX}-withdraw-dialog__container`}>
|
||||
<div className={`${PREFIX}-withdraw-dialog__title`}>本次申请提现金额为</div>
|
||||
<div className={`${PREFIX}-withdraw-dialog__count`}>
|
||||
{props.count}
|
||||
{+props.count}
|
||||
<div className="yuan">元</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}-withdraw-dialog__hint`}>单笔最大500元</div>
|
||||
<div className={`${PREFIX}-withdraw-dialog__hint`}>单日提现最大200元</div>
|
||||
<Button className={`${PREFIX}-withdraw-dialog__confirm-button`} onClick={handleWithdraw}>
|
||||
提现
|
||||
</Button>
|
||||
@ -86,20 +119,28 @@ export default function PartnerKanban({ simple }: PartnerKanbanProps) {
|
||||
const handleTipClose = useCallback(() => {
|
||||
setTipOpen(false);
|
||||
}, []);
|
||||
const handleViewWithdraw = useCallback(() => {
|
||||
if (stats.availableBalance < 10 * 1000) {
|
||||
Toast.info('提现金额需大于等于10元');
|
||||
return;
|
||||
}
|
||||
setWithdrawOpen(true);
|
||||
}, []);
|
||||
const handleWithdrawClose = useCallback(() => {
|
||||
setWithdrawOpen(false);
|
||||
}, []);
|
||||
const getProfitStats = useCallback(async () => {
|
||||
const data = await getPartnerProfitStat();
|
||||
setStats(data);
|
||||
}, []);
|
||||
const handleViewWithdraw = useCallback(() => {
|
||||
if (stats.availableBalance < 0) {
|
||||
Toast.info('提现金额需大于等于0元');
|
||||
return;
|
||||
}
|
||||
// if (stats.availableBalance < 10 * 1000) {
|
||||
// Toast.error('提现金额需大于等于10元');
|
||||
// return;
|
||||
// }
|
||||
setWithdrawOpen(true);
|
||||
}, [stats.availableBalance]);
|
||||
const handleWithdrawClose = useCallback(() => {
|
||||
setWithdrawOpen(false);
|
||||
getProfitStats();
|
||||
}, [getProfitStats]);
|
||||
useDidShow(() => {
|
||||
getProfitStats();
|
||||
});
|
||||
useEffect(() => {
|
||||
getProfitStats();
|
||||
}, []);
|
||||
@ -154,7 +195,13 @@ export default function PartnerKanban({ simple }: PartnerKanbanProps) {
|
||||
)}
|
||||
</div>
|
||||
{!simple && <TipDialog open={tipOpen} onClose={handleTipClose} />}
|
||||
{!simple && <WithdrawDialog count={350} open={withdrawOpen} onClose={handleWithdrawClose} />}
|
||||
{!simple && (
|
||||
<WithdrawDialog
|
||||
count={Math.min(Number(formatMoney(stats.availableBalance)), 200)}
|
||||
open={withdrawOpen}
|
||||
onClose={handleWithdrawClose}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -96,7 +96,8 @@ function ProfitList(props: IPartnerProfitListProps) {
|
||||
style={listHeight ? { height: `${listHeight}px` } : undefined}
|
||||
>
|
||||
{dataList.map(item => {
|
||||
const isChat = type === ProfitType.CHAT_SHARE || item.earnType.toString().toLowerCase().indexOf('chat') > -1;
|
||||
const isChat =
|
||||
type === ProfitType.CHAT_SHARE || item.earnType.toString().toLowerCase().indexOf('chat') > -1;
|
||||
return (
|
||||
<div className={`${PREFIX}__row`} key={item.id}>
|
||||
<div className={`${PREFIX}__row-content`}>
|
||||
|
@ -78,10 +78,13 @@
|
||||
&:last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
&.time,
|
||||
&.project {
|
||||
&.time {
|
||||
flex: 2;
|
||||
}
|
||||
&.project {
|
||||
width: 150px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
&.status {
|
||||
width: 96px;
|
||||
padding: 0 8px;
|
||||
|
@ -19,7 +19,7 @@ export interface IPhoneButtonProps extends ButtonProps {
|
||||
message?: string;
|
||||
// 绑定后是否需要刷新接口获取手机号
|
||||
needPhone?: boolean;
|
||||
onBindPhone?: (status: BindPhoneStatus) => void;
|
||||
onBindPhone?: (status: BindPhoneStatus, e: ITouchEvent) => void;
|
||||
onSuccess?: (e: ITouchEvent) => void;
|
||||
}
|
||||
|
||||
@ -44,17 +44,17 @@ export default function PhoneButton(props: IPhoneButtonProps) {
|
||||
const encryptedData = e.detail.encryptedData;
|
||||
const iv = e.detail.iv;
|
||||
if (!encryptedData || !iv) {
|
||||
onBindPhone?.(BindPhoneStatus.Cancel);
|
||||
onBindPhone?.(BindPhoneStatus.Cancel, e as ITouchEvent);
|
||||
return Toast.error('取消授权');
|
||||
}
|
||||
try {
|
||||
await setPhoneNumber({ encryptedData, iv });
|
||||
needPhone && (await requestUserInfo());
|
||||
Toast.success(message);
|
||||
onBindPhone?.(BindPhoneStatus.Success);
|
||||
onBindPhone?.(BindPhoneStatus.Success, e as ITouchEvent);
|
||||
onSuccess?.(e as ITouchEvent);
|
||||
} catch (err) {
|
||||
onBindPhone?.(BindPhoneStatus.Error);
|
||||
onBindPhone?.(BindPhoneStatus.Error, e as ITouchEvent);
|
||||
Toast.error('绑定失败');
|
||||
log('bind phone fail', err);
|
||||
}
|
||||
|
82
src/components/prejob-popup/index.less
Normal file
82
src/components/prejob-popup/index.less
Normal file
@ -0,0 +1,82 @@
|
||||
@import '@/styles/common.less';
|
||||
@import '@/styles/variables.less';
|
||||
|
||||
.prejob-popup {
|
||||
&__content {
|
||||
padding: 40px 32px;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-weight: 500;
|
||||
font-size: 32px;
|
||||
line-height: 48px;
|
||||
margin-bottom: 31px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&__body {
|
||||
}
|
||||
|
||||
&__item {
|
||||
.flex-row();
|
||||
margin-bottom: 40px;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
&-icon {
|
||||
width: 88px;
|
||||
height: 88px;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&.material {
|
||||
background: #feba00;
|
||||
> image {
|
||||
width: 40px;
|
||||
height: 46px;
|
||||
}
|
||||
}
|
||||
&.vip {
|
||||
background: #b094ff;
|
||||
> image {
|
||||
width: 48px;
|
||||
height: 42px;
|
||||
}
|
||||
}
|
||||
&.video {
|
||||
background: #34a853;
|
||||
> image {
|
||||
width: 46px;
|
||||
height: 44px;
|
||||
}
|
||||
}
|
||||
}
|
||||
&-main {
|
||||
padding: 0 24px;
|
||||
flex: 1;
|
||||
.title {
|
||||
font-weight: 500;
|
||||
font-size: 28px;
|
||||
line-height: 40px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.desc {
|
||||
font-size: 24px;
|
||||
line-height: 36px;
|
||||
color: @blColorG1;
|
||||
}
|
||||
}
|
||||
&-action {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
&__btn {
|
||||
.button(@width: 136px, @height: 72px, @fontSize: 28px, @fontWeight: 400, @borderRadius: 43px, @highlight: 0);
|
||||
background: #f2f2f2;
|
||||
}
|
||||
}
|
89
src/components/prejob-popup/index.tsx
Normal file
89
src/components/prejob-popup/index.tsx
Normal file
@ -0,0 +1,89 @@
|
||||
import { Button, Image } from '@tarojs/components';
|
||||
|
||||
import { Popup, Dialog } from '@taroify/core';
|
||||
import { Fragment, useCallback, useState } from 'react';
|
||||
|
||||
import JobBuy from '@/components/product-dialog/steps-ui/job-buy';
|
||||
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
||||
import { PageUrl } from '@/constants/app';
|
||||
import { GET_CONTACT_TYPE } from '@/constants/job';
|
||||
import { navigateTo } from '@/utils/route';
|
||||
|
||||
import './index.less';
|
||||
|
||||
interface IProps {
|
||||
onCancel: () => void;
|
||||
onConfirm: (type: GET_CONTACT_TYPE) => void;
|
||||
}
|
||||
|
||||
const PREFIX = 'prejob-popup';
|
||||
|
||||
const GET_CONTACT_TYPE_OPTIONS = [
|
||||
{
|
||||
type: GET_CONTACT_TYPE.MATERIAL,
|
||||
icon: 'https://publiccdn.neighbourhood.com.cn/img/file.svg',
|
||||
title: '创建模卡(免费报单)',
|
||||
desc: '免费报单,优先推荐给企业,机会更多',
|
||||
btnText: '创建',
|
||||
},
|
||||
{
|
||||
type: GET_CONTACT_TYPE.VIP,
|
||||
icon: 'https://publiccdn.neighbourhood.com.cn/img/diamond.svg',
|
||||
title: '播络会员',
|
||||
desc: '开通会员每天可查看10个',
|
||||
btnText: '开通',
|
||||
},
|
||||
];
|
||||
|
||||
export function PrejobPopup({ onCancel, onConfirm }: IProps) {
|
||||
const [openPopup, setOpenPopup] = useState(true);
|
||||
const [openDialog, setOpenDialog] = useState(false);
|
||||
const handleClick = (type: GET_CONTACT_TYPE) => () => {
|
||||
if (type === GET_CONTACT_TYPE.MATERIAL) {
|
||||
navigateTo(PageUrl.MaterialUploadVideo);
|
||||
onConfirm(type);
|
||||
}
|
||||
if (type === GET_CONTACT_TYPE.VIP) {
|
||||
setOpenPopup(false);
|
||||
setOpenDialog(true);
|
||||
}
|
||||
};
|
||||
const handleAfterBuy = useCallback(async () => {
|
||||
onConfirm(GET_CONTACT_TYPE.VIP);
|
||||
}, [onConfirm]);
|
||||
return (
|
||||
<Fragment>
|
||||
<Popup rounded className={PREFIX} placement="bottom" open={openPopup} onClose={onCancel}>
|
||||
<div className={`${PREFIX}__content`}>
|
||||
<div className={`${PREFIX}__title`}>以下方式任选其一均可获取联系方式</div>
|
||||
<div className={`${PREFIX}__body`}>
|
||||
{GET_CONTACT_TYPE_OPTIONS.map(option => {
|
||||
return (
|
||||
<div className={`${PREFIX}__item`} key={option.type}>
|
||||
<div className={`${PREFIX}__item-icon ${option.type}`}>
|
||||
<Image mode="aspectFit" src={option.icon} />
|
||||
</div>
|
||||
<div className={`${PREFIX}__item-main`}>
|
||||
<div className="title">{option.title}</div>
|
||||
<div className="desc">{option.desc}</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__item-action`}>
|
||||
<Button className={`${PREFIX}__btn`} onClick={handleClick(option.type)}>
|
||||
{option.btnText}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
<SafeBottomPadding />
|
||||
</Popup>
|
||||
<Dialog open={openDialog} onClose={onCancel}>
|
||||
<Dialog.Content>
|
||||
<JobBuy onConfirm={handleAfterBuy} buyOnly />
|
||||
</Dialog.Content>
|
||||
</Dialog>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
@ -3,6 +3,7 @@ export const PREFIX = 'product-dialog';
|
||||
export enum DialogStatus {
|
||||
// 加载中
|
||||
LOADING = 'loading',
|
||||
PRE_ACTION = 'pre_action',
|
||||
// 直接联系通告主
|
||||
JOB_CONTACT_DIRECT = 'job_contact_direct',
|
||||
// 联系客服去联系通告主 -> 订阅通知
|
||||
|
@ -82,7 +82,10 @@ function ProductGroupDialog(props: IProps) {
|
||||
return;
|
||||
}
|
||||
// 否则:如果有解锁次数,显示是否确定消费。无解锁次数,显示不无次数 UI
|
||||
const [time, detail] = await Promise.all([requestProductBalance(PRODUCT_CODE), requestGroupDetail(blGroupId)]);
|
||||
const [[time], detail] = await Promise.all([
|
||||
requestProductBalance(PRODUCT_CODE),
|
||||
requestGroupDetail(blGroupId),
|
||||
]);
|
||||
setGroupDetail(detail);
|
||||
if (time <= 0) {
|
||||
setStatus(DialogStatus.GROUP_NEED_BUY_ADD);
|
||||
|
@ -133,6 +133,7 @@
|
||||
&__header {
|
||||
.flex-row();
|
||||
.header-font();
|
||||
font-size: 32px;
|
||||
|
||||
.highlight {
|
||||
color: @blHighlightColor;
|
||||
@ -143,7 +144,8 @@
|
||||
&__describe {
|
||||
.flex-row();
|
||||
.describe-font();
|
||||
margin-top: 24px;
|
||||
margin-top: 18px;
|
||||
line-height: 40px;
|
||||
|
||||
.highlight {
|
||||
color: @blHighlightColor;
|
||||
@ -158,13 +160,13 @@
|
||||
|
||||
&__item {
|
||||
position: relative;
|
||||
width: 170px;
|
||||
width: 182px;
|
||||
height: 192px;
|
||||
.flex-column();
|
||||
justify-content: center;
|
||||
border: 2px solid @blHighlightColor;
|
||||
border-radius: 8px;
|
||||
margin-right: 24px;
|
||||
margin-right: 15px;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
|
@ -102,7 +102,7 @@ function ProductJobWithGroupDialog(props: Omit<IProps, 'visible'>) {
|
||||
return;
|
||||
}
|
||||
// 否则:如果有解锁次数,显示是否确定消费。无解锁次数,显示不无次数 UI
|
||||
const time = await requestProductBalance(ProductType.AddGroup);
|
||||
const [time] = await requestProductBalance(ProductType.AddGroup);
|
||||
if (time <= 0) {
|
||||
setStatus(DialogStatus.JOB_CONTACT_NEED_BUY_GROUP);
|
||||
} else {
|
||||
@ -119,7 +119,7 @@ function ProductJobWithGroupDialog(props: Omit<IProps, 'visible'>) {
|
||||
return;
|
||||
}
|
||||
// 自动报单
|
||||
const time = await requestProductBalance(ProductType.GetJob);
|
||||
const [time] = await requestProductBalance(ProductType.GetJob);
|
||||
if (time <= 0) {
|
||||
setStatus(DialogStatus.JOB_UNABLE_UNLOCK);
|
||||
} else {
|
||||
|
@ -41,7 +41,7 @@ function ProductJobDialog(props: Omit<IProps, 'visible'>) {
|
||||
}, [onClose]);
|
||||
|
||||
const handleAfterBuy = useCallback(async () => {
|
||||
const time = await requestProductBalance(PRODUCT_CODE);
|
||||
const [time] = await requestProductBalance(PRODUCT_CODE);
|
||||
if (time <= 0) {
|
||||
Toast.error('发生错误请重试');
|
||||
onClose();
|
||||
@ -83,7 +83,7 @@ function ProductJobDialog(props: Omit<IProps, 'visible'>) {
|
||||
handleContact(result.declarationTypeResult);
|
||||
return;
|
||||
}
|
||||
const time = await requestProductBalance(PRODUCT_CODE);
|
||||
const [time] = await requestProductBalance(PRODUCT_CODE);
|
||||
if (time <= 0) {
|
||||
const allowBuy = await requestAllBuyProduct(PRODUCT_CODE);
|
||||
setStatus(allowBuy ? DialogStatus.JOB_BUY : DialogStatus.JOB_UNABLE_UNLOCK);
|
||||
|
@ -115,7 +115,7 @@ export function CompanyPublishJobDialog(props: IProps) {
|
||||
try {
|
||||
const productCode = ProductType.CompanyPublishJob;
|
||||
Taro.showLoading();
|
||||
const time = await requestProductBalance(productCode);
|
||||
const [time] = await requestProductBalance(productCode);
|
||||
if (time <= 0) {
|
||||
setStatus(DialogStatus.COMPANY_PUBLISH_JOB_BUY);
|
||||
return;
|
||||
|
@ -70,7 +70,7 @@ export default function GroupBuy(props: IProps) {
|
||||
if (status !== OrderStatus.Success) {
|
||||
throw new Error('order status error');
|
||||
}
|
||||
const time = await requestProductBalance(ProductType.AddGroup);
|
||||
const [time] = await requestProductBalance(ProductType.AddGroup);
|
||||
log('handleBuy new addGroupTime', time);
|
||||
onConfirm(time);
|
||||
} catch (e) {
|
||||
|
@ -16,6 +16,7 @@ import { postSubscribe, subscribeMessage } from '@/utils/subscribe';
|
||||
import Toast from '@/utils/toast';
|
||||
|
||||
interface IProps {
|
||||
buyOnly?: boolean;
|
||||
onConfirm: () => void;
|
||||
}
|
||||
|
||||
@ -23,6 +24,7 @@ interface Item {
|
||||
id: ProductSpecId;
|
||||
title: string;
|
||||
content: string;
|
||||
buyOnlyContent?: string;
|
||||
price: string;
|
||||
amt: number;
|
||||
badge?: string;
|
||||
@ -31,17 +33,19 @@ interface Item {
|
||||
const LIST: Item[] = [
|
||||
{ id: ProductSpecId.WeeklyVIP, title: '非会员', content: '每日2次', price: '免费', amt: 0 },
|
||||
{
|
||||
id: ProductSpecId.WeeklyVIP,
|
||||
title: '周会员',
|
||||
content: '每日5次',
|
||||
id: ProductSpecId.DailyVIP,
|
||||
title: '日会员',
|
||||
content: '每日+10次',
|
||||
buyOnlyContent: '每日12次',
|
||||
price: '60播豆',
|
||||
amt: 6,
|
||||
badge: '限时体验',
|
||||
},
|
||||
{
|
||||
id: ProductSpecId.NewMonthlyVIP,
|
||||
title: '月会员',
|
||||
content: '每日5次',
|
||||
id: ProductSpecId.WeeklyVIP,
|
||||
title: '周会员',
|
||||
content: '每日+10次',
|
||||
buyOnlyContent: '每日12次',
|
||||
price: '180播豆',
|
||||
amt: 18,
|
||||
badge: ' 超值',
|
||||
@ -62,7 +66,7 @@ const subscribe = async () => {
|
||||
};
|
||||
|
||||
export default function JobBuy(props: IProps) {
|
||||
const { onConfirm } = props;
|
||||
const { onConfirm, buyOnly } = props;
|
||||
const [selectItem, setSelectItem] = useState(LIST[1]);
|
||||
|
||||
const handleClickItem = useCallback((newSelectItem: Item) => setSelectItem(newSelectItem), []);
|
||||
@ -106,32 +110,47 @@ export default function JobBuy(props: IProps) {
|
||||
|
||||
return (
|
||||
<div className={`${PREFIX}__job-buy`}>
|
||||
<div className={`${PREFIX}__job-buy__header`}>
|
||||
<div>今日通告对接次数</div>
|
||||
<div className="highlight">已用完</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__job-buy__describe`}>
|
||||
<div>请</div>
|
||||
<div className="highlight">明日</div>
|
||||
<div>再来 或 </div>
|
||||
<div className="highlight">升级会员</div>
|
||||
</div>
|
||||
{buyOnly ? (
|
||||
<div className={`${PREFIX}__job-buy__header`}>开通播络会员即可直接查看联系方式</div>
|
||||
) : (
|
||||
<div className={`${PREFIX}__job-buy__header`}>
|
||||
<div>今日通告对接次数</div>
|
||||
<div className="highlight">已用完</div>
|
||||
</div>
|
||||
)}
|
||||
{buyOnly ? (
|
||||
<div className={`${PREFIX}__job-buy__describe`}>每天可获取12个联系方式</div>
|
||||
) : (
|
||||
<div className={`${PREFIX}__job-buy__describe`}>
|
||||
<div>请</div>
|
||||
<div className="highlight">明日</div>
|
||||
<div>再来 或 </div>
|
||||
<div className="highlight">升级会员</div>
|
||||
</div>
|
||||
)}
|
||||
<div className={`${PREFIX}__job-buy__container`}>
|
||||
{LIST.map(item => (
|
||||
<div
|
||||
key={item.price}
|
||||
className={classNames(`${PREFIX}__job-buy__item`, {
|
||||
selected: item.amt === selectItem.amt,
|
||||
disabled: item.amt === 0,
|
||||
})}
|
||||
onClick={item.amt === 0 ? undefined : () => handleClickItem(item)}
|
||||
>
|
||||
<div className={classNames(`${PREFIX}__job-buy__item__title`, { free: item.amt === 0 })}>{item.title}</div>
|
||||
<div className={`${PREFIX}__job-buy__item__content`}>{item.content}</div>
|
||||
<div className={`${PREFIX}__job-buy__item__price`}>{item.price}</div>
|
||||
{item.badge && <Badge className={`${PREFIX}__job-buy__item__badge`} text={item.badge} />}
|
||||
</div>
|
||||
))}
|
||||
{LIST.map(item => {
|
||||
if (buyOnly && !item.amt) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<div
|
||||
key={item.price}
|
||||
className={classNames(`${PREFIX}__job-buy__item`, {
|
||||
selected: item.amt === selectItem.amt,
|
||||
disabled: item.amt === 0,
|
||||
})}
|
||||
onClick={item.amt === 0 ? undefined : () => handleClickItem(item)}
|
||||
>
|
||||
<div className={classNames(`${PREFIX}__job-buy__item__title`, { free: item.amt === 0 })}>
|
||||
{item.title}
|
||||
</div>
|
||||
<div className={`${PREFIX}__job-buy__item__content`}>{buyOnly ? item.buyOnlyContent : item.content}</div>
|
||||
<div className={`${PREFIX}__job-buy__item__price`}>{item.price}</div>
|
||||
{item.badge && <Badge className={`${PREFIX}__job-buy__item__badge`} text={item.badge} />}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<Button className={`${PREFIX}__job-buy__button`} onClick={handleBuy}>
|
||||
{`支付 ${selectItem.amt} 元`}
|
||||
|
@ -1,14 +1,11 @@
|
||||
import { Tabbar } from '@taroify/core';
|
||||
import classNames from 'classnames';
|
||||
import { useCallback } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
||||
import { APP_TAB_BAR_ID, RoleType, PageType, PageUrl } from '@/constants/app';
|
||||
import { ANCHOR_TAB_LIST, COMPANY_TAB_LIST, TabItemType } from '@/hooks/use-config';
|
||||
import useMessage from '@/hooks/use-message';
|
||||
import useRoleType from '@/hooks/user-role-type';
|
||||
import { changeHomePage } from '@/store/actions';
|
||||
import { selectHomePageType } from '@/store/selector';
|
||||
import { logWithPrefix } from '@/utils/common';
|
||||
import { switchTab } from '@/utils/route';
|
||||
|
||||
@ -16,6 +13,7 @@ import './index.less';
|
||||
|
||||
interface IProps {
|
||||
className?: string;
|
||||
type: PageType;
|
||||
}
|
||||
|
||||
const PREFIX = 'base-tab-bar';
|
||||
@ -40,25 +38,21 @@ const TabItem = (props: { item: TabItemType }) => {
|
||||
);
|
||||
};
|
||||
|
||||
function BaseTabBar(props: IProps) {
|
||||
const { className } = props;
|
||||
function BaseTabBar({ className, type }: IProps) {
|
||||
const roleType = useRoleType();
|
||||
const currentPage = useSelector(selectHomePageType);
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const tabs = roleType === RoleType.Anchor ? ANCHOR_TAB_LIST : COMPANY_TAB_LIST;
|
||||
|
||||
const handleTabClick = useCallback(
|
||||
(value: PageType) => {
|
||||
if (value === currentPage) {
|
||||
if (value === type) {
|
||||
return;
|
||||
}
|
||||
dispatch(changeHomePage(value));
|
||||
const item = tabs.find((i: TabItemType) => i.type === value);
|
||||
log('tab bar changed', value, item?.pagePath);
|
||||
item && switchTab(item.pagePath as PageUrl);
|
||||
},
|
||||
[tabs, currentPage, dispatch]
|
||||
[tabs, type]
|
||||
);
|
||||
|
||||
// useEffect(() => {
|
||||
@ -72,14 +66,14 @@ function BaseTabBar(props: IProps) {
|
||||
|
||||
return (
|
||||
<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) => {
|
||||
return (
|
||||
<Tabbar.TabItem
|
||||
key={item.pagePath}
|
||||
value={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} />
|
||||
</Tabbar.TabItem>
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Button, Image, Text } from '@tarojs/components';
|
||||
import { Button, Text } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
|
||||
import { Cell } from '@taroify/core';
|
||||
@ -35,29 +35,36 @@ interface CityOption extends ISelectOption<CityValue> {
|
||||
|
||||
const PREFIX = 'user-batch-publish';
|
||||
const log = logWithPrefix(PREFIX);
|
||||
const SERVICE_ILLUSTRATE = `群发次数:每日一次,连发3天
|
||||
群发内容:仅限主播招聘通告,违规内容不发
|
||||
联系方法:通告中留通告主联系方式,主播直接联系`;
|
||||
const SERVICE_ILLUSTRATE = `服务方式:帮您把招聘需求发到众多同城合作主播群
|
||||
群发次数:每日1次,连发3天
|
||||
内容要求:仅限带货主播招聘需求,其他不发
|
||||
主播联系:内容中留招聘方联系方式,主播直接联系`;
|
||||
const cityValues: CityValue[] = [
|
||||
{ cityCode: '440100', cityName: '广州', count: 300 },
|
||||
{ cityCode: '440100', cityName: '广州', count: 800 },
|
||||
{ cityCode: '440300', cityName: '深圳', count: 100 },
|
||||
{ cityCode: '330100', cityName: '杭州', count: 300 },
|
||||
{ cityCode: '110100', cityName: '北京', count: 100 },
|
||||
{ cityCode: '510100', cityName: '成都', count: 50 },
|
||||
{ cityCode: '330100', cityName: '杭州', count: 750 },
|
||||
{ cityCode: '110100', cityName: '北京', count: 150 },
|
||||
{ cityCode: '510100', cityName: '成都', count: 100 },
|
||||
{ cityCode: '500100', cityName: '重庆', count: 50 },
|
||||
{ cityCode: '430100', cityName: '长沙', count: 50 },
|
||||
{ cityCode: '350200', cityName: '厦门', count: 50 },
|
||||
{ cityCode: '310100', cityName: '上海', count: 100 },
|
||||
{ cityCode: '420100', cityName: '武汉', count: 50 },
|
||||
{ cityCode: '610100', cityName: '西安', count: 50 },
|
||||
{ cityCode: '410100', cityName: '郑州', count: 100 },
|
||||
{ cityCode: '310100', cityName: '上海', count: 150 },
|
||||
{ cityCode: '420100', cityName: '武汉', count: 80 },
|
||||
{ cityCode: '610100', cityName: '西安', count: 60 },
|
||||
{ cityCode: '410100', cityName: '郑州', count: 150 },
|
||||
].sort((a, b) => b.count - a.count);
|
||||
const MIN_GROUP_SIZE = 20;
|
||||
const GROUP_OPTIONS = [
|
||||
{ value: MIN_GROUP_SIZE, productSpecId: ProductSpecId.GroupBatchPublish20, label: '20', price: 18 },
|
||||
{ value: 50, productSpecId: ProductSpecId.GroupBatchPublish50, label: '50', price: 40 },
|
||||
{ value: 60, productSpecId: ProductSpecId.GroupBatchPublish60, label: '60', price: 48 },
|
||||
{ value: 80, productSpecId: ProductSpecId.GroupBatchPublish80, label: '80', price: 58 },
|
||||
{ value: 100, productSpecId: ProductSpecId.GroupBatchPublish100, label: '100', price: 68 },
|
||||
{ value: 150, productSpecId: ProductSpecId.GroupBatchPublish150, label: '150', price: 98 },
|
||||
{ value: 300, productSpecId: ProductSpecId.GroupBatchPublish300, label: '300', price: 128 },
|
||||
{ value: 500, productSpecId: ProductSpecId.GroupBatchPublish500, label: '500', price: 188 },
|
||||
{ value: 500, productSpecId: ProductSpecId.GroupBatchPublish500, label: '500', price: 168 },
|
||||
{ value: 750, productSpecId: ProductSpecId.GroupBatchPublish750, label: '750', price: 188 },
|
||||
{ value: 800, productSpecId: ProductSpecId.GroupBatchPublish800, label: '800', price: 198 },
|
||||
{ value: 1000, productSpecId: ProductSpecId.GroupBatchPublish1000, label: '1000', price: 288 },
|
||||
];
|
||||
|
||||
@ -139,7 +146,7 @@ export default function UserBatchPublish() {
|
||||
useEffect(() => {
|
||||
try {
|
||||
const cOptions: CityOption[] = cityValues.map(value => ({ value, label: value.cityName }));
|
||||
const initCity = cOptions[0].value;
|
||||
const initCity = (cOptions.find(o => o.label === '重庆') || cOptions[0]).value;
|
||||
|
||||
setLoading(false);
|
||||
setCity(initCity);
|
||||
@ -156,7 +163,7 @@ export default function UserBatchPublish() {
|
||||
|
||||
return (
|
||||
<div className={PREFIX}>
|
||||
<Image mode="widthFix" className={`${PREFIX}__header-image`} src="https://neighbourhood.cn/pubJob.png" />
|
||||
{/*<Image mode="widthFix" className={`${PREFIX}__header-image`} src="https://neighbourhood.cn/pubJob.png" />*/}
|
||||
<div className={`${PREFIX}__title`}>请选择城市</div>
|
||||
<Cell isLink align="center" className={`${PREFIX}__cell`} title={city?.cityName} onClick={handleClickCity} />
|
||||
<div className={`${PREFIX}__title`}>可购买群数</div>
|
||||
|
@ -74,6 +74,7 @@ export enum PageUrl {
|
||||
PrivacyWebview = 'pages/privacy-webview/index',
|
||||
Partner = 'pages/partner/index',
|
||||
WithdrawRecord = 'pages/withdraw-record/index',
|
||||
GroupDelegatePublish = 'pages/group-delegate-publish/index',
|
||||
}
|
||||
|
||||
export enum PluginUrl {
|
||||
|
@ -10,5 +10,7 @@ export enum CacheKey {
|
||||
LAST_SELECT_MY_JOB = '__last_select_my_job__',
|
||||
CLOSE_PARTNER_BANNER = '__close_partner_banner__',
|
||||
INVITE_CODE = '__invite_code__',
|
||||
AGREEMENT_SIGNED = '__agreement_signed__'
|
||||
AGREEMENT_SIGNED = '__agreement_signed__',
|
||||
CITY_CODES = '__city_codes__',
|
||||
JOIN_GROUP_CARD_CLICKED = '__join_group_card_clicked__',
|
||||
}
|
||||
|
@ -5861,6 +5861,16 @@ export const CITY_INDEXES_LIST = [
|
||||
];
|
||||
|
||||
export const GROUP_CITY_INDEXES_LIST = [
|
||||
{
|
||||
letter: 'B',
|
||||
data: [
|
||||
{
|
||||
cityCode: '110100',
|
||||
cityName: '北京',
|
||||
keyword: 'BEIJING北京',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
letter: 'C',
|
||||
data: [
|
||||
@ -5874,6 +5884,11 @@ export const GROUP_CITY_INDEXES_LIST = [
|
||||
cityName: '成都',
|
||||
keyword: 'CHENGDOU成都',
|
||||
},
|
||||
{
|
||||
cityCode: '430100',
|
||||
cityName: '长沙',
|
||||
keyword: 'CHANGSHA长沙',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -5914,6 +5929,11 @@ export const GROUP_CITY_INDEXES_LIST = [
|
||||
{
|
||||
letter: 'H',
|
||||
data: [
|
||||
{
|
||||
cityCode: '330100',
|
||||
cityName: '杭州',
|
||||
keyword: 'HANGZHOU杭州',
|
||||
},
|
||||
{
|
||||
cityCode: '340100',
|
||||
cityName: '合肥',
|
||||
@ -5921,6 +5941,16 @@ export const GROUP_CITY_INDEXES_LIST = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
letter: 'K',
|
||||
data: [
|
||||
{
|
||||
cityCode: '530100',
|
||||
cityName: '昆明',
|
||||
keyword: 'KUNMING昆明',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
letter: 'N',
|
||||
data: [
|
||||
@ -5939,6 +5969,11 @@ export const GROUP_CITY_INDEXES_LIST = [
|
||||
cityName: '青岛',
|
||||
keyword: 'QINGDAO青岛',
|
||||
},
|
||||
{
|
||||
cityCode: '350500',
|
||||
cityName: '泉州',
|
||||
keyword: 'QUANZHOU泉州',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -5959,11 +5994,6 @@ export const GROUP_CITY_INDEXES_LIST = [
|
||||
cityName: '苏州',
|
||||
keyword: 'SUZHOU苏州',
|
||||
},
|
||||
{
|
||||
cityCode: '330300',
|
||||
cityName: '温州',
|
||||
keyword: 'WENZHOU温州',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -5979,6 +6009,11 @@ export const GROUP_CITY_INDEXES_LIST = [
|
||||
{
|
||||
letter: 'W',
|
||||
data: [
|
||||
{
|
||||
cityCode: '330300',
|
||||
cityName: '温州',
|
||||
keyword: 'WENZHOU温州',
|
||||
},
|
||||
{
|
||||
cityCode: '420100',
|
||||
cityName: '武汉',
|
||||
@ -5994,6 +6029,11 @@ export const GROUP_CITY_INDEXES_LIST = [
|
||||
cityName: '西安',
|
||||
keyword: 'XIAN西安',
|
||||
},
|
||||
{
|
||||
cityCode: '350200',
|
||||
cityName: '厦门',
|
||||
keyword: 'XIAMEN厦门',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -174,3 +174,8 @@ export const FULL_EMPLOY_SALARY_OPTIONS = [
|
||||
export const PART_PRICE_OPTIONS = PART_EMPLOY_SALARY_OPTIONS.filter(o => !!o.value);
|
||||
|
||||
export const FULL_PRICE_OPTIONS = FULL_EMPLOY_SALARY_OPTIONS.filter(o => !!o.value);
|
||||
|
||||
export enum GET_CONTACT_TYPE {
|
||||
VIP = 'vip',
|
||||
MATERIAL = 'material',
|
||||
}
|
||||
|
@ -52,3 +52,9 @@ export const ProfitStatusDescriptions = {
|
||||
OTHER: '',
|
||||
FINISHED: '已分账',
|
||||
};
|
||||
|
||||
export const WithdrawStatusDescriptions = {
|
||||
0: '提现中',
|
||||
1: '已提现',
|
||||
2: '失败',
|
||||
};
|
||||
|
@ -27,14 +27,20 @@ export enum ProductSpecId {
|
||||
AddGroup2 = 'ADDGROUP_2',
|
||||
AddGroup3 = 'ADDGROUP_3',
|
||||
BossVip = 'BOSSVIP',
|
||||
DailyVIP = 'VIP_D',
|
||||
WeeklyVIP = 'VIP_W',
|
||||
MonthlyVIP = 'VIP_M', // 30 每天十次
|
||||
NewMonthlyVIP = 'VIP_M_NEW', // 18 每天五次
|
||||
GroupBatchPublish20 = 'GROUP_BATCH_PUSH_20',
|
||||
GroupBatchPublish50 = 'GROUP_BATCH_PUSH_50',
|
||||
GroupBatchPublish60 = 'GROUP_BATCH_PUSH_60',
|
||||
GroupBatchPublish80 = 'GROUP_BATCH_PUSH_80',
|
||||
GroupBatchPublish100 = 'GROUP_BATCH_PUSH_100',
|
||||
GroupBatchPublish150 = 'GROUP_BATCH_PUSH_150',
|
||||
GroupBatchPublish300 = 'GROUP_BATCH_PUSH_300',
|
||||
GroupBatchPublish500 = 'GROUP_BATCH_PUSH_500',
|
||||
GroupBatchPublish750 = 'GROUP_BATCH_PUSH_750',
|
||||
GroupBatchPublish800 = 'GROUP_BATCH_PUSH_800',
|
||||
GroupBatchPublish1000 = 'GROUP_BATCH_PUSH_1000',
|
||||
BOSS_PUB_JOB_1 = 'BOSS_PUB_JOB_1', // 旧版企业发通告会员
|
||||
BOSS_VIP_NEW_1 = 'BOSS_VIP_NEW_1', // 新版企业发通告会员 - 周
|
||||
|
@ -62,7 +62,7 @@ const getSalaryPrice = (fullSalary?: SalaryRange, partSalary?: SalaryRange) => {
|
||||
|
||||
function ProfileIntentionFragment(props: IProps, ref) {
|
||||
const { profile } = props;
|
||||
const [cityCodes, setCityCodes] = useState(calcInitCityCodes(profile.cityCodes));
|
||||
const [cityCodes, setCityCodes] = useState(calcInitCityCodes(profile.cityCodes || ''));
|
||||
const [employType, setEmployType] = useState(profile.employType);
|
||||
const [fullSalary, setFullSalary] = useState(calcSalarySelect(profile, true));
|
||||
const [partSalary, setPartSalary] = useState(calcSalarySelect(profile, false));
|
||||
|
@ -44,7 +44,7 @@
|
||||
font-size: 28px;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
background: #0000005c;
|
||||
background: #6D3DF5B2;
|
||||
border-radius: 48px;
|
||||
}
|
||||
|
||||
@ -232,4 +232,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.join-group-hint {
|
||||
margin: 24px;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import { navigateTo } from '@/utils/route';
|
||||
|
||||
import './index.less';
|
||||
import onChangeEventDetail = SwiperProps.onChangeEventDetail;
|
||||
import { JoinGroupHint } from '@/components/join-group-hint';
|
||||
|
||||
interface IProps {
|
||||
editable: boolean;
|
||||
@ -207,6 +208,7 @@ export default function ProfileViewFragment(props: IProps) {
|
||||
>{`${coverIndex + 1}/${profile.materialVideoInfoList.length}`}</div>
|
||||
</div>
|
||||
</div>
|
||||
{!editable && <JoinGroupHint />}
|
||||
<div className={`${PREFIX}__body`}>
|
||||
<div className={`${PREFIX}__basic-info`}>
|
||||
<div className={`${PREFIX}__basic-info__name-container`}>
|
||||
@ -228,7 +230,9 @@ export default function ProfileViewFragment(props: IProps) {
|
||||
{index ? (
|
||||
<div className={`${PREFIX}__info-group__header__title`}>{data.title}</div>
|
||||
) : (
|
||||
<DevDiv className={`${PREFIX}__info-group__header__title`} OnDev={onDev}>{data.title}</DevDiv>
|
||||
<DevDiv className={`${PREFIX}__info-group__header__title`} OnDev={onDev}>
|
||||
{data.title}
|
||||
</DevDiv>
|
||||
)}
|
||||
{editable && (
|
||||
<div className={`${PREFIX}__info-group__header__edit`} onClick={() => handleEditGroupItem(data.type)}>
|
||||
|
@ -97,6 +97,7 @@ export const APP_CONFIG: AppConfigType = {
|
||||
PageUrl.PrivacyWebview,
|
||||
PageUrl.Partner,
|
||||
PageUrl.WithdrawRecord,
|
||||
PageUrl.GroupDelegatePublish,
|
||||
// PageUrl.DevDebug,
|
||||
],
|
||||
window: {
|
||||
|
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 { useSelector } from 'react-redux';
|
||||
|
||||
import { selectRoleType } from '@/store/selector';
|
||||
import { RoleType } from '@/constants/app';
|
||||
import { selectRoleType } from '@/store/selector';
|
||||
|
||||
function useRoleType() {
|
||||
return useSelector(selectRoleType) || RoleType.Anchor;
|
||||
|
@ -82,4 +82,6 @@ export enum API {
|
||||
BECOME_PARTNER = '/user/becomePartner',
|
||||
GET_PROFIT_LIST = '/user/profit/list',
|
||||
GET_PROFIT_STAT = '/user/profits',
|
||||
WITHDRAW = '/user/withdraw',
|
||||
GET_WITHDRAW_LIST = '/user/withdraw/records',
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ export enum RESPONSE_ERROR_CODE {
|
||||
INSUFFICIENT_BALANCE = 'INSUFFICIENT_BALANCE', // 聊天或者模卡查看超出限制
|
||||
INSUFFICIENT_FREE_BALANCE = 'INSUFFICIENT_FREE_BALANCE', // 免费查看次数(未购买会员)超限
|
||||
BOSS_VIP_EXPIRED = 'BOSS_VIP_EXPIRED', // 会员过期
|
||||
CHAT_MSG_SEND_NOT_ALLOW = 'CHAT_MSG_SEND_NOT_ALLOW',
|
||||
}
|
||||
|
||||
export const RESPONSE_ERROR_INFO: { [key in RESPONSE_ERROR_CODE]?: string } = {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Image } from '@tarojs/components';
|
||||
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 { isEqual } from 'lodash-es';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
@ -14,7 +14,7 @@ import Overlay from '@/components/overlay';
|
||||
import PageLoading from '@/components/page-loading';
|
||||
import PartnerBanner from '@/components/partner-banner';
|
||||
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 { ALL_ANCHOR_SORT_TYPES, ANCHOR_SORT_TYPE_TITLE_MAP, AnchorSortType } from '@/constants/material';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
@ -23,6 +23,7 @@ import useLocation from '@/hooks/use-location';
|
||||
import { JobManageInfo } from '@/types/job';
|
||||
import { Coordinate } from '@/types/location';
|
||||
import { IAnchorFilters } from '@/types/material';
|
||||
import { switchRoleType } from '@/utils/app';
|
||||
import { logWithPrefix } from '@/utils/common';
|
||||
import { getLastSelectMyJobId, requestJobManageList, setLastSelectMyJobId } from '@/utils/job';
|
||||
import { getWxLocation } from '@/utils/location';
|
||||
@ -165,6 +166,8 @@ export default function AnchorPage() {
|
||||
}, [location]);
|
||||
|
||||
useLoad(async () => {
|
||||
switchRoleType(RoleType.Company);
|
||||
|
||||
const query = getPageQuery();
|
||||
getInviteCodeFromQueryAndUpdate(query);
|
||||
|
||||
@ -186,13 +189,13 @@ export default function AnchorPage() {
|
||||
});
|
||||
|
||||
useShareAppMessage(() => {
|
||||
return getCommonShareMessage(true, inviteCode);
|
||||
return getCommonShareMessage({ inviteCode, title: '数万名优质主播等你来挑', path: PageUrl.Anchor });
|
||||
});
|
||||
|
||||
useDidShow(() => requestUnreadMessageCount());
|
||||
|
||||
return (
|
||||
<HomePage>
|
||||
<HomePage type={PageType.Anchor}>
|
||||
{!!loading && <PageLoading className={`${PREFIX}__loading`} />}
|
||||
<CustomNavigationBar className={`${PREFIX}__navigation-bar`}>
|
||||
{selectJob && <SwitchBar title={selectJob.title.substring(0, 4)} onClick={handleClickSwitch} />}
|
||||
|
@ -4,7 +4,7 @@ import { Button } from '@taroify/core';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import HomePage from '@/components/home-page';
|
||||
import { PageUrl } from '@/constants/app';
|
||||
import { PageType, PageUrl } from '@/constants/app';
|
||||
import { copy, logWithPrefix } from '@/utils/common';
|
||||
import { navigateTo } from '@/utils/route';
|
||||
|
||||
@ -136,7 +136,7 @@ export default function DevDebug() {
|
||||
});
|
||||
|
||||
return (
|
||||
<HomePage>
|
||||
<HomePage type={PageType.DEV}>
|
||||
<div className={PREFIX}>
|
||||
{/* <div>{`最近一次的订单 ID: ${lastOrderNo}`}</div>
|
||||
<Button onClick={() => handleCreateOrder(OrderType.Group)} style={marginTopStyle} color="primary">
|
||||
|
3
src/pages/group-delegate-publish/index.config.ts
Normal file
3
src/pages/group-delegate-publish/index.config.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '群代发',
|
||||
});
|
0
src/pages/group-delegate-publish/index.less
Normal file
0
src/pages/group-delegate-publish/index.less
Normal file
12
src/pages/group-delegate-publish/index.tsx
Normal file
12
src/pages/group-delegate-publish/index.tsx
Normal file
@ -0,0 +1,12 @@
|
||||
import UserBatchPublish from '@/components/user-batch-publish';
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'group-delegate-publish';
|
||||
|
||||
export default function Partner() {
|
||||
return (
|
||||
<div className={PREFIX}>
|
||||
<UserBatchPublish />
|
||||
</div>
|
||||
);
|
||||
}
|
@ -4,13 +4,16 @@ import { useCallback } from 'react';
|
||||
|
||||
import HomePage from '@/components/home-page';
|
||||
import SearchCity from '@/components/search-city';
|
||||
import { PageType, PageUrl, RoleType } from '@/constants/app';
|
||||
import { GROUPS } from '@/constants/group';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import { switchRoleType } from '@/utils/app';
|
||||
import { openCustomerServiceChat } from '@/utils/common';
|
||||
import { getCurrentCityCode } from '@/utils/location';
|
||||
import { getInviteCodeFromQueryAndUpdate } from '@/utils/partner';
|
||||
import { getPageQuery } from '@/utils/route';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
import { checkCityCode } from '@/utils/user';
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'group-v2-page';
|
||||
@ -19,13 +22,20 @@ export default function GroupV2() {
|
||||
const inviteCode = useInviteCode();
|
||||
|
||||
useLoad(() => {
|
||||
switchRoleType(RoleType.Anchor);
|
||||
|
||||
const query = getPageQuery();
|
||||
getInviteCodeFromQueryAndUpdate(query);
|
||||
});
|
||||
|
||||
useShareAppMessage(() => getCommonShareMessage(true, inviteCode));
|
||||
useShareAppMessage(() =>
|
||||
getCommonShareMessage({ inviteCode, title: '邀请你加入本地主播求职招聘群', path: PageUrl.GroupV2 })
|
||||
);
|
||||
|
||||
const handleSelectCity = useCallback(cityCode => {
|
||||
if (!checkCityCode(cityCode)) {
|
||||
return;
|
||||
}
|
||||
const group = GROUPS.find(g => String(g.cityCode) === cityCode);
|
||||
if (group) {
|
||||
openCustomerServiceChat(group.serviceUrl);
|
||||
@ -33,14 +43,14 @@ export default function GroupV2() {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<HomePage>
|
||||
<HomePage type={PageType.GroupV2}>
|
||||
<div className={PREFIX}>
|
||||
<SearchCity
|
||||
onSelectCity={handleSelectCity}
|
||||
currentCity={getCurrentCityCode()}
|
||||
forGroup
|
||||
offset={72}
|
||||
banner="点击城市加入本地通告群,高薪工作早知道"
|
||||
banner="点击城市加入本地主播招聘群,高薪职位早知道"
|
||||
/>
|
||||
</div>
|
||||
</HomePage>
|
||||
|
@ -4,6 +4,7 @@ import { Tabs } from '@taroify/core';
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
import HomePage from '@/components/home-page';
|
||||
import { PageType } from '@/constants/app';
|
||||
import { GroupType, GROUP_PAGE_TABS } from '@/constants/group';
|
||||
import GroupFragment from '@/fragments/group';
|
||||
import useNavigation from '@/hooks/use-navigation';
|
||||
@ -22,7 +23,7 @@ export default function Group() {
|
||||
useShareAppMessage(() => getCommonShareMessage());
|
||||
|
||||
return (
|
||||
<HomePage>
|
||||
<HomePage type={PageType.Group}>
|
||||
<Tabs
|
||||
swipeable
|
||||
value={tabType}
|
||||
|
@ -7,14 +7,15 @@ import { CertificationStatusIcon } from '@/components/certification-status';
|
||||
import CommonDialog from '@/components/common-dialog';
|
||||
import DevDiv from '@/components/dev-div';
|
||||
import JobRecommendList from '@/components/job-recommend-list';
|
||||
import { JoinGroupHint } from '@/components/join-group-hint';
|
||||
import LoginButton from '@/components/login-button';
|
||||
import MaterialGuide from '@/components/material-guide';
|
||||
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 { CertificationStatusType } from '@/constants/company';
|
||||
import { CollectEventName, ReportEventId } from '@/constants/event';
|
||||
import { EMPLOY_TYPE_TITLE_MAP } from '@/constants/job';
|
||||
import { EMPLOY_TYPE_TITLE_MAP, GET_CONTACT_TYPE } from '@/constants/job';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import useUserInfo from '@/hooks/use-user-info';
|
||||
import useRoleType from '@/hooks/user-role-type';
|
||||
@ -22,6 +23,7 @@ import { RESPONSE_ERROR_CODE } from '@/http/constant';
|
||||
import { HttpError } from '@/http/error';
|
||||
import { JobDetails } from '@/types/job';
|
||||
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';
|
||||
@ -74,9 +76,12 @@ const AnchorFooter = (props: { data: JobDetails }) => {
|
||||
reportEvent(ReportEventId.CLICK_JOB_CONTACT);
|
||||
try {
|
||||
const needCreateMaterial = await isNeedCreateMaterial();
|
||||
if (needCreateMaterial) {
|
||||
setShowMaterialGuide(true);
|
||||
return;
|
||||
|
||||
if (data.sourcePlat !== 'bl') {
|
||||
if (needCreateMaterial) {
|
||||
setShowMaterialGuide(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (data.isAuthed) {
|
||||
const toUserId = data.userId;
|
||||
@ -84,19 +89,27 @@ const AnchorFooter = (props: { data: JobDetails }) => {
|
||||
Toast.error('不能与自己聊天');
|
||||
return;
|
||||
}
|
||||
const profile = await requestProfileDetail();
|
||||
const chat = await postCreateChat(toUserId);
|
||||
const materialMessage: IMaterialMessage = {
|
||||
id: profile.id,
|
||||
name: profile.name,
|
||||
age: profile.age,
|
||||
height: profile.height,
|
||||
weight: profile.weight,
|
||||
shoeSize: profile.shoeSize,
|
||||
gender: profile.gender,
|
||||
workedSecCategoryStr: profile.workedSecCategoryStr,
|
||||
};
|
||||
navigateTo(PageUrl.MessageChat, { chatId: chat.chatId, material: materialMessage, jobId: data.id });
|
||||
let materialMessage: null | IMaterialMessage = null;
|
||||
if (!needCreateMaterial) {
|
||||
const profile = await requestProfileDetail();
|
||||
materialMessage = {
|
||||
id: profile.id,
|
||||
name: profile.name,
|
||||
age: profile.age,
|
||||
height: profile.height,
|
||||
weight: profile.weight,
|
||||
shoeSize: profile.shoeSize,
|
||||
gender: profile.gender,
|
||||
workedSecCategoryStr: profile.workedSecCategoryStr,
|
||||
};
|
||||
}
|
||||
navigateTo(PageUrl.MessageChat, {
|
||||
chatId: chat.chatId,
|
||||
initText: !materialMessage,
|
||||
material: materialMessage,
|
||||
jobId: data.id,
|
||||
});
|
||||
} else {
|
||||
setDialogVisible(true);
|
||||
}
|
||||
@ -111,8 +124,15 @@ const AnchorFooter = (props: { data: JobDetails }) => {
|
||||
}
|
||||
}, [data]);
|
||||
|
||||
const handleDialogHidden = useCallback(() => setDialogVisible(false), []);
|
||||
|
||||
const handleDialogHidden = useCallback(() => {
|
||||
setDialogVisible(false);
|
||||
}, []);
|
||||
const handleConfirmPrejob = useCallback((type: GET_CONTACT_TYPE) => {
|
||||
setShowMaterialGuide(false);
|
||||
if (GET_CONTACT_TYPE.VIP === type) {
|
||||
setDialogVisible(true);
|
||||
}
|
||||
}, []);
|
||||
return (
|
||||
<>
|
||||
<div className={`${PREFIX}__footer`}>
|
||||
@ -125,7 +145,9 @@ const AnchorFooter = (props: { data: JobDetails }) => {
|
||||
</div>
|
||||
<div>
|
||||
{dialogVisible && <ProductJobDialog data={data} onClose={handleDialogHidden} />}
|
||||
{showMaterialGuide && <MaterialGuide onClose={() => setShowMaterialGuide(false)} />}
|
||||
{showMaterialGuide && (
|
||||
<PrejobPopup onCancel={() => setShowMaterialGuide(false)} onConfirm={handleConfirmPrejob} />
|
||||
)}
|
||||
<CommonDialog
|
||||
content={errorTips}
|
||||
confirm="确定"
|
||||
@ -219,7 +241,11 @@ export default function JobDetail() {
|
||||
}, []);
|
||||
|
||||
useLoad(async () => {
|
||||
const query = getPageQuery<Pick<JobDetails, 'id'> & { c: string }>();
|
||||
const query = getPageQuery<Pick<JobDetails, 'id'> & { c: string; share: string }>();
|
||||
|
||||
if (query?.share === 'true') {
|
||||
switchRoleType(RoleType.Anchor);
|
||||
}
|
||||
getInviteCodeFromQueryAndUpdate(query);
|
||||
const jobId = query?.id;
|
||||
if (!jobId) {
|
||||
@ -236,8 +262,9 @@ export default function JobDetail() {
|
||||
|
||||
useShareAppMessage(() => {
|
||||
if (!data) {
|
||||
return getCommonShareMessage(true, inviteCode);
|
||||
return getCommonShareMessage({ inviteCode });
|
||||
}
|
||||
|
||||
return {
|
||||
title: getJobTitle(data) || '',
|
||||
path: getJumpUrl(PageUrl.JobDetail, { id: data.id, share: true, c: inviteCode }),
|
||||
@ -279,6 +306,8 @@ export default function JobDetail() {
|
||||
{data.companyName && <div className={`${PREFIX}__company`}>{`公司:${data.companyName}`}</div>}
|
||||
</div>
|
||||
|
||||
{!isOwner && <JoinGroupHint />}
|
||||
|
||||
<div className={`${PREFIX}__content`}>
|
||||
<div className={`${PREFIX}__content-title`}>职位描述</div>
|
||||
<div className={`${PREFIX}__tags`}>
|
||||
|
@ -3,16 +3,17 @@ import Taro, { useDidShow, useLoad, useShareAppMessage } from '@tarojs/taro';
|
||||
import { Tabs } from '@taroify/core';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import { AgreementPopup } from '@/components/agreement-popup';
|
||||
import HomePage from '@/components/home-page';
|
||||
import { LoginGuide } from '@/components/login-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 JobFragment from '@/fragments/job/base';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import useLocation from '@/hooks/use-location';
|
||||
import useNavigation from '@/hooks/use-navigation';
|
||||
import { Coordinate } from '@/types/location';
|
||||
import { switchRoleType } from '@/utils/app';
|
||||
import { logWithPrefix } from '@/utils/common';
|
||||
import { getWxLocation, isNotNeedAuthorizeLocation, requestLocation } from '@/utils/location';
|
||||
import { requestUnreadMessageCount } from '@/utils/message';
|
||||
@ -20,8 +21,7 @@ import { getInviteCodeFromQueryAndUpdate } from '@/utils/partner';
|
||||
import { getJumpUrl, getPageQuery, navigateTo } from '@/utils/route';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
import Toast from '@/utils/toast';
|
||||
import { isNeedCreateMaterial } from '@/utils/user';
|
||||
|
||||
import { getAgreementSigned, setAgreementSigned } from '@/utils/user';
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'job';
|
||||
@ -39,9 +39,19 @@ export default function Job() {
|
||||
longitude: location.longitude,
|
||||
});
|
||||
const [showMaterialGuide, setShowMaterialGuide] = useState(false);
|
||||
const [showAuthorize, setShowAuthorize] = useState(false);
|
||||
const cityValuesChangedRef = useRef(false);
|
||||
const [openAgreementPopup, setAgreementPopupOpen] = useState(typeof getAgreementSigned() !== 'boolean');
|
||||
|
||||
const getLocation = async () => {
|
||||
if (await isNotNeedAuthorizeLocation()) {
|
||||
log('not need authorize location');
|
||||
requestLocation();
|
||||
} else {
|
||||
log('show authorize location dialog');
|
||||
// setShowAuthorize(true);
|
||||
requestLocation(true);
|
||||
}
|
||||
};
|
||||
const handleTypeChange = useCallback(value => setTabType(value), []);
|
||||
|
||||
const handleClickCity = useCallback(
|
||||
@ -75,12 +85,19 @@ export default function Job() {
|
||||
setCityCode(code);
|
||||
}, []);
|
||||
|
||||
const handleAfterBindPhone = useCallback(async () => {
|
||||
if (await isNeedCreateMaterial()) {
|
||||
setShowMaterialGuide(true);
|
||||
}
|
||||
}, []);
|
||||
const handleCancelAgreementPopup = () => {
|
||||
setAgreementPopupOpen(false);
|
||||
setAgreementSigned(false);
|
||||
|
||||
getLocation();
|
||||
};
|
||||
|
||||
const handleConfirmAgreementPopup = () => {
|
||||
setAgreementPopupOpen(false);
|
||||
setAgreementSigned(true);
|
||||
|
||||
getLocation();
|
||||
};
|
||||
useEffect(() => {
|
||||
Taro.eventCenter.on(EventName.SELECT_CITY, handleCityChange);
|
||||
return () => {
|
||||
@ -96,19 +113,15 @@ export default function Job() {
|
||||
}, [location]);
|
||||
|
||||
useLoad(async () => {
|
||||
switchRoleType(RoleType.Anchor);
|
||||
const query = getPageQuery<{ sortType: SortType; c?: string; scene?: string }>();
|
||||
const type = query.sortType;
|
||||
if (type === SortType.CREATE_TIME) {
|
||||
setSortType(type);
|
||||
}
|
||||
getInviteCodeFromQueryAndUpdate(query);
|
||||
if (await isNotNeedAuthorizeLocation()) {
|
||||
log('not need authorize location');
|
||||
requestLocation();
|
||||
} else {
|
||||
log('show authorize location dialog');
|
||||
setShowAuthorize(true);
|
||||
requestLocation(true);
|
||||
if (!openAgreementPopup) {
|
||||
getLocation();
|
||||
}
|
||||
});
|
||||
|
||||
@ -121,11 +134,11 @@ export default function Job() {
|
||||
path: getJumpUrl(PageUrl.Job, { sortType, c: inviteCode }),
|
||||
};
|
||||
}
|
||||
return getCommonShareMessage(true, inviteCode);
|
||||
return getCommonShareMessage({ inviteCode, path: PageUrl.Job });
|
||||
});
|
||||
|
||||
return (
|
||||
<HomePage>
|
||||
<HomePage type={PageType.JOB}>
|
||||
<Tabs
|
||||
swipeable
|
||||
value={tabType}
|
||||
@ -147,8 +160,12 @@ export default function Job() {
|
||||
))}
|
||||
</Tabs>
|
||||
<div>
|
||||
<LoginGuide disabled={showAuthorize} onAfterBind={handleAfterBindPhone} />
|
||||
{showMaterialGuide && <MaterialGuide onClose={() => setShowMaterialGuide(false)} />}
|
||||
<AgreementPopup
|
||||
open={openAgreementPopup}
|
||||
onCancel={handleCancelAgreementPopup}
|
||||
onConfirm={handleConfirmAgreementPopup}
|
||||
/>
|
||||
</div>
|
||||
</HomePage>
|
||||
);
|
||||
|
@ -6,7 +6,7 @@ import { useCallback, useEffect, useState } from 'react';
|
||||
import MaterialManagePopup from '@/components/material-manage-popup';
|
||||
import PageLoading from '@/components/page-loading';
|
||||
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
||||
import { EventName } from '@/constants/app';
|
||||
import { EventName, RoleType } from '@/constants/app';
|
||||
import { CollectEventName } from '@/constants/event';
|
||||
import { MaterialStatus } from '@/constants/material';
|
||||
import ProfileViewFragment from '@/fragments/profile/view';
|
||||
@ -17,6 +17,7 @@ import { getCommonShareMessage } from '@/utils/share';
|
||||
import Toast from '@/utils/toast';
|
||||
|
||||
import './index.less';
|
||||
import { switchRoleType } from '@/utils/app';
|
||||
|
||||
const PREFIX = 'page-material-profile';
|
||||
|
||||
@ -70,7 +71,7 @@ export default function MaterialProfilePage() {
|
||||
|
||||
useShareAppMessage(async () => {
|
||||
const shareMessage = await getMaterialShareMessage(profile, false);
|
||||
return shareMessage || getCommonShareMessage(false);
|
||||
return shareMessage || getCommonShareMessage({ useCapture: false });
|
||||
});
|
||||
|
||||
if (!profile) {
|
||||
|
@ -6,7 +6,7 @@ import { useCallback, useEffect, useState } from 'react';
|
||||
import CommonDialog from '@/components/common-dialog';
|
||||
import PageLoading from '@/components/page-loading';
|
||||
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 { MaterialViewSource } from '@/constants/material';
|
||||
import ProfileViewFragment from '@/fragments/profile/view';
|
||||
@ -16,6 +16,7 @@ import { HttpError } from '@/http/error';
|
||||
import { JobManageInfo } from '@/types/job';
|
||||
import { MaterialProfile } from '@/types/material';
|
||||
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';
|
||||
@ -141,6 +142,8 @@ export default function MaterialViewPage() {
|
||||
}, []);
|
||||
|
||||
useLoad(async () => {
|
||||
switchRoleType(RoleType.Company);
|
||||
|
||||
const context = getPageQuery<IViewContext | IShareContext>();
|
||||
getInviteCodeFromQueryAndUpdate(context as BL.Anything);
|
||||
try {
|
||||
|
@ -72,6 +72,7 @@ interface ILoadProps {
|
||||
chatId: string;
|
||||
jobId?: string;
|
||||
job?: string;
|
||||
initText?: boolean;
|
||||
material?: string;
|
||||
}
|
||||
|
||||
@ -90,16 +91,18 @@ export default function MessageChat() {
|
||||
const [input, setInput] = useState('');
|
||||
const [showMore, setShowMore] = useState(false);
|
||||
const [chat, setChat] = useState<IChatInfo | null>(null);
|
||||
const [initText, setInitText] = useState('');
|
||||
const [reject, setReject] = useState<boolean>(false);
|
||||
const [receiver, setReceiver] = useState<IChatUser | null>(null);
|
||||
const [messages, setMessages] = useState<IChatMessage[]>([]);
|
||||
const [messageStatusList, setMessageStatusList] = useState<IMessageStatus[]>([]);
|
||||
const [jobId, setJobId] = useState<string>();
|
||||
const [resumeId, setResumeId] = useState<string>();
|
||||
const [job, setJob] = useState<IJobMessage>();
|
||||
const [material, setMaterial] = useState<IMaterialMessage>();
|
||||
const [scrollItemId, setScrollItemId] = useState<string>();
|
||||
const scrollToLowerRef = useRef(false);
|
||||
const autoSendRef = useRef({ sendJob: false, sendMaterial: false });
|
||||
const autoSendRef = useRef({ sendJob: false, sendMaterial: false, sendText: false });
|
||||
const loadMoreRef = useRef(async (chatId: string, currentMessages: IChatMessage[], forceScroll?: boolean) => {
|
||||
try {
|
||||
const lastMsgId = last(currentMessages)?.msgId;
|
||||
@ -166,6 +169,9 @@ export default function MessageChat() {
|
||||
) {
|
||||
tips = '今日申请交换联系方式次数已用完,当前每日限制为5次';
|
||||
duration = 3000;
|
||||
} else if (errorCode === RESPONSE_ERROR_CODE.CHAT_MSG_SEND_NOT_ALLOW) {
|
||||
tips = '账号已在另一台设备上切换身份,本条消息未发送成功,请在本设备重新切换身份后,再发送消息';
|
||||
duration = 5000;
|
||||
}
|
||||
tips.length > 7 ? Toast.info(tips, duration) : Toast.error(tips, duration);
|
||||
}
|
||||
@ -174,6 +180,7 @@ export default function MessageChat() {
|
||||
);
|
||||
|
||||
const handleClickReject = useCallback(async () => {
|
||||
await postAddMessageTimes('message_chat_page');
|
||||
if (!chat || !receiver || reject) {
|
||||
return;
|
||||
}
|
||||
@ -273,7 +280,11 @@ export default function MessageChat() {
|
||||
}
|
||||
job && handleSendJobMessage();
|
||||
material && handleSendMaterialMessage();
|
||||
}, [chat, job, material, handleSendJobMessage, handleSendMaterialMessage]);
|
||||
if (initText && !autoSendRef.current.sendText) {
|
||||
autoSendRef.current.sendText = true;
|
||||
handleSendMessage({ type: MessageType.Text, content: '你好,想了解下这个岗位' });
|
||||
}
|
||||
}, [chat, job, material, handleSendJobMessage, handleSendMaterialMessage, initText, handleSendMessage]);
|
||||
|
||||
useLoad(async () => {
|
||||
const query = getPageQuery<ILoadProps>();
|
||||
@ -298,11 +309,15 @@ export default function MessageChat() {
|
||||
const parseMaterial = query.material ? parseQuery<IMaterialMessage>(query.material) : null;
|
||||
// log('requestChatDetail', chatDetail, parseJob, parseMaterial);
|
||||
setChat(chatDetail);
|
||||
setResumeId(chatDetail.participants.find(u => u.userId !== currentUserId)?.resumeId);
|
||||
setJobId(query.jobId);
|
||||
setMessages(chatDetail.messages);
|
||||
setScrollItemId(getScrollItemId(last(chatDetail.messages)?.msgId));
|
||||
parseJob && setJob(parseJob);
|
||||
parseMaterial && setMaterial(parseMaterial);
|
||||
if (!parseMaterial && query.initText && watchType === ChatWatchType.AnchorReject) {
|
||||
setInitText('你好,想了解下这个岗位');
|
||||
}
|
||||
Taro.setNavigationBarTitle({ title: toUserInfo.nickName });
|
||||
setReceiver(toUserInfo);
|
||||
setReject(!watchStatus);
|
||||
@ -353,6 +368,7 @@ export default function MessageChat() {
|
||||
id={message.msgId}
|
||||
key={message.msgId}
|
||||
message={message}
|
||||
resumeId={resumeId}
|
||||
isRead={messageStatusList.some(m => m.msgId === message.msgId && !!m.isRead)}
|
||||
/>
|
||||
);
|
||||
|
@ -7,8 +7,9 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import HomePage from '@/components/home-page';
|
||||
import MessageCard from '@/components/message-card';
|
||||
import { MessageHelpDialog, MessageNoTimesDialog } from '@/components/message-dialog';
|
||||
import { APP_TAB_BAR_ID, EventName } from '@/constants/app';
|
||||
import { APP_TAB_BAR_ID, EventName, PageType } from '@/constants/app';
|
||||
import { REFRESH_CHAT_LIST_TIME } from '@/constants/message';
|
||||
import { MessageSubscribeIds, SubscribeTempId } from '@/constants/subscribe';
|
||||
import useListHeight, { IUseListHeightProps } from '@/hooks/use-list-height';
|
||||
import useRoleType from '@/hooks/user-role-type';
|
||||
import { MainMessage } from '@/types/message';
|
||||
@ -20,7 +21,10 @@ import {
|
||||
requestUnreadMessageCount,
|
||||
} from '@/utils/message';
|
||||
|
||||
import { isSubscribeRefused, postSubscribe } from '@/utils/subscribe';
|
||||
import './index.less';
|
||||
import { collectEvent } from '@/utils/event';
|
||||
import { CollectEventName } from '@/constants/event';
|
||||
|
||||
const PREFIX = 'page-message';
|
||||
const HEADER_CLASS = `${PREFIX}__header`;
|
||||
@ -58,12 +62,52 @@ export default function Message() {
|
||||
|
||||
const handleClickHelp = useCallback(() => setShowHelp(true), []);
|
||||
|
||||
const handleClickAddMessageTimes = useCallback(async () => {
|
||||
const addMessageTimes = useCallback(async () => {
|
||||
await postAddMessageTimes('message_page');
|
||||
const remain = await requestRemainPushTime();
|
||||
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));
|
||||
|
||||
useDidShow(() => {
|
||||
@ -101,7 +145,7 @@ export default function Message() {
|
||||
}, [roleType]);
|
||||
|
||||
return (
|
||||
<HomePage>
|
||||
<HomePage type={PageType.Message}>
|
||||
<div className={PREFIX}>
|
||||
<div className={HEADER_CLASS}>
|
||||
<div className={`${HEADER_CLASS}__times`}>
|
||||
|
@ -1,33 +1,36 @@
|
||||
import { useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import { Tabs } from '@taroify/core';
|
||||
import { useState } from 'react';
|
||||
|
||||
import PartnerIntro from '@/components/partner-intro';
|
||||
import PartnerInviteList from '@/components/partner-invite-list';
|
||||
import PartnerProfit from '@/components/partner-profit';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'partner';
|
||||
|
||||
export default function Partner() {
|
||||
const inviteCode = useInviteCode();
|
||||
|
||||
const [tab, setTab] = useState<number>(0);
|
||||
const handleChange = v => {
|
||||
setTab(v);
|
||||
};
|
||||
useShareAppMessage(() => {
|
||||
console.log('Partner inviteCode', inviteCode);
|
||||
return getCommonShareMessage(false, inviteCode);
|
||||
return getCommonShareMessage({ useCapture: false, inviteCode });
|
||||
});
|
||||
|
||||
return (
|
||||
<div className={PREFIX}>
|
||||
<Tabs className={`${PREFIX}__tabs`}>
|
||||
<Tabs className={`${PREFIX}__tabs`} value={tab} onChange={handleChange}>
|
||||
<Tabs.TabPane value={0} title="简介">
|
||||
<PartnerIntro />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane value={1} title="邀请名单">
|
||||
<PartnerInviteList />
|
||||
<PartnerInviteList refreshDisabled={tab !== 1} visible={tab === 1} />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane value={2} title="我的收益">
|
||||
<PartnerProfit />
|
||||
|
@ -1,88 +1,94 @@
|
||||
import { Image } from '@tarojs/components';
|
||||
import { useLoad } from '@tarojs/taro';
|
||||
|
||||
import { useState } from 'react';
|
||||
|
||||
import { AgreementPopup } from '@/components/agreement-popup';
|
||||
import Slogan from '@/components/slogan';
|
||||
import { PageUrl, RoleType } from '@/constants/app';
|
||||
import { ANCHOR_TAB_LIST, COMPANY_TAB_LIST } from '@/hooks/use-config';
|
||||
import store from '@/store';
|
||||
import { changeHomePage } from '@/store/actions';
|
||||
// import { useEffect, useState } from 'react';
|
||||
// import { AgreementPopup } from '@/components/agreement-popup';
|
||||
// import Slogan from '@/components/slogan';
|
||||
// import { PageUrl, RoleType } from '@/constants/app';
|
||||
// import { ANCHOR_TAB_LIST, COMPANY_TAB_LIST } from '@/hooks/use-config';
|
||||
// import store from '@/store';
|
||||
// import { changeHomePage } from '@/store/actions';
|
||||
import { RoleType } from '@/constants/app';
|
||||
import { getRoleType, switchDefaultTab, switchRoleType } from '@/utils/app';
|
||||
import { switchTab } from '@/utils/route';
|
||||
import { getAgreementSigned, setAgreementSigned } from '@/utils/user';
|
||||
// import { switchTab } from '@/utils/route';
|
||||
// import { getAgreementSigned, setAgreementSigned } from '@/utils/user';
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'page-start';
|
||||
|
||||
export default function Start() {
|
||||
const [open, setOpen] = useState(typeof getAgreementSigned() !== 'boolean');
|
||||
// const [open, setOpen] = useState(typeof getAgreementSigned() !== 'boolean');
|
||||
const mode = getRoleType();
|
||||
useLoad(() => {
|
||||
switchDefaultTab();
|
||||
if (!mode) {
|
||||
switchRoleType(RoleType.Anchor).then(() => {
|
||||
switchDefaultTab();
|
||||
});
|
||||
} else {
|
||||
switchDefaultTab();
|
||||
}
|
||||
});
|
||||
const handleAnchor = async () => {
|
||||
await switchRoleType(RoleType.Anchor);
|
||||
store.dispatch(changeHomePage(ANCHOR_TAB_LIST[0].type));
|
||||
await switchTab(ANCHOR_TAB_LIST[0].pagePath as PageUrl);
|
||||
};
|
||||
// const handleAnchor = async () => {
|
||||
// await switchRoleType(RoleType.Anchor);
|
||||
// store.dispatch(changeHomePage(ANCHOR_TAB_LIST[0].type));
|
||||
// await switchTab(ANCHOR_TAB_LIST[0].pagePath as PageUrl);
|
||||
// };
|
||||
|
||||
const handleCompany = async () => {
|
||||
await switchRoleType(RoleType.Company);
|
||||
store.dispatch(changeHomePage(COMPANY_TAB_LIST[0].type));
|
||||
await switchTab(COMPANY_TAB_LIST[0].pagePath as PageUrl);
|
||||
};
|
||||
// const handleCompany = async () => {
|
||||
// await switchRoleType(RoleType.Company);
|
||||
// store.dispatch(changeHomePage(COMPANY_TAB_LIST[0].type));
|
||||
// await switchTab(COMPANY_TAB_LIST[0].pagePath as PageUrl);
|
||||
// };
|
||||
|
||||
const handleCancel = () => {
|
||||
setOpen(false);
|
||||
setAgreementSigned(false);
|
||||
};
|
||||
|
||||
const handleConfirm = () => {
|
||||
setOpen(false);
|
||||
setAgreementSigned(true);
|
||||
};
|
||||
// const handleCancel = () => {
|
||||
// setOpen(false);
|
||||
// setAgreementSigned(false);
|
||||
// };
|
||||
//
|
||||
// const handleConfirm = () => {
|
||||
// setOpen(false);
|
||||
// setAgreementSigned(true);
|
||||
// };
|
||||
return (
|
||||
<div className={`${PREFIX} ${mode ? '' : 'color-bg'}`}>
|
||||
{mode && (
|
||||
<div className={`${PREFIX}__app`}>
|
||||
<Image className={`${PREFIX}__icon`} mode="aspectFit" src={require('@/statics/svg/slogan.svg')} />
|
||||
<div className={`${PREFIX}__text`}>每天推荐海量高薪通告 </div>
|
||||
</div>
|
||||
)}
|
||||
<div className={`${PREFIX}`}>
|
||||
{/*{mode && (*/}
|
||||
<div className={`${PREFIX}__app`}>
|
||||
<Image className={`${PREFIX}__icon`} mode="aspectFit" src={require('@/statics/svg/slogan.svg')} />
|
||||
<div className={`${PREFIX}__text`}>每天推荐海量高薪通告 </div>
|
||||
</div>
|
||||
{/*)}*/}
|
||||
{!mode && (
|
||||
<>
|
||||
<div className={`${PREFIX}__role-app`}>
|
||||
<div className={`${PREFIX}__greet`}>Hi,很高兴见到你</div>
|
||||
<div className={`${PREFIX}__title`}>请选择您的身份</div>
|
||||
<div className={`${PREFIX}__card`} onClick={handleAnchor}>
|
||||
<Image
|
||||
className={`${PREFIX}__avatar anchor`}
|
||||
src="https://publiccdn.neighbourhood.com.cn/img/avatar_f.png"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<div className={`${PREFIX}__content`}>
|
||||
<div className="title">我是主播</div>
|
||||
<div className="desc">我要找工作</div>
|
||||
</div>
|
||||
<Image src={require('@/statics/svg/arrow-right.svg')} mode="aspectFill" className={`${PREFIX}__arrow`} />
|
||||
</div>
|
||||
<div className={`${PREFIX}__card`} onClick={handleCompany}>
|
||||
<Image
|
||||
className={`${PREFIX}__avatar company`}
|
||||
src="https://publiccdn.neighbourhood.com.cn/img/avatar_m.png"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<div className={`${PREFIX}__content`}>
|
||||
<div className="title">我是企业</div>
|
||||
<div className="desc">我要招主播</div>
|
||||
</div>
|
||||
<Image src={require('@/statics/svg/arrow-right.svg')} mode="aspectFill" className={`${PREFIX}__arrow`} />
|
||||
</div>
|
||||
</div>
|
||||
<Slogan />
|
||||
<AgreementPopup open={open} onCancel={handleCancel} onConfirm={handleConfirm} />
|
||||
{/*<div className={`${PREFIX}__role-app`}>*/}
|
||||
{/* <div className={`${PREFIX}__greet`}>Hi,很高兴见到你</div>*/}
|
||||
{/* <div className={`${PREFIX}__title`}>请选择您的身份</div>*/}
|
||||
{/* <div className={`${PREFIX}__card`} onClick={handleAnchor}>*/}
|
||||
{/* <Image*/}
|
||||
{/* className={`${PREFIX}__avatar anchor`}*/}
|
||||
{/* src="https://publiccdn.neighbourhood.com.cn/img/avatar_f.png"*/}
|
||||
{/* mode="aspectFill"*/}
|
||||
{/* />*/}
|
||||
{/* <div className={`${PREFIX}__content`}>*/}
|
||||
{/* <div className="title">我是主播</div>*/}
|
||||
{/* <div className="desc">我要找工作</div>*/}
|
||||
{/* </div>*/}
|
||||
{/* <Image src={require('@/statics/svg/arrow-right.svg')} mode="aspectFill" className={`${PREFIX}__arrow`} />*/}
|
||||
{/* </div>*/}
|
||||
{/* <div className={`${PREFIX}__card`} onClick={handleCompany}>*/}
|
||||
{/* <Image*/}
|
||||
{/* className={`${PREFIX}__avatar company`}*/}
|
||||
{/* src="https://publiccdn.neighbourhood.com.cn/img/avatar_m.png"*/}
|
||||
{/* mode="aspectFill"*/}
|
||||
{/* />*/}
|
||||
{/* <div className={`${PREFIX}__content`}>*/}
|
||||
{/* <div className="title">我是企业</div>*/}
|
||||
{/* <div className="desc">我要招主播</div>*/}
|
||||
{/* </div>*/}
|
||||
{/* <Image src={require('@/statics/svg/arrow-right.svg')} mode="aspectFill" className={`${PREFIX}__arrow`} />*/}
|
||||
{/* </div>*/}
|
||||
{/*</div>*/}
|
||||
{/*<Slogan />*/}
|
||||
{/*<AgreementPopup open={open} onCancel={handleCancel} onConfirm={handleConfirm} />*/}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
@ -20,6 +20,81 @@
|
||||
> .taroify-tabs__content {
|
||||
padding-top: var(--tabs-wrap-height);
|
||||
}
|
||||
|
||||
//.taroify-tabs__nav .taroify-tabs__tab:nth-child(2) .taroify-badge-wrapper {
|
||||
// left: 18px;
|
||||
//}
|
||||
}
|
||||
|
||||
&__star {
|
||||
width: 33px;
|
||||
height: 38px;
|
||||
}
|
||||
&__header-image {
|
||||
width: 100%;
|
||||
height: 120px;
|
||||
}
|
||||
&__delegate {
|
||||
& {
|
||||
padding: 24px;
|
||||
padding-bottom: calc(120px + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
&-fix {
|
||||
width: 100%;
|
||||
background: #f5f6fa;
|
||||
padding-left: 24px;
|
||||
padding-right: 24px;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 110px;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: calc(24px + env(safe-area-inset-bottom));
|
||||
}
|
||||
&-image {
|
||||
width: 100%;
|
||||
height: 298px;
|
||||
}
|
||||
&-card {
|
||||
background: #fff;
|
||||
padding: 24px;
|
||||
border-radius: 24px;
|
||||
&.image {
|
||||
padding: 1px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
&-h5 {
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-size: 28px;
|
||||
line-height: 32px;
|
||||
color: @blColor;
|
||||
padding-top: 40px;
|
||||
padding-bottom: 24px;
|
||||
|
||||
&:first-child {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
&-body {
|
||||
font-weight: 400;
|
||||
font-size: 28px;
|
||||
line-height: 48px;
|
||||
color: @blColorG2;
|
||||
&.link {
|
||||
margin-top: 16px;
|
||||
color: @blHighlightColor;
|
||||
}
|
||||
}
|
||||
&-btn {
|
||||
.button(@width: 100%; @height: 80px; @fontSize: 32px);
|
||||
margin-top: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
&__recruitment {
|
||||
|
@ -1,39 +1,115 @@
|
||||
import { useShareAppMessage } from '@tarojs/taro';
|
||||
import { Image } from '@tarojs/components';
|
||||
import Taro, { useLoad, useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import { Button, Tabs } from '@taroify/core';
|
||||
import { useCallback } from 'react';
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
import HomePage from '@/components/home-page';
|
||||
import SearchCity from '@/components/search-city';
|
||||
import UserBatchPublish from '@/components/user-batch-publish';
|
||||
import { PageType, PageUrl, RoleType } from '@/constants/app';
|
||||
import { GROUPS } from '@/constants/group';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import { switchRoleType } from '@/utils/app';
|
||||
import { openCustomerServiceChat } from '@/utils/common';
|
||||
import { getCurrentCityCode } from '@/utils/location';
|
||||
import { getPageQuery, navigateTo } from '@/utils/route';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
import { checkCityCode } from '@/utils/user';
|
||||
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'page-biz-service';
|
||||
|
||||
const EXAMPLE_IMAGE = 'https://publiccdn.neighbourhood.com.cn/img/delegate-example.png';
|
||||
const COMMENT_IMAGE = 'https://publiccdn.neighbourhood.com.cn/img/delegate-comments.png';
|
||||
export default function BizService() {
|
||||
const inviteCode = useInviteCode();
|
||||
const [value, setValue] = useState('0');
|
||||
|
||||
const handleClickDelegate = useCallback(() => {
|
||||
navigateTo(PageUrl.GroupDelegatePublish);
|
||||
}, []);
|
||||
const handlePreview = (current: string) => {
|
||||
Taro.previewImage({
|
||||
current,
|
||||
urls: [EXAMPLE_IMAGE, COMMENT_IMAGE],
|
||||
});
|
||||
};
|
||||
const handleOpenService = useCallback(() => {
|
||||
openCustomerServiceChat('https://work.weixin.qq.com/kfid/kfcd60708731367168d');
|
||||
}, []);
|
||||
const handleSelectCity = useCallback(cityCode => {
|
||||
if (!checkCityCode(cityCode)) {
|
||||
return;
|
||||
}
|
||||
const group = GROUPS.find(g => String(g.cityCode) === cityCode);
|
||||
if (group) {
|
||||
openCustomerServiceChat(group.serviceUrl);
|
||||
}
|
||||
}, []);
|
||||
useShareAppMessage(() => getCommonShareMessage(true, 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 (
|
||||
<HomePage>
|
||||
<HomePage type={PageType.BatchPublish}>
|
||||
<div className={PREFIX}>
|
||||
<Tabs className={`${PREFIX}__tabs`} defaultValue={0}>
|
||||
<Tabs.TabPane value={0} title="主播群">
|
||||
<Tabs className={`${PREFIX}__tabs`} value={value} onChange={handleChange}>
|
||||
<Tabs.TabPane value="0" title="群代发">
|
||||
<div className={`${PREFIX}__delegate`}>
|
||||
<Image
|
||||
mode="widthFix"
|
||||
className={`${PREFIX}__header-image`}
|
||||
src="https://publiccdn.neighbourhood.com.cn/img/pub-job.png"
|
||||
/>
|
||||
<div className={`${PREFIX}__delegate-h5`}>服务说明</div>
|
||||
<div className={`${PREFIX}__delegate-card`}>
|
||||
<div className={`${PREFIX}__delegate-body`}>服务方式:帮您把招聘需求发到众多同城合作主播群</div>
|
||||
<div className={`${PREFIX}__delegate-body`}>群发次数:每日1次,连发3天</div>
|
||||
<div className={`${PREFIX}__delegate-body`}>内容要求:仅限带货主播招聘需求,其他不发</div>
|
||||
<div className={`${PREFIX}__delegate-body`}>主播联系:内容中留招聘方联系方式,主播直接联系</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__delegate-h5`}>代发示例</div>
|
||||
<div className={`${PREFIX}__delegate-card image`} onClick={() => handlePreview(EXAMPLE_IMAGE)}>
|
||||
<Image className={`${PREFIX}__delegate-image`} src={EXAMPLE_IMAGE} mode="heightFix" />
|
||||
</div>
|
||||
<div className={`${PREFIX}__delegate-h5`}>部分客户评价</div>
|
||||
<div className={`${PREFIX}__delegate-card image`} onClick={() => handlePreview(COMMENT_IMAGE)}>
|
||||
<Image className={`${PREFIX}__delegate-image`} src={COMMENT_IMAGE} mode="heightFix" />
|
||||
</div>
|
||||
<div className={`${PREFIX}__delegate-fix`}>
|
||||
<Button className={`${PREFIX}__delegate-btn`} onClick={handleClickDelegate}>
|
||||
我要代发
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane
|
||||
value="1"
|
||||
title={
|
||||
<>
|
||||
主播群
|
||||
{/*<Image src={require('@/statics/svg/star.svg')} className={`${PREFIX}__star`} />*/}
|
||||
</>
|
||||
}
|
||||
>
|
||||
<SearchCity
|
||||
onSelectCity={handleSelectCity}
|
||||
currentCity={getCurrentCityCode()}
|
||||
@ -42,10 +118,7 @@ export default function BizService() {
|
||||
banner="点击城市名称,进本地通告群,免费招主播"
|
||||
/>
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane value={1} title="群代发">
|
||||
<UserBatchPublish />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane value={2} title="代招">
|
||||
<Tabs.TabPane value="2" title="代招">
|
||||
<div className={`${PREFIX}__recruitment`}>
|
||||
<div className={`${PREFIX}__recruitment-card`}>
|
||||
<div className={`${PREFIX}__recruitment-h5`}>服务城市</div>
|
||||
|
@ -9,7 +9,7 @@ import LoginButton from '@/components/login-button';
|
||||
import PartnerEntry from '@/components/partner-entry';
|
||||
import Slogan from '@/components/slogan';
|
||||
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 CompanyFragment from '@/fragments/user/company';
|
||||
import useUserInfo from '@/hooks/use-user-info';
|
||||
@ -38,10 +38,10 @@ export default function User() {
|
||||
[]
|
||||
);
|
||||
|
||||
useShareAppMessage(() => getCommonShareMessage(false));
|
||||
useShareAppMessage(() => getCommonShareMessage({ useCapture: false }));
|
||||
|
||||
return (
|
||||
<HomePage>
|
||||
<HomePage type={PageType.User}>
|
||||
<CustomNavigationBar className={`${PREFIX}__navigation-bar`}>
|
||||
<SwitchBar title={roleType === RoleType.Anchor ? '切换为企业' : '切换为主播'} onClick={handleSwitchRoleType} />
|
||||
</CustomNavigationBar>
|
||||
|
@ -2,4 +2,52 @@
|
||||
@import '@/styles/variables.less';
|
||||
|
||||
.withdraw-record {
|
||||
&__item {
|
||||
height: 131px;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
padding: 24px 32px 0 32px;
|
||||
box-sizing: border-box;
|
||||
font-size: 28px;
|
||||
|
||||
&-border {
|
||||
border-bottom: 1px solid #e6e7e8;
|
||||
}
|
||||
|
||||
&-content {
|
||||
.flex-row();
|
||||
width: 100%;
|
||||
padding-bottom: 24px;
|
||||
}
|
||||
|
||||
&-time {
|
||||
padding-right: 8px;
|
||||
line-height: 40px;
|
||||
flex: 1;
|
||||
.noWrap();
|
||||
}
|
||||
|
||||
&-withdraw {
|
||||
width: 200px;
|
||||
text-align: right;
|
||||
padding-left: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
&-money {
|
||||
line-height: 40px;
|
||||
padding-bottom: 8px;
|
||||
.noWrap();
|
||||
font-weight: 600;
|
||||
font-size: 30px;
|
||||
color: #ff5051;
|
||||
}
|
||||
|
||||
&-status {
|
||||
font-size: 24px;
|
||||
line-height: 36px;
|
||||
color: #999999;
|
||||
.noWrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,119 @@
|
||||
import { useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import { List, PullRefresh } from '@taroify/core';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import ListPlaceholder from '@/components/list-placeholder';
|
||||
import { WithdrawStatusDescriptions } from '@/constants/partner';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import { WithdrawRecord } from '@/types/partner';
|
||||
import { logWithPrefix } from '@/utils/common';
|
||||
import { formatMoney, formatTimestamp, getWithdrawList as requestData } from '@/utils/partner';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'withdraw-record';
|
||||
const log = logWithPrefix(PREFIX);
|
||||
const FIRST_PAGE = 0;
|
||||
|
||||
export default function WithdrawRecord() {
|
||||
export default function WithdrawRecords() {
|
||||
const inviteCode = useInviteCode();
|
||||
const [hasMore, setHasMore] = useState(true);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
const [loadingMore, setLoadingMore] = useState(false);
|
||||
const [loadMoreError, setLoadMoreError] = useState(false);
|
||||
const [dataList, setDataList] = useState<WithdrawRecord[]>([]);
|
||||
const currentPage = useRef<number>(FIRST_PAGE);
|
||||
|
||||
const handleRefresh = useCallback(async () => {
|
||||
log('start pull refresh');
|
||||
try {
|
||||
setRefreshing(true);
|
||||
setLoadMoreError(false);
|
||||
const { content, totalPages } = await requestData({ page: 1 });
|
||||
setDataList(content);
|
||||
currentPage.current = 1;
|
||||
setHasMore(currentPage.current < totalPages);
|
||||
log('pull refresh success');
|
||||
} catch (e) {
|
||||
setDataList([]);
|
||||
setHasMore(false);
|
||||
setLoadMoreError(true);
|
||||
currentPage.current = FIRST_PAGE;
|
||||
log('pull refresh failed');
|
||||
} finally {
|
||||
setRefreshing(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleLoadMore = useCallback(async () => {
|
||||
log('start load more', hasMore);
|
||||
if (!hasMore) {
|
||||
return;
|
||||
}
|
||||
setLoadMoreError(false);
|
||||
setLoadingMore(true);
|
||||
try {
|
||||
const { totalPages, content } = await requestData({ page: currentPage.current + 1 });
|
||||
setDataList([...dataList, ...content]);
|
||||
currentPage.current = currentPage.current + 1;
|
||||
setHasMore(currentPage.current < totalPages);
|
||||
log('load more success');
|
||||
} catch (e) {
|
||||
setLoadMoreError(true);
|
||||
log('load more failed');
|
||||
} finally {
|
||||
setLoadingMore(false);
|
||||
}
|
||||
}, [dataList, hasMore]);
|
||||
// 初始化数据&配置变更后刷新数据
|
||||
useEffect(() => {
|
||||
const refresh = async () => {
|
||||
log('visible changed, start refresh list data');
|
||||
try {
|
||||
setDataList([]);
|
||||
setLoadingMore(true);
|
||||
setLoadMoreError(false);
|
||||
const { totalPages, content } = await requestData({ page: 1 });
|
||||
setDataList(content);
|
||||
currentPage.current = 1;
|
||||
setHasMore(currentPage.current < totalPages);
|
||||
} catch (e) {
|
||||
setDataList([]);
|
||||
setHasMore(false);
|
||||
setLoadMoreError(true);
|
||||
} finally {
|
||||
log('visible changed, refresh list data end');
|
||||
setLoadingMore(false);
|
||||
}
|
||||
};
|
||||
refresh();
|
||||
}, []);
|
||||
useShareAppMessage(() => {
|
||||
return getCommonShareMessage(false);
|
||||
return getCommonShareMessage({ useCapture: false, inviteCode });
|
||||
});
|
||||
|
||||
return <div className={PREFIX}></div>;
|
||||
return (
|
||||
<div className={PREFIX}>
|
||||
<PullRefresh className={`${PREFIX}__pull-refresh`} loading={refreshing} onRefresh={handleRefresh}>
|
||||
<List hasMore={hasMore} onLoad={handleLoadMore} loading={loadingMore || refreshing} disabled={loadMoreError}>
|
||||
{dataList.map(item => (
|
||||
<div className={`${PREFIX}__item`} key={item.id || item.userId}>
|
||||
<div className={`${PREFIX}__item-border`}>
|
||||
<div className={`${PREFIX}__item-content`}>
|
||||
<div className={`${PREFIX}__item-time`}>{formatTimestamp(item.created)}</div>
|
||||
<div className={`${PREFIX}__item-withdraw`}>
|
||||
<div className={`${PREFIX}__item-money`}>{formatMoney(item.amt)}</div>
|
||||
<div className={`${PREFIX}__item-status`}>{WithdrawStatusDescriptions[item.status]}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<ListPlaceholder hasMore={false} loadingMore={loadingMore} loadMoreError={loadMoreError} />
|
||||
</List>
|
||||
</PullRefresh>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
4
src/statics/svg/star.svg
Normal file
4
src/statics/svg/star.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<svg width="33" height="36" viewBox="0 0 33 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8.57143 8.57143L12 0L15.4286 8.57143L24 12L15.4286 15.4286L12 24L8.57143 15.4286L0 12L8.57143 8.57143Z" fill="#FF5051"/>
|
||||
<path opacity="0.24" d="M24.6429 27.6429L26.5 23L28.3571 27.6429L33 29.5L28.3571 31.3571L26.5 36L24.6429 31.3571L20 29.5L24.6429 27.6429Z" fill="#FF5051"/>
|
||||
</svg>
|
After Width: | Height: | Size: 390 B |
@ -49,6 +49,7 @@ export type JobDetails = JobInfo &
|
||||
declarationType: DeclarationType; // 报单类型
|
||||
userId: string; // 发布人的 userId
|
||||
verifyFailReason?: string; // 审核不通过的原因
|
||||
sourcePlat?: string;
|
||||
};
|
||||
|
||||
export interface JobManageInfo {
|
||||
|
@ -43,7 +43,9 @@ export interface ILocationMessage {
|
||||
longitude: number;
|
||||
}
|
||||
|
||||
export interface IChatUser extends Pick<UserInfo, 'userId' | 'nickName'> {}
|
||||
export interface IChatUser extends Pick<UserInfo, 'userId' | 'nickName'> {
|
||||
resumeId: string;
|
||||
}
|
||||
|
||||
export interface IChatMessage {
|
||||
msgId: string;
|
||||
|
@ -64,3 +64,26 @@ export interface PartnerProfitItem {
|
||||
expectedSettlementDate: string;
|
||||
actualSettlementDate: string;
|
||||
}
|
||||
export interface WithdrawResponse {
|
||||
outBillNo: string;
|
||||
transferBillNo: string;
|
||||
createTime: string;
|
||||
state: string;
|
||||
packageInfo: string;
|
||||
}
|
||||
export interface WithdrawRecord {
|
||||
id: number;
|
||||
userId: string;
|
||||
orderNo: string;
|
||||
outTradeId: string;
|
||||
amt: number;
|
||||
status: number;
|
||||
remark: string;
|
||||
created: string;
|
||||
updated: string;
|
||||
finishedTime: string;
|
||||
}
|
||||
export interface PartnerPagination<T> {
|
||||
content: T[];
|
||||
totalPages: number;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ export interface ProductInfo {
|
||||
balance: number;
|
||||
created: number;
|
||||
updated: number;
|
||||
isPaidVip?: boolean;
|
||||
// 报单类型信息,只有 use 接口返回值才有
|
||||
declarationTypeResult?: DeclarationTypeResult;
|
||||
}
|
||||
|
@ -37,10 +37,19 @@ export const switchDefaultTab = async () => {
|
||||
};
|
||||
|
||||
export const switchRoleType = async (appMode?: RoleType) => {
|
||||
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) {
|
||||
const curMode = getRoleType();
|
||||
console.log('[utils:app] no app mode from arguments');
|
||||
appMode = curMode === RoleType.Anchor ? RoleType.Company : RoleType.Anchor;
|
||||
}
|
||||
|
||||
console.log('[utils:app] switchRoleType', appMode);
|
||||
try {
|
||||
await postSwitchRoleType(appMode);
|
||||
store.dispatch(changeRoleType(appMode));
|
||||
|
@ -4,12 +4,12 @@ export const isDev = () => process.env.NODE_ENV === 'development';
|
||||
// export const isDev = () => true;
|
||||
|
||||
export const isIPhone = (() => {
|
||||
const info = Taro.getSystemInfoSync();
|
||||
const info = Taro.getDeviceInfo();
|
||||
return info.platform === 'ios';
|
||||
})();
|
||||
|
||||
export const isDesktop = (() => {
|
||||
const info = Taro.getSystemInfoSync();
|
||||
const info = Taro.getDeviceInfo();
|
||||
return info.platform === 'windows' || info.platform === 'mac';
|
||||
})();
|
||||
|
||||
|
@ -8,20 +8,20 @@ import { API } from '@/http/api';
|
||||
import store from '@/store';
|
||||
import { selectLocation } from '@/store/selector';
|
||||
import {
|
||||
JobDetails,
|
||||
CreateJobInfo,
|
||||
GetJobManagesRequest,
|
||||
GetJobManagesResponse,
|
||||
GetJobsDetailsRequest,
|
||||
GetJobsRequest,
|
||||
GetJobsResponse,
|
||||
JobInfo,
|
||||
GetMyRecommendJobRequest,
|
||||
GetUserJobRequest,
|
||||
GetUserJobResponse,
|
||||
MyDeclaredJobInfo,
|
||||
MyBrowsedJobInfo,
|
||||
GetMyRecommendJobRequest,
|
||||
GetJobManagesRequest,
|
||||
GetJobManagesResponse,
|
||||
CreateJobInfo,
|
||||
JobDetails,
|
||||
JobInfo,
|
||||
JobManageInfo,
|
||||
MyBrowsedJobInfo,
|
||||
MyDeclaredJobInfo,
|
||||
} from '@/types/job';
|
||||
import { collectEvent } from '@/utils/event';
|
||||
import { getCityValues } from '@/utils/location';
|
||||
|
@ -101,6 +101,7 @@ export const postAddMessageTimes = async (source: string) => {
|
||||
await postSubscribe(MessageSubscribeIds, successIds);
|
||||
};
|
||||
|
||||
|
||||
export const postCreateChat = (toUserId: string) => {
|
||||
return http.post<IChatInfo>(API.MESSAGE_CREATE_CHAT, { data: { toUserId } });
|
||||
};
|
||||
|
@ -10,8 +10,11 @@ import {
|
||||
GetProfitRequest,
|
||||
InviteUserInfo,
|
||||
PartnerInviteCode,
|
||||
PartnerPagination,
|
||||
PartnerProfitItem,
|
||||
PartnerProfitsState,
|
||||
WithdrawRecord,
|
||||
WithdrawResponse,
|
||||
} from '@/types/partner';
|
||||
import { requestUserInfo } from '@/utils/user';
|
||||
|
||||
@ -53,7 +56,7 @@ export const getPartnerProfitStat = async () => {
|
||||
return await http.post<PartnerProfitsState>(API.GET_PROFIT_STAT);
|
||||
};
|
||||
export const getPartnerInviteList = async (data: IPaginationRequest) => {
|
||||
return await http.post<{ content: InviteUserInfo[]; totalPages: number }>(API.GET_INVITE_LIST, {
|
||||
return await http.post<PartnerPagination<InviteUserInfo>>(API.GET_INVITE_LIST, {
|
||||
data,
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
});
|
||||
@ -113,3 +116,14 @@ export function formatUserId(input: string): string {
|
||||
// 拼接结果
|
||||
return beforeMask + maskedPart + afterMask;
|
||||
}
|
||||
|
||||
export async function withdrawMoney() {
|
||||
return await http.post<WithdrawResponse>(API.WITHDRAW);
|
||||
}
|
||||
|
||||
export async function getWithdrawList(data: IPaginationRequest) {
|
||||
return await http.post<PartnerPagination<WithdrawRecord>>(API.GET_WITHDRAW_LIST, {
|
||||
data,
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
});
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import Taro from '@tarojs/taro';
|
||||
|
||||
import { ProductType, QrCodeType } from '@/constants/product';
|
||||
import http from '@/http';
|
||||
import { API, DOMAIN } from '@/http/api';
|
||||
import { API } from '@/http/api';
|
||||
import {
|
||||
ProductInfo,
|
||||
GetProductDetailRequest,
|
||||
@ -54,13 +54,13 @@ export async function requestUseProduct(
|
||||
}
|
||||
|
||||
// 获取某个产品的剩余解锁次数
|
||||
export async function requestProductBalance(productCode: ProductType) {
|
||||
export async function requestProductBalance(productCode: ProductType): Promise<[number, boolean | undefined]> {
|
||||
const data: GetProductDetailRequest = { productCode, userId: getUserId() };
|
||||
const { balance } = await http.post<ProductInfo>(API.GET_PRODUCT_DETAIL, {
|
||||
const { balance, isPaidVip } = await http.post<ProductInfo>(API.GET_PRODUCT_DETAIL, {
|
||||
data,
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
});
|
||||
return balance;
|
||||
return [balance, isPaidVip];
|
||||
}
|
||||
|
||||
// 是否可以购买某一个产品
|
||||
|
@ -15,11 +15,27 @@ const getRandomCount = () => {
|
||||
return (seed % 300) + 500;
|
||||
};
|
||||
|
||||
export const getCommonShareMessage = (useCapture: boolean = true, inviteCode?: string): ShareAppMessageReturn => {
|
||||
console.log('share share message', getJumpUrl(PageUrl.Job, inviteCode ? { c: inviteCode } : undefined));
|
||||
interface ShareAppProps {
|
||||
useCapture?: boolean;
|
||||
inviteCode?: string;
|
||||
title?: string;
|
||||
path?: PageUrl;
|
||||
params?: Record<string, BL.Anything>;
|
||||
}
|
||||
|
||||
export const getCommonShareMessage = ({
|
||||
useCapture = true,
|
||||
inviteCode,
|
||||
title,
|
||||
path,
|
||||
params = {},
|
||||
}: ShareAppProps = {}): ShareAppMessageReturn => {
|
||||
const inviteParams = inviteCode ? { c: inviteCode } : undefined;
|
||||
const sharePath = path ? getJumpUrl(path, { ...params, ...inviteParams }) : getJumpUrl(PageUrl.Job, inviteParams);
|
||||
console.log('share share message', sharePath);
|
||||
return {
|
||||
title: `昨天新增了${getRandomCount()}条主播通告,宝子快来看看`,
|
||||
path: getJumpUrl(PageUrl.Job, inviteCode ? { c: inviteCode } : undefined),
|
||||
title: title || `昨天新增了${getRandomCount()}条主播通告,宝子快来看看`,
|
||||
path: sharePath,
|
||||
imageUrl: useCapture ? undefined : imageUrl,
|
||||
};
|
||||
};
|
||||
|
@ -7,24 +7,35 @@ import { logWithPrefix } from '@/utils/common';
|
||||
|
||||
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];
|
||||
const { subscriptionsSetting } = await Taro.getSetting({ withSubscriptions: true });
|
||||
log('isSubscribeRefuse subscriptionsSetting:', subscriptionsSetting);
|
||||
if (!subscriptionsSetting) {
|
||||
return false;
|
||||
return [false, []];
|
||||
}
|
||||
const { mainSwitch, itemSettings = {} } = subscriptionsSetting;
|
||||
if (!mainSwitch) {
|
||||
return true;
|
||||
return [true, []];
|
||||
}
|
||||
return tempId.some(id => {
|
||||
const acceptedIds: SubscribeTempId[] = [];
|
||||
let refused = false;
|
||||
tempId.some(id => {
|
||||
const item = itemSettings[id];
|
||||
if (!item) {
|
||||
return false;
|
||||
if (item === 'accept') {
|
||||
acceptedIds.push(id);
|
||||
}
|
||||
return item === 'reject';
|
||||
|
||||
if (refused) {
|
||||
return;
|
||||
}
|
||||
|
||||
refused = item === 'reject';
|
||||
});
|
||||
|
||||
return [refused || false, acceptedIds];
|
||||
};
|
||||
|
||||
export const subscribeMessage = async (tempIds: SubscribeTempId[]) => {
|
||||
|
@ -151,3 +151,24 @@ export async function followGroup(blGroupId: FollowGroupRequest['blGroupId']) {
|
||||
|
||||
export const getAgreementSigned = (): boolean | '' => Taro.getStorageSync(CacheKey.AGREEMENT_SIGNED);
|
||||
export const setAgreementSigned = (signed: boolean) => Taro.setStorageSync(CacheKey.AGREEMENT_SIGNED, signed);
|
||||
export const getCityCodes = (): string[] => {
|
||||
const cachedValue = Taro.getStorageSync(CacheKey.CITY_CODES);
|
||||
return !cachedValue || !Array.isArray(cachedValue) ? [] : cachedValue;
|
||||
};
|
||||
export const setCityCodes = (cityCode: string[]) => Taro.setStorageSync(CacheKey.CITY_CODES, cityCode);
|
||||
export const validCityCode = (cityCode: string) => {
|
||||
const cachedCityCodes = getCityCodes();
|
||||
const isNewCityCode = cachedCityCodes.indexOf(cityCode) === -1;
|
||||
return !(cachedCityCodes.length === 2 && isNewCityCode);
|
||||
};
|
||||
export const checkCityCode = (cityCode: string): boolean => {
|
||||
if (!validCityCode(cityCode)) {
|
||||
Toast.info('最多只能进入2个城市');
|
||||
return false;
|
||||
}
|
||||
const cachedCityCodes = getCityCodes();
|
||||
if (cachedCityCodes.indexOf(cityCode) === -1) {
|
||||
setCityCodes([...cachedCityCodes, cityCode]);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
Reference in New Issue
Block a user