|
|
|
@ -19,46 +19,8 @@ import { BUILD_VERSION, } from '@/config';
|
|
|
|
|
const { Header, Content, Footer } = Layout;
|
|
|
|
|
const { Title } = Typography;
|
|
|
|
|
|
|
|
|
|
let items = [];
|
|
|
|
|
|
|
|
|
|
const useItemDefault = () => {
|
|
|
|
|
const [data, setData] = useState([]);
|
|
|
|
|
const { t, i18n } = useTranslation();
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const newData = [
|
|
|
|
|
{ label: <Link to='/account/change-password'>{t('ChangePassword')}</Link>, key: '0' },
|
|
|
|
|
{ label: <Link to='/account/profile'>{t('Profile')}</Link>, key: '1' },
|
|
|
|
|
{ type: 'divider' },
|
|
|
|
|
{ label: <Link to='/login?out'>{t('Logout')}</Link>, key: '3' },
|
|
|
|
|
];
|
|
|
|
|
setData(newData);
|
|
|
|
|
}, [i18n.language]);
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
};
|
|
|
|
|
const useItemManager = () => {
|
|
|
|
|
const items_default = useItemDefault();
|
|
|
|
|
const [data, setData] = useState(items_default);
|
|
|
|
|
const { t, i18n } = useTranslation();
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const newData = [
|
|
|
|
|
{ label: <Link to='/account/change-password'>{t('ChangePassword')}</Link>, key: '0' },
|
|
|
|
|
{ label: <Link to='/account/profile'>{t('Profile')}</Link>, key: '1' },
|
|
|
|
|
{ type: 'divider' },
|
|
|
|
|
{ label: <Link to='/login?out'>{t('Logout')}</Link>, key: '3' },
|
|
|
|
|
{ label: <Link to='/account/change-vendor'>{t('ChangeVendor')}</Link>, key: '4' },
|
|
|
|
|
];
|
|
|
|
|
setData(newData);
|
|
|
|
|
}, [i18n.language]);
|
|
|
|
|
return data;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function App() {
|
|
|
|
|
const { t, i18n } = useTranslation();
|
|
|
|
|
const items_default = useItemDefault();
|
|
|
|
|
const item_manager = useItemManager();
|
|
|
|
|
|
|
|
|
|
const [password, setPassword] = useState('');
|
|
|
|
|
const { authStore, noticeStore } = useStore();
|
|
|
|
@ -70,14 +32,6 @@ function App() {
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
const location = useLocation();
|
|
|
|
|
|
|
|
|
|
const arrManager = config.arrManager; // ["testzp","testzac","testycc","testlyj","testqqs","testjjh","testhn"];//特定账号加修改所属供应商的菜单 zp
|
|
|
|
|
if (arrManager.includes(authStore.login.username)){
|
|
|
|
|
items = item_manager;
|
|
|
|
|
}else{
|
|
|
|
|
items = items_default;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (href !== '/login' && isEmpty(loginToken)) {
|
|
|
|
|
navigate('/login');
|
|
|
|
@ -194,7 +148,12 @@ function App() {
|
|
|
|
|
<Col span={2}>
|
|
|
|
|
<Dropdown
|
|
|
|
|
menu={{
|
|
|
|
|
items: [...items,
|
|
|
|
|
items: [...[
|
|
|
|
|
{ label: <Link to='/account/change-password'>{t('ChangePassword')}</Link>, key: '0' },
|
|
|
|
|
{ label: <Link to='/account/profile'>{t('Profile')}</Link>, key: '1' },
|
|
|
|
|
{ type: 'divider' },
|
|
|
|
|
{ label: <Link to='/login?out'>{t('Logout')}</Link>, key: '3' },
|
|
|
|
|
],
|
|
|
|
|
{ type: 'divider' },
|
|
|
|
|
{ label: <>v{BUILD_VERSION}</>, key: 'BUILD_VERSION' },
|
|
|
|
|
],
|
|
|
|
|