Skip to content

Commit

Permalink
💥 feat(appConfig): appConfig enabled (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwnmengjing committed Apr 14, 2024
1 parent 1a224ea commit d51ec91
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 222 deletions.
176 changes: 0 additions & 176 deletions mock/listTableList.ts

This file was deleted.

6 changes: 5 additions & 1 deletion src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Question, SelectLang } from '@/components/RightContent';
import { LinkOutlined } from '@ant-design/icons';
import type { Settings as LayoutSettings } from '@ant-design/pro-components';
import { SettingDrawer } from '@ant-design/pro-components';
import type { RunTimeLayoutConfig } from '@umijs/max';
import { RunTimeLayoutConfig } from '@umijs/max';
import { addLocale, FormattedMessage, history, Link } from '@umijs/max';
import defaultSettings from '../config/defaultSettings';
import { errorConfig } from './requestErrorConfig';
Expand Down Expand Up @@ -68,6 +68,9 @@ export async function getInitialState(): Promise<{
// 如果不是登录页面,执行
const { location } = history;
const appConfig = await getAppConfigsNoAuthProfile();
//set title
defaultSettings.title = appConfig?.base?.websiteName || 'mss-boot-admin';
defaultSettings.logo = appConfig?.base?.websiteLogo || 'https://docs.mss-boot-io.top/favicon.ico';
if (location.pathname !== loginPath && !callbackPath.includes(location.pathname)) {
const currentUser = await fetchUserInfo();
return {
Expand All @@ -87,6 +90,7 @@ export async function getInitialState(): Promise<{
// ProLayout 支持的api https://procomponents.ant.design/components/layout
export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) => {
return {
title: initialState?.appConfig?.base?.websiteName || 'mss-boot-admin',
menu: {
request: async () => {
const menuData = await getMenuAuthorize();
Expand Down
14 changes: 9 additions & 5 deletions src/components/Footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { GithubOutlined } from '@ant-design/icons';
import { DefaultFooter } from '@ant-design/pro-components';
import { useIntl } from '@umijs/max';
import { useIntl, useModel } from '@umijs/max';
import React from 'react';

const Footer: React.FC = () => {
const intl = useIntl();
const defaultMessage = intl.formatMessage({ id: 'app.copyright.produced' });
const { initialState } = useModel('@@initialState');

const defaultMessage =
initialState?.appConfig?.base?.websiteCopyRight ||
intl.formatMessage({ id: 'app.copyright.produced' });

const currentYear = new Date().getFullYear();

Expand All @@ -17,9 +21,9 @@ const Footer: React.FC = () => {
copyright={`${currentYear} ${defaultMessage}`}
links={[
{
key: 'mss-boot-io',
title: 'mss-boot-io',
href: 'https://github.com/mss-boot-io/mss-boot',
key: 'beian',
title: initialState?.appConfig?.base?.websiteRecordNumber,
href: 'http://beian.miit.gov.cn',
blankTarget: true,
},
{
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import pages from './en-US/pages';
import pwa from './en-US/pwa';
import settingDrawer from './en-US/settingDrawer';
import settings from './en-US/settings';
import custom from './en-US/custom';

export default {
'navBar.lang': 'Languages',
Expand All @@ -23,4 +24,5 @@ export default {
...pwa,
...component,
...pages,
...custom,
};
1 change: 1 addition & 0 deletions src/locales/en-US/custom.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
2 changes: 2 additions & 0 deletions src/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import pages from './zh-CN/pages';
import pwa from './zh-CN/pwa';
import settingDrawer from './zh-CN/settingDrawer';
import settings from './zh-CN/settings';
import custom from './en-US/custom';

export default {
'navBar.lang': '语言',
Expand All @@ -23,4 +24,5 @@ export default {
...settings,
...pwa,
...component,
...custom,
};
1 change: 1 addition & 0 deletions src/locales/zh-CN/custom.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
66 changes: 66 additions & 0 deletions src/pages/AppConfig/components/BaseView.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// @import '~antd/es/style/themes/default.less';

.baseView {
display: flex;
padding-top: 12px;

:global {
.ant-legacy-form-item .ant-legacy-form-item-control-wrapper {
width: 100%;
}
}

.left {
min-width: 224px;
max-width: 448px;
width: 50%;
}
.right {
flex: 1;
padding-left: 104px;
.avatar_title {
height: 22px;
margin-bottom: 8px;
color: @heading-color;
font-size: @font-size-base;
line-height: 22px;
}
.avatar {
width: 144px;
height: 144px;
margin-bottom: 12px;
overflow: hidden;
img {
width: 100%;
}
}
.button_view {
width: 144px;
text-align: center;
}
}
}

.area_code {
width: 72px;
}
.phone_number {
width: 214px;
}

@media screen and (max-width: @screen-xl) {
.baseView {
flex-direction: column-reverse;

.right {
display: flex;
flex-direction: column;
align-items: center;
max-width: 448px;
padding: 20px;
.avatar_title {
display: none;
}
}
}
}
Loading

0 comments on commit d51ec91

Please sign in to comment.