@ -0,0 +1,16 @@
|
||||
# http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
@ -0,0 +1,4 @@
|
||||
/lambda/
|
||||
/scripts
|
||||
/config
|
||||
.history
|
@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
extends: [require.resolve('@umijs/fabric/dist/eslint')],
|
||||
globals: {
|
||||
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true,
|
||||
page: true,
|
||||
REACT_APP_ENV: true,
|
||||
},
|
||||
};
|
@ -0,0 +1,41 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
**/node_modules
|
||||
# roadhog-api-doc ignore
|
||||
/src/utils/request-temp.js
|
||||
_roadhog-api-doc
|
||||
|
||||
# production
|
||||
/dist
|
||||
/.vscode
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
npm-debug.log*
|
||||
yarn-error.log
|
||||
|
||||
/coverage
|
||||
.idea
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
*bak
|
||||
.vscode
|
||||
|
||||
# visual studio code
|
||||
.history
|
||||
*.log
|
||||
functions/*
|
||||
.temp/**
|
||||
|
||||
# umi
|
||||
.umi
|
||||
.umi-production
|
||||
|
||||
# screenshot
|
||||
screenshot
|
||||
.firebase
|
||||
.eslintcache
|
||||
|
||||
build
|
||||
/public/sso
|
@ -0,0 +1,22 @@
|
||||
**/*.svg
|
||||
package.json
|
||||
.umi
|
||||
.umi-production
|
||||
/dist
|
||||
.dockerignore
|
||||
.DS_Store
|
||||
.eslintignore
|
||||
*.png
|
||||
*.toml
|
||||
docker
|
||||
.editorconfig
|
||||
Dockerfile*
|
||||
.gitignore
|
||||
.prettierignore
|
||||
LICENSE
|
||||
.eslintcache
|
||||
*.lock
|
||||
yarn-error.log
|
||||
.history
|
||||
CNAME
|
||||
/build
|
@ -0,0 +1,5 @@
|
||||
const fabric = require('@umijs/fabric');
|
||||
|
||||
module.exports = {
|
||||
...fabric.prettier,
|
||||
};
|
@ -0,0 +1,5 @@
|
||||
const fabric = require('@umijs/fabric');
|
||||
|
||||
module.exports = {
|
||||
...fabric.stylelint,
|
||||
};
|
@ -0,0 +1,3 @@
|
||||
PORT=8002
|
||||
# HTTPS=true
|
||||
BROWSER=none
|
@ -0,0 +1,34 @@
|
||||
import { name } from './package.json';
|
||||
|
||||
export default {
|
||||
history: { type: 'hash' },
|
||||
base: name,
|
||||
publicPath: '/classInfo/',
|
||||
outputPath: './dist/classInfo',
|
||||
mountElementId: 'classInfo',
|
||||
qiankun: {
|
||||
slave: {},
|
||||
},
|
||||
proxy: {
|
||||
'/IoTCenter': {
|
||||
// "target": "http://222.168.49.126:59996",
|
||||
//"target": "http://10.10.22.26:9976",
|
||||
target: 'http://221.194.113.154:8100',
|
||||
changeOrigin: true,
|
||||
secure: false
|
||||
},
|
||||
'/platform': {
|
||||
// "target": "http://222.168.49.126:59996",
|
||||
//"target": "http://10.10.22.26:9976",
|
||||
target: 'http://221.194.113.154:8100',
|
||||
changeOrigin: true,
|
||||
secure: false
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
require.resolve('../../node_modules/@umijs/plugin-dva/lib'),
|
||||
require.resolve('../../node_modules/@umijs/plugin-model/lib'),
|
||||
require.resolve('../../node_modules/@umijs/plugin-antd/lib'),
|
||||
require.resolve('../../node_modules/@umijs/plugin-qiankun/lib'),
|
||||
],
|
||||
};
|
@ -0,0 +1,14 @@
|
||||
export const qiankun = {
|
||||
// 应用加载之前
|
||||
async bootstrap(props) {
|
||||
console.log('app2 bootstrap', props);
|
||||
},
|
||||
// 应用 render 之前触发
|
||||
async mount(props) {
|
||||
console.log('app2 mount', props);
|
||||
},
|
||||
// 应用卸载之后触发
|
||||
async unmount(props) {
|
||||
console.log('app2 unmount', props);
|
||||
},
|
||||
};
|
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
|
||||
/>
|
||||
<link rel="stylesheet" href="/helloworld/umi.css" />
|
||||
<script>
|
||||
window.routerBase = "helloworld";
|
||||
</script>
|
||||
<script>
|
||||
window.publicPath =
|
||||
window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ || "/helloworld/";
|
||||
</script>
|
||||
<script>
|
||||
//! umi version: 3.2.14
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="helloworld"></div>
|
||||
|
||||
<script src="/helloworld/umi.js" entry></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,3 @@
|
||||
#app2 {
|
||||
height: 100%;
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
import { Layout, Menu } from 'antd';
|
||||
import { Link,useModel } from 'umi';
|
||||
import style from './style.less';
|
||||
|
||||
const { SubMenu } = Menu;
|
||||
const { Header, Content, Sider } = Layout;
|
||||
// alert('join')
|
||||
// const { id } = useModel('@@qiankunStateFromMaster') || {};
|
||||
// alert('id')
|
||||
// console.log(id,'idididididdidi')
|
||||
|
||||
export default ({ children }) => {
|
||||
const { id } = useModel('@@qiankunStateFromMaster') || {};
|
||||
debugger
|
||||
return (
|
||||
<Layout className={style.layout}>
|
||||
{/* <Sider width={200} className={style.sider}>
|
||||
<Menu
|
||||
mode="inline"
|
||||
defaultSelectedKeys={['dashboard']}
|
||||
style={{ height: '100%', borderRight: 0 }}
|
||||
>
|
||||
<Menu.Item key="dashboard">
|
||||
<Link to="/">App2 Dashboard</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="user">
|
||||
<Link to="/user">User</Link>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
</Sider> */}
|
||||
|
||||
<Content
|
||||
style={{
|
||||
background: '#fff',
|
||||
padding: 24,
|
||||
margin: 0,
|
||||
minHeight: 280,
|
||||
}}
|
||||
>
|
||||
{/* {children} */}
|
||||
{
|
||||
React.Children.map(children, child => {
|
||||
console.log(child,'children2222')
|
||||
return React.cloneElement(child, {"test": id})
|
||||
})
|
||||
}
|
||||
</Content>
|
||||
</Layout>
|
||||
)
|
||||
};
|
@ -0,0 +1,9 @@
|
||||
.layout {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.sider {
|
||||
ul {
|
||||
background: rgba(243, 250, 255, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
import mockjs from 'mockjs';
|
||||
|
||||
export default {
|
||||
'GET /api/app1/users': mockjs.mock({
|
||||
'data|100': [
|
||||
{
|
||||
'id|+1': 1,
|
||||
name: '@cname',
|
||||
email: '@email',
|
||||
},
|
||||
],
|
||||
}),
|
||||
};
|
@ -0,0 +1,6 @@
|
||||
export interface TagType {
|
||||
name: string;
|
||||
value: string;
|
||||
type: string;
|
||||
}
|
||||
|
@ -0,0 +1,3 @@
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
export default new EventEmitter();
|
@ -0,0 +1,34 @@
|
||||
import request from './request';
|
||||
|
||||
|
||||
export async function queryTags() {
|
||||
return request('/api/tags');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 单个教室设备信息
|
||||
export async function getClassInfo(params: { [key: string]: string }) {
|
||||
return request(`/IoTCenter/api/v1/node/getNode?number=${params.number}`, {
|
||||
method: 'post',
|
||||
});
|
||||
}
|
||||
|
||||
//开关设备方法
|
||||
export async function execApi(params: { [key: string]: string }) {
|
||||
console.log('params',params);
|
||||
return request(`/IoTCenter/api/v1/api/execApi`, {
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
|
||||
//场景操作方法
|
||||
export async function execScene(id: string) {
|
||||
return request(`/IoTCenter/api/v1/api/execScene`, {
|
||||
method: 'post',
|
||||
data:id
|
||||
});
|
||||
}
|
||||
|
@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "classInfo",
|
||||
"scripts": {
|
||||
"start": "umi dev",
|
||||
"build": "COMPRESS=none umi build",
|
||||
"test": "umi test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^4.0.0",
|
||||
"@ant-design/pro-layout": "^5.0.8",
|
||||
"@aspnet/signalr": "^1.1.4",
|
||||
"@types/lodash.debounce": "^4.0.6",
|
||||
"@types/lodash.isequal": "^4.5.5",
|
||||
"antd": "^4.0.0",
|
||||
"classnames": "^2.2.6",
|
||||
"dva": "^2.4.0",
|
||||
"events": "^3.2.0",
|
||||
"gg-editor": "^2.0.2",
|
||||
"jwt-decode": "^2.2.0",
|
||||
"lodash": "^4.17.11",
|
||||
"lodash-decorators": "^6.0.0",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"lodash.isequal": "^4.5.0",
|
||||
"mockjs": "^1.0.1-beta3",
|
||||
"moment": "^2.24.0",
|
||||
"numeral": "^2.0.6",
|
||||
"nzh": "^1.0.3",
|
||||
"omit.js": "^1.0.2",
|
||||
"path-to-regexp": "2.4.0",
|
||||
"prop-types": "^15.5.10",
|
||||
"qiankun": "^2.0.20",
|
||||
"qs": "^6.9.0",
|
||||
"react": "^16.8.6",
|
||||
"react-dom": "^16.8.6",
|
||||
"react-fittext": "^1.0.0",
|
||||
"react-helmet-async": "^1.0.4",
|
||||
"react-router": "^4.3.1",
|
||||
"umi": "^3.2.14",
|
||||
"umi-request": "^1.0.8",
|
||||
"use-merge-value": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"checkFiles": [
|
||||
"src/**/*.js*",
|
||||
"src/**/*.ts*",
|
||||
"src/**/*.less",
|
||||
"config/**/*.js*",
|
||||
"scripts/**/*.js"
|
||||
]
|
||||
|
||||
}
|
@ -0,0 +1,345 @@
|
||||
import { Link, useModel } from 'umi';
|
||||
import { Card, Col, Row, Statistic, Tree, Modal } from 'antd';
|
||||
import { FormattedMessage, formatMessage, } from 'umi';
|
||||
import React, { Component } from 'react';
|
||||
import { PoweroffOutlined } from '@ant-design/icons';
|
||||
import { Dispatch, Action } from 'redux';
|
||||
import { connect } from 'dva';
|
||||
import { StateType } from '../models/model';
|
||||
import style from './style.less'
|
||||
|
||||
|
||||
|
||||
// export default function(props) {
|
||||
// alert('join')
|
||||
// const { id } = useModel('@@qiankunStateFromMaster') || {};
|
||||
// alert(id)
|
||||
// // const { id } = props;
|
||||
// return (
|
||||
// <div>
|
||||
// <h1>Dashboard 2#</h1>
|
||||
// <div>参数传递:</div>
|
||||
// <div>{id}</div>
|
||||
// </div>
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
|
||||
const { confirm } = Modal;
|
||||
|
||||
interface ClassInfoComProps {
|
||||
dashboardAndmonitor: StateType;
|
||||
|
||||
loading: boolean;
|
||||
}
|
||||
|
||||
interface ClassInfoComState {
|
||||
|
||||
}
|
||||
|
||||
class ClassInfoCom extends Component<ClassInfoComProps,ClassInfoComState> {
|
||||
|
||||
|
||||
state:ClassInfoComState = {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
debugger
|
||||
|
||||
// const { dispatch } = this.props;
|
||||
|
||||
// console.log(this.props.id,'ididididdi')
|
||||
// dispatch({
|
||||
// type: 'dashboardAndmonitor/getClassInfo',
|
||||
// payload: {
|
||||
// number: this.props.id
|
||||
// },
|
||||
|
||||
// })
|
||||
}
|
||||
|
||||
getStatusDevice(data:any){
|
||||
let dom:any = [];
|
||||
data.map((item1:any)=>{
|
||||
if(item1.key == "Light"){
|
||||
dom.push(
|
||||
<p className={style.sensingValue}>{`${item1.name}: ${item1.value}${item1.unit}`}</p>
|
||||
)
|
||||
}
|
||||
|
||||
if(item1.key == "Warning"){
|
||||
dom.push(
|
||||
<p className={style.sensingValue}>{`${item1.name}: ${item1.value}`}</p>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
return dom
|
||||
}
|
||||
|
||||
|
||||
getStatusDeviceHum(data:any){
|
||||
let dom:any = [];
|
||||
data.map((item1:any)=>{
|
||||
if(item1.key == "Temperature"){
|
||||
dom.push(
|
||||
<p className={style.sensingValue}>{`${item1.name}: ${item1.description} ${item1.value}${item1.unit}`}</p>
|
||||
)
|
||||
}
|
||||
|
||||
if(item1.key == "Humidity"){
|
||||
dom.push(
|
||||
<p className={style.sensingValue}>{`${item1.name}: ${item1.description} ${item1.value}${item1.unit}`}</p>
|
||||
)
|
||||
}
|
||||
|
||||
if(item1.key == "Warning"){
|
||||
dom.push(
|
||||
<p className={style.sensingValue}>{`${item1.name}: ${item1.value}`}</p>
|
||||
)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
return dom
|
||||
}
|
||||
|
||||
//获取传感设备列表
|
||||
getSensingList = () => {
|
||||
let dom:any = [];
|
||||
|
||||
if(this.props.dashboardAndmonitor.classInfo.devices){
|
||||
this.props.dashboardAndmonitor.classInfo.devices.map((item:any)=>{
|
||||
if(item.product.number == 'fbee:0106:01'){ //光强传感器
|
||||
dom.push(
|
||||
<div className={style.sensingItem}>
|
||||
<img src='../images/light.svg' className={style.sensingImg}/>
|
||||
{this.getStatusDevice(item.data)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if(item.product.number == 'fbee:0302:01'){ //温湿度传感器
|
||||
dom.push(
|
||||
<div className={style.sensingItem}>
|
||||
<img src='../images/humiture.svg' className={style.sensingImg}/>
|
||||
{this.getStatusDeviceHum(item.data)}
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
if(item.product.number == 'fbee:0402:0d'){ //人体感应器
|
||||
dom.push(
|
||||
<div className={style.sensingItem}>
|
||||
<img src='../images/person.svg' className={style.sensingImg}/>
|
||||
<p className={style.sensingValue}>{`${item.data[0].name}: ${item.data[0].value}`}</p>
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return dom;
|
||||
}
|
||||
|
||||
|
||||
//开关设备方法
|
||||
handleDevices = (data:any) => {
|
||||
const { dispatch } = this.props;
|
||||
let status = this.getDevicesOn(data.data)
|
||||
|
||||
dispatch({
|
||||
type: 'dashboardAndmonitor/exec',
|
||||
payload: {connectionId: window['connectionId'], number:data.number, method:status == '开' ? '/Switch/Off' : '/Switch/On'}
|
||||
});
|
||||
}
|
||||
|
||||
//获取设备开关状态
|
||||
getDevicesOn = (data:any) => {
|
||||
let status = "";
|
||||
|
||||
data.map((item:any)=>{
|
||||
if(item.key == 'State'){
|
||||
status = item.value
|
||||
}
|
||||
})
|
||||
|
||||
return status
|
||||
}
|
||||
|
||||
//获取设备列表
|
||||
getEquList = () => {
|
||||
let dom:any = [];
|
||||
|
||||
if(this.props.dashboardAndmonitor.classInfo.devices){
|
||||
this.props.dashboardAndmonitor.classInfo.devices.map((item:any)=>{
|
||||
|
||||
if(item.product.number == 'fbee:0002:01'){ //一路开关
|
||||
dom.push(
|
||||
<Card className={style.equItem} bordered={true}>
|
||||
<div className={style.equItemTop}>
|
||||
{`${item.displayName}`}
|
||||
</div>
|
||||
<div className={style.equContent}>
|
||||
<img src='/images/switch1.svg' className={style.equImgs}/>
|
||||
<PoweroffOutlined style={{color:this.getDevicesOn(item.data) == "开" ? '#00DB00' : '#FF0000',fontSize:'1.8rem',marginTop:'0.7rem',cursor:'pointer'}}
|
||||
onClick={() => this.handleDevices(item)}
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
if(item.product.number == 'fbee:0009:01'){ //插座
|
||||
dom.push(
|
||||
<Card className={style.equItem} bordered={true}>
|
||||
<div className={style.equItemTop}>
|
||||
{`${item.displayName}`}
|
||||
</div>
|
||||
<div className={style.equContent}>
|
||||
<img src='/images/socket.svg' className={style.equImgs}/>
|
||||
<PoweroffOutlined style={{color:this.getDevicesOn(item.data) == "开" ? '#00DB00' : '#FF0000',fontSize:'1.8rem',marginTop:'0.7rem',cursor:'pointer'}}
|
||||
onClick={() => this.handleDevices(item)}
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
if(item.product.number == 'fbee:0051:01'){ //智能插座
|
||||
dom.push(
|
||||
<Card className={style.equItem} bordered={true}>
|
||||
<div className={style.equItemTop}>
|
||||
{`${item.displayName}`}
|
||||
</div>
|
||||
<div className={style.equContent}>
|
||||
<img src='/images/socket.svg' className={style.equImgs}/>
|
||||
<PoweroffOutlined style={{color:this.getDevicesOn(item.data) == "开" ? '#00DB00' : '#FF0000',fontSize:'1.8rem',marginTop:'0.7rem',cursor:'pointer'}}
|
||||
onClick={() => this.handleDevices(item)}
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
if(item.product.number == 'fbee:000a:01'){ //门锁
|
||||
dom.push(
|
||||
<Card className={style.equItem} bordered={true}>
|
||||
<div className={style.equItemTop}>
|
||||
{`${item.displayName}`}
|
||||
</div>
|
||||
<div className={style.equContent}>
|
||||
<img src='/images/doors.svg' className={style.equImgs}/>
|
||||
<PoweroffOutlined style={{color:this.getDevicesOn(item.data) == "开" ? '#00DB00' : '#FF0000',fontSize:'1.8rem',marginTop:'0.7rem',cursor:'pointer'}}
|
||||
onClick={() => this.handleDevices(item)}
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return dom;
|
||||
}
|
||||
|
||||
//场景操作方法
|
||||
handleScenes = (data:any) => {
|
||||
const { dispatch } = this.props;
|
||||
|
||||
|
||||
dispatch({
|
||||
type: 'dashboardAndmonitor/execScene',
|
||||
payload: '"' + data.id + '"'
|
||||
});
|
||||
}
|
||||
|
||||
//获取场景操作列表
|
||||
getOperInfoList = () => {
|
||||
let dom:any = [];
|
||||
if( this.props.dashboardAndmonitor.classInfo.scenes){
|
||||
this.props.dashboardAndmonitor.classInfo.scenes.map((item:any)=>{
|
||||
dom.push(
|
||||
<div className={style.sensingItem} style={{minHeight:'5rem',cursor:'pointer'}} title={item.name}>
|
||||
<img src='../images/button.svg' className={style.sensingImg} onClick={()=>this.handleScenes(item)}/>
|
||||
<p className={style.sensingValue}>{item.name}</p>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
return dom;
|
||||
}
|
||||
|
||||
render() {
|
||||
debugger
|
||||
alert('join')
|
||||
console.log(this.props.dashboardAndmonitor.classInfo)
|
||||
return (
|
||||
<div style={{width:'100%'}}>
|
||||
<Card bordered={true}>
|
||||
<Row className={style.operSpanStyle}>
|
||||
传感设备
|
||||
</Row>
|
||||
<Row className={style.operSensing}>
|
||||
{this.getSensingList()}
|
||||
</Row>
|
||||
</Card>
|
||||
|
||||
<Card bordered={true} style={{marginTop:'1rem'}}>
|
||||
<Row className={style.operSpanStyle}>
|
||||
场景操作
|
||||
</Row>
|
||||
<Row className={style.operSensing}>
|
||||
{this.getOperInfoList()}
|
||||
</Row>
|
||||
</Card>
|
||||
|
||||
<Card bordered={true} style={{marginTop:'1rem'}}>
|
||||
<Row className={style.operSpanStyle}>
|
||||
设备
|
||||
</Row>
|
||||
</Card>
|
||||
|
||||
<Row className={style.equipmentList}>
|
||||
{this.getEquList()}
|
||||
</Row>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(
|
||||
({
|
||||
dashboardAndmonitor,
|
||||
loading,
|
||||
}: {
|
||||
dashboardAndmonitor: StateType;
|
||||
loading: {
|
||||
models: { [key: string]: boolean };
|
||||
};
|
||||
}) => ({
|
||||
dashboardAndmonitor,
|
||||
loading: loading.models.dashboardAndmonitor,
|
||||
}),
|
||||
)(ClassInfoCom);
|
@ -0,0 +1,146 @@
|
||||
@import '~antd/es/style/themes/default.less';
|
||||
|
||||
.mapChart {
|
||||
height: 452px;
|
||||
padding-top: 24px;
|
||||
img {
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
max-height: 437px;
|
||||
}
|
||||
}
|
||||
|
||||
.pieCard :global(.pie-stat) {
|
||||
font-size: 24px !important;
|
||||
}
|
||||
|
||||
@media screen and (max-width: @screen-lg) {
|
||||
.mapChart {
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.treeStyle{
|
||||
padding: 1rem;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.operSpanStyle{
|
||||
border-bottom: 1px solid #ccc;
|
||||
padding-bottom: 0.5rem;
|
||||
font-weight: bold;
|
||||
padding-left: 1rem;
|
||||
}
|
||||
|
||||
.operSensing{
|
||||
padding-top: 1rem;
|
||||
.sensingItem{
|
||||
width: 10rem;
|
||||
min-height: 6rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
.sensingImg{
|
||||
width: 100%;
|
||||
height: 3rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.sensingValue{
|
||||
width: 100%;
|
||||
margin-bottom: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.equipmentList{
|
||||
width: 100%;
|
||||
padding-top: 1.5rem;
|
||||
.equItem{
|
||||
min-height: 9rem;
|
||||
border-radius: 0.2rem;
|
||||
display: inline-block;
|
||||
margin-right: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
.equItemTop{
|
||||
width: 100%;
|
||||
line-height: 3rem;
|
||||
color: #555;
|
||||
font-weight: bold;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
.equContent{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding-top: 1.2rem;
|
||||
.equImgs{
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
}
|
||||
.equOffOn{
|
||||
color:'#00DB00';
|
||||
font-size:1.8rem;
|
||||
cursor:pointer;
|
||||
margin-top: 0.7rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.allOperStyle{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-right:8rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.operButtonStyle{
|
||||
margin-top: 1rem;
|
||||
padding-bottom: 1rem;
|
||||
padding-left:6rem;
|
||||
}
|
||||
|
||||
.classDiv{
|
||||
display: flex;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.classItem{
|
||||
width: 20%;
|
||||
min-height: 20rem;
|
||||
border-radius: 0.2rem;
|
||||
margin-bottom: 1rem;
|
||||
.classItemTitle{
|
||||
width: 100%;
|
||||
height: 6rem;
|
||||
border-bottom: 1px solid #ccc;
|
||||
border-top-left-radius: 0.2rem;
|
||||
border-top-right-radius: 0.2rem;
|
||||
}
|
||||
.classItemContent{
|
||||
width: 100%;
|
||||
border-bottom: 1px solid #ccc;
|
||||
min-height: 9rem;
|
||||
padding-bottom: 1rem;
|
||||
.tempStyle{
|
||||
padding-top: 1rem;
|
||||
padding-left: 1rem;
|
||||
color: #999;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
.classItemButton{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding-top: 1rem;
|
||||
.itemOperStyle{
|
||||
width: 30%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
import React from 'react';
|
||||
import { Button, Table } from 'antd';
|
||||
import { connect } from 'dva';
|
||||
|
||||
@connect(({ user }) => ({ user }))
|
||||
export default class extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const { dispatch } = props;
|
||||
dispatch({
|
||||
type: 'user/query',
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const { user } = this.props;
|
||||
const { list } = user;
|
||||
const columns = [
|
||||
{
|
||||
dataIndex: 'id',
|
||||
title: 'ID',
|
||||
},
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: 'Name',
|
||||
},
|
||||
{
|
||||
dataIndex: 'email',
|
||||
title: 'Email',
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Table rowKey="id" columns={columns} dataSource={list} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
import { query } from '@/services/user';
|
||||
|
||||
export default {
|
||||
namespace: 'user',
|
||||
|
||||
state: {
|
||||
list: [],
|
||||
},
|
||||
|
||||
effects: {
|
||||
*query(_, { put }) {
|
||||
const { data } = yield query();
|
||||
yield put({
|
||||
type: 'querySuccess',
|
||||
payload: {
|
||||
list: data,
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
reducers: {
|
||||
querySuccess(state, { payload }) {
|
||||
state.list = payload.list;
|
||||
return {
|
||||
...state,
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"public": "dist",
|
||||
"rewrites": [
|
||||
{
|
||||
"source": "/app2/*",
|
||||
"destination": "/app2/index.html"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
import { extend } from 'umi-request';
|
||||
|
||||
export default extend({
|
||||
prefix: '/api/app1',
|
||||
});
|
@ -0,0 +1,5 @@
|
||||
import request from './request';
|
||||
|
||||
export async function query() {
|
||||
return request('/users');
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
PORT=8002
|
||||
# HTTPS=true
|
||||
BROWSER=none
|
@ -0,0 +1,18 @@
|
||||
import { name } from './package.json';
|
||||
|
||||
export default {
|
||||
history: { type: 'hash' },
|
||||
base: name,
|
||||
publicPath: '/helloworld/',
|
||||
outputPath: './dist/helloworld',
|
||||
mountElementId: 'helloworld',
|
||||
qiankun: {
|
||||
slave: {},
|
||||
},
|
||||
plugins: [
|
||||
require.resolve('../../node_modules/@umijs/plugin-dva/lib'),
|
||||
require.resolve('../../node_modules/@umijs/plugin-model/lib'),
|
||||
require.resolve('../../node_modules/@umijs/plugin-antd/lib'),
|
||||
require.resolve('../../node_modules/@umijs/plugin-qiankun/lib'),
|
||||
],
|
||||
};
|
@ -0,0 +1,14 @@
|
||||
export const qiankun = {
|
||||
// 应用加载之前
|
||||
async bootstrap(props) {
|
||||
console.log('app2 bootstrap', props);
|
||||
},
|
||||
// 应用 render 之前触发
|
||||
async mount(props) {
|
||||
console.log('app2 mount', props);
|
||||
},
|
||||
// 应用卸载之后触发
|
||||
async unmount(props) {
|
||||
console.log('app2 unmount', props);
|
||||
},
|
||||
};
|
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
|
||||
/>
|
||||
<link rel="stylesheet" href="/helloworld/umi.css" />
|
||||
<script>
|
||||
window.routerBase = "helloworld";
|
||||
</script>
|
||||
<script>
|
||||
window.publicPath =
|
||||
window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ || "/helloworld/";
|
||||
</script>
|
||||
<script>
|
||||
//! umi version: 3.2.14
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="helloworld"></div>
|
||||
|
||||
<script src="/helloworld/umi.js" entry></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,3 @@
|
||||
#app2 {
|
||||
height: 100%;
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
import { Layout, Menu } from 'antd';
|
||||
import { Link, useModel} from 'umi';
|
||||
|
||||
import style from './style.less';
|
||||
|
||||
const { SubMenu } = Menu;
|
||||
const { Header, Content, Sider } = Layout;
|
||||
|
||||
export default ({ children }) => {
|
||||
const { id } = useModel('@@qiankunStateFromMaster') || {};
|
||||
|
||||
global.constants = {id:id}
|
||||
// 存储
|
||||
sessionStorage.setItem("helloworld-id", id);
|
||||
return (
|
||||
<Layout className={style.layout}>
|
||||
<Sider width={200} className={style.sider}>
|
||||
<Menu
|
||||
mode="inline"
|
||||
defaultSelectedKeys={['dashboard']}
|
||||
style={{ height: '100%', borderRight: 0 }}
|
||||
>
|
||||
<Menu.Item key="dashboard">
|
||||
<Link to="/">App2 Dashboard</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="user">
|
||||
<Link to="/user">User</Link>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
</Sider>
|
||||
<Content
|
||||
style={{
|
||||
background: '#fff',
|
||||
padding: 24,
|
||||
margin: 0,
|
||||
minHeight: 280,
|
||||
}}
|
||||
><div>{id}</div>
|
||||
{/*children*/}
|
||||
{
|
||||
React.Children.map(children, child => {
|
||||
return React.cloneElement(child, {"test": id})
|
||||
})
|
||||
}
|
||||
</Content>
|
||||
</Layout>
|
||||
)};
|
@ -0,0 +1,9 @@
|
||||
.layout {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.sider {
|
||||
ul {
|
||||
background: rgba(243, 250, 255, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
import mockjs from 'mockjs';
|
||||
|
||||
export default {
|
||||
'GET /api/app1/users': mockjs.mock({
|
||||
'data|100': [
|
||||
{
|
||||
'id|+1': 1,
|
||||
name: '@cname',
|
||||
email: '@email',
|
||||
},
|
||||
],
|
||||
}),
|
||||
};
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "helloworld",
|
||||
"scripts": {
|
||||
"start": "umi dev",
|
||||
"build": "COMPRESS=none umi build",
|
||||
"test": "umi test"
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
import React from 'react';
|
||||
import { Button, Table } from 'antd';
|
||||
import { connect } from 'dva';
|
||||
|
||||
@connect(({ user }) => ({ user }))
|
||||
export default class extends React.PureComponent {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const { dispatch, id } = props;
|
||||
this.state = {id:sessionStorage.getItem("helloworld-id")}
|
||||
|
||||
dispatch({
|
||||
type: 'user/query',
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const { user, test } = this.props;
|
||||
const { list } = user;
|
||||
const columns = [
|
||||
{
|
||||
dataIndex: 'id',
|
||||
title: 'ID',
|
||||
},
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: 'Name',
|
||||
},
|
||||
{
|
||||
dataIndex: 'email',
|
||||
title: 'Email',
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div>
|
||||
<strong style={{color:'red'}}>000{test}</strong>
|
||||
<Table rowKey="id" columns={columns} dataSource={list} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
import { query } from '@/services/user';
|
||||
|
||||
export default {
|
||||
namespace: 'user',
|
||||
|
||||
state: {
|
||||
id:0,
|
||||
list: [],
|
||||
},
|
||||
|
||||
effects: {
|
||||
*query(_, { put }) {
|
||||
const { data } = yield query();
|
||||
yield put({
|
||||
type: 'querySuccess',
|
||||
payload: {
|
||||
list: data,
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
reducers: {
|
||||
querySuccess(state, { payload }) {
|
||||
state.list = payload.list;
|
||||
return {
|
||||
...state,
|
||||
};
|
||||
},
|
||||
setID(state, { payload }){
|
||||
state.id = payload.id
|
||||
return {
|
||||
...state,
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"public": "dist",
|
||||
"rewrites": [
|
||||
{
|
||||
"source": "/app2/*",
|
||||
"destination": "/app2/index.html"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
import { extend } from 'umi-request';
|
||||
|
||||
export default extend({
|
||||
prefix: '/api/app1',
|
||||
});
|
@ -0,0 +1,5 @@
|
||||
import request from './request';
|
||||
|
||||
export async function query() {
|
||||
return request('/users');
|
||||
}
|
@ -0,0 +1,279 @@
|
||||
// https://umijs.org/config/
|
||||
import { defineConfig, utils } from 'umi';
|
||||
import defaultSettings from './defaultSettings';
|
||||
import proxy from './proxy';
|
||||
import webpackPlugin from './plugin.config';
|
||||
const { winPath } = utils; // preview.pro.ant.design only do not use in your production ;
|
||||
// preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
|
||||
|
||||
const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION, REACT_APP_ENV, GA_KEY } = process.env;
|
||||
export default defineConfig({
|
||||
hash: true,
|
||||
history: { type: 'hash' },
|
||||
antd: {
|
||||
dark: false,
|
||||
compact: false
|
||||
},
|
||||
analytics: GA_KEY
|
||||
? {
|
||||
ga: GA_KEY,
|
||||
}
|
||||
: false,
|
||||
dva: {
|
||||
hmr: true,
|
||||
},
|
||||
locale: {
|
||||
// default zh-CN
|
||||
default: 'zh-CN',
|
||||
// default true, when it is true, will use `navigator.language` overwrite default
|
||||
antd: true,
|
||||
baseNavigator: true,
|
||||
|
||||
},
|
||||
dynamicImport: {
|
||||
loading: '@/components/PageLoading/index',
|
||||
},
|
||||
targets: {
|
||||
ie: 11,
|
||||
},
|
||||
proxy: {
|
||||
'/IoTCenter': {
|
||||
// "target": "http://222.168.49.126:59996",
|
||||
target: "https://iot.edusoa.com",
|
||||
// target: 'http://221.194.113.154:8100',
|
||||
changeOrigin: true,
|
||||
"secure": false, //配置关闭证书签名验证 跳过https证书验证
|
||||
},
|
||||
'/platform': {
|
||||
// "target": "http://222.168.49.126:59996",
|
||||
target: "https://iot.edusoa.com",
|
||||
// target: 'http://221.194.113.154:8100',
|
||||
changeOrigin: true,
|
||||
"secure": false, //配置关闭证书签名验证
|
||||
},
|
||||
},
|
||||
qiankun: {
|
||||
master: {},
|
||||
},
|
||||
// umi routes: https://umijs.org/docs/routing
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
component: '../layouts/BlankLayout',
|
||||
routes: [
|
||||
// 手动设置微应用路由,(后续需要动态匹配)
|
||||
{
|
||||
path: '/app1',
|
||||
microApp: 'app1',
|
||||
settings: { singular: false },
|
||||
},
|
||||
{
|
||||
path:'/cas',
|
||||
component: './cas',
|
||||
},
|
||||
{
|
||||
path: '/user',
|
||||
component: '../layouts/UserLayout',
|
||||
routes: [
|
||||
{
|
||||
name: 'login',
|
||||
icon: 'smile',
|
||||
path: '/user/login',
|
||||
component: './user/login',
|
||||
},
|
||||
{
|
||||
name: 'register-result',
|
||||
icon: 'smile',
|
||||
path: '/user/register-result',
|
||||
component: './user/register-result',
|
||||
},
|
||||
{
|
||||
name: 'register',
|
||||
icon: 'smile',
|
||||
path: '/user/register',
|
||||
component: './user/register',
|
||||
},
|
||||
{
|
||||
component: './exception/404',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/dashboard',
|
||||
component: '../layouts/BasicLayout',
|
||||
routes: [
|
||||
{
|
||||
name: '学校数据',
|
||||
icon: 'smile',
|
||||
path: '/dashboard/schoolMain',
|
||||
component: './dashboard/main/mainState'
|
||||
},
|
||||
{
|
||||
name: '教室管理',
|
||||
icon: 'HomeOutlined',
|
||||
path: '/dashboard/monitor',
|
||||
component: './dashboard/monitor',
|
||||
},
|
||||
{
|
||||
name: '设备管理',
|
||||
icon: 'SettingOutlined',
|
||||
path: '/dashboard/workplace',
|
||||
component: './dashboard/workplace',
|
||||
},
|
||||
|
||||
{
|
||||
component: './exception/404',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
component: '../layouts/MainLayout',
|
||||
Routes: ['src/pages/Authorized'],
|
||||
authority: ['admin', 'user'],
|
||||
routes: [
|
||||
{
|
||||
name: 'data-center',
|
||||
icon: 'FundOutlined',
|
||||
path: '/main',
|
||||
component: './dashboard/main',
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/main',
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
|
||||
// {
|
||||
// path: '/dashboard',
|
||||
// component: '../layouts/BasicLayout',
|
||||
// Routes: ['src/pages/Authorized'],
|
||||
// authority: ['admin', 'user'],
|
||||
// routes: [
|
||||
// {
|
||||
// path: '/dashboard',
|
||||
// name: 'dashboard',
|
||||
// icon: 'dashboard',
|
||||
// routes: [
|
||||
// {
|
||||
// name: '数据中心',
|
||||
// icon: 'FundOutlined',
|
||||
// path: '/dashboard/main',
|
||||
// component: './dashboard/main',
|
||||
// },
|
||||
// {
|
||||
// name: '学校数据',
|
||||
// icon: 'FundOutlined',
|
||||
// path: '/dashboard/schoolMain',
|
||||
// component: './dashboard/main/mainState'
|
||||
// },
|
||||
// // {
|
||||
// // name: 'analysis',
|
||||
// // icon: 'smile',
|
||||
// // path: '/dashboard/analysis',
|
||||
// // component: './dashboard/analysis',
|
||||
// // },
|
||||
// {
|
||||
// name: 'monitor',
|
||||
// icon: 'HomeOutlined',
|
||||
// path: '/dashboard/monitor',
|
||||
// component: './dashboard/monitor',
|
||||
// },
|
||||
// {
|
||||
// name: 'workplace',
|
||||
// icon: 'SettingOutlined',
|
||||
// path: '/dashboard/workplace',
|
||||
// component: './dashboard/workplace',
|
||||
// },
|
||||
// // {
|
||||
// // name: 'classOne',
|
||||
// // path: '/dashboard/monitor/classInfoCom',
|
||||
// // component: './dashboard/monitor/components/ClassInfoCom',
|
||||
// // },
|
||||
// // {
|
||||
// // name: 'classTwo',
|
||||
// // path: '/dashboard/monitor/classInfoComTwo',
|
||||
// // component: './dashboard/monitor/components/ClassInfoComTwo',
|
||||
// // },
|
||||
// ],
|
||||
// },
|
||||
// /*{
|
||||
// path: '/',
|
||||
// redirect: '/dashboard/main',
|
||||
// },*/
|
||||
// {
|
||||
// path: '/',
|
||||
// redirect: '/dashboard/main',
|
||||
// },
|
||||
{
|
||||
name: 'DEMO',
|
||||
icon: 'smile',
|
||||
path: '/demo',
|
||||
|
||||
component: './demo',
|
||||
},
|
||||
{
|
||||
component: './exception/404',
|
||||
},
|
||||
// ],
|
||||
// },
|
||||
],
|
||||
},
|
||||
],
|
||||
// Theme for antd: https://ant.design/docs/react/customize-theme-cn
|
||||
theme: {
|
||||
// ...darkTheme,
|
||||
'primary-color': defaultSettings.primaryColor,
|
||||
},
|
||||
define: {
|
||||
REACT_APP_ENV: REACT_APP_ENV || false,
|
||||
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION:
|
||||
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '', // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
|
||||
},
|
||||
ignoreMomentLocale: true,
|
||||
lessLoader: {
|
||||
javascriptEnabled: true,
|
||||
},
|
||||
cssLoader: {
|
||||
modules: {
|
||||
getLocalIdent: (
|
||||
context: {
|
||||
resourcePath: string;
|
||||
},
|
||||
_: string,
|
||||
localName: string,
|
||||
) => {
|
||||
if (
|
||||
context.resourcePath.includes('node_modules') ||
|
||||
context.resourcePath.includes('ant.design.pro.less') ||
|
||||
context.resourcePath.includes('global.less')
|
||||
) {
|
||||
return localName;
|
||||
}
|
||||
|
||||
const match = context.resourcePath.match(/src(.*)/);
|
||||
|
||||
if (match && match[1]) {
|
||||
const antdProPath = match[1].replace('.less', '');
|
||||
const arr = winPath(antdProPath)
|
||||
.split('/')
|
||||
.map((a: string) => a.replace(/([A-Z])/g, '-$1'))
|
||||
.map((a: string) => a.toLowerCase());
|
||||
return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-');
|
||||
}
|
||||
|
||||
return localName;
|
||||
},
|
||||
},
|
||||
},
|
||||
base: '/',
|
||||
publicPath: './',
|
||||
manifest: {
|
||||
basePath: './',
|
||||
},
|
||||
// proxy: proxy[REACT_APP_ENV || 'dev'],
|
||||
chainWebpack: webpackPlugin,
|
||||
});
|
@ -0,0 +1,65 @@
|
||||
import path from 'path';
|
||||
|
||||
import * as IWebpackChainConfig from 'webpack-chain';
|
||||
|
||||
function getModulePackageName(module: { context: string }) {
|
||||
if (!module.context) return null;
|
||||
|
||||
const nodeModulesPath = path.join(__dirname, '../node_modules/');
|
||||
if (module.context.substring(0, nodeModulesPath.length) !== nodeModulesPath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const moduleRelativePath = module.context.substring(nodeModulesPath.length);
|
||||
const [moduleDirName] = moduleRelativePath.split(path.sep);
|
||||
let packageName: string | null = moduleDirName;
|
||||
// handle tree shaking
|
||||
if (packageName && packageName.match('^_')) {
|
||||
// eslint-disable-next-line prefer-destructuring
|
||||
packageName = packageName.match(/^_(@?[^@]+)/)![1];
|
||||
}
|
||||
return packageName;
|
||||
}
|
||||
|
||||
const webpackPlugin = (config: IWebpackChainConfig) => {
|
||||
// optimize chunks
|
||||
config.optimization
|
||||
// share the same chunks across different modules
|
||||
.runtimeChunk(false)
|
||||
.splitChunks({
|
||||
chunks: 'async',
|
||||
name: 'vendors',
|
||||
maxInitialRequests: Infinity,
|
||||
minSize: 0,
|
||||
cacheGroups: {
|
||||
vendors: {
|
||||
test: (module: { context: string }) => {
|
||||
const packageName = getModulePackageName(module) || '';
|
||||
if (packageName) {
|
||||
return [
|
||||
'bizcharts',
|
||||
'gg-editor',
|
||||
'g6',
|
||||
'@antv',
|
||||
'l7',
|
||||
'gg-editor-core',
|
||||
'bizcharts-plugin-slider',
|
||||
].includes(packageName);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
name(module: { context: string }) {
|
||||
const packageName = getModulePackageName(module);
|
||||
if (packageName) {
|
||||
if (['bizcharts', '@antv_data-set'].indexOf(packageName) >= 0) {
|
||||
return 'viz'; // visualization package
|
||||
}
|
||||
}
|
||||
return 'misc';
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export default webpackPlugin;
|
@ -0,0 +1,129 @@
|
||||
{
|
||||
"theme": [
|
||||
{
|
||||
"key": "dark",
|
||||
"fileName": "dark.css",
|
||||
"theme": "dark",
|
||||
"modifyVars": {
|
||||
"dark": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "dust",
|
||||
"fileName": "dust.css",
|
||||
"modifyVars": {
|
||||
"@primary-color": "#F5222D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "volcano",
|
||||
"fileName": "volcano.css",
|
||||
"modifyVars": {
|
||||
"@primary-color": "#FA541C"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "sunset",
|
||||
"fileName": "sunset.css",
|
||||
"modifyVars": {
|
||||
"@primary-color": "#FAAD14"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "cyan",
|
||||
"fileName": "cyan.css",
|
||||
"modifyVars": {
|
||||
"@primary-color": "#13C2C2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "green",
|
||||
"fileName": "green.css",
|
||||
"modifyVars": {
|
||||
"@primary-color": "#52C41A"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "geekblue",
|
||||
"fileName": "geekblue.css",
|
||||
"modifyVars": {
|
||||
"@primary-color": "#2F54EB"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "purple",
|
||||
"fileName": "purple.css",
|
||||
"modifyVars": {
|
||||
"@primary-color": "#722ED1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "dust",
|
||||
"theme": "dark",
|
||||
"fileName": "dark-dust.css",
|
||||
"modifyVars": {
|
||||
"@primary-color": "#F5222D",
|
||||
"dark": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "volcano",
|
||||
"theme": "dark",
|
||||
"fileName": "dark-volcano.css",
|
||||
"modifyVars": {
|
||||
"@primary-color": "#FA541C",
|
||||
"dark": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "sunset",
|
||||
"theme": "dark",
|
||||
"fileName": "dark-sunset.css",
|
||||
"modifyVars": {
|
||||
"@primary-color": "#FAAD14",
|
||||
"dark": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "cyan",
|
||||
"theme": "dark",
|
||||
"fileName": "dark-cyan.css",
|
||||
"modifyVars": {
|
||||
"@primary-color": "#13C2C2",
|
||||
"dark": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "green",
|
||||
"theme": "dark",
|
||||
"fileName": "dark-green.css",
|
||||
"modifyVars": {
|
||||
"@primary-color": "#52C41A",
|
||||
"dark": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "geekblue",
|
||||
"theme": "dark",
|
||||
"fileName": "dark-geekblue.css",
|
||||
"modifyVars": {
|
||||
"@primary-color": "#2F54EB",
|
||||
"dark": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "purple",
|
||||
"theme": "dark",
|
||||
"fileName": "dark-purple.css",
|
||||
"modifyVars": {
|
||||
"@primary-color": "#722ED1",
|
||||
"dark": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"min": true,
|
||||
"isModule": true,
|
||||
"ignoreAntd": false,
|
||||
"ignoreProLayout": false,
|
||||
"cache": true
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
module.exports = {
|
||||
testURL: 'http://localhost:8000',
|
||||
testEnvironment: './tests/PuppeteerEnvironment',
|
||||
verbose: false,
|
||||
globals: {
|
||||
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: false,
|
||||
localStorage: null,
|
||||
},
|
||||
};
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { Request, Response } from 'express';
|
||||
import { parse } from 'url';
|
||||
import { TableListItem, TableListParams } from '@/pages/ListTableList/data';
|
||||
|
||||
// mock tableListDataSource
|
||||
const genList = (current: number, pageSize: number) => {
|
||||
const tableListDataSource: TableListItem[] = [];
|
||||
|
||||
for (let i = 0; i < pageSize; i += 1) {
|
||||
const index = (current - 1) * 10 + i;
|
||||
tableListDataSource.push({
|
||||
key: index,
|
||||
disabled: i % 6 === 0,
|
||||
href: 'https://ant.design',
|
||||
avatar: [
|
||||
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
|
||||
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
|
||||
][i % 2],
|
||||
name: `TradeCode ${index}`,
|
||||
owner: '曲丽丽',
|
||||
desc: '这是一段描述',
|
||||
callNo: Math.floor(Math.random() * 1000),
|
||||
status: Math.floor(Math.random() * 10) % 4,
|
||||
updatedAt: new Date(),
|
||||
createdAt: new Date(),
|
||||
progress: Math.ceil(Math.random() * 100),
|
||||
});
|
||||
}
|
||||
tableListDataSource.reverse();
|
||||
return tableListDataSource;
|
||||
};
|
||||
|
||||
let tableListDataSource = genList(1, 100);
|
||||
|
||||
function getRule(req: Request, res: Response, u: string) {
|
||||
let realUrl = u;
|
||||
if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
|
||||
realUrl = req.url;
|
||||
}
|
||||
const { current = 1, pageSize = 10 } = req.query;
|
||||
const params = (parse(realUrl, true).query as unknown) as TableListParams;
|
||||
|
||||
let dataSource = [...tableListDataSource].slice((current - 1) * pageSize, current * pageSize);
|
||||
if (params.sorter) {
|
||||
const s = params.sorter.split('_');
|
||||
dataSource = dataSource.sort((prev, next) => {
|
||||
if (s[1] === 'descend') {
|
||||
return next[s[0]] - prev[s[0]];
|
||||
}
|
||||
return prev[s[0]] - next[s[0]];
|
||||
});
|
||||
}
|
||||
|
||||
if (params.status) {
|
||||
const status = params.status.split(',');
|
||||
let filterDataSource: TableListItem[] = [];
|
||||
status.forEach((s: string) => {
|
||||
filterDataSource = filterDataSource.concat(
|
||||
dataSource.filter((item) => {
|
||||
if (parseInt(`${item.status}`, 10) === parseInt(s.split('')[0], 10)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}),
|
||||
);
|
||||
});
|
||||
dataSource = filterDataSource;
|
||||
}
|
||||
|
||||
if (params.name) {
|
||||
dataSource = dataSource.filter((data) => data.name.includes(params.name || ''));
|
||||
}
|
||||
const result = {
|
||||
data: dataSource,
|
||||
total: tableListDataSource.length,
|
||||
success: true,
|
||||
pageSize,
|
||||
current: parseInt(`${params.currentPage}`, 10) || 1,
|
||||
};
|
||||
|
||||
return res.json(result);
|
||||
}
|
||||
|
||||
function postRule(req: Request, res: Response, u: string, b: Request) {
|
||||
let realUrl = u;
|
||||
if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
|
||||
realUrl = req.url;
|
||||
}
|
||||
|
||||
const body = (b && b.body) || req.body;
|
||||
const { method, name, desc, key } = body;
|
||||
|
||||
switch (method) {
|
||||
/* eslint no-case-declarations:0 */
|
||||
case 'delete':
|
||||
tableListDataSource = tableListDataSource.filter((item) => key.indexOf(item.key) === -1);
|
||||
break;
|
||||
case 'post':
|
||||
(() => {
|
||||
const i = Math.ceil(Math.random() * 10000);
|
||||
const newRule = {
|
||||
key: tableListDataSource.length,
|
||||
href: 'https://ant.design',
|
||||
avatar: [
|
||||
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
|
||||
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
|
||||
][i % 2],
|
||||
name,
|
||||
owner: '曲丽丽',
|
||||
desc,
|
||||
callNo: Math.floor(Math.random() * 1000),
|
||||
status: Math.floor(Math.random() * 10) % 2,
|
||||
updatedAt: new Date(),
|
||||
createdAt: new Date(),
|
||||
progress: Math.ceil(Math.random() * 100),
|
||||
};
|
||||
tableListDataSource.unshift(newRule);
|
||||
return res.json(newRule);
|
||||
})();
|
||||
return;
|
||||
|
||||
case 'update':
|
||||
(() => {
|
||||
let newRule = {};
|
||||
tableListDataSource = tableListDataSource.map((item) => {
|
||||
if (item.key === key) {
|
||||
newRule = { ...item, desc, name };
|
||||
return { ...item, desc, name };
|
||||
}
|
||||
return item;
|
||||
});
|
||||
return res.json(newRule);
|
||||
})();
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
const result = {
|
||||
list: tableListDataSource,
|
||||
pagination: {
|
||||
total: tableListDataSource.length,
|
||||
},
|
||||
};
|
||||
|
||||
res.json(result);
|
||||
}
|
||||
|
||||
export default {
|
||||
'GET /api/rule': getRule,
|
||||
'POST /api/rule': postRule,
|
||||
};
|
@ -0,0 +1,5 @@
|
||||
export default {
|
||||
'/api/auth_routes': {
|
||||
'/form/advanced-form': { authority: ['admin', 'user'] },
|
||||
},
|
||||
};
|
@ -0,0 +1,137 @@
|
||||
{
|
||||
"name": "ant-design-pro",
|
||||
"version": "4.0.0",
|
||||
"private": true,
|
||||
"description": "An out-of-box UI solution for enterprise applications",
|
||||
"scripts": {
|
||||
"analyze": "cross-env ANALYZE=1 umi build",
|
||||
"build": "umi build",
|
||||
"deploy": "npm run site && npm run gh-pages",
|
||||
"dev": "npm run start:dev",
|
||||
"fetch:blocks": "pro fetch-blocks --branch=umi@3 && npm run prettier",
|
||||
"gh-pages": "cp CNAME ./dist/ && gh-pages -d dist",
|
||||
"i18n-remove": "pro i18n-remove --locale=zh-CN --write",
|
||||
"postinstall": "umi g tmp",
|
||||
"lint": "umi g tmp && npm run lint:js && npm run lint:style && npm run lint:prettier",
|
||||
"lint-staged": "lint-staged",
|
||||
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
|
||||
"lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src && npm run lint:style",
|
||||
"lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
|
||||
"lint:prettier": "prettier --check \"**/*\" --end-of-line auto",
|
||||
"lint:style": "stylelint --fix \"src/**/*.less\" --syntax less",
|
||||
"prettier": "prettier -c --write \"**/*\"",
|
||||
"start": "umi dev",
|
||||
"start:dev": "cross-env REACT_APP_ENV=dev MOCK=none umi dev",
|
||||
"start:no-mock": "cross-env MOCK=none umi dev",
|
||||
"start:no-ui": "cross-env UMI_UI=none umi dev",
|
||||
"start:pre": "cross-env REACT_APP_ENV=pre umi dev",
|
||||
"start:test": "cross-env REACT_APP_ENV=test MOCK=none umi dev",
|
||||
"pretest": "node ./tests/beforeTest",
|
||||
"test": "umi test",
|
||||
"test:all": "node ./tests/run-tests.js",
|
||||
"test:component": "umi test ./src/components",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "npm run lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"**/*.less": "stylelint --syntax less",
|
||||
"**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js",
|
||||
"**/*.{js,jsx,tsx,ts,less,md,json}": [
|
||||
"prettier --write"
|
||||
]
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not ie <= 10"
|
||||
],
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^4.0.0",
|
||||
"@ant-design/pro-layout": "^5.0.8",
|
||||
"@ant-design/pro-table": "^2.1.11",
|
||||
"@antv/data-set": "^0.11.0",
|
||||
"@antv/l7": "^2.0.0",
|
||||
"@antv/l7-maps": "^2.0.0",
|
||||
"@aspnet/signalr": "^1.1.4",
|
||||
"@types/lodash.debounce": "^4.0.6",
|
||||
"@types/lodash.isequal": "^4.5.5",
|
||||
"antd": "^4.0.0",
|
||||
"bizcharts": "^3.5.3-beta.0",
|
||||
"bizcharts-plugin-slider": "^2.1.1-beta.1",
|
||||
"classnames": "^2.2.6",
|
||||
"dva": "^2.4.0",
|
||||
"events": "^3.2.0",
|
||||
"gg-editor": "^2.0.2",
|
||||
"jwt-decode": "^2.2.0",
|
||||
"lodash": "^4.17.11",
|
||||
"lodash-decorators": "^6.0.0",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"lodash.isequal": "^4.5.0",
|
||||
"mockjs": "^1.0.1-beta3",
|
||||
"moment": "^2.24.0",
|
||||
"numeral": "^2.0.6",
|
||||
"nzh": "^1.0.3",
|
||||
"omit.js": "^1.0.2",
|
||||
"path-to-regexp": "2.4.0",
|
||||
"prop-types": "^15.5.10",
|
||||
"qiankun": "^2.0.20",
|
||||
"qs": "^6.9.0",
|
||||
"react": "^16.8.6",
|
||||
"react-dom": "^16.8.6",
|
||||
"react-fittext": "^1.0.0",
|
||||
"react-helmet-async": "^1.0.4",
|
||||
"react-router": "^4.3.1",
|
||||
"umi": "^3.2.14",
|
||||
"umi-request": "^1.0.8",
|
||||
"use-merge-value": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ant-design/pro-cli": "^1.0.18",
|
||||
"@types/classnames": "^2.2.7",
|
||||
"@types/express": "^4.17.0",
|
||||
"@types/history": "^4.7.2",
|
||||
"@types/jest": "^25.1.0",
|
||||
"@types/lodash": "^4.14.144",
|
||||
"@types/qs": "^6.5.3",
|
||||
"@types/react": "^16.9.17",
|
||||
"@types/react-dom": "^16.8.4",
|
||||
"@types/react-helmet": "^5.0.13",
|
||||
"@umijs/fabric": "^2.0.5",
|
||||
"@umijs/plugin-blocks": "^2.0.5",
|
||||
"@umijs/plugin-qiankun": "^2.8.1",
|
||||
"@umijs/preset-ant-design-pro": "^1.0.1",
|
||||
"@umijs/preset-react": "^1.4.8",
|
||||
"@umijs/preset-ui": "^2.0.9",
|
||||
"carlo": "^0.9.46",
|
||||
"chalk": "^4.0.0",
|
||||
"cross-env": "^7.0.0",
|
||||
"cross-port-killer": "^1.1.1",
|
||||
"detect-installer": "^1.0.1",
|
||||
"enzyme": "^3.11.0",
|
||||
"eslint": "^6.8.0",
|
||||
"express": "^4.17.1",
|
||||
"gh-pages": "^2.0.1",
|
||||
"husky": "^4.0.7",
|
||||
"jsdom-global": "^3.0.2",
|
||||
"lint-staged": "^10.0.0",
|
||||
"mockjs": "^1.0.1-beta3",
|
||||
"prettier": "^2.0.1",
|
||||
"pro-download": "1.0.1",
|
||||
"puppeteer-core": "^2.1.1",
|
||||
"stylelint": "^13.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"checkFiles": [
|
||||
"src/**/*.js*",
|
||||
"src/**/*.ts*",
|
||||
"src/**/*.less",
|
||||
"config/**/*.js*",
|
||||
"scripts/**/*.js"
|
||||
]
|
||||
}
|
After Width: | Height: | Size: 11 KiB |
@ -0,0 +1 @@
|
||||
preview.pro.ant.design
|
@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"name": "classInfo",
|
||||
"entry": "http://localhost:8002",
|
||||
"to": "/classInfo"
|
||||
},
|
||||
{
|
||||
"name": "helloWord",
|
||||
"entry": "http://localhost:8001",
|
||||
"to": "/helloWord"
|
||||
}
|
||||
]
|
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 199 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 613 B |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.0 KiB |