Compare commits

...
10 Commits
Author SHA1 Message Date
zuiidea 75cc86152d 4.3.2 2017-08-07 14:28:32 +08:00
zuiidea 3d9f263330 add Alias 2017-08-07 11:46:42 +08:00
zuiidea 70b5d05f1a format 2017-08-03 14:01:49 +08:00
zuiidea 4da23b9133 version.js 2017-08-03 13:50:43 +08:00
zuiidea da1c52e82b npm run build:new 2017-07-31 17:28:03 +08:00
zuiidea ecbd8bf51e fix little bug 2017-07-31 10:49:15 +08:00
zuiidea 0c9fabe2b4 Merge pull request #452 from zuiidea/develop
fix build:dll
2017-07-30 23:51:07 +08:00
zuiidea 0f27528d2f fix build:dll 2017-07-30 23:50:12 +08:00
zuiidea a36d44d402 Merge pull request #450 from zuiidea/develop
Develop
2017-07-30 14:54:15 +08:00
zuiidea b2b0aa872f Merge pull request #431 from zuiidea/develop
pagenation style
2017-07-21 19:03:48 +08:00
30 changed files with 1652 additions and 1592 deletions
+4 -4
View File
@@ -1,4 +1,4 @@
dist
node_modules
yarn.lock
npm-debug.log
dist
node_modules
yarn.lock
npm-debug.log
+14 -6
View File
@@ -114,11 +114,16 @@ npm run dev
```
构建:
[详情](https://github.com/zuiidea/antd-admin/issues/269)
```bash
npm run build
将会生成dist目录
将会打包至dist/{version}目录 #package.json里version字段
npm run build:new
将会打包至dist/{version增加1}目录 #package.json里version字段
```
代码检测:
@@ -129,11 +134,14 @@ npm run lint
## FAQ
- 项目打包后如何部署? [#269](https://github.com/zuiidea/antd-admin/issues/269)
- 如何做权限管理? [#384](https://github.com/zuiidea/antd-admin/issues/384)
- 如何使用mock.js模拟接口,怎么使用线上接口? [#348](https://github.com/zuiidea/antd-admin/issues/348)
- 如何使用Iconfont,如何使用本地的svg图标? [#270](https://github.com/zuiidea/antd-admin/issues/270)
- 怎么按版本打包,上线时不影响正在访问的用户? [#449](https://github.com/zuiidea/antd-admin/issues/449)
- 项目打包后如何部署? [#269](https://github.com/zuiidea/antd-admin/issues/269)
- 如何做权限管理? [#384](https://github.com/zuiidea/antd-admin/issues/384)
- 如何使用mock.js模拟接口,怎么使用线上接口? [#348](https://github.com/zuiidea/antd-admin/issues/348)
- 如何使用Iconfont,如何使用本地的svg图标? [#270](https://github.com/zuiidea/antd-admin/issues/270)
- 怎么按版本打包,上线时不影响正在访问的用户? [#449](https://github.com/zuiidea/antd-admin/issues/449)
- windows处理CRLF?[参考](http://blog.csdn.net/lysc_forever/article/details/42835203)
git config --global core.autocrlf false
## 参考
+7 -7
View File
@@ -1,18 +1,18 @@
{
"private": true,
"name": "antd-admin",
"version": "4.3.0",
"version": "4.3.2",
"dependencies": {
"antd": "^2.11.2",
"axios": "^0.16.2",
"babel-polyfill": "^6.23.0",
"classnames": "^2.2.5",
"copy-webpack-plugin": "^4.0.1",
"d3-shape": "^1.2.0",
"draftjs-to-markdown": "^0.4.0",
"dva": "^1.2.0",
"dva-loading": "^0.2.0",
"ejs-loader": "^0.3.0",
"js-beautify": "^1.6.14",
"jsonp": "^0.2.1",
"less-vars-to-js": "^1.1.2",
"lodash": "^4.17.4",
@@ -36,6 +36,7 @@
"babel-plugin-import": "^1.1.1",
"babel-plugin-transform-runtime": "^6.9.0",
"babel-runtime": "^6.9.2",
"copy-webpack-plugin": "^4.0.1",
"draftjs-to-html": "^0.7.0",
"dva-model-extend": "^0.1.1",
"eslint": "^4.1.1",
@@ -50,13 +51,12 @@
"redbox-react": "^1.2.10",
"roadhog": "1.0.0-beta.7"
},
"pre-commit": [
"lint"
],
"pre-commit": ["lint"],
"scripts": {
"dev": "set BROWSER=none&&set HOST=0.0.0.0&&roadhog server",
"lint": "eslint --fix --ext .js src",
"build": "roadhog build",
"build:dll": "roadhog buildDll"
"build:dll": "roadhog buildDll",
"build:new": "node version && roadhog build"
}
}
}
+8 -8
View File
@@ -1,8 +1,8 @@
@import "../../themes/vars.less";
.bread {
height: 64px;
line-height: 64px;
padding: 0 24px;
margin-bottom: -24px;
}
@import "~themes/vars";
.bread {
height: 64px;
line-height: 64px;
padding: 0 24px;
margin-bottom: -24px;
}
+12 -12
View File
@@ -1,12 +1,12 @@
@import "../../themes/vars.less";
.footer {
height: 48px;
line-height: 48px;
text-align: center;
font-size: 12px;
color: #999;
background: #fff;
box-shadow: @shadow-2;
width: 100%;
}
@import "~themes/vars";
.footer {
height: 48px;
line-height: 48px;
text-align: center;
font-size: 12px;
color: #999;
background: #fff;
box-shadow: @shadow-2;
width: 100%;
}
+59 -59
View File
@@ -1,59 +1,59 @@
@import "../../themes/vars.less";
.header {
:global .ant-menu-horizontal {
& > .ant-menu-submenu {
float: right;
}
border: none;
display: inline-block;
}
box-shadow: @shadow-2;
position: relative;
display: flex;
justify-content: space-between;
height: 47px;
background-color: #fff;
z-index: 999;
.rightWarpper {
display: flex;
padding-right: 16px;
}
.button {
width: 47px;
height: 47px;
line-height: 47px;
text-align: center;
font-size: 18px;
cursor: pointer;
transition: @transition-ease-in;
&:hover {
color: @primary-color;
background-color: fade(@primary-color, 15%);
}
}
}
.popovermenu {
width: 280px;
margin-left: 6px;
:global .ant-popover-inner-content {
padding: 0;
.ant-menu-inline .ant-menu-item,
.ant-menu-vertical .ant-menu-item {
border-right: 0;
height: 48px;
line-height: 48px;
}
.ant-menu-inline .ant-menu-item-selected,
.ant-menu-inline .ant-menu-selected {
border-right: 0;
}
}
}
@import "~themes/vars";
.header {
:global .ant-menu-horizontal {
& > .ant-menu-submenu {
float: right;
}
border: none;
display: inline-block;
}
box-shadow: @shadow-2;
position: relative;
display: flex;
justify-content: space-between;
height: 47px;
background-color: #fff;
z-index: 999;
.rightWarpper {
display: flex;
padding-right: 16px;
}
.button {
width: 47px;
height: 47px;
line-height: 47px;
text-align: center;
font-size: 18px;
cursor: pointer;
transition: @transition-ease-in;
&:hover {
color: @primary-color;
background-color: fade(@primary-color, 15%);
}
}
}
.popovermenu {
width: 280px;
margin-left: 6px;
:global .ant-popover-inner-content {
padding: 0;
.ant-menu-inline .ant-menu-item,
.ant-menu-vertical .ant-menu-item {
border-right: 0;
height: 48px;
line-height: 48px;
}
.ant-menu-inline .ant-menu-item-selected,
.ant-menu-inline .ant-menu-selected {
border-right: 0;
}
}
}
+292 -292
View File
@@ -1,292 +1,292 @@
@import "../../themes/vars.less";
.layout {
position: relative;
height: 100vh;
&.withnavbar {
.main {
margin-left: 0;
}
}
&.fold {
.sider {
width: 42px;
.logo {
img {
width: 28px;
margin: 6px 7px;
}
}
:global {
.ant-menu-root {
width: 100%;
overflow: visible;
& > .ant-menu-item {
padding: 0;
text-align: center;
.anticon {
font-size: 14px;
margin-right: 0;
}
}
& > .ant-menu-submenu {
& > .ant-menu-submenu-title {
padding: 0;
text-align: center;
.anticon {
font-size: 14px;
margin-right: 0;
}
&::after {
display: none;
}
}
}
}
}
}
.main {
margin-left: 42px;
}
}
.sider {
width: 224px;
background: #3e3e3e;
position: absolute;
overflow: visible;
padding-bottom: 24px;
height: 100vh;
transition: @transition-ease-out;
box-shadow: @shadow-1;
color: #999;
&.light {
background: #fff;
.switchtheme {
background: #fff;
border-top: solid 1px #f8f8f8;
}
}
.logo {
text-align: center;
height: 40px;
line-height: 40px;
cursor: pointer;
margin: 28px 0;
transition: @transition-ease-out;
overflow: hidden;
img {
width: 40px;
margin-right: 8px;
transition: @transition-ease-out;
}
span {
vertical-align: text-bottom;
font-size: 16px;
text-transform: uppercase;
display: inline-block;
}
.anticon {
transition: @transition-ease-out;
}
}
.switchtheme {
width: 100%;
position: absolute;
bottom: 0;
height: 48px;
background-color: @dark-half;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 16px 0 24px;
overflow: hidden;
z-index: 1000;
span {
white-space: nowrap;
overflow: hidden;
}
:global {
.anticon {
min-width: 14px;
margin-right: 8px;
font-size: 14px;
}
}
}
:global {
.ant-menu-dark,
.ant-menu-dark .ant-menu-sub {
color: #999;
}
.ant-menu-root {
height: ~"calc(100vh - 144px)";
overflow-x: hidden;
border-right: none;
&::-webkit-scrollbar-thumb {
background-color: transparent;
}
&:hover {
&::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.2);
}
}
&.ant-menu-vertical {
.ant-menu-sub {
height: 0;
opacity: 0;
transition: none;
}
.ant-menu-submenu-active {
.ant-menu-sub {
height: auto;
opacity: 1;
}
}
}
}
.ant-menu {
transition: @transition-ease-out;
.ant-menu-item,
.ant-menu-submenu-title {
overflow: hidden;
white-space: normal;
}
}
}
}
.main {
margin-left: 224px;
overflow: auto;
height: 100vh;
transition: @transition-ease-out;
:global {
.content-inner {
background: #fff;
padding: 24px;
box-shadow: @shadow-1;
min-height: e("calc(100vh - 184px)");
}
}
.container {
margin: 24px;
}
.content {
min-height: e("calc(100vh - 184px)");
position: relative;
}
}
}
:global .ant-menu-dark {
color: #999;
background-color: #3e3e3e;
.ant-menu-submenu-title:hover,
.ant-menu-submenu:hover {
color: @primary-color;
}
.ant-menu-sub {
color: #999;
}
.ant-menu-submenu-selected {
color: @primary-color;
&:not(.ant-menu-submenu-open) {
background-color: @dark-half;
}
}
.ant-menu-item,
.ant-menu-submenu-title {
& > a {
color: #999;
}
&:hover > a {
color: @primary-color;
}
}
&.ant-menu-inline {
.ant-menu-item-selected {
background-color: @dark-half;
}
}
.ant-menu-item-selected {
color: @primary-color;
background-color: @dark-half;
& > a {
color: @primary-color;
}
&:hover {
background-color: @dark-half;
}
}
}
.spin {
:global .ant-spin-container {
height: 100vh;
}
}
@media (max-width: 767px) {
.layout {
.main {
.container {
margin: 12px;
}
.bread {
padding: 0 12px;
}
.content {
min-height: e("calc(100vh - 160px)");
}
:global {
.content-inner {
padding: 12px;
min-height: e("calc(100vh - 160px)");
}
}
}
}
}
@import "~themes/vars";
.layout {
position: relative;
height: 100vh;
&.withnavbar {
.main {
margin-left: 0;
}
}
&.fold {
.sider {
width: 42px;
.logo {
img {
width: 28px;
margin: 6px 7px;
}
}
:global {
.ant-menu-root {
width: 100%;
overflow: visible;
& > .ant-menu-item {
padding: 0;
text-align: center;
.anticon {
font-size: 14px;
margin-right: 0;
}
}
& > .ant-menu-submenu {
& > .ant-menu-submenu-title {
padding: 0;
text-align: center;
.anticon {
font-size: 14px;
margin-right: 0;
}
&::after {
display: none;
}
}
}
}
}
}
.main {
margin-left: 42px;
}
}
.sider {
width: 224px;
background: #3e3e3e;
position: absolute;
overflow: visible;
padding-bottom: 24px;
height: 100vh;
transition: @transition-ease-out;
box-shadow: @shadow-1;
color: #999;
&.light {
background: #fff;
.switchtheme {
background: #fff;
border-top: solid 1px #f8f8f8;
}
}
.logo {
text-align: center;
height: 40px;
line-height: 40px;
cursor: pointer;
margin: 28px 0;
transition: @transition-ease-out;
overflow: hidden;
img {
width: 40px;
margin-right: 8px;
transition: @transition-ease-out;
}
span {
vertical-align: text-bottom;
font-size: 16px;
text-transform: uppercase;
display: inline-block;
}
.anticon {
transition: @transition-ease-out;
}
}
.switchtheme {
width: 100%;
position: absolute;
bottom: 0;
height: 48px;
background-color: @dark-half;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 16px 0 24px;
overflow: hidden;
z-index: 1000;
span {
white-space: nowrap;
overflow: hidden;
}
:global {
.anticon {
min-width: 14px;
margin-right: 8px;
font-size: 14px;
}
}
}
:global {
.ant-menu-dark,
.ant-menu-dark .ant-menu-sub {
color: #999;
}
.ant-menu-root {
height: ~"calc(100vh - 144px)";
overflow-x: hidden;
border-right: none;
&::-webkit-scrollbar-thumb {
background-color: transparent;
}
&:hover {
&::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.2);
}
}
&.ant-menu-vertical {
.ant-menu-sub {
height: 0;
opacity: 0;
transition: none;
}
.ant-menu-submenu-active {
.ant-menu-sub {
height: auto;
opacity: 1;
}
}
}
}
.ant-menu {
transition: @transition-ease-out;
.ant-menu-item,
.ant-menu-submenu-title {
overflow: hidden;
white-space: normal;
}
}
}
}
.main {
margin-left: 224px;
overflow: auto;
height: 100vh;
transition: @transition-ease-out;
:global {
.content-inner {
background: #fff;
padding: 24px;
box-shadow: @shadow-1;
min-height: e("calc(100vh - 184px)");
}
}
.container {
margin: 24px;
}
.content {
min-height: e("calc(100vh - 184px)");
position: relative;
}
}
}
:global .ant-menu-dark {
color: #999;
background-color: #3e3e3e;
.ant-menu-submenu-title:hover,
.ant-menu-submenu:hover {
color: @primary-color;
}
.ant-menu-sub {
color: #999;
}
.ant-menu-submenu-selected {
color: @primary-color;
&:not(.ant-menu-submenu-open) {
background-color: @dark-half;
}
}
.ant-menu-item,
.ant-menu-submenu-title {
& > a {
color: #999;
}
&:hover > a {
color: @primary-color;
}
}
&.ant-menu-inline {
.ant-menu-item-selected {
background-color: @dark-half;
}
}
.ant-menu-item-selected {
color: @primary-color;
background-color: @dark-half;
& > a {
color: @primary-color;
}
&:hover {
background-color: @dark-half;
}
}
}
.spin {
:global .ant-spin-container {
height: 100vh;
}
}
@media (max-width: 767px) {
.layout {
.main {
.container {
margin: 12px;
}
.bread {
padding: 0 12px;
}
.content {
min-height: e("calc(100vh - 160px)");
}
:global {
.content-inner {
padding: 12px;
min-height: e("calc(100vh - 160px)");
}
}
}
}
}
+1 -1
View File
@@ -1 +1 @@
@import "../../themes/vars.less";
@import "~themes/vars";
-33
View File
@@ -1,33 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="/index.css" />
<!--[if lte IE 10]>
<script
src="https://as.alipayobjects.com/g/component/??console-polyfill/0.2.2/index.js,media-match/2.0.2/media.match.min.js"></script>
<![endif]-->
</head>
<body>
<div id="root"></div>
<script type="text/javascript">
(function() {
var __oldConsoleError = window.console.error.bind(console)
window.console.error = function(message, b) {
if (message === "Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead." ||
"Warning: A Component: React.createClass is deprecated and will be removed in version 16. Use plain JavaScript classes instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement.") {
return false
}
__oldConsoleError(message)
}
})()
</script>
<script src="roadhog.dll.js"></script>
<script src="/index.js"></script>
</body>
</html>
-1
View File
@@ -3,7 +3,6 @@ import dva from 'dva'
import createLoading from 'dva-loading'
import { browserHistory } from 'dva/router'
import 'babel-polyfill'
import './index.html'
// 1. Initialize
const app = dva({
+152 -152
View File
@@ -1,152 +1,152 @@
/* global window */
/* global document */
/* global location */
import { routerRedux } from 'dva/router'
import { parse } from 'qs'
import config from 'config'
import { EnumRoleType } from 'enums'
import { query, logout } from '../services/app'
import * as menusService from '../services/menus'
const { prefix } = config
export default {
namespace: 'app',
state: {
user: {},
permissions: {
visit: [],
},
menu: [
{
id: 1,
icon: 'laptop',
name: 'Dashboard',
router: '/dashboard',
},
],
menuPopoverVisible: false,
siderFold: window.localStorage.getItem(`${prefix}siderFold`) === 'true',
darkTheme: window.localStorage.getItem(`${prefix}darkTheme`) === 'true',
isNavbar: document.body.clientWidth < 769,
navOpenKeys: JSON.parse(window.localStorage.getItem(`${prefix}navOpenKeys`)) || [],
},
subscriptions: {
setup ({ dispatch }) {
dispatch({ type: 'query' })
let tid
window.onresize = () => {
clearTimeout(tid)
tid = setTimeout(() => {
dispatch({ type: 'changeNavbar' })
}, 300)
}
},
},
effects: {
* query ({
payload,
}, { call, put }) {
const { success, user } = yield call(query, payload)
if (success && user) {
const { list } = yield call(menusService.query)
const { permissions } = user
let menu = list
if (permissions.role === EnumRoleType.ADMIN || permissions.role === EnumRoleType.DEVELOPER) {
permissions.visit = list.map(item => item.id)
} else {
menu = list.filter((item) => {
const cases = [
permissions.visit.includes(item.id),
item.mpid ? permissions.visit.includes(item.mpid) || item.mpid === '-1' : true,
item.bpid ? permissions.visit.includes(item.bpid) : true,
]
return cases.every(_ => _)
})
}
yield put({
type: 'updateState',
payload: {
user,
permissions,
menu,
},
})
if (location.pathname === '/login') {
yield put(routerRedux.push('/dashboard'))
}
} else if (config.openPages && config.openPages.indexOf(location.pathname) < 0) {
let from = location.pathname
window.location = `${location.origin}/login?from=${from}`
}
},
* logout ({
payload,
}, { call, put }) {
const data = yield call(logout, parse(payload))
if (data.success) {
yield put({ type: 'query' })
} else {
throw (data)
}
},
* changeNavbar (action, { put, select }) {
const { app } = yield (select(_ => _))
const isNavbar = document.body.clientWidth < 769
if (isNavbar !== app.isNavbar) {
yield put({ type: 'handleNavbar', payload: isNavbar })
}
},
},
reducers: {
updateState (state, { payload }) {
return {
...state,
...payload,
}
},
switchSider (state) {
window.localStorage.setItem(`${prefix}siderFold`, !state.siderFold)
return {
...state,
siderFold: !state.siderFold,
}
},
switchTheme (state) {
window.localStorage.setItem(`${prefix}darkTheme`, !state.darkTheme)
return {
...state,
darkTheme: !state.darkTheme,
}
},
switchMenuPopver (state) {
return {
...state,
menuPopoverVisible: !state.menuPopoverVisible,
}
},
handleNavbar (state, { payload }) {
return {
...state,
isNavbar: payload,
}
},
handleNavOpenKeys (state, { payload: navOpenKeys }) {
return {
...state,
...navOpenKeys,
}
},
},
}
/* global window */
/* global document */
/* global location */
import { routerRedux } from 'dva/router'
import { parse } from 'qs'
import config from 'config'
import { EnumRoleType } from 'enums'
import { query, logout } from 'services/app'
import * as menusService from 'services/menus'
const { prefix } = config
export default {
namespace: 'app',
state: {
user: {},
permissions: {
visit: [],
},
menu: [
{
id: 1,
icon: 'laptop',
name: 'Dashboard',
router: '/dashboard',
},
],
menuPopoverVisible: false,
siderFold: window.localStorage.getItem(`${prefix}siderFold`) === 'true',
darkTheme: window.localStorage.getItem(`${prefix}darkTheme`) === 'true',
isNavbar: document.body.clientWidth < 769,
navOpenKeys: JSON.parse(window.localStorage.getItem(`${prefix}navOpenKeys`)) || [],
},
subscriptions: {
setup ({ dispatch }) {
dispatch({ type: 'query' })
let tid
window.onresize = () => {
clearTimeout(tid)
tid = setTimeout(() => {
dispatch({ type: 'changeNavbar' })
}, 300)
}
},
},
effects: {
* query ({
payload,
}, { call, put }) {
const { success, user } = yield call(query, payload)
if (success && user) {
const { list } = yield call(menusService.query)
const { permissions } = user
let menu = list
if (permissions.role === EnumRoleType.ADMIN || permissions.role === EnumRoleType.DEVELOPER) {
permissions.visit = list.map(item => item.id)
} else {
menu = list.filter((item) => {
const cases = [
permissions.visit.includes(item.id),
item.mpid ? permissions.visit.includes(item.mpid) || item.mpid === '-1' : true,
item.bpid ? permissions.visit.includes(item.bpid) : true,
]
return cases.every(_ => _)
})
}
yield put({
type: 'updateState',
payload: {
user,
permissions,
menu,
},
})
if (location.pathname === '/login') {
yield put(routerRedux.push('/dashboard'))
}
} else if (config.openPages && config.openPages.indexOf(location.pathname) < 0) {
let from = location.pathname
window.location = `${location.origin}/login?from=${from}`
}
},
* logout ({
payload,
}, { call, put }) {
const data = yield call(logout, parse(payload))
if (data.success) {
yield put({ type: 'query' })
} else {
throw (data)
}
},
* changeNavbar (action, { put, select }) {
const { app } = yield (select(_ => _))
const isNavbar = document.body.clientWidth < 769
if (isNavbar !== app.isNavbar) {
yield put({ type: 'handleNavbar', payload: isNavbar })
}
},
},
reducers: {
updateState (state, { payload }) {
return {
...state,
...payload,
}
},
switchSider (state) {
window.localStorage.setItem(`${prefix}siderFold`, !state.siderFold)
return {
...state,
siderFold: !state.siderFold,
}
},
switchTheme (state) {
window.localStorage.setItem(`${prefix}darkTheme`, !state.darkTheme)
return {
...state,
darkTheme: !state.darkTheme,
}
},
switchMenuPopver (state) {
return {
...state,
menuPopoverVisible: !state.menuPopoverVisible,
}
},
handleNavbar (state, { payload }) {
return {
...state,
isNavbar: payload,
}
},
handleNavOpenKeys (state, { payload: navOpenKeys }) {
return {
...state,
...navOpenKeys,
}
},
},
}
+227 -227
View File
@@ -1,227 +1,227 @@
import { parse } from 'qs'
import { myCity, queryWeather, query } from '../services/dashboard'
// zuimei 摘自 http://www.zuimeitianqi.com/res/js/index.js
let zuimei = {
parseActualData (actual) {
let weather = {
icon: `http://www.zuimeitianqi.com/res/icon/${zuimei.getIconName(actual.wea, 'big')}`,
name: zuimei.getWeatherName(actual.wea),
temperature: actual.tmp,
dateTime: new Date(actual.PTm).format('MM-dd hh:mm'),
}
return weather
},
getIconName (wea, flg) {
let myDate = new Date()
let hour = myDate.getHours()
let num = 0
if (wea.indexOf('/') !== -1) {
let weas = wea.split('/')
if (hour < 12) {
num = zuimei.replaceIcon(weas[0])
if (num < 6) {
num = `${num}_${flg}_night.png`
} else {
num = `${num}_${flg}.png`
}
} else if (hour >= 12) {
num = zuimei.replaceIcon(weas[1])
if (hour >= 18) {
num = `${num}_${flg}_night.png`
} else {
num = `${num}_${flg}.png`
}
}
} else if ((hour >= 18 && hour <= 23) || (hour >= 0 && hour <= 6)) {
num = `${num}_${flg}_night.png`
} else {
num = `${num}_${flg}.png`
}
return num
},
replaceIcon (num) {
if (num === 21) {
num = 7
} else if (num === 22) {
num = 8
} else if (num === 10 || num === 11 || num === 12 || num === 23 || num === 24 || num === 25) {
num = 9
} else if (num === 13 || num === 15 || num === 26 || num === 27 || num === 34) {
num = 14
} else if (num === 17 || num === 28) {
num = 16
} else if (num === 35) {
num = 18
} else if (num === 31 || num === 32 || num === 33) {
num = 20
} else if (num === 30) {
num = 29
}
return num
},
getWeatherName (wea) {
let name = ''
if (wea.indexOf('/') !== -1) {
let weas = wea.split('/')
name = `${zuimei.getWeatherByCode(weas[0])}转${zuimei.getWeatherByCode(weas[1])}`
} else {
name = zuimei.getWeatherByCode(wea)
}
return name
},
getWeatherByCode (number) {
let wea = ''
let num = Number(number)
if (num === 0) {
wea = '晴'
} else if (num === 1) {
wea = '多云'
} else if (num === 2) {
wea = '阴'
} else if (num === 3) {
wea = '阵雨'
} else if (num === 4) {
wea = '雷阵雨'
} else if (num === 5) {
wea = '雷阵雨并伴有冰雹'
} else if (num === 6) {
wea = '雨夹雪'
} else if (num === 7) {
wea = '小雨'
} else if (num === 8) {
wea = '中雨'
} else if (num === 9) {
wea = '大雨'
} else if (num === 10) {
wea = '暴雨'
} else if (num === 11) {
wea = '大暴雨'
} else if (num === 12) {
wea = '特大暴雨'
} else if (num === 13) {
wea = '阵雪'
} else if (num === 14) {
wea = '小雪'
} else if (num === 15) {
wea = '中雪'
} else if (num === 16) {
wea = '大雪'
} else if (num === 17) {
wea = '暴雪'
} else if (num === 18) {
wea = '雾'
} else if (num === 19) {
wea = '冻雨'
} else if (num === 20) {
wea = '沙尘暴'
} else if (num === 21) {
wea = '小雨-中雨'
} else if (num === 22) {
wea = '中雨-大雨'
} else if (num === 23) {
wea = '大雨-暴雨'
} else if (num === 24) {
wea = '暴雨-大暴雨'
} else if (num === 25) {
wea = '大暴雨-特大暴雨'
} else if (num === 26) {
wea = '小雪-中雪'
} else if (num === 27) {
wea = '中雪-大雪'
} else if (num === 28) {
wea = '大雪-暴雪'
} else if (num === 29) {
wea = '浮沉'
} else if (num === 30) {
wea = '扬沙'
} else if (num === 31) {
wea = '强沙尘暴'
} else if (num === 32) {
wea = '飑'
} else if (num === 33) {
wea = '龙卷风'
} else if (num === 34) {
wea = '若高吹雪'
} else if (num === 35) {
wea = '轻雾'
} else if (num === 53) {
wea = '霾'
} else if (num === 99) {
wea = '未知'
}
return wea
},
}
export default {
namespace: 'dashboard',
state: {
weather: {
city: '成都',
temperature: '5',
name: '晴',
icon: 'http://www.zuimeitianqi.com/res/icon/0_big.png',
dateTime: new Date().format('MM-dd hh:mm'),
},
sales: [],
quote: {
avatar: 'http://img.hb.aicdn.com/bc442cf0cc6f7940dcc567e465048d1a8d634493198c4-sPx5BR_fw236',
},
numbers: [],
recentSales: [],
comments: [],
completed: [],
browser: [],
cpu: {},
user: {
avatar: 'http://img.hb.aicdn.com/bc442cf0cc6f7940dcc567e465048d1a8d634493198c4-sPx5BR_fw236',
},
},
subscriptions: {
setup ({ dispatch }) {
dispatch({ type: 'query' })
dispatch({ type: 'queryWeather' })
},
},
effects: {
* query ({
payload,
}, { call, put }) {
const data = yield call(query, parse(payload))
yield put({ type: 'queryWeather', payload: { ...data } })
},
* queryWeather (action, { call, put }) {
const myCityResult = yield call(myCity, { flg: 0 })
const result = yield call(queryWeather, { cityCode: myCityResult.selectCityCode })
const weather = zuimei.parseActualData(result.data.actual)
weather.city = myCityResult.selectCityName
yield put({ type: 'queryWeatherSuccess',
payload: {
weather,
} })
},
},
reducers: {
queryWeatherSuccess (state, action) {
return {
...state,
...action.payload,
}
},
queryWeather (state, action) {
return {
...state,
...action.payload,
}
},
},
}
import { parse } from 'qs'
import { myCity, queryWeather, query } from 'services/dashboard'
// zuimei 摘自 http://www.zuimeitianqi.com/res/js/index.js
let zuimei = {
parseActualData (actual) {
let weather = {
icon: `http://www.zuimeitianqi.com/res/icon/${zuimei.getIconName(actual.wea, 'big')}`,
name: zuimei.getWeatherName(actual.wea),
temperature: actual.tmp,
dateTime: new Date(actual.PTm).format('MM-dd hh:mm'),
}
return weather
},
getIconName (wea, flg) {
let myDate = new Date()
let hour = myDate.getHours()
let num = 0
if (wea.indexOf('/') !== -1) {
let weas = wea.split('/')
if (hour < 12) {
num = zuimei.replaceIcon(weas[0])
if (num < 6) {
num = `${num}_${flg}_night.png`
} else {
num = `${num}_${flg}.png`
}
} else if (hour >= 12) {
num = zuimei.replaceIcon(weas[1])
if (hour >= 18) {
num = `${num}_${flg}_night.png`
} else {
num = `${num}_${flg}.png`
}
}
} else if ((hour >= 18 && hour <= 23) || (hour >= 0 && hour <= 6)) {
num = `${num}_${flg}_night.png`
} else {
num = `${num}_${flg}.png`
}
return num
},
replaceIcon (num) {
if (num === 21) {
num = 7
} else if (num === 22) {
num = 8
} else if (num === 10 || num === 11 || num === 12 || num === 23 || num === 24 || num === 25) {
num = 9
} else if (num === 13 || num === 15 || num === 26 || num === 27 || num === 34) {
num = 14
} else if (num === 17 || num === 28) {
num = 16
} else if (num === 35) {
num = 18
} else if (num === 31 || num === 32 || num === 33) {
num = 20
} else if (num === 30) {
num = 29
}
return num
},
getWeatherName (wea) {
let name = ''
if (wea.indexOf('/') !== -1) {
let weas = wea.split('/')
name = `${zuimei.getWeatherByCode(weas[0])}转${zuimei.getWeatherByCode(weas[1])}`
} else {
name = zuimei.getWeatherByCode(wea)
}
return name
},
getWeatherByCode (number) {
let wea = ''
let num = Number(number)
if (num === 0) {
wea = '晴'
} else if (num === 1) {
wea = '多云'
} else if (num === 2) {
wea = '阴'
} else if (num === 3) {
wea = '阵雨'
} else if (num === 4) {
wea = '雷阵雨'
} else if (num === 5) {
wea = '雷阵雨并伴有冰雹'
} else if (num === 6) {
wea = '雨夹雪'
} else if (num === 7) {
wea = '小雨'
} else if (num === 8) {
wea = '中雨'
} else if (num === 9) {
wea = '大雨'
} else if (num === 10) {
wea = '暴雨'
} else if (num === 11) {
wea = '大暴雨'
} else if (num === 12) {
wea = '特大暴雨'
} else if (num === 13) {
wea = '阵雪'
} else if (num === 14) {
wea = '小雪'
} else if (num === 15) {
wea = '中雪'
} else if (num === 16) {
wea = '大雪'
} else if (num === 17) {
wea = '暴雪'
} else if (num === 18) {
wea = '雾'
} else if (num === 19) {
wea = '冻雨'
} else if (num === 20) {
wea = '沙尘暴'
} else if (num === 21) {
wea = '小雨-中雨'
} else if (num === 22) {
wea = '中雨-大雨'
} else if (num === 23) {
wea = '大雨-暴雨'
} else if (num === 24) {
wea = '暴雨-大暴雨'
} else if (num === 25) {
wea = '大暴雨-特大暴雨'
} else if (num === 26) {
wea = '小雪-中雪'
} else if (num === 27) {
wea = '中雪-大雪'
} else if (num === 28) {
wea = '大雪-暴雪'
} else if (num === 29) {
wea = '浮沉'
} else if (num === 30) {
wea = '扬沙'
} else if (num === 31) {
wea = '强沙尘暴'
} else if (num === 32) {
wea = '飑'
} else if (num === 33) {
wea = '龙卷风'
} else if (num === 34) {
wea = '若高吹雪'
} else if (num === 35) {
wea = '轻雾'
} else if (num === 53) {
wea = '霾'
} else if (num === 99) {
wea = '未知'
}
return wea
},
}
export default {
namespace: 'dashboard',
state: {
weather: {
city: '成都',
temperature: '5',
name: '晴',
icon: 'http://www.zuimeitianqi.com/res/icon/0_big.png',
dateTime: new Date().format('MM-dd hh:mm'),
},
sales: [],
quote: {
avatar: 'http://img.hb.aicdn.com/bc442cf0cc6f7940dcc567e465048d1a8d634493198c4-sPx5BR_fw236',
},
numbers: [],
recentSales: [],
comments: [],
completed: [],
browser: [],
cpu: {},
user: {
avatar: 'http://img.hb.aicdn.com/bc442cf0cc6f7940dcc567e465048d1a8d634493198c4-sPx5BR_fw236',
},
},
subscriptions: {
setup ({ dispatch }) {
dispatch({ type: 'query' })
dispatch({ type: 'queryWeather' })
},
},
effects: {
* query ({
payload,
}, { call, put }) {
const data = yield call(query, parse(payload))
yield put({ type: 'queryWeather', payload: { ...data } })
},
* queryWeather (action, { call, put }) {
const myCityResult = yield call(myCity, { flg: 0 })
const result = yield call(queryWeather, { cityCode: myCityResult.selectCityCode })
const weather = zuimei.parseActualData(result.data.actual)
weather.city = myCityResult.selectCityName
yield put({ type: 'queryWeatherSuccess',
payload: {
weather,
} })
},
},
reducers: {
queryWeatherSuccess (state, action) {
return {
...state,
...action.payload,
}
},
queryWeather (state, action) {
return {
...state,
...action.payload,
}
},
},
}
+45 -45
View File
@@ -1,45 +1,45 @@
import { routerRedux } from 'dva/router'
import { queryURL } from 'utils'
import { login } from '../services/login'
export default {
namespace: 'login',
state: {
loginLoading: false,
},
effects: {
* login ({
payload,
}, { put, call }) {
yield put({ type: 'showLoginLoading' })
const data = yield call(login, payload)
yield put({ type: 'hideLoginLoading' })
if (data.success) {
const from = queryURL('from')
yield put({ type: 'app/query' })
if (from) {
yield put(routerRedux.push(from))
} else {
yield put(routerRedux.push('/dashboard'))
}
} else {
throw data
}
},
},
reducers: {
showLoginLoading (state) {
return {
...state,
loginLoading: true,
}
},
hideLoginLoading (state) {
return {
...state,
loginLoading: false,
}
},
},
}
import { routerRedux } from 'dva/router'
import { queryURL } from 'utils'
import { login } from 'services/login'
export default {
namespace: 'login',
state: {
loginLoading: false,
},
effects: {
* login ({
payload,
}, { put, call }) {
yield put({ type: 'showLoginLoading' })
const data = yield call(login, payload)
yield put({ type: 'hideLoginLoading' })
if (data.success) {
const from = queryURL('from')
yield put({ type: 'app/query' })
if (from) {
yield put(routerRedux.push(from))
} else {
yield put(routerRedux.push('/dashboard'))
}
} else {
throw data
}
},
},
reducers: {
showLoginLoading (state) {
return {
...state,
loginLoading: true,
}
},
hideLoginLoading (state) {
return {
...state,
loginLoading: false,
}
},
},
}
+2 -2
View File
@@ -1,6 +1,6 @@
import modelExtend from 'dva-model-extend'
import { query } from '../services/posts'
import { pageModel } from './common'
import { query } from 'services/posts'
import { pageModel } from 'models/common'
export default modelExtend(pageModel, {
+115 -115
View File
@@ -1,115 +1,115 @@
/* global window */
import modelExtend from 'dva-model-extend'
import { config } from 'utils'
import { create, remove, update } from '../services/user'
import * as usersService from '../services/users'
import { pageModel } from './common'
const { query } = usersService
const { prefix } = config
export default modelExtend(pageModel, {
namespace: 'user',
state: {
currentItem: {},
modalVisible: false,
modalType: 'create',
selectedRowKeys: [],
isMotion: window.localStorage.getItem(`${prefix}userIsMotion`) === 'true',
},
subscriptions: {
setup ({ dispatch, history }) {
history.listen((location) => {
if (location.pathname === '/user') {
dispatch({
type: 'query',
payload: location.query,
})
}
})
},
},
effects: {
* query ({ payload = {} }, { call, put }) {
const data = yield call(query, payload)
if (data) {
yield put({
type: 'querySuccess',
payload: {
list: data.data,
pagination: {
current: Number(payload.page) || 1,
pageSize: Number(payload.pageSize) || 10,
total: data.total,
},
},
})
}
},
* delete ({ payload }, { call, put, select }) {
const data = yield call(remove, { id: payload })
const { selectedRowKeys } = yield select(_ => _.user)
if (data.success) {
yield put({ type: 'updateState', payload: { selectedRowKeys: selectedRowKeys.filter(_ => _ !== payload) } })
yield put({ type: 'query' })
} else {
throw data
}
},
* multiDelete ({ payload }, { call, put }) {
const data = yield call(usersService.remove, payload)
if (data.success) {
yield put({ type: 'updateState', payload: { selectedRowKeys: [] } })
yield put({ type: 'query' })
} else {
throw data
}
},
* create ({ payload }, { call, put }) {
const data = yield call(create, payload)
if (data.success) {
yield put({ type: 'hideModal' })
yield put({ type: 'query' })
} else {
throw data
}
},
* update ({ payload }, { select, call, put }) {
const id = yield select(({ user }) => user.currentItem.id)
const newUser = { ...payload, id }
const data = yield call(update, newUser)
if (data.success) {
yield put({ type: 'hideModal' })
yield put({ type: 'query' })
} else {
throw data
}
},
},
reducers: {
showModal (state, { payload }) {
return { ...state, ...payload, modalVisible: true }
},
hideModal (state) {
return { ...state, modalVisible: false }
},
switchIsMotion (state) {
window.localStorage.setItem(`${prefix}userIsMotion`, !state.isMotion)
return { ...state, isMotion: !state.isMotion }
},
},
})
/* global window */
import modelExtend from 'dva-model-extend'
import { config } from 'utils'
import { create, remove, update } from 'services/user'
import * as usersService from 'services/users'
import { pageModel } from './common'
const { query } = usersService
const { prefix } = config
export default modelExtend(pageModel, {
namespace: 'user',
state: {
currentItem: {},
modalVisible: false,
modalType: 'create',
selectedRowKeys: [],
isMotion: window.localStorage.getItem(`${prefix}userIsMotion`) === 'true',
},
subscriptions: {
setup ({ dispatch, history }) {
history.listen((location) => {
if (location.pathname === '/user') {
dispatch({
type: 'query',
payload: location.query,
})
}
})
},
},
effects: {
* query ({ payload = {} }, { call, put }) {
const data = yield call(query, payload)
if (data) {
yield put({
type: 'querySuccess',
payload: {
list: data.data,
pagination: {
current: Number(payload.page) || 1,
pageSize: Number(payload.pageSize) || 10,
total: data.total,
},
},
})
}
},
* delete ({ payload }, { call, put, select }) {
const data = yield call(remove, { id: payload })
const { selectedRowKeys } = yield select(_ => _.user)
if (data.success) {
yield put({ type: 'updateState', payload: { selectedRowKeys: selectedRowKeys.filter(_ => _ !== payload) } })
yield put({ type: 'query' })
} else {
throw data
}
},
* multiDelete ({ payload }, { call, put }) {
const data = yield call(usersService.remove, payload)
if (data.success) {
yield put({ type: 'updateState', payload: { selectedRowKeys: [] } })
yield put({ type: 'query' })
} else {
throw data
}
},
* create ({ payload }, { call, put }) {
const data = yield call(create, payload)
if (data.success) {
yield put({ type: 'hideModal' })
yield put({ type: 'query' })
} else {
throw data
}
},
* update ({ payload }, { select, call, put }) {
const id = yield select(({ user }) => user.currentItem.id)
const newUser = { ...payload, id }
const data = yield call(update, newUser)
if (data.success) {
yield put({ type: 'hideModal' })
yield put({ type: 'query' })
} else {
throw data
}
},
},
reducers: {
showModal (state, { payload }) {
return { ...state, ...payload, modalVisible: true }
},
hideModal (state) {
return { ...state, modalVisible: false }
},
switchIsMotion (state) {
window.localStorage.setItem(`${prefix}userIsMotion`, !state.isMotion)
return { ...state, isMotion: !state.isMotion }
},
},
})
+24 -24
View File
@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import { Router } from 'dva/router'
import App from './routes/app'
import App from 'routes/app'
const registerModel = (app, model) => {
if (!(app._models.filter(m => m.namespace === model.namespace).length === 1)) {
@@ -16,8 +16,8 @@ const Routers = function ({ history, app }) {
component: App,
getIndexRoute (nextState, cb) {
require.ensure([], (require) => {
registerModel(app, require('./models/dashboard'))
cb(null, { component: require('./routes/dashboard/') })
registerModel(app, require('models/dashboard'))
cb(null, { component: require('routes/dashboard/') })
}, 'dashboard')
},
childRoutes: [
@@ -25,117 +25,117 @@ const Routers = function ({ history, app }) {
path: 'dashboard',
getComponent (nextState, cb) {
require.ensure([], (require) => {
registerModel(app, require('./models/dashboard'))
cb(null, require('./routes/dashboard/'))
registerModel(app, require('models/dashboard'))
cb(null, require('routes/dashboard/'))
}, 'dashboard')
},
}, {
path: 'user',
getComponent (nextState, cb) {
require.ensure([], (require) => {
registerModel(app, require('./models/user'))
cb(null, require('./routes/user/'))
registerModel(app, require('models/user'))
cb(null, require('routes/user/'))
}, 'user')
},
}, {
path: 'user/:id',
getComponent (nextState, cb) {
require.ensure([], (require) => {
registerModel(app, require('./models/user/detail'))
cb(null, require('./routes/user/detail/'))
registerModel(app, require('models/user/detail'))
cb(null, require('routes/user/detail/'))
}, 'user-detail')
},
}, {
path: 'login',
getComponent (nextState, cb) {
require.ensure([], (require) => {
registerModel(app, require('./models/login'))
cb(null, require('./routes/login/'))
registerModel(app, require('models/login'))
cb(null, require('routes/login/'))
}, 'login')
},
}, {
path: 'request',
getComponent (nextState, cb) {
require.ensure([], (require) => {
cb(null, require('./routes/request/'))
cb(null, require('routes/request/'))
}, 'request')
},
}, {
path: 'UIElement/iconfont',
getComponent (nextState, cb) {
require.ensure([], (require) => {
cb(null, require('./routes/UIElement/iconfont/'))
cb(null, require('routes/UIElement/iconfont/'))
}, 'UIElement-iconfont')
},
}, {
path: 'UIElement/search',
getComponent (nextState, cb) {
require.ensure([], (require) => {
cb(null, require('./routes/UIElement/search/'))
cb(null, require('routes/UIElement/search/'))
}, 'UIElement-search')
},
}, {
path: 'UIElement/dropOption',
getComponent (nextState, cb) {
require.ensure([], (require) => {
cb(null, require('./routes/UIElement/dropOption/'))
cb(null, require('routes/UIElement/dropOption/'))
}, 'UIElement-dropOption')
},
}, {
path: 'UIElement/layer',
getComponent (nextState, cb) {
require.ensure([], (require) => {
cb(null, require('./routes/UIElement/layer/'))
cb(null, require('routes/UIElement/layer/'))
}, 'UIElement-layer')
},
}, {
path: 'UIElement/dataTable',
getComponent (nextState, cb) {
require.ensure([], (require) => {
cb(null, require('./routes/UIElement/dataTable/'))
cb(null, require('routes/UIElement/dataTable/'))
}, 'UIElement-dataTable')
},
}, {
path: 'UIElement/editor',
getComponent (nextState, cb) {
require.ensure([], (require) => {
cb(null, require('./routes/UIElement/editor/'))
cb(null, require('routes/UIElement/editor/'))
}, 'UIElement-editor')
},
}, {
path: 'chart/lineChart',
getComponent (nextState, cb) {
require.ensure([], (require) => {
cb(null, require('./routes/chart/lineChart/'))
cb(null, require('routes/chart/lineChart/'))
}, 'chart-lineChart')
},
}, {
path: 'chart/barChart',
getComponent (nextState, cb) {
require.ensure([], (require) => {
cb(null, require('./routes/chart/barChart/'))
cb(null, require('routes/chart/barChart/'))
}, 'chart-barChart')
},
}, {
path: 'chart/areaChart',
getComponent (nextState, cb) {
require.ensure([], (require) => {
cb(null, require('./routes/chart/areaChart/'))
cb(null, require('routes/chart/areaChart/'))
}, 'chart-areaChart')
},
}, {
path: 'post',
getComponent (nextState, cb) {
require.ensure([], (require) => {
registerModel(app, require('./models/post'))
cb(null, require('./routes/post/'))
registerModel(app, require('models/post'))
cb(null, require('routes/post/'))
}, 'post')
},
}, {
path: '*',
getComponent (nextState, cb) {
require.ensure([], (require) => {
cb(null, require('./routes/error/'))
cb(null, require('routes/error/'))
}, 'error')
},
},
+72 -72
View File
@@ -1,72 +1,72 @@
@import "../themes/vars.less";
:global {
#nprogress {
pointer-events: none;
.bar {
background: @primary-color;
position: fixed;
z-index: 1024;
top: 0;
left: 0;
right: 0;
width: 100%;
height: 2px;
}
.peg {
display: block;
position: absolute;
right: 0;
width: 100px;
height: 100%;
box-shadow: 0 0 10px @primary-color,0 0 5px @primary-color;
opacity: 1.0;
transform: rotate(3deg) translate(0px,-4px);
}
.spinner {
display: block;
position: fixed;
z-index: 1031;
top: 15px;
right: 15px;
}
.spinner-icon {
width: 18px;
height: 18px;
box-sizing: border-box;
border: solid 2px transparent;
border-top-color: @primary-color;
border-left-color: @primary-color;
border-radius: 50%;
:local {
animation: nprogress-spinner 400ms linear infinite;
}
}
}
.nprogress-custom-parent {
overflow: hidden;
position: relative;
#nprogress {
.bar,
.spinner {
position: absolute;
}
}
}
}
@keyframes nprogress-spinner {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@import "~themes/vars";
:global {
#nprogress {
pointer-events: none;
.bar {
background: @primary-color;
position: fixed;
z-index: 1024;
top: 0;
left: 0;
right: 0;
width: 100%;
height: 2px;
}
.peg {
display: block;
position: absolute;
right: 0;
width: 100px;
height: 100%;
box-shadow: 0 0 10px @primary-color,0 0 5px @primary-color;
opacity: 1.0;
transform: rotate(3deg) translate(0px,-4px);
}
.spinner {
display: block;
position: fixed;
z-index: 1031;
top: 15px;
right: 15px;
}
.spinner-icon {
width: 18px;
height: 18px;
box-sizing: border-box;
border: solid 2px transparent;
border-top-color: @primary-color;
border-left-color: @primary-color;
border-radius: 50%;
:local {
animation: nprogress-spinner 400ms linear infinite;
}
}
}
.nprogress-custom-parent {
overflow: hidden;
position: relative;
#nprogress {
.bar,
.spinner {
position: absolute;
}
}
}
}
@keyframes nprogress-spinner {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
+43 -43
View File
@@ -1,43 +1,43 @@
@import "../../../themes/vars.less";
.comments {
:global .ant-table-thead > tr > th {
background: #fff;
border-bottom: solid 1px @border-color-base;
}
.avatar {
width: 48px;
height: 48px;
background-position: center;
background-size: cover;
border-radius: 50%;
background: #f8f8f8;
display: inline-block;
}
.content {
text-align: left;
color: #757575;
}
.date {
color: #a3a3a3;
line-height: 30px;
}
.daterow {
display: flex;
justify-content: space-between;
}
.name {
font-size: 14px;
color: #474747;
text-align: left;
}
.avatarcolumn {
vertical-align: top;
}
}
@import "~themes/vars";
.comments {
:global .ant-table-thead > tr > th {
background: #fff;
border-bottom: solid 1px @border-color-base;
}
.avatar {
width: 48px;
height: 48px;
background-position: center;
background-size: cover;
border-radius: 50%;
background: #f8f8f8;
display: inline-block;
}
.content {
text-align: left;
color: #757575;
}
.date {
color: #a3a3a3;
line-height: 30px;
}
.daterow {
display: flex;
justify-content: space-between;
}
.name {
font-size: 14px;
color: #474747;
text-align: left;
}
.avatarcolumn {
vertical-align: top;
}
}
+50 -50
View File
@@ -1,50 +1,50 @@
@import "../../../themes/vars.less";
.sales {
.title {
margin-left: 32px;
font-size: 16px;
}
}
.radiusdot {
width: 12px;
height: 12px;
margin-right: 8px;
border-radius: 50%;
display: inline-block;
}
.legend {
color: @dark-half;
text-align: right;
color: #999;
font-size: 14px;
li {
height: 48px;
line-height: 48px;
display: inline-block;
&+li {
margin-left: 24px;
}
}
}
.tooltip {
background: #fff;
padding: 20px;
font-size: 14px;
.tiptitle {
font-weight: 700;
font-size: 16px;
margin-bottom: 8px;
}
.tipitem {
height: 32px;
line-height: 32px;
}
}
@import "~themes/vars";
.sales {
.title {
margin-left: 32px;
font-size: 16px;
}
}
.radiusdot {
width: 12px;
height: 12px;
margin-right: 8px;
border-radius: 50%;
display: inline-block;
}
.legend {
color: @dark-half;
text-align: right;
color: #999;
font-size: 14px;
li {
height: 48px;
line-height: 48px;
display: inline-block;
&+li {
margin-left: 24px;
}
}
}
.tooltip {
background: #fff;
padding: 20px;
font-size: 14px;
.tiptitle {
font-weight: 700;
font-size: 16px;
margin-bottom: 8px;
}
.tipitem {
height: 32px;
line-height: 32px;
}
}
+32 -32
View File
@@ -1,32 +1,32 @@
@import "../../../themes/vars.less";
.numberCard {
padding: 32px;
margin-bottom: 24px;
cursor: pointer;
.iconWarp {
font-size: 54px;
float: left;
}
.content {
width: 100%;
padding-left: 78px;
.title {
line-height: 16px;
font-size: 16px;
margin-bottom: 8px;
height: 16px;
.text-overflow();
}
.number {
line-height: 32px;
font-size: 24px;
height: 32px;
.text-overflow();
}
}
}
@import "~themes/vars";
.numberCard {
padding: 32px;
margin-bottom: 24px;
cursor: pointer;
.iconWarp {
font-size: 54px;
float: left;
}
.content {
width: 100%;
padding-left: 78px;
.title {
line-height: 16px;
font-size: 16px;
margin-bottom: 8px;
height: 16px;
.text-overflow();
}
.number {
line-height: 32px;
font-size: 24px;
height: 32px;
.text-overflow();
}
}
}
+52 -52
View File
@@ -1,52 +1,52 @@
@import "../../../themes/vars.less";
.quote {
color: #fff;
height: 100%;
width: 100%;
padding: 24px;
font-size: 16px;
font-weight: 700;
.inner {
text-overflow: ellipsis;
word-wrap: normal;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
overflow: hidden;
text-indent: 24px;
}
.footer {
position: relative;
margin-top: 14px;
.description {
width: 100%;
p {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-right: 64px;
text-align: right;
&:last-child {
font-weight: 100;
}
}
}
.avatar {
width: 48px;
height: 48px;
background-position: center;
background-size: cover;
border-radius: 50%;
position: absolute;
right: 0;
top: 0;
}
}
}
@import "~themes/vars";
.quote {
color: #fff;
height: 100%;
width: 100%;
padding: 24px;
font-size: 16px;
font-weight: 700;
.inner {
text-overflow: ellipsis;
word-wrap: normal;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
overflow: hidden;
text-indent: 24px;
}
.footer {
position: relative;
margin-top: 14px;
.description {
width: 100%;
p {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-right: 64px;
text-align: right;
&:last-child {
font-weight: 100;
}
}
}
.avatar {
width: 48px;
height: 48px;
background-position: center;
background-size: cover;
border-radius: 50%;
position: absolute;
right: 0;
top: 0;
}
}
}
@@ -1,8 +1,8 @@
@import "../../../themes/vars.less";
.recentsales {
:global .ant-table-thead > tr > th {
background: #fff;
border-bottom: solid 1px @border-color-base;
}
}
@import "~themes/vars";
.recentsales {
:global .ant-table-thead > tr > th {
background: #fff;
border-bottom: solid 1px @border-color-base;
}
}
+50 -50
View File
@@ -1,50 +1,50 @@
@import "../../../themes/vars.less";
.sales {
.title {
margin-left: 32px;
font-size: 16px;
}
}
.radiusdot {
width: 12px;
height: 12px;
margin-right: 8px;
border-radius: 50%;
display: inline-block;
}
.legend {
color: @dark-half;
text-align: right;
color: #999;
font-size: 14px;
li {
height: 48px;
line-height: 48px;
display: inline-block;
&+li {
margin-left: 24px;
}
}
}
.tooltip {
background: #fff;
padding: 20px;
font-size: 14px;
.tiptitle {
font-weight: 700;
font-size: 16px;
margin-bottom: 8px;
}
.tipitem {
height: 32px;
line-height: 32px;
}
}
@import "~themes/vars";
.sales {
.title {
margin-left: 32px;
font-size: 16px;
}
}
.radiusdot {
width: 12px;
height: 12px;
margin-right: 8px;
border-radius: 50%;
display: inline-block;
}
.legend {
color: @dark-half;
text-align: right;
color: #999;
font-size: 14px;
li {
height: 48px;
line-height: 48px;
display: inline-block;
&+li {
margin-left: 24px;
}
}
}
.tooltip {
background: #fff;
padding: 20px;
font-size: 14px;
.tiptitle {
font-weight: 700;
font-size: 16px;
margin-bottom: 8px;
}
.tipitem {
height: 32px;
line-height: 32px;
}
}
+97 -97
View File
@@ -1,97 +1,97 @@
@import "../../../themes/vars.less";
.user {
.header {
display: flex;
justify-content: center;
text-align: center;
color: #fff;
height: 200px;
background-image: ~ "url(./user-background.png)";
background-repeat: no-repeat;
background-size: cover;
align-items: center;
.headerinner {
z-index: 2;
}
&::after {
content: '';
background: @purple;
position: absolute;
width: 100%;
height: 200px;
left: 0;
top: 0;
opacity: 0.4;
z-index: 1;
}
.avatar {
width: 64px;
height: 64px;
background-position: center;
background-size: cover;
border-radius: 50%;
display: inline-block;
}
.name {
font-size: 16px;
}
}
.number {
display: flex;
height: 116px;
justify-content: space-between;
border-bottom: solid 1px #f5f5f5;
.item {
text-align: center;
height: 116px;
width: 100%;
position: relative;
padding: 30px 0;
&+.item {
&::before {
content: '';
display: block;
width: 1px;
height: 116px;
position: absolute;
background: #f5f5f5;
top: 0;
}
}
p {
color: #757575;
&:first-child {
font-size: 16px;
}
&:last-child {
font-size: 20px;
font-weight: 700;
}
}
}
}
.footer {
height: 116px;
display: flex;
justify-content: center;
align-items: center;
:global .ant-btn {
color: @purple;
border-color: @purple;
padding: 6px 16px;
}
}
}
@import "~themes/vars";
.user {
.header {
display: flex;
justify-content: center;
text-align: center;
color: #fff;
height: 200px;
background-image: ~ "url(./user-background.png)";
background-repeat: no-repeat;
background-size: cover;
align-items: center;
.headerinner {
z-index: 2;
}
&::after {
content: '';
background: @purple;
position: absolute;
width: 100%;
height: 200px;
left: 0;
top: 0;
opacity: 0.4;
z-index: 1;
}
.avatar {
width: 64px;
height: 64px;
background-position: center;
background-size: cover;
border-radius: 50%;
display: inline-block;
}
.name {
font-size: 16px;
}
}
.number {
display: flex;
height: 116px;
justify-content: space-between;
border-bottom: solid 1px #f5f5f5;
.item {
text-align: center;
height: 116px;
width: 100%;
position: relative;
padding: 30px 0;
&+.item {
&::before {
content: '';
display: block;
width: 1px;
height: 116px;
position: absolute;
background: #f5f5f5;
top: 0;
}
}
p {
color: #757575;
&:first-child {
font-size: 16px;
}
&:last-child {
font-size: 20px;
font-weight: 700;
}
}
}
}
.footer {
height: 116px;
display: flex;
justify-content: center;
align-items: center;
:global .ant-btn {
color: @purple;
border-color: @purple;
padding: 6px 16px;
}
}
}
+48 -48
View File
@@ -1,48 +1,48 @@
@import "../../../themes/vars.less";
.weather {
color: #fff;
height: 204px;
padding: 24px;
justify-content: space-between;
display: flex;
font-size: 14px;
.left {
display: flex;
flex-direction: column;
width: 64px;
padding-top: 55px;
.icon {
width: 64px;
height: 64px;
background-position: center;
background-size: cover;
}
p {
margin-top: 16px;
}
}
.right {
display: flex;
flex-direction: column;
width: 50%;
.temperature {
font-size: 36px;
text-align: right;
height: 64px;
color: #fff;
}
.description {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: right;
}
}
}
@import "~themes/vars";
.weather {
color: #fff;
height: 204px;
padding: 24px;
justify-content: space-between;
display: flex;
font-size: 14px;
.left {
display: flex;
flex-direction: column;
width: 64px;
padding-top: 55px;
.icon {
width: 64px;
height: 64px;
background-position: center;
background-size: cover;
}
p {
margin-top: 16px;
}
}
.right {
display: flex;
flex-direction: column;
width: 50%;
.temperature {
font-size: 36px;
text-align: right;
height: 64px;
color: #fff;
}
.description {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: right;
}
}
}
+135 -135
View File
@@ -1,135 +1,135 @@
@import "./vars.less";
body {
height: 100%;
overflow-y: hidden;
background-color: #f8f8f8;
}
::-webkit-scrollbar-thumb {
background-color: #e6e6e6;
}
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
:global {
.ant-breadcrumb {
& > span {
&:last-child {
color: #999;
font-weight: normal;
}
}
}
.ant-breadcrumb-link {
.anticon + span {
margin-left: 4px;
}
}
.ant-table {
.ant-table-thead > tr > th {
text-align: center;
}
.ant-table-tbody > tr > td {
text-align: center;
}
&.ant-table-small {
.ant-table-thead > tr > th {
background: #f7f7f7;
}
.ant-table-body > table {
padding: 0;
}
}
}
.ant-table-pagination {
float: none!important;
display: table;
margin: 16px auto !important;
}
.ant-popover-inner {
border: none;
border-radius: 0;
box-shadow: 0 0 20px rgba(100, 100, 100, 0.2);
}
.vertical-center-modal {
display: flex;
align-items: center;
justify-content: center;
.ant-modal {
top: 0;
.ant-modal-body {
max-height: 80vh;
overflow-y: auto;
}
}
}
.ant-form-item-control {
vertical-align: middle;
}
.ant-modal-mask {
background-color: rgba(55, 55, 55, 0.2);
}
.ant-modal-content {
box-shadow: none;
}
.ant-select-dropdown-menu-item {
padding: 12px 16px !important;
}
.margin-right {
margin-right: 16px;
}
a:focus {
text-decoration: none;
}
}
@media (min-width: 1600px) {
:global {
.ant-col-xl-48 {
width: 20%;
}
.ant-col-xl-96 {
width: 40%;
}
}
}
@media (max-width: 767px) {
:global {
.ant-pagination-item,
.ant-pagination-next,
.ant-pagination-options,
.ant-pagination-prev {
margin-bottom: 8px;
}
.ant-card {
.ant-card-head {
padding: 0 12px;
}
.ant-card-body {
padding: 12px;
}
}
}
}
@import "~themes/vars";
body {
height: 100%;
overflow-y: hidden;
background-color: #f8f8f8;
}
::-webkit-scrollbar-thumb {
background-color: #e6e6e6;
}
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
:global {
.ant-breadcrumb {
& > span {
&:last-child {
color: #999;
font-weight: normal;
}
}
}
.ant-breadcrumb-link {
.anticon + span {
margin-left: 4px;
}
}
.ant-table {
.ant-table-thead > tr > th {
text-align: center;
}
.ant-table-tbody > tr > td {
text-align: center;
}
&.ant-table-small {
.ant-table-thead > tr > th {
background: #f7f7f7;
}
.ant-table-body > table {
padding: 0;
}
}
}
.ant-table-pagination {
float: none!important;
display: table;
margin: 16px auto !important;
}
.ant-popover-inner {
border: none;
border-radius: 0;
box-shadow: 0 0 20px rgba(100, 100, 100, 0.2);
}
.vertical-center-modal {
display: flex;
align-items: center;
justify-content: center;
.ant-modal {
top: 0;
.ant-modal-body {
max-height: 80vh;
overflow-y: auto;
}
}
}
.ant-form-item-control {
vertical-align: middle;
}
.ant-modal-mask {
background-color: rgba(55, 55, 55, 0.2);
}
.ant-modal-content {
box-shadow: none;
}
.ant-select-dropdown-menu-item {
padding: 12px 16px !important;
}
.margin-right {
margin-right: 16px;
}
a:focus {
text-decoration: none;
}
}
@media (min-width: 1600px) {
:global {
.ant-col-xl-48 {
width: 20%;
}
.ant-col-xl-96 {
width: 40%;
}
}
}
@media (max-width: 767px) {
:global {
.ant-pagination-item,
.ant-pagination-next,
.ant-pagination-options,
.ant-pagination-prev {
margin-bottom: 8px;
}
.ant-card {
.ant-card-head {
padding: 0 12px;
}
.ant-card-body {
padding: 12px;
}
}
}
}
+14 -14
View File
@@ -1,14 +1,14 @@
@import "./default.less"; // antd-admin
@dark-half: #494949;
@purple: #d897eb;
@shadow-1: 4px 4px 20px 0 rgba(0,0,0,0.01);
@shadow-2: 4px 4px 40px 0 rgba(0,0,0,0.05);
@transition-ease-in: all 0.3s ease-out;
@transition-ease-out: all 0.3s ease-out;
@ease-in: ease-in;
.text-overflow {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
@import "~themes/default"; // antd-admin
@dark-half: #494949;
@purple: #d897eb;
@shadow-1: 4px 4px 20px 0 rgba(0,0,0,0.01);
@shadow-2: 4px 4px 40px 0 rgba(0,0,0,0.05);
@transition-ease-in: all 0.3s ease-out;
@transition-ease-out: all 0.3s ease-out;
@ease-in: ease-in;
.text-overflow {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
+2 -2
View File
@@ -1,2 +1,2 @@
@import "./default.less";
@import "./mixin.less";
@import "~themes/default";
@import "~themes/mixin";
+82
View File
@@ -0,0 +1,82 @@
const fs = require('fs')
const path = require('path')
const beautify = require('js-beautify').js_beautify
const config = require('./package.json')
const dist = path.join(`${__dirname}/dist`)
const maxVersion = 5
const writeVersion = () => new Promise((resolve, reject) => {
const { version } = config
const numbers = version.split('.')
numbers[2] = Number(numbers[2]) + 1
config.version = numbers.join('.')
fs.writeFile(path.join(__dirname, 'package.json'), beautify(JSON.stringify(config), { indent_size: 2 }), (err) => {
if (err) {
reject()
}
resolve()
console.log(`version: ${config.version}`)
})
})
const removeFolder = (folderPath) => {
let files = []
if (fs.existsSync(folderPath)) {
files = fs.readdirSync(folderPath)
files.forEach((file) => {
const curPath = `${folderPath}/${file}`
if (fs.statSync(curPath).isDirectory()) {
removeFolder(curPath)
} else {
fs.unlinkSync(curPath)
}
})
fs.rmdirSync(folderPath)
}
}
const start = async () => {
const files = fs.readdirSync(dist)
const promises = files.map(file => new Promise((resolve, reject) => {
fs.stat(`${dist}/${file}`, (err, stats) => {
if (err) {
reject()
} else {
resolve(!stats.isFile()
? file
: null)
}
})
}))
const result = await Promise.all(promises)
const folders = result.filter((item) => {
if (item) {
return item.split('.').length === 3
}
return false
}).sort((a, b) => {
const an = a.split('.').map(_ => Number(_))
const bn = b.split('.').map(_ => Number(_))
if (an[0] === bn[0]) {
if (an[1] === bn[1]) {
return an[2] < bn[2]
}
return an[1] < bn[1]
}
return an[0] < bn[0]
}).filter((item, index) => {
return index > (maxVersion - 1)
})
for (const item of folders) {
await removeFolder(`${dist}/${item}`)
}
await writeVersion()
}
start()
+5 -1
View File
@@ -46,7 +46,7 @@ module.exports = (webpackConfig, env) => {
minify: {
collapseWhitespace: true,
},
scripts: env === 'production' ? null : ['roadhog.dll.js'],
scripts: env === 'production' ? null : ['/roadhog.dll.js'],
meta: [
{
name: 'description',
@@ -65,6 +65,10 @@ module.exports = (webpackConfig, env) => {
utils: `${__dirname}/src/utils`,
config: `${__dirname}/src/utils/config`,
enums: `${__dirname}/src/utils/enums`,
services: `${__dirname}/src/services`,
models: `${__dirname}/src/models`,
routes: `${__dirname}/src/routes`,
themes: `${__dirname}/src/themes`,
}
return webpackConfig