feat: update

This commit is contained in:
chashaobao
2025-06-27 22:46:24 +08:00
parent 0020eb8dbe
commit de2f380cd9
22 changed files with 183 additions and 59 deletions

View File

@ -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>
);
}

View File

@ -80,4 +80,8 @@
margin-top: 24px;
}
}
}
&__no-subscription {
}
}

View File

@ -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}>

View File

@ -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>