From 81ee2c129622a449de44fa019e48c524b538dd92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=84=9A=E9=81=93?= Date: Fri, 7 Dec 2018 19:06:59 +0800 Subject: [PATCH] remove pages --- .eslintignore | 2 +- config/config.js | 21 +- config/router.config.js | 263 ------- src/layouts/BasicLayout.js | 3 +- src/pages/404.js | 13 - src/pages/Account/Center/Applications.js | 88 --- src/pages/Account/Center/Articles.js | 59 -- src/pages/Account/Center/Articles.less | 12 - src/pages/Account/Center/Center.js | 216 ------ src/pages/Account/Center/Center.less | 97 --- src/pages/Account/Center/Projects.js | 52 -- src/pages/Account/Settings/BaseView.js | 192 ----- src/pages/Account/Settings/BaseView.less | 52 -- src/pages/Account/Settings/BindingView.js | 60 -- src/pages/Account/Settings/GeographicView.js | 128 ---- .../Account/Settings/GeographicView.less | 19 - src/pages/Account/Settings/Info.js | 125 ---- src/pages/Account/Settings/Info.less | 97 --- .../Account/Settings/NotificationView.js | 50 -- src/pages/Account/Settings/PhoneView.js | 33 - src/pages/Account/Settings/PhoneView.less | 11 - src/pages/Account/Settings/SecurityView.js | 102 --- .../Account/Settings/models/geographic.js | 65 -- src/pages/BasicDemo.js | 3 + src/pages/Dashboard/Analysis.js | 187 ----- src/pages/Dashboard/Analysis.less | 197 ----- src/pages/Dashboard/IntroduceRow.js | 144 ---- src/pages/Dashboard/Monitor.js | 245 ------- src/pages/Dashboard/Monitor.less | 23 - src/pages/Dashboard/OfflineData.js | 65 -- src/pages/Dashboard/ProportionSales.js | 58 -- src/pages/Dashboard/SalesCard.js | 150 ---- src/pages/Dashboard/TopSearch.js | 111 --- src/pages/Dashboard/Workplace.js | 256 ------- src/pages/Dashboard/Workplace.less | 227 ------ src/pages/Dashboard/models/activities.js | 28 - src/pages/Dashboard/models/chart.js | 61 -- src/pages/Dashboard/models/monitor.js | 28 - src/pages/Exception/403.js | 15 - src/pages/Exception/404.js | 15 - src/pages/Exception/500.js | 15 - src/pages/Exception/TriggerException.js | 50 -- src/pages/Exception/models/error.js | 28 - src/pages/Exception/style.less | 7 - src/pages/Forms/AdvancedForm.js | 323 --------- src/pages/Forms/BasicForm.js | 247 ------- src/pages/Forms/StepForm/Step1.js | 115 --- src/pages/Forms/StepForm/Step2.js | 99 --- src/pages/Forms/StepForm/Step3.js | 74 -- src/pages/Forms/StepForm/index.js | 46 -- src/pages/Forms/StepForm/style.less | 78 -- src/pages/Forms/TableForm.js | 261 ------- src/pages/Forms/models/form.js | 47 -- src/pages/Forms/style.less | 90 --- src/pages/List/Applications.js | 183 ----- src/pages/List/Applications.less | 43 -- src/pages/List/Articles.js | 242 ------ src/pages/List/Articles.less | 31 - src/pages/List/BasicList.js | 340 --------- src/pages/List/BasicList.less | 195 ----- src/pages/List/CardList.js | 101 --- src/pages/List/CardList.less | 113 --- src/pages/List/List.js | 80 -- src/pages/List/Projects.js | 154 ---- src/pages/List/Projects.less | 57 -- src/pages/List/TableList.js | 686 ------------------ src/pages/List/TableList.less | 49 -- src/pages/List/models/rule.js | 55 -- src/pages/Profile/AdvancedProfile.js | 353 --------- src/pages/Profile/AdvancedProfile.less | 54 -- src/pages/Profile/BasicProfile.js | 185 ----- src/pages/Profile/BasicProfile.less | 8 - src/pages/Profile/models/profile.js | 38 - src/pages/Result/Error.js | 66 -- src/pages/Result/Success.js | 144 ---- src/pages/Result/Success.test.js | 9 - src/pages/User/Login.js | 168 ----- src/pages/User/Login.less | 32 - src/pages/User/Register.js | 334 --------- src/pages/User/Register.less | 57 -- src/pages/User/RegisterResult.js | 41 -- src/pages/User/RegisterResult.less | 18 - src/pages/User/models/register.js | 32 - src/pages/document.ejs | 15 - 84 files changed, 25 insertions(+), 8911 deletions(-) delete mode 100644 config/router.config.js delete mode 100644 src/pages/404.js delete mode 100644 src/pages/Account/Center/Applications.js delete mode 100644 src/pages/Account/Center/Articles.js delete mode 100644 src/pages/Account/Center/Articles.less delete mode 100644 src/pages/Account/Center/Center.js delete mode 100644 src/pages/Account/Center/Center.less delete mode 100644 src/pages/Account/Center/Projects.js delete mode 100644 src/pages/Account/Settings/BaseView.js delete mode 100644 src/pages/Account/Settings/BaseView.less delete mode 100644 src/pages/Account/Settings/BindingView.js delete mode 100644 src/pages/Account/Settings/GeographicView.js delete mode 100644 src/pages/Account/Settings/GeographicView.less delete mode 100644 src/pages/Account/Settings/Info.js delete mode 100644 src/pages/Account/Settings/Info.less delete mode 100644 src/pages/Account/Settings/NotificationView.js delete mode 100644 src/pages/Account/Settings/PhoneView.js delete mode 100644 src/pages/Account/Settings/PhoneView.less delete mode 100644 src/pages/Account/Settings/SecurityView.js delete mode 100644 src/pages/Account/Settings/models/geographic.js create mode 100644 src/pages/BasicDemo.js delete mode 100644 src/pages/Dashboard/Analysis.js delete mode 100644 src/pages/Dashboard/Analysis.less delete mode 100755 src/pages/Dashboard/IntroduceRow.js delete mode 100644 src/pages/Dashboard/Monitor.js delete mode 100644 src/pages/Dashboard/Monitor.less delete mode 100755 src/pages/Dashboard/OfflineData.js delete mode 100755 src/pages/Dashboard/ProportionSales.js delete mode 100755 src/pages/Dashboard/SalesCard.js delete mode 100755 src/pages/Dashboard/TopSearch.js delete mode 100644 src/pages/Dashboard/Workplace.js delete mode 100644 src/pages/Dashboard/Workplace.less delete mode 100644 src/pages/Dashboard/models/activities.js delete mode 100644 src/pages/Dashboard/models/chart.js delete mode 100644 src/pages/Dashboard/models/monitor.js delete mode 100644 src/pages/Exception/403.js delete mode 100644 src/pages/Exception/404.js delete mode 100644 src/pages/Exception/500.js delete mode 100644 src/pages/Exception/TriggerException.js delete mode 100644 src/pages/Exception/models/error.js delete mode 100644 src/pages/Exception/style.less delete mode 100644 src/pages/Forms/AdvancedForm.js delete mode 100644 src/pages/Forms/BasicForm.js delete mode 100644 src/pages/Forms/StepForm/Step1.js delete mode 100644 src/pages/Forms/StepForm/Step2.js delete mode 100644 src/pages/Forms/StepForm/Step3.js delete mode 100644 src/pages/Forms/StepForm/index.js delete mode 100644 src/pages/Forms/StepForm/style.less delete mode 100644 src/pages/Forms/TableForm.js delete mode 100644 src/pages/Forms/models/form.js delete mode 100644 src/pages/Forms/style.less delete mode 100644 src/pages/List/Applications.js delete mode 100644 src/pages/List/Applications.less delete mode 100644 src/pages/List/Articles.js delete mode 100644 src/pages/List/Articles.less delete mode 100644 src/pages/List/BasicList.js delete mode 100644 src/pages/List/BasicList.less delete mode 100644 src/pages/List/CardList.js delete mode 100644 src/pages/List/CardList.less delete mode 100644 src/pages/List/List.js delete mode 100644 src/pages/List/Projects.js delete mode 100644 src/pages/List/Projects.less delete mode 100644 src/pages/List/TableList.js delete mode 100644 src/pages/List/TableList.less delete mode 100644 src/pages/List/models/rule.js delete mode 100644 src/pages/Profile/AdvancedProfile.js delete mode 100644 src/pages/Profile/AdvancedProfile.less delete mode 100644 src/pages/Profile/BasicProfile.js delete mode 100644 src/pages/Profile/BasicProfile.less delete mode 100644 src/pages/Profile/models/profile.js delete mode 100644 src/pages/Result/Error.js delete mode 100644 src/pages/Result/Success.js delete mode 100644 src/pages/Result/Success.test.js delete mode 100644 src/pages/User/Login.js delete mode 100644 src/pages/User/Login.less delete mode 100644 src/pages/User/Register.js delete mode 100644 src/pages/User/Register.less delete mode 100644 src/pages/User/RegisterResult.js delete mode 100644 src/pages/User/RegisterResult.less delete mode 100644 src/pages/User/models/register.js delete mode 100644 src/pages/document.ejs diff --git a/.eslintignore b/.eslintignore index 43ab7824..576c8151 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,3 @@ /functions/mock/** /scripts -/config \ No newline at end of file +/config diff --git a/config/config.js b/config/config.js index 887b0614..1d5f2530 100644 --- a/config/config.js +++ b/config/config.js @@ -1,6 +1,5 @@ // https://umijs.org/config/ import os from 'os'; -import pageRoutes from './router.config'; import webpackPlugin from './plugin.config'; import defaultSettings from '../src/defaultSettings'; import slash from 'slash2'; @@ -63,7 +62,25 @@ export default { ie: 11, }, // 路由配置 - routes: pageRoutes, + routes: [{ + path: '/user', + components: ['../layouts/UserLayout'], + routes: [], + }, { + path: '/', + component: '../layouts/BasicLayout', + Routes: ['src/pages/Authorized'], + authority: ['admin', 'user'], + routes: [ + // dashboard + { + path: '/', + name: 'dashboard', + icon: 'dashboard', + component: './BasicDemo', + }, + ], + }], // Theme for antd // https://ant.design/docs/react/customize-theme-cn theme: { diff --git a/config/router.config.js b/config/router.config.js deleted file mode 100644 index 656027d2..00000000 --- a/config/router.config.js +++ /dev/null @@ -1,263 +0,0 @@ -export default [ - // user - { - path: '/user', - component: '../layouts/UserLayout', - routes: [ - { path: '/user', redirect: '/user/login' }, - { path: '/user/login', component: './User/Login' }, - { path: '/user/register', component: './User/Register' }, - { path: '/user/register-result', component: './User/RegisterResult' }, - ], - }, - // app - { - path: '/', - component: '../layouts/BasicLayout', - Routes: ['src/pages/Authorized'], - authority: ['admin', 'user'], - routes: [ - // dashboard - { path: '/', redirect: '/dashboard/analysis' }, - { - path: '/dashboard', - name: 'dashboard', - icon: 'dashboard', - routes: [ - { - path: '/dashboard/analysis', - name: 'analysis', - component: './Dashboard/Analysis', - }, - { - path: '/dashboard/monitor', - name: 'monitor', - component: './Dashboard/Monitor', - }, - { - path: '/dashboard/workplace', - name: 'workplace', - component: './Dashboard/Workplace', - }, - ], - }, - // forms - { - path: '/form', - icon: 'form', - name: 'form', - routes: [ - { - path: '/form/basic-form', - name: 'basicform', - component: './Forms/BasicForm', - }, - { - path: '/form/step-form', - name: 'stepform', - component: './Forms/StepForm', - hideChildrenInMenu: true, - routes: [ - { - path: '/form/step-form', - redirect: '/form/step-form/info', - }, - { - path: '/form/step-form/info', - name: 'info', - component: './Forms/StepForm/Step1', - }, - { - path: '/form/step-form/confirm', - name: 'confirm', - component: './Forms/StepForm/Step2', - }, - { - path: '/form/step-form/result', - name: 'result', - component: './Forms/StepForm/Step3', - }, - ], - }, - { - path: '/form/advanced-form', - name: 'advancedform', - authority: ['admin'], - component: './Forms/AdvancedForm', - }, - ], - }, - // list - { - path: '/list', - icon: 'table', - name: 'list', - routes: [ - { - path: '/list/table-list', - name: 'searchtable', - component: './List/TableList', - }, - { - path: '/list/basic-list', - name: 'basiclist', - component: './List/BasicList', - }, - { - path: '/list/card-list', - name: 'cardlist', - component: './List/CardList', - }, - { - path: '/list/search', - name: 'searchlist', - component: './List/List', - routes: [ - { - path: '/list/search', - redirect: '/list/search/articles', - }, - { - path: '/list/search/articles', - name: 'articles', - component: './List/Articles', - }, - { - path: '/list/search/projects', - name: 'projects', - component: './List/Projects', - }, - { - path: '/list/search/applications', - name: 'applications', - component: './List/Applications', - }, - ], - }, - ], - }, - { - path: '/profile', - name: 'profile', - icon: 'profile', - routes: [ - // profile - { - path: '/profile/basic', - name: 'basic', - component: './Profile/BasicProfile', - }, - { - path: '/profile/advanced', - name: 'advanced', - authority: ['admin'], - component: './Profile/AdvancedProfile', - }, - ], - }, - { - name: 'result', - icon: 'check-circle-o', - path: '/result', - routes: [ - // result - { - path: '/result/success', - name: 'success', - component: './Result/Success', - }, - { path: '/result/fail', name: 'fail', component: './Result/Error' }, - ], - }, - { - name: 'exception', - icon: 'warning', - path: '/exception', - routes: [ - // exception - { - path: '/exception/403', - name: 'not-permission', - component: './Exception/403', - }, - { - path: '/exception/404', - name: 'not-find', - component: './Exception/404', - }, - { - path: '/exception/500', - name: 'server-error', - component: './Exception/500', - }, - { - path: '/exception/trigger', - name: 'trigger', - hideInMenu: true, - component: './Exception/TriggerException', - }, - ], - }, - { - name: 'account', - icon: 'user', - path: '/account', - routes: [ - { - path: '/account/center', - name: 'center', - component: './Account/Center/Center', - routes: [ - { - path: '/account/center', - redirect: '/account/center/articles', - }, - { - path: '/account/center/articles', - component: './Account/Center/Articles', - }, - { - path: '/account/center/applications', - component: './Account/Center/Applications', - }, - { - path: '/account/center/projects', - component: './Account/Center/Projects', - }, - ], - }, - { - path: '/account/settings', - name: 'settings', - component: './Account/Settings/Info', - routes: [ - { - path: '/account/settings', - redirect: '/account/settings/base', - }, - { - path: '/account/settings/base', - component: './Account/Settings/BaseView', - }, - { - path: '/account/settings/security', - component: './Account/Settings/SecurityView', - }, - { - path: '/account/settings/binding', - component: './Account/Settings/BindingView', - }, - { - path: '/account/settings/notification', - component: './Account/Settings/NotificationView', - }, - ], - }, - ], - }, - { - component: '404', - }, - ], - }, -]; diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 914f47f8..b121b452 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -14,7 +14,6 @@ import logo from '../assets/logo.svg'; import Footer from './Footer'; import Header from './Header'; import Context from './MenuContext'; -import Exception403 from '../pages/Exception/403'; import PageLoading from '@/components/PageLoading'; import SiderMenu from '@/components/SiderMenu'; import { title } from '../defaultSettings'; @@ -25,6 +24,8 @@ const SettingDrawer = React.lazy(() => import('@/components/SettingDrawer')); const { Content } = Layout; +const Exception403 =

Exception403

; + const query = { 'screen-xs': { maxWidth: 575, diff --git a/src/pages/404.js b/src/pages/404.js deleted file mode 100644 index 627797ae..00000000 --- a/src/pages/404.js +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react'; -import Link from 'umi/link'; -import { formatMessage } from 'umi/locale'; -import Exception from 'ant-design-pro/lib/Exception'; - -export default () => ( - -); diff --git a/src/pages/Account/Center/Applications.js b/src/pages/Account/Center/Applications.js deleted file mode 100644 index 031686cd..00000000 --- a/src/pages/Account/Center/Applications.js +++ /dev/null @@ -1,88 +0,0 @@ -import React, { PureComponent } from 'react'; -import { List, Card, Icon, Dropdown, Menu, Avatar, Tooltip } from 'antd'; -import numeral from 'numeral'; -import { connect } from 'dva'; -import { formatWan } from '@/utils/utils'; -import stylesApplications from '../../List/Applications.less'; - -@connect(({ list }) => ({ - list, -})) -class Center extends PureComponent { - render() { - const { - list: { list }, - } = this.props; - const itemMenu = ( - - - - 1st menu item - - - - - 2nd menu item - - - - - 3d menu item - - - - ); - const CardInfo = ({ activeUser, newUser }) => ( -
-
-

活跃用户

-

{activeUser}

-
-
-

新增用户

-

{newUser}

-
-
- ); - return ( - ( - - - - , - - - , - - - , - - - , - ]} - > - } title={item.title} /> -
- -
-
-
- )} - /> - ); - } -} - -export default Center; diff --git a/src/pages/Account/Center/Articles.js b/src/pages/Account/Center/Articles.js deleted file mode 100644 index 9bb5ac30..00000000 --- a/src/pages/Account/Center/Articles.js +++ /dev/null @@ -1,59 +0,0 @@ -import React, { PureComponent } from 'react'; -import { List, Icon, Tag } from 'antd'; -import { connect } from 'dva'; -import ArticleListContent from '@/components/ArticleListContent'; -import styles from './Articles.less'; - -@connect(({ list }) => ({ - list, -})) -class Center extends PureComponent { - render() { - const { - list: { list }, - } = this.props; - const IconText = ({ type, text }) => ( - - - {text} - - ); - return ( - ( - , - , - , - ]} - > - - {item.title} - - } - description={ - - Ant Design - 设计语言 - 蚂蚁金服 - - } - /> - - - )} - /> - ); - } -} - -export default Center; diff --git a/src/pages/Account/Center/Articles.less b/src/pages/Account/Center/Articles.less deleted file mode 100644 index 2e51509b..00000000 --- a/src/pages/Account/Center/Articles.less +++ /dev/null @@ -1,12 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.articleList { - :global { - .ant-list-item:first-child { - padding-top: 0; - } - } -} -a.listItemMetaTitle { - color: @heading-color; -} diff --git a/src/pages/Account/Center/Center.js b/src/pages/Account/Center/Center.js deleted file mode 100644 index d2512f95..00000000 --- a/src/pages/Account/Center/Center.js +++ /dev/null @@ -1,216 +0,0 @@ -import React, { PureComponent } from 'react'; -import { connect } from 'dva'; -import Link from 'umi/link'; -import router from 'umi/router'; -import { Card, Row, Col, Icon, Avatar, Tag, Divider, Spin, Input } from 'antd'; -import GridContent from '@/components/PageHeaderWrapper/GridContent'; -import styles from './Center.less'; - -@connect(({ loading, user, project }) => ({ - listLoading: loading.effects['list/fetch'], - currentUser: user.currentUser, - currentUserLoading: loading.effects['user/fetchCurrent'], - project, - projectLoading: loading.effects['project/fetchNotice'], -})) -class Center extends PureComponent { - state = { - newTags: [], - inputVisible: false, - inputValue: '', - }; - - componentDidMount() { - const { dispatch } = this.props; - dispatch({ - type: 'user/fetchCurrent', - }); - dispatch({ - type: 'list/fetch', - payload: { - count: 8, - }, - }); - dispatch({ - type: 'project/fetchNotice', - }); - } - - onTabChange = key => { - const { match } = this.props; - switch (key) { - case 'articles': - router.push(`${match.url}/articles`); - break; - case 'applications': - router.push(`${match.url}/applications`); - break; - case 'projects': - router.push(`${match.url}/projects`); - break; - default: - break; - } - }; - - showInput = () => { - this.setState({ inputVisible: true }, () => this.input.focus()); - }; - - saveInputRef = input => { - this.input = input; - }; - - handleInputChange = e => { - this.setState({ inputValue: e.target.value }); - }; - - handleInputConfirm = () => { - const { state } = this; - const { inputValue } = state; - let { newTags } = state; - if (inputValue && newTags.filter(tag => tag.label === inputValue).length === 0) { - newTags = [...newTags, { key: `new-${newTags.length}`, label: inputValue }]; - } - this.setState({ - newTags, - inputVisible: false, - inputValue: '', - }); - }; - - render() { - const { newTags, inputVisible, inputValue } = this.state; - const { - listLoading, - currentUser, - currentUserLoading, - project: { notice }, - projectLoading, - match, - location, - children, - } = this.props; - - const operationTabList = [ - { - key: 'articles', - tab: ( - - 文章 (8) - - ), - }, - { - key: 'applications', - tab: ( - - 应用 (8) - - ), - }, - { - key: 'projects', - tab: ( - - 项目 (8) - - ), - }, - ]; - - return ( - - - - - {currentUser && Object.keys(currentUser).length ? ( -
-
- -
{currentUser.name}
-
{currentUser.signature}
-
-
-

- - {currentUser.title} -

-

- - {currentUser.group} -

-

- - {currentUser.geographic.province.label} - {currentUser.geographic.city.label} -

-
- -
-
标签
- {currentUser.tags.concat(newTags).map(item => ( - {item.label} - ))} - {inputVisible && ( - - )} - {!inputVisible && ( - - - - )} -
- -
-
团队
- - - {notice.map(item => ( - - - - {item.member} - - - ))} - - -
-
- ) : ( - 'loading...' - )} -
- - - - {children} - - -
-
- ); - } -} - -export default Center; diff --git a/src/pages/Account/Center/Center.less b/src/pages/Account/Center/Center.less deleted file mode 100644 index 37d6a203..00000000 --- a/src/pages/Account/Center/Center.less +++ /dev/null @@ -1,97 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; -@import '~@/utils/utils.less'; - -.avatarHolder { - text-align: center; - margin-bottom: 24px; - - & > img { - width: 104px; - height: 104px; - margin-bottom: 20px; - } - - .name { - font-size: 20px; - line-height: 28px; - font-weight: 500; - color: @heading-color; - margin-bottom: 4px; - } -} - -.detail { - p { - margin-bottom: 8px; - padding-left: 26px; - position: relative; - - &:last-child { - margin-bottom: 0; - } - } - - i { - position: absolute; - height: 14px; - width: 14px; - left: 0; - top: 4px; - background: url(https://gw.alipayobjects.com/zos/rmsportal/pBjWzVAHnOOtAUvZmZfy.svg); - - &.title { - background-position: 0 0; - } - - &.group { - background-position: 0 -22px; - } - - &.address { - background-position: 0 -44px; - } - } -} - -.tagsTitle, -.teamTitle { - font-weight: 500; - color: @heading-color; - margin-bottom: 12px; -} - -.tags { - :global { - .ant-tag { - margin-bottom: 8px; - } - } -} - -.team { - :global { - .ant-avatar { - margin-right: 12px; - } - } - - a { - display: block; - margin-bottom: 24px; - color: @text-color; - transition: color 0.3s; - .textOverflow(); - - &:hover { - color: @primary-color; - } - } -} - -.tabsCard { - :global { - .ant-card-head { - padding: 0 16px; - } - } -} diff --git a/src/pages/Account/Center/Projects.js b/src/pages/Account/Center/Projects.js deleted file mode 100644 index ec0a358b..00000000 --- a/src/pages/Account/Center/Projects.js +++ /dev/null @@ -1,52 +0,0 @@ -import React, { PureComponent } from 'react'; -import { List, Card } from 'antd'; -import moment from 'moment'; -import { connect } from 'dva'; -import AvatarList from 'ant-design-pro/lib/AvatarList'; -import stylesProjects from '../../List/Projects.less'; - -@connect(({ list }) => ({ - list, -})) -class Center extends PureComponent { - render() { - const { - list: { list }, - } = this.props; - return ( - ( - - } - > - {item.title}} description={item.subDescription} /> -
- {moment(item.updatedAt).fromNow()} -
- - {item.members.map(member => ( - - ))} - -
-
-
-
- )} - /> - ); - } -} - -export default Center; diff --git a/src/pages/Account/Settings/BaseView.js b/src/pages/Account/Settings/BaseView.js deleted file mode 100644 index 388a8358..00000000 --- a/src/pages/Account/Settings/BaseView.js +++ /dev/null @@ -1,192 +0,0 @@ -import React, { Component, Fragment } from 'react'; -import { formatMessage, FormattedMessage } from 'umi/locale'; -import { Form, Input, Upload, Select, Button } from 'antd'; -import { connect } from 'dva'; -import styles from './BaseView.less'; -import GeographicView from './GeographicView'; -import PhoneView from './PhoneView'; -// import { getTimeDistance } from '@/utils/utils'; - -const FormItem = Form.Item; -const { Option } = Select; - -// 头像组件 方便以后独立,增加裁剪之类的功能 -const AvatarView = ({ avatar }) => ( - -
- -
-
- avatar -
- -
- -
-
-
-); - -const validatorGeographic = (rule, value, callback) => { - const { province, city } = value; - if (!province.key) { - callback('Please input your province!'); - } - if (!city.key) { - callback('Please input your city!'); - } - callback(); -}; - -const validatorPhone = (rule, value, callback) => { - const values = value.split('-'); - if (!values[0]) { - callback('Please input your area code!'); - } - if (!values[1]) { - callback('Please input your phone number!'); - } - callback(); -}; - -@connect(({ user }) => ({ - currentUser: user.currentUser, -})) -@Form.create() -class BaseView extends Component { - componentDidMount() { - this.setBaseInfo(); - } - - setBaseInfo = () => { - const { currentUser, form } = this.props; - Object.keys(form.getFieldsValue()).forEach(key => { - const obj = {}; - obj[key] = currentUser[key] || null; - form.setFieldsValue(obj); - }); - }; - - getAvatarURL() { - const { currentUser } = this.props; - if (currentUser.avatar) { - return currentUser.avatar; - } - const url = 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'; - return url; - } - - getViewDom = ref => { - this.view = ref; - }; - - render() { - const { - form: { getFieldDecorator }, - } = this.props; - return ( -
-
-
- - {getFieldDecorator('email', { - rules: [ - { - required: true, - message: formatMessage({ id: 'app.settings.basic.email-message' }, {}), - }, - ], - })()} - - - {getFieldDecorator('name', { - rules: [ - { - required: true, - message: formatMessage({ id: 'app.settings.basic.nickname-message' }, {}), - }, - ], - })()} - - - {getFieldDecorator('profile', { - rules: [ - { - required: true, - message: formatMessage({ id: 'app.settings.basic.profile-message' }, {}), - }, - ], - })( - - )} - - - {getFieldDecorator('country', { - rules: [ - { - required: true, - message: formatMessage({ id: 'app.settings.basic.country-message' }, {}), - }, - ], - })( - - )} - - - {getFieldDecorator('geographic', { - rules: [ - { - required: true, - message: formatMessage({ id: 'app.settings.basic.geographic-message' }, {}), - }, - { - validator: validatorGeographic, - }, - ], - })()} - - - {getFieldDecorator('address', { - rules: [ - { - required: true, - message: formatMessage({ id: 'app.settings.basic.address-message' }, {}), - }, - ], - })()} - - - {getFieldDecorator('phone', { - rules: [ - { - required: true, - message: formatMessage({ id: 'app.settings.basic.phone-message' }, {}), - }, - { validator: validatorPhone }, - ], - })()} - - -
-
-
- -
-
- ); - } -} - -export default BaseView; diff --git a/src/pages/Account/Settings/BaseView.less b/src/pages/Account/Settings/BaseView.less deleted file mode 100644 index a0a2ffde..00000000 --- a/src/pages/Account/Settings/BaseView.less +++ /dev/null @@ -1,52 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.baseView { - display: flex; - padding-top: 12px; - - .left { - max-width: 448px; - min-width: 224px; - } - .right { - flex: 1; - padding-left: 104px; - .avatar_title { - height: 22px; - font-size: @font-size-base; - color: @heading-color; - line-height: 22px; - margin-bottom: 8px; - } - .avatar { - width: 144px; - height: 144px; - margin-bottom: 12px; - overflow: hidden; - img { - width: 100%; - } - } - .button_view { - width: 144px; - text-align: center; - } - } -} - -@media screen and (max-width: @screen-xl) { - .baseView { - flex-direction: column-reverse; - - .right { - padding: 20px; - display: flex; - flex-direction: column; - align-items: center; - max-width: 448px; - .avatar_title { - display: none; - } - } - } -} diff --git a/src/pages/Account/Settings/BindingView.js b/src/pages/Account/Settings/BindingView.js deleted file mode 100644 index 29a29890..00000000 --- a/src/pages/Account/Settings/BindingView.js +++ /dev/null @@ -1,60 +0,0 @@ -import React, { Component, Fragment } from 'react'; -import { formatMessage, FormattedMessage } from 'umi/locale'; -import { Icon, List } from 'antd'; - -class BindingView extends Component { - getData = () => [ - { - title: formatMessage({ id: 'app.settings.binding.taobao' }, {}), - description: formatMessage({ id: 'app.settings.binding.taobao-description' }, {}), - actions: [ - - - , - ], - avatar: , - }, - { - title: formatMessage({ id: 'app.settings.binding.alipay' }, {}), - description: formatMessage({ id: 'app.settings.binding.alipay-description' }, {}), - actions: [ - - - , - ], - avatar: , - }, - { - title: formatMessage({ id: 'app.settings.binding.dingding' }, {}), - description: formatMessage({ id: 'app.settings.binding.dingding-description' }, {}), - actions: [ - - - , - ], - avatar: , - }, - ]; - - render() { - return ( - - ( - - - - )} - /> - - ); - } -} - -export default BindingView; diff --git a/src/pages/Account/Settings/GeographicView.js b/src/pages/Account/Settings/GeographicView.js deleted file mode 100644 index d33cb138..00000000 --- a/src/pages/Account/Settings/GeographicView.js +++ /dev/null @@ -1,128 +0,0 @@ -import React, { PureComponent } from 'react'; -import { Select, Spin } from 'antd'; -import { connect } from 'dva'; -import styles from './GeographicView.less'; - -const { Option } = Select; - -const nullSlectItem = { - label: '', - key: '', -}; - -@connect(({ geographic }) => { - const { province, isLoading, city } = geographic; - return { - province, - city, - isLoading, - }; -}) -class GeographicView extends PureComponent { - componentDidMount = () => { - const { dispatch } = this.props; - dispatch({ - type: 'geographic/fetchProvince', - }); - }; - - componentDidUpdate(props) { - const { dispatch, value } = this.props; - - if (!props.value && !!value && !!value.province) { - dispatch({ - type: 'geographic/fetchCity', - payload: value.province.key, - }); - } - } - - getProvinceOption() { - const { province } = this.props; - return this.getOption(province); - } - - getCityOption = () => { - const { city } = this.props; - return this.getOption(city); - }; - - getOption = list => { - if (!list || list.length < 1) { - return ( - - ); - } - return list.map(item => ( - - )); - }; - - selectProvinceItem = item => { - const { dispatch, onChange } = this.props; - dispatch({ - type: 'geographic/fetchCity', - payload: item.key, - }); - onChange({ - province: item, - city: nullSlectItem, - }); - }; - - selectCityItem = item => { - const { value, onChange } = this.props; - onChange({ - province: value.province, - city: item, - }); - }; - - conversionObject() { - const { value } = this.props; - if (!value) { - return { - province: nullSlectItem, - city: nullSlectItem, - }; - } - const { province, city } = value; - return { - province: province || nullSlectItem, - city: city || nullSlectItem, - }; - } - - render() { - const { province, city } = this.conversionObject(); - const { isLoading } = this.props; - return ( - - - - - ); - } -} - -export default GeographicView; diff --git a/src/pages/Account/Settings/GeographicView.less b/src/pages/Account/Settings/GeographicView.less deleted file mode 100644 index 22e35a29..00000000 --- a/src/pages/Account/Settings/GeographicView.less +++ /dev/null @@ -1,19 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.row { - .item { - max-width: 220px; - width: 50%; - } - .item:first-child { - margin-right: 8px; - width: ~'calc(50% - 8px)'; - } -} - -@media screen and (max-width: @screen-sm) { - .item:first-child { - margin: 0; - margin-bottom: 8px; - } -} diff --git a/src/pages/Account/Settings/Info.js b/src/pages/Account/Settings/Info.js deleted file mode 100644 index ceee506b..00000000 --- a/src/pages/Account/Settings/Info.js +++ /dev/null @@ -1,125 +0,0 @@ -import React, { Component } from 'react'; -import { connect } from 'dva'; -import router from 'umi/router'; -import { FormattedMessage } from 'umi/locale'; -import { Menu } from 'antd'; -import GridContent from '@/components/PageHeaderWrapper/GridContent'; -import styles from './Info.less'; - -const { Item } = Menu; - -@connect(({ user }) => ({ - currentUser: user.currentUser, -})) -class Info extends Component { - constructor(props) { - super(props); - const { match, location } = props; - const menuMap = { - base: , - security: ( - - ), - binding: ( - - ), - notification: ( - - ), - }; - const key = location.pathname.replace(`${match.path}/`, ''); - this.state = { - mode: 'inline', - menuMap, - selectKey: menuMap[key] ? key : 'base', - }; - } - - static getDerivedStateFromProps(props, state) { - const { match, location } = props; - let selectKey = location.pathname.replace(`${match.path}/`, ''); - selectKey = state.menuMap[selectKey] ? selectKey : 'base'; - if (selectKey !== state.selectKey) { - return { selectKey }; - } - return null; - } - - componentDidMount() { - window.addEventListener('resize', this.resize); - this.resize(); - } - - componentWillUnmount() { - window.removeEventListener('resize', this.resize); - } - - getmenu = () => { - const { menuMap } = this.state; - return Object.keys(menuMap).map(item => {menuMap[item]}); - }; - - getRightTitle = () => { - const { selectKey, menuMap } = this.state; - return menuMap[selectKey]; - }; - - selectKey = ({ key }) => { - router.push(`/account/settings/${key}`); - this.setState({ - selectKey: key, - }); - }; - - resize = () => { - if (!this.main) { - return; - } - requestAnimationFrame(() => { - let mode = 'inline'; - const { offsetWidth } = this.main; - if (this.main.offsetWidth < 641 && offsetWidth > 400) { - mode = 'horizontal'; - } - if (window.innerWidth < 768 && offsetWidth > 400) { - mode = 'horizontal'; - } - this.setState({ - mode, - }); - }); - }; - - render() { - const { children, currentUser } = this.props; - if (!currentUser.userid) { - return ''; - } - const { mode, selectKey } = this.state; - return ( - -
{ - this.main = ref; - }} - > -
- - {this.getmenu()} - -
-
-
{this.getRightTitle()}
- {children} -
-
-
- ); - } -} - -export default Info; diff --git a/src/pages/Account/Settings/Info.less b/src/pages/Account/Settings/Info.less deleted file mode 100644 index b7a59fba..00000000 --- a/src/pages/Account/Settings/Info.less +++ /dev/null @@ -1,97 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.main { - width: 100%; - height: 100%; - background-color: @body-background; - display: flex; - padding-top: 16px; - padding-bottom: 16px; - overflow: auto; - .leftmenu { - width: 224px; - border-right: @border-width-base @border-style-base @border-color-split; - :global { - .ant-menu-inline { - border: none; - } - .ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected { - font-weight: bold; - } - } - } - .right { - flex: 1; - padding-left: 40px; - padding-right: 40px; - padding-top: 8px; - padding-bottom: 8px; - .title { - font-size: 20px; - color: @heading-color; - line-height: 28px; - font-weight: 500; - margin-bottom: 12px; - } - } - :global { - .ant-list-split .ant-list-item:last-child { - border-bottom: 1px solid #e8e8e8; - } - .ant-list-item { - padding-top: 14px; - padding-bottom: 14px; - } - } -} -:global { - .ant-list-item-meta { - // 账号绑定图标 - .taobao { - color: #ff4000; - display: block; - font-size: 48px; - line-height: 48px; - border-radius: @border-radius-base; - } - .dingding { - background-color: #2eabff; - color: #fff; - font-size: 32px; - line-height: 32px; - padding: 6px; - margin: 2px; - border-radius: @border-radius-base; - } - .alipay { - color: #2eabff; - font-size: 48px; - line-height: 48px; - border-radius: @border-radius-base; - } - } - - // 密码强度 - font.strong { - color: @success-color; - } - font.medium { - color: @warning-color; - } - font.weak { - color: @error-color; - } -} - -@media screen and (max-width: @screen-md) { - .main { - flex-direction: column; - .leftmenu { - width: 100%; - border: none; - } - .right { - padding: 40px; - } - } -} diff --git a/src/pages/Account/Settings/NotificationView.js b/src/pages/Account/Settings/NotificationView.js deleted file mode 100644 index 96677bbd..00000000 --- a/src/pages/Account/Settings/NotificationView.js +++ /dev/null @@ -1,50 +0,0 @@ -import React, { Component, Fragment } from 'react'; -import { formatMessage } from 'umi/locale'; -import { Switch, List } from 'antd'; - -class NotificationView extends Component { - getData = () => { - const Action = ( - - ); - return [ - { - title: formatMessage({ id: 'app.settings.notification.password' }, {}), - description: formatMessage({ id: 'app.settings.notification.password-description' }, {}), - actions: [Action], - }, - { - title: formatMessage({ id: 'app.settings.notification.messages' }, {}), - description: formatMessage({ id: 'app.settings.notification.messages-description' }, {}), - actions: [Action], - }, - { - title: formatMessage({ id: 'app.settings.notification.todo' }, {}), - description: formatMessage({ id: 'app.settings.notification.todo-description' }, {}), - actions: [Action], - }, - ]; - }; - - render() { - return ( - - ( - - - - )} - /> - - ); - } -} - -export default NotificationView; diff --git a/src/pages/Account/Settings/PhoneView.js b/src/pages/Account/Settings/PhoneView.js deleted file mode 100644 index 26655276..00000000 --- a/src/pages/Account/Settings/PhoneView.js +++ /dev/null @@ -1,33 +0,0 @@ -import React, { Fragment, PureComponent } from 'react'; -import { Input } from 'antd'; -import styles from './PhoneView.less'; - -class PhoneView extends PureComponent { - render() { - const { value, onChange } = this.props; - let values = ['', '']; - if (value) { - values = value.split('-'); - } - return ( - - { - onChange(`${e.target.value}-${values[1]}`); - }} - /> - { - onChange(`${values[0]}-${e.target.value}`); - }} - value={values[1]} - /> - - ); - } -} - -export default PhoneView; diff --git a/src/pages/Account/Settings/PhoneView.less b/src/pages/Account/Settings/PhoneView.less deleted file mode 100644 index 5c85970d..00000000 --- a/src/pages/Account/Settings/PhoneView.less +++ /dev/null @@ -1,11 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.area_code { - max-width: 128px; - margin-right: 8px; - width: 30%; -} -.phone_number { - max-width: 312px; - width: ~'calc(70% - 8px)'; -} diff --git a/src/pages/Account/Settings/SecurityView.js b/src/pages/Account/Settings/SecurityView.js deleted file mode 100644 index 0706bd0b..00000000 --- a/src/pages/Account/Settings/SecurityView.js +++ /dev/null @@ -1,102 +0,0 @@ -import React, { Component, Fragment } from 'react'; -import { formatMessage, FormattedMessage } from 'umi/locale'; -import { List } from 'antd'; -// import { getTimeDistance } from '@/utils/utils'; - -const passwordStrength = { - strong: ( - - - - ), - medium: ( - - - - ), - weak: ( - - - Weak - - ), -}; - -class SecurityView extends Component { - getData = () => [ - { - title: formatMessage({ id: 'app.settings.security.password' }, {}), - description: ( - - {formatMessage({ id: 'app.settings.security.password-description' })}: - {passwordStrength.strong} - - ), - actions: [ - - - , - ], - }, - { - title: formatMessage({ id: 'app.settings.security.phone' }, {}), - description: `${formatMessage( - { id: 'app.settings.security.phone-description' }, - {} - )}:138****8293`, - actions: [ - - - , - ], - }, - { - title: formatMessage({ id: 'app.settings.security.question' }, {}), - description: formatMessage({ id: 'app.settings.security.question-description' }, {}), - actions: [ - - - , - ], - }, - { - title: formatMessage({ id: 'app.settings.security.email' }, {}), - description: `${formatMessage( - { id: 'app.settings.security.email-description' }, - {} - )}:ant***sign.com`, - actions: [ - - - , - ], - }, - { - title: formatMessage({ id: 'app.settings.security.mfa' }, {}), - description: formatMessage({ id: 'app.settings.security.mfa-description' }, {}), - actions: [ - - - , - ], - }, - ]; - - render() { - return ( - - ( - - - - )} - /> - - ); - } -} - -export default SecurityView; diff --git a/src/pages/Account/Settings/models/geographic.js b/src/pages/Account/Settings/models/geographic.js deleted file mode 100644 index a501920c..00000000 --- a/src/pages/Account/Settings/models/geographic.js +++ /dev/null @@ -1,65 +0,0 @@ -import { queryProvince, queryCity } from '@/services/geographic'; - -export default { - namespace: 'geographic', - - state: { - province: [], - city: [], - isLoading: false, - }, - - effects: { - *fetchProvince(_, { call, put }) { - yield put({ - type: 'changeLoading', - payload: true, - }); - const response = yield call(queryProvince); - yield put({ - type: 'setProvince', - payload: response, - }); - yield put({ - type: 'changeLoading', - payload: false, - }); - }, - *fetchCity({ payload }, { call, put }) { - yield put({ - type: 'changeLoading', - payload: true, - }); - const response = yield call(queryCity, payload); - yield put({ - type: 'setCity', - payload: response, - }); - yield put({ - type: 'changeLoading', - payload: false, - }); - }, - }, - - reducers: { - setProvince(state, action) { - return { - ...state, - province: action.payload, - }; - }, - setCity(state, action) { - return { - ...state, - city: action.payload, - }; - }, - changeLoading(state, action) { - return { - ...state, - isLoading: action.payload, - }; - }, - }, -}; diff --git a/src/pages/BasicDemo.js b/src/pages/BasicDemo.js new file mode 100644 index 00000000..045b7364 --- /dev/null +++ b/src/pages/BasicDemo.js @@ -0,0 +1,3 @@ +import React from 'react'; + +export default () =>

hello pro!

; diff --git a/src/pages/Dashboard/Analysis.js b/src/pages/Dashboard/Analysis.js deleted file mode 100644 index 0b85db70..00000000 --- a/src/pages/Dashboard/Analysis.js +++ /dev/null @@ -1,187 +0,0 @@ -import React, { Component, Suspense } from 'react'; -import { connect } from 'dva'; -import { Row, Col, Icon, Menu, Dropdown } from 'antd'; - -import GridContent from '@/components/PageHeaderWrapper/GridContent'; -import { getTimeDistance } from '@/utils/utils'; - -import styles from './Analysis.less'; -import PageLoading from '@/components/PageLoading'; - -const IntroduceRow = React.lazy(() => import('./IntroduceRow')); -const SalesCard = React.lazy(() => import('./SalesCard')); -const TopSearch = React.lazy(() => import('./TopSearch')); -const ProportionSales = React.lazy(() => import('./ProportionSales')); -const OfflineData = React.lazy(() => import('./OfflineData')); - -@connect(({ chart, loading }) => ({ - chart, - loading: loading.effects['chart/fetch'], -})) -class Analysis extends Component { - state = { - salesType: 'all', - currentTabKey: '', - rangePickerValue: getTimeDistance('year'), - }; - - componentDidMount() { - const { dispatch } = this.props; - this.reqRef = requestAnimationFrame(() => { - dispatch({ - type: 'chart/fetch', - }); - }); - } - - componentWillUnmount() { - const { dispatch } = this.props; - dispatch({ - type: 'chart/clear', - }); - cancelAnimationFrame(this.reqRef); - clearTimeout(this.timeoutId); - } - - handleChangeSalesType = e => { - this.setState({ - salesType: e.target.value, - }); - }; - - handleTabChange = key => { - this.setState({ - currentTabKey: key, - }); - }; - - handleRangePickerChange = rangePickerValue => { - const { dispatch } = this.props; - this.setState({ - rangePickerValue, - }); - - dispatch({ - type: 'chart/fetchSalesData', - }); - }; - - selectDate = type => { - const { dispatch } = this.props; - this.setState({ - rangePickerValue: getTimeDistance(type), - }); - - dispatch({ - type: 'chart/fetchSalesData', - }); - }; - - isActive = type => { - const { rangePickerValue } = this.state; - const value = getTimeDistance(type); - if (!rangePickerValue[0] || !rangePickerValue[1]) { - return ''; - } - if ( - rangePickerValue[0].isSame(value[0], 'day') && - rangePickerValue[1].isSame(value[1], 'day') - ) { - return styles.currentDate; - } - return ''; - }; - - render() { - const { rangePickerValue, salesType, currentTabKey } = this.state; - const { chart, loading } = this.props; - const { - visitData, - visitData2, - salesData, - searchData, - offlineData, - offlineChartData, - salesTypeData, - salesTypeDataOnline, - salesTypeDataOffline, - } = chart; - let salesPieData; - if (salesType === 'all') { - salesPieData = salesTypeData; - } else { - salesPieData = salesType === 'online' ? salesTypeDataOnline : salesTypeDataOffline; - } - const menu = ( - - 操作一 - 操作二 - - ); - - const dropdownGroup = ( - - - - - - ); - - const activeKey = currentTabKey || (offlineData[0] && offlineData[0].name); - - return ( - - }> - - - - - -
- - - - - - - - - - - - -
- - - -
- ); - } -} - -export default Analysis; diff --git a/src/pages/Dashboard/Analysis.less b/src/pages/Dashboard/Analysis.less deleted file mode 100644 index 70877d66..00000000 --- a/src/pages/Dashboard/Analysis.less +++ /dev/null @@ -1,197 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; -@import '~@/utils/utils.less'; - -.iconGroup { - i { - transition: color 0.32s; - color: @text-color-secondary; - cursor: pointer; - margin-left: 16px; - &:hover { - color: @text-color; - } - } -} - -.rankingList { - margin: 25px 0 0; - padding: 0; - list-style: none; - li { - .clearfix(); - margin-top: 16px; - display: flex; - align-items: center; - span { - color: @text-color; - font-size: 14px; - line-height: 22px; - } - .rankingItemNumber { - background-color: @background-color-base; - border-radius: 20px; - display: inline-block; - font-size: 12px; - font-weight: 600; - margin-right: 16px; - height: 20px; - line-height: 20px; - width: 20px; - text-align: center; - margin-top: 1.5px; - &.active { - background-color: #314659; - color: #fff; - } - } - .rankingItemTitle { - flex: 1; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - margin-right: 8px; - } - } -} - -.salesExtra { - display: inline-block; - margin-right: 24px; - a { - color: @text-color; - margin-left: 24px; - &:hover { - color: @primary-color; - } - &.currentDate { - color: @primary-color; - } - } -} - -.salesCard { - .salesBar { - padding: 0 0 32px 32px; - } - .salesRank { - padding: 0 32px 32px 72px; - } - :global { - .ant-tabs-bar { - padding-left: 16px; - .ant-tabs-nav .ant-tabs-tab { - padding-top: 16px; - padding-bottom: 14px; - line-height: 24px; - } - } - .ant-tabs-extra-content { - padding-right: 24px; - line-height: 55px; - } - .ant-card-head { - position: relative; - } - .ant-card-head-title { - align-items: normal; - } - } -} - -.salesCardExtra { - height: inherit; -} - -.salesTypeRadio { - position: absolute; - right: 54px; - bottom: 12px; -} - -.offlineCard { - :global { - .ant-tabs-ink-bar { - bottom: auto; - } - .ant-tabs-bar { - border-bottom: none; - } - .ant-tabs-nav-container-scrolling { - padding-left: 40px; - padding-right: 40px; - } - .ant-tabs-tab-prev-icon:before { - position: relative; - left: 6px; - } - .ant-tabs-tab-next-icon:before { - position: relative; - right: 6px; - } - .ant-tabs-tab-active h4 { - color: @primary-color; - } - } -} - -.twoColLayout { - .salesCard { - height: calc(100% - 24px); - } - div[class^='ant-col']:last-child { - right: 0\9; - height: 100%\9; - position: absolute\9; - } - :global { - .ant-row { - display: flex; - display: block\9; - flex-flow: row wrap; - position: relative\9; - } - } -} - -.trendText { - margin-left: 8px; - color: @heading-color; -} - -@media screen and (max-width: @screen-lg) { - .salesExtra { - display: none; - } - - .rankingList { - li { - span:first-child { - margin-right: 8px; - } - } - } -} - -@media screen and (max-width: @screen-md) { - .rankingTitle { - margin-top: 16px; - } - - .salesCard .salesBar { - padding: 16px; - } -} - -@media screen and (max-width: @screen-sm) { - .salesExtraWrap { - display: none; - } - - .salesCard { - :global { - .ant-tabs-content { - padding-top: 30px; - } - } - } -} diff --git a/src/pages/Dashboard/IntroduceRow.js b/src/pages/Dashboard/IntroduceRow.js deleted file mode 100755 index 8e9020e7..00000000 --- a/src/pages/Dashboard/IntroduceRow.js +++ /dev/null @@ -1,144 +0,0 @@ -import React, { memo } from 'react'; -import { Row, Col, Icon, Tooltip } from 'antd'; -import { FormattedMessage } from 'umi/locale'; -import styles from './Analysis.less'; -import { ChartCard, MiniArea, MiniBar, MiniProgress, Field } from 'ant-design-pro/lib/Charts'; -import Trend from 'ant-design-pro/lib/Trend'; -import numeral from 'numeral'; -import Yuan from '@/utils/Yuan'; - -const topColResponsiveProps = { - xs: 24, - sm: 12, - md: 12, - lg: 12, - xl: 6, - style: { marginBottom: 24 }, -}; - -const IntroduceRow = memo(({ loading, visitData }) => ( - - - } - action={ - } - > - - - } - loading={loading} - total={() => 126560} - footer={ - } - value={`¥${numeral(12423).format('0,0')}`} - /> - } - contentHeight={46} - > - - - 12% - - - - 11% - - - - - - } - action={ - } - > - - - } - total={numeral(8846).format('0,0')} - footer={ - } - value={numeral(1234).format('0,0')} - /> - } - contentHeight={46} - > - - - - - } - action={ - } - > - - - } - total={numeral(6560).format('0,0')} - footer={ - - } - value="60%" - /> - } - contentHeight={46} - > - - - - - - } - action={ - } - > - - - } - total="78%" - footer={ -
- - - 12% - - - - 11% - -
- } - contentHeight={46} - > - -
- -
-)); - -export default IntroduceRow; diff --git a/src/pages/Dashboard/Monitor.js b/src/pages/Dashboard/Monitor.js deleted file mode 100644 index 536c90cc..00000000 --- a/src/pages/Dashboard/Monitor.js +++ /dev/null @@ -1,245 +0,0 @@ -import React, { PureComponent } from 'react'; -import { connect } from 'dva'; -import { formatMessage, FormattedMessage } from 'umi/locale'; -import { Row, Col, Card, Tooltip } from 'antd'; -import { Pie, WaterWave, Gauge, TagCloud } from 'ant-design-pro/lib/Charts'; -import NumberInfo from 'ant-design-pro/lib/NumberInfo'; -import CountDown from 'ant-design-pro/lib/CountDown'; -import ActiveChart from '@/components/ActiveChart'; -import numeral from 'numeral'; -import GridContent from '@/components/PageHeaderWrapper/GridContent'; - -import Authorized from '@/utils/Authorized'; -import styles from './Monitor.less'; - -const { Secured } = Authorized; - -const targetTime = new Date().getTime() + 3900000; - -// use permission as a parameter -const havePermissionAsync = new Promise(resolve => { - // Call resolve on behalf of passed - setTimeout(() => resolve(), 300); -}); - -@Secured(havePermissionAsync) -@connect(({ monitor, loading }) => ({ - monitor, - loading: loading.models.monitor, -})) -class Monitor extends PureComponent { - componentDidMount() { - const { dispatch } = this.props; - dispatch({ - type: 'monitor/fetchTags', - }); - } - - render() { - const { monitor, loading } = this.props; - const { tags } = monitor; - - return ( - - - - - } - bordered={false} - > - - - - } - suffix="元" - total={numeral(124543233).format('0,0')} - /> - - - - } - total="92%" - /> - - - - } - total={} - /> - - - - } - suffix="元" - total={numeral(234).format('0,0')} - /> - - -
- - } - > - map - -
-
- - - - } - style={{ marginBottom: 24 }} - bordered={false} - > - - - } - style={{ marginBottom: 24 }} - bodyStyle={{ textAlign: 'center' }} - bordered={false} - > - - - -
- - - - } - bordered={false} - className={styles.pieCard} - > - - - - } - total="28%" - height={128} - lineWidth={2} - /> - - - - } - total="22%" - height={128} - lineWidth={2} - /> - - - - } - total="32%" - height={128} - lineWidth={2} - /> - - - - - - - } - loading={loading} - bordered={false} - bodyStyle={{ overflow: 'hidden' }} - > - - - - - - } - bodyStyle={{ textAlign: 'center', fontSize: 0 }} - bordered={false} - > - - } - percent={34} - /> - - - -
- ); - } -} - -export default Monitor; diff --git a/src/pages/Dashboard/Monitor.less b/src/pages/Dashboard/Monitor.less deleted file mode 100644 index ca41f33e..00000000 --- a/src/pages/Dashboard/Monitor.less +++ /dev/null @@ -1,23 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; -@import '~@/utils/utils.less'; - -.mapChart { - padding-top: 24px; - height: 452px; - text-align: center; - img { - display: inline-block; - max-width: 100%; - max-height: 437px; - } -} - -.pieCard :global(.pie-stat) { - font-size: 24px !important; -} - -@media screen and (max-width: @screen-lg) { - .mapChart { - height: auto; - } -} diff --git a/src/pages/Dashboard/OfflineData.js b/src/pages/Dashboard/OfflineData.js deleted file mode 100755 index e2521006..00000000 --- a/src/pages/Dashboard/OfflineData.js +++ /dev/null @@ -1,65 +0,0 @@ -import React, { memo } from 'react'; -import { Card, Tabs, Row, Col } from 'antd'; -import { formatMessage, FormattedMessage } from 'umi/locale'; -import { TimelineChart, Pie } from 'ant-design-pro/lib/Charts'; -import NumberInfo from 'ant-design-pro/lib/NumberInfo'; -import styles from './Analysis.less'; - -const CustomTab = ({ data, currentTabKey: currentKey }) => ( - - - - } - gap={2} - total={`${data.cvr * 100}%`} - theme={currentKey !== data.name && 'light'} - /> - - - - - -); - -const { TabPane } = Tabs; - -const OfflineData = memo( - ({ activeKey, loading, offlineData, offlineChartData, handleTabChange }) => ( - - - {offlineData.map(shop => ( - } key={shop.name}> -
- -
-
- ))} -
-
- ) -); - -export default OfflineData; diff --git a/src/pages/Dashboard/ProportionSales.js b/src/pages/Dashboard/ProportionSales.js deleted file mode 100755 index 47b011ed..00000000 --- a/src/pages/Dashboard/ProportionSales.js +++ /dev/null @@ -1,58 +0,0 @@ -import React, { memo } from 'react'; -import { Card, Radio } from 'antd'; -import { FormattedMessage } from 'umi/locale'; -import styles from './Analysis.less'; -import { Pie } from 'ant-design-pro/lib/Charts'; -import Yuan from '@/utils/Yuan'; - -const ProportionSales = memo( - ({ dropdownGroup, salesType, loading, salesPieData, handleChangeSalesType }) => ( - - } - bodyStyle={{ padding: 24 }} - extra={ -
- {dropdownGroup} -
- - - - - - - - - - - -
-
- } - style={{ marginTop: 24 }} - > -

- -

- } - total={() => {salesPieData.reduce((pre, now) => now.y + pre, 0)}} - data={salesPieData} - valueFormat={value => {value}} - height={270} - lineWidth={4} - style={{ padding: '8px 0' }} - /> -
- ) -); - -export default ProportionSales; diff --git a/src/pages/Dashboard/SalesCard.js b/src/pages/Dashboard/SalesCard.js deleted file mode 100755 index 453a4e17..00000000 --- a/src/pages/Dashboard/SalesCard.js +++ /dev/null @@ -1,150 +0,0 @@ -import React, { memo } from 'react'; -import { Row, Col, Card, Tabs, DatePicker } from 'antd'; -import { FormattedMessage, formatMessage } from 'umi/locale'; -import numeral from 'numeral'; -import { Bar } from 'ant-design-pro/lib/Charts'; -import styles from './Analysis.less'; - -const { RangePicker } = DatePicker; -const { TabPane } = Tabs; - -const rankingListData = []; -for (let i = 0; i < 7; i += 1) { - rankingListData.push({ - title: formatMessage({ id: 'app.analysis.test' }, { no: i }), - total: 323234, - }); -} - -const SalesCard = memo( - ({ rangePickerValue, salesData, isActive, handleRangePickerChange, loading, selectDate }) => ( - - - } - size="large" - tabBarStyle={{ marginBottom: 24 }} - > - } - key="sales" - > - - -
- - } - data={salesData} - /> -
- - -
-

- -

-
    - {rankingListData.map((item, i) => ( -
  • - - {i + 1} - - - {item.title} - - - {numeral(item.total).format('0,0')} - -
  • - ))} -
-
- -
-
- } - key="views" - > - - -
- - } - data={salesData} - /> -
- - -
-

- -

-
    - {rankingListData.map((item, i) => ( -
  • - - {i + 1} - - - {item.title} - - {numeral(item.total).format('0,0')} -
  • - ))} -
-
- -
-
- - -
- ) -); - -export default SalesCard; diff --git a/src/pages/Dashboard/TopSearch.js b/src/pages/Dashboard/TopSearch.js deleted file mode 100755 index 5ae05a12..00000000 --- a/src/pages/Dashboard/TopSearch.js +++ /dev/null @@ -1,111 +0,0 @@ -import React, { memo } from 'react'; -import { Row, Col, Table, Tooltip, Card, Icon } from 'antd'; -import { FormattedMessage } from 'umi/locale'; -import Trend from 'ant-design-pro/lib/Trend'; -import numeral from 'numeral'; -import NumberInfo from 'ant-design-pro/lib/NumberInfo'; -import { MiniArea } from 'ant-design-pro/lib/Charts'; -import styles from './Analysis.less'; - -const columns = [ - { - title: , - dataIndex: 'index', - key: 'index', - }, - { - title: ( - - ), - dataIndex: 'keyword', - key: 'keyword', - render: text => {text}, - }, - { - title: , - dataIndex: 'count', - key: 'count', - sorter: (a, b) => a.count - b.count, - className: styles.alignRight, - }, - { - title: , - dataIndex: 'range', - key: 'range', - sorter: (a, b) => a.range - b.range, - render: (text, record) => ( - - {text}% - - ), - align: 'right', - }, -]; - -const TopSearch = memo(({ loading, visitData2, searchData, dropdownGroup }) => ( - - } - extra={dropdownGroup} - style={{ marginTop: 24 }} - > - - - - - } - > - - - - } - gap={8} - total={numeral(12321).format('0,0')} - status="up" - subTotal={17.1} - /> - - - - - - } - > - - - - } - total={2.7} - status="down" - subTotal={26.2} - gap={8} - /> - - - - record.index} - size="small" - columns={columns} - dataSource={searchData} - pagination={{ - style: { marginBottom: 0 }, - pageSize: 5, - }} - /> - -)); - -export default TopSearch; diff --git a/src/pages/Dashboard/Workplace.js b/src/pages/Dashboard/Workplace.js deleted file mode 100644 index 3a6e2607..00000000 --- a/src/pages/Dashboard/Workplace.js +++ /dev/null @@ -1,256 +0,0 @@ -import React, { PureComponent } from 'react'; -import moment from 'moment'; -import { connect } from 'dva'; -import Link from 'umi/link'; -import { Row, Col, Card, List, Avatar } from 'antd'; - -import { Radar } from 'ant-design-pro/lib/Charts'; -import EditableLinkGroup from '@/components/EditableLinkGroup'; -import PageHeaderWrapper from '@/components/PageHeaderWrapper'; - -import styles from './Workplace.less'; - -const links = [ - { - title: '操作一', - href: '', - }, - { - title: '操作二', - href: '', - }, - { - title: '操作三', - href: '', - }, - { - title: '操作四', - href: '', - }, - { - title: '操作五', - href: '', - }, - { - title: '操作六', - href: '', - }, -]; - -@connect(({ user, project, activities, chart, loading }) => ({ - currentUser: user.currentUser, - project, - activities, - chart, - currentUserLoading: loading.effects['user/fetchCurrent'], - projectLoading: loading.effects['project/fetchNotice'], - activitiesLoading: loading.effects['activities/fetchList'], -})) -class Workplace extends PureComponent { - componentDidMount() { - const { dispatch } = this.props; - dispatch({ - type: 'user/fetchCurrent', - }); - dispatch({ - type: 'project/fetchNotice', - }); - dispatch({ - type: 'activities/fetchList', - }); - dispatch({ - type: 'chart/fetch', - }); - } - - componentWillUnmount() { - const { dispatch } = this.props; - dispatch({ - type: 'chart/clear', - }); - } - - renderActivities() { - const { - activities: { list }, - } = this.props; - return list.map(item => { - const events = item.template.split(/@\{([^{}]*)\}/gi).map(key => { - if (item[key]) { - return ( - - {item[key].name} - - ); - } - return key; - }); - return ( - - } - title={ - - {item.user.name} -   - {events} - - } - description={ - - {moment(item.updatedAt).fromNow()} - - } - /> - - ); - }); - } - - render() { - const { - currentUser, - currentUserLoading, - project: { notice }, - projectLoading, - activitiesLoading, - chart: { radarData }, - } = this.props; - - const pageHeaderContent = - currentUser && Object.keys(currentUser).length ? ( -
-
- -
-
-
- 早安, - {currentUser.name} - ,祝你开心每一天! -
-
- {currentUser.title} |{currentUser.group} -
-
-
- ) : null; - - const extraContent = ( -
-
-

项目数

-

56

-
-
-

团队内排名

-

- 8 / 24 -

-
-
-

项目访问

-

2,223

-
-
- ); - - return ( - - - - 全部项目} - loading={projectLoading} - bodyStyle={{ padding: 0 }} - > - {notice.map(item => ( - - - - - {item.title} - - } - description={item.description} - /> -
- {item.member || ''} - {item.updatedAt && ( - - {moment(item.updatedAt).fromNow()} - - )} -
-
-
- ))} -
- - -
{this.renderActivities()}
-
-
- - - - {}} links={links} linkElement={Link} /> - - -
- -
-
- -
- - {notice.map(item => ( -
- - - {item.member} - - - ))} - - - - - - - ); - } -} - -export default Workplace; diff --git a/src/pages/Dashboard/Workplace.less b/src/pages/Dashboard/Workplace.less deleted file mode 100644 index 03801711..00000000 --- a/src/pages/Dashboard/Workplace.less +++ /dev/null @@ -1,227 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; -@import '~@/utils/utils.less'; - -.activitiesList { - padding: 0 24px 8px 24px; - .username { - color: @text-color; - } - .event { - font-weight: normal; - } -} - -.pageHeaderContent { - display: flex; - .avatar { - flex: 0 1 72px; - margin-bottom: 8px; - & > span { - border-radius: 72px; - display: block; - width: 72px; - height: 72px; - } - } - .content { - position: relative; - top: 4px; - margin-left: 24px; - flex: 1 1 auto; - color: @text-color-secondary; - line-height: 22px; - .contentTitle { - font-size: 20px; - line-height: 28px; - font-weight: 500; - color: @heading-color; - margin-bottom: 12px; - } - } -} - -.extraContent { - .clearfix(); - float: right; - white-space: nowrap; - .statItem { - padding: 0 32px; - position: relative; - display: inline-block; - > p:first-child { - color: @text-color-secondary; - font-size: @font-size-base; - line-height: 22px; - margin-bottom: 4px; - } - > p { - color: @heading-color; - font-size: 30px; - line-height: 38px; - margin: 0; - > span { - color: @text-color-secondary; - font-size: 20px; - } - } - &:after { - background-color: @border-color-split; - position: absolute; - top: 8px; - right: 0; - width: 1px; - height: 40px; - content: ''; - } - &:last-child { - padding-right: 0; - &:after { - display: none; - } - } - } -} - -.members { - a { - display: block; - margin: 12px 0; - height: 24px; - color: @text-color; - transition: all 0.3s; - .textOverflow(); - .member { - font-size: @font-size-base; - line-height: 24px; - vertical-align: top; - margin-left: 12px; - } - &:hover { - color: @primary-color; - } - } -} - -.projectList { - :global { - .ant-card-meta-description { - color: @text-color-secondary; - height: 44px; - line-height: 22px; - overflow: hidden; - } - } - .cardTitle { - font-size: 0; - a { - color: @heading-color; - margin-left: 12px; - line-height: 24px; - height: 24px; - display: inline-block; - vertical-align: top; - font-size: @font-size-base; - &:hover { - color: @primary-color; - } - } - } - .projectGrid { - width: 33.33%; - } - .projectItemContent { - display: flex; - margin-top: 8px; - overflow: hidden; - font-size: 12px; - height: 20px; - line-height: 20px; - .textOverflow(); - a { - color: @text-color-secondary; - display: inline-block; - flex: 1 1 0; - .textOverflow(); - &:hover { - color: @primary-color; - } - } - .datetime { - color: @disabled-color; - flex: 0 0 auto; - float: right; - } - } -} - -.datetime { - color: @disabled-color; -} - -@media screen and (max-width: @screen-xl) and (min-width: @screen-lg) { - .activeCard { - margin-bottom: 24px; - } - .members { - margin-bottom: 0; - } - .extraContent { - margin-left: -44px; - .statItem { - padding: 0 16px; - } - } -} - -@media screen and (max-width: @screen-lg) { - .activeCard { - margin-bottom: 24px; - } - .members { - margin-bottom: 0; - } - .extraContent { - float: none; - margin-right: 0; - .statItem { - padding: 0 16px; - text-align: left; - &:after { - display: none; - } - } - } -} - -@media screen and (max-width: @screen-md) { - .extraContent { - margin-left: -16px; - } - .projectList { - .projectGrid { - width: 50%; - } - } -} - -@media screen and (max-width: @screen-sm) { - .pageHeaderContent { - display: block; - .content { - margin-left: 0; - } - } - .extraContent { - .statItem { - float: none; - } - } -} - -@media screen and (max-width: @screen-xs) { - .projectList { - .projectGrid { - width: 100%; - } - } -} diff --git a/src/pages/Dashboard/models/activities.js b/src/pages/Dashboard/models/activities.js deleted file mode 100644 index 4e0a11e2..00000000 --- a/src/pages/Dashboard/models/activities.js +++ /dev/null @@ -1,28 +0,0 @@ -import { queryActivities } from '@/services/api'; - -export default { - namespace: 'activities', - - state: { - list: [], - }, - - effects: { - *fetchList(_, { call, put }) { - const response = yield call(queryActivities); - yield put({ - type: 'saveList', - payload: Array.isArray(response) ? response : [], - }); - }, - }, - - reducers: { - saveList(state, action) { - return { - ...state, - list: action.payload, - }; - }, - }, -}; diff --git a/src/pages/Dashboard/models/chart.js b/src/pages/Dashboard/models/chart.js deleted file mode 100644 index 8dfe4a93..00000000 --- a/src/pages/Dashboard/models/chart.js +++ /dev/null @@ -1,61 +0,0 @@ -import { fakeChartData } from '@/services/api'; - -export default { - namespace: 'chart', - - state: { - visitData: [], - visitData2: [], - salesData: [], - searchData: [], - offlineData: [], - offlineChartData: [], - salesTypeData: [], - salesTypeDataOnline: [], - salesTypeDataOffline: [], - radarData: [], - loading: false, - }, - - effects: { - *fetch(_, { call, put }) { - const response = yield call(fakeChartData); - yield put({ - type: 'save', - payload: response, - }); - }, - *fetchSalesData(_, { call, put }) { - const response = yield call(fakeChartData); - yield put({ - type: 'save', - payload: { - salesData: response.salesData, - }, - }); - }, - }, - - reducers: { - save(state, { payload }) { - return { - ...state, - ...payload, - }; - }, - clear() { - return { - visitData: [], - visitData2: [], - salesData: [], - searchData: [], - offlineData: [], - offlineChartData: [], - salesTypeData: [], - salesTypeDataOnline: [], - salesTypeDataOffline: [], - radarData: [], - }; - }, - }, -}; diff --git a/src/pages/Dashboard/models/monitor.js b/src/pages/Dashboard/models/monitor.js deleted file mode 100644 index e3e832ff..00000000 --- a/src/pages/Dashboard/models/monitor.js +++ /dev/null @@ -1,28 +0,0 @@ -import { queryTags } from '@/services/api'; - -export default { - namespace: 'monitor', - - state: { - tags: [], - }, - - effects: { - *fetchTags(_, { call, put }) { - const response = yield call(queryTags); - yield put({ - type: 'saveTags', - payload: response.list, - }); - }, - }, - - reducers: { - saveTags(state, action) { - return { - ...state, - tags: action.payload, - }; - }, - }, -}; diff --git a/src/pages/Exception/403.js b/src/pages/Exception/403.js deleted file mode 100644 index fd78e0ce..00000000 --- a/src/pages/Exception/403.js +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; -import { formatMessage } from 'umi/locale'; -import Link from 'umi/link'; -import Exception from 'ant-design-pro/lib/Exception'; - -const Exception403 = () => ( - -); - -export default Exception403; diff --git a/src/pages/Exception/404.js b/src/pages/Exception/404.js deleted file mode 100644 index 6cf91268..00000000 --- a/src/pages/Exception/404.js +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; -import { formatMessage } from 'umi/locale'; -import Link from 'umi/link'; -import Exception from 'ant-design-pro/lib/Exception'; - -const Exception404 = () => ( - -); - -export default Exception404; diff --git a/src/pages/Exception/500.js b/src/pages/Exception/500.js deleted file mode 100644 index 24fbc3a2..00000000 --- a/src/pages/Exception/500.js +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; -import { formatMessage } from 'umi/locale'; -import Link from 'umi/link'; -import Exception from 'ant-design-pro/lib/Exception'; - -const Exception500 = () => ( - -); - -export default Exception500; diff --git a/src/pages/Exception/TriggerException.js b/src/pages/Exception/TriggerException.js deleted file mode 100644 index 15ace510..00000000 --- a/src/pages/Exception/TriggerException.js +++ /dev/null @@ -1,50 +0,0 @@ -import React, { PureComponent } from 'react'; -import { Button, Spin, Card } from 'antd'; -import { connect } from 'dva'; -import styles from './style.less'; - -@connect(state => ({ - isloading: state.error.isloading, -})) -class TriggerException extends PureComponent { - state = { - isloading: false, - }; - - triggerError = code => { - this.setState({ - isloading: true, - }); - const { dispatch } = this.props; - dispatch({ - type: 'error/query', - payload: { - code, - }, - }); - }; - - render() { - const { isloading } = this.state; - return ( - - - - - - - - - ); - } -} - -export default TriggerException; diff --git a/src/pages/Exception/models/error.js b/src/pages/Exception/models/error.js deleted file mode 100644 index 1bfd9392..00000000 --- a/src/pages/Exception/models/error.js +++ /dev/null @@ -1,28 +0,0 @@ -import queryError from '@/services/error'; - -export default { - namespace: 'error', - - state: { - error: '', - isloading: false, - }, - - effects: { - *query({ payload }, { call, put }) { - yield call(queryError, payload.code); - yield put({ - type: 'trigger', - payload: payload.code, - }); - }, - }, - - reducers: { - trigger(state, action) { - return { - error: action.payload, - }; - }, - }, -}; diff --git a/src/pages/Exception/style.less b/src/pages/Exception/style.less deleted file mode 100644 index 91ec7dcf..00000000 --- a/src/pages/Exception/style.less +++ /dev/null @@ -1,7 +0,0 @@ -.trigger { - background: 'red'; - :global(.ant-btn) { - margin-right: 8px; - margin-bottom: 12px; - } -} diff --git a/src/pages/Forms/AdvancedForm.js b/src/pages/Forms/AdvancedForm.js deleted file mode 100644 index c1f8976f..00000000 --- a/src/pages/Forms/AdvancedForm.js +++ /dev/null @@ -1,323 +0,0 @@ -import React, { PureComponent } from 'react'; -import { - Card, - Button, - Form, - Icon, - Col, - Row, - DatePicker, - TimePicker, - Input, - Select, - Popover, -} from 'antd'; -import { connect } from 'dva'; -import FooterToolbar from 'ant-design-pro/lib/FooterToolbar'; -import PageHeaderWrapper from '@/components/PageHeaderWrapper'; -import TableForm from './TableForm'; -import styles from './style.less'; - -const { Option } = Select; -const { RangePicker } = DatePicker; - -const fieldLabels = { - name: '仓库名', - url: '仓库域名', - owner: '仓库管理员', - approver: '审批人', - dateRange: '生效日期', - type: '仓库类型', - name2: '任务名', - url2: '任务描述', - owner2: '执行人', - approver2: '责任人', - dateRange2: '生效日期', - type2: '任务类型', -}; - -const tableData = [ - { - key: '1', - workId: '00001', - name: 'John Brown', - department: 'New York No. 1 Lake Park', - }, - { - key: '2', - workId: '00002', - name: 'Jim Green', - department: 'London No. 1 Lake Park', - }, - { - key: '3', - workId: '00003', - name: 'Joe Black', - department: 'Sidney No. 1 Lake Park', - }, -]; - -@connect(({ loading }) => ({ - submitting: loading.effects['form/submitAdvancedForm'], -})) -@Form.create() -class AdvancedForm extends PureComponent { - state = { - width: '100%', - }; - - componentDidMount() { - window.addEventListener('resize', this.resizeFooterToolbar, { passive: true }); - } - - componentWillUnmount() { - window.removeEventListener('resize', this.resizeFooterToolbar); - } - - getErrorInfo = () => { - const { - form: { getFieldsError }, - } = this.props; - const errors = getFieldsError(); - const errorCount = Object.keys(errors).filter(key => errors[key]).length; - if (!errors || errorCount === 0) { - return null; - } - const scrollToField = fieldKey => { - const labelNode = document.querySelector(`label[for="${fieldKey}"]`); - if (labelNode) { - labelNode.scrollIntoView(true); - } - }; - const errorList = Object.keys(errors).map(key => { - if (!errors[key]) { - return null; - } - return ( -
  • scrollToField(key)}> - -
    {errors[key][0]}
    -
    {fieldLabels[key]}
    -
  • - ); - }); - return ( - - trigger.parentNode} - > - - - {errorCount} - - ); - }; - - resizeFooterToolbar = () => { - requestAnimationFrame(() => { - const sider = document.querySelectorAll('.ant-layout-sider')[0]; - if (sider) { - const width = `calc(100% - ${sider.style.width})`; - const { width: stateWidth } = this.state; - if (stateWidth !== width) { - this.setState({ width }); - } - } - }); - }; - - validate = () => { - const { - form: { validateFieldsAndScroll }, - dispatch, - } = this.props; - validateFieldsAndScroll((error, values) => { - if (!error) { - // submit the values - dispatch({ - type: 'form/submitAdvancedForm', - payload: values, - }); - } - }); - }; - - render() { - const { - form: { getFieldDecorator }, - submitting, - } = this.props; - const { width } = this.state; - - return ( - - -
    - -
    - - {getFieldDecorator('name', { - rules: [{ required: true, message: '请输入仓库名称' }], - })()} - - - - - {getFieldDecorator('url', { - rules: [{ required: true, message: '请选择' }], - })( - - )} - - - - - {getFieldDecorator('owner', { - rules: [{ required: true, message: '请选择管理员' }], - })( - - )} - - - - - - - {getFieldDecorator('approver', { - rules: [{ required: true, message: '请选择审批员' }], - })( - - )} - - - - - {getFieldDecorator('dateRange', { - rules: [{ required: true, message: '请选择生效日期' }], - })( - - )} - - - - - {getFieldDecorator('type', { - rules: [{ required: true, message: '请选择仓库类型' }], - })( - - )} - - - - - - -
    - -
    - - {getFieldDecorator('name2', { - rules: [{ required: true, message: '请输入' }], - })()} - - - - - {getFieldDecorator('url2', { - rules: [{ required: true, message: '请选择' }], - })()} - - - - - {getFieldDecorator('owner2', { - rules: [{ required: true, message: '请选择管理员' }], - })( - - )} - - - - - - - {getFieldDecorator('approver2', { - rules: [{ required: true, message: '请选择审批员' }], - })( - - )} - - - - - {getFieldDecorator('dateRange2', { - rules: [{ required: true, message: '请输入' }], - })( - trigger.parentNode} - /> - )} - - - - - {getFieldDecorator('type2', { - rules: [{ required: true, message: '请选择仓库类型' }], - })( - - )} - - - - - - - {getFieldDecorator('members', { - initialValue: tableData, - })()} - - - {this.getErrorInfo()} - - - - ); - } -} - -export default AdvancedForm; diff --git a/src/pages/Forms/BasicForm.js b/src/pages/Forms/BasicForm.js deleted file mode 100644 index 55833150..00000000 --- a/src/pages/Forms/BasicForm.js +++ /dev/null @@ -1,247 +0,0 @@ -import React, { PureComponent } from 'react'; -import { connect } from 'dva'; -import { formatMessage, FormattedMessage } from 'umi/locale'; -import { - Form, - Input, - DatePicker, - Select, - Button, - Card, - InputNumber, - Radio, - Icon, - Tooltip, -} from 'antd'; -import PageHeaderWrapper from '@/components/PageHeaderWrapper'; -import styles from './style.less'; - -const FormItem = Form.Item; -const { Option } = Select; -const { RangePicker } = DatePicker; -const { TextArea } = Input; - -@connect(({ loading }) => ({ - submitting: loading.effects['form/submitRegularForm'], -})) -@Form.create() -class BasicForms extends PureComponent { - handleSubmit = e => { - const { dispatch, form } = this.props; - e.preventDefault(); - form.validateFieldsAndScroll((err, values) => { - if (!err) { - dispatch({ - type: 'form/submitRegularForm', - payload: values, - }); - } - }); - }; - - render() { - const { submitting } = this.props; - const { - form: { getFieldDecorator, getFieldValue }, - } = this.props; - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 7 }, - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 12 }, - md: { span: 10 }, - }, - }; - - const submitFormLayout = { - wrapperCol: { - xs: { span: 24, offset: 0 }, - sm: { span: 10, offset: 7 }, - }, - }; - - return ( - } - content={} - > - -
    - }> - {getFieldDecorator('title', { - rules: [ - { - required: true, - message: formatMessage({ id: 'validation.title.required' }), - }, - ], - })()} - - }> - {getFieldDecorator('date', { - rules: [ - { - required: true, - message: formatMessage({ id: 'validation.date.required' }), - }, - ], - })( - - )} - - }> - {getFieldDecorator('goal', { - rules: [ - { - required: true, - message: formatMessage({ id: 'validation.goal.required' }), - }, - ], - })( -