feat:
This commit is contained in:
@ -3,6 +3,7 @@ import Taro, { useDidShow, useLoad, useShareAppMessage } from '@tarojs/taro';
|
|||||||
import { Tabs } from '@taroify/core';
|
import { Tabs } from '@taroify/core';
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
|
import { AgreementPopup } from '@/components/agreement-popup';
|
||||||
import HomePage from '@/components/home-page';
|
import HomePage from '@/components/home-page';
|
||||||
import { LoginGuide } from '@/components/login-guide';
|
import { LoginGuide } from '@/components/login-guide';
|
||||||
import MaterialGuide from '@/components/material-guide';
|
import MaterialGuide from '@/components/material-guide';
|
||||||
@ -21,8 +22,7 @@ import { getInviteCodeFromQueryAndUpdate } from '@/utils/partner';
|
|||||||
import { getJumpUrl, getPageQuery, navigateTo } from '@/utils/route';
|
import { getJumpUrl, getPageQuery, navigateTo } from '@/utils/route';
|
||||||
import { getCommonShareMessage } from '@/utils/share';
|
import { getCommonShareMessage } from '@/utils/share';
|
||||||
import Toast from '@/utils/toast';
|
import Toast from '@/utils/toast';
|
||||||
import { isNeedCreateMaterial } from '@/utils/user';
|
import { getAgreementSigned, isNeedCreateMaterial, setAgreementSigned } from '@/utils/user';
|
||||||
|
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
const PREFIX = 'job';
|
const PREFIX = 'job';
|
||||||
@ -42,6 +42,7 @@ export default function Job() {
|
|||||||
const [showMaterialGuide, setShowMaterialGuide] = useState(false);
|
const [showMaterialGuide, setShowMaterialGuide] = useState(false);
|
||||||
const [showAuthorize, setShowAuthorize] = useState(false);
|
const [showAuthorize, setShowAuthorize] = useState(false);
|
||||||
const cityValuesChangedRef = useRef(false);
|
const cityValuesChangedRef = useRef(false);
|
||||||
|
const [openAgreementPopup, setAgreementPopupOpen] = useState(typeof getAgreementSigned() !== 'boolean');
|
||||||
|
|
||||||
const handleTypeChange = useCallback(value => setTabType(value), []);
|
const handleTypeChange = useCallback(value => setTabType(value), []);
|
||||||
|
|
||||||
@ -81,7 +82,15 @@ export default function Job() {
|
|||||||
setShowMaterialGuide(true);
|
setShowMaterialGuide(true);
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
const handleCancelAgreementPopup = () => {
|
||||||
|
setAgreementPopupOpen(false);
|
||||||
|
setAgreementSigned(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleConfirmAgreementPopup = () => {
|
||||||
|
setAgreementPopupOpen(false);
|
||||||
|
setAgreementSigned(true);
|
||||||
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Taro.eventCenter.on(EventName.SELECT_CITY, handleCityChange);
|
Taro.eventCenter.on(EventName.SELECT_CITY, handleCityChange);
|
||||||
return () => {
|
return () => {
|
||||||
@ -151,6 +160,11 @@ export default function Job() {
|
|||||||
<div>
|
<div>
|
||||||
<LoginGuide disabled={showAuthorize} onAfterBind={handleAfterBindPhone} />
|
<LoginGuide disabled={showAuthorize} onAfterBind={handleAfterBindPhone} />
|
||||||
{showMaterialGuide && <MaterialGuide onClose={() => setShowMaterialGuide(false)} />}
|
{showMaterialGuide && <MaterialGuide onClose={() => setShowMaterialGuide(false)} />}
|
||||||
|
<AgreementPopup
|
||||||
|
open={openAgreementPopup}
|
||||||
|
onCancel={handleCancelAgreementPopup}
|
||||||
|
onConfirm={handleConfirmAgreementPopup}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</HomePage>
|
</HomePage>
|
||||||
);
|
);
|
||||||
|
@ -1,88 +1,94 @@
|
|||||||
import { Image } from '@tarojs/components';
|
import { Image } from '@tarojs/components';
|
||||||
import { useLoad } from '@tarojs/taro';
|
import { useLoad } from '@tarojs/taro';
|
||||||
|
|
||||||
import { useState } from 'react';
|
// import { useEffect, useState } from 'react';
|
||||||
|
// import { AgreementPopup } from '@/components/agreement-popup';
|
||||||
import { AgreementPopup } from '@/components/agreement-popup';
|
// import Slogan from '@/components/slogan';
|
||||||
import Slogan from '@/components/slogan';
|
// import { PageUrl, RoleType } from '@/constants/app';
|
||||||
import { PageUrl, RoleType } from '@/constants/app';
|
// import { ANCHOR_TAB_LIST, COMPANY_TAB_LIST } from '@/hooks/use-config';
|
||||||
import { ANCHOR_TAB_LIST, COMPANY_TAB_LIST } from '@/hooks/use-config';
|
// import store from '@/store';
|
||||||
import store from '@/store';
|
// import { changeHomePage } from '@/store/actions';
|
||||||
import { changeHomePage } from '@/store/actions';
|
import { RoleType } from '@/constants/app';
|
||||||
import { getRoleType, switchDefaultTab, switchRoleType } from '@/utils/app';
|
import { getRoleType, switchDefaultTab, switchRoleType } from '@/utils/app';
|
||||||
import { switchTab } from '@/utils/route';
|
// import { switchTab } from '@/utils/route';
|
||||||
import { getAgreementSigned, setAgreementSigned } from '@/utils/user';
|
// import { getAgreementSigned, setAgreementSigned } from '@/utils/user';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
const PREFIX = 'page-start';
|
const PREFIX = 'page-start';
|
||||||
|
|
||||||
export default function Start() {
|
export default function Start() {
|
||||||
const [open, setOpen] = useState(typeof getAgreementSigned() !== 'boolean');
|
// const [open, setOpen] = useState(typeof getAgreementSigned() !== 'boolean');
|
||||||
const mode = getRoleType();
|
const mode = getRoleType();
|
||||||
useLoad(() => {
|
useLoad(() => {
|
||||||
|
if (!mode) {
|
||||||
|
switchRoleType(RoleType.Anchor).then(() => {
|
||||||
switchDefaultTab();
|
switchDefaultTab();
|
||||||
});
|
});
|
||||||
const handleAnchor = async () => {
|
} else {
|
||||||
await switchRoleType(RoleType.Anchor);
|
switchDefaultTab();
|
||||||
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 () => {
|
// const handleCompany = async () => {
|
||||||
await switchRoleType(RoleType.Company);
|
// await switchRoleType(RoleType.Company);
|
||||||
store.dispatch(changeHomePage(COMPANY_TAB_LIST[0].type));
|
// store.dispatch(changeHomePage(COMPANY_TAB_LIST[0].type));
|
||||||
await switchTab(COMPANY_TAB_LIST[0].pagePath as PageUrl);
|
// await switchTab(COMPANY_TAB_LIST[0].pagePath as PageUrl);
|
||||||
};
|
// };
|
||||||
|
|
||||||
const handleCancel = () => {
|
// const handleCancel = () => {
|
||||||
setOpen(false);
|
// setOpen(false);
|
||||||
setAgreementSigned(false);
|
// setAgreementSigned(false);
|
||||||
};
|
// };
|
||||||
|
//
|
||||||
const handleConfirm = () => {
|
// const handleConfirm = () => {
|
||||||
setOpen(false);
|
// setOpen(false);
|
||||||
setAgreementSigned(true);
|
// setAgreementSigned(true);
|
||||||
};
|
// };
|
||||||
return (
|
return (
|
||||||
<div className={`${PREFIX} ${mode ? '' : 'color-bg'}`}>
|
<div className={`${PREFIX}`}>
|
||||||
{mode && (
|
{/*{mode && (*/}
|
||||||
<div className={`${PREFIX}__app`}>
|
<div className={`${PREFIX}__app`}>
|
||||||
<Image className={`${PREFIX}__icon`} mode="aspectFit" src={require('@/statics/svg/slogan.svg')} />
|
<Image className={`${PREFIX}__icon`} mode="aspectFit" src={require('@/statics/svg/slogan.svg')} />
|
||||||
<div className={`${PREFIX}__text`}>每天推荐海量高薪通告 </div>
|
<div className={`${PREFIX}__text`}>每天推荐海量高薪通告 </div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
{/*)}*/}
|
||||||
{!mode && (
|
{!mode && (
|
||||||
<>
|
<>
|
||||||
<div className={`${PREFIX}__role-app`}>
|
{/*<div className={`${PREFIX}__role-app`}>*/}
|
||||||
<div className={`${PREFIX}__greet`}>Hi,很高兴见到你</div>
|
{/* <div className={`${PREFIX}__greet`}>Hi,很高兴见到你</div>*/}
|
||||||
<div className={`${PREFIX}__title`}>请选择您的身份</div>
|
{/* <div className={`${PREFIX}__title`}>请选择您的身份</div>*/}
|
||||||
<div className={`${PREFIX}__card`} onClick={handleAnchor}>
|
{/* <div className={`${PREFIX}__card`} onClick={handleAnchor}>*/}
|
||||||
<Image
|
{/* <Image*/}
|
||||||
className={`${PREFIX}__avatar anchor`}
|
{/* className={`${PREFIX}__avatar anchor`}*/}
|
||||||
src="https://publiccdn.neighbourhood.com.cn/img/avatar_f.png"
|
{/* src="https://publiccdn.neighbourhood.com.cn/img/avatar_f.png"*/}
|
||||||
mode="aspectFill"
|
{/* mode="aspectFill"*/}
|
||||||
/>
|
{/* />*/}
|
||||||
<div className={`${PREFIX}__content`}>
|
{/* <div className={`${PREFIX}__content`}>*/}
|
||||||
<div className="title">我是主播</div>
|
{/* <div className="title">我是主播</div>*/}
|
||||||
<div className="desc">我要找工作</div>
|
{/* <div className="desc">我要找工作</div>*/}
|
||||||
</div>
|
{/* </div>*/}
|
||||||
<Image src={require('@/statics/svg/arrow-right.svg')} mode="aspectFill" className={`${PREFIX}__arrow`} />
|
{/* <Image src={require('@/statics/svg/arrow-right.svg')} mode="aspectFill" className={`${PREFIX}__arrow`} />*/}
|
||||||
</div>
|
{/* </div>*/}
|
||||||
<div className={`${PREFIX}__card`} onClick={handleCompany}>
|
{/* <div className={`${PREFIX}__card`} onClick={handleCompany}>*/}
|
||||||
<Image
|
{/* <Image*/}
|
||||||
className={`${PREFIX}__avatar company`}
|
{/* className={`${PREFIX}__avatar company`}*/}
|
||||||
src="https://publiccdn.neighbourhood.com.cn/img/avatar_m.png"
|
{/* src="https://publiccdn.neighbourhood.com.cn/img/avatar_m.png"*/}
|
||||||
mode="aspectFill"
|
{/* mode="aspectFill"*/}
|
||||||
/>
|
{/* />*/}
|
||||||
<div className={`${PREFIX}__content`}>
|
{/* <div className={`${PREFIX}__content`}>*/}
|
||||||
<div className="title">我是企业</div>
|
{/* <div className="title">我是企业</div>*/}
|
||||||
<div className="desc">我要招主播</div>
|
{/* <div className="desc">我要招主播</div>*/}
|
||||||
</div>
|
{/* </div>*/}
|
||||||
<Image src={require('@/statics/svg/arrow-right.svg')} mode="aspectFill" className={`${PREFIX}__arrow`} />
|
{/* <Image src={require('@/statics/svg/arrow-right.svg')} mode="aspectFill" className={`${PREFIX}__arrow`} />*/}
|
||||||
</div>
|
{/* </div>*/}
|
||||||
</div>
|
{/*</div>*/}
|
||||||
<Slogan />
|
{/*<Slogan />*/}
|
||||||
<AgreementPopup open={open} onCancel={handleCancel} onConfirm={handleConfirm} />
|
{/*<AgreementPopup open={open} onCancel={handleCancel} onConfirm={handleConfirm} />*/}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user