feat: login
This commit is contained in:
@ -4,7 +4,6 @@ import { Tabs } from '@taroify/core';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import HomePage from '@/components/home-page';
|
||||
import LocationDialog from '@/components/location-dialog';
|
||||
import { LoginGuide } from '@/components/login-guide';
|
||||
import MaterialGuide from '@/components/material-guide';
|
||||
import { EventName, OpenSource, PageUrl } from '@/constants/app';
|
||||
@ -82,13 +81,6 @@ export default function Job() {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleCloseAuthorize = useCallback(() => setShowAuthorize(false), []);
|
||||
|
||||
const handleClickAuthorize = useCallback(() => {
|
||||
requestLocation(true);
|
||||
setShowAuthorize(false);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
Taro.eventCenter.on(EventName.SELECT_CITY, handleCityChange);
|
||||
return () => {
|
||||
@ -116,6 +108,7 @@ export default function Job() {
|
||||
} else {
|
||||
log('show authorize location dialog');
|
||||
setShowAuthorize(true);
|
||||
requestLocation(true);
|
||||
}
|
||||
});
|
||||
|
||||
@ -154,7 +147,6 @@ export default function Job() {
|
||||
))}
|
||||
</Tabs>
|
||||
<div>
|
||||
<LocationDialog open={showAuthorize} onClose={handleCloseAuthorize} onClick={handleClickAuthorize} />
|
||||
<LoginGuide disabled={showAuthorize} onAfterBind={handleAfterBindPhone} />
|
||||
{showMaterialGuide && <MaterialGuide onClose={() => setShowMaterialGuide(false)} />}
|
||||
</div>
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
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';
|
||||
@ -8,12 +11,13 @@ import store from '@/store';
|
||||
import { changeHomePage } from '@/store/actions';
|
||||
import { getRoleType, switchDefaultTab, switchRoleType } from '@/utils/app';
|
||||
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 mode = getRoleType();
|
||||
useLoad(() => {
|
||||
switchDefaultTab();
|
||||
@ -30,6 +34,15 @@ export default function Start() {
|
||||
await switchTab(COMPANY_TAB_LIST[0].pagePath as PageUrl);
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
setOpen(false);
|
||||
setAgreementSigned(false);
|
||||
};
|
||||
|
||||
const handleConfirm = () => {
|
||||
setOpen(false);
|
||||
setAgreementSigned(true);
|
||||
};
|
||||
return (
|
||||
<div className={`${PREFIX} ${mode ? '' : 'color-bg'}`}>
|
||||
{mode && (
|
||||
@ -69,6 +82,7 @@ export default function Start() {
|
||||
</div>
|
||||
</div>
|
||||
<Slogan />
|
||||
<AgreementPopup open={open} onCancel={handleCancel} onConfirm={handleConfirm} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user