Compare commits
9 Commits
5acc25c8c9
...
feat/updat
| Author | SHA1 | Date | |
|---|---|---|---|
| 56cf10c768 | |||
| 0ec366cc2e | |||
| 828497fcd6 | |||
| fd5b3dab97 | |||
| 1b782ee82c | |||
| 80c0d71921 | |||
| c76027b4d9 | |||
| c08b0bef95 | |||
| 96eb46821e |
@ -109,5 +109,6 @@
|
|||||||
"ignoredBuiltDependencies": [
|
"ignoredBuiltDependencies": [
|
||||||
"@tarojs/binding"
|
"@tarojs/binding"
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,4 +44,4 @@
|
|||||||
},
|
},
|
||||||
"appid": "wxf0724a83f8e377d2",
|
"appid": "wxf0724a83f8e377d2",
|
||||||
"simulatorPluginLibVersion": {}
|
"simulatorPluginLibVersion": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Button } from '@tarojs/components';
|
import { Button, ITouchEvent } from '@tarojs/components';
|
||||||
|
|
||||||
import { Popup } from '@taroify/core';
|
import { Popup } from '@taroify/core';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
@ -8,23 +8,23 @@ import PhoneButton from '@/components/phone-button';
|
|||||||
import { ProtocolPrivacy } from '@/components/protocol-privacy';
|
import { ProtocolPrivacy } from '@/components/protocol-privacy';
|
||||||
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
||||||
|
|
||||||
|
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
onConfirm: () => void;
|
onConfirm: (e: ITouchEvent) => void;
|
||||||
needPhone?: boolean;
|
needPhone?: boolean;
|
||||||
|
needBindPhone?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PREFIX = 'agreement-popup';
|
const PREFIX = 'agreement-popup';
|
||||||
|
|
||||||
export function AgreementPopup({ open, onCancel, onConfirm, needPhone }: IProps) {
|
export function AgreementPopup({ open, onCancel, onConfirm, needPhone, needBindPhone }: IProps) {
|
||||||
const handleBindPhone = useCallback(
|
const handleBindPhone = useCallback(
|
||||||
status => {
|
(status: BindPhoneStatus, e: ITouchEvent) => {
|
||||||
if (status === BindPhoneStatus.Success) {
|
if (status === BindPhoneStatus.Success) {
|
||||||
onConfirm();
|
onConfirm(e);
|
||||||
} else {
|
} else {
|
||||||
onCancel();
|
onCancel();
|
||||||
}
|
}
|
||||||
@ -49,8 +49,8 @@ export function AgreementPopup({ open, onCancel, onConfirm, needPhone }: IProps)
|
|||||||
<Button className={`${PREFIX}__cancel-button`} onClick={onCancel}>
|
<Button className={`${PREFIX}__cancel-button`} onClick={onCancel}>
|
||||||
拒绝
|
拒绝
|
||||||
</Button>
|
</Button>
|
||||||
{needPhone ? (
|
{needBindPhone ? (
|
||||||
<PhoneButton className={`${PREFIX}__confirm-button`} needPhone onBindPhone={handleBindPhone}>
|
<PhoneButton className={`${PREFIX}__confirm-button`} needPhone={needPhone} onBindPhone={handleBindPhone}>
|
||||||
同意
|
同意
|
||||||
</PhoneButton>
|
</PhoneButton>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@ -7,13 +7,14 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|||||||
|
|
||||||
import AnchorCard from '@/components/anchor-card';
|
import AnchorCard from '@/components/anchor-card';
|
||||||
import ListPlaceholder from '@/components/list-placeholder';
|
import ListPlaceholder from '@/components/list-placeholder';
|
||||||
|
import LoginDialog from '@/components/login-dialog';
|
||||||
import { EventName } from '@/constants/app';
|
import { EventName } from '@/constants/app';
|
||||||
import { AnchorSortType } from '@/constants/material';
|
import { AnchorSortType } from '@/constants/material';
|
||||||
import useUserInfo from '@/hooks/use-user-info';
|
import useUserInfo from '@/hooks/use-user-info';
|
||||||
import { AnchorInfo, GetAnchorListRequest, IAnchorFilters } from '@/types/material';
|
import { AnchorInfo, GetAnchorListRequest, IAnchorFilters } from '@/types/material';
|
||||||
import { logWithPrefix } from '@/utils/common';
|
import { logWithPrefix } from '@/utils/common';
|
||||||
import { requestAnchorList as requestData } from '@/utils/material';
|
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';
|
import { AgreementPopup } from '../agreement-popup';
|
||||||
|
|
||||||
@ -59,10 +60,11 @@ function AnchorList(props: IAnchorListProps) {
|
|||||||
const requestProps = useRef<IRequestProps>({});
|
const requestProps = useRef<IRequestProps>({});
|
||||||
const prevRequestProps = useRef<IRequestProps>({});
|
const prevRequestProps = useRef<IRequestProps>({});
|
||||||
const onListEmptyRef = useRef(onListEmpty);
|
const onListEmptyRef = useRef(onListEmpty);
|
||||||
const [open, setOpen] = useState(false);
|
const [openLogin, setLoginOpen] = useState(false);
|
||||||
|
const [openAssignment, setAssignmentOpen] = useState(false);
|
||||||
const successCallback = useRef<() => void>(() => {});
|
const successCallback = useRef<() => void>(() => {});
|
||||||
const userInfo = useUserInfo();
|
const userInfo = useUserInfo();
|
||||||
const needPhone = isNeedPhone(userInfo);
|
const needLogin = isNeedLogin(userInfo);
|
||||||
|
|
||||||
const handleRefresh = useCallback(async () => {
|
const handleRefresh = useCallback(async () => {
|
||||||
log('start pull refresh');
|
log('start pull refresh');
|
||||||
@ -129,23 +131,33 @@ function AnchorList(props: IAnchorListProps) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleCancel = useCallback(() => {
|
const handleCancel = useCallback(() => {
|
||||||
setOpen(false);
|
setAssignmentOpen(false);
|
||||||
setAgreementSigned(false);
|
setAgreementSigned(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleConfirm = useCallback(() => {
|
const handleConfirm = useCallback(() => {
|
||||||
setOpen(false);
|
setAssignmentOpen(false);
|
||||||
setAgreementSigned(true);
|
setAgreementSigned(true);
|
||||||
//TODO 没手机号要授权一下; 必须要开弹窗才可以,与需求不符
|
|
||||||
successCallback.current();
|
successCallback.current();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const handleLoginSuccess = useCallback(() => {
|
||||||
|
setLoginOpen(false);
|
||||||
|
successCallback.current();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleLoginCancel = useCallback(() => {
|
||||||
|
setLoginOpen(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const validator = (onSuccess: () => void) => {
|
const validator = (onSuccess: () => void) => {
|
||||||
if (getAgreementSigned()) {
|
successCallback.current = onSuccess;
|
||||||
onSuccess();
|
if (!getAgreementSigned()) {
|
||||||
|
setAssignmentOpen(true);
|
||||||
|
} else if (needLogin) {
|
||||||
|
setLoginOpen(true);
|
||||||
} else {
|
} else {
|
||||||
successCallback.current = onSuccess;
|
onSuccess();
|
||||||
setOpen(true);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -233,7 +245,13 @@ function AnchorList(props: IAnchorListProps) {
|
|||||||
<ListPlaceholder hasMore={hasMore} loadingMore={loadingMore} loadMoreError={loadMoreError} />
|
<ListPlaceholder hasMore={hasMore} loadingMore={loadingMore} loadMoreError={loadMoreError} />
|
||||||
</List>
|
</List>
|
||||||
</PullRefresh>
|
</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} />}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,8 +46,8 @@ function JobRecommendList(props: IJobListProps) {
|
|||||||
setDataList([]);
|
setDataList([]);
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setLoadError(false);
|
setLoadError(false);
|
||||||
const { jobResults = [] } = await requestMyRecommendJobList({ ...requestProps.current });
|
const { jobResults } = await requestMyRecommendJobList({ ...requestProps.current });
|
||||||
setDataList(jobResults);
|
setDataList(jobResults || []);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setDataList([]);
|
setDataList([]);
|
||||||
setLoadError(true);
|
setLoadError(true);
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
import { Button, ButtonProps } from '@tarojs/components';
|
import { Button, ButtonProps, ITouchEvent } from '@tarojs/components';
|
||||||
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
|
import { AgreementPopup } from '@/components/agreement-popup';
|
||||||
import LoginDialog from '@/components/login-dialog';
|
import LoginDialog from '@/components/login-dialog';
|
||||||
import useUserInfo from '@/hooks/use-user-info';
|
import useUserInfo from '@/hooks/use-user-info';
|
||||||
import { isNeedLogin } from '@/utils/user';
|
import { getAgreementSigned, isNeedLogin, setAgreementSigned } from '@/utils/user';
|
||||||
|
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
@ -17,6 +18,7 @@ export enum BindPhoneStatus {
|
|||||||
|
|
||||||
export interface ILoginButtonProps extends ButtonProps {
|
export interface ILoginButtonProps extends ButtonProps {
|
||||||
needPhone?: boolean;
|
needPhone?: boolean;
|
||||||
|
needAssignment?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PREFIX = 'login-button';
|
const PREFIX = 'login-button';
|
||||||
@ -24,12 +26,50 @@ const PREFIX = 'login-button';
|
|||||||
function LoginButton(props: ILoginButtonProps) {
|
function LoginButton(props: ILoginButtonProps) {
|
||||||
const { className, children, needPhone, onClick, ...otherProps } = props;
|
const { className, children, needPhone, onClick, ...otherProps } = props;
|
||||||
const userInfo = useUserInfo();
|
const userInfo = useUserInfo();
|
||||||
const [visible, setVisible] = useState(false);
|
const [loginVisible, setLoginVisible] = useState(false);
|
||||||
|
const [assignVisible, setAssignVisible] = useState(false);
|
||||||
const needLogin = isNeedLogin(userInfo);
|
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 => {
|
e => {
|
||||||
setVisible(false);
|
setLoginVisible(false);
|
||||||
onClick?.(e);
|
onClick?.(e);
|
||||||
},
|
},
|
||||||
[onClick]
|
[onClick]
|
||||||
@ -37,14 +77,18 @@ function LoginButton(props: ILoginButtonProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button {...otherProps} className={classNames(PREFIX, className)} onClick={handleClick}>
|
||||||
{...otherProps}
|
|
||||||
className={classNames(PREFIX, className)}
|
|
||||||
onClick={needLogin ? () => setVisible(true) : onClick}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</Button>
|
</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);
|
.button(@width: 360px, @height: 72px, @fontSize: 28px, @fontWeight: 400, @borderRadius: 44px);
|
||||||
margin-top: 40px;
|
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 { Dialog } from '@taroify/core';
|
||||||
import { useCallback, useState } from 'react';
|
|
||||||
|
|
||||||
import PhoneButton, { IPhoneButtonProps } from '@/components/phone-button';
|
import PhoneButton, { IPhoneButtonProps } from '@/components/phone-button';
|
||||||
import { ProtocolPrivacyCheckbox } from '@/components/protocol-privacy';
|
|
||||||
import Toast from '@/utils/toast';
|
|
||||||
|
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
@ -21,36 +16,20 @@ const PREFIX = 'login-dialog';
|
|||||||
|
|
||||||
export default function LoginDialog(props: IProps) {
|
export default function LoginDialog(props: IProps) {
|
||||||
const { title = '使用播络服务前,请先登录', needPhone, onSuccess, onCancel, onBindPhone } = props;
|
const { title = '使用播络服务前,请先登录', needPhone, onSuccess, onCancel, onBindPhone } = props;
|
||||||
const [checked, setChecked] = useState(false);
|
|
||||||
|
|
||||||
const handleTipCheck = useCallback(() => {
|
|
||||||
Toast.info('请先阅读并同意协议');
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open onClose={onCancel}>
|
<Dialog open onClose={onCancel}>
|
||||||
<Dialog.Content>
|
<Dialog.Content>
|
||||||
<div className={`${PREFIX}__container`}>
|
<div className={`${PREFIX}__container`}>
|
||||||
<div className={`${PREFIX}__title`}>{title}</div>
|
<div className={`${PREFIX}__title`}>{title}</div>
|
||||||
{!checked && (
|
<PhoneButton
|
||||||
<Button className={`${PREFIX}__confirm-button`} onClick={handleTipCheck}>
|
className={`${PREFIX}__confirm-button`}
|
||||||
登录
|
onSuccess={onSuccess}
|
||||||
</Button>
|
onBindPhone={onBindPhone}
|
||||||
)}
|
needPhone={needPhone}
|
||||||
{checked && (
|
>
|
||||||
<PhoneButton
|
登录
|
||||||
className={`${PREFIX}__confirm-button`}
|
</PhoneButton>
|
||||||
onSuccess={onSuccess}
|
|
||||||
onBindPhone={onBindPhone}
|
|
||||||
needPhone={needPhone}
|
|
||||||
>
|
|
||||||
登录
|
|
||||||
</PhoneButton>
|
|
||||||
)}
|
|
||||||
<Button className={`${PREFIX}__cancel-button`} onClick={onCancel}>
|
|
||||||
跳过,暂不登录
|
|
||||||
</Button>
|
|
||||||
<ProtocolPrivacyCheckbox checked={checked} onChange={setChecked} className={`${PREFIX}__checkbox`} />
|
|
||||||
</div>
|
</div>
|
||||||
</Dialog.Content>
|
</Dialog.Content>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|||||||
@ -2,13 +2,13 @@ import { Image } from '@tarojs/components';
|
|||||||
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { PropsWithChildren, useEffect, useState, useCallback } from 'react';
|
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 useUserInfo from '@/hooks/use-user-info';
|
||||||
import { IChatMessage } from '@/types/message';
|
import { IChatMessage } from '@/types/message';
|
||||||
import { getScrollItemId } from '@/utils/common';
|
import { getScrollItemId } from '@/utils/common';
|
||||||
import { navigateTo } from '@/utils/route';
|
import { navigateTo } from '@/utils/route';
|
||||||
import { PageUrl } from '@/constants/app';
|
|
||||||
|
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
@ -19,12 +19,13 @@ export interface IBaseMessageProps {
|
|||||||
|
|
||||||
export interface IUserMessageProps extends PropsWithChildren, IBaseMessageProps {
|
export interface IUserMessageProps extends PropsWithChildren, IBaseMessageProps {
|
||||||
isRead?: boolean;
|
isRead?: boolean;
|
||||||
|
resumeId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PREFIX = 'base-message';
|
const PREFIX = 'base-message';
|
||||||
|
|
||||||
function BaseMessage(props: IUserMessageProps) {
|
function BaseMessage(props: IUserMessageProps) {
|
||||||
const { id, message, isRead: isReadProps, children } = props;
|
const { id, message, isRead: isReadProps, children, resumeId } = props;
|
||||||
const { userId } = useUserInfo();
|
const { userId } = useUserInfo();
|
||||||
const [isRead, setIsRead] = useState(message.isRead);
|
const [isRead, setIsRead] = useState(message.isRead);
|
||||||
const isSender = message.senderUserId === userId;
|
const isSender = message.senderUserId === userId;
|
||||||
@ -37,10 +38,12 @@ function BaseMessage(props: IUserMessageProps) {
|
|||||||
// const timer = setTimeout(() => setIsRead(true), 1200);
|
// const timer = setTimeout(() => setIsRead(true), 1200);
|
||||||
// return () => clearTimeout(timer);
|
// return () => clearTimeout(timer);
|
||||||
// }, [isSender]);
|
// }, [isSender]);
|
||||||
const handleClick = useCallback(
|
const handleClick = useCallback(() => {
|
||||||
() => navigateTo(PageUrl.MaterialView, { resumeId: message.jobId, source: MaterialViewSource.Chat }),
|
if (!resumeId || isSender) {
|
||||||
[message.jobId]
|
return;
|
||||||
);
|
}
|
||||||
|
navigateTo(PageUrl.MaterialView, { resumeId: resumeId, source: MaterialViewSource.Chat });
|
||||||
|
}, [resumeId, isSender]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isRead) {
|
if (isRead) {
|
||||||
return;
|
return;
|
||||||
@ -53,6 +56,7 @@ function BaseMessage(props: IUserMessageProps) {
|
|||||||
<Image
|
<Image
|
||||||
mode="aspectFit"
|
mode="aspectFit"
|
||||||
className={`${PREFIX}__avatar`}
|
className={`${PREFIX}__avatar`}
|
||||||
|
onClick={handleClick}
|
||||||
src={message.senderAvatarUrl || require('@/statics/png/default_avatar.png')}
|
src={message.senderAvatarUrl || require('@/statics/png/default_avatar.png')}
|
||||||
/>
|
/>
|
||||||
<div className={`${PREFIX}__content-container`}>
|
<div className={`${PREFIX}__content-container`}>
|
||||||
|
|||||||
@ -60,7 +60,9 @@ export default function PartnerBanner() {
|
|||||||
)}
|
)}
|
||||||
<div className={`${PREFIX}__close`} onClick={handlePartnerBannerClose} />
|
<div className={`${PREFIX}__close`} onClick={handlePartnerBannerClose} />
|
||||||
</div>
|
</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>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</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}
|
hasMore={hasMore}
|
||||||
onLoad={handleLoadMore}
|
onLoad={handleLoadMore}
|
||||||
loading={loadingMore || refreshing}
|
loading={loadingMore || refreshing}
|
||||||
disabled={loadMoreError}
|
disabled={loadMoreError || !visible}
|
||||||
fixedHeight={typeof listHeight !== 'undefined'}
|
fixedHeight={typeof listHeight !== 'undefined'}
|
||||||
style={listHeight ? { height: `${listHeight}px` } : undefined}
|
style={listHeight ? { height: `${listHeight}px` } : undefined}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -1,14 +1,16 @@
|
|||||||
import { Button, Image } from '@tarojs/components';
|
import { Button, Image } from '@tarojs/components';
|
||||||
|
import Taro, { useDidShow } from '@tarojs/taro';
|
||||||
|
|
||||||
import { Dialog } from '@taroify/core';
|
import { Dialog } from '@taroify/core';
|
||||||
import { Question } from '@taroify/icons';
|
import { Question } from '@taroify/icons';
|
||||||
import { useCallback, useState, useEffect } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
|
|
||||||
import { PageUrl } from '@/constants/app';
|
import { PageUrl } from '@/constants/app';
|
||||||
import { PartnerProfitsState } from '@/types/partner';
|
import { PartnerProfitsState } from '@/types/partner';
|
||||||
import { formatMoney, getPartnerProfitStat } from '@/utils/partner';
|
import { formatMoney, getPartnerProfitStat, withdrawMoney } from '@/utils/partner';
|
||||||
import { navigateTo } from '@/utils/route';
|
import { navigateTo } from '@/utils/route';
|
||||||
import Toast from '@/utils/toast';
|
import Toast from '@/utils/toast';
|
||||||
|
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
const PREFIX = 'partner-kanban';
|
const PREFIX = 'partner-kanban';
|
||||||
@ -31,17 +33,48 @@ function TipDialog(props: { open: boolean; onClose: () => void }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function WithdrawDialog(props: { open: boolean; onClose: () => void; count: number }) {
|
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 (
|
return (
|
||||||
<Dialog open={props.open} onClose={props.onClose}>
|
<Dialog open={props.open} onClose={props.onClose}>
|
||||||
<Dialog.Content>
|
<Dialog.Content>
|
||||||
<div className={`${PREFIX}-withdraw-dialog__container`}>
|
<div className={`${PREFIX}-withdraw-dialog__container`}>
|
||||||
<div className={`${PREFIX}-withdraw-dialog__title`}>本次申请提现金额为</div>
|
<div className={`${PREFIX}-withdraw-dialog__title`}>本次申请提现金额为</div>
|
||||||
<div className={`${PREFIX}-withdraw-dialog__count`}>
|
<div className={`${PREFIX}-withdraw-dialog__count`}>
|
||||||
{props.count}
|
{+props.count}
|
||||||
<div className="yuan">元</div>
|
<div className="yuan">元</div>
|
||||||
</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 className={`${PREFIX}-withdraw-dialog__confirm-button`} onClick={handleWithdraw}>
|
||||||
提现
|
提现
|
||||||
</Button>
|
</Button>
|
||||||
@ -86,20 +119,28 @@ export default function PartnerKanban({ simple }: PartnerKanbanProps) {
|
|||||||
const handleTipClose = useCallback(() => {
|
const handleTipClose = useCallback(() => {
|
||||||
setTipOpen(false);
|
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 getProfitStats = useCallback(async () => {
|
||||||
const data = await getPartnerProfitStat();
|
const data = await getPartnerProfitStat();
|
||||||
setStats(data);
|
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(() => {
|
useEffect(() => {
|
||||||
getProfitStats();
|
getProfitStats();
|
||||||
}, []);
|
}, []);
|
||||||
@ -154,7 +195,13 @@ export default function PartnerKanban({ simple }: PartnerKanbanProps) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{!simple && <TipDialog open={tipOpen} onClose={handleTipClose} />}
|
{!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>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,7 +96,8 @@ function ProfitList(props: IPartnerProfitListProps) {
|
|||||||
style={listHeight ? { height: `${listHeight}px` } : undefined}
|
style={listHeight ? { height: `${listHeight}px` } : undefined}
|
||||||
>
|
>
|
||||||
{dataList.map(item => {
|
{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 (
|
return (
|
||||||
<div className={`${PREFIX}__row`} key={item.id}>
|
<div className={`${PREFIX}__row`} key={item.id}>
|
||||||
<div className={`${PREFIX}__row-content`}>
|
<div className={`${PREFIX}__row-content`}>
|
||||||
|
|||||||
@ -78,10 +78,13 @@
|
|||||||
&:last-child {
|
&:last-child {
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
}
|
}
|
||||||
&.time,
|
&.time {
|
||||||
&.project {
|
|
||||||
flex: 2;
|
flex: 2;
|
||||||
}
|
}
|
||||||
|
&.project {
|
||||||
|
width: 150px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
&.status {
|
&.status {
|
||||||
width: 96px;
|
width: 96px;
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
|
|||||||
@ -19,7 +19,7 @@ export interface IPhoneButtonProps extends ButtonProps {
|
|||||||
message?: string;
|
message?: string;
|
||||||
// 绑定后是否需要刷新接口获取手机号
|
// 绑定后是否需要刷新接口获取手机号
|
||||||
needPhone?: boolean;
|
needPhone?: boolean;
|
||||||
onBindPhone?: (status: BindPhoneStatus) => void;
|
onBindPhone?: (status: BindPhoneStatus, e: ITouchEvent) => void;
|
||||||
onSuccess?: (e: ITouchEvent) => void;
|
onSuccess?: (e: ITouchEvent) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,17 +44,17 @@ export default function PhoneButton(props: IPhoneButtonProps) {
|
|||||||
const encryptedData = e.detail.encryptedData;
|
const encryptedData = e.detail.encryptedData;
|
||||||
const iv = e.detail.iv;
|
const iv = e.detail.iv;
|
||||||
if (!encryptedData || !iv) {
|
if (!encryptedData || !iv) {
|
||||||
onBindPhone?.(BindPhoneStatus.Cancel);
|
onBindPhone?.(BindPhoneStatus.Cancel, e as ITouchEvent);
|
||||||
return Toast.error('取消授权');
|
return Toast.error('取消授权');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await setPhoneNumber({ encryptedData, iv });
|
await setPhoneNumber({ encryptedData, iv });
|
||||||
needPhone && (await requestUserInfo());
|
needPhone && (await requestUserInfo());
|
||||||
Toast.success(message);
|
Toast.success(message);
|
||||||
onBindPhone?.(BindPhoneStatus.Success);
|
onBindPhone?.(BindPhoneStatus.Success, e as ITouchEvent);
|
||||||
onSuccess?.(e as ITouchEvent);
|
onSuccess?.(e as ITouchEvent);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
onBindPhone?.(BindPhoneStatus.Error);
|
onBindPhone?.(BindPhoneStatus.Error, e as ITouchEvent);
|
||||||
Toast.error('绑定失败');
|
Toast.error('绑定失败');
|
||||||
log('bind phone fail', err);
|
log('bind phone fail', err);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,5 +10,6 @@ export enum CacheKey {
|
|||||||
LAST_SELECT_MY_JOB = '__last_select_my_job__',
|
LAST_SELECT_MY_JOB = '__last_select_my_job__',
|
||||||
CLOSE_PARTNER_BANNER = '__close_partner_banner__',
|
CLOSE_PARTNER_BANNER = '__close_partner_banner__',
|
||||||
INVITE_CODE = '__invite_code__',
|
INVITE_CODE = '__invite_code__',
|
||||||
AGREEMENT_SIGNED = '__agreement_signed__'
|
AGREEMENT_SIGNED = '__agreement_signed__',
|
||||||
|
CITY_CODES = '__city_codes__',
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5861,6 +5861,16 @@ export const CITY_INDEXES_LIST = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const GROUP_CITY_INDEXES_LIST = [
|
export const GROUP_CITY_INDEXES_LIST = [
|
||||||
|
{
|
||||||
|
letter: 'B',
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
cityCode: '110100',
|
||||||
|
cityName: '北京',
|
||||||
|
keyword: 'BEIJING北京',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
letter: 'C',
|
letter: 'C',
|
||||||
data: [
|
data: [
|
||||||
@ -5874,6 +5884,11 @@ export const GROUP_CITY_INDEXES_LIST = [
|
|||||||
cityName: '成都',
|
cityName: '成都',
|
||||||
keyword: 'CHENGDOU成都',
|
keyword: 'CHENGDOU成都',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
cityCode: '430100',
|
||||||
|
cityName: '长沙',
|
||||||
|
keyword: 'CHANGSHA长沙',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -5914,6 +5929,11 @@ export const GROUP_CITY_INDEXES_LIST = [
|
|||||||
{
|
{
|
||||||
letter: 'H',
|
letter: 'H',
|
||||||
data: [
|
data: [
|
||||||
|
{
|
||||||
|
cityCode: '330100',
|
||||||
|
cityName: '杭州',
|
||||||
|
keyword: 'HANGZHOU杭州',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
cityCode: '340100',
|
cityCode: '340100',
|
||||||
cityName: '合肥',
|
cityName: '合肥',
|
||||||
@ -5921,6 +5941,16 @@ export const GROUP_CITY_INDEXES_LIST = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
letter: 'K',
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
cityCode: '530100',
|
||||||
|
cityName: '昆明',
|
||||||
|
keyword: 'KUNMING昆明',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
letter: 'N',
|
letter: 'N',
|
||||||
data: [
|
data: [
|
||||||
@ -5939,6 +5969,11 @@ export const GROUP_CITY_INDEXES_LIST = [
|
|||||||
cityName: '青岛',
|
cityName: '青岛',
|
||||||
keyword: 'QINGDAO青岛',
|
keyword: 'QINGDAO青岛',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
cityCode: '350500',
|
||||||
|
cityName: '泉州',
|
||||||
|
keyword: 'QUANZHOU泉州',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -5959,11 +5994,6 @@ export const GROUP_CITY_INDEXES_LIST = [
|
|||||||
cityName: '苏州',
|
cityName: '苏州',
|
||||||
keyword: 'SUZHOU苏州',
|
keyword: 'SUZHOU苏州',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
cityCode: '330300',
|
|
||||||
cityName: '温州',
|
|
||||||
keyword: 'WENZHOU温州',
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -5979,6 +6009,11 @@ export const GROUP_CITY_INDEXES_LIST = [
|
|||||||
{
|
{
|
||||||
letter: 'W',
|
letter: 'W',
|
||||||
data: [
|
data: [
|
||||||
|
{
|
||||||
|
cityCode: '330300',
|
||||||
|
cityName: '温州',
|
||||||
|
keyword: 'WENZHOU温州',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
cityCode: '420100',
|
cityCode: '420100',
|
||||||
cityName: '武汉',
|
cityName: '武汉',
|
||||||
@ -5994,6 +6029,11 @@ export const GROUP_CITY_INDEXES_LIST = [
|
|||||||
cityName: '西安',
|
cityName: '西安',
|
||||||
keyword: 'XIAN西安',
|
keyword: 'XIAN西安',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
cityCode: '350200',
|
||||||
|
cityName: '厦门',
|
||||||
|
keyword: 'XIAMEN厦门',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -52,3 +52,9 @@ export const ProfitStatusDescriptions = {
|
|||||||
OTHER: '',
|
OTHER: '',
|
||||||
FINISHED: '已分账',
|
FINISHED: '已分账',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const WithdrawStatusDescriptions = {
|
||||||
|
0: '提现中',
|
||||||
|
1: '已提现',
|
||||||
|
2: '失败',
|
||||||
|
};
|
||||||
|
|||||||
@ -62,7 +62,7 @@ const getSalaryPrice = (fullSalary?: SalaryRange, partSalary?: SalaryRange) => {
|
|||||||
|
|
||||||
function ProfileIntentionFragment(props: IProps, ref) {
|
function ProfileIntentionFragment(props: IProps, ref) {
|
||||||
const { profile } = props;
|
const { profile } = props;
|
||||||
const [cityCodes, setCityCodes] = useState(calcInitCityCodes(profile.cityCodes));
|
const [cityCodes, setCityCodes] = useState(calcInitCityCodes(profile.cityCodes || ''));
|
||||||
const [employType, setEmployType] = useState(profile.employType);
|
const [employType, setEmployType] = useState(profile.employType);
|
||||||
const [fullSalary, setFullSalary] = useState(calcSalarySelect(profile, true));
|
const [fullSalary, setFullSalary] = useState(calcSalarySelect(profile, true));
|
||||||
const [partSalary, setPartSalary] = useState(calcSalarySelect(profile, false));
|
const [partSalary, setPartSalary] = useState(calcSalarySelect(profile, false));
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
|
|
||||||
import { selectRoleType } from '@/store/selector';
|
|
||||||
import { RoleType } from '@/constants/app';
|
import { RoleType } from '@/constants/app';
|
||||||
|
import { selectRoleType } from '@/store/selector';
|
||||||
|
|
||||||
function useRoleType() {
|
function useRoleType() {
|
||||||
return useSelector(selectRoleType) || RoleType.Anchor;
|
return useSelector(selectRoleType) || RoleType.Anchor;
|
||||||
|
|||||||
@ -82,4 +82,6 @@ export enum API {
|
|||||||
BECOME_PARTNER = '/user/becomePartner',
|
BECOME_PARTNER = '/user/becomePartner',
|
||||||
GET_PROFIT_LIST = '/user/profit/list',
|
GET_PROFIT_LIST = '/user/profit/list',
|
||||||
GET_PROFIT_STAT = '/user/profits',
|
GET_PROFIT_STAT = '/user/profits',
|
||||||
|
WITHDRAW = '/user/withdraw',
|
||||||
|
GET_WITHDRAW_LIST = '/user/withdraw/records',
|
||||||
}
|
}
|
||||||
|
|||||||
@ -186,7 +186,7 @@ export default function AnchorPage() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useShareAppMessage(() => {
|
useShareAppMessage(() => {
|
||||||
return getCommonShareMessage(true, inviteCode);
|
return getCommonShareMessage(true, inviteCode, '数万名优质主播等你来挑');
|
||||||
});
|
});
|
||||||
|
|
||||||
useDidShow(() => requestUnreadMessageCount());
|
useDidShow(() => requestUnreadMessageCount());
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import { getCurrentCityCode } from '@/utils/location';
|
|||||||
import { getInviteCodeFromQueryAndUpdate } from '@/utils/partner';
|
import { getInviteCodeFromQueryAndUpdate } from '@/utils/partner';
|
||||||
import { getPageQuery } from '@/utils/route';
|
import { getPageQuery } from '@/utils/route';
|
||||||
import { getCommonShareMessage } from '@/utils/share';
|
import { getCommonShareMessage } from '@/utils/share';
|
||||||
|
import { checkCityCode } from '@/utils/user';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
const PREFIX = 'group-v2-page';
|
const PREFIX = 'group-v2-page';
|
||||||
@ -26,6 +27,9 @@ export default function GroupV2() {
|
|||||||
useShareAppMessage(() => getCommonShareMessage(true, inviteCode));
|
useShareAppMessage(() => getCommonShareMessage(true, inviteCode));
|
||||||
|
|
||||||
const handleSelectCity = useCallback(cityCode => {
|
const handleSelectCity = useCallback(cityCode => {
|
||||||
|
if (!checkCityCode(cityCode)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const group = GROUPS.find(g => String(g.cityCode) === cityCode);
|
const group = GROUPS.find(g => String(g.cityCode) === cityCode);
|
||||||
if (group) {
|
if (group) {
|
||||||
openCustomerServiceChat(group.serviceUrl);
|
openCustomerServiceChat(group.serviceUrl);
|
||||||
|
|||||||
@ -112,7 +112,6 @@ const AnchorFooter = (props: { data: JobDetails }) => {
|
|||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
const handleDialogHidden = useCallback(() => setDialogVisible(false), []);
|
const handleDialogHidden = useCallback(() => setDialogVisible(false), []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={`${PREFIX}__footer`}>
|
<div className={`${PREFIX}__footer`}>
|
||||||
|
|||||||
@ -95,6 +95,7 @@ export default function MessageChat() {
|
|||||||
const [messages, setMessages] = useState<IChatMessage[]>([]);
|
const [messages, setMessages] = useState<IChatMessage[]>([]);
|
||||||
const [messageStatusList, setMessageStatusList] = useState<IMessageStatus[]>([]);
|
const [messageStatusList, setMessageStatusList] = useState<IMessageStatus[]>([]);
|
||||||
const [jobId, setJobId] = useState<string>();
|
const [jobId, setJobId] = useState<string>();
|
||||||
|
const [resumeId, setResumeId] = useState<string>();
|
||||||
const [job, setJob] = useState<IJobMessage>();
|
const [job, setJob] = useState<IJobMessage>();
|
||||||
const [material, setMaterial] = useState<IMaterialMessage>();
|
const [material, setMaterial] = useState<IMaterialMessage>();
|
||||||
const [scrollItemId, setScrollItemId] = useState<string>();
|
const [scrollItemId, setScrollItemId] = useState<string>();
|
||||||
@ -298,6 +299,7 @@ export default function MessageChat() {
|
|||||||
const parseMaterial = query.material ? parseQuery<IMaterialMessage>(query.material) : null;
|
const parseMaterial = query.material ? parseQuery<IMaterialMessage>(query.material) : null;
|
||||||
// log('requestChatDetail', chatDetail, parseJob, parseMaterial);
|
// log('requestChatDetail', chatDetail, parseJob, parseMaterial);
|
||||||
setChat(chatDetail);
|
setChat(chatDetail);
|
||||||
|
setResumeId(chatDetail.participants.find(u => u.userId !== currentUserId)?.resumeId);
|
||||||
setJobId(query.jobId);
|
setJobId(query.jobId);
|
||||||
setMessages(chatDetail.messages);
|
setMessages(chatDetail.messages);
|
||||||
setScrollItemId(getScrollItemId(last(chatDetail.messages)?.msgId));
|
setScrollItemId(getScrollItemId(last(chatDetail.messages)?.msgId));
|
||||||
@ -353,6 +355,7 @@ export default function MessageChat() {
|
|||||||
id={message.msgId}
|
id={message.msgId}
|
||||||
key={message.msgId}
|
key={message.msgId}
|
||||||
message={message}
|
message={message}
|
||||||
|
resumeId={resumeId}
|
||||||
isRead={messageStatusList.some(m => m.msgId === message.msgId && !!m.isRead)}
|
isRead={messageStatusList.some(m => m.msgId === message.msgId && !!m.isRead)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,20 +1,23 @@
|
|||||||
import { useShareAppMessage } from '@tarojs/taro';
|
import { useShareAppMessage } from '@tarojs/taro';
|
||||||
|
|
||||||
import { Tabs } from '@taroify/core';
|
import { Tabs } from '@taroify/core';
|
||||||
|
import { useState } from 'react';
|
||||||
|
|
||||||
import PartnerIntro from '@/components/partner-intro';
|
import PartnerIntro from '@/components/partner-intro';
|
||||||
import PartnerInviteList from '@/components/partner-invite-list';
|
import PartnerInviteList from '@/components/partner-invite-list';
|
||||||
import PartnerProfit from '@/components/partner-profit';
|
import PartnerProfit from '@/components/partner-profit';
|
||||||
import useInviteCode from '@/hooks/use-invite-code';
|
import useInviteCode from '@/hooks/use-invite-code';
|
||||||
import { getCommonShareMessage } from '@/utils/share';
|
import { getCommonShareMessage } from '@/utils/share';
|
||||||
|
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
const PREFIX = 'partner';
|
const PREFIX = 'partner';
|
||||||
|
|
||||||
export default function Partner() {
|
export default function Partner() {
|
||||||
const inviteCode = useInviteCode();
|
const inviteCode = useInviteCode();
|
||||||
|
const [tab, setTab] = useState<number>(0);
|
||||||
|
const handleChange = v => {
|
||||||
|
setTab(v);
|
||||||
|
};
|
||||||
useShareAppMessage(() => {
|
useShareAppMessage(() => {
|
||||||
console.log('Partner inviteCode', inviteCode);
|
console.log('Partner inviteCode', inviteCode);
|
||||||
return getCommonShareMessage(false, inviteCode);
|
return getCommonShareMessage(false, inviteCode);
|
||||||
@ -22,12 +25,12 @@ export default function Partner() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={PREFIX}>
|
<div className={PREFIX}>
|
||||||
<Tabs className={`${PREFIX}__tabs`}>
|
<Tabs className={`${PREFIX}__tabs`} value={tab} onChange={handleChange}>
|
||||||
<Tabs.TabPane value={0} title="简介">
|
<Tabs.TabPane value={0} title="简介">
|
||||||
<PartnerIntro />
|
<PartnerIntro />
|
||||||
</Tabs.TabPane>
|
</Tabs.TabPane>
|
||||||
<Tabs.TabPane value={1} title="邀请名单">
|
<Tabs.TabPane value={1} title="邀请名单">
|
||||||
<PartnerInviteList />
|
<PartnerInviteList refreshDisabled={tab !== 1} visible={tab === 1} />
|
||||||
</Tabs.TabPane>
|
</Tabs.TabPane>
|
||||||
<Tabs.TabPane value={2} title="我的收益">
|
<Tabs.TabPane value={2} title="我的收益">
|
||||||
<PartnerProfit />
|
<PartnerProfit />
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import useInviteCode from '@/hooks/use-invite-code';
|
|||||||
import { openCustomerServiceChat } from '@/utils/common';
|
import { openCustomerServiceChat } from '@/utils/common';
|
||||||
import { getCurrentCityCode } from '@/utils/location';
|
import { getCurrentCityCode } from '@/utils/location';
|
||||||
import { getCommonShareMessage } from '@/utils/share';
|
import { getCommonShareMessage } from '@/utils/share';
|
||||||
|
import { checkCityCode } from '@/utils/user';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
const PREFIX = 'page-biz-service';
|
const PREFIX = 'page-biz-service';
|
||||||
@ -22,6 +23,9 @@ export default function BizService() {
|
|||||||
openCustomerServiceChat('https://work.weixin.qq.com/kfid/kfcd60708731367168d');
|
openCustomerServiceChat('https://work.weixin.qq.com/kfid/kfcd60708731367168d');
|
||||||
}, []);
|
}, []);
|
||||||
const handleSelectCity = useCallback(cityCode => {
|
const handleSelectCity = useCallback(cityCode => {
|
||||||
|
if (!checkCityCode(cityCode)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const group = GROUPS.find(g => String(g.cityCode) === cityCode);
|
const group = GROUPS.find(g => String(g.cityCode) === cityCode);
|
||||||
if (group) {
|
if (group) {
|
||||||
openCustomerServiceChat(group.serviceUrl);
|
openCustomerServiceChat(group.serviceUrl);
|
||||||
|
|||||||
@ -2,4 +2,52 @@
|
|||||||
@import '@/styles/variables.less';
|
@import '@/styles/variables.less';
|
||||||
|
|
||||||
.withdraw-record {
|
.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 { 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 { getCommonShareMessage } from '@/utils/share';
|
||||||
|
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
const PREFIX = 'withdraw-record';
|
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(() => {
|
useShareAppMessage(() => {
|
||||||
return getCommonShareMessage(false);
|
return getCommonShareMessage(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>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,9 @@ export interface ILocationMessage {
|
|||||||
longitude: number;
|
longitude: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IChatUser extends Pick<UserInfo, 'userId' | 'nickName'> {}
|
export interface IChatUser extends Pick<UserInfo, 'userId' | 'nickName'> {
|
||||||
|
resumeId: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IChatMessage {
|
export interface IChatMessage {
|
||||||
msgId: string;
|
msgId: string;
|
||||||
|
|||||||
@ -64,3 +64,26 @@ export interface PartnerProfitItem {
|
|||||||
expectedSettlementDate: string;
|
expectedSettlementDate: string;
|
||||||
actualSettlementDate: 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;
|
||||||
|
}
|
||||||
|
|||||||
@ -41,6 +41,8 @@ export const switchRoleType = async (appMode?: RoleType) => {
|
|||||||
const curMode = getRoleType();
|
const curMode = getRoleType();
|
||||||
appMode = curMode === RoleType.Anchor ? RoleType.Company : RoleType.Anchor;
|
appMode = curMode === RoleType.Anchor ? RoleType.Company : RoleType.Anchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('switchRoleType', appMode);
|
||||||
try {
|
try {
|
||||||
await postSwitchRoleType(appMode);
|
await postSwitchRoleType(appMode);
|
||||||
store.dispatch(changeRoleType(appMode));
|
store.dispatch(changeRoleType(appMode));
|
||||||
|
|||||||
@ -10,8 +10,11 @@ import {
|
|||||||
GetProfitRequest,
|
GetProfitRequest,
|
||||||
InviteUserInfo,
|
InviteUserInfo,
|
||||||
PartnerInviteCode,
|
PartnerInviteCode,
|
||||||
|
PartnerPagination,
|
||||||
PartnerProfitItem,
|
PartnerProfitItem,
|
||||||
PartnerProfitsState,
|
PartnerProfitsState,
|
||||||
|
WithdrawRecord,
|
||||||
|
WithdrawResponse,
|
||||||
} from '@/types/partner';
|
} from '@/types/partner';
|
||||||
import { requestUserInfo } from '@/utils/user';
|
import { requestUserInfo } from '@/utils/user';
|
||||||
|
|
||||||
@ -53,7 +56,7 @@ export const getPartnerProfitStat = async () => {
|
|||||||
return await http.post<PartnerProfitsState>(API.GET_PROFIT_STAT);
|
return await http.post<PartnerProfitsState>(API.GET_PROFIT_STAT);
|
||||||
};
|
};
|
||||||
export const getPartnerInviteList = async (data: IPaginationRequest) => {
|
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,
|
data,
|
||||||
contentType: 'application/x-www-form-urlencoded',
|
contentType: 'application/x-www-form-urlencoded',
|
||||||
});
|
});
|
||||||
@ -113,3 +116,14 @@ export function formatUserId(input: string): string {
|
|||||||
// 拼接结果
|
// 拼接结果
|
||||||
return beforeMask + maskedPart + afterMask;
|
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',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@ -15,10 +15,14 @@ const getRandomCount = () => {
|
|||||||
return (seed % 300) + 500;
|
return (seed % 300) + 500;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCommonShareMessage = (useCapture: boolean = true, inviteCode?: string): ShareAppMessageReturn => {
|
export const getCommonShareMessage = (
|
||||||
|
useCapture: boolean = true,
|
||||||
|
inviteCode?: string,
|
||||||
|
title?: string
|
||||||
|
): ShareAppMessageReturn => {
|
||||||
console.log('share share message', getJumpUrl(PageUrl.Job, inviteCode ? { c: inviteCode } : undefined));
|
console.log('share share message', getJumpUrl(PageUrl.Job, inviteCode ? { c: inviteCode } : undefined));
|
||||||
return {
|
return {
|
||||||
title: `昨天新增了${getRandomCount()}条主播通告,宝子快来看看`,
|
title: title || `昨天新增了${getRandomCount()}条主播通告,宝子快来看看`,
|
||||||
path: getJumpUrl(PageUrl.Job, inviteCode ? { c: inviteCode } : undefined),
|
path: getJumpUrl(PageUrl.Job, inviteCode ? { c: inviteCode } : undefined),
|
||||||
imageUrl: useCapture ? undefined : imageUrl,
|
imageUrl: useCapture ? undefined : imageUrl,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -151,3 +151,20 @@ export async function followGroup(blGroupId: FollowGroupRequest['blGroupId']) {
|
|||||||
|
|
||||||
export const getAgreementSigned = (): boolean | '' => Taro.getStorageSync(CacheKey.AGREEMENT_SIGNED);
|
export const getAgreementSigned = (): boolean | '' => Taro.getStorageSync(CacheKey.AGREEMENT_SIGNED);
|
||||||
export const setAgreementSigned = (signed: boolean) => Taro.setStorageSync(CacheKey.AGREEMENT_SIGNED, 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 checkCityCode = (cityCode: string): boolean => {
|
||||||
|
const cachedCityCodes = getCityCodes();
|
||||||
|
const isNewCityCode = cachedCityCodes.indexOf(cityCode) === -1;
|
||||||
|
if (cachedCityCodes.length === 2 && isNewCityCode) {
|
||||||
|
Toast.info('最多只能进入2个城市');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (isNewCityCode) {
|
||||||
|
setCityCodes([...cachedCityCodes, cityCode]);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user