Commit 29aac24f authored by 曾婧's avatar 曾婧

合并更改

parents 75c5134c 67d9eabc
...@@ -4,7 +4,7 @@ const defaultSetting = require('./defaultSetting'); ...@@ -4,7 +4,7 @@ const defaultSetting = require('./defaultSetting');
const cesiumBuild = '../node_modules/cesium/Build/Cesium'; const cesiumBuild = '../node_modules/cesium/Build/Cesium';
const pkgName = require('../package.json').name; const pkgName = require('../package.json').name;
// eslint-disable-next-line import/order // eslint-disable-next-line import/order
const { REACT_APP_ENV } = process.env; const { NODE_ENV } = process.env;
// eslint-disable-next-line import/order // eslint-disable-next-line import/order
const path = require('path'); const path = require('path');
const CESIUM_BASE_URL = `/${pkgName}`; const CESIUM_BASE_URL = `/${pkgName}`;
...@@ -45,7 +45,7 @@ module.exports = { ...@@ -45,7 +45,7 @@ module.exports = {
'Cesium', 'Cesium',
], ],
}, },
proxy: proxy[REACT_APP_ENV || 'dev'], proxy: proxy[NODE_ENV],
// openAPI: { // openAPI: {
// requestLibPath: "import { request } from '@wisdom-utils/utils'", // requestLibPath: "import { request } from '@wisdom-utils/utils'",
// schemaPath: 'http://192.168.10.150:8777/Publish/OMS/swagger/v1/swagger.json', // schemaPath: 'http://192.168.10.150:8777/Publish/OMS/swagger/v1/swagger.json',
......
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
// }, // },
{ {
name: 'civ_water', name: 'civ_water',
entry: `//${window.location.hostname}:8080/civ_water`, entry: `//${window.location.hostname}:8081/civ_water`,
container: '#micro-container', container: '#micro-container',
activeRule: '/civbase/civ_water', activeRule: '/civbase/civ_water',
}, },
......
...@@ -4,10 +4,9 @@ ...@@ -4,10 +4,9 @@
// const proxyURL = 'http://192.168.12.47:8082'; // const proxyURL = 'http://192.168.12.47:8082';
const proxyURL = 'http://localhost:8086'; const proxyURL = 'http://localhost:8086';
module.exports = { module.exports = {
assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './', assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './',
dev: { development: {
'/PandaOMS':{ '/PandaOMS':{
target: proxyURL, target: proxyURL,
changeOrigin: true, changeOrigin: true,
......
...@@ -487,10 +487,6 @@ module.exports = options => { ...@@ -487,10 +487,6 @@ module.exports = options => {
.end(); .end();
} }
rule
.use('babel-loader')
.loader(require.resolve('babel-loader'))
.options({});
if ((isProd && defineConfig.analyze) || process.env.ANALYZE) { if ((isProd && defineConfig.analyze) || process.env.ANALYZE) {
const mergeAnalyze = Object.assign( const mergeAnalyze = Object.assign(
......
{ {
"name": "civbase", "name": "civbase",
"version": "0.0.14", "version": "0.0.14",
"description": "1. Make sure that you have Node.js v8.15.1 and npm v5 or above installed.\r 2. Run `npm run setup` in order to install dependencies and clean the git repo.<br />\r _At this point you can run `npm start`", "description": "",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://g.civnet.cn:8443/ReactWeb5/CivWeb.git" "url": "https://g.civnet.cn:8443/ReactWeb5/CivWeb.git"
}, },
"engines": { "engines": {
"npm": ">=5", "npm": ">=5",
"node": ">=8.15.1" "node": ">=8.15.1"
}, },
"author": "dengxiaofeng", "author": "dengxiaofeng",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"init": "npm install --registry=https://g.civnet.cn:4873", "init": "npm install --registry=https://g.civnet.cn:4873",
"analyze:clean": "rimraf stats.json", "analyze:clean": "rimraf stats.json",
"preanalyze": "npm run analyze:clean", "preanalyze": "npm run analyze:clean",
"analyze": "cross-env ANALYZE=1 npm run build", "analyze": "cross-env ANALYZE=1 npm run build",
"npmcheckversion": "node ./internals/scripts/npmcheckversion.js", "npmcheckversion": "node ./internals/scripts/npmcheckversion.js",
"preinstall": "npm run npmcheckversion", "preinstall": "npm run npmcheckversion",
"build": "cross-env NODE_ENV=production node --max_old_space_size=4096 internals/webpack/build.js", "build": "cross-env NODE_ENV=production node --max_old_space_size=4096 internals/webpack/build.js",
"build:clean": "rimraf ./build", "build:clean": "rimraf ./build",
"openapi": "cross-env NODE_ENV=development node server/openapi/run.js", "openapi": "cross-env NODE_ENV=development node server/openapi/run.js",
"start": "cross-env REACT_APP_ENV=dev NODE_ENV=development node --max_old_space_size=4192 server --port=$port", "start": "cross-env REACT_APP_ENV=dev NODE_ENV=development node --max_old_space_size=4192 server --port=$port",
"start:tunnel": "cross-env NODE_ENV=development ENABLE_TUNNEL=true node server", "start:tunnel": "cross-env NODE_ENV=development ENABLE_TUNNEL=true node server",
"start:production": "npm run test && npm run build && npm run start:prod", "start:production": "npm run test && npm run build && npm run start:prod",
"start:prod": "cross-env NODE_ENV=production node server", "start:prod": "cross-env NODE_ENV=production node server",
"release": "np --no-cleanup --yolo --no-publish", "release": "np --no-cleanup --yolo --no-publish",
"cm": "git-cz", "cm": "git-cz",
"log": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md", "log": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
"update:deps": "yarn upgrade-interactive --latest", "update:deps": "yarn upgrade-interactive --latest",
"presetup": "npm i chalk shelljs", "presetup": "npm i chalk shelljs",
"setup": "node ./internals/scripts/setup.js", "setup": "node ./internals/scripts/setup.js",
"clean": "shjs ./internals/scripts/clean.js", "clean": "shjs ./internals/scripts/clean.js",
"clean:all": "npm run analyze:clean && npm run test:clean && npm run build:clean", "clean:all": "npm run analyze:clean && npm run test:clean && npm run build:clean",
"generate": "plop --plopfile internals/generators/index.js", "generate": "plop --plopfile internals/generators/index.js",
"lint": "npm run lint:js && npm run lint:prettier", "lint": "npm run lint:js && npm run lint:prettier",
"lint:style": "stylelint --fix \"src/**/*.less\" --syntax less", "lint:style": "stylelint --fix \"src/**/*.less\" --syntax less",
"lint:eslint": "eslint --ignore-path .gitignore --ignore-pattern internals/scripts", "lint:eslint": "eslint --ignore-path .gitignore --ignore-pattern internals/scripts",
"lint:eslint:fix": "eslint --ignore-path .gitignore --ignore-pattern internals/scripts --fix", "lint:eslint:fix": "eslint --ignore-path .gitignore --ignore-pattern internals/scripts --fix",
"lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src", "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
"lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ", "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ",
"lint:prettier": "prettier -c ./src/**/*.js", "lint:prettier": "prettier -c ./src/**/*.js",
"lint:staged": "lint-staged", "lint:staged": "lint-staged",
"pretest": "npm run test:clean && npm run lint", "pretest": "npm run test:clean && npm run lint",
"prettier": "prettier --write ./src/**/*.js", "prettier": "prettier --write ./src/**/*.js",
"test:clean": "rimraf ./coverage", "test:clean": "rimraf ./coverage",
"test": "cross-env NODE_ENV=test jest --coverage", "test": "cross-env NODE_ENV=test jest --coverage",
"test:watch": "cross-env NODE_ENV=test jest --watchAll", "test:watch": "cross-env NODE_ENV=test jest --watchAll",
"coveralls": "cat ./coverage/lcov.info | coveralls", "coveralls": "cat ./coverage/lcov.info | coveralls",
"prettify": "prettier --write" "prettify": "prettier --write"
}, },
"browserslist": [ "browserslist": [
"last 2 versions", "last 2 versions",
"> 1%", "> 1%",
"IE 10" "IE 10"
], ],
"config": { "config": {
"commitizen": { "commitizen": {
"path": "cz-conventional-changelog" "path": "cz-conventional-changelog"
} }
}, },
"husky": { "husky": {
"hooks": { "hooks": {
"pre-commit": "lint-staged", "pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
} }
}, },
"lint-staged": { "lint-staged": {
"*.js": [ "*.js": [
"npm run lint:eslint:fix", "npm run lint:eslint:fix",
"git add --force" "git add --force"
], ],
"*.json": [ "*.json": [
"prettier --write", "prettier --write",
"git add --force" "git add --force"
] ]
}, },
"pre-commit": "lint:staged", "pre-commit": "lint:staged",
"mock": true, "mock": true,
"checkFiles": [ "checkFiles": [
"src/**/*.js*", "src/**/*.js*",
"src/**/*.ts*", "src/**/*.ts*",
"src/**/*.less", "src/**/*.less",
"config/**/*.js*", "config/**/*.js*",
"scripts/**/*.js" "scripts/**/*.js"
], ],
"resolutions": { "resolutions": {
"babel-core": "7.0.0-bridge.0" "babel-core": "7.0.0-bridge.0"
}, },
"dependencies": { "dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1", "@amap/amap-jsapi-loader": "^1.0.1",
"@ant-design/colors": "^5.0.1", "@ant-design/colors": "^5.0.1",
"@ant-design/icons": "^4.0.0", "@ant-design/icons": "^4.0.0",
"@ant-design/pro-form": "^1.42.1", "@ant-design/pro-form": "^1.42.1",
"@ant-design/pro-layout": "^6.24.1", "@ant-design/pro-layout": "^6.24.1",
"@ant-design/pro-list": "^1.20.0", "@ant-design/pro-list": "^1.20.0",
"@ant-design/pro-skeleton": "^1.0.0-beta.2", "@ant-design/pro-skeleton": "^1.0.0-beta.2",
"@ant-design/pro-table": "^2.5.3", "@ant-design/pro-table": "^2.5.3",
"@ant-design/pro-utils": "^1.10.4", "@ant-design/pro-utils": "^1.10.4",
"@babel/polyfill": "7.4.3", "@babel/polyfill": "7.4.3",
"@babel/runtime": "^7.10.5", "@babel/runtime": "^7.10.5",
"@esri/arcgis-html-sanitizer": "2.9.1", "@esri/arcgis-html-sanitizer": "2.9.1",
"@esri/calcite-colors": "6.0.3", "@esri/calcite-colors": "6.0.3",
"@wisdom-cesium/cesium": "^1.0.75", "@wisdom-cesium/cesium": "^1.0.75",
"@wisdom-components/basictable": "^1.5.16", "@wisdom-components/basictable": "^1.5.16",
"@wisdom-components/empty": "^1.4.1", "@wisdom-components/empty": "^1.4.1",
"@wisdom-map/Amap": "^1.0.49-8", "@wisdom-map/Amap": "^1.0.49-10",
"@wisdom-map/Map": "^1.0.12-17", "@wisdom-map/Map": "^1.0.12-19",
"@wisdom-map/arcgismap": "^1.0.79-17", "@wisdom-map/arcgismap": "^1.0.79-19",
"@wisdom-map/util": "^1.0.27-0", "@wisdom-map/util": "^1.0.27-0",
"@wisdom-utils/components": "0.1.43", "@wisdom-utils/components": "0.1.58",
"@wisdom-utils/runtime": "0.0.15", "@wisdom-utils/runtime": "0.0.15",
"@wisdom-utils/utils": "0.1.83", "@wisdom-utils/utils": "0.1.98",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"antd": "^4.17.4", "antd": "^4.17.4",
"compression": "1.7.4", "compression": "1.7.4",
"connected-react-router": "6.4.0", "connected-react-router": "6.4.0",
"echarts": "^5.3.0", "echarts": "^5.3.0",
"echarts-for-react": "^3.0.2", "echarts-for-react": "^3.0.2",
"fontfaceobserver": "2.1.0", "fontfaceobserver": "2.1.0",
"history": "4.9.0", "history": "4.9.0",
"hoist-non-react-statics": "3.3.0", "hoist-non-react-statics": "3.3.0",
"immer": "3.0.0", "immer": "3.0.0",
"immutable": "^4.0.0-rc.12", "immutable": "^4.0.0-rc.12",
"js-base64": "^3.5.2", "js-base64": "^3.5.2",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"kit_global_config": "^1.0.46", "kit_global_config": "^1.0.46",
"kit_logger": "^1.0.2", "kit_logger": "^1.0.2",
"kit_utils": "^1.3.11", "kit_utils": "^1.3.11",
"lodash": "4.17.11", "lodash": "4.17.11",
"minimist": "1.2.0", "minimist": "1.2.0",
"omit.js": "^2.0.2", "omit.js": "^2.0.2",
"pinyin-match": "^1.1.1", "pinyin-match": "^1.1.1",
"promise.prototype.finally": "^3.1.2", "promise.prototype.finally": "^3.1.2",
"prop-types": "15.7.2", "prop-types": "15.7.2",
"qiankun": "^2.4.6", "qiankun": "^2.4.6",
"qrcode.react": "^1.0.0", "qrcode.react": "^1.0.0",
"rc-cascader": "^2.3.2", "rc-cascader": "^2.3.2",
"react": "16.12.0", "react": "16.12.0",
"react-activation": "^0.9.9", "react-activation": "^0.9.9",
"react-dom": "16.12.0", "react-dom": "16.12.0",
"react-draggable": "^4.4.3", "react-draggable": "^4.4.3",
"react-helmet": "6.0.0-beta", "react-helmet": "6.0.0-beta",
"react-helmet-async": "^1.0.4", "react-helmet-async": "^1.0.4",
"react-iframe": "^1.8.0", "react-iframe": "^1.8.0",
"react-intl": "^3.12.1", "react-intl": "^3.12.1",
"react-redux": "7.0.2", "react-redux": "7.0.2",
"react-router-config": "^5.1.1", "react-router-config": "^5.1.1",
"react-router-dom": "5.3.0", "react-router-dom": "5.3.0",
"react-svg": "^14.0.11", "react-svg": "^14.0.11",
"react-use": "^15.3.4", "react-use": "^15.3.4",
"redux": "4.0.1", "redux": "4.0.1",
"redux-immutable": "^4.0.0", "redux-immutable": "^4.0.0",
"redux-saga": "1.0.2", "redux-saga": "1.0.2",
"redux-thunk": "^2.3.0", "redux-thunk": "^2.3.0",
"reselect": "4.0.0", "reselect": "4.0.0",
"sanitize.css": "8.0.0", "sanitize.css": "8.0.0",
"sha1": "^1.1.1", "sha1": "^1.1.1",
"styled-components": "4.2.0" "styled-components": "4.2.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "7.4.3", "@babel/cli": "7.4.3",
"@babel/core": "7.4.3", "@babel/core": "7.4.3",
"@babel/plugin-proposal-class-properties": "7.4.0", "@babel/plugin-proposal-class-properties": "7.4.0",
"@babel/plugin-syntax-dynamic-import": "7.2.0", "@babel/plugin-syntax-dynamic-import": "7.2.0",
"@babel/plugin-transform-flow-strip-types": "^7.12.13", "@babel/plugin-transform-flow-strip-types": "^7.12.13",
"@babel/plugin-transform-modules-commonjs": "7.4.3", "@babel/plugin-transform-modules-commonjs": "7.4.3",
"@babel/plugin-transform-react-constant-elements": "7.2.0", "@babel/plugin-transform-react-constant-elements": "7.2.0",
"@babel/plugin-transform-react-inline-elements": "7.2.0", "@babel/plugin-transform-react-inline-elements": "7.2.0",
"@babel/plugin-transform-react-jsx": "^7.12.16", "@babel/plugin-transform-react-jsx": "^7.12.16",
"@babel/preset-env": "7.4.3", "@babel/preset-env": "7.4.3",
"@babel/preset-react": "7.0.0", "@babel/preset-react": "7.0.0",
"@babel/register": "7.4.0", "@babel/register": "7.4.0",
"@commitlint/cli": "^9.1.2", "@commitlint/cli": "^9.1.2",
"@commitlint/config-conventional": "^9.1.2", "@commitlint/config-conventional": "^9.1.2",
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.3", "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
"@svgr/webpack": "4.3.3", "@svgr/webpack": "4.3.3",
"@umijs/bundler-utils": "3.3.7", "@umijs/bundler-utils": "3.3.7",
"@umijs/deps": "^0.8.1", "@umijs/deps": "^0.8.1",
"@umijs/fabric": "^2.2.0", "@umijs/fabric": "^2.2.0",
"@umijs/runtime": "3.3.7", "@umijs/runtime": "3.3.7",
"@umijs/utils": "3.3.7", "@umijs/utils": "3.3.7",
"babel-core": "7.0.0-bridge.0", "babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.1", "babel-eslint": "10.0.1",
"babel-loader": "8.0.5", "babel-loader": "8.0.5",
"babel-plugin-dynamic-import-node": "2.2.0", "babel-plugin-dynamic-import-node": "2.2.0",
"babel-plugin-import": "^1.13.0", "babel-plugin-import": "^1.13.0",
"babel-plugin-inline-react-svg": "^2.0.1", "babel-plugin-inline-react-svg": "^2.0.1",
"babel-plugin-lodash": "3.3.4", "babel-plugin-lodash": "3.3.4",
"babel-plugin-react-intl": "3.0.1", "babel-plugin-react-intl": "3.0.1",
"babel-plugin-styled-components": "1.10.0", "babel-plugin-styled-components": "1.10.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.24", "babel-plugin-transform-react-remove-prop-types": "0.4.24",
"bcore": "^0.0.22", "bcore": "^0.0.22",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"chalk": "2.4.2", "chalk": "2.4.2",
"child_process": "^1.0.2", "child_process": "^1.0.2",
"circular-dependency-plugin": "5.0.2", "circular-dependency-plugin": "5.0.2",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"cliui": "^7.0.4", "cliui": "^7.0.4",
"compare-versions": "3.4.0", "compare-versions": "3.4.0",
"compression-webpack-plugin": "2.0.0", "compression-webpack-plugin": "2.0.0",
"conventional-changelog-cli": "^2.1.0", "conventional-changelog-cli": "^2.1.0",
"copy-webpack-plugin": "^5.0.4", "copy-webpack-plugin": "^5.0.4",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"coveralls": "3.0.3", "coveralls": "3.0.3",
"cross-env": "^5.2.1", "cross-env": "^5.2.1",
"css-loader": "^4.2.1", "css-loader": "^4.2.1",
"cz-customizable": "^6.3.0", "cz-customizable": "^6.3.0",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"ejs": "^3.1.6", "ejs": "^3.1.6",
"esbuild-loader": "^2.18.0", "esbuild-loader": "^2.18.0",
"eslint": "^5.16.0", "eslint": "^5.16.0",
"eslint-config-airbnb": "17.1.0", "eslint-config-airbnb": "17.1.0",
"eslint-config-airbnb-base": "13.1.0", "eslint-config-airbnb-base": "13.1.0",
"eslint-config-prettier": "4.1.0", "eslint-config-prettier": "4.1.0",
"eslint-import-resolver-webpack": "0.11.1", "eslint-import-resolver-webpack": "0.11.1",
"eslint-plugin-import": "^2.17.2", "eslint-plugin-import": "^2.17.2",
"eslint-plugin-jsx-a11y": "6.2.1", "eslint-plugin-jsx-a11y": "6.2.1",
"eslint-plugin-prettier": "3.0.1", "eslint-plugin-prettier": "3.0.1",
"eslint-plugin-react": "7.12.4", "eslint-plugin-react": "7.12.4",
"eslint-plugin-react-hooks": "1.6.0", "eslint-plugin-react-hooks": "1.6.0",
"eslint-plugin-redux-saga": "1.0.0", "eslint-plugin-redux-saga": "1.0.0",
"express": "^4.17.1", "express": "^4.17.1",
"file-loader": "3.0.1", "file-loader": "3.0.1",
"friendly-errors-webpack-plugin": "^1.7.0", "friendly-errors-webpack-plugin": "^1.7.0",
"fs-extra": "^9.0.1", "fs-extra": "^9.0.1",
"html-loader": "0.5.5", "html-loader": "0.5.5",
"html-webpack-plugin": "5.5.0", "html-webpack-plugin": "5.5.0",
"http-proxy-middleware": "^1.0.5", "http-proxy-middleware": "^1.0.5",
"husky": "^2.3.0", "husky": "^2.3.0",
"imports-loader": "0.8.0", "imports-loader": "0.8.0",
"invariant": "2.2.4", "invariant": "2.2.4",
"ip": "1.1.5", "ip": "1.1.5",
"jest-cli": "24.7.1", "jest-cli": "24.7.1",
"jest-dom": "3.1.3", "jest-dom": "3.1.3",
"jest-styled-components": "6.3.1", "jest-styled-components": "6.3.1",
"jsonp": "^0.2.1", "jsonp": "^0.2.1",
"less": "3.12.0", "less": "3.12.0",
"less-loader": "5.0.0", "less-loader": "5.0.0",
"lint-staged": "8.1.5", "lint-staged": "8.1.5",
"memoizee": "^0.4.15", "memoizee": "^0.4.15",
"mini-css-extract-plugin": "^0.12.0", "mini-css-extract-plugin": "^0.12.0",
"mockjs": "^1.0.1-beta3", "mockjs": "^1.0.1-beta3",
"moment": "^2.29.1", "moment": "^2.29.1",
"multer": "^1.4.2", "multer": "^1.4.2",
"nanoid": "^3.1.16", "nanoid": "^3.1.16",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
"node-plop": "0.18.0", "node-plop": "0.18.0",
"np": "^7.0.0", "np": "^7.0.0",
"null-loader": "0.1.1", "null-loader": "0.1.1",
"nunjucks": "^3.2.2", "nunjucks": "^3.2.2",
"optimize-css-assets-webpack-plugin": "5.0.4", "optimize-css-assets-webpack-plugin": "5.0.4",
"ora": "^5.1.0", "ora": "^5.1.0",
"path-to-regexp": "^2.4.0", "path-to-regexp": "^2.4.0",
"plop": "2.3.0", "plop": "2.3.0",
"postcss": "7.0.32", "postcss": "7.0.32",
"postcss-flexbugs-fixes": "4.2.1", "postcss-flexbugs-fixes": "4.2.1",
"postcss-loader": "3.0.0", "postcss-loader": "3.0.0",
"postcss-preset-env": "6.7.0", "postcss-preset-env": "6.7.0",
"postcss-safe-parser": "^4.0.2", "postcss-safe-parser": "^4.0.2",
"pre-commit": "1.2.2", "pre-commit": "1.2.2",
"prettier": "1.17.0", "prettier": "1.17.0",
"querystring-browser": "^1.0.4", "querystring-browser": "^1.0.4",
"raw-loader": "^4.0.2", "raw-loader": "^4.0.2",
"react-activation": "^0.9.9", "react-activation": "^0.9.9",
"react-app-polyfill": "0.2.2", "react-app-polyfill": "0.2.2",
"react-error-overlay": "6.0.8", "react-error-overlay": "6.0.8",
"react-inlinesvg": "^2.3.0", "react-inlinesvg": "^2.3.0",
"react-refresh": "^0.9.0", "react-refresh": "^0.9.0",
"react-sticky": "^6.0.3", "react-sticky": "^6.0.3",
"react-test-renderer": "16.8.6", "react-test-renderer": "16.8.6",
"react-testing-library": "6.1.2", "react-testing-library": "6.1.2",
"redux-logger": "^3.0.6", "redux-logger": "^3.0.6",
"regenerator-runtime": "^0.13.7", "regenerator-runtime": "^0.13.7",
"reserved-words": "^0.1.2", "reserved-words": "^0.1.2",
"shelljs": "0.8.3", "shelljs": "0.8.3",
"slash2": "^2.0.0", "slash2": "^2.0.0",
"speed-measure-webpack-plugin": "1.3.3", "speed-measure-webpack-plugin": "1.3.3",
"spinner": "^0.3.4", "spinner": "^0.3.4",
"stats-webpack-plugin": "0.7.0", "stats-webpack-plugin": "0.7.0",
"style-loader": "^1.2.1", "style-loader": "^1.2.1",
"stylelint": "10.0.1", "stylelint": "10.0.1",
"stylelint-config-recommended": "2.2.0", "stylelint-config-recommended": "2.2.0",
"stylelint-config-styled-components": "0.1.1", "stylelint-config-styled-components": "0.1.1",
"stylelint-processor-styled-components": "1.6.0", "stylelint-processor-styled-components": "1.6.0",
"svg-url-loader": "^2.3.2", "svg-url-loader": "^2.3.2",
"swagger-ui-react": "^4.0.0-beta.4", "swagger-ui-react": "^4.0.0-beta.4",
"swagger2openapi": "^7.0.5", "swagger2openapi": "^7.0.5",
"swc-loader": "^0.1.15", "swc-loader": "^0.1.15",
"terser-webpack-plugin": "1.2.3", "terser-webpack-plugin": "1.2.3",
"traverse": "^0.6.6", "traverse": "^0.6.6",
"umi-webpack-bundle-analyzer": "3.6.0", "umi-webpack-bundle-analyzer": "3.6.0",
"url-loader": "1.1.2", "url-loader": "1.1.2",
"webpack": "^5.70.0", "webpack": "^5.70.0",
"webpack-chain": "6.5.1", "webpack-chain": "6.5.1",
"webpack-cli": "4.2.0", "webpack-cli": "4.2.0",
"webpack-dev-middleware": "5.3.0", "webpack-dev-middleware": "5.3.0",
"webpack-hot-middleware": "2.24.3", "webpack-hot-middleware": "2.24.3",
"webpack-manifest-plugin": "^3.0.0", "webpack-manifest-plugin": "^3.0.0",
"webpack-theme-color-replacer": "^1.3.15", "webpack-theme-color-replacer": "^1.3.15",
"webpackbar": "5.0.0-3", "webpackbar": "5.0.0-3",
"whatwg-fetch": "^3.0.0", "whatwg-fetch": "^3.0.0",
"yorkie": "^2.0.0" "yorkie": "^2.0.0"
}, }
"main": ".eslintrc.js"
} }
...@@ -3,7 +3,7 @@ const { writeFileSync, mkdirSync, existsSync } = require('fs'); ...@@ -3,7 +3,7 @@ const { writeFileSync, mkdirSync, existsSync } = require('fs');
const rimraf = require('rimraf'); const rimraf = require('rimraf');
const serveStatic = require('serve-static'); const serveStatic = require('serve-static');
const { resolve } = require('path'); const { resolve } = require('path');
const { portfinder, chalk, delay } = require('@umijs/utils'); const { portfinder, chalk, delay, createDebug, chokidar, signale, glob } = require('@umijs/utils');
const argv = require('./argv'); const argv = require('./argv');
const setup = require('./middlewares/frontendMiddleware'); const setup = require('./middlewares/frontendMiddleware');
const pkg = require('../package.json'); const pkg = require('../package.json');
...@@ -11,20 +11,19 @@ const config = require('../config/config'); ...@@ -11,20 +11,19 @@ const config = require('../config/config');
const mockMiddewares = require('./mock'); const mockMiddewares = require('./mock');
const emitter = require('./event'); const emitter = require('./event');
const Server = require('./server'); const Server = require('./server');
const debug = createDebug('preset-build-in:proxy:createMiddleware');
// const proxyConfig = require('../config/proxy');
const loadDotEnv = require('./utils/loadDotEnv'); const loadDotEnv = require('./utils/loadDotEnv');
const { getSchema } = require('./openapi'); const { getSchema } = require('./openapi');
const cleanRequireCache = require('./utils/cleanRequireCache');
(async () => { (async () => {
const defaultPort = const defaultPort = process.env.PORT || argv.port || (config && config.devServer && config.devServer.port);
process.env.PORT ||
argv.port ||
(config && config.devServer && config.devServer.port);
const port = await portfinder.getPortPromise({ const port = await portfinder.getPortPromise({
port: defaultPort ? parseInt(String(defaultPort), 10) : 8080, port: defaultPort ? parseInt(String(defaultPort), 10) : 8080,
}); });
const homename = const homename = process.env.HOST || (config && config.devServer && config.devServer.host) || '127.0.0.1';
process.env.HOST ||
(config && config.devServer && config.devServer.host) ||
'127.0.0.1';
console.log(chalk.cyan('Starting the development server...')); console.log(chalk.cyan('Starting the development server...'));
// process.send && process.send({ type: 'UPDATE_PORT', port }); // process.send && process.send({ type: 'UPDATE_PORT', port });
const isHTTPS = process.env.HTTPS || (argv && argv.https); const isHTTPS = process.env.HTTPS || (argv && argv.https);
...@@ -81,6 +80,54 @@ const { getSchema } = require('./openapi'); ...@@ -81,6 +80,54 @@ const { getSchema } = require('./openapi');
}, },
); );
// proxy config 热更新
const ignore = [
// ignore mock files under node_modules
'node_modules/**'
];
const cwd = process.cwd();
const proxyWatcherPaths = [
...(glob.sync('config/proxy.js', {
cwd,
ignore,
}) || []),
...(glob.sync('**/proxy.js', {
cwd,
ignore,
}) || []),
...(glob.sync('.env', {
cwd,
ignore,
}) || []),
...(glob.sync('.env.local', {
cwd,
ignore,
}) || [])
];
const watcher = chokidar.watch(proxyWatcherPaths, {
ignoreInitial: true,
});
const errors = [];
watcher.on('ready', () => debug('Initial scan complete. Ready for changes')).on('all', async (event, file) => {
debug(`[${event}] ${file}, reload proxy config`);``
errors.splice(0, errors.length);
cleanRequireCache(Array.from(new Set(proxyWatcherPaths)));
if (!errors.length) {
const hotProxy = require('../config/proxy');
server.setupProxy && server.setupProxy(hotProxy[process.env.NODE_ENV], true);
signale.success(`Proxy config parse success`);
}
});
process.once('SIGINT', async () => {
await watcher.close();
});
emitter.on('onDevCompileDone', async () => { emitter.on('onDevCompileDone', async () => {
try { try {
const openAPIConfig = config.openAPI; const openAPIConfig = config.openAPI;
...@@ -96,6 +143,7 @@ const { getSchema } = require('./openapi'); ...@@ -96,6 +143,7 @@ const { getSchema } = require('./openapi');
} }
}); });
await server.listen({ await server.listen({
port, port,
homename, homename,
......
...@@ -4,6 +4,7 @@ const webpackDevMiddleware = require('webpack-dev-middleware'); ...@@ -4,6 +4,7 @@ const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotMiddleware = require('webpack-hot-middleware'); const webpackHotMiddleware = require('webpack-hot-middleware');
const DevCompileDonePlugin = require('../../internals/webpack/plugins/DevCompileDonePlugin'); const DevCompileDonePlugin = require('../../internals/webpack/plugins/DevCompileDonePlugin');
const emitter = require('../event'); const emitter = require('../event');
function getIgnoredWatchRegExp() { function getIgnoredWatchRegExp() {
// const absOutputPath = winPath(path.join(process.cwd(), outputPath)); // const absOutputPath = winPath(path.join(process.cwd(), outputPath));
return process.env.WATCH_IGNORED === 'none' return process.env.WATCH_IGNORED === 'none'
...@@ -29,6 +30,7 @@ module.exports = function addDevMiddlewares( ...@@ -29,6 +30,7 @@ module.exports = function addDevMiddlewares(
config, config,
{ port = 8080, hostname = '127.0.0.1' }, { port = 8080, hostname = '127.0.0.1' },
) { ) {
if (!config.mfsu) { if (!config.mfsu) {
webpackConfig.plugins.push( webpackConfig.plugins.push(
new DevCompileDonePlugin({ new DevCompileDonePlugin({
...@@ -63,8 +65,15 @@ module.exports = function addDevMiddlewares( ...@@ -63,8 +65,15 @@ module.exports = function addDevMiddlewares(
app.use(middleware); app.use(middleware);
app.use(webpackHotMiddleware(compiler)); app.use(webpackHotMiddleware(compiler));
const fs = middleware.context.outputFileSystem; const fs = middleware.context.outputFileSystem;
app.get('*', (req, res) => { app.get('*', (req, res) => {
fs.readFile(path.join(compiler.outputPath, 'index.html'), (err, file) => { fs.readFile(path.join(compiler.outputPath, 'index.html'), (err, file) => {
if (err) { if (err) {
......
...@@ -134,7 +134,7 @@ class Server { ...@@ -134,7 +134,7 @@ class Server {
); );
} }
setupProxy(proxyOpts, isWatch = true) { setupProxy(proxyOpts, isWatch = false) {
let proxy = proxyOpts || this.opts.proxy; let proxy = proxyOpts || this.opts.proxy;
if (!Array.isArray(proxy)) { if (!Array.isArray(proxy)) {
if (proxy && 'target' in proxy) { if (proxy && 'target' in proxy) {
...@@ -181,6 +181,7 @@ class Server { ...@@ -181,6 +181,7 @@ class Server {
}, },
}); });
} }
return;
}; };
let startIndex = null; let startIndex = null;
......
const { winPath } = require('@umijs/utils')
function cleanRequireCache(paths) {
Object.keys(require.cache).forEach(file => {
if (paths.some(p => winPath(file).indexOf(p) > -1)) {
delete require.cache[file];
}
});
};
module.exports = cleanRequireCache;
\ No newline at end of file
import 'whatwg-fetch'; // import 'whatwg-fetch';
import './public-path'; import './public-path';
import '!file-loader?name=[name].[ext]!./images/favicon.ico'; import '!file-loader?name=[name].[ext]!./images/favicon.ico';
import './global.less'; import './global.less';
...@@ -7,11 +7,7 @@ import 'antd/dist/antd.less'; ...@@ -7,11 +7,7 @@ import 'antd/dist/antd.less';
import 'file-loader?name=.htaccess!./.htaccess'; // eslint-disable-line import/extensions import 'file-loader?name=.htaccess!./.htaccess'; // eslint-disable-line import/extensions
import '@wisdom-utils/utils/lib/helpers/format'; import '@wisdom-utils/utils/lib/helpers/format';
import 'sanitize.css/sanitize.css'; import 'sanitize.css/sanitize.css';
// import { event } from '@wisdom-utils/utils';
import { ConfigProvider } from 'antd';
import { Storeage } from '@wisdom-utils/utils/lib/helpers'; import { Storeage } from '@wisdom-utils/utils/lib/helpers';
// import { history } from '@wisdom-utils/runtime';
// import { actionCreators } from './containers/App/store';
import { initGlobalConfig } from './initConfig'; import { initGlobalConfig } from './initConfig';
import './utils/event'; import './utils/event';
...@@ -19,9 +15,7 @@ import './utils/event'; ...@@ -19,9 +15,7 @@ import './utils/event';
// eslint-disable-next-line no-restricted-globals // eslint-disable-next-line no-restricted-globals
const namespace = `__PANDA_STORE__${location.hostname}`; const namespace = `__PANDA_STORE__${location.hostname}`;
window.createStoreage = new Storeage(namespace); window.createStoreage = new Storeage(namespace);
ConfigProvider.config({
prefixCls: 'panda-console-base',
});
const initLocale = () => { const initLocale = () => {
localStorage.setItem('umi_locale', 'zh-CN'); localStorage.setItem('umi_locale', 'zh-CN');
}; };
...@@ -29,15 +23,6 @@ const initLocale = () => { ...@@ -29,15 +23,6 @@ const initLocale = () => {
initGlobalConfig(); initGlobalConfig();
initLocale(); initLocale();
// const unlisten = (function() {
// let prePathname = '';
// return history.listen(location => {
// if (location.pathname.indexOf('/civbase/user/login') > -1 && location.pathname !== prePathname) {
// initGlobalConfig();
// }
// prePathname = location.pathname;
// });
// })();
// event.on('event:logout', () => { // event.on('event:logout', () => {
// store.dispatch(actionCreators.logout()); // store.dispatch(actionCreators.logout());
......
...@@ -11,7 +11,6 @@ const pkg = require('../../../package.json'); ...@@ -11,7 +11,6 @@ const pkg = require('../../../package.json');
const { renderRoutes } = helpers; const { renderRoutes } = helpers;
const config = require('../../../config/config'); const config = require('../../../config/config');
function App(props) { function App(props) {
//
const metaSecurity = /https/.test(window.location.protocol) ? ( const metaSecurity = /https/.test(window.location.protocol) ? (
<meta httpEquiv="Content-Security-Policy" content="upgrade-insecure-requests" /> <meta httpEquiv="Content-Security-Policy" content="upgrade-insecure-requests" />
) : null; ) : null;
......
...@@ -25,7 +25,7 @@ import { ...@@ -25,7 +25,7 @@ import {
AMAP_VIEW, AMAP_VIEW,
PD_VIEW, PD_VIEW,
} from './constants'; } from './constants';
import { store } from '@wisdom-utils/utils';
export function getConfig(data) { export function getConfig(data) {
return { return {
type: GET_CONFIG, type: GET_CONFIG,
...@@ -222,6 +222,17 @@ export function logout(data) { ...@@ -222,6 +222,17 @@ export function logout(data) {
// eslint-disable-next-line no-undef,no-restricted-globals // eslint-disable-next-line no-undef,no-restricted-globals
createStoreage.remove(`__PANDA_STORE__MICRO_${location.hostname}`); createStoreage.remove(`__PANDA_STORE__MICRO_${location.hostname}`);
localStorage.removeItem('JmReport-Access-Token'); localStorage.removeItem('JmReport-Access-Token');
const products = (window.globalConfig.products || []).map(item => {
if (item.PackageName === 'civweb4') {
return 'web4_console'
}
return `${item.PackageName}-main`;
});
Object.keys(products).forEach(item => {
window[products[item]] && window[products[item]] && window[products[item]].unmount && window[products[item]].unmount({ store: store });
});
return { return {
type: LOGINOUT, type: LOGINOUT,
data: { data: {
......
...@@ -36,16 +36,18 @@ export const initGlobalConfig = () => { ...@@ -36,16 +36,18 @@ export const initGlobalConfig = () => {
localStorage.removeItem('loginSite'); localStorage.removeItem('loginSite');
} }
/* eslint-disable */ /* eslint-disable */
if (window.globalConfig.token !== null && Object.keys(window.globalConfig).length > 0) { // if (window.globalConfig.token !== null && Object.keys(window.globalConfig).length > 0) {
store.dispatch(actionCreators.getConfig(window.globalConfig)); // store.dispatch(actionCreators.getConfig(window.globalConfig));
// render({ appContent: '', loading: true }); // // render({ appContent: '', loading: true });
initMicroApps(loader, store); // initMicroApps(loader, store);
if (config.isNewYear) { // if (config.isNewYear) {
updateTheme('#ff9600'); // updateTheme('#ff9600');
} // }
} else { // } else {
// eslint-disable-next-line react-hooks/rules-of-hooks // // eslint-disable-next-line react-hooks/rules-of-hooks
let client = params.getParams('client') || Cookies.get('city');
// }
let client = params.getParams('client') || Cookies.get('city');
client = client && client !== 'undefined' ? client : 'city'; client = client && client !== 'undefined' ? client : 'city';
appService appService
.getWateWayConfig({ .getWateWayConfig({
...@@ -97,12 +99,14 @@ export const initGlobalConfig = () => { ...@@ -97,12 +99,14 @@ export const initGlobalConfig = () => {
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
new Login( new Login(
{ {
global: Object.assign({}, data, { global: Object.assign({}, data,
token: getToken(), {
}), token: getToken(),
},
gateWayConfig,
),
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
updateConfig: data => updateConfig: data => store.dispatch(actionCreators.getConfig(data)),
store.dispatch(actionCreators.getConfig(data)),
isInit: false, isInit: false,
logout: () => store.dispatch(actionCreators.logout()), logout: () => store.dispatch(actionCreators.logout()),
}, },
...@@ -117,23 +121,14 @@ export const initGlobalConfig = () => { ...@@ -117,23 +121,14 @@ export const initGlobalConfig = () => {
true, true,
); );
} }
// eslint-disable-next-line no-shadow
} }
return res; return res;
}) })
// eslint-disable-next-line no-shadow
.then(res => { .then(res => {
// eslint-disable-next-line no-use-before-define
// initSensorType();
// eslint-disable-next-line no-use-before-define
// initIsMock();
render({ appContent: '', loading: true }); render({ appContent: '', loading: true });
}) })
.catch(error => { .catch(error => {
console.log(error);
store.dispatch(actionCreators.getConfigError(error)); store.dispatch(actionCreators.getConfigError(error));
}); });
}); });
}
}; };
...@@ -223,6 +223,10 @@ const Layout = props => { ...@@ -223,6 +223,10 @@ const Layout = props => {
props.logout(); props.logout();
return; return;
} }
}, [props.global]);
useEffect(() => {
if ( if (
props.global && props.global &&
props.global.userInfo && props.global.userInfo &&
...@@ -234,7 +238,7 @@ const Layout = props => { ...@@ -234,7 +238,7 @@ const Layout = props => {
setCityData(res); setCityData(res);
}); });
} }
}, [props.global]); }, [props.global.userInfo])
const handlerPageChange = () => { const handlerPageChange = () => {
...@@ -252,7 +256,11 @@ const Layout = props => { ...@@ -252,7 +256,11 @@ const Layout = props => {
useEffect(() => { useEffect(() => {
window.share.event.on('updateSite', res => setCityData(res));
window.share.event.on('updateSite', res => {
debugger
setCityData(res)
});
return () => { return () => {
window.share.event.removeAllListeners('updateSite'); window.share.event.removeAllListeners('updateSite');
}; };
......
import React from 'react'; import React from 'react';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Redirect } from '@wisdom-utils/runtime'; import { Redirect, history } from '@wisdom-utils/runtime';
import { PageLoading } from '@ant-design/pro-layout'; import { PageLoading } from '@ant-design/pro-layout';
import _ from 'lodash'; import _ from 'lodash';
import { stringify } from 'querystring';
import { store, helpers } from '@wisdom-utils/utils'; import { store, helpers } from '@wisdom-utils/utils';
class SecurityLayout extends React.Component { class SecurityLayout extends React.Component {
state = { state = {
...@@ -19,7 +20,7 @@ class SecurityLayout extends React.Component { ...@@ -19,7 +20,7 @@ class SecurityLayout extends React.Component {
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const products = (this.props.global.products || []).map(item => { const products = (this.props.global.products || []).map(item => {
if(item.PackageName === 'civweb4') { if (item.PackageName === 'civweb4') {
return 'web4_console' return 'web4_console'
} }
return `${item.PackageName}-main`; return `${item.PackageName}-main`;
...@@ -30,35 +31,36 @@ class SecurityLayout extends React.Component { ...@@ -30,35 +31,36 @@ class SecurityLayout extends React.Component {
const nextPathname = nextProps.location.pathname; const nextPathname = nextProps.location.pathname;
const nextArgv = nextPathname.split('/'); const nextArgv = nextPathname.split('/');
if (argv[2] !== nextArgv[2]) {
if(argv[1] !== nextArgv[1]) {
Object.keys(products).forEach(item => { Object.keys(products).forEach(item => {
window[products[item]] && window[products[item]] && window[products[item]].unmount && window[products[item]].unmount({store: store}); window[products[item]] && window[products[item]] && window[products[item]].unmount && window[products[item]].unmount({ store: store });
}); });
} }
if(this.props.location.pathname !== nextProps.location.pathname) { if (this.props.location.pathname !== nextProps.location.pathname) {
store.set('event:globalConfig', {globalConfig: nextProps.global}); store.set('event:globalConfig', { globalConfig: nextProps.global });
} }
} }
render() { render() {
const { isReady } = this.state; const { isReady } = this.state;
const { children, global, loading } = this.props; const { children, global, loading } = this.props;
const isLogin = Cookies.get('token') !== null && global.token !== null; const isLogin = Cookies.get('token') !== null && global.token !== null;
// const queryString = stringify({
// redirect: window.location.href, if (!isLogin && window.location.pathname !== '/civbase/user/login') {
// }); const { query = {}, search, pathname } = history.location;
if (!Cookies.get('token')) { const { redirect } = query;
const queryString = stringify({
redirect: pathname + search,
});
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0); this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
let client = global.client || Cookies.get('city'); let client = global.client || Cookies.get('city');
client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city'; client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city';
// event.emit(?'event:initConfig');
let { generateType } = global; let { generateType } = global;
generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : ''; generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : '';
return ( return (
<Redirect <Redirect
to={`/user/login?client=${client}${generateType}`} to={`/user/login?client=${client}${generateType}&${queryString}`}
/> />
); );
} }
......
...@@ -337,13 +337,13 @@ class Site { ...@@ -337,13 +337,13 @@ class Site {
self.props.updateCurrentIndex && self.props.updateCurrentIndex(-1); self.props.updateCurrentIndex && self.props.updateCurrentIndex(-1);
const login = new Login(this.props, () => { const login = new Login(this.props, () => {
self.setLoading(false); self.setLoading(false);
self.getCityStationsForUser().then(res => {
window.share.event.emit('updateSite', res);
});
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
self.props.updateCurrentIndex && self.props.updateCurrentIndex(0); self.props.updateCurrentIndex && self.props.updateCurrentIndex(0);
// debugger // debugger
// initMicroApps(); // initMicroApps();
// 切换站点后,重置掉三级菜单 // 切换站点后,重置掉三级菜单
const homeType = self.globalConfig.homeType || 'civweb4'; const homeType = self.globalConfig.homeType || 'civweb4';
const homePath = self.globalConfig.homepage ? self.globalConfig.homepage.startsWith(homeType) ? self.globalConfig.homepage: `/${homeType}/${self.globalConfig.homepage}`: `/${homeType}`; const homePath = self.globalConfig.homepage ? self.globalConfig.homepage.startsWith(homeType) ? self.globalConfig.homepage: `/${homeType}/${self.globalConfig.homepage}`: `/${homeType}`;
...@@ -355,17 +355,10 @@ class Site { ...@@ -355,17 +355,10 @@ class Site {
// 重新加载订阅消息铃铛 // 重新加载订阅消息铃铛
window.share && window.share.event && window.share.event.emit('reloadNotice'); window.share && window.share.event && window.share.event.emit('reloadNotice');
const config = self.globalConfig;
const config = self.globalConfig; let url = !config.home ? ((config.homepage === '' || _.isNull(config.homepage)) ? `/civweb4`: `/civweb4/${config.homepage.replace(/^\//, '').replace(/^civweb4\//, '')}`) : `/${config.homepage.replace(/^\//, '')}`;
let url = !config.home ? ((config.homepage === '' || _.isNull(config.homepage)) ? `/civweb4`: `/civweb4/${config.homepage.replace(/^\//, '').replace(/^civweb4\//, '')}`) : `/${config.homepage.replace(/^\//, '')}`; self.props.history && self.props.history.push(url);
self.props.history && self.props.history.push(url) self.props && self.props.updateCollapsed && self.props.updateCollapsed(false);
self.getCityStationsForUser().then(res => {
window.share.event.emit('updateSite', res);
});
self.props &&
self.props.updateCollapsed &&
self.props.updateCollapsed(false);
window.share.event.emit('triggerMicro', this.props.global); window.share.event.emit('triggerMicro', this.props.global);
onChangeVisible && onChangeVisible(false); onChangeVisible && onChangeVisible(false);
}); });
......
...@@ -106,7 +106,7 @@ export const initMicroApps = () => { ...@@ -106,7 +106,7 @@ export const initMicroApps = () => {
// createStoreage.remove(`__PANDA_STORE__${location.hostname}`) // createStoreage.remove(`__PANDA_STORE__${location.hostname}`)
}, },
], ],
afterUnmount: [app => { afterUnmount: [app => {
actions.offGlobalStateChange(); actions.offGlobalStateChange();
Logger.info(`[LifeCycle] after unmount %c%s ${app.name}`, app); Logger.info(`[LifeCycle] after unmount %c%s ${app.name}`, app);
}], }],
...@@ -174,7 +174,10 @@ export const initMicroApps = () => { ...@@ -174,7 +174,10 @@ export const initMicroApps = () => {
url.indexOf('https://maponline1.bdimg.com') !== -1 || url.indexOf('https://maponline1.bdimg.com') !== -1 ||
url.indexOf('https://maponline2.bdimg.com') !== -1 || url.indexOf('https://maponline2.bdimg.com') !== -1 ||
url.indexOf('https://maponline3.bdimg.com') !== -1 || url.indexOf('https://maponline3.bdimg.com') !== -1 ||
url.indexOf('https://api.map.baidu.com/getscript') !== -1, url.indexOf('https://api.map.baidu.com/getscript') !== -1 ||
url.indexOf('dlswbr.baidu.com') !== -1 ||
url.indexOf('maponline0.bdimg.com') !== -1 ||
url.indexOf('miao.baidu.com') !== -1,
}); });
runAfterFirstMounted(() => { runAfterFirstMounted(() => {
Logger.info('[MainApp] first app mounted'); Logger.info('[MainApp] first app mounted');
...@@ -189,12 +192,13 @@ export const initMicroApps = () => { ...@@ -189,12 +192,13 @@ export const initMicroApps = () => {
}; };
export const defaultApp = () => { export const defaultApp = () => {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const config = window.globalConfig; const config = window.globalConfig;
if (config && config.token) { if (config && config.token) {
let url = !config.home ? ((config.homepage === '' || _.isNull(config.homepage)) ? `/civbase/civweb4`: `/civbase/civweb4/${config.homepage.replace(/^\//, '').replace(/^civweb4\//, '')}`) : `/civbase/${config.homepage.replace(/^\//, '')}`; let url = !config.home ?
((config.homepage === '' || _.isNull(config.homepage)) ? `/civbase/civweb4`: (`/civbase/${config.homepage.replace(/^\//, '')}`)) : `/civbase/${config.homepage.replace(/^\//, '')}`;
setDefaultMountApp(url); setDefaultMountApp(url);
} }
}; };
...@@ -302,7 +306,8 @@ window.app.define('kit_global_config', require.context('../node_modules/kit_glob ...@@ -302,7 +306,8 @@ window.app.define('kit_global_config', require.context('../node_modules/kit_glob
window.app.define('@wisdom-utils/utils', require.context('../node_modules/@wisdom-utils/utils/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js'); window.app.define('@wisdom-utils/utils', require.context('../node_modules/@wisdom-utils/utils/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@wisdom-utils/runtime', require.context('../node_modules/@wisdom-utils/runtime/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js'); window.app.define('@wisdom-utils/runtime', require.context('../node_modules/@wisdom-utils/runtime/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@wisdom-utils/components', require.context('../node_modules/@wisdom-utils/components/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js'); window.app.define('@wisdom-utils/components', require.context('../node_modules/@wisdom-utils/components/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('axios', require.context('../node_modules/axios/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'axios.js');
window.app.define('js-base64', require.context('../node_modules/js-base64', true, /[^\/]+\.js$/), 'base64.js');
/** /**
* arcgismap * arcgismap
*/ */
...@@ -495,6 +500,10 @@ window.app.define('@wisdom-utils/components', require.context('../node_modules/@ ...@@ -495,6 +500,10 @@ window.app.define('@wisdom-utils/components', require.context('../node_modules/@
window.app.define('@ant-design/pro-list', require.context('../node_modules/@ant-design/pro-list/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js'); window.app.define('@ant-design/pro-list', require.context('../node_modules/@ant-design/pro-list/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('antd', require.context('../node_modules/antd/es', true, /^.\/(es\/)?[^\/]+\.js$/), 'index.js'); window.app.define('antd', require.context('../node_modules/antd/es', true, /^.\/(es\/)?[^\/]+\.js$/), 'index.js');
// window.app.define('antd-es-button-style', require.context('../node_modules/antd/es/button/style', true, /\.js/));
// window.app.define('antd-es-input-style', require.context('../node_modules/antd/es/input/style', true, /\.js/));
// window.app.define('style-button', require.context('../node_modules/antd/es/button/style', /^.\/(style\/)?[^\/]+\.js$/), 'index.js');
window.app.define('classnames', require.context('classnames', true, /^.\/index\.js$/), 'index.js'); window.app.define('classnames', require.context('classnames', true, /^.\/index\.js$/), 'index.js');
window.app.define('@ant-design/icons', require.context('../node_modules/@ant-design/icons/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js'); window.app.define('@ant-design/icons', require.context('../node_modules/@ant-design/icons/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@ant-design/pro-utils', require.context('../node_modules/@ant-design/pro-utils/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js'); window.app.define('@ant-design/pro-utils', require.context('../node_modules/@ant-design/pro-utils/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
......
import React from 'react'; import React, { useEffect } from 'react';
import BaseLogin from './template/baseLogin'; import BaseLogin from './template/baseLogin';
import NewYear from './template/newYear'; import NewYear from './template/newYear';
import InfoLogin from './template/infoLogin'; import InfoLogin from './template/infoLogin';
import Yulin from './template/yulin'; import Yulin from './template/yulin';
import { getParams } from '@wisdom-utils/utils/lib/helpers/params';
// import { useParams } from '@wisdom-utils/runtime';
import { initGlobalConfig } from '../../../initConfig'; import { initGlobalConfig } from '../../../initConfig';
const LoginTemplate = {
'新春 - 智联.html': NewYear,
'Dark - IOTMultiLogin.html': BaseLogin,
'Dark.html': BaseLogin,
'DarkCloud.html': BaseLogin,
'信息化.html': InfoLogin,
'项目 - 榆林.html': Yulin,
'default': BaseLogin
};
/* eslint-disable */ /* eslint-disable */
export default () => { export default (props) => {
const redirect = getParams('redirect');
React.useEffect(() => { useEffect(() => {
if(getParams('loginName') && getParams('password')) return
initGlobalConfig(); initGlobalConfig();
}, []); }, [redirect]);
const template = window.globalConfig && window.globalConfig.loginTemplate;
const loginTemplate = window.globalConfig && window.globalConfig.loginTemplate; const RenderComponent = LoginTemplate[template] ? LoginTemplate[template]: LoginTemplate['default'];
switch(loginTemplate) { return <RenderComponent {...props}/>
case '新春 - 智联.html':
return <NewYear/>
case 'Dark - IOTMultiLogin.html':
case 'Dark.html':
return <BaseLogin/>
case '信息化.html':
return <InfoLogin />
case '项目 - 榆林.html':
return <Yulin />
default:
return <BaseLogin/>;
}
}; };
...@@ -114,18 +114,27 @@ class Login { ...@@ -114,18 +114,27 @@ class Login {
}).then(response => { }).then(response => {
if (response && !response.errMsg) { if (response && !response.errMsg) {
self.globalConfig.userInfo = {}; self.globalConfig.userInfo = {};
if (
response.Groups && if(response.hasOwnProperty('data')) {
response.Groups instanceof Array && self.globalConfig.userInfo = {
response.Groups.length // ... self.globalConfig.userInfo,
) { ...response.data
self.globalConfig.userInfo.Groups = response.Groups; }
} else {
if (
response.Groups &&
response.Groups instanceof Array &&
response.Groups.length
) {
self.globalConfig.userInfo.Groups = response.Groups;
}
self.globalConfig.userInfo = Object.assign(
{},
response,
self.globalConfig.userInfo,
);
} }
self.globalConfig.userInfo = Object.assign(
{},
response,
self.globalConfig.userInfo,
);
self.updateConfig && self.updateConfig(self.globalConfig); self.updateConfig && self.updateConfig(self.globalConfig);
self.getUserInfoAndConfig(); self.getUserInfoAndConfig();
} else { } else {
......
...@@ -2,20 +2,34 @@ import React from 'react'; ...@@ -2,20 +2,34 @@ import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { history } from '@wisdom-utils/runtime'; import { history } from '@wisdom-utils/runtime';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { ConfigProvider } from 'antd'; import { ConfigProvider, message, Modal, notification } from 'antd';
import { ConnectedRouter } from 'connected-react-router/immutable'; import { ConnectedRouter } from 'connected-react-router/immutable';
import { ErrorBoundary, LocaleContainer } from '@wisdom-utils/components'; import { ErrorBoundary, LocaleContainer } from '@wisdom-utils/components';
import store from './stores'; import store from './stores';
import Container from './components/Container'; import Container from './components/Container';
import App from './containers/App'; import App from './containers/App';
const MOUNT_NODE = document.getElementById('root'); const MOUNT_NODE = document.getElementById('root');
const customPrefixCls = 'panda-console-base';
Modal.config({
rootPrefixCls: customPrefixCls
});
message.config({
rootPrefixCls: customPrefixCls
});
notification.config({
rootPrefixCls: customPrefixCls
});
ConfigProvider.config({
prefixCls: customPrefixCls,
});
export const render = () => { export const render = () => {
// eslint-disable-next-line react-hooks/rules-of-hooks // eslint-disable-next-line react-hooks/rules-of-hooks
ReactDOM.render( ReactDOM.render(
<Provider store={store}> <Provider store={store}>
<ConnectedRouter history={history}> <ConnectedRouter history={history}>
<LocaleContainer> <LocaleContainer>
<ConfigProvider prefixCls="panda-console-base"> <ConfigProvider prefixCls={customPrefixCls}>
<ErrorBoundary> <ErrorBoundary>
<Container> <Container>
<App /> <App />
......
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