From ece1a97b1c72697be61723b42f087ad938705bef Mon Sep 17 00:00:00 2001 From: sorrycc Date: Tue, 14 Aug 2018 15:03:02 +0800 Subject: [PATCH] Make model and page together --- config/plugin.config.js | 2 ++ src/models/list.js | 2 +- src/models/project.js | 2 +- src/{ => pages/Account/Settings}/models/geographic.js | 0 src/{ => pages/Account/Settings}/services/geographic.js | 2 +- src/pages/Dashboard/Workplace.js | 6 +++--- src/{ => pages/Dashboard}/models/activities.js | 2 +- src/{ => pages/Dashboard}/models/chart.js | 2 +- src/{ => pages/Dashboard}/models/monitor.js | 2 +- src/{ => pages/Exception}/models/error.js | 0 src/{ => pages/Exception}/services/error.js | 2 +- src/{ => pages/Forms}/models/form.js | 2 +- src/{ => pages/List}/models/rule.js | 2 +- src/{ => pages/Profile}/models/profile.js | 2 +- src/pages/Result/Error.js | 4 ++-- src/pages/Result/Success.js | 2 +- src/{ => pages/User}/models/login.js | 8 ++++---- src/{ => pages/User}/models/register.js | 6 +++--- 18 files changed, 25 insertions(+), 23 deletions(-) rename src/{ => pages/Account/Settings}/models/geographic.js (100%) rename src/{ => pages/Account/Settings}/services/geographic.js (79%) rename src/{ => pages/Dashboard}/models/activities.js (89%) rename src/{ => pages/Dashboard}/models/chart.js (95%) rename src/{ => pages/Dashboard}/models/monitor.js (89%) rename src/{ => pages/Exception}/models/error.js (100%) rename src/{ => pages/Exception}/services/error.js (61%) rename src/{ => pages/Forms}/models/form.js (95%) rename src/{ => pages/List}/models/rule.js (93%) rename src/{ => pages/Profile}/models/profile.js (89%) rename src/{ => pages/User}/models/login.js (88%) rename src/{ => pages/User}/models/register.js (76%) diff --git a/config/plugin.config.js b/config/plugin.config.js index 27879fdd..dd76beb8 100644 --- a/config/plugin.config.js +++ b/config/plugin.config.js @@ -5,6 +5,8 @@ const AntDesignThemePlugin = require('antd-theme-webpack-plugin'); const path = require('path'); const plugin = config => { + return; + // 将所有 less 合并为一个供 themePlugin使用 const outFile = path.join(__dirname, '../.temp/ant-design-pro.less'); const stylesDir = path.join(__dirname, '../src/'); diff --git a/src/models/list.js b/src/models/list.js index 8acf49f3..06d25a93 100644 --- a/src/models/list.js +++ b/src/models/list.js @@ -1,4 +1,4 @@ -import { queryFakeList, removeFakeList, addFakeList, updateFakeList } from '../services/api'; +import { queryFakeList, removeFakeList, addFakeList, updateFakeList } from '@/services/api'; export default { namespace: 'list', diff --git a/src/models/project.js b/src/models/project.js index f68bef53..cf894125 100644 --- a/src/models/project.js +++ b/src/models/project.js @@ -1,4 +1,4 @@ -import { queryProjectNotice } from '../services/api'; +import { queryProjectNotice } from '@/services/api'; export default { namespace: 'project', diff --git a/src/models/geographic.js b/src/pages/Account/Settings/models/geographic.js similarity index 100% rename from src/models/geographic.js rename to src/pages/Account/Settings/models/geographic.js diff --git a/src/services/geographic.js b/src/pages/Account/Settings/services/geographic.js similarity index 79% rename from src/services/geographic.js rename to src/pages/Account/Settings/services/geographic.js index 570a36e0..ee7fcc3f 100644 --- a/src/services/geographic.js +++ b/src/pages/Account/Settings/services/geographic.js @@ -1,4 +1,4 @@ -import request from '../utils/request'; +import request from '../../../../utils/request'; export async function queryProvince() { return request('/api/geographic/province'); diff --git a/src/pages/Dashboard/Workplace.js b/src/pages/Dashboard/Workplace.js index 91e5dd28..986586e8 100644 --- a/src/pages/Dashboard/Workplace.js +++ b/src/pages/Dashboard/Workplace.js @@ -4,9 +4,9 @@ import { connect } from 'dva'; import { Link } from 'dva/router'; import { Row, Col, Card, List, Avatar } from 'antd'; -import { Radar } from 'components/Charts'; -import EditableLinkGroup from 'components/EditableLinkGroup'; -import PageHeaderLayout from '../../layouts/PageHeaderLayout'; +import { Radar } from '@/components/Charts'; +import EditableLinkGroup from '@/components/EditableLinkGroup'; +import PageHeaderLayout from '@/layouts/PageHeaderLayout'; import styles from './Workplace.less'; diff --git a/src/models/activities.js b/src/pages/Dashboard/models/activities.js similarity index 89% rename from src/models/activities.js rename to src/pages/Dashboard/models/activities.js index 76a7d502..4e0a11e2 100644 --- a/src/models/activities.js +++ b/src/pages/Dashboard/models/activities.js @@ -1,4 +1,4 @@ -import { queryActivities } from '../services/api'; +import { queryActivities } from '@/services/api'; export default { namespace: 'activities', diff --git a/src/models/chart.js b/src/pages/Dashboard/models/chart.js similarity index 95% rename from src/models/chart.js rename to src/pages/Dashboard/models/chart.js index 17bd3061..8dfe4a93 100644 --- a/src/models/chart.js +++ b/src/pages/Dashboard/models/chart.js @@ -1,4 +1,4 @@ -import { fakeChartData } from '../services/api'; +import { fakeChartData } from '@/services/api'; export default { namespace: 'chart', diff --git a/src/models/monitor.js b/src/pages/Dashboard/models/monitor.js similarity index 89% rename from src/models/monitor.js rename to src/pages/Dashboard/models/monitor.js index a5f96f82..e3e832ff 100644 --- a/src/models/monitor.js +++ b/src/pages/Dashboard/models/monitor.js @@ -1,4 +1,4 @@ -import { queryTags } from '../services/api'; +import { queryTags } from '@/services/api'; export default { namespace: 'monitor', diff --git a/src/models/error.js b/src/pages/Exception/models/error.js similarity index 100% rename from src/models/error.js rename to src/pages/Exception/models/error.js diff --git a/src/services/error.js b/src/pages/Exception/services/error.js similarity index 61% rename from src/services/error.js rename to src/pages/Exception/services/error.js index 7e1eeee1..2cb9456c 100644 --- a/src/services/error.js +++ b/src/pages/Exception/services/error.js @@ -1,4 +1,4 @@ -import request from '../utils/request'; +import request from '../../../utils/request'; export async function query(code) { return request(`/api/${code}`); diff --git a/src/models/form.js b/src/pages/Forms/models/form.js similarity index 95% rename from src/models/form.js rename to src/pages/Forms/models/form.js index 64a1d497..0b241b13 100644 --- a/src/models/form.js +++ b/src/pages/Forms/models/form.js @@ -1,6 +1,6 @@ import { routerRedux } from 'dva/router'; import { message } from 'antd'; -import { fakeSubmitForm } from '../services/api'; +import { fakeSubmitForm } from '@/services/api'; export default { namespace: 'form', diff --git a/src/models/rule.js b/src/pages/List/models/rule.js similarity index 93% rename from src/models/rule.js rename to src/pages/List/models/rule.js index 8303dd21..b318dbe3 100644 --- a/src/models/rule.js +++ b/src/pages/List/models/rule.js @@ -1,4 +1,4 @@ -import { queryRule, removeRule, addRule, updateRule } from '../services/api'; +import { queryRule, removeRule, addRule, updateRule } from '@/services/api'; export default { namespace: 'rule', diff --git a/src/models/profile.js b/src/pages/Profile/models/profile.js similarity index 89% rename from src/models/profile.js rename to src/pages/Profile/models/profile.js index 7c9d0198..de651b8a 100644 --- a/src/models/profile.js +++ b/src/pages/Profile/models/profile.js @@ -1,4 +1,4 @@ -import { queryBasicProfile, queryAdvancedProfile } from '../services/api'; +import { queryBasicProfile, queryAdvancedProfile } from '@/services/api'; export default { namespace: 'profile', diff --git a/src/pages/Result/Error.js b/src/pages/Result/Error.js index 4ef70c6d..6d8aafcf 100644 --- a/src/pages/Result/Error.js +++ b/src/pages/Result/Error.js @@ -1,8 +1,8 @@ import React, { Fragment } from 'react'; import { formatMessage, FormattedMessage } from 'umi/locale'; import { Button, Icon, Card } from 'antd'; -import Result from 'components/Result'; -import PageHeaderLayout from '../../layouts/PageHeaderLayout'; +import Result from '@/components/Result'; +import PageHeaderLayout from '@/layouts/PageHeaderLayout'; const extra = ( diff --git a/src/pages/Result/Success.js b/src/pages/Result/Success.js index 7ce0c68f..1d049b8f 100644 --- a/src/pages/Result/Success.js +++ b/src/pages/Result/Success.js @@ -2,7 +2,7 @@ import React, { Fragment } from 'react'; import { formatMessage, FormattedMessage } from 'umi/locale'; import { Button, Row, Col, Icon, Steps, Card } from 'antd'; import Result from 'components/Result'; -import PageHeaderLayout from '../../layouts/PageHeaderLayout'; +import PageHeaderLayout from '@/layouts/PageHeaderLayout'; const { Step } = Steps; diff --git a/src/models/login.js b/src/pages/User/models/login.js similarity index 88% rename from src/models/login.js rename to src/pages/User/models/login.js index 426c9e86..d38465d0 100644 --- a/src/models/login.js +++ b/src/pages/User/models/login.js @@ -1,9 +1,9 @@ import { routerRedux } from 'dva/router'; import { stringify } from 'qs'; -import { fakeAccountLogin, getFakeCaptcha } from '../services/api'; -import { setAuthority } from '../utils/authority'; -import { getPageQuery } from '../utils/utils'; -import { reloadAuthorized } from '../utils/Authorized'; +import { fakeAccountLogin, getFakeCaptcha } from '@/services/api'; +import { setAuthority } from '@/utils/authority'; +import { getPageQuery } from '@/utils/utils'; +import { reloadAuthorized } from '@/utils/Authorized'; export default { namespace: 'login', diff --git a/src/models/register.js b/src/pages/User/models/register.js similarity index 76% rename from src/models/register.js rename to src/pages/User/models/register.js index 57a97838..a2901bbd 100644 --- a/src/models/register.js +++ b/src/pages/User/models/register.js @@ -1,6 +1,6 @@ -import { fakeRegister } from '../services/api'; -import { setAuthority } from '../utils/authority'; -import { reloadAuthorized } from '../utils/Authorized'; +import { fakeRegister } from '@/services/api'; +import { setAuthority } from '@/utils/authority'; +import { reloadAuthorized } from '@/utils/Authorized'; export default { namespace: 'register', -- GitLab