Commit 28da69f6 by zhaochengxiang

初始化

parents
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
package-lock.json
yarn.lock
/center-home
\ No newline at end of file
const CracoLessPlugin = require('craco-less');
module.exports = {
plugins: [
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: { },
javascriptEnabled: true,
},
},
},
},
],
};
\ No newline at end of file
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@craco/craco": "^6.1.1",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"antd": "^4.14.0",
"craco-less": "^1.17.1",
"less": "^4.1.1",
"less-loader": "^8.0.0",
"core-js": "^3.4.2",
"react-redux": "^7.1.0",
"redux": "^4.0.1",
"redux-saga": "^1.0.5",
"axios": "^0.19.0",
"crypto-js": "^4.0.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-router-dom": "^5.0.1",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "craco start",
"build": "craco build",
"test": "craco test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"proxy": "http://139.198.126.96:9011",
"homepage": "http://myhost/data-govern"
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>数据管控平台</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
import React from 'react';
import {
BrowserRouter as Router,
Route, Switch, Redirect
} from 'react-router-dom';
import { ContextPath } from './util';
import Signin from './view/Signin';
import Home from './view/Home';
import Manage from './view/Manage';
export default class App extends React.Component {
render() {
return (
<React.Fragment>
<Router>
<Switch>
<Route path={`${ContextPath}/login`} component={Signin} exact />
<Route path={`${ContextPath}/home`} component={Home} />
<Route path={`${ContextPath}/manage`} component={Manage} />
<Route path={`${ContextPath}/manage`} exact component={() => <Redirect to={`${ContextPath}/manage/map`} />} />
<Route component={() => <Redirect to={`${ContextPath}/login`} />}/>
</Switch>
</Router>
</React.Fragment>
);
}
}
\ No newline at end of file
import "core-js/stable";
import "regenerator-runtime/runtime";
import React, { Suspense, lazy } from 'react';
import ReactDOM from 'react-dom';
import { ConfigProvider } from 'antd';
import zh_CN from 'antd/es/locale-provider/zh_CN';
import { Provider } from "react-redux";
import { store } from './model';
import './index.less';
const App = lazy(() => import("./App"));
const app = (
<ConfigProvider locale={zh_CN}>
<Suspense fallback={<div className="text-center">正在加载界面...</div>}>
<Provider store={store}><App /></Provider>
</Suspense>
</ConfigProvider>
);
ReactDOM.render(app, document.getElementById('root'));
\ No newline at end of file
@import './normalize.less';
@import '~antd/dist/antd.less';
@import './mixins.less';
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-color: #fff;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
.text-center {
text-align: center;
}
.pointer {
cursor: pointer;
}
.position-absolute {
position: absolute;
}
.position-relative {
position: relative;
}
.overflow-hidden {
overflow: hidden;
}
.d-flex {
display: flex;
}
.ml-auto {
margin-left: auto !important;
}
.text-white {
color: white;
}
//ant design
.ant-layout {
background-color: #eee !important;
}
import React from "react";
import { routeMap } from '../routes';
import './PageHeaderWrapper.less';
export default class PageHeaderWrapper extends React.Component {
constructor() {
super();
this.state = { routes: null };
}
componentDidMount() {
const { location } = this.props;
this.getRoutes(location.pathname);
}
componentDidUpdate(preProps, preState) {
const { location } = this.props;
if (location && preProps.location !== location) {
this.getRoutes(location.pathname)
}
}
getRoutes(pathname) {
const route = routeMap[pathname];//RouteStore.getState();
const routes = [];
// console.log(route)
const getParent = (route) => {
if (route) {
if (route.text) {
routes.unshift(route);
}
route.parent && getParent(route.parent);
}
}
getParent(route);
this.setState({ routes });
}
render() {
const { children, extra } = this.props;
const { routes } = this.state;
let curRoute = null;
if (routes && routes.length > 0) {
curRoute = routes[routes.length - 1];
}
return (
<div className="page-container">
<div className="page-container-header">
<div className="pl-3 page-container-header-title">
{
curRoute && <span>{curRoute.text}</span>
}
</div>
{
extra&&(
<div className="ml-auto pr-3">
{ extra }
</div>
)
}
</div>
<div className="mt-3 page-container-content">
{ children }
</div>
</div>
);
}
}
.page-container {
&-header {
display: flex;
align-items: center;
height: 64px;
background-color: #fff;
&-title {
color: rgba(0,0,0,.85);
font-weight: 600;
font-size: 20px;
}
}
}
\ No newline at end of file
import React, { useState, Fragment } from "react";
import { Link } from 'react-router-dom';
import { Layout, Menu, message, Avatar } from 'antd';
import { connect } from 'react-redux';
import classnames from 'classnames';
import { UserOutlined, LogoutOutlined, MenuFoldOutlined, MenuUnfoldOutlined, HomeOutlined, FileOutlined, AppstoreOutlined } from "@ant-design/icons";
import { ContextPath, Open } from '../util';
import { routes, routeMap } from '../routes';
import './index.less';
import { dispatchLatest } from "../model";
import logo from "../assets/logo.png";
const { Header, Sider, Content } = Layout;
const { SubMenu } = Menu;
const _Logout = ({session, isHome, location}) => session ?
<Menu className={ classnames('logout-menu', isHome?'':'ml-auto') } mode="horizontal" theme="light"
onClick={null}>
<SubMenu
title={
<Fragment>
<Avatar icon={<UserOutlined />} />
<span className="ml-2">{`${session.userDName}/${session.userName}`}</span>
</Fragment>
}
>
<Menu.Item key="SignOut"
onClick={e => dispatchLatest({type: 'user.signout', callback: e => {
message.success('退出成功!')
window.setTimeout(e => Open(`${ContextPath}/login`, { target: '_self' }), 1000);
}})}>
<LogoutOutlined />
<span>退出登录</span>
</Menu.Item>
</SubMenu>
</Menu> : <span />
const Logout = connect(state => {return { session: state.sessionState }})(_Logout)
function GetMenuIcon({ name = '', isMenuItem = false }) {
if (name === 'home') {
return <HomeOutlined />;
}
return isMenuItem ?<FileOutlined /> : <AppstoreOutlined />;
}
function GetSubMenu(children, depth = 0) {
return children.map((route, i) => {
const key = `${depth}-${i}`;
return route.children ?
<SubMenu key={route.path} className={'layout-menu'}
title={
<span>
{ GetMenuIcon({ name: route.icon }) }
<span>{route.text}</span>
</span>
}
>
{GetSubMenu(route.children, key)}
</SubMenu> :
<Menu.Item key={route.path} className={'layout-menu'}>
<Link to={route.path} >
{ GetMenuIcon({ name: route.icon, isMenuItem: true }) }
<span>{route.text}</span>
</Link>
</Menu.Item>
})
}
export const ManageLayout = function ({ content, location }) {
const subMenus = GetSubMenu(routes), route = routeMap[location.pathname], openKey = (route && route.parent) ? route.parent.path : '';
const [collapsed, toggle] = useState(false);
return <Layout style={{ minHeight: '100vh' }}>
<Header className={'bg-primary d-flex manage-header'} >
{/* <Link to={`${ContextPath}/home`} className="manage-sider-logo">
<img
src={logo}
alt=""
style={{ width: '150px', marginLeft: '24px' }}
/>
</Link> */}
{
collapsed ? <MenuUnfoldOutlined style={{ marginLeft: '16px' }} onClick={() => toggle(!collapsed)} /> : <MenuFoldOutlined style={{ marginLeft: '16px' }} onClick={() => toggle(!collapsed)} />
}
<Logout />
</Header>
<Layout>
<Sider trigger={null} collapsible collapsed={collapsed} style={{ backgroundColor: '#fff' }}>
<Menu mode="inline"
defaultSelectedKeys={[location.pathname]}
selectedKeys={[location.pathname]}
defaultOpenKeys={[openKey]} >
{subMenus}
</Menu>
</Sider>
<Content className="m-4" style={{ backgroundColor: '#eee' }}>
{content}
</Content>
</Layout>
</Layout>
}
export const HomeLayout = function ({ content, location }) {
const subMenus = GetSubMenu(routes);
return <Layout style={{ minHeight: '100vh' }}>
<Header style={{}} className={'bg-white d-flex home-header'}>
<div className="mr-3">
<img
src={logo}
alt=""
style={{ width: '150px'}}
/>
</div>
<Menu
mode="horizontal"
selectedKeys={[location.pathname]}
style={{ lineHeight: '64px'}}>
{subMenus}
</Menu>
<Logout isHome={true} />
</Header>
<Layout style={{ backgroundColor: '#eee' }}>
{content}
</Layout>
</Layout>
}
\ No newline at end of file
.home-header, .manage-header {
align-items: center;
&.ant-layout-header {
color: #ffffff;
padding: 0;
}
.ant-menu {
background-color: transparent;
border-bottom: none;
&.ant-menu-horizontal {
.ant-menu-item,
.ant-menu-submenu,
.ant-menu-item-active,
.ant-menu-item-open,
.ant-menu-item-selected,
.ant-menu-item:hover,
.ant-menu-submenu-active,
.ant-menu-submenu-open,
.ant-menu-submenu-selected,
.ant-menu-submenu:hover {
border-bottom: none;
}
}
}
.layout-menu, .logout-menu {
i, span {
color: #fff;
}
}
.logout-menu {
.anticon-user {
margin-right: 0 !important;
font-size: 18px !important;
}
}
}
.home-header {
justify-content: space-between ;
&.ant-layout-header {
padding: 0 60px;
}
.layout-menu, .logout-menu {
i, span {
color: #000;
}
&:hover {
i, span {
color: #249aec;
}
}
}
}
.manage-sider-logo {
display: flex;
align-items: center;
height: 64px;
overflow: hidden;
}
.manage-header {
.trigger {
font-size: 20px;
cursor: pointer;
padding: 0 24px;
}
}
@paddingArray: 0 0, 1 2px, 2 5px, 3 10px, 4 15px, 5 20px, 6 30px, 7 50px, 8 100px;
.paddingNmargin(@iterator:1) when(@iterator <= length(@paddingArray)) {
@name: extract(extract(@paddingArray, @iterator), 1);
.p-@{name} {
padding: extract(extract(@paddingArray, @iterator), 2);
}
.pl-@{name},
.pl-between-@{name} + .pl-between-@{name} {
padding-left: extract(extract(@paddingArray, @iterator), 2);
}
.pr-@{name} {
padding-right: extract(extract(@paddingArray, @iterator), 2);
}
.pt-@{name} {
padding-top: extract(extract(@paddingArray, @iterator), 2);
}
.pb-@{name} {
padding-bottom: extract(extract(@paddingArray, @iterator), 2);
}
.px-@{name} {
padding-right: extract(extract(@paddingArray, @iterator), 2);
padding-left: extract(extract(@paddingArray, @iterator), 2);
}
.py-@{name} {
padding-top: extract(extract(@paddingArray, @iterator), 2);
padding-bottom: extract(extract(@paddingArray, @iterator), 2);
}
.m-@{name} {
margin: extract(extract(@paddingArray, @iterator), 2);
}
.ml-@{name} {
margin-left: extract(extract(@paddingArray, @iterator), 2);
}
.mr-@{name} {
margin-right: extract(extract(@paddingArray, @iterator), 2);
}
.mt-@{name} {
margin-top: extract(extract(@paddingArray, @iterator), 2);
}
.mb-@{name} {
margin-bottom: extract(extract(@paddingArray, @iterator), 2);
}
.mx-@{name} {
margin-right: extract(extract(@paddingArray, @iterator), 2);
margin-left: extract(extract(@paddingArray, @iterator), 2);
}
.my-@{name} {
margin-top: extract(extract(@paddingArray, @iterator), 2);
margin-bottom: extract(extract(@paddingArray, @iterator), 2);
}
.paddingNmargin(@iterator + 1);
}
.paddingNmargin();
@colorArray: primary @primary-color, success @success-color, warning @warning-color, error @error-color,
muted @normal-color, white @white, transparent transparent;
.color(@iterator:1) when(@iterator <= length(@colorArray)) {
@name: extract(extract(@colorArray, @iterator), 1);
.text-@{name} {
color: extract(extract(@colorArray, @iterator), 2) !important;
}
.bg-@{name} {
background-color: extract(extract(@colorArray, @iterator), 2) !important;
}
.color(@iterator + 1);
}
.color();
@fontArray: lg 2rem, sm @font-size-sm, xl 3rem, h1 @heading-1-size, h2 @heading-2-size,
h3 @heading-3-size, h3 @heading-3-size;
.fontSize(@iterator:1) when(@iterator <= length(@fontArray)) {
@name: extract(extract(@fontArray, @iterator), 1);
.font-@{name} {
font-size: extract(extract(@fontArray, @iterator), 2) !important;
}
.fontSize(@iterator + 1);
}
.fontSize();
.font-weight-lighter {
font-weight: lighter !important;
}
@borderArray: 0 0, 1 2px;
.borderWidth(@iterator:1) when(@iterator <= length(@borderArray)) {
@name: extract(extract(@borderArray, @iterator), 1);
.border-left-@{name} {
border-left-width: extract(extract(@borderArray, @iterator), 2) !important;
}
.border-right-@{name} {
border-right-width: extract(extract(@borderArray, @iterator), 2) !important;
}
.border-top-@{name} {
border-top-width: extract(extract(@borderArray, @iterator), 2) !important;
}
.border-bottom-@{name} {
border-bottom-width: extract(extract(@borderArray, @iterator), 2) !important;
}
.border-@{name} {
border-width: extract(extract(@borderArray, @iterator), 2) !important;
}
.borderWidth(@iterator + 1);
}
.borderWidth();
\ No newline at end of file
import * as service from '../service/assets';
import { call } from 'redux-saga/effects';
export function* getDomainsAndHotwords(payload) {
const domains = yield call(service.domains, null);
const hotwords = yield call(service.getHotWord, payload);
return {domains: domains||[], hotwords: hotwords||[]};
}
export function* domains(payload) {
return yield call(service.domains, payload);
}
export function* getHotWord(payload) {
return yield call(service.getHotWord, payload);
}
export function* searchTableModelsByPage(payload) {
return yield call(service.searchTableModelsByPage, payload);
}
export function* queryTopicAsTree(payload) {
return yield call(service.queryTopicAsTree, payload);
}
export function* listCatalogTableModelsByPage(payload) {
return yield call(service.listCatalogTableModelsByPage, payload);
}
export function* listTableModelColumnsWithQuerySql(payload) {
return yield call(service.listTableModelColumnsWithQuerySql, payload);
}
export function* listTableModelSampleDatas(payload) {
return yield call(service.listTableModelSampleDatas, payload);
}
export function* getMetadata(payload) {
const items = yield call(service.getMetadata, payload);
const args = { metedata: items, download: false};
if(items && items.namePath){
const download = yield call(service.isHaveUploadFile, items.namePath);
if(download === 1) args.download = true
}
return args;
}
export function* subscribeTableModel(payload) {
return yield call(service.subscribeTableModel, payload);
}
export function* unSubscribeTableModel(payload) {
return yield call(service.unSubscribeTableModel, payload);
}
export function* setTableModelScore(payload) {
return yield call(service.setTableModelScore, payload);
}
export function* apply(payload) {
return yield call(service.apply, payload);
}
export function* getDataFlowCount(payload) {
return yield call(service.getDataFlowCount, payload);
}
export function* uploadAttachment(payload) {
return yield call(service.uploadAttachment, payload);
}
export function* treeQuery(payload) {
return yield call(service.treeQuery,payload);
}
export function* fileQuery(payload) {
return yield call(service.fileQuery, payload);
}
\ No newline at end of file
import { createStore, applyMiddleware } from 'redux'
import createSagaMiddleware from 'redux-saga'
import { all, call, takeLatest, takeEvery, cancelled } from 'redux-saga/effects'
import { message } from 'antd'
import { SetSource, Cancel } from '../util/axios'
import { Connect } from '../util';
import { reducers } from './reducer';
import * as user from './user';
import * as assets from './assets';
import * as metadata from './metadata';
const funcs = Connect({ user, assets, metadata })
function* request(args) {
const { type, payload, callback, error } = args.args;
SetSource();
try {
const rs = yield call(funcs[type], payload)
if (callback)
yield call(callback, rs)
} catch (ex) {
ex.ApiError && ex.ApiError.message && message.error(ex.ApiError.message);
error && error(ex);
}finally {
if (yield cancelled()) {
yield Cancel('cancel request');
}
}
}
function* watchLatest() {
yield takeLatest('TAKE_LATEST', request)
}
function* watchEvery() {
yield takeEvery('TAKE_EVERY', request)
}
const sagaMiddleware = createSagaMiddleware()
export const store = createStore(
reducers,
applyMiddleware(sagaMiddleware)
)
function* rootSaga() {
yield all([
watchLatest(), watchEvery()
])
}
sagaMiddleware.run(rootSaga)
export const dispatchLatest = ({ type, payload=null, callback=null, error=null }) => store.dispatch({ type: 'TAKE_LATEST', args: { type, payload, callback, error } })
export const dispatch = ({ type, payload=null, callback=null, error=null }) => store.dispatch({ type: 'TAKE_EVERY', args: { type, payload, callback, error } })
export const action = ({ type, args}) => store.dispatch({ type, args })
import * as service from '../service/metadata';
import { call } from 'redux-saga/effects';
export function* queryTopicAsTree(payload) {
let treeData = yield call(service.queryTopicAsTree, payload);
treeData = treeData || [];
for (let node of treeData) {
let children = yield call(service.queryChildTopicAsTree, {
parentId: node._id,
model: payload.model
});
children = children||[];
children.map(cnode=> {
cnode.title = cnode.name || '';
cnode.key = cnode._id;
return cnode;
})
node.loadData = true;
node.children = children;
node.title = node.name || '';
node.key = node._id;
node.isLeaf = (children.length===0)?true:false;
}
return treeData;
}
export function* queryChildTopicAsTree(payload) {
let childTreeData = yield call(service.queryChildTopicAsTree, payload);
childTreeData = childTreeData||[];
childTreeData.map(cnode=> {
cnode.title = cnode.name || '';
cnode.key = cnode._id;
return cnode;
})
return childTreeData;
}
export function* tableModelsByPage(payload) {
return yield call(service.tableModelsByPage, payload);
}
import { combineReducers } from 'redux'
export const set_sess_state = 'set_sess_state';
export const sessionState = function (state = null, action) {
switch (action.type) {
case set_sess_state:
return action.args
default:
return state
}
}
export const reducers = combineReducers({
sessionState
})
import * as service from '../service/user';
import { call } from 'redux-saga/effects';
export function* fetchSessionInfo(payload) {
const session = yield call(service.sessionInfo, payload);
return session;
}
export function* signin(payload) {
return yield call(service.signin, payload);
}
export function* signout() {
return yield call(service.signout);
}
export function* getUserSubscribeTableModels(payload) {
return yield call(service.getUserSubscribeTableModels, payload);
}
export function* listPrivilegeTableModels(payload) {
return yield call(service.listPrivilegeTableModels, payload);
}
export function* questions(payload) {
return yield call(service.questions, payload);
}
export function* saveQuestion(payload) {
return yield call(service.saveQuestion, payload);
}
export function* domains(payload) {
return yield call(service.domains, payload);
}
export function* listProcessByPage(payload) {
return yield call(service.listProcessByPage, payload);
}
export function* confirmProcess(payload){
return yield call(service.confirmProcess, payload);
}
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
html {
line-height: 1.15; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/* Sections
========================================================================== */
/**
* Remove the margin in all browsers.
*/
body {
margin: 0;
}
/**
* Render the `main` element consistently in IE.
*/
main {
display: block;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/* Grouping content
========================================================================== */
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
pre {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/* Text-level semantics
========================================================================== */
/**
* Remove the gray background on active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* 1. Remove the bottom border in Chrome 57-
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Remove the border on images inside links in IE 10.
*/
img {
border-style: none;
}
/* Forms
========================================================================== */
/**
* 1. Change the font styles in all browsers.
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input { /* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select { /* 1 */
text-transform: none;
}
/**
* Correct the inability to style clickable types in iOS and Safari.
*/
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Correct the padding in Firefox.
*/
fieldset {
padding: 0.35em 0.75em 0.625em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Remove the default vertical scrollbar in IE 10+.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10.
* 2. Remove the padding in IE 10.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding in Chrome and Safari on macOS.
*/
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/* Interactive
========================================================================== */
/*
* Add the correct display in Edge, IE 10+, and Firefox.
*/
details {
display: block;
}
/*
* Add the correct display in all browsers.
*/
summary {
display: list-item;
}
/* Misc
========================================================================== */
/**
* Add the correct display in IE 10+.
*/
template {
display: none;
}
/**
* Add the correct display in IE 10.
*/
[hidden] {
display: none;
}
import { ConvertToRouteMap } from './util';
export const routes = [
{
name: 'home',
text: '首页',
icon: 'home',
},
{
name: 'manage',
text: '数据管理',
redirect: 'map',
children: [
{
name: 'map',
text: '数据地图'
},
]
}
];
export const routeMap = ConvertToRouteMap(routes, null, null);
\ No newline at end of file
import { PostJSON, Post, GetJSON, testPost } from "../util/axios"
export function domains(payload) {
return GetJSON("/authservice/domains", payload);
}
export function getHotWord(payload) {
return GetJSON("/datacatalog/front/getHotWord", payload)
}
export function searchTableModelsByPage(payload) {
return GetJSON("/datacatalog/front/searchTableModelsByPage", payload)
}
export function queryTopicAsTree(payload) {
return GetJSON("/datacatalog/front/queryTopicAsTree", payload)
}
export function listCatalogTableModelsByPage(payload) {
return GetJSON("/datacatalog/front/listCatalogTableModelsByPage", payload)
}
export function listTableModelColumnsWithQuerySql(payload) {
return GetJSON("/datacatalog/front/listTableModelColumnsWithQuerySql", payload);
}
export function listTableModelSampleDatas(payload) {
return GetJSON("/datacatalog/front/listTableModelSampleDatas", payload);
}
export async function getMetadata(payload) {
return GetJSON(`/metadatarepo/rest/metadata/get/${encodeURIComponent(payload)}`, null);
}
export async function isHaveUploadFile(payload) {
return GetJSON(`/metadataharvester/rest/fileExcelPdf/isHaveUploadFile?namePath=${payload}`,null);
}
export async function subscribeTableModel(payload) {
return PostJSON("/datacatalog/front/subscribeTableModel",payload);
}
export async function unSubscribeTableModel(payload) {
return PostJSON("/datacatalog/front/unSubscribeTableModel",payload);
}
export async function setTableModelScore(payload) {
return Post("/datacatalog/front/setTableModelScore",payload);
}
export async function apply(payload){
return Post('/datacatalog/front/apply', payload);
}
export function getDataFlowCount(payload) {
return GetJSON('/metadatarepo/rest/jobInfo/getDataFlowCount')
}
export function uploadAttachment(payload) {
return testPost('/datacatalog/front/uploadAttachment',payload)
}
export function treeQuery(payload) {
return GetJSON('/informationmanagement/rest/fileCatalog/query')
}
export function fileQuery(payload) {
return GetJSON('/informationmanagement/rest/fileInformation/queryAll',payload)
}
import { GetJSON } from "../util/axios"
export function queryTopicAsTree(payload) {
return GetJSON("/metadatarepo/rest/metadata/getChildByPathAndClass", payload);
}
export function queryChildTopicAsTree(payload) {
return GetJSON("/metadatarepo/rest/metadata/getChild", payload);
}
export function tableModelsByPage(payload) {
return GetJSON("/metadatarepo/rest/metadata/getPageChild", payload)
}
\ No newline at end of file
import { PostJSON, Post, GetJSON } from "../util/axios"
export function sessionInfo(payload) {
return PostJSON("/auth/sessionInfo", payload)
}
export function signin(payload) {
return Post("/auth/signin", payload)
}
export function signout() {
return Post("/auth/signout")
}
export function getUserSubscribeTableModels(payload) {
return GetJSON("/datacatalog/front/getUserSubscribeTableModels")
}
export function listPrivilegeTableModels(payload) {
return GetJSON("/datacatalog/front/listPrivilegeTableModels")
}
export async function questions(payload) {
return GetJSON("/questionfeedback/rest/issuetrack/mylist", payload);
}
export async function saveQuestion(payload) {
return PostJSON("/questionfeedback/rest/issuetrack/save", payload);
}
export async function domains(payload) {
return GetJSON(`/authservice/users/${payload.userId}/domains`, payload);
}
export async function listProcessByPage(payload) {
return GetJSON("/datacatalog/front/listProcessByPage",payload)
}
export async function confirmProcess(payload) {
return PostJSON(`/datacatalog/front/confirmProcess?processId=${payload.processId}`)
}
\ No newline at end of file
import axios from 'axios';
import { message } from 'antd';
import { Open, ContextPath, IsArr } from './index';
const CancelToken = axios.CancelToken;
const baseURL = '/api/';
const instance = axios.create({
baseURL,
timeout: 5000,
headers: {
//'X-Custom-Header': 'rest',
'Cache-Control': 'no-cache,no-store,must-revalidate,max-age=-1,private'
},
responseType: 'json', // default
validateStatus: (status) => {
return true;
}
});
const textplain = axios.create({
baseURL,
timeout: 600000,
headers: {
//'X-Custom-Header': 'rest',
'Cache-Control': 'no-cache,no-store,must-revalidate,max-age=-1,private'
},
transformResponse: [(data) => {
return data;
}],
});
textplain.interceptors.request.use(
(config) => {
let parmas = config.params
if (config.method === 'post' && parmas) {
let url_params = ''
for (const key in parmas) {
const val = parmas[key];
let url_params_temp = url_params;
if (IsArr(val)){
val.map((_val)=> {
url_params_temp += url_params_temp ? '&' : '?';
url_params_temp += encodeURIComponent(key+'[]') + '=' + encodeURIComponent(_val);
return _val;
});
} else {
url_params_temp += url_params_temp ? '&' : '?';
url_params_temp += encodeURIComponent(key) + '=' + encodeURIComponent(parmas[key]);
}
url_params = url_params_temp;
}
config.url = config.url+url_params;
config.params = {};
}
return config;
}
);
const testA = axios.create({
baseURL,
timeout: 5000,
headers:{'Content-Type':'multipart/form-data'},
processData:true,
validateStatus: (status) => {
return true;
}
});
let __source = null;
export const Cancel = function (msg) {
return new Promise(res => __source && __source.cancel(msg));
}
export const SetSource = function (source) {
__source = source || CancelToken.source();
}
const callback = resp => {
if (resp.status === 401) {
message.warning("session过期,请重新登录!");
window.setTimeout(args => Open(`${ContextPath}/login`, { target: '_self' }), 2000);
return null;
}
else if (resp.status !== 200) {
throw resp.data
}
return resp.data || resp;
}
export function GetJSON(url, params) {
const cancelToken = __source ? __source.token : null;
return instance.get(url, {
params, cancelToken,
validateStatus: false
}).then(
callback
)
}
export function PostJSON(url, payload) {
const { params = null, data = null } = payload||{};
const cancelToken = __source ? __source.token : null;
return instance.post(url, null, {
params, data, cancelToken
}).then(
callback
)
}
export function Post(url, payload) {
const { params = null, data = null } = payload||{};
const cancelToken = __source ? __source.token : null;
return textplain.post(url, null, {
params, data, cancelToken
}).then(
callback
)
}
export function testPost(url, payload) {
const { fileList = null,} = payload||{};
let formData = new FormData();
formData.append('attachment',fileList)
return testA.post(url, formData, ).then(
callback
)
}
\ No newline at end of file
import React from "react";
import { message } from 'antd';
import { Redirect } from 'react-router-dom';
import { dispatchLatest, action } from '../model';
import { set_sess_state } from "../model/reducer";
export const ContextPath = '/data-govern';
const routeMap = {};
export const ConvertToRouteMap = function (routes, pPath, pRoute) {
routes.map((route, i) => {
const { name, children, redirect } = route;
const path = `${pPath ? pPath : ''}/${name}`;
route.path = `${ContextPath}${path}`;
route.parent = pRoute;
if (redirect) {
route.redirect = `${route.path}/${redirect}`;
}
if (!(route.path in routeMap)) {
routeMap[route.path] = route;
}
children && ConvertToRouteMap(children, path, route);
return route;
});
return routeMap;
}
export const RedirectHome = () => <Redirect to={`${ContextPath}/home`} />
export const RedirectSignin = () => <Redirect to={`${ContextPath}/login`} />
export const Open = function (url, args) {
const { target = '_blank' } = args || {};
return window.open(url, target);//_self
}
export function Connect(modules) {
const funcs = {};
for (const m in modules) {
const mdl = modules[m];
for (const f in mdl) {
const name = [m, f].join('.');
funcs[name] = mdl[f];
}
}
return funcs;
}
export class GetSession extends React.Component {
componentDidMount() {
const { history, location } = this.props;
dispatchLatest({
type: 'user.fetchSessionInfo',
callback: session => {
if (session && session.userId) {
action({ type: set_sess_state, args: session })
} else {
action({ type: set_sess_state, args: { referer: location.pathname } })
history.push(`${ContextPath}/login`);
}
},
error: () => {
action({ type: set_sess_state, args: { referer: location.pathname } })
history.push(`${ContextPath}/login`);
}
})
}
render() {
return <div>正在获取登录信息...</div>;
}
}
export const Assert = function (arg, msg) {
if (!arg) {
message.warning(msg)
throw msg
}
}
export const paginate = function (items, pageNum = 1, pageSize = 10) {
const offset = (pageNum - 1) * pageSize;
return items.filter((item, i) => i >= offset && i < offset + pageSize);
}
export const IsArr = function (data) {
return data && Object.prototype.toString.call(data) === '[object Array]';
}
import React, { Component } from "react";
import { connect } from 'react-redux';
import { GetSession } from '../../util';
import { HomeLayout } from '../../layout';
class Home extends Component {
render() {
const { session } = this.props;
return (
<React.Fragment>
<HomeLayout {...this.props}
content={(session && session.userId) ? (
<div />
)
: <GetSession {...this.props} />}
/>
</React.Fragment>
);
}
}
export default connect(
state => {
return { session: state.sessionState }
}
)(Home);
import React from 'react';
class Map extends React.Component {
render() {
return (
<>
map
</>
);
}
}
export default Map;
\ No newline at end of file
import React, { Component } from "react";
import { Route, Switch } from "react-router-dom";
import { connect } from 'react-redux';
import { GetSession } from "../../util";
import { ManageLayout } from "../../layout";
import Map from './Map';
class Manage extends Component {
constructor() {
super()
this.state = {}
}
componentDidMount() {}
render() {
const { match } = this.props
const { session } = this.props;
return (
<React.Fragment>
<ManageLayout
{...this.props}
content={
session && session.userId ? (
<Switch>
<Route path={`${match.path}/map`} component={Map} />
</Switch>
) : (
<GetSession {...this.props} />
)
}
/>
</React.Fragment>
)
}
}
export default connect(
state => {
return {session: state.sessionState}
}
)(Manage);
\ No newline at end of file
import React, { Component } from "react";
import { Form, Input, Button, message } from 'antd';
import { connect } from 'react-redux';
import CryptoJS from "crypto-js";
import { UserOutlined, LockOutlined } from "@ant-design/icons";
import { Open, Assert, ContextPath } from '../../util';
import { dispatchLatest } from '../../model';
import loginBG from "../../assets/login_bg.png";
class Signin extends Component {
onFinish = (values) => {
const { history, session } = this.props;
const { referer } = session||{};
const username = values['username']||'';
const password = values['password']||'';
dispatchLatest({
type: 'user.signin',
payload: { params: { username: username, password: CryptoJS.SHA1(password).toString(CryptoJS.enc.Hex) }},
callback: sess => {
if (sess && sess === "expire") {
Open("/license", {target: "_self"});
return;
}
Assert(sess === "ok", "用户名或密码不正确");
message.success('登录成功');
history.push(referer || `${ContextPath}/home`);
}
});
}
render() {
return (
<>
<img className="position-absolute" src={loginBG} style={{ objectFit: 'cover', top: 0, left: 0, right: 0 ,bottom: 0, width: '100%', height:'100%' }} alt="" />
<div className="position-absolute" style={{ top: '50%', right: '10%', backgroundColor: '#fff', width: 350, transform: 'translateY(-50%)'}}>
<div style={{ padding: '30px' }}>
<div style={{ fontSize: 25, fontWeight: 800, color: '#159be9' }}>欢迎,</div>
<div style={{ fontSize: 15, fontWeight: 500, color: '#159be9', marginBottom: 30 }}>深圳证劵交易所数据治理系统</div>
<Form onFinish={this.onFinish} className="login-form">
<Form.Item
name="username"
rules={[
{
required: true,
message: "请输入您的用户名!"
}
]}
>
<Input
placeholder="用户名"
prefix={<UserOutlined />}
/>
</Form.Item>
<Form.Item
name="password"
rules={[
{
required: true,
message: "请输入您的密码!"
}
]}
>
<Input
type="password"
placeholder="密码"
prefix={<LockOutlined />}
/>
</Form.Item>
<Form.Item>
<Button htmlType="submit" style={{ width: '100%', backgroundColor: '#159BE9', color: '#fff' }}>
登录
</Button>
</Form.Item>
</Form>
</div>
<div style={{ height: '30px', lineHeight: '30px', backgroundColor: '#f4f4f4', textAlign: 'center', color: '#333', fontSize: 12, fontWeight: 400 }}>技术支持:广州元曜软件有限公司</div>
</div>
<div className="position-absolute" style={{ bottom: 10, textAlign: 'center', color: '#fff', fontSize: 12, fontWeight: 400, left: '50%', transform: 'translateX(-50%)' }}>版权所有:深圳证劵交易所</div>
</>
);
}
}
export default connect(
state => {
return { session: state.sessionState }
}
)(Signin);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment