Commit 6dd63ddf authored by 邹绪超's avatar 邹绪超

chore: merge master分支

parents 2615ead3 de3bb6eb
variables:
TARGET_REPO: "F:/CIV_CI/CivWebPublish2021_CIVWeb5/CivWebPublish2021/"
TARGET_REPO: "G:/CIV_CI/CivWebPublish2021_CIVWeb5/CivWebPublish2021/"
GIT_STRATEGY: 'fetch'
GIT_CHECKOUT: 'false'
before_script:
- chcp 65001
- 'git config core.autocrlf false'
......@@ -12,12 +13,15 @@ stages:
install:
stage: install
tags:
- civ_base
script:
- git pull origin master
- npm run init
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
#cache:
# key: ${CI_COMMIT_REF_SLUG}
# paths:
# - node_modules/
only:
refs:
- master
......@@ -27,13 +31,17 @@ install:
package:
stage: package
tags:
- civ_base
script:
- echo "${CI_PROJECT_DIR}"
- git pull origin master
#- npm run init
- npm run build --releasepath=../CivWebPublish2021
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
#cache:
# key: ${CI_COMMIT_REF_SLUG}
# paths:
# - node_modules/
only:
- master
when: manual
......@@ -43,6 +51,8 @@ push:
variables:
GIT_STRATEGY: none
stage: push
tags:
- civ_base
script:
- 'cd "${TARGET_REPO}"'
- 'git reset --hard head'
......@@ -51,7 +61,7 @@ push:
- 'git pull origin map'
- 'git rm -rf "${TARGET_REPO}/civbase"'
- 'git commit -m "chore: clear folder"'
- 'git push origin map'
#- 'git push origin map'
- 'robocopy "${CI_PROJECT_DIR}/../CivWebPublish2021/civbase" "${TARGET_REPO}/civbase" /S ;
IF ((${LASTEXITCODE} -le 8)) {cmd /c "exit /b 0"}'
- 'git add . ; git reset HEAD Web.config CityInterface/Web.config CityWebFW/Web.config ; git commit -m "auto package civbase."'
......
const { join } = require('path');
const proxy = require('./proxy');
const slash = require('slash2');
const proxy = require('./proxy');
const defaultSetting = require('./defaultSetting');
function resolve (dir) {
return join(__dirname, '../', dir)
}
const { REACT_APP_ENV } = process.env;
const cesiumBuild = "../node_modules/cesium/Build/Cesium"
const pkgName = require('../package.json').name;
const path = require('path');
const CESIUM_BASE_URL = `/${pkgName}`
module.exports = {
// mfsu: {},
webpack5: {},
base: '/civbase',
title: '熊猫智慧城市监控管理解决方案',
hash: true,
layout: {
siderWidth: '145px',
locale: true,
...defaultSetting
...defaultSetting,
},
fastRefresh: true,
useHash: true,
locale: {
default: 'zh-CN',
antd: true,
......@@ -33,8 +32,12 @@ module.exports = {
// },
ignoreMomentLocale: true,
nodeModulesTransform: {
type: 'all',
exclude: ['@wisdom-map/arcgismap', '@wisdom-map/arcgismap/lib/arcgisapi'],
type: 'none',
exclude: [
'@wisdom-map/arcgismap',
'@wisdom-map/arcgismap/lib/arcgisapi',
'swagger-ui-react',
],
},
proxy: proxy[REACT_APP_ENV || 'dev'],
// openAPI: {
......@@ -77,9 +80,9 @@ module.exports = {
modifyVars: {
// hack: `true; @import "~@/global.less";`,
'@ant-prefix': 'panda-console-base',
'@iconPrefixCls': 'panda-console-base-icon'
'@iconPrefixCls': 'panda-console-base-icon',
},
javascriptEnabled: true
javascriptEnabled: true,
},
copy : [{
from : path.join(pkgName , cesiumBuild, './Workers'),
......@@ -100,6 +103,7 @@ module.exports = {
},
alias: {
cesium : path.resolve(__dirname, cesiumBuild)
}
},
workerLoader: {},
// esbuild: {}
};
......@@ -4,23 +4,38 @@ export function genActiveRule(routerPrefix) {
export default {
dev: [
// {
// name: 'civ_monitor',
// entry: `//${window.location.hostname}:8082/civ_monitor`,
// name: 'civ_energy',
// entry: `//${window.location.hostname}:8081/civ_energy`,
// container: '#micro-container',
// activeRule: '/civbase/civ_monitor',
// activeRule: '/civbase/civ_energy',
// },
// {
// name: 'civ_water',
// entry: `//${window.location.hostname}:8081/civ_water`,
// container: '#micro-container',
// activeRule: '/civbase/civ_water',
// },
{
name: 'civ_water',
entry: `//${window.location.hostname}:8082/civ_water`,
name: 'civ_pandawork',
entry: `//${window.location.hostname}:8081/civ_pandawork`,
container: '#micro-container',
activeRule: '/civbase/civ_water',
activeRule: '/civbase/civ_pandawork',
},
{
name: 'civ_webgis',
entry: `//${window.location.hostname}:8080/civ_webgis`,
name: 'report',
entry: `//127.0.0.1:8345/report/workplatform`,
container: '#micro-container',
activeRule: '/civbase/civ_webgis',
activeRule: '/civbase/report',
props: {
origin: `//127.0.0.1:8345`
}
},
// {
// name: 'civ_webgis',
// entry: `//${window.location.hostname}:8080/civ_webgis`,
// container: '#micro-container',
// activeRule: '/civbase/civ_energy',
// },
{
name: 'civweb4',
entry: `//${window.location.hostname}:3020/civweb4`,
......@@ -29,7 +44,7 @@ export default {
},
{
name: 'middleground',
entry: `//${window.location.hostname}:8081/middleground`,
entry: `//${window.location.hostname}:8082/middleground`,
container: '#micro-container',
activeRule: '/civbase/middleground',
},
......
/* eslint-disable */
// const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin;
const proxyURL = 'http://192.168.12.47:8081'
//'http://61.150.107.92:8200';
const proxyURL = 'https://work.panda-water.cn';
module.exports = {
assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './',
dev: {
......@@ -80,6 +80,26 @@ module.exports = {
'/PandaCore': '/PandaCore',
},
},
'/PandaInformatization': {
target: proxyURL,
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
pathRewrite: {
'/PandaInformatization': '/PandaInformatization',
},
},
'/PandaWorkFlow': {
target: proxyURL,
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
pathRewrite: {
'/PandaWorkFlow': '/PandaWorkFlow',
},
},
'/CityTemp': {
// target: 'http://192.168.10.150:8777',
target: proxyURL,
......
......@@ -23,7 +23,8 @@ module.exports = opts => {
'@babel/preset-env',
{
...mergeConfig(defaultEnvConfig,{}),
modules: false
modules: false,
...opts.env
},
],
// opts.react && ['@babel/preset-react'],
......@@ -56,17 +57,17 @@ module.exports = opts => {
'@babel/plugin-proposal-logical-assignment-operators',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-react-jsx',
// opts.transformRuntime && [
// '@babel/plugin-transform-runtime',
// {
// version: require('@babel/runtime/package.json').version,
// absoluteRuntime: dirname(
// require.resolve('@babel/runtime/package.json'),
// ),
// useESModules: true,
// ...toObject(opts.transformRuntime),
// },
// ],
opts.transformRuntime && [
'@babel/plugin-transform-runtime',
{
version: require('@babel/runtime/package.json').version,
absoluteRuntime: dirname(
require.resolve('@babel/runtime/package.json'),
),
useESModules: true,
...toObject(opts.transformRuntime),
},
],
[
'babel-plugin-transform-react-remove-prop-types',
{
......
......@@ -24,16 +24,19 @@ rm(
// eslint-disable-next-line no-shadow
webpack(webpackConfig, function (err, stats) {
spinner.stop()
if (err) throw err
// process.stdout.write(`${stats.toString({
// colors: true,
// color: true,
// progress: true,
// modules: false,
// children: false,
// chunks: true,
// chunkModules: true
// }) }\n\n`)
if (err) {
console.log(err)
throw err
}
process.stdout.write(`${stats.toString({
colors: true,
color: true,
progress: true,
modules: false,
children: false,
chunks: true,
chunkModules: true
}) }\n\n`)
printFileSizes(stats, path.relative(process.cwd(), webpackConfig.output.path));
if (stats.hasErrors()) {
......
......@@ -13,9 +13,6 @@ class DevCompileDonePlugin {
if (process.env.SYSTEM_BELL !== 'none') {
process.stdout.write('\x07');
}
this.opts.onCompileFail && this.opts.onCompileFail({
stats,
});
return;
}
......@@ -34,7 +31,6 @@ class DevCompileDonePlugin {
copied = chalk.red(`(copy to clipboard failed)`);
}
console.log();
console.log(
[
` App running at:`,
......@@ -44,18 +40,22 @@ class DevCompileDonePlugin {
.filter(Boolean)
.join('\n'),
);
process.send &&
process.send({
type: 'DONE',
});
isFirstCompile = false;
}
this.opts.onCompileDone && this.opts.onCompileDone({
isFirstCompile,
stats,
});
if(isFirstCompile) {
isFirstCompile = false;
// process.send({
// type: 'DONE'
// })
// this.opts.onCompileDone && this.opts.onCompileDone({
// isFirstCompile,
// stats,
// });
if (isFirstCompile) {
isFirstCompile = false;
// process.send({
// type: 'DONE'
// })
}
});
}
......
This diff is collapsed.
......@@ -13,8 +13,9 @@ module.exports = require('./webpack.base.babel')({
path.join(process.cwd(), 'src/app.js'), // Start with js/app.js
],
optimization: {
namedModules: true,
namedChunks: true,
// namedModules: true,
// namedChunks: true,
chunkIds: "named",
runtimeChunk: {
name: 'runtime',
},
......@@ -53,13 +54,13 @@ module.exports = require('./webpack.base.babel')({
},
},
plugins: [
new CircularDependencyPlugin({
exclude: /node_modules/,
include: /src/,
failOnError: false,
allowAsyncCycles: false,
cwd: process.cwd(),
}),
// new CircularDependencyPlugin({
// exclude: /node_modules/,
// include: /src/,
// failOnError: false,
// allowAsyncCycles: false,
// cwd: process.cwd(),
// }),
],
devtool: 'cheap-module-source-map',
node: {
......
// Important modules this config uses
const path = require('path');
const { HashedModuleIdsPlugin } = require('webpack');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
module.exports = require('./webpack.base.babel')({
mode: 'production',
mode: 'production',
// In production, we skip all hot-reloading stuff
entry: [
require.resolve('react-app-polyfill/ie11'),
path.join(process.cwd(), 'src/app.js'),
],
// In production, we skip all hot-reloading stuff
entry: [
require.resolve('react-app-polyfill/ie11'),
path.join(process.cwd(), 'src/app.js'),
],
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
// output: {
// filename: '[name].[chunkhash].js',
// chunkFilename: '[name].[chunkhash].chunk.js',
// },
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
// output: {
// filename: '[name].[chunkhash].js',
// chunkFilename: '[name].[chunkhash].chunk.js',
// },
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
warnings: false,
compress: {
comparisons: false,
},
parse: {},
mangle: true,
output: {
comments: false,
ascii_only: true,
},
},
parallel: true,
cache: true,
sourceMap: true,
}),
],
nodeEnv: 'production',
sideEffects: true,
concatenateModules: true,
runtimeChunk: 'single',
splitChunks: {
// minSize: 0,
maxSize: 100 * 1024, // 控制包的最大字节数
minSize: 10 * 1024, // 控制包的最小字节数
minChunks: 1,
cacheGroups: {
vendor: {
chunks: 'all',
maxInitialRequests: 10,
minSize: 0,
test: /[\\/]node_modules[\\/]/,
name(module) {
const packageName = module.context.match(
/[\\/]node_modules[\\/](.*?)([\\/]|$)/,
)[1];
return `npm.${packageName.replace('@', '')}`;
},
},
bizComponent: {
chunks: 'all',
minSize: 0,
maxInitialRequests: 10,
test: /[\\/]src[\\/]components[\\/]/,
name: 'biz-component',
},
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
warnings: false,
compress: {
comparisons: false,
},
drop_debugger: true,
drop_console: true,
pure_funcs: ['console.log'],
parse: {},
mangle: true,
output: {
comments: false,
ascii_only: true,
},
},
parallel: true,
cache: true,
sourceMap: true,
}),
],
nodeEnv: 'production',
chunkIds: 'deterministic',
moduleIds: 'deterministic',
usedExports: true,
sideEffects: true,
concatenateModules: true,
runtimeChunk: 'single',
splitChunks: {
maxSize: 100 * 1024, // 控制包的最大字节数
minSize: 10 * 1024, // 控制包的最小字节数
cacheGroups: {
vendor: {
chunks: 'all',
minSize: 0,
maxInitialRequests: 10,
test: /[\\/]node_modules[\\/]/,
name(module) {
const packageName = module.context.match(
/[\\/]node_modules[\\/](.*?)([\\/]|$)/,
)[1];
return `npm.${packageName.replace('@', '')}`;
},
},
bizComponent: {
chunks: 'all',
minSize: 0,
maxInitialRequests: 10,
test: /[\\/]src[\\/]components[\\/]/,
name: 'biz-component',
},
react: {
chunks: 'all',
minSize: 0,
maxInitialRequests: 10,
test: /[\\/]node_modules[\\/]react-dom[\\/]/,
name: 'react-dom',
}
},
},
},
plugins: [
new CompressionPlugin({
algorithm: 'gzip',
test: /\.js$|\.css$|\.html$/,
threshold: 10240,
minRatio: 0.8,
}),
plugins: [
new CompressionPlugin({
algorithm: 'gzip',
test: /\.js$|\.css$|\.html$/,
threshold: 10240,
minRatio: 0.8,
}),
new HashedModuleIdsPlugin({
hashFunction: 'sha256',
hashDigest: 'hex',
hashDigestLength: 20,
}),
],
// new webpack.ids.HashedModuleIdsPlugin({
// hashFunction: 'sha256',
// hashDigest: 'hex',
// hashDigestLength: 20,
// }),
],
performance: {
assetFilter: assetFilename =>
!/(\.map$)|(^(main\.|favicon\.))/.test(assetFilename),
},
performance: {
assetFilter: assetFilename =>
!/(\.map$)|(^(main\.|favicon\.))/.test(assetFilename),
},
});
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -100,15 +100,15 @@
"@ant-design/pro-utils": "^1.10.4",
"@babel/polyfill": "7.4.3",
"@babel/runtime": "^7.10.5",
"@wisdom-cesium/cesium": "^1.0.52",
"@wisdom-cesium/cesium": "^1.0.64",
"@wisdom-components/empty": "^1.4.1",
"@wisdom-map/arcgismap": "^1.0.60-0",
"@wisdom-map/util": "^1.0.27-0",
"@wisdom-utils/components": "0.0.14",
"@wisdom-utils/runtime": "0.0.15",
"@wisdom-utils/utils": "0.0.52",
"@wisdom-utils/utils": "0.0.63",
"animate.css": "^4.1.1",
"antd": "^4.16.13",
"antd": "^4.17.4",
"compression": "1.7.4",
"connected-react-router": "6.4.0",
"fontfaceobserver": "2.1.0",
......@@ -118,7 +118,7 @@
"immutable": "^4.0.0-rc.12",
"js-base64": "^3.5.2",
"js-cookie": "^2.2.1",
"kit_global_config": "^1.0.32",
"kit_global_config": "^1.0.41",
"kit_logger": "^1.0.2",
"kit_utils": "^1.3.11",
"lodash": "4.17.11",
......@@ -130,11 +130,13 @@
"prop-types": "15.7.2",
"qiankun": "^2.4.6",
"qrcode.react": "^1.0.0",
"rc-cascader": "^2.3.2",
"react": "16.12.0",
"react-dom": "16.12.0",
"react-draggable": "^4.4.3",
"react-helmet": "6.0.0-beta",
"react-helmet-async": "^1.0.4",
"react-iframe": "^1.8.0",
"react-intl": "^3.12.1",
"react-redux": "7.0.2",
"react-router-config": "^5.1.1",
......@@ -173,9 +175,6 @@
"@umijs/fabric": "^2.2.0",
"@umijs/runtime": "3.3.7",
"@umijs/utils": "3.3.7",
"add-asset-html-webpack-plugin": "3.1.3",
"antd-icon-reduce-loader": "^1.0.6",
"antd-icon-reduce-plugin": "^1.1.1",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.1",
"babel-loader": "8.0.5",
......@@ -218,10 +217,9 @@
"express": "^4.17.1",
"file-loader": "3.0.1",
"friendly-errors-webpack-plugin": "^1.7.0",
"fs": "0.0.1-security",
"fs-extra": "^9.0.1",
"html-loader": "0.5.5",
"html-webpack-plugin": "4.4.0",
"html-webpack-plugin": "5.5.0",
"http-proxy-middleware": "^1.0.5",
"husky": "^2.3.0",
"imports-loader": "0.8.0",
......@@ -288,16 +286,15 @@
"traverse": "^0.6.6",
"umi-webpack-bundle-analyzer": "3.6.0",
"url-loader": "1.1.2",
"webpack": "4.44.1",
"webpack": "^5.65.0",
"webpack-chain": "6.5.1",
"webpack-cli": "3.3.0",
"webpack-dev-middleware": "3.6.2",
"webpack-cli": "4.2.0",
"webpack-dev-middleware": "5.3.0",
"webpack-hot-middleware": "2.24.3",
"webpack-manifest-plugin": "^3.0.0",
"webpack-theme-color-replacer": "^1.3.15",
"webpackbar": "5.0.0-3",
"whatwg-fetch": "3.0.0",
"yorkie": "^2.0.0",
"zlib": "^1.0.5"
"whatwg-fetch": "^3.0.0",
"yorkie": "^2.0.0"
}
}
-----BEGIN CERTIFICATE-----
MIIETDCCArSgAwIBAgIQKxt9OXlPUkkQASISMtxezDANBgkqhkiG9w0BAQsFADBh
MR4wHAYDVQQKExVta2NlcnQgZGV2ZWxvcG1lbnQgQ0ExGzAZBgNVBAsMEmpjbEB5
Y2pjbDg2OC5sb2NhbDEiMCAGA1UEAwwZbWtjZXJ0IGpjbEB5Y2pjbDg2OC5sb2Nh
bDAeFw0xOTA2MDEwMDAwMDBaFw0zMDA2MDEwOTMzNTdaMEkxJzAlBgNVBAoTHm1r
Y2VydCBkZXZlbG9wbWVudCBjZXJ0aWZpY2F0ZTEeMBwGA1UECwwVamNsQHVtaWpz
LmxvY2FsICh1bWkpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvKA/
Oz9az6kEZ5zSZyufpYXt5gOAnE/f8VY2hP3g7JDRCMk6w0XgkmGDJ45nY9fVVhCy
oqg8bIkLcLbvp69/I5O8ae0TbyS95mgBflhgsqjSkydhn7bZmAe5OdZv+JtGBjd2
2YDpzseK0z1VkXxgEAKYOsxszaCj6aktAhTQvER2DYGo0XaM62SOQNL4qLn97Zrg
+g8GSjS/Cg/vb+k42tCghOm0Ks26CDBl92Dwl5modEkfzewrjC2WNletiZupsX6p
rnRDBcGYHl+S/+D/iHCSu83IkxoorsIigGlSah/nVfetsKHBTXFXnSxL86T9MA1R
5ZcXoVv1cWZNiiMMawIDAQABo4GXMIGUMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUE
DDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMB8GA1UdIwQYMBaAFFRTg3QdwqVq
CLRjdLfglrJZqTrzMD4GA1UdEQQ3MDWCCWxvY2FsaG9zdIIQbG9jYWwuYWxpcGF5
Lm5ldIcEfwAAAYcQAAAAAAAAAAAAAAAAAAAAATANBgkqhkiG9w0BAQsFAAOCAYEA
lFgca57CNAoaq8MC6bTZo10FC/LDTnUh/p20w5uCp8iSKGtVM+HvulrWXwUGRkUl
jnukYeMwl4tONzwHeUV1oVT8DATFLAFIHE4ikGDM7V+Ximxv5yQQ9hD8fzeOWdYO
SKA5eDjd+ut+HiSfItqgM+8t1RxPxsYlGeOMp65cKt1NaIdRxQHwESGba6H0sez7
p5Eu95pXp/BUy7lnvqudXgfTAUpSzxpSG+49hzMKuN/CAZyFNp52qDDHpRtuxHns
q0pjGHBOC2aYc1eXNgn2g0wMDp3+BYh9yjoWNkMKqY7hpcB9PY5zw0u8R0wG8z+n
d915bZT3FKjx5sxmDmVaDNdARwi9ExqFvIs+hje1IUrszR7pnT7EUcUOhWNbKKkf
jRH3sy+TyA+TsYm1AAcnnY/Ne/Ce4OcMGcYwjb1L/gu/PWoup4f/GIziEw8cbPti
1+Exm+AOSjcSspPPfQmpHqupNaDJSjo6xYX3wn3oIb34WvH8INL3liiVedn+LTy4
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC8oD87P1rPqQRn
nNJnK5+lhe3mA4CcT9/xVjaE/eDskNEIyTrDReCSYYMnjmdj19VWELKiqDxsiQtw
tu+nr38jk7xp7RNvJL3maAF+WGCyqNKTJ2GfttmYB7k51m/4m0YGN3bZgOnOx4rT
PVWRfGAQApg6zGzNoKPpqS0CFNC8RHYNgajRdozrZI5A0viouf3tmuD6DwZKNL8K
D+9v6Tja0KCE6bQqzboIMGX3YPCXmah0SR/N7CuMLZY2V62Jm6mxfqmudEMFwZge
X5L/4P+IcJK7zciTGiiuwiKAaVJqH+dV962wocFNcVedLEvzpP0wDVHllxehW/Vx
Zk2KIwxrAgMBAAECggEAUdiitz2dVN/85kyYy2WVZ0g+2wCIDMtn25tSGtDiiSOp
YEuYsOSgNkQTmdVjrWIY0rh6GrQvS9UHXsgyIyu2WiSfq8LQHPjvYYudokoM41j3
zhxXcurvbdVkHOGcQl51uvrUGjqiuTPCXDiP6YnzUN8fWNwdFfhvR1M+EVog3J+F
RpSavm+SCOkyqCBWgQDb/p59kvlISJuDXKr3tV5HaKVKYfDBQLvuiZBweDwXjxop
z2Srs2GEmJPuKXU32deqNg7KgPvd6ADxb+GXhrGVBaj7dxi77E8nHL/aGutVE4ON
VqMwdWoRPkEPU33rF+CCxHqHJFcNS+62ozzeUYGlaQKBgQDR2mPnjthIgMkX+cw5
ROSadd5gZtQFXAzjAv685k+Xqm2IGk2Z2d5VydHO7cKwVLTB6cEJ+CbLZ1kIS6yV
GxBHaZ+LQxGkt4QD9IBSnL9Cxe7uvo+bpvV3eXbANG0tNl482RctS/u+g+OGSu05
6KIIlYag5hcMjr7ozuhv8LVytwKBgQDmGuIKFHXXqeRJNW+QvJfwQFKNQViqASlY
W4Y5guS6s85inJ3bRKwYtZsczne2uwYqQHlPw8X4TQMXApM+04mJtqwrYDpcX6Ad
VYPmo+J/k917QwlN8VP4AzlDdz8PU+zenmWgpKaG8GMtYia9qCIbWY/+hwwBk0sG
FNpguWnv7QKBgFSGT2ksSwdhAB5tGgoTKrTgNvLDWDDUc8hYI3y4k2R2W+nPFmSa
sYgCY0Si1aEqbSgR3BQE5LNW7DCAMoJYRUVOUNnJ6Ohclor1R15/DjZ5/RQioztB
k2tM/DzMoRDt7iU6F7DCAyMoglNMCKMjhWhJudFC/BOtx02EUXENFjifAoGAD966
yEcw+XbWL9Zno2vebsuA5g0juFXsLBPj5gOJEvdjvJlgqcbKt8mOsSXsS8YKXs+j
jkTKWp21INkknqioS781kKhKXiSaPmuvdTDIZlQkamPtOFr0l55hTK3kw4HeTFxQ
VgwFEDl0HaUvVtVJxOkgbUWTJmiqO/kkNpeTHuECgYEAtD4dRK3w65d9BWHqgeOV
IVSDeYjA6gNuC3tuGzk9bA70U0X/T8+EQMuKNvRZC61/JzAlzEH1oGIw8md8Ki86
aRT96Gce7Q0FA3SaQ+h+w+kgsJG/aly3IThaJh/mx6HN7Xry6BFO1vlYlgdlm/1G
iKX/ppCt7bJYqfrptWs42u4=
-----END PRIVATE KEY-----
......@@ -2,11 +2,11 @@ const { join } = require('path');
const { writeFileSync, mkdirSync, existsSync } = require('fs');
const rimraf = require('rimraf');
const serveStatic = require('serve-static');
const { resolve } = require('path');
const { portfinder, chalk, delay } = require('@umijs/utils');
const argv = require('./argv');
const setup = require('./middlewares/frontendMiddleware');
const pkg = require('../package.json');
const { resolve } = require('path');
const { portfinder, chalk, delay } = require('@umijs/utils');
const config = require('../config/config');
const mockMiddewares = require('./mock');
const emitter = require('./event');
......@@ -30,9 +30,9 @@ const { getSchema } = require('./openapi');
const isHTTPS = process.env.HTTPS || (argv && argv.https);
await delay(500);
const absNodeModulesPath = process.cwd() + '/node_modules';
const absNodeModulesPath = `${process.cwd()}/node_modules`;
const openAPIFilesPath = join(absNodeModulesPath, 'civ_open_api');
const loadEnv = () => {
const basePath = join(process.cwd(), '.env');
const localPath = `${basePath}.local`;
......@@ -41,7 +41,7 @@ const { getSchema } = require('./openapi');
};
loadEnv();
// const absNodeModulesPath = cwd + '/node_modules';
try {
if (existsSync(openAPIFilesPath)) {
......@@ -58,7 +58,7 @@ const { getSchema } = require('./openapi');
headers: {
'access-control-allow-origin': '*',
},
port: port,
port,
beforeMiddlewares: [
(config.mock || process.env.MOCK !== 'none') && mockMiddewares,
],
......@@ -67,6 +67,7 @@ const { getSchema } = require('./openapi');
...(config.devServer || {}),
});
setup(
server.app,
{
......@@ -76,14 +77,14 @@ const { getSchema } = require('./openapi');
config,
{
port,
homename
}
homename,
},
);
emitter.on('onDevCompileDone', async () => {
try {
const openAPIConfig = config.openAPI;
if(openAPIConfig && openAPIConfig.schemaPath) {
if (openAPIConfig && openAPIConfig.schemaPath) {
const openAPIJson = await getSchema(openAPIConfig.schemaPath);
writeFileSync(
join(openAPIFilesPath, 'civ-plugins_openapi.json'),
......
......@@ -6,46 +6,64 @@ const DevCompileDonePlugin = require('../../internals/webpack/plugins/DevCompile
const emitter = require('../event');
function getIgnoredWatchRegExp() {
// const absOutputPath = winPath(path.join(process.cwd(), outputPath));
return process.env.WATCH_IGNORED === 'none' ? undefined: new RegExp(process.env.WATCH_IGNORED || `(node_modules)`)
return process.env.WATCH_IGNORED === 'none'
? undefined
: new RegExp(process.env.WATCH_IGNORED || `(node_modules)`);
}
function createWebpackMiddleware(compiler, output, config) {
return webpackDevMiddleware(compiler, {
logLevel: 'warn',
// logLevel: 'warn',
publicPath: output.publicPath,
silent: true,
// silent: true,
stats: 'errors-only',
writeToDisk: config && config.devServer && config.devServer.writeToDisk,
watchOptions: {
ignored: getIgnoredWatchRegExp()
}
// watchOptions: {
// ignored: getIgnoredWatchRegExp()
// }
});
}
module.exports = function addDevMiddlewares(app, webpackConfig, config, { port= 8080, hostname = '127.0.0.1' }) {
webpackConfig.plugins.push(
new DevCompileDonePlugin({
port: (webpackConfig.devServer && webpackConfig.devServer.port) ? (webpackConfig.devServer.port || port): port,
hostname: (webpackConfig.devServer && webpackConfig.devServer.hostname ) ? (webpackConfig.devServer.hostname || '127.0.0.1'): hostname,
onCompileDone({ isFirstCompile, stats }) {
emitter.emit('onDevCompileDone', { isFirstCompile, stats });
},
onCompileFail(error) {
console.log(error);
},
}),
)
module.exports = function addDevMiddlewares(
app,
webpackConfig,
config,
{ port = 8080, hostname = '127.0.0.1' },
) {
if (!config.mfsu) {
webpackConfig.plugins.push(
new DevCompileDonePlugin({
port:
webpackConfig.devServer && webpackConfig.devServer.port
? webpackConfig.devServer.port || port
: port,
hostname:
webpackConfig.devServer && webpackConfig.devServer.hostname
? webpackConfig.devServer.hostname || '127.0.0.1'
: hostname,
onCompileDone({ isFirstCompile, stats }) {
if (isFirstCompile) {
emitter.emit('onDevCompileDone', { isFirstCompile, stats });
}
},
onCompileFail(error) {
console.log(error);
},
}),
);
}
const compiler = webpack(webpackConfig);
const middleware = createWebpackMiddleware(
compiler,
webpackConfig.output,
config,
);
// console.log(middleware.compiler.watching)
app.use(middleware);
app.use(webpackHotMiddleware(compiler));
const fs = middleware.fileSystem;
const fs = middleware.context.outputFileSystem;
app.get('*', (req, res) => {
fs.readFile(path.join(compiler.outputPath, 'index.html'), (err, file) => {
......
const {
lodash,
portfinder,
} = require('@umijs/utils');
const { lodash, portfinder, createDebug } = require('@umijs/utils');
const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware');
const spdy = require('spdy');
const compress = require('compression');
const url = require('url');
const url = require('url');
const http = require('http');
// const https = require('https');
const sockjs = require('sockjs');
const debug = createDebug('umi:server:Server');
const getCredentials = (options) => {};
const defaultOpts = {
afterMiddlewares: [],
beforeMiddlewares: [],
compilerMiddleware: null,
compress: true,
https: !!process.env.HTTP2 ? true : !!process.env.HTTPS,
https: process.env.HTTP2 ? true : !!process.env.HTTPS,
onListening: argv => argv,
onConnection: () => {},
onConnectionClose: () => {},
......@@ -44,20 +43,18 @@ class Server {
if (this.opts.https) {
const credential = getCredentials(this.opts);
if (typeof this.opts.https === 'object' && this.opts.https.spdy) {
logger.warn(
console.warn(
'Providing custom spdy server options is deprecated and will be removed in the next major version.',
);
return credential;
} else {
return {
spdy: {
protocols: ['h2', 'http/1.1'],
},
...credential,
};
}
return {
spdy: {
protocols: ['h2', 'http/1.1'],
},
...credential,
};
}
return;
}
setupFeatures() {
......@@ -116,6 +113,7 @@ class Server {
deleteRoutes() {
let startIndex = null;
let endIndex = null;
// eslint-disable-next-line no-underscore-dangle
this.app._router.stack.forEach((item, index) => {
if (item.name === 'PROXY_START') startIndex = index;
if (item.name === 'PROXY_END') endIndex = index;
......@@ -126,6 +124,7 @@ class Server {
.join(', ')}`,
);
if (startIndex !== null && endIndex !== null) {
// eslint-disable-next-line no-underscore-dangle
this.app._router.stack.splice(startIndex, endIndex - startIndex + 1);
}
debug(
......@@ -135,7 +134,7 @@ class Server {
);
}
setupProxy(proxyOpts, isWatch = false) {
setupProxy(proxyOpts, isWatch = true) {
let proxy = proxyOpts || this.opts.proxy;
if (!Array.isArray(proxy)) {
if (proxy && 'target' in proxy) {
......@@ -153,7 +152,7 @@ class Server {
};
} else {
proxyOptions = {
...(proxy && proxy[context] || {}),
...((proxy && proxy[context]) || {}),
context: correctedContext,
};
}
......@@ -177,11 +176,11 @@ class Server {
: proxyConfig.target;
const realUrl = new URL(req.url || '', target).href || '';
proxyRes.headers['x-real-url'] = realUrl;
proxyConfig.onProxyRes && proxyConfig.onProxyRes(proxyRes, req, res);
proxyConfig.onProxyRes &&
proxyConfig.onProxyRes(proxyRes, req, res);
},
});
}
return;
};
let startIndex = null;
......@@ -328,4 +327,4 @@ class Server {
}
}
module.exports = Server
\ No newline at end of file
module.exports = Server;
import { Modal, notification } from 'antd';
import { instanceRequest, service } from '@wisdom-utils/utils';
import { event } from 'microser-data';
import { actionCreators } from '../containers/App/store';
import AppService from './service/base';
import notificationService from './service/notification';
const { warning } = Modal;
// eslint-disable-next-line no-return-await
instanceRequest.reportCodeError = true;
instanceRequest.transformRequestURL = function(url) {
// url = url.replace(/\/GateWay/, '')
const excludeURL = ['/PandaCore/GCK/Basis/GateWayConfig', '/CityInterface/rest/services.svc/GetConfig'];
if(excludeURL.includes(url)) {
return url;
}
if (window.globalConfig && window.globalConfig.hasGateWay && /^\/(cityinterface|CityInterface|Cityinterface|CityServer|PandaInformatization)/.test(url)) {
return /\/CityInterface\/rest\/services.svc\/GetConfig/.test(url) ? url ? /^\/GateWay/.test(url) ? url : '/GateWay' + url: '/GateWay' + url: '/GateWay' + url;
}
return url;
}
const codeMessage = {
200: '服务器成功返回请求的数据。',
201: '新建或修改数据成功。',
......@@ -40,10 +52,8 @@ instanceRequest.setErrorHandler(error => {
content: `${codeMessage[status]}`,
centered: true,
onOk(close) {
window.share &&
window.share.event &&
window.share.event.emit('triggerLoginout');
close();
event.emit('event:logout');
close();
},
});
}
......@@ -62,7 +72,6 @@ instanceRequest.setErrorHandler(error => {
}
return response;
});
const appService = service(AppService);
const noticeService = service(notificationService);
export { appService, noticeService };
import { jsonp, request } from '@wisdom-utils/utils';
import * as constants from '../../constants';
/**
* 兼容老接口
*/
const transformGateWay = (url) => {
if(!/^(cityinterface|CityInterface|CityServer)/) {
return url.replace(/GeteWay/, '')
}
}
export const API = {
AUTHORIZATION_TOKEN: '/Publish/Identity/AuthorizationToken',
GET_GATEWAY_CONFIG: '/PandaOMS/OMS/GateWayConfig',
AUTHORIZATION_TOKEN: '/Identity/AuthorizationToken',
GET_GATEWAY_CONFIG: '/PandaCore/GCK/Basis/GateWayConfig',
GET_CONFIG: '/CityInterface/rest/services.svc/GetConfig',
GENERATE_TOKEN: '/cityinterface/rest/services.svc/generatetoken',
GENERATE_GATEWAT_TOKEN: '/GCK/Basis/GenerateToken',
GENERATE_IOT_TOKEN: 'cityinterface/rest/services.svc/generateGCKToken',
GENERATE_QRCODE: 'cityinterface/rest/services.svc/generatetokenByqrcode',
GENERATE_TOKEN_CHANGE: '/cityinterface/rest/services.svc/generatetokenquick',
GET_WEB_SITE_CONFIG: '/CityInterface/rest/services.svc/GetWebSiteConfig',
GET_WEB_SITE_CONFIG_GEWAY: '/Publish/OMS/PlatformCenter/GetWebSiteConfig',
GET_WEB_SITE_CONFIG_GEWAY: '/GCK/Basis/GetWebSiteConfig',
GET_USER_INFO: '/CityInterface/rest/services.svc/getUserInfo',
GET_GATEWAY_USER_INFO: '/GCK/Basis/GetUserInfo',
GET_OA: '/CityInterface/rest/services/OA.svc/getLoginInfo',
GET_LOGS: '/CityInterface/rest/services/portal.svc/OMMonitor/SaveLoginInfo',
GET_CITY:
process.env.NODE_ENV !== 'production'
? '/cityjson?ie=utf-8'
: 'https://pv.sohu.com',
GET_ALL_GROUPS_INFO_FORUSER:
'CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser',
GET_ALL_GROUPS_INFO_FORUSER: '/CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser',
GET_WEATHER: '/CityInterface/rest/services/CountyProduct.svc/GetWeather',
SEND_MESSAGE_CODE:
'CityInterface/rest/services/portal.svc/SendMessVerificationCode',
......@@ -79,7 +87,9 @@ const services = {
},
getUserInfo: {
url: API.GET_USER_INFO,
url: () => {
return window.globalConfig && window.globalConfig.hasGateWay? API.GET_GATEWAY_USER_INFO: API.GET_USER_INFO
},
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
......@@ -208,6 +218,31 @@ export const searchAutoCity = keywords => {
return jsonp(url, params, options);
};
export const getUserInfo = (params) => {
const url = window.globalConfig && window.globalConfig.hasGateWay? API.GET_GATEWAY_USER_INFO: API.GET_USER_INFO
return request({
url: url,
method: constants.REQUEST_METHOD_GET,
params: params,
// params: param.query,
});
}
export const getWebSiteConfig = (params) => {
const url = window.globalConfig &&
window.globalConfig &&
window.globalConfig.hasGateWay
? API.GET_WEB_SITE_CONFIG_GEWAY
: API.GET_WEB_SITE_CONFIG;
return request({
url: url,
method: constants.REQUEST_METHOD_GET,
params: params,
// params: param.query,
});
}
// 更新常用页
export const savePagePartInfo = param =>
request({
......@@ -217,4 +252,5 @@ export const savePagePartInfo = param =>
params: param.query,
});
export default services;
import * as constants from '../../constants';
import { request } from '@wisdom-utils/utils';
const API = {
GET_INFORMATION:
'/CityInterface/rest/services/CountyProduct.svc/SCADAOper/GetInformationInfo',
......@@ -34,4 +34,12 @@ const notificationService = {
},
};
export const postInformationStatus = param =>
request({
url: API.POST_INFORMATION_STATUS,
method: constants.REQUEST_METHOD_POST,
data: param.data,
params: param.query,
});
export default notificationService;
import 'whatwg-fetch';
import './public-path'
import '!file-loader?name=[name].[ext]!./images/favicon.ico';
import './global.less';
// import '@babel/polyfill';
import 'animate.css/animate.css';
import 'antd/dist/antd.less';
import 'file-loader?name=.htaccess!./.htaccess'; // eslint-disable-line import/extensions
import 'kit_utils/lib/format';
import 'sanitize.css/sanitize.css';
// import './locales/zh-CN';
// import './loader';
// import './vm';
import React from 'react';
import ReactDOM from 'react-dom';
import { Button, ConfigProvider, message, notification } from 'antd';
import { ConnectedRouter } from 'connected-react-router/immutable';
import Immutable from 'immutable';
import { params, Storeage } from 'kit_utils';
import { Provider } from 'react-redux';
import { event } from 'microser-data';
import _ from 'lodash';
import { ConfigProvider} from 'antd';
import { Storeage } from 'kit_utils';
import { history } from '@wisdom-utils/runtime';
import ErrorBoundary from './components/ErrorBoundary';
import { useIntl } from '@/locales/localeExports';
// import { ErrorBoundary } from '@ant-design/pro-utils';
import defaultSettings from '../config/defaultSetting';
// import themePluginConfig from '../config/themePluginConfig';
import { appService } from './api';
import { updateTheme } from './common/helpers/settingColor';
import Container from './components/Container';
import configureStore from './configureStore';
import App from './containers/App';
import { actionCreators } from './containers/App/store';
import { LocaleContainer } from './locales/locale';
import { initMicroApps } from './micro';
import Login from './pages/user/login/login';
import { getToken, isString } from './utils/utils';
import { initGlobalConfig } from './initConfig'
import './utils/event';
import Cookies from 'js-cookie';
const isHttps = document.location.protocol === 'https:';
const { pwa } = defaultSettings;
// eslint-disable-next-line no-restricted-globals
import store from './stores'
const namespace = `__PANDA_STORE__${location.hostname}`;
window.createStoreage = new Storeage(namespace);
// eslint-disable-next-line no-underscore-dangle
const initialState = Immutable.Map();
const store = configureStore(initialState, history);
const MOUNT_NODE = document.getElementById('root');
ConfigProvider.config({
prefixCls: 'panda-console-base'
});
const render = () => {
// eslint-disable-next-line react-hooks/rules-of-hooks
ReactDOM.render(
<Provider store={store}>
<ConnectedRouter history={history}>
<LocaleContainer>
<ConfigProvider prefixCls="panda-console-base">
<ErrorBoundary>
<Container>
<App />
</Container>
</ErrorBoundary>
</ConfigProvider>
</LocaleContainer>
</ConnectedRouter>
</Provider>,
MOUNT_NODE,
);
};
// updateTheme('#ff9600');
const loader = (appContent, loading) => render({ appContent, loading });
const initLocale = () => {
localStorage.setItem('umi_locale', 'zh-CN');
};
const PRODUCT_NAME = ['civ_water', 'civ_monitor'];
const initGlobalConfig = () => {
// eslint-disable-next-line no-debugger
// eslint-disable-next-line no-undef
let config = createStoreage.get('globalConfig') || {};
store.dispatch(actionCreators.updateComplexConfig({}));
if (!getToken() || config.token == null) {
// eslint-disable-next-line no-undef
createStoreage.remove(namespace);
config = {};
}
if (!params.getParams('client', window.location.search) && config) {
// eslint-disable-next-line no-undef
createStoreage.remove(namespace);
}
// eslint-disable-next-line no-undef
if (!createStoreage.get('globalConfig')) {
window.createStoreage = new Storeage(namespace);
}
if (!getToken()) {
localStorage.removeItem('loginSite');
}
if (config.token !== null && Object.keys(config).length > 0) {
store.dispatch(actionCreators.getConfig(config));
// render({ appContent: '', loading: true });
initMicroApps(loader, store);
if (config.isNewYear) {
updateTheme('#ff9600');
}
} else {
appService.getWateWayConfig().then(res => {
const hasGateWay =
res && res.data && isString(res.data) ? JSON.parse(res.data) : res.data;
if (res.code === 0) {
store.dispatch(
actionCreators.getConfig(
Object.assign({}, window.globalConfig, {
hasGateWay,
apiGatewayDomain: `${window.location.origin}/PandaCore/GateWay`,
}),
),
);
}
});
// eslint-disable-next-line react-hooks/rules-of-hooks
appService
.queryConfig({
client: params.getParams('client') || Cookies.get('city') || 'city',
})
.then(res => {
if (res) {
const data = res;
if (!data.client) {
data.client = 'city';
}
store.dispatch(
actionCreators.getConfig(
Object.assign({}, window.globalConfig, data),
),
);
if (data.loginTemplate === '新春 - 智联.html') {
updateTheme('#ff9600');
}
// eslint-disable-next-line no-new
if (getToken()) {
// eslint-disable-next-line no-new
new Login(
{
global: Object.assign({}, data, {
token: getToken(),
}),
// eslint-disable-next-line no-shadow
updateConfig: data =>
store.dispatch(actionCreators.getConfig(data)),
isInit: false,
logout: () => store.dispatch(actionCreators.logout()),
},
() => {
(async () => {
(await (getToken() &&
window.globalConfig &&
window.globalConfig.token)) && initMicroApps(loader, store);
})();
},
true,
);
}
// eslint-disable-next-line no-shadow
}
return res;
})
// eslint-disable-next-line no-shadow
.then(res => {
// eslint-disable-next-line no-use-before-define
initSensorType();
// eslint-disable-next-line no-use-before-define
initIsMock();
render({ appContent: '', loading: true });
})
.catch(error => {
store.dispatch(actionCreators.getConfigError(error));
});
}
};
const initSensorType = () => {
let filterProduct =
(window.globalConfig && window.globalConfig.products) || [];
filterProduct = filterProduct.filter(item =>
PRODUCT_NAME.includes(item.PackageName),
);
if (filterProduct.length > 0) {
appService.getSensorType().then(res => {
store.dispatch(
actionCreators.getConfig(
Object.assign({}, window.globalConfig, {
sensorType: res.data,
}),
),
);
});
}
};
const initIsMock = () => {
appService
.sysConfiguration({
moduleName: '是否mock数据',
})
.then(res => {
store.dispatch(
actionCreators.getConfig(
Object.assign({}, window.globalConfig, {
isMock: res.data === '是',
}),
),
);
});
};
// const PRODUCT_NAME = ['civ_water', 'civ_monitor'];
initGlobalConfig();
initLocale();
window.share &&
window.share.event &&
window.share.event.on('triggerMicro', () => {
initMicroApps(loader, store);
});
if (pwa) {
// const appPWA = window.i18n.getI18n('app');
window.addEventListener('sw.offline', () => {
message.warning(useIntl().formatMessage({ id: 'app.pwa.offline' }));
});
window.addEventListener('sw.updated', event => {
const e = event;
const reloadSW = async () => {
const worker = e.detail && e.detail.waiting;
if (!worker) {
return true;
}
await new Promise((resolve, reject) => {
const channel = new MessageChannel();
channel.port1.onmessage = msgEvent => {
if (msgEvent.data.error) {
reject(msgEvent.data.error);
} else {
resolve(msgEvent.data);
}
};
worker.postMessage({ type: 'skip-waiting' }, [channel.port2]);
});
window.location.reload(true);
return true;
};
const key = `open${Date.now()}`;
const btn = (
<Button
type="primary"
onClick={() => {
notification.close(key);
reloadSW();
}}
>
{useIntl().formatMessage({ id: 'app.pwa.serviceworker.updated.ok' })}
</Button>
);
notification.open({
message: useIntl().formatMessage({ id: 'pwa.serviceworker.updated' }),
description: useIntl().formatMessage({
id: 'pwa.serviceworker.updated.hint',
}),
btn,
key,
onClose: async () => null,
});
});
} else if ('serviceWorker' in navigator && isHttps) {
const { serviceWorker } = navigator;
if (serviceWorker.getRegistrations) {
serviceWorker.getRegistrations().then(sws => {
sws.forEach(sw => {
sw.unregister();
});
});
const unlisten = history.listen(location => {
if(location.pathname.indexOf('/civbase/user/login') > -1) {
initGlobalConfig();
}
serviceWorker.getRegistration().then(sw => {
if (sw) sw.unregister();
});
});
if (window.caches && window.caches.keys) {
caches.keys().then(keys => {
keys.forEach(key => {
caches.delete(key);
});
});
}
}
event.on('event:logout', () => {
store.dispatch(actionCreators.logout())
});
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
......@@ -12,11 +12,7 @@ export default class Container extends React.Component {
}
oms(event) {
const omsUrl = [
`${window.location.protocol}/`,
MaintenanceHost,
MaintenancePath,
].join('/');
const omsUrl = `${MaintenanceHost}/${MaintenancePath}`;
window.open(omsUrl, '_blank');
}
......
......@@ -11,7 +11,7 @@ import {
Upload,
} from 'antd';
import { withRouter } from 'react-router';
import Cookies from 'js-cookie';
import {
FormattedMessage,
useIntl,
......@@ -21,6 +21,7 @@ import { request } from '@wisdom-utils/utils';
import { appService } from '../../api';
// eslint-disable-next-line import/named
import { API } from '../../api/service/base';
import globalHeader from '../../locales/zh-CN/globalHeader';
import styles from './index.less';
// import i18n from '../../utils/share';
......@@ -70,7 +71,10 @@ class AvatarDropdown extends React.Component {
window.location.href = `${window.location.origin}/#login`;
return false;
}
window.location.reload();
// console.log(this.props)
// this.props.history.push('/login')
// window.location.reload();
//
};
getRoles = () => {
......@@ -108,7 +112,8 @@ class AvatarDropdown extends React.Component {
appService.changePassword(params)
.then(res => {
if (res.success) {
message.success(useIntl().formatMessage({id: 'component.account.password.update.success'}));
//message.success(useIntl().formatMessage({id: 'component.account.password.update.success'}));
message.success(globalHeader['component.account.password.update.success']);
setTimeout(() => {
this.setState({
visible: false,
......@@ -211,13 +216,15 @@ class AvatarDropdown extends React.Component {
})
}
formData.append("filedata", file);
request.post(action, formData, {
request(action, {
withCredentials,
headers: {
...headers,
Accept: '*/*',
'civ-site': ''
},
method: 'post',
data: formData,
ignoreSite: true,
onUploadProgress: ({ total, loaded }) => {
onProgress({ percent: Math.round((loaded / total) * 100).toFixed(2) }, file);
......@@ -270,7 +277,8 @@ class AvatarDropdown extends React.Component {
appService.updateAvatar(params).then(res => {
if(res.success) {
message.success(useIntl().formatMessage({id: 'component.avatar.update.success'}));
// message.success(useIntl().formatMessage({id: 'component.avatar.update.success'}));
message.success(globalHeader['component.avatar.update.success']);
self.setState({
currentUser: {
name: self.state.currentUser.name,
......@@ -300,7 +308,7 @@ class AvatarDropdown extends React.Component {
const menuHeaderDropdown = (
<div className={styles.userInfo}>
<div className={styles.header}>
<Upload className="avatar-uploader" {...uploadProps}>
<Upload className="avatar-uploader" {...uploadProps} maxCount={1} itemRender={()=>(<></>)}>
<div
className={styles.avatar}
style={{ backgroundImage: `url(${currentUser.avatar})` }}
......
......@@ -3,10 +3,10 @@ import { message } from 'antd';
import _, { words } from 'lodash';
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
import { loadMicroApp } from 'qiankun';
import { useIntl } from '@/locales/localeExports';
import Icon from '@ant-design/icons';
import { setDefaultMountApp } from 'qiankun'
import { actionCreators } from '../../containers/App/store';
import HeaderSearch from '../HeaderSearch';
import Avatar from './AvatarDropdown';
......@@ -122,10 +122,13 @@ const GlobalHeaderRight = props => {
const goHome = event => {
event.stopPropagation();
const url = _.isString(props.global.get('homepage'))
let url = _.isString(props.global.get('homepage'))
? props.global.get('homepage')
: props.global.get('homepage.url');
window.share.event.emit('goHome', `/civbase/civweb4/${url}`);
if(!props.global.get('home')) {
url = `civweb4/${url}`
}
window.share.event.emit('goHome', `/${url}`);
url ? (
window.share.event.emit('listenerMointer', {
label: '首页',
......@@ -277,4 +280,4 @@ const mapDispatchToProps = dispatch => ({
export default connect(
mapStateToProps,
mapDispatchToProps,
)(withRouter(GlobalHeaderRight));
)(GlobalHeaderRight);
......@@ -236,4 +236,4 @@ const mapDispatchToProps = dispatch => ({
export default connect(
mapStateToProps,
mapDispatchToProps,
)(withRouter(GlobalHeaderRight));
)(GlobalHeaderRight);
......@@ -105,7 +105,7 @@ const SearchPanel = props => {
}
const goFeature = (path, rect, value) => {
// eslint-disable-next-line no-param-reassign
debugger
value = value || props.value;
const findKeywordIndex =
recentKeywords.length > 0
......
import React from 'react';
import _ from 'lodash';
import classNames from 'classnames';
import { findPathByWidget, isJSON } from '../../../../utils/utils';
import commonStyles from '../common.less';
......@@ -70,7 +70,7 @@ const Alarm = ({ message, confirmRead, config }) => {
<p style={{color: '#888'}} >
{
alarmContent && alarmContent.content.split(",")[1]
alarmContent && _.isString(alarmContent.content) && alarmContent.content.split(",")[1]
}
</p>
<p className={commonStyles.messageTime}>{message.time}</p>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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