Commit 80c1027b authored by 邓晓峰's avatar 邓晓峰

feat: 菜单调整

parent 0ddec45e
Pipeline #52880 waiting for manual action with stages
// eslint-disable-next-line import/no-unresolved
module.exports = async function addAssetRules(opts) {
const { config, userConfig } = opts;
const inlineLimit = parseInt(userConfig.inlineLimit || '10000', 10);
const rule = config.module.rule('asset');
rule
.oneOf('avif')
.test(/\.avif$/)
.type('asset')
.mimetype('image/avif')
.parser({
dataUrlCondition: {
maxSize: inlineLimit,
},
})
.generator({
filename: `${opts.staticPathPrefix}[name].[hash:8].[ext]`,
});
rule
.oneOf('image')
.test(/\.(bmp|gif|jpg|jpeg|png)$/)
.type('asset')
.parser({
dataUrlCondition: {
maxSize: inlineLimit,
},
})
.generator({
filename: `${opts.staticPathPrefix}[name].[hash:8].[ext]`,
});
const fallback = rule
.oneOf('fallback')
.exclude.add(/^$/) /* handle data: resources */
.add(/\.(js|mjs|jsx|ts|tsx)$/)
.add(/\.(css|less|sass|scss|stylus)$/)
.add(/\.html$/)
.add(/\.json$/);
if (userConfig.mdx) {
fallback.add(/\.mdx?$/);
}
fallback
.end()
.type('asset/resource')
.generator({
filename: `${opts.staticPathPrefix}[name].[hash:8].[ext]`,
});
};
const { BundleAnalyzerPlugin } = require('../compiled/webpack-bundle-analyzer');
module.exports = async function addBundleAnalyzerPlugin(opts) {
const { config } = opts;
config.plugin('webpack-bundle-analyzer').use(BundleAnalyzerPlugin, [
{
analyzerMode: 'server',
analyzerPort: process.env.ANALYZE_PORT || 8888,
openAnalyzer: false,
logLevel: 'info',
defaultSizes: 'parsed',
},
]);
};
import CSSMinimizerWebpackPlugin from '../compiled/css-minimizer-webpack-plugin';
import TerserPlugin from '../compiled/terser-webpack-plugin';
import Config from '../compiled/webpack-5-chain';
const ESBuildCSSMinifyPlugin = require('../plugins/ESBuildCSSMinifyPlugin');
// eslint-disable-next-line import/extensions
const ParcelCSSMinifyPlugin = require('../plugins/ParcelCSSMinifyPlugin');
// eslint-disable-next-line import/extensions
const { CSSMinifier, Env, JSMinifier } = require('../types');
const { getEsBuildTarget } = require('../utils/getEsBuildTarget');
async function addCompressPlugin(opts) {
const { config, userConfig, env } = opts;
const jsMinifier = userConfig.jsMinifier || JSMinifier.esbuild;
const cssMinifier = userConfig.cssMinifier || CSSMinifier.esbuild;
if (
env === Env.development ||
process.env.COMPRESS === 'none' ||
(jsMinifier === JSMinifier.none && cssMinifier === CSSMinifier.none)
) {
config.optimization.minimize(false);
return;
}
config.optimization.minimize(true);
let minify: any;
let terserOptions;
if (jsMinifier === JSMinifier.esbuild) {
minify = TerserPlugin.esbuildMinify;
terserOptions = {
target: getEsBuildTarget({
targets: userConfig.targets || {},
}),
};
} else if (jsMinifier === JSMinifier.terser) {
minify = TerserPlugin.terserMinify;
} else if (jsMinifier === JSMinifier.swc) {
minify = TerserPlugin.swcMinify;
} else if (jsMinifier === JSMinifier.uglifyJs) {
minify = TerserPlugin.uglifyJsMinify;
} else if (jsMinifier !== JSMinifier.none) {
throw new Error(`Unsupported jsMinifier ${userConfig.jsMinifier}.`);
}
terserOptions = {
...terserOptions,
...userConfig.jsMinifierOptions,
};
if (jsMinifier !== JSMinifier.none) {
config.optimization.minimizer(`js-${jsMinifier}`).use(TerserPlugin, [
{
minify,
terserOptions,
},
]);
}
if (cssMinifier === CSSMinifier.esbuild) {
config.optimization.minimizer(`css-${cssMinifier}`).use(ESBuildCSSMinifyPlugin, [userConfig.cssMinifierOptions]);
} else if (cssMinifier === CSSMinifier.cssnano) {
config.optimization.minimizer(`css-${cssMinifier}`).use(CSSMinimizerWebpackPlugin, [
{
minimizerOptions: userConfig.cssMinifierOptions,
parallel: true,
},
]);
} else if (cssMinifier === CSSMinifier.parcelCSS) {
config.optimization.minimizer(`css-${cssMinifier}`).use(ParcelCSSMinifyPlugin);
} else if (cssMinifier !== CSSMinifier.none) {
throw new Error(`Unsupported cssMinifier ${userConfig.cssMinifier}.`);
}
}
module.exports = addCompressPlugin;
const { join } = require('path');
const webpack = require('../compiled/webpack');
const { DEFAULT_BROWSER_TARGETS, DEFAULT_DEVTOOL, DEFAULT_OUTPUT_PATH } = require('../constants');
const Config = require('../compiled/webpack-5-chain');
// eslint-disable-next-line import/extensions
const { Env } = require('../types');
// eslint-disable-next-line import/extensions
const { RuntimePublicPathPlugin } = require('../plugins/RuntimePublicPathPlugin');
const { getBrowsersList } = require('../utils/browsersList');
const addAssetRules = require('./assetRules');
const addBundleAnalyzerPlugin = require('./bundleAnalyzerPlugin');
const addCompressPlugin = require('./compressPlugin');
const addCopyPlugin = require('./copyPlugin');
const addCSSRules = require('./cssRules');
const addDefinePlugin = require('./definePlugin');
const addDetectDeadCodePlugin = require('./detectDeadCodePlugin');
const addFastRefreshPlugin = require('./fastRefreshPlugin');
const addForkTSCheckerPlugin = require('./forkTSCheckerPlugin');
const addHarmonyLinkingErrorPlugin = require('./harmonyLinkingErrorPlugin');
const addIgnorePlugin = require('./ignorePlugin');
const addJavaScriptRules = require('./javaScriptRules');
const addManifestPlugin = require('./manifestPlugin');
const addMiniCSSExtractPlugin = require('./miniCSSExtractPlugin');
const addNodePolyfill = require('./nodePolyfill');
const addNodePrefixPlugin = require('./nodePrefixPlugin');
const addProgressPlugin = require('./progressPlugin');
const addSpeedMeasureWebpackPlugin = require('./speedMeasureWebpackPlugin');
const addSVGRules = require('./svgRules');
async function getConfig(opts) {
const { userConfig } = opts;
const isDev = opts.env === Env.development;
const config = new Config();
userConfig.targets ||= DEFAULT_BROWSER_TARGETS;
const useHash = !!(opts.hash || (userConfig.hash && !isDev));
const applyOpts = {
name: opts.name,
config,
userConfig,
cwd: opts.cwd,
env: opts.env,
babelPreset: opts.babelPreset,
extraBabelPlugins: opts.extraBabelPlugins || [],
extraBabelPresets: opts.extraBabelPresets || [],
extraEsbuildLoaderHandler: opts.extraEsbuildLoaderHandler || [],
browsers: getBrowsersList({
targets: userConfig.targets,
}),
useHash,
staticPathPrefix: opts.staticPathPrefix !== undefined ? opts.staticPathPrefix : 'static/',
};
// mode
config.mode(opts.env);
config.stats('none');
// entry
Object.keys(opts.entry).forEach(key => {
const entry = config.entry(key);
if (isDev && opts.hmr) {
entry.add(require.resolve('../../client/client/client'));
}
entry.add(opts.entry[key]);
});
// devtool
config.devtool(
isDev ? (userConfig.devtool === false ? false : userConfig.devtool || DEFAULT_DEVTOOL) : userConfig.devtool,
);
// output
const absOutputPath = join(opts.cwd, userConfig.outputPath || DEFAULT_OUTPUT_PATH);
const disableCompress = process.env.COMPRESS === 'none';
config.output
.path(absOutputPath)
.filename(useHash ? `[name].[contenthash:8].js` : `[name].js`)
.chunkFilename(useHash ? `[name].[contenthash:8].async.js` : `[name].js`)
.publicPath(userConfig.publicPath || 'auto')
.pathinfo(isDev || disableCompress);
// resolve
// prettier-ignore
config.resolve
.set('symlinks', true)
.modules
.add('node_modules')
.end()
.alias
.merge(userConfig.alias || {})
.end()
.extensions
.merge([
'.wasm',
'.mjs',
'.js',
'.jsx',
'.ts',
'.tsx',
'.json'
])
.end();
// externals
config.externals(userConfig.externals || []);
// target
config.target(['web', 'es5']);
// experiments
config.experiments({
topLevelAwait: true,
outputModule: !!userConfig.esm,
});
// node polyfill
await addNodePolyfill(applyOpts);
// rules
await addJavaScriptRules(applyOpts);
await addCSSRules(applyOpts);
await addAssetRules(applyOpts);
await addSVGRules(applyOpts);
// plugins
// mini-css-extract-plugin
await addMiniCSSExtractPlugin(applyOpts);
// ignoreMomentLocale
await addIgnorePlugin(applyOpts);
// define
await addDefinePlugin(applyOpts);
// fast refresh
await addFastRefreshPlugin(applyOpts);
// progress
await addProgressPlugin(applyOpts);
// detect-dead-code-plugin
await addDetectDeadCodePlugin(applyOpts);
// fork-ts-checker
await addForkTSCheckerPlugin(applyOpts);
// copy
await addCopyPlugin(applyOpts);
// manifest
await addManifestPlugin(applyOpts);
// hmr
if (isDev && opts.hmr) {
config.plugin('hmr').use(webpack.HotModuleReplacementPlugin);
}
// compress
await addCompressPlugin(applyOpts);
// purgecss
// await applyPurgeCSSWebpackPlugin(applyOpts);
// handle HarmonyLinkingError
await addHarmonyLinkingErrorPlugin(applyOpts);
// remove node: prefix
await addNodePrefixPlugin(applyOpts);
// runtimePublicPath
if (userConfig.runtimePublicPath) {
config.plugin('runtimePublicPath').use(RuntimePublicPathPlugin);
}
// cache
if (opts.cache) {
config.cache({
type: 'filesystem',
// eslint-disable-next-line global-require
version: require('../../../package.json').version,
buildDependencies: {
config: opts.cache.buildDependencies || [],
},
cacheDirectory: opts.cache.cacheDirectory || join(opts.cwd, 'node_modules', '.cache', 'bundler-webpack'),
});
// tnpm 安装依赖的情况 webpack 默认的 managedPaths 不生效
// 使用 immutablePaths 避免 node_modules 的内容被写入缓存
// tnpm 安装的依赖路径中同时包含包名和版本号,满足 immutablePaths 使用的条件
// ref: smallfish
// eslint-disable-next-line global-require
if (/* isTnpm */ require('@umijs/utils/package').__npminstall_done) {
config.snapshot({
immutablePaths: [opts.cache.absNodeModulesPath || join(opts.cwd, 'node_modules')],
});
}
config.infrastructureLogging({
level: 'error',
...(process.env.WEBPACK_FS_CACHE_DEBUG
? {
debug: /webpack\.cache/,
}
: {}),
});
}
// analyzer
if (opts.analyze) {
await addBundleAnalyzerPlugin(applyOpts);
}
// chain webpack
if (opts.chainWebpack) {
await opts.chainWebpack(config, {
env: opts.env,
webpack,
});
}
if (userConfig.chainWebpack) {
await userConfig.chainWebpack(config, {
env: opts.env,
webpack,
});
}
let webpackConfig = config.toConfig();
// speed measure
// TODO: mini-css-extract-plugin 报错
webpackConfig = await addSpeedMeasureWebpackPlugin({
webpackConfig,
});
if (opts.modifyWebpackConfig) {
webpackConfig = await opts.modifyWebpackConfig(webpackConfig, {
env: opts.env,
webpack,
});
}
return webpackConfig;
}
module.exports = getConfig;
/* eslint-disable */
const { existsSync } = require('fs');
const { join } = require('path');
module.exports = async function addCopyPlugin(opts) {
const { config, userConfig, cwd } = opts;
const copyPatterns = [
existsSync(join(cwd, 'public')) && {
from: join(cwd, 'public'),
},
...(userConfig.copy
? userConfig.copy.map(item => {
if (typeof item === 'string') {
return {
from: join(cwd, item),
to: item,
};
}
return {
from: join(cwd, item.from),
to: item.to,
};
})
: []),
].filter(Boolean);
if (copyPatterns.length) {
// eslint-disable-next-line global-require
config.plugin('copy').use(require('../compiled/copy-webpack-plugin'), [
{
patterns: copyPatterns,
},
]);
}
};
/* eslint-disable */
export async function addCSSRules(opts) {
const { config, userConfig } = opts;
const rulesConfig = [
{ name: 'css', test: /\.css(\?.*)?$/ },
{
name: 'less',
test: /\.less(\?.*)?$/,
loader: require.resolve('@umijs/bundler-webpack/compiled/less-loader'),
loaderOptions: {
implementation: require.resolve('@umijs/bundler-utils/compiled/less'),
lessOptions: {
modifyVars: userConfig.theme,
javascriptEnabled: true,
...userConfig.lessLoader,
},
},
},
{
name: 'sass',
test: /\.(sass|scss)(\?.*)?$/,
loader: require.resolve('@umijs/bundler-webpack/compiled/sass-loader'),
loaderOptions: userConfig.sassLoader || {},
},
];
for (const { name, test, loader, loaderOptions } of rulesConfig) {
const rule = config.module.rule(name);
const nestRulesConfig = [
userConfig.autoCSSModules && {
rule: rule
.test(test)
.oneOf('css-modules')
.resourceQuery(/modules/),
isCSSModules: true,
},
{
rule: rule
.test(test)
.oneOf('css')
.sideEffects(true),
isCSSModules: false,
},
].filter(Boolean);
// @ts-ignore
for (const { rule, isCSSModules } of nestRulesConfig) {
if (userConfig.styleLoader) {
rule
.use('style-loader')
.loader(require.resolve('@umijs/bundler-webpack/compiled/style-loader'))
.options({ base: 0, esModule: true, ...userConfig.styleLoader });
} else {
rule
.use('mini-css-extract-plugin')
.loader(require.resolve('@umijs/bundler-webpack/compiled/mini-css-extract-plugin/loader'))
.options({
publicPath: './',
emit: true,
esModule: true,
});
}
rule
.use('css-loader')
.loader(require.resolve('css-loader'))
.options({
importLoaders: 1,
esModule: true,
url: true,
import: true,
...(isCSSModules
? {
modules: {
localIdentName: '[local]___[hash:base64:5]',
...userConfig.cssLoaderModules,
},
}
: {}),
...userConfig.cssLoader,
});
rule
.use('postcss-loader')
.loader(require.resolve('@umijs/bundler-webpack/compiled/postcss-loader'))
.options({
postcssOptions: {
ident: 'postcss',
plugins: [
require('../compiled/postcss-flexbugs-fixes'),
require('postcss-preset-env')({
browsers: opts.browsers,
autoprefixer: {
flexbox: 'no-2009',
...userConfig.autoprefixer,
},
stage: 3,
}),
].concat(userConfig.extraPostCSSPlugins || []),
...userConfig.postcssLoader,
},
});
if (loader) {
rule
.use(loader)
.loader(typeof loader === 'string' ? require.resolve(loader) : loader)
.options(loaderOptions || {});
}
}
}
}
const { DefinePlugin } = require('@umijs/bundler-webpack/compiled/webpack');
const ENV_SHOULD_PASS = ['NODE_ENV', 'HMR', 'SOCKET_SERVER', 'ERROR_OVERLAY'];
const prefixRE = /^PANDA_APP_/;
function resolveDefine(opts) {
const env = {};
Object.keys(process.env).forEach(key => {
if (prefixRE.test(key) || ENV_SHOULD_PASS.includes(key)) {
env[key] = process.env[key];
}
});
for (const key in env) {
env[key] = JSON.stringify(env[key]);
}
const define = {};
if (opts.define) {
for (const key in opts.define) {
define[key] = JSON.stringify(opts.define[key]);
}
}
return {
'process.env': env,
...define,
};
}
async function addDefinePlugin(opts) {
const { config, userConfig } = opts;
config.plugin('define').use(DefinePlugin, [
resolveDefine({
define: userConfig.define || {},
}),
]);
}
module.exports = {
resolveDefine,
addDefinePlugin,
};
/* eslint-disable */
const { chalk, glob } = require('@umijs/utils');
const path = require('path');
const { Chunk, Compilation, Module, NormalModule } = require('../compiled/webpack');
const disabledFolders = ['node_modules', '.panda', '.panda-production', 'dist'];
const detectDeadCode = (compilation, options) => {
const assets = getWebpackAssets(compilation);
const compiledFilesDictionary = convertFilesToDict(assets);
const includedFiles = getPattern(options)
.map(pattern => glob.sync(pattern))
.flat();
const unusedFiles = options.detectUnusedFiles ? includedFiles.filter(file => !compiledFilesDictionary[file]) : [];
const unusedExportMap = options.detectUnusedExport
? getUnusedExportMap(convertFilesToDict(includedFiles), compilation)
: {};
logUnusedFiles(unusedFiles);
logUnusedExportMap(unusedExportMap);
const hasUnusedThings = unusedFiles.length || Object.keys(unusedExportMap).length;
if (hasUnusedThings && options.failOnHint) {
process.exit(2);
}
};
const getPattern = options =>
options.patterns
.map(pattern => path.resolve(options.context || '', pattern))
.concat(options.exclude.map(pattern => path.resolve(options.context || '', `!${pattern}`)))
.map(convertToUnixPath);
const getUnusedExportMap = (includedFileMap, compilation) => {
const unusedExportMap = {};
compilation.chunks.forEach(chunk => {
compilation.chunkGraph.getChunkModules(chunk).forEach(module => {
outputUnusedExportMap(compilation, chunk, module, includedFileMap, unusedExportMap);
});
});
return unusedExportMap;
};
const outputUnusedExportMap = (compilation, chunk, module, includedFileMap, unusedExportMap) => {
if (!(module instanceof NormalModule) || !module.resource) {
return;
}
const path = convertToUnixPath(module.resource);
if (!/^((?!(node_modules)).)*$/.test(path)) return;
const providedExports = compilation.chunkGraph.moduleGraph.getProvidedExports(module);
const usedExports = compilation.chunkGraph.moduleGraph.getUsedExports(module, chunk.runtime);
if (usedExports !== true && providedExports !== true && includedFileMap[path]) {
if (usedExports === false) {
if (providedExports?.length) {
unusedExportMap[path] = providedExports;
}
} else if (providedExports instanceof Array) {
const unusedExports = providedExports.filter(item => usedExports && !usedExports.has(item));
if (unusedExports.length) {
unusedExportMap[path] = unusedExports;
}
}
}
};
const logUnusedExportMap = unusedExportMap => {
if (!Object.keys(unusedExportMap).length) {
return;
}
let numberOfUnusedExport = 0;
let logStr = '';
Object.keys(unusedExportMap).forEach((filePath, fileIndex) => {
const unusedExports = unusedExportMap[filePath];
logStr += [
`\n${fileIndex + 1}. `,
chalk.yellow(`${filePath}\n`),
' >>> ',
chalk.yellow(`${unusedExports.join(', ')}`),
].join('');
numberOfUnusedExport += unusedExports.length;
});
console.log(
chalk.yellow.bold('\nWarning:'),
chalk.yellow(`There are ${numberOfUnusedExport} unused exports in ${Object.keys(unusedExportMap).length} files:`),
logStr,
chalk.red.bold('\nPlease be careful if you want to remove them (¬º-°)¬.\n'),
);
};
const getWebpackAssets = compilation => {
const outputPath = compilation.getPath(compilation.compiler.outputPath);
const assets = [
...Array.from(compilation.fileDependencies),
...compilation.getAssets().map(asset => path.join(outputPath, asset.name)),
];
return assets;
};
const convertFilesToDict = assets =>
assets
.filter(file => Boolean(file) && disabledFolders.every(disabledPath => !file.includes(disabledPath)))
.reduce((fileDictionary, file) => {
const unixFile = convertToUnixPath(file);
fileDictionary[unixFile] = true;
return fileDictionary;
}, {});
const logUnusedFiles = unusedFiles => {
if (!unusedFiles?.length) {
return;
}
console.log(
chalk.yellow.bold('\nWarning:'),
chalk.yellow(`There are ${unusedFiles.length} unused files:`),
...unusedFiles.map((file, index) => `\n${index + 1}. ${chalk.yellow(file)}`),
chalk.red.bold('\nPlease be careful if you want to remove them (¬º-°)¬.\n'),
);
};
const convertToUnixPath = path => path.replace(/\\+/g, '/');
module.exports = {
detectDeadCode,
disabledFolders
}
const { detectDeadCode, disabledFolders } = require('./detectDeadCode');
// eslint-disable-next-line import/extensions
const { Env } = require('../types');
const defaultOptions = {
patterns: [`!(${disabledFolders.join('|')})/**/*.*`],
exclude: [],
failOnHint: false,
detectUnusedFiles: true,
detectUnusedExport: true,
};
class DetectDeadCodePlugin {
options = defaultOptions;
constructor(options) {
if (!options) {
return;
}
this.options = {
...this.options,
...options,
};
}
apply(compiler) {
if (!this.options.context) {
this.options = {
...this.options,
context: compiler.context,
};
}
compiler.hooks.afterEmit.tapAsync('DetectDeadCodePlugin', this.handleAfterEmit);
}
handleAfterEmit = (compilation, callback) => {
detectDeadCode(compilation, this.options);
callback();
};
}
module.exports = async function addDetectDeadCodePlugin(opts) {
const { config, userConfig } = opts;
const isDev = opts.env === Env.development;
if (userConfig.deadCode && !isDev) {
config.plugin('detect-dead-code-plugin').use(DetectDeadCodePlugin, [userConfig.deadCode]);
}
};
const FastRefreshPlugin = require('@pmmmwh/react-refresh-webpack-plugin/lib');
const { MFSU_NAME } = require('../constants');
const { Env } = require('../types');
module.exports = async function addFastRefreshPlugin(opts) {
const { config, userConfig, name } = opts;
const isDev = opts.env === Env.development;
const useFastRefresh = isDev && userConfig.fastRefresh !== false && name !== MFSU_NAME;
if (useFastRefresh) {
config
.plugin('fastRefresh')
.after('hmr')
.use(FastRefreshPlugin, [{ overlay: false }]);
}
};
const ForkTSCheckerPlugin = require('../compiled/fork-ts-checker-webpack-plugin');
module.exports = async function addForkTSCheckerPlugin(opts) {
const { config, userConfig } = opts;
if (userConfig.forkTSChecker) {
if (userConfig.forkTSChecker.typescript?.enable) {
userConfig.forkTSChecker.typescript.typescriptPath = require.resolve('typescript');
}
config.plugin('fork-ts-checker-plugin').use(ForkTSCheckerPlugin, [userConfig.forkTSChecker]);
}
};
const LINKING_ERROR_TAG = 'was not found in';
// build 时会出现 css modules 的引用警告,但这应该是需要忽略的
const CSS_NO_EXPORTS = /\.(css|sass|scss|styl|less)' \(module has no exports\)/;
class HarmonyLinkingErrorPlugin {
apply(compiler) {
compiler.hooks.afterCompile.tap('HarmonyLinkingErrorPlugin', (compilation) => {
if (!compilation.warnings.length) {
return;
}
const harmonyLinkingErrors = compilation.warnings.filter((w) => {
return (
w.name === 'ModuleDependencyWarning' &&
!w.module.resource.includes('node_modules') &&
w.message.includes(LINKING_ERROR_TAG) &&
!CSS_NO_EXPORTS.test(w.message)
);
});
if (!harmonyLinkingErrors.length) {
return;
}
compilation.errors.push(...harmonyLinkingErrors);
});
}
}
module.exports = async function addHarmonyLinkingErrorPlugin(opts) {
const { config } = opts;
config.plugin('harmony-linking-error-plugin').use(HarmonyLinkingErrorPlugin);
};
const { IgnorePlugin } = require('../compiled/webpack');
async function addIgnorePlugin(opts) {
const { config, userConfig } = opts;
if (userConfig.ignoreMomentLocale) {
config.plugin('ignore-moment-locale').use(IgnorePlugin, [
{
resourceRegExp: /^\.\/locale$/,
contextRegExp: /moment$/,
},
]);
}
}
module.exports = addIgnorePlugin;
const { autoCssModulesHandler, esbuildLoader } = require('@umijs/mfsu');
const { chalk } = require('@umijs/utils');
const { ProvidePlugin } = require('../compiled/webpack');
const { MFSU_NAME } = require('../constants');
const { es5ImcompatibleVersionsToPkg, isMatch } = require('../utils/depMatch');
const { Env, Transpiler } = require('../types');
async function addJavaScriptRules(opts) {
const { config, userConfig, cwd, name } = opts;
const isDev = opts.env === Env.development;
const useFastRefresh = isDev && userConfig.fastRefresh !== false && name !== MFSU_NAME;
const depPkgs = Object.assign({}, es5ImcompatibleVersionsToPkg());
const srcRules = [
config.module
.rule('src')
.test(/\.(js|mjs)$/)
.include.add([
cwd,
// import module out of cwd using APP_ROOT
// issue: https://github.com/umijs/umi/issues/5594
...(process.env.APP_ROOT ? [process.cwd()] : []),
])
.end()
.exclude.add(/node_modules/)
.end(),
config.module.rule('jsx-ts-tsx').test(/\.(jsx|ts|tsx)$/),
config.module
.rule('extra-src')
.test(/\.(js|mjs)$/)
.include.add(path => {
try {
// do src transform for bundler-webpack/client/client/client.js
if (path.includes('client/client/client')) return true;
return isMatch({ path, pkgs: depPkgs });
} catch (e) {
console.error(chalk.red(e));
throw e;
}
})
.end(),
];
if (userConfig.mdx) {
srcRules.push(config.module.rule('markdown').test(/\.mdx?$/));
}
const depRules = [
config.module
.rule('dep')
.test(/\.(js|mjs)$/)
.include.add(/node_modules/)
.end()
.exclude.add(path => {
try {
return isMatch({ path, pkgs: depPkgs });
} catch (e) {
console.error(chalk.red(e));
throw e;
}
})
.end(),
];
// const prefix = existsSync(join(cwd, 'src')) ? join(cwd, 'src') : cwd;
const srcTranspiler = userConfig.srcTranspiler || Transpiler.babel;
srcRules.forEach(rule => {
if (srcTranspiler === Transpiler.babel) {
rule
.use('babel-loader')
.loader(require.resolve('../../compiled/babel-loader'))
.options({
// Tell babel to guess the type, instead assuming all files are modules
// https://github.com/webpack/webpack/issues/4039#issuecomment-419284940
sourceType: 'unambiguous',
babelrc: false,
cacheDirectory: false,
// process.env.BABEL_CACHE !== 'none'
// ? join(cwd, `.umi/.cache/babel-loader`)
// : false,
targets: userConfig.targets,
presets: [
opts.babelPreset || [
require.resolve('@umijs/babel-preset-umi'),
{
presetEnv: {},
presetReact: {},
presetTypeScript: {},
pluginTransformRuntime: {},
pluginLockCoreJS: {},
pluginDynamicImportNode: false,
pluginAutoCSSModules: userConfig.autoCSSModules,
},
],
...opts.extraBabelPresets,
...(userConfig.extraBabelPresets || []).filter(Boolean),
],
plugins: [
useFastRefresh && require.resolve('react-refresh/babel'),
...opts.extraBabelPlugins,
...(userConfig.extraBabelPlugins || []),
].filter(Boolean),
});
} else if (srcTranspiler === Transpiler.swc) {
const AutoCSSModule = require('../swcPlugins/autoCSSModules').default;
rule
.use('swc-loader')
.loader(require.resolve('../loader/swc'))
.options({
plugin: m => new AutoCSSModule().visitProgram(m),
});
} else if (srcTranspiler === Transpiler.esbuild) {
rule
.use('esbuild-loader')
.loader(esbuildLoader)
.options({
target: isDev ? 'esnext' : 'es2015',
handler: [autoCssModulesHandler, ...opts.extraEsbuildLoaderHandler],
});
// esbuild loader can not auto import `React`
config.plugin('react-provide-plugin').use(ProvidePlugin, [
{
React: 'react',
},
]);
} else {
throw new Error(`Unsupported srcTranspiler ${srcTranspiler}.`);
}
});
if (userConfig.mdx) {
config.module
.rule('mdx')
.test(/\.mdx?$/)
.use('mdx-loader')
.loader(userConfig.mdx?.loader)
.options(userConfig.mdx?.loaderOptions);
}
const depTranspiler = userConfig.depTranspiler || Transpiler.none;
depRules.forEach(_rule => {
if (depTranspiler === Transpiler.none) {
// noop
} else {
throw new Error(`Unsupported depTranspiler ${depTranspiler}.`);
}
});
}
module.exports = addJavaScriptRules;
const { WebpackManifestPlugin } = require('../compiled/webpack-manifest-plugin');
module.exports = async function addManifestPlugin(opts) {
const { config, userConfig } = opts;
if (userConfig.manifest) {
config.plugin('manifest-plugin').use(WebpackManifestPlugin, [
{
fileName: 'asset-manifest.json',
...userConfig.manifest,
},
]);
}
};
const MiniCSSExtractPlugin = require('../compiled/mini-css-extract-plugin');
module.exports = async function addMiniCSSExtractPlugin(opts) {
const { config, userConfig, useHash } = opts;
const hash = useHash ? '.[contenthash:8]' : '';
if (!userConfig.styleLoader) {
config.plugin('mini-css-extract-plugin').use(MiniCSSExtractPlugin, [
{
filename: `[name]${hash}.css`,
chunkFilename: `[name]${hash}.chunk.css`,
ignoreOrder: true,
},
]);
}
}
const { ProvidePlugin } = require('../compiled/webpack');
module.exports = async function addNodePolyfill(opts) {
const { config } = opts;
config.plugin('node-polyfill-provider').use(ProvidePlugin, [
{
Buffer: ['buffer', 'Buffer'],
},
]);
// eslint-disable-next-line global-require
const nodeLibs = require('node-libs-browser');
config.resolve.fallback.merge({
...Object.keys(nodeLibs).reduce((memo, key) => {
if (nodeLibs[key]) {
memo[key] = nodeLibs[key];
} else {
memo[key] = false;
}
return memo;
}, {}),
http: false,
https: false,
});
};
const { NormalModuleReplacementPlugin } = require('../compiled/webpack');
module.exports = async function addNodePrefixPlugin(opts) {
const { config } = opts;
config.plugin('node-prefix-plugin').use(NormalModuleReplacementPlugin, [
/^node:/,
resource => {
resource.request = resource.request.replace(/^node:/, '');
},
]);
};
const ProgressPlugin = require('../plugins/ProgressPlugin');
module.exports = async function addProgressPlugin(opts) {
const { config, name } = opts;
config.plugin('progress-plugin').use(ProgressPlugin, [
{
name,
},
]);
};
const { Env } = require('../types');
module.exports = async function applyPurgeCSSWebpackPlugin(opts) {
const { config, userConfig, cwd, env } = opts;
config;
userConfig;
cwd;
env;
if (userConfig.purgeCSS && env === Env.production) {
// eslint-disable-next-line global-require
config.plugin('purgecss-webpack-plugin').use(require('../compiled/purgecss-webpack-plugin'), [
{
paths: [],
},
]);
}
};
const { join } = require('path');
const SpeedMeasurePlugin = require('../compiled/speed-measure-webpack-plugin');
export async function addSpeedMeasureWebpackPlugin(opts) {
let { webpackConfig } = opts;
if (process.env.SPEED_MEASURE) {
const smpOption =
process.env.SPEED_MEASURE === 'JSON'
? {
outputFormat: 'json',
outputTarget: join(process.cwd(), 'SPEED_MEASURE.json'),
}
: { outputFormat: 'human', outputTarget: console.log };
webpackConfig = new SpeedMeasurePlugin(smpOption).wrap(webpackConfig);
}
return webpackConfig;
}
module.exports = async function addSVGRules(opts) {
const { config, userConfig } = opts;
const { svgr, svgo = {} } = userConfig;
if (svgr) {
const svgrRule = config.module.rule('svgr');
svgrRule
.test(/\.svg$/)
.issuer(/\.[jt]sx?$/)
.type('javascript/auto')
.use('svgr-loader')
.loader(require.resolve('../loader/svgr'))
.options({
svgoConfig: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeTitle: false,
},
},
},
],
...svgo,
},
...svgr,
svgo: !!svgo,
})
.end()
.use('url-loader')
.loader(require.resolve('@umijs/bundler-webpack/compiled/url-loader'))
.end();
}
if (svgo === false) {
const svgRule = config.module.rule('svg');
svgRule
.test(/\.svg$/)
.use('url-loader')
.loader(require.resolve('@umijs/bundler-webpack/compiled/url-loader'));
return;
}
const svgRule = config.module.rule('svg');
svgRule
.test(/\.svg$/)
.use('svgo-loader')
.loader(require.resolve('@umijs/bundler-webpack/compiled/svgo-loader'))
.options({ configFile: false, ...svgo })
.end();
}
\ No newline at end of file
const DEFAULT_DEVTOOL = 'cheap-module-source-map';
const DEFAULT_OUTPUT_PATH = 'dist';
const MFSU_NAME = 'MFSU';
const MESSAGE_TYPE = {
ok:'ok',
warnings:'warnings',
errors:'errors',
hash:'hash',
stillOk: 'still-ok',
invalid:'invalid',
}
const DEFAULT_BROWSER_TARGETS = {
chrome: 80,
};
const DEFAULT_ESBUILD_TARGET_KEYS = [
'chrome',
'firefox',
'edge',
'safari',
];
module.exports = {
DEFAULT_BROWSER_TARGETS,
DEFAULT_ESBUILD_TARGET_KEYS,
DEFAULT_DEVTOOL,
DEFAULT_OUTPUT_PATH,
MESSAGE_TYPE,
MFSU_NAME
}
\ No newline at end of file
"use strict";
// Important modules this config uses
var path = require('path');
var webpack = require('webpack');
var TerserPlugin = require('terser-webpack-plugin');
var CompressionPlugin = require('compression-webpack-plugin');
module.exports = require('./webpack.base.babel')({
mode: 'production',
// 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',
// },
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: 1000 * 1024,
// 控制包的最大字节数
minSize: 10 * 1024,
// 控制包的最小字节数
cacheGroups: {
vendor: {
chunks: 'all',
minSize: 0,
maxInitialRequests: 10,
test: /[\\/]node_modules[\\/]/,
name: function name(module) {
var packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
return "npm.".concat(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
}) // new webpack.ids.HashedModuleIdsPlugin({
// hashFunction: 'sha256',
// hashDigest: 'hex',
// hashDigestLength: 20,
// }),
],
performance: {
assetFilter: function assetFilter(assetFilename) {
return !/(\.map$)|(^(main\.|favicon\.))/.test(assetFilename);
}
}
});
\ No newline at end of file
......@@ -15,13 +15,13 @@
"scripts": {
"init": "yarn install --registry=https://g.civnet.cn:4873",
"analyze:clean": "rimraf stats.json",
"preanalyze": "npm run analyze:clean",
"preanalyze": "yarn run analyze:clean",
"analyze": "cross-env ANALYZE=1 npm run build",
"npmcheckversion": "node ./internals/scripts/npmcheckversion.js",
"preinstall": "npm run npmcheckversion && npx only-allow yarn",
"preinstall": "yarn run npmcheckversion && npx only-allow yarn",
"build": "cross-env NODE_ENV=production node --max_old_space_size=4096 internals/webpack/build.js",
"build:clean": "rimraf ./build",
"openapi": "cross-env NODE_ENV=development node server/openapi/run.js",
"openapi": "cross-env NODE_ENV=development yarn server/openapi/run.js",
"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:production": "npm run test && npm run build && npm run start:prod",
......@@ -33,9 +33,9 @@
"presetup": "npm i chalk shelljs",
"setup": "node ./internals/scripts/setup.js",
"clean": "shjs ./internals/scripts/clean.js",
"clean:all": "npm run analyze:clean && npm run test:clean && npm run build:clean",
"clean:all": "yarn run analyze:clean && npm run test:clean && npm run build:clean",
"generate": "plop --plopfile internals/generators/index.js",
"lint": "npm run lint:js && npm run lint:prettier",
"lint": "yarn run lint:js && yarn run lint:prettier",
"lint:style": "stylelint --fix \"src/**/*.less\" --syntax less",
"lint:eslint": "eslint --ignore-path .gitignore --ignore-pattern internals/scripts",
"lint:eslint:fix": "eslint --ignore-path .gitignore --ignore-pattern internals/scripts --fix",
......@@ -43,7 +43,7 @@
"lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ",
"lint:prettier": "prettier -c ./src/**/*.js",
"lint:staged": "lint-staged",
"pretest": "npm run test:clean && npm run lint",
"pretest": "yarn run test:clean && npm run lint",
"prettier": "prettier --write ./src/**/*.js",
"test:clean": "rimraf ./coverage",
"test": "cross-env NODE_ENV=test jest --coverage",
......@@ -111,9 +111,9 @@
"@wisdom-map/arcgismap": "^1.1.0",
"@wisdom-map/basemap": "^1.0.12-50",
"@wisdom-map/util": "^1.0.27-0",
"@wisdom-utils/components": "0.1.214",
"@wisdom-utils/components": "0.1.216",
"@wisdom-utils/runtime": "0.0.32",
"@wisdom-utils/utils": "0.1.254",
"@wisdom-utils/utils": "0.1.256",
"animate.css": "^4.1.1",
"antd": "^4.20.7",
"compression": "1.7.4",
......
......@@ -21,87 +21,6 @@
window.share.event.setMaxListeners(50000);
window.umi_plugin_ant_themeVar = [
{ key: 'dark', fileName: 'dark.css', theme: 'dark' },
{
key: 'dust',
fileName: 'dust.css',
modifyVars: { '@primary-color': '#F5222D' },
},
{
key: 'volcano',
fileName: 'volcano.css',
modifyVars: { '@primary-color': '#FA541C' },
},
{
key: 'sunset',
fileName: 'sunset.css',
modifyVars: { '@primary-color': '#FAAD14' },
},
{
key: 'cyan',
fileName: 'cyan.css',
modifyVars: { '@primary-color': '#13C2C2' },
},
{
key: 'green',
fileName: 'green.css',
modifyVars: { '@primary-color': '#52C41A' },
},
{
key: 'geekblue',
fileName: 'geekblue.css',
modifyVars: { '@primary-color': '#2F54EB' },
},
{
key: 'purple',
fileName: 'purple.css',
modifyVars: { '@primary-color': '#722ED1' },
},
{
key: 'dust',
theme: 'dark',
fileName: 'dark-dust.css',
modifyVars: { '@primary-color': '#F5222D' },
},
{
key: 'volcano',
theme: 'dark',
fileName: 'dark-volcano.css',
modifyVars: { '@primary-color': '#FA541C' },
},
{
key: 'sunset',
theme: 'dark',
fileName: 'dark-sunset.css',
modifyVars: { '@primary-color': '#FAAD14' },
},
{
key: 'cyan',
theme: 'dark',
fileName: 'dark-cyan.css',
modifyVars: { '@primary-color': '#13C2C2' },
},
{
key: 'green',
theme: 'dark',
fileName: 'dark-green.css',
modifyVars: { '@primary-color': '#52C41A' },
},
{
key: 'geekblue',
theme: 'dark',
fileName: 'dark-geekblue.css',
modifyVars: { '@primary-color': '#2F54EB' },
},
{
key: 'purple',
theme: 'dark',
fileName: 'dark-purple.css',
modifyVars: { '@primary-color': '#722ED1' },
},
];
</script>
</head>
......
This diff is collapsed.
.login {
width: 100%;
height: 100%;
}
.loginCenter {
width: 100%;
height: 100%;
overflow: hidden;
background: url('assets/images/login/江水置换/bg.png');
background-size: 100% 100%;
background-repeat: no-repeat;
position: relative;
}
.loginCenter p {
margin: 0;
}
.loginCtop {
width: 100%;
height: 74px;
padding: 20px 30px;
}
.loginCTleft {
float: left;
}
.loginCTleft img {
width: 40px;
float: left;
}
.loginCTleft p {
float: left;
font-size: 24px;
font-family: PingFang SC;
font-weight: bold;
color: #0F293F;
margin: 0 14px;
letter-spacing: 2px;
}
.loginCTright {
float: right;
}
.loginCTright .time {
float: left;
font-size: 30px;
font-family: Microsoft YaHei UI;
font-weight: 400;
color: #0F293F;
margin-right: 20px;
}
.loginCTright .dateBox {
float: left;
font-size: 14px;
font-family: Microsoft YaHei UI;
font-weight: 300;
color: #0F293F;
}
.loginCcenter {
width: 1100px;
height: 650px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.loginCCtitleImg {
width: 682px;
height: 50px;
margin: auto;
}
.loginCCbottomBox {
width: 100%;
}
.loginCCbigImg {
width: 687px;
height: 600px;
float: left;
}
.loginCCright {
float: left;
width: 413px;
height: 600px;
background: white;
padding: 0 40px;
}
.loginForm > div {
width: 100%;
text-align: left;
}
.loginForm .formgroup {
margin-bottom: 30px;
position: relative;
line-height: 1;
}
.loginForm .formgroup:nth-child(2) {
margin-bottom: 16px;
}
.loginForm .formgroup:nth-child(3) {
margin-bottom: 52px;
height: 30px;
}
.loginForm .formgroup input[type="checkbox"] {
width: 13px;
height: 13px;
margin-left: 12px;
}
.loginForm .formgroup input {
box-shadow: none;
font-size: 18px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #2D3033;
padding: 0 40px;
}
.loginForm .formgroup span {
position: relative;
top: -2px;
margin-left: 10px;
font-size: 14px;
float: right;
font-weight: 400;
color: #9FA8B3;
}
.loginForm .formgroup img {
position: absolute;
bottom: 10px;
height: 24px;
left: 6px;
}
.loginForm .rmpwdInput span {
font-size: 12px;
color: #fff;
visibility: hidden;
position: absolute;
top: 3px;
left: -7px;
}
.loginForm .rmpwdInput.active {
background-color: #2ea0f2;
}
.loginForm .rmpwdInput.active span {
visibility: visible;
color: #fff;
}
.loginForm .rmpwdInput {
width: 20px;
height: 20px;
border-radius: 10px;
border: 1px solid #2ea0f2;
position: relative;
float: right;
}
.loginCCRtitleImg {
width: 100px;
margin: 80px 0 60px;
}
.loginForm .formgroup .loginCCpwdImg {
left: auto;
}
.eyesopen {
display: none;
}
.loginCCsubmit {
width: 205px;
border-radius: 25px;
outline: none;
}
.loginCcode {
width: 34px;
height: 34px;
position: absolute;
right: -33px;
background: rgba(255, 255, 255, 0.7);
padding: 6px;
border-radius: 0 3px 3px 0;
cursor: pointer;
bottom: 0;
}
.loginCcode:hover {
display: block;
background: transparent;
}
.loginCcode:hover img {
display: none;
}
.loginCcode:hover .codeBig {
display: block;
}
.loginCcode img {
width: 23px;
}
.loginCcode .codeBig {
width: 128px;
height: 150px;
position: absolute;
bottom: 0;
left: 0px;
background: rgba(255, 255, 255, 0.7);
padding: 6px;
display: none;
}
.loginCcode .codeBig span {
font-size: 12px;
opacity: 0.75;
}
.CodeText {
font-size: 14px;
font-family: PingFang SC;
font-weight: bold;
color: #121F2B;
text-align: center;
line-height: 24px;
}
/*# sourceMappingURL=index.css.map */
\ No newline at end of file
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA;EACI,WAAA;EACA,YAAA;;AAGJ;EACI,WAAA;EACA,YAAA;EACA,gBAAA;EACA,gBAAgB,kCAAhB;EACA,0BAAA;EACA,4BAAA;EACA,kBAAA;;AAPJ,YAQI;EACI,SAAA;;AAIR;EACI,WAAA;EACA,YAAA;EACA,kBAAA;;AAGJ;EACI,WAAA;;AADJ,YAEI;EACI,WAAA;EACA,WAAA;;AAJR,YAMI;EACI,WAAA;EACA,eAAA;EACA,wBAAA;EACA,iBAAA;EACA,cAAA;EACA,cAAA;EACA,mBAAA;;AAIR;EACI,YAAA;;AADJ,aAEI;EACI,WAAA;EACA,eAAA;EACA,+BAAA;EACA,gBAAA;EACA,cAAA;EACA,kBAAA;;AARR,aAUI;EACI,WAAA;EACA,eAAA;EACA,+BAAA;EACA,gBAAA;EACA,cAAA;;AAKR;EACI,aAAA;EACA,aAAA;EACA,kBAAA;EACA,QAAA;EACA,SAAA;EACA,WAAW,qBAAX;EACA,kBAAA;;AAGJ;EACI,YAAA;EACA,YAAA;EACA,YAAA;;AAGJ;EACI,WAAA;;AAGJ;EACI,YAAA;EACA,aAAA;EACA,WAAA;;AAGJ;EACI,WAAA;EACA,YAAA;EACA,aAAA;EACA,iBAAA;EACA,eAAA;;AAGA,UAAE;EACE,WAAA;EACA,gBAAA;;AAGR,UAAW;EACP,mBAAA;EACA,kBAAA;EACA,cAAA;;AAGJ,UAAW,WAAU,UAAU;EAC3B,mBAAA;;AAGJ,UAAW,WAAU,UAAU;EAC3B,mBAAA;EACA,YAAA;;AAGJ,UAAW,WAAW,MAAK;EACvB,WAAA;EACA,YAAA;EACA,iBAAA;;AAGJ,UAAW,WAAW;EAClB,gBAAA;EACA,eAAA;EACA,+BAAA;EACA,gBAAA;EACA,cAAA;EACA,eAAA;;AAGJ,UAAW,WAAW;EAClB,kBAAA;EACA,SAAA;EACA,iBAAA;EACA,eAAA;EACA,YAAA;EACA,gBAAA;EACA,cAAA;;AAGJ,UAAW,WAAW;EAClB,kBAAA;EACA,YAAA;EACA,YAAA;EACA,SAAA;;AAaJ,UAAW,YAAY;EACnB,eAAA;EACA,WAAA;EACA,kBAAA;EACA,kBAAA;EACA,QAAA;EACA,UAAA;;AAGJ,UAAW,YAAW;EAClB,yBAAA;;AAGJ,UAAW,YAAW,OAAQ;EAC1B,mBAAA;EACA,WAAA;;AAGJ,UAAW;EACP,WAAA;EACA,YAAA;EACA,mBAAA;EACA,yBAAA;EACA,kBAAA;EACA,YAAA;;AAGJ;EACI,YAAA;EACA,mBAAA;;AAGJ,UAAW,WAAW;EAClB,UAAA;;AAGJ;EACI,aAAA;;AAGJ;EACI,YAAA;EACA,mBAAA;EACA,aAAA;;AAGJ;EACI,WAAA;EACA,YAAA;EACA,kBAAA;EACA,YAAA;EACA,oCAAA;EACA,YAAA;EACA,0BAAA;EACA,eAAA;EACA,SAAA;;AACA,WAAC;EACG,cAAA;EACA,uBAAA;;AAFJ,WAAC,MAGG;EACI,aAAA;;AAJR,WAAC,MAMG;EACI,cAAA;;AAjBZ,WAoBI;EACI,WAAA;;AArBR,WAuBI;EACI,YAAA;EACA,aAAA;EACA,kBAAA;EACA,SAAA;EACA,SAAA;EACA,oCAAA;EACA,YAAA;EACA,aAAA;;AA/BR,WAuBI,SASI;EACI,eAAA;EACA,aAAA;;AAOZ;EACI,eAAA;EACA,wBAAA;EACA,iBAAA;EACA,cAAA;EACA,kBAAA;EACA,iBAAA","file":"index.css"}
\ No newline at end of file
.main {
position: relative;
width: 100%;
height: 100%;
}
.layer1 {
position: absolute;
z-index: 1;
width: 100%;
object-fit: fill;
}
.layer2 {
width: 100%;
height: 100%;
display: -ms-flexbox;
display: flex;
-ms-flex-pack: center;
justify-content: center;
-ms-flex-align: center;
align-items: center;
flex-flow: column nowrap;
position: absolute;
z-index: 2;
}
.layer2 .title-block img {
height: 64px;
filter: drop-shadow(0px 0px 5px rgba(0, 0, 0, 0.5));
}
.layer2 .title-block h1 {
display: inline;
margin: auto;
vertical-align: middle;
color: #fff;
margin-left: 10px;
font-size: 50px;
text-shadow: 0px 0px 6px #000000;
}
.layer2 .title-block h2 {
margin: 15px 0 0 0;
vertical-align: middle;
color: #fff;
text-shadow: 0px 0px 3px #000000;
text-align: center;
}
.layer2 .login-block {
width: 500px;
margin: 60px 0 150px 0;
position: relative;
}
.layer2 .login-block .login-form {
background-color: rgba(255, 255, 255, 0.5);
border-radius: 4px;
box-shadow: 3px 3px 5px 0px rgba(0, 0, 0, 0.2);
padding: 50px;
}
.layer2 .login-block .login-form > div {
width: 100%;
}
.layer2 .login-block .login-form .rememberpwd input[type="checkbox"] {
width: 16px;
height: 16px;
}
.layer2 .login-block .login-form .form-group input {
font-size: 16px;
}
.layer2 .login-block .login-form .rememberpwd span {
position: relative;
top: -3px;
}
.layer2 .login-block .login-form button[type="submit"] {
width: 100%;
background-color: #35B2F1 !important;
border: none !important;
color: #fff !important;
outline: none !important;
border-color: transparent !important;
}
.layer2 .login-block .login-form .glyphicon {
color: #35B2F1;
}
.layer2 .login-block .login-form .input-group-addon {
background-color: #fff;
}
.layer2 .login-block .login-form .input-lg,
.layer2 .login-block .login-form .btn-lg {
height: 40px;
}
.layer2 .login-block .loginCcode {
width: 34px;
height: 34px;
position: absolute;
right: -34px;
background: rgba(255, 255, 255, 0.7);
padding: 6px;
border-radius: 0 3px 3px 0;
cursor: pointer;
bottom: 3px;
}
.layer2 .login-block .loginCcode:hover {
display: block;
background: transparent;
}
.layer2 .login-block .loginCcode:hover img {
display: none;
}
.layer2 .login-block .loginCcode:hover .codeBig {
display: block;
}
.layer2 .login-block .loginCcode img {
width: 23px;
}
.layer2 .login-block .loginCcode .codeBig {
width: 128px;
height: 150px;
position: absolute;
bottom: 0;
left: 0px;
background: rgba(255, 255, 255, 0.7);
padding: 6px;
display: none;
}
.layer2 .login-block .loginCcode .codeBig span {
font-size: 12px;
opacity: 0.75;
}
@-moz-document url-prefix() {
.layer1 {
height: 100%;
}
}
@-moz-document url-prefix() {
.layer1 {
height: 100%;
}
}
@media screen and (-webkit-min-device-pixel-ratio: 0) {
.layer1 {
height: 100%;
}
}
.footerCase {
width: 100%;
height: 16%;
background: #fff;
position: absolute;
bottom: 0;
left: 0;
}
.footerCase .quickMark {
position: absolute;
bottom: 48px;
text-align: center;
width: 100%;
font-size: 12px;
min-height: 71px;
}
.footerCase .quickMark-single {
text-align: center;
width: 120px;
display: inline-block;
}
.footerCase .quickMark-single span.Android {
display: block;
background-image: url(https://panda-water.cn/web4/assets/images/login/dark/Android1.png);
width: 26px;
height: 32px;
margin: auto;
margin-bottom: 6px;
}
.footerCase .quickMark-single span.Wechat {
display: block;
background-image: url(https://panda-water.cn/web4/assets/images/login/dark/Wechat1.png);
width: 34px;
height: 32px;
margin: auto;
margin-bottom: 6px;
}
.footerCase .quickMark-single span.iphone {
display: block;
background-image: url(https://panda-water.cn/web4/assets/images/login/dark/iphone1.png);
width: 28px;
height: 32px;
margin: auto;
margin-bottom: 6px;
}
.footerCase .quickMark .Android-single .Android-code,
.footerCase .quickMark .iphone-single .iphone-code {
margin: 0px 0px 10px 0px;
width: 150px;
height: 150px;
background: #fff;
padding: 5px;
display: none;
transform: translateX(-15px);
}
.footerCase .quickMark .icon-Container {
height: 50px;
cursor: pointer;
}
.footerCase .copyright {
position: absolute;
z-index: 2;
text-align: center;
width: 100%;
bottom: 10px;
font-size: 13px;
color: #fff;
}
.footerCase .copyright a {
color: #eee;
text-decoration: underline;
}
.footerCase .copyright .addons {
display: none;
}
.footerCase .copyright .split {
border-left: 1px solid white;
margin: 0 8px;
}
.footerCase .copyright .glyphicon-qrcode {
vertical-align: text-top;
}
/*# sourceMappingURL=index.css.map */
\ No newline at end of file
{"version":3,"sources":["index.less"],"names":[],"mappings":"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","file":"index.css"}
\ No newline at end of file
import { UserLayout } from '@wisdom-utils/components/lib/AppLayout';
import LoadingComponent from '@wisdom-utils/components/lib/AppLayout/components/PageLoading';
import { dynamic } from '@wisdom-utils/runtime';
import { UserLayout } from '@wisdom-utils/components/lib/AppLayout';
import BasicLayout from '../layouts/BasicLayout_PRO';
import HNLayout from '../layouts/HNLayout';
import BasicLayout from '../layouts/BasicLayout';
import BootPage from '../pages/bootpage';
import UsingAnalysis from '../pages/cloudOMS/usingAnalysis';
import CommonMenu from '../pages/commonMenu';
import Iframe from '../pages/iframe';
import Login from '../pages/user/login';
import CommonMenu from '../pages/commonMenu';
import NoSecret from '../pages/user/login/noSecret';
import UsingAnalysis from '../pages/cloudOMS/usingAnalysis';
export const dyRoutes = (routes, layout, theme) => {
// eslint-disable-next-line no-shadow
const dyRoutes = routes || [];
......@@ -49,7 +49,8 @@ export const dyRoutes = (routes, layout, theme) => {
},
{
path: '/',
component: theme === 'lightgreen.css' ? HNLayout : BasicLayout,
// component: theme === 'lightgreen.css' ? HNLayout : BasicLayout,
component: BasicLayout,
routes: [
...dyRoutes,
{
......
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable no-restricted-globals */
/* eslint-disable no-underscore-dangle */
/* globals workbox */
workbox.core.setCacheNameDetails({
prefix: 'panda',
suffix: 'v1',
});
// Control all opened tabs ASAP
workbox.clientsClaim();
/**
* Use precaching list generated by workbox in build process.
* https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.precaching
*/
workbox.precaching.precacheAndRoute(self.__precacheManifest || []);
/**
* Register a navigation route.
* https://developers.google.com/web/tools/workbox/modules/workbox-routing#how_to_register_a_navigation_route
*/
workbox.routing.registerNavigationRoute('/index.html');
/**
* Use runtime cache:
* https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.routing#.registerRoute
*
* Workbox provides all common caching strategies including CacheFirst, NetworkFirst etc.
* https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.strategies
*/
/**
* Handle API requests
*/
workbox.routing.registerRoute(/\/api\//, workbox.strategies.networkFirst());
/**
* Handle third party requests
*/
workbox.routing.registerRoute(
/^https:\/\/gw\.alipayobjects\.com\//,
workbox.strategies.networkFirst(),
);
workbox.routing.registerRoute(
/^https:\/\/cdnjs\.cloudflare\.com\//,
workbox.strategies.networkFirst(),
);
workbox.routing.registerRoute(
/\/color.less/,
workbox.strategies.networkFirst(),
);
/**
* Response to client after skipping waiting with MessageChannel
*/
addEventListener('message', event => {
const replyPort = event.ports[0];
const message = event.data;
if (replyPort && message && message.type === 'skip-waiting') {
event.waitUntil(
self.skipWaiting().then(
() => {
replyPort.postMessage({
error: null,
});
},
error => {
replyPort.postMessage({
error,
});
},
),
);
}
});
......@@ -4940,10 +4940,10 @@
resolved "https://g.civnet.cn:4873/@webpack-cli%2fserve/-/serve-1.6.1.tgz#0de2875ac31b46b6c5bb1ae0a7d7f0ba5678dffe"
integrity sha512-gNGTiTrjEVQ0OcVnzsRSqTxaBSr+dmTfm+qJsCDluky8uhdLWep7Gcr62QsAKHTMxjCS/8nEITsmFAhfIx+QSw==
"@wisdom-cesium/cesium@^1.0.83":
version "1.0.83"
resolved "https://g.civnet.cn:4873/@wisdom-cesium%2fcesium/-/cesium-1.0.83.tgz#848c2621629661c4aa17c8fa216152ca3549462f"
integrity sha512-FViJwxOUPhexW5PO5aHiwqM20Joul1+o+hT4KfPAozcOuAMSC+zlR/46h+YZovXDaXdSWuYZw0WGPnUhI/RFDg==
"@wisdom-cesium/cesium@^1.0.84":
version "1.0.84"
resolved "https://g.civnet.cn:4873/@wisdom-cesium%2fcesium/-/cesium-1.0.84.tgz#10b148e3bb89218c8ddd3f65ab2f7c67b58ab0b3"
integrity sha512-6lwDwh8DNWdQZZgu5IpC63FX4KNdxoUXRot9oEBXDO/qOSalB93V1O9GbFsZg49qu/qzvmfEl+eDj+brmb/ZVw==
dependencies:
"@babel/polyfill" "7.4.3"
"@babel/runtime" "^7.12.0"
......@@ -5068,17 +5068,17 @@
resolved "https://g.civnet.cn:4873/@wisdom-map%2futil/-/util-1.0.30.tgz#666f749845aa2ec5afdd327a6b44d129fb545821"
integrity sha512-6e+0dUno8Cus4KC8lZHTFX5cbosk+52oN53xa+eDEsLUtgqQHuxzYjqHzyy6AB8b1ahrDAdKWnUPB7d6bzPIdA==
"@wisdom-utils/components@0.1.214", "@wisdom-utils/components@^0.1.214":
version "0.1.214"
resolved "https://g.civnet.cn:4873/@wisdom-utils%2fcomponents/-/components-0.1.214.tgz#54cd87a2a8c491ed7f88bbeb7fbfe620de295172"
integrity sha512-I+rKCYk1eHfPYTWbPtHp8Cl+OEz2RLDCnhGiHwW10yHQAfvnR/NtW4gZ0fS0xcnC6I0wHxtGTxuMevDKuDdcgA==
"@wisdom-utils/components@0.1.216", "@wisdom-utils/components@^0.1.216":
version "0.1.216"
resolved "https://g.civnet.cn:4873/@wisdom-utils%2fcomponents/-/components-0.1.216.tgz#2369de63a919899616fc4b8b30a02c6abae91764"
integrity sha512-1/GQi+JtEfIdnoPXfie6wuYp5mMRgCxxLtD6ufyp5BRHUh3KpjyMYW8HAI3PJnYrjnIAHgDFV6yteScZ51YKug==
dependencies:
"@ant-design/icons" "^4.0.0"
"@ant-design/pro-utils" "1.41.2"
"@umijs/route-utils" "^2.1.0"
"@umijs/use-params" "^1.0.9"
"@wisdom-utils/runtime" "^0.0.32"
"@wisdom-utils/utils" "^0.1.254"
"@wisdom-utils/utils" "^0.1.256"
antd "^4.17.4"
classnames "^2.2.6"
kit_logger "^1.0.2"
......@@ -5131,13 +5131,13 @@
lodash.throttle "^4.1.1"
query-string "^6.13.8"
"@wisdom-utils/utils@0.1.254", "@wisdom-utils/utils@^0.1.254":
version "0.1.254"
resolved "https://g.civnet.cn:4873/@wisdom-utils%2futils/-/utils-0.1.254.tgz#978497945729eaf7d5c9556dfd892c144f3d83f5"
integrity sha512-M0e826nZbz9tAqrVnT9NF6p5DvUw3RJBmP2kEmYMoVxooLtdX3HmTw1wpmpchRtX+Ol8veePiglT9YfA5KiG2g==
"@wisdom-utils/utils@0.1.256", "@wisdom-utils/utils@^0.1.256":
version "0.1.256"
resolved "https://g.civnet.cn:4873/@wisdom-utils%2futils/-/utils-0.1.256.tgz#3f8fb61994977058bed300f5fa66fe6db008a49a"
integrity sha512-S/8otDc+ugjqZHYTuGh5BtA9iFJRkRFPXXkEuQc+zHW1aPpzI+PF40/NONsNujN8i8IlYk3DYLg+VvZR908E4Q==
dependencies:
"@ahooksjs/use-request" "^2.0.0"
"@wisdom-utils/components" "^0.1.214"
"@wisdom-utils/components" "^0.1.216"
"@wisdom-utils/runtime" "^0.0.32"
axios "^0.21.1"
cookie "^0.4.1"
......
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