Browse Source

主题主题

release_0.0.4
巴林闲侠 2 years ago
parent
commit
0a1922a223
  1. 24
      api/app/lib/controllers/data/index.js
  2. 1
      api/app/lib/index.js
  3. 4
      api/app/lib/routes/data/index.js
  4. 22
      web/client/assets/color.less
  5. 3
      web/client/src/layout/components/header/index.js
  6. 18
      web/client/src/layout/containers/layout/index.js
  7. 2
      web/package.json

24
api/app/lib/controllers/data/index.js

@ -2,6 +2,7 @@
const fs = require('fs');
const xlsxDownload = require('../../../../utils/xlsxDownload.js');
const moment = require('moment');
const request = require('superagent');
async function dataExport (ctx) {
try {
@ -105,6 +106,27 @@ async function dataExport (ctx) {
}
}
async function godTrans (ctx) {
try {
const models = ctx.fs.dc.models;
const { userId } = ctx.fs.api
const res = await request.get('https://report.amap.com/ajax/districtRank.do?linksType=1&cityCode=360100')
const data = JSON.parse(res.text)
const nanchang = data.find(item => item.name == '南昌县') || {}
ctx.status = 200
ctx.body = nanchang
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
message: typeof error == 'string' ? error : undefined
}
}
}
module.exports = {
dataExport
dataExport,
godTrans
};

1
api/app/lib/index.js

@ -23,7 +23,6 @@ module.exports.entry = function (app, router, opts) {
module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Sequelize, models: {} }
fs.readdirSync(path.join(__dirname, '/models')).forEach((filename) => {
console.log(filename);
require(`./models/${filename}`)(dc)
});

4
api/app/lib/routes/data/index.js

@ -15,6 +15,10 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/data/export'] = { content: '导出数据', visible: true };
router.get('/data/export', dataIndex.dataExport);
// god 交通
app.fs.api.logAttr['GET/data/god_trans'] = { content: '获取高德交通数据', visible: true };
router.get('/data/god_trans', dataIndex.godTrans);
// 运政
//客运车
async function setVehicleType (ctx, next) {

22
web/client/assets/color.less

@ -1149,10 +1149,10 @@ tr > .ant-picker-cell-in-view.ant-picker-cell-range-hover-start:last-child::afte
.ant-mentions-dropdown-menu-item-active {background-color: @item-hover-bg;}
.ant-menu-item-danger.ant-menu-item {color: #ff4d4f;}
.ant-menu-item-danger.ant-menu-item:hover, .ant-menu-item-danger.ant-menu-item-active {color: #ff4d4f;}
.ant-menu-item-danger.ant-menu-item:active {background: color(~`colorPalette("@{slider-rail-background-color}", 1)`);}
.ant-menu-item-danger.ant-menu-item:active {background: color(~`colorPalette("@{select-clear-background}", 1)`);}
.ant-menu-item-danger.ant-menu-item-selected {color: #ff4d4f;}
.ant-menu-item-danger.ant-menu-item-selected > a, .ant-menu-item-danger.ant-menu-item-selected > a:hover {color: #ff4d4f;}
.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-danger.ant-menu-item-selected {background-color: color(~`colorPalette("@{slider-rail-background-color}", 1)`);}
.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-danger.ant-menu-item-selected {background-color: color(~`colorPalette("@{select-clear-background}", 1)`);}
.ant-menu-inline .ant-menu-item-danger.ant-menu-item::after {border-right-color: #ff4d4f;}
.ant-menu-dark .ant-menu-item-danger.ant-menu-item, .ant-menu-dark .ant-menu-item-danger.ant-menu-item:hover, .ant-menu-dark .ant-menu-item-danger.ant-menu-item > a {color: #ff4d4f;}
.ant-menu-dark.ant-menu-dark:not(.ant-menu-horizontal) .ant-menu-item-danger.ant-menu-item-selected {color: #fff;background-color: #ff4d4f;}
@ -1722,11 +1722,11 @@ tr.ant-table-expanded-row:hover > td {background: @table-expanded-row-bg;}
.ant-tag-checkable:active, .ant-tag-checkable-checked {color: #fff;}
.ant-tag-checkable-checked {background-color: @primary-color;}
.ant-tag-checkable:active {background-color: color(~`colorPalette("@{primary-color}", 7)`);}
.ant-tag-pink {color: #c41d7f;background: color(~`colorPalette("@{table-expand-icon-bg}", 1)`);border-color: #ffadd2;}
.ant-tag-pink {color: #c41d7f;background: color(~`colorPalette("@{modal-footer-border-color-split}", 1)`);border-color: #ffadd2;}
.ant-tag-pink-inverse {color: #fff;background: #eb2f96;border-color: #eb2f96;}
.ant-tag-magenta {color: #c41d7f;background: color(~`colorPalette("@{table-expand-icon-bg}", 1)`);border-color: #ffadd2;}
.ant-tag-magenta {color: #c41d7f;background: color(~`colorPalette("@{modal-footer-border-color-split}", 1)`);border-color: #ffadd2;}
.ant-tag-magenta-inverse {color: #fff;background: #eb2f96;border-color: #eb2f96;}
.ant-tag-red {color: #cf1322;background: color(~`colorPalette("@{slider-rail-background-color}", 1)`);border-color: #ffa39e;}
.ant-tag-red {color: #cf1322;background: color(~`colorPalette("@{select-clear-background}", 1)`);border-color: #ffa39e;}
.ant-tag-red-inverse {color: #fff;background: #f5222d;border-color: #f5222d;}
.ant-tag-volcano {color: #d4380d;background: #fff2e8;border-color: #ffbb96;}
.ant-tag-volcano-inverse {color: #fff;background: #fa541c;border-color: #fa541c;}
@ -1734,19 +1734,19 @@ tr.ant-table-expanded-row:hover > td {background: @table-expanded-row-bg;}
.ant-tag-orange-inverse {color: #fff;background: #fa8c16;border-color: #fa8c16;}
.ant-tag-yellow {color: #d4b106;background: #feffe6;border-color: #fffb8f;}
.ant-tag-yellow-inverse {color: #fff;background: #fadb14;border-color: #fadb14;}
.ant-tag-gold {color: #d48806;background: #fffbe6;border-color: #ffe58f;}
.ant-tag-gold {color: #d48806;background: color(~`colorPalette("@{error-color-deprecated-border}", 1)`);border-color: #ffe58f;}
.ant-tag-gold-inverse {color: #fff;background: #faad14;border-color: #faad14;}
.ant-tag-cyan {color: #08979c;background: #e6fffb;border-color: #87e8de;}
.ant-tag-cyan-inverse {color: #fff;background: #13c2c2;border-color: #13c2c2;}
.ant-tag-lime {color: #7cb305;background: #fcffe6;border-color: #eaff8f;}
.ant-tag-lime {color: #7cb305;background: color(~`colorPalette("@{steps-nav-arrow-color}", 1)`);border-color: #eaff8f;}
.ant-tag-lime-inverse {color: #fff;background: #a0d911;border-color: #a0d911;}
.ant-tag-green {color: #389e0d;background: #f6ffed;border-color: #b7eb8f;}
.ant-tag-green-inverse {color: #fff;background: #52c41a;border-color: #52c41a;}
.ant-tag-blue {color: #096dd9;background: #e6f7ff;border-color: #91d5ff;}
.ant-tag-blue {color: #096dd9;background: color(~`colorPalette("@{pagination-item-input-bg}", 1)`);border-color: color(~`colorPalette("@{pagination-item-input-bg}", 3)`);}
.ant-tag-blue-inverse {color: #fff;background: #1890ff;border-color: #1890ff;}
.ant-tag-geekblue {color: #1d39c4;background: color(~`colorPalette("@{cascader-menu-bg}", 1)`);border-color: #adc6ff;}
.ant-tag-geekblue {color: #1d39c4;background: color(~`colorPalette("@{modal-content-bg}", 1)`);border-color: #adc6ff;}
.ant-tag-geekblue-inverse {color: #fff;background: #2f54eb;border-color: #2f54eb;}
.ant-tag-purple {color: #531dab;background: color(~`colorPalette("@{disabled-color-dark}", 4)`);border-color: #d3adf7;}
.ant-tag-purple {color: #531dab;background: #f9f0ff;border-color: #d3adf7;}
.ant-tag-purple-inverse {color: #fff;background: #722ed1;border-color: #722ed1;}
.ant-tag-success {color: #52c41a;background: @success-color-deprecated-bg;border-color: @success-color-deprecated-border;}
.ant-tag-processing {color: @primary-color;background: @info-color-deprecated-bg;border-color: @info-color-deprecated-border;}
@ -1984,7 +1984,7 @@ a.ant-typography.ant-typography-disabled:hover, .ant-typography a.ant-typography
.ant-upload-list-picture .ant-upload-list-item-error, .ant-upload-list-picture-card .ant-upload-list-item-error {border-color: #ff4d4f;}
.ant-upload-list-picture .ant-upload-list-item:hover .ant-upload-list-item-info, .ant-upload-list-picture-card .ant-upload-list-item:hover .ant-upload-list-item-info {background: transparent;}
.ant-upload-list-picture .ant-upload-list-item-uploading, .ant-upload-list-picture-card .ant-upload-list-item-uploading {border-style: dashed;}
.ant-upload-list-picture .ant-upload-list-item-error .ant-upload-list-item-thumbnail .anticon svg path[fill='#e6f7ff'], .ant-upload-list-picture-card .ant-upload-list-item-error .ant-upload-list-item-thumbnail .anticon svg path[fill='#e6f7ff'] {fill: @error-color-deprecated-bg;}
.ant-upload-list-picture .ant-upload-list-item-error .ant-upload-list-item-thumbnail .anticon svg path[fill='color(~`colorPalette("@{pagination-item-input-bg}", 1)`)'], .ant-upload-list-picture-card .ant-upload-list-item-error .ant-upload-list-item-thumbnail .anticon svg path[fill='color(~`colorPalette("@{pagination-item-input-bg}", 1)`)'] {fill: @error-color-deprecated-bg;}
.ant-upload-list-picture .ant-upload-list-item-error .ant-upload-list-item-thumbnail .anticon svg path[fill='#1890ff'], .ant-upload-list-picture-card .ant-upload-list-item-error .ant-upload-list-item-thumbnail .anticon svg path[fill='#1890ff'] {fill: #ff4d4f;}
.ant-upload-list-picture-card .ant-upload-list-item-info::before {background-color: rgba(0, 0, 0, 0.5);}
.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-eye, .ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-download, .ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-delete {color: rgba(255, 255, 255, 0.85);}

3
web/client/src/layout/components/header/index.js

@ -52,7 +52,8 @@ const Header = props => {
<div id="nav" className={styles['header-nav']}>
<Menu
mode='horizontal'
selectedKeys={[current]} style={{ border: 0 }}
selectedKeys={[current]}
style={{ border: 0 }}
onClick={handelClick}
>
<div style={{ display: 'inline-block', cursor: "pointer" }} onClick={() => history.push(`/quanju`)}>进入大屏</div>

18
web/client/src/layout/containers/layout/index.js

@ -51,15 +51,9 @@ const LayoutContainer = props => {
})
}, [true])
useEffect(() => {
window.less.modifyVars(themeName == 'light' ? lightVars : darkVars).then(() => {
resize_(collapsed)
}).catch(error => {
resize_(collapsed)
message.error(`主题切换失败`);
});
scrollbar = new PerfectScrollbar('#page-content', { suppressScrollX: true });
}, [])
useEffect(() => {
NProgress.done();
if (!user || !user.authorized) {
@ -89,13 +83,13 @@ const LayoutContainer = props => {
padding: '8px',
height: clientHeight - 16 + 68,
}
if (themeName == 'light') {
contentStyle.background = '#fff';
}
// if (themeName == 'light') {
contentStyle.background = '#fff';
// }
return (
<Layout id="layout">
<Layout.Header style={{ padding: 0 }} >
<Layout.Header style={{ padding: 0, background: '#fff' }} >
<Header
user={user}
pathname={location.pathname}
@ -138,7 +132,7 @@ const LayoutContainer = props => {
)
}
function mapStateToProps(state) {
function mapStateToProps (state) {
const { global, auth, ajaxResponse } = state;
return {
title: global.title,

2
web/package.json

@ -6,7 +6,7 @@
"scripts": {
"test": "mocha",
"start": "cross-env NODE_ENV=development npm run start-params",
"start-params": "npm run color && node server -p 5000 -u http://10.8.30.7:14000",
"start-params": "node server -p 5000 -u http://10.8.30.7:14000",
"deploy": "export NODE_ENV=production&&npm run color && npm run build && node server",
"build-dev": "export NODE_ENV=development&&webpack --config webpack.config.js",
"build": "export NODE_ENV=production&&webpack --config webpack.config.prod.js",

Loading…
Cancel
Save