feat
This commit is contained in:
@ -6,7 +6,7 @@ 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 { getAgreementSigned, isNeedLogin, setAgreementSigned } from '@/utils/user';
|
||||
import { getAgreementSigned, isNeedLogin, requestUserInfo, setAgreementSigned } from '@/utils/user';
|
||||
|
||||
import './index.less';
|
||||
|
||||
@ -18,13 +18,14 @@ export enum BindPhoneStatus {
|
||||
|
||||
export interface ILoginButtonProps extends ButtonProps {
|
||||
needPhone?: boolean;
|
||||
needRefresh?: boolean;
|
||||
needAssignment?: boolean;
|
||||
}
|
||||
|
||||
const PREFIX = 'login-button';
|
||||
|
||||
function LoginButton(props: ILoginButtonProps) {
|
||||
const { className, children, needPhone, onClick, ...otherProps } = props;
|
||||
const { className, children, needPhone, onClick, needRefresh, ...otherProps } = props;
|
||||
const userInfo = useUserInfo();
|
||||
const [loginVisible, setLoginVisible] = useState(false);
|
||||
const [assignVisible, setAssignVisible] = useState(false);
|
||||
@ -70,9 +71,12 @@ function LoginButton(props: ILoginButtonProps) {
|
||||
const handleLoginSuccess = useCallback(
|
||||
e => {
|
||||
setLoginVisible(false);
|
||||
if (needRefresh) {
|
||||
requestUserInfo();
|
||||
}
|
||||
onClick?.(e);
|
||||
},
|
||||
[onClick]
|
||||
[needRefresh, onClick]
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@ -200,14 +200,14 @@ const AnchorFooter = (props: { data: JobDetails }) => {
|
||||
<Button className={`${PREFIX}__share-button`} openType="share">
|
||||
分享
|
||||
</Button>
|
||||
<LoginButton className={`${PREFIX}__contact-publisher`} onClick={handleClickContact}>
|
||||
<LoginButton needRefresh className={`${PREFIX}__contact-publisher`} onClick={handleClickContact}>
|
||||
{data.isAuthed ? '在线沟通' : '查看联系方式'}
|
||||
{!productRecord && (data.isAuthed || productInfo?.content) ? (
|
||||
{needPhone ? (
|
||||
<div className={`${PREFIX}__contact-publisher-tag`}>登录后可免费报单</div>
|
||||
) : !productRecord && (data.isAuthed || productInfo?.content) ? (
|
||||
<div className={`${PREFIX}__contact-publisher-tag`}>
|
||||
{data.isAuthed ? '急招岗位可免费查看' : productInfo?.content}
|
||||
</div>
|
||||
) : needPhone ? (
|
||||
<div className={`${PREFIX}__contact-publisher-tag`}>登录后可免费报单</div>
|
||||
) : null}
|
||||
</LoginButton>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user