Commit daf705e8 by zhangleyuan

feat:第一次提交项目代码

parents
/*
* @Author: 吴文洁
* @Date: 2020-04-30 10:39:36
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-24 11:43:35
* @Description:
*/
module.exports = {
"parser": '@typescript-eslint/parser',
"plugins": [
"jsx-control-statements",
"@typescript-eslint"
],
"rules": {
"react/jsx-no-undef": [2, { "allowGlobals": true }]
},
"extends": ["react-app", "plugin:jsx-control-statements/recommended"],
}
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `yarn start`
Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br />
You will also see any lint errors in the console.
### `yarn test`
Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `yarn build`
Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `yarn eject`
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
### Analyzing the Bundle Size
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
### Making a Progressive Web App
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
### Advanced Configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
### Deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
### `yarn build` fails to minify
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
'use strict';
const fs = require('fs');
const path = require('path');
const paths = require('./paths');
// Make sure that including paths.js after env.js will read .env variables.
delete require.cache[require.resolve('./paths')];
const NODE_ENV = process.env.NODE_ENV;
if (!NODE_ENV) {
throw new Error(
'The NODE_ENV environment variable is required but was not specified.'
);
}
// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
const dotenvFiles = [
`${paths.dotenv}.${NODE_ENV}.local`,
`${paths.dotenv}.${NODE_ENV}`,
// Don't include `.env.local` for `test` environment
// since normally you expect tests to produce the same
// results for everyone
NODE_ENV !== 'test' && `${paths.dotenv}.local`,
paths.dotenv,
].filter(Boolean);
// Load environment variables from .env* files. Suppress warnings using silent
// if this file is missing. dotenv will never modify any environment variables
// that have already been set. Variable expansion is supported in .env files.
// https://github.com/motdotla/dotenv
// https://github.com/motdotla/dotenv-expand
dotenvFiles.forEach(dotenvFile => {
if (fs.existsSync(dotenvFile)) {
require('dotenv-expand')(
require('dotenv').config({
path: dotenvFile,
})
);
}
});
// We support resolving modules according to `NODE_PATH`.
// This lets you use absolute paths in imports inside large monorepos:
// https://github.com/facebook/create-react-app/issues/253.
// It works similar to `NODE_PATH` in Node itself:
// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
// Otherwise, we risk importing Node.js core modules into an app instead of webpack shims.
// https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421
// We also resolve them to make sure all tools using them work consistently.
const appDirectory = fs.realpathSync(process.cwd());
process.env.NODE_PATH = (process.env.NODE_PATH || '')
.split(path.delimiter)
.filter(folder => folder && !path.isAbsolute(folder))
.map(folder => path.resolve(appDirectory, folder))
.join(path.delimiter);
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
// injected into the application via DefinePlugin in webpack configuration.
const REACT_APP = /^REACT_APP_/i;
function getClientEnvironment(publicUrl) {
const raw = Object.keys(process.env)
.filter(key => REACT_APP.test(key))
.reduce(
(env, key) => {
env[key] = process.env[key];
return env;
},
{
// Useful for determining whether we’re running in production mode.
// Most importantly, it switches React into the correct mode.
NODE_ENV: process.env.NODE_ENV || 'development',
DEPLOY_ENV: process.env.DEPLOY_ENV,
// Useful for resolving the correct path to static assets in `public`.
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
// This should only be used as an escape hatch. Normally you would put
// images into the `src` and `import` them in code to get their paths.
PUBLIC_URL: publicUrl,
// We support configuring the sockjs pathname during development.
// These settings let a developer run multiple simultaneous projects.
// They are used as the connection `hostname`, `pathname` and `port`
// in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
// and `sockPort` options in webpack-dev-server.
WDS_SOCKET_HOST: process.env.WDS_SOCKET_HOST,
WDS_SOCKET_PATH: process.env.WDS_SOCKET_PATH,
WDS_SOCKET_PORT: process.env.WDS_SOCKET_PORT,
}
);
// Stringify all values so we can feed into webpack DefinePlugin
const stringified = {
'process.env': Object.keys(raw).reduce((env, key) => {
env[key] = JSON.stringify(raw[key]);
return env;
}, {}),
};
return { raw, stringified };
}
module.exports = getClientEnvironment;
'use strict';
const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
const chalk = require('react-dev-utils/chalk');
const paths = require('./paths');
// Ensure the certificate and key provided are valid and if not
// throw an easy to debug error
function validateKeyAndCerts({ cert, key, keyFile, crtFile }) {
let encrypted;
try {
// publicEncrypt will throw an error with an invalid cert
encrypted = crypto.publicEncrypt(cert, Buffer.from('test'));
} catch (err) {
throw new Error(
`The certificate "${chalk.yellow(crtFile)}" is invalid.\n${err.message}`
);
}
try {
// privateDecrypt will throw an error with an invalid key
crypto.privateDecrypt(key, encrypted);
} catch (err) {
throw new Error(
`The certificate key "${chalk.yellow(keyFile)}" is invalid.\n${
err.message
}`
);
}
}
// Read file and throw an error if it doesn't exist
function readEnvFile(file, type) {
if (!fs.existsSync(file)) {
throw new Error(
`You specified ${chalk.cyan(
type
)} in your env, but the file "${chalk.yellow(file)}" can't be found.`
);
}
return fs.readFileSync(file);
}
// Get the https config
// Return cert files if provided in env, otherwise just true or false
function getHttpsConfig() {
const { SSL_CRT_FILE, SSL_KEY_FILE, HTTPS } = process.env;
const isHttps = HTTPS === 'true';
if (isHttps && SSL_CRT_FILE && SSL_KEY_FILE) {
const crtFile = path.resolve(paths.appPath, SSL_CRT_FILE);
const keyFile = path.resolve(paths.appPath, SSL_KEY_FILE);
const config = {
cert: readEnvFile(crtFile, 'SSL_CRT_FILE'),
key: readEnvFile(keyFile, 'SSL_KEY_FILE'),
};
validateKeyAndCerts({ ...config, keyFile, crtFile });
return config;
}
return isHttps;
}
module.exports = getHttpsConfig;
'use strict';
// This is a custom Jest transformer turning style imports into empty objects.
// http://facebook.github.io/jest/docs/en/webpack.html
module.exports = {
process() {
return 'module.exports = {};';
},
getCacheKey() {
// The output is always the same.
return 'cssTransform';
},
};
'use strict';
const path = require('path');
const camelcase = require('camelcase');
// This is a custom Jest transformer turning file imports into filenames.
// http://facebook.github.io/jest/docs/en/webpack.html
module.exports = {
process(src, filename) {
const assetFilename = JSON.stringify(path.basename(filename));
if (filename.match(/\.svg$/)) {
// Based on how SVGR generates a component name:
// https://github.com/smooth-code/svgr/blob/01b194cf967347d43d4cbe6b434404731b87cf27/packages/core/src/state.js#L6
const pascalCaseFilename = camelcase(path.parse(filename).name, {
pascalCase: true,
});
const componentName = `Svg${pascalCaseFilename}`;
return `const React = require('react');
module.exports = {
__esModule: true,
default: ${assetFilename},
ReactComponent: React.forwardRef(function ${componentName}(props, ref) {
return {
$$typeof: Symbol.for('react.element'),
type: 'svg',
ref: ref,
key: null,
props: Object.assign({}, props, {
children: ${assetFilename}
})
};
}),
};`;
}
return `module.exports = ${assetFilename};`;
},
};
'use strict';
const fs = require('fs');
const path = require('path');
const paths = require('./paths');
const chalk = require('react-dev-utils/chalk');
const resolve = require('resolve');
/**
* Get additional module paths based on the baseUrl of a compilerOptions object.
*
* @param {Object} options
*/
function getAdditionalModulePaths(options = {}) {
const baseUrl = options.baseUrl;
// We need to explicitly check for null and undefined (and not a falsy value) because
// TypeScript treats an empty string as `.`.
if (baseUrl == null) {
// If there's no baseUrl set we respect NODE_PATH
// Note that NODE_PATH is deprecated and will be removed
// in the next major release of create-react-app.
const nodePath = process.env.NODE_PATH || '';
return nodePath.split(path.delimiter).filter(Boolean);
}
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
// We don't need to do anything if `baseUrl` is set to `node_modules`. This is
// the default behavior.
if (path.relative(paths.appNodeModules, baseUrlResolved) === '') {
return null;
}
// Allow the user set the `baseUrl` to `appSrc`.
if (path.relative(paths.appSrc, baseUrlResolved) === '') {
return [paths.appSrc];
}
// If the path is equal to the root directory we ignore it here.
// We don't want to allow importing from the root directly as source files are
// not transpiled outside of `src`. We do allow importing them with the
// absolute path (e.g. `src/Components/Button.js`) but we set that up with
// an alias.
if (path.relative(paths.appPath, baseUrlResolved) === '') {
return null;
}
// Otherwise, throw an error.
throw new Error(
chalk.red.bold(
"Your project's `baseUrl` can only be set to `src` or `node_modules`." +
' Create React App does not support other values at this time.'
)
);
}
/**
* Get webpack aliases based on the baseUrl of a compilerOptions object.
*
* @param {*} options
*/
function getWebpackAliases(options = {}) {
const baseUrl = options.baseUrl;
if (!baseUrl) {
return {};
}
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
if (path.relative(paths.appPath, baseUrlResolved) === '') {
return {
src: paths.appSrc,
};
}
}
/**
* Get jest aliases based on the baseUrl of a compilerOptions object.
*
* @param {*} options
*/
function getJestAliases(options = {}) {
const baseUrl = options.baseUrl;
if (!baseUrl) {
return {};
}
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
if (path.relative(paths.appPath, baseUrlResolved) === '') {
return {
'^src/(.*)$': '<rootDir>/src/$1',
};
}
}
function getModules() {
// Check if TypeScript is setup
const hasTsConfig = fs.existsSync(paths.appTsConfig);
const hasJsConfig = fs.existsSync(paths.appJsConfig);
if (hasTsConfig && hasJsConfig) {
throw new Error(
'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.'
);
}
let config;
// If there's a tsconfig.json we assume it's a
// TypeScript project and set up the config
// based on tsconfig.json
if (hasTsConfig) {
const ts = require(resolve.sync('typescript', {
basedir: paths.appNodeModules,
}));
config = ts.readConfigFile(paths.appTsConfig, ts.sys.readFile).config;
// Otherwise we'll check if there is jsconfig.json
// for non TS projects.
} else if (hasJsConfig) {
config = require(paths.appJsConfig);
}
config = config || {};
const options = config.compilerOptions || {};
const additionalModulePaths = getAdditionalModulePaths(options);
return {
additionalModulePaths: additionalModulePaths,
webpackAliases: getWebpackAliases(options),
jestAliases: getJestAliases(options),
hasTsConfig,
};
}
module.exports = getModules();
/*
* @Author: 吴文洁
* @Date: 2020-08-24 13:36:56
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-24 13:36:56
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
'use strict';
const path = require('path');
const fs = require('fs');
const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath');
// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebook/create-react-app/issues/637
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
// We use `PUBLIC_URL` environment variable or "homepage" field to infer
// "public path" at which the app is served.
// webpack needs to know it to put the right <script> hrefs into HTML even in
// single-page apps that may serve index.html for nested URLs like /todos/42.
// We can't use a relative path in HTML because we don't want to load something
// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
const publicUrlOrPath = getPublicUrlOrPath(
process.env.NODE_ENV === 'development',
require(resolveApp('package.json')).homepage,
process.env.PUBLIC_URL
);
const moduleFileExtensions = [
'web.mjs',
'mjs',
'web.js',
'js',
'web.ts',
'ts',
'web.tsx',
'tsx',
'json',
'web.jsx',
'jsx',
];
// Resolve file paths in the same order as webpack
const resolveModule = (resolveFn, filePath) => {
const extension = moduleFileExtensions.find(extension =>
fs.existsSync(resolveFn(`${filePath}.${extension}`))
);
if (extension) {
return resolveFn(`${filePath}.${extension}`);
}
return resolveFn(`${filePath}.js`);
};
// config after eject: we're in ./config/
module.exports = {
dotenv: resolveApp('.env'),
appPath: resolveApp('.'),
appBuild: resolveApp('dist'),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveModule(resolveApp, 'src/index'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
appTsConfig: resolveApp('tsconfig.json'),
appJsConfig: resolveApp('jsconfig.json'),
yarnLockFile: resolveApp('yarn.lock'),
testsSetup: resolveModule(resolveApp, 'src/setupTests'),
proxySetup: resolveApp('src/setupProxy.js'),
appNodeModules: resolveApp('node_modules'),
publicUrlOrPath,
};
module.exports.moduleFileExtensions = moduleFileExtensions;
'use strict';
const { resolveModuleName } = require('ts-pnp');
exports.resolveModuleName = (
typescript,
moduleName,
containingFile,
compilerOptions,
resolutionHost
) => {
return resolveModuleName(
moduleName,
containingFile,
compilerOptions,
resolutionHost,
typescript.resolveModuleName
);
};
exports.resolveTypeReferenceDirective = (
typescript,
moduleName,
containingFile,
compilerOptions,
resolutionHost
) => {
return resolveModuleName(
moduleName,
containingFile,
compilerOptions,
resolutionHost,
typescript.resolveTypeReferenceDirective
);
};
'use strict';
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const resolve = require('resolve');
const PnpWebpackPlugin = require('pnp-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const safePostCssParser = require('postcss-safe-parser');
const ManifestPlugin = require('webpack-manifest-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
const paths = require('./paths');
const modules = require('./modules');
const getClientEnvironment = require('./env');
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin');
const typescriptFormatter = require('react-dev-utils/typescriptFormatter');
const postcssNormalize = require('postcss-normalize');
const appPackageJson = require(paths.appPackageJson);
// Source maps are resource heavy and can cause out of memory issue for large source files.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
// Some apps do not need the benefits of saving a web request, so not inlining the chunk
// makes for a smoother build process.
const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';
const isExtendingEslintConfig = process.env.EXTEND_ESLINT === 'true';
const imageInlineSizeLimit = parseInt(
process.env.IMAGE_INLINE_SIZE_LIMIT || '10000'
);
// Check if TypeScript is setup
const useTypeScript = fs.existsSync(paths.appTsConfig);
// style files regexes
const cssRegex = /\.css$/;
const cssModuleRegex = /\.module\.css$/;
const lessRegex = /\.less$/;
const lessModuleRegex = /\.module\.less$/;
// This is the production and development configuration.
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
module.exports = function(webpackEnv) {
const isEnvDevelopment = webpackEnv === 'development';
const isEnvProduction = webpackEnv === 'production';
// Variable used for enabling profiling in Production
// passed into alias object. Uses a flag if passed into the build command
const isEnvProductionProfile =
isEnvProduction && process.argv.includes('--profile');
// We will provide `paths.publicUrlOrPath` to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
// Get environment variables to inject into our app.
const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
// common function to get style loaders
const getStyleLoaders = (cssOptions, preProcessor) => {
const loaders = [
isEnvDevelopment && require.resolve('style-loader'),
isEnvProduction && {
loader: MiniCssExtractPlugin.loader,
// css is located in `static/css`, use '../../' to locate index.html folder
// in production `paths.publicUrlOrPath` can be a relative path
options: paths.publicUrlOrPath.startsWith('.')
? { publicPath: '../../' }
: {},
},
{
loader: require.resolve('css-loader'),
options: cssOptions,
},
{
// Options for PostCSS as we reference these options twice
// Adds vendor prefixing based on your specified browser support in
// package.json
loader: require.resolve('postcss-loader'),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebook/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({
autoprefixer: {
flexbox: 'no-2009',
},
stage: 3,
}),
// Adds PostCSS Normalize as the reset css with default options,
// so that it honors browserslist config in package.json
// which in turn let's users customize the target behavior as per their needs.
postcssNormalize(),
],
sourceMap: isEnvProduction && shouldUseSourceMap,
},
},
].filter(Boolean);
if (preProcessor) {
loaders.push(
{
loader: require.resolve('resolve-url-loader'),
options: {
sourceMap: isEnvProduction && shouldUseSourceMap,
},
},
{
loader: require.resolve(preProcessor),
options: {
sourceMap: true,
},
},
{
loader: require.resolve('less-loader'),
options: {
lessOptions: {
modifyVars: {
'primary-color': '#Fc9C6B',
},
javascriptEnabled: true,
},
}
}
);
}
return loaders;
};
return {
mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development',
// Stop compilation early in production
bail: isEnvProduction,
devtool: isEnvProduction
? shouldUseSourceMap
? 'source-map'
: false
: isEnvDevelopment && 'cheap-module-source-map',
// These are the "entry points" to our application.
// This means they will be the "root" imports that are included in JS bundle.
entry: [
// Include an alternative client for WebpackDevServer. A client's job is to
// connect to WebpackDevServer by a socket and get notified about changes.
// When you save a file, the client will either apply hot updates (in case
// of CSS changes), or refresh the page (in case of JS changes). When you
// make a syntax error, this client will display a syntax error overlay.
// Note: instead of the default WebpackDevServer client, we use a custom one
// to bring better experience for Create React App users. You can replace
// the line below with these two lines if you prefer the stock client:
// require.resolve('webpack-dev-server/client') + '?/',
// require.resolve('webpack/hot/dev-server'),
isEnvDevelopment &&
require.resolve('react-dev-utils/webpackHotDevClient'),
// Finally, this is your app's code:
paths.appIndexJs,
// We include the app code last so that if there is a runtime error during
// initialization, it doesn't blow up the WebpackDevServer client, and
// changing JS code would still trigger a refresh.
].filter(Boolean),
output: {
// The build folder.
path: isEnvProduction ? paths.appBuild : undefined,
// Add /* filename */ comments to generated require()s in the output.
pathinfo: isEnvDevelopment,
// There will be one main bundle, and one file per asynchronous chunk.
// In development, it does not produce real files.
filename: isEnvProduction
? 'static/js/[name].[contenthash:8].js'
: isEnvDevelopment && 'static/js/bundle.js',
// TODO: remove this when upgrading to webpack 5
futureEmitAssets: true,
// There are also additional JS chunk files if you use code splitting.
chunkFilename: isEnvProduction
? 'static/js/[name].[contenthash:8].chunk.js'
: isEnvDevelopment && 'static/js/[name].chunk.js',
// webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path.
// We inferred the "public path" (such as / or /my-project) from homepage.
publicPath: isEnvDevelopment ? '/' : './',
// Point sourcemap entries to original disk location (format as URL on Windows)
devtoolModuleFilenameTemplate: isEnvProduction
? info =>
path
.relative(paths.appSrc, info.absoluteResourcePath)
.replace(/\\/g, '/')
: isEnvDevelopment &&
(info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
// Prevents conflicts when multiple webpack runtimes (from different apps)
// are used on the same page.
jsonpFunction: `webpackJsonp${appPackageJson.name}`,
// this defaults to 'window', but by setting it to 'this' then
// module chunks which are built will work in web workers as well.
globalObject: 'this',
library: appPackageJson.name,
libraryTarget: "umd",
jsonpFunction: `webpackJsonp_${appPackageJson.name}`,
},
optimization: {
minimize: isEnvProduction,
minimizer: [
// This is only used in production mode
new TerserPlugin({
terserOptions: {
parse: {
// We want terser to parse ecma 8 code. However, we don't want it
// to apply any minification steps that turns valid ecma 5 code
// into invalid ecma 5 code. This is why the 'compress' and 'output'
// sections only apply transformations that are ecma 5 safe
// https://github.com/facebook/create-react-app/pull/4234
ecma: 8,
},
compress: {
ecma: 5,
warnings: false,
// Disabled because of an issue with Uglify breaking seemingly valid code:
// https://github.com/facebook/create-react-app/issues/2376
// Pending further investigation:
// https://github.com/mishoo/UglifyJS2/issues/2011
comparisons: false,
// Disabled because of an issue with Terser breaking valid code:
// https://github.com/facebook/create-react-app/issues/5250
// Pending further investigation:
// https://github.com/terser-js/terser/issues/120
inline: 2,
},
mangle: {
safari10: true,
},
// Added for profiling in devtools
keep_classnames: isEnvProductionProfile,
keep_fnames: isEnvProductionProfile,
output: {
ecma: 5,
comments: false,
// Turned on because emoji and regex is not minified properly using default
// https://github.com/facebook/create-react-app/issues/2488
ascii_only: true,
},
},
sourceMap: shouldUseSourceMap,
}),
// This is only used in production mode
new OptimizeCSSAssetsPlugin({
cssProcessorOptions: {
parser: safePostCssParser,
map: shouldUseSourceMap
? {
// `inline: false` forces the sourcemap to be output into a
// separate file
inline: false,
// `annotation: true` appends the sourceMappingURL to the end of
// the css file, helping the browser find the sourcemap
annotation: true,
}
: false,
},
cssProcessorPluginOptions: {
preset: ['default', { minifyFontValues: { removeQuotes: false } }],
},
}),
],
// Automatically split vendor and commons
// https://twitter.com/wSokra/status/969633336732905474
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
splitChunks: {
chunks: 'all',
name: false,
},
// Keep the runtime chunk separated to enable long term caching
// https://twitter.com/wSokra/status/969679223278505985
// https://github.com/facebook/create-react-app/issues/5358
runtimeChunk: {
name: entrypoint => `runtime-${entrypoint.name}`,
},
},
resolve: {
// This allows you to set a fallback for where webpack should look for modules.
// We placed these paths second because we want `node_modules` to "win"
// if there are any conflicts. This matches Node resolution mechanism.
// https://github.com/facebook/create-react-app/issues/253
modules: ['node_modules', paths.appNodeModules].concat(
modules.additionalModulePaths || []
),
// These are the reasonable defaults supported by the Node ecosystem.
// We also include JSX as a common component filename extension to support
// some tools, although we do not recommend using it, see:
// https://github.com/facebook/create-react-app/issues/290
// `web` extension prefixes have been added for better support
// for React Native Web.
extensions: paths.moduleFileExtensions
.map(ext => `.${ext}`)
.filter(ext => useTypeScript || !ext.includes('ts')),
alias: {
"@": path.resolve(__dirname, '../src'),
// Support React Native Web
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
'react-native': 'react-native-web',
// Allows for better profiling with ReactDevTools
...(isEnvProductionProfile && {
'react-dom$': 'react-dom/profiling',
'scheduler/tracing': 'scheduler/tracing-profiling',
}),
...(modules.webpackAliases || {}),
},
plugins: [
// Adds support for installing with Plug'n'Play, leading to faster installs and adding
// guards against forgotten dependencies and such.
PnpWebpackPlugin,
// Prevents users from importing files from outside of src/ (or node_modules/).
// This often causes confusion because we only process files within src/ with babel.
// To fix this, we prevent you from importing files out of src/ -- if you'd like to,
// please link the files into your node_modules/ and let module-resolution kick in.
// Make sure your source files are compiled, as they will not be processed in any way.
new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),
],
},
resolveLoader: {
plugins: [
// Also related to Plug'n'Play, but this time it tells webpack to load its loaders
// from the current package.
PnpWebpackPlugin.moduleLoader(module),
],
},
module: {
strictExportPresence: true,
rules: [
// Disable require.ensure as it's not a standard language feature.
{ parser: { requireEnsure: false } },
// First, run the linter.
// It's important to do this before Babel processes the JS.
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
enforce: 'pre',
use: [
{
options: {
cache: true,
formatter: require.resolve('react-dev-utils/eslintFormatter'),
eslintPath: require.resolve('eslint'),
resolvePluginsRelativeTo: __dirname,
},
loader: require.resolve('eslint-loader'),
},
],
include: paths.appSrc,
},
{
// "oneOf" will traverse all following loaders until one will
// match the requirements. When no loader matches it will fall
// back to the "file" loader at the end of the loader list.
oneOf: [
// "url" loader works like "file" loader except that it embeds assets
// smaller than specified limit in bytes as data URLs to avoid requests.
// A missing `test` is equivalent to a match.
{
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
loader: require.resolve('url-loader'),
options: {
limit: imageInlineSizeLimit,
name: 'static/media/[name].[hash:8].[ext]',
},
},
// Process application JS with Babel.
// The preset includes JSX, Flow, TypeScript, and some ESnext features.
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
include: paths.appSrc,
loader: require.resolve('babel-loader'),
options: {
customize: require.resolve(
'babel-preset-react-app/webpack-overrides'
),
plugins: [
[
require.resolve('babel-plugin-named-asset-import'),
{
loaderMap: {
svg: {
ReactComponent:
'@svgr/webpack?-svgo,+titleProp,+ref![path]',
},
},
},
],
],
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true,
// See #6846 for context on why cacheCompression is disabled
cacheCompression: false,
compact: isEnvProduction,
},
},
// Process any JS outside of the app with Babel.
// Unlike the application JS, we only compile the standard ES features.
{
test: /\.(js|mjs)$/,
exclude: /@babel(?:\/|\\{1,2})runtime/,
loader: require.resolve('babel-loader'),
options: {
babelrc: false,
configFile: false,
compact: false,
presets: [
[
require.resolve('babel-preset-react-app/dependencies'),
{ helpers: true },
],
],
cacheDirectory: true,
// See #6846 for context on why cacheCompression is disabled
cacheCompression: false,
// Babel sourcemaps are needed for debugging into node_modules
// code. Without the options below, debuggers like VSCode
// show incorrect code and set breakpoints on the wrong lines.
sourceMaps: shouldUseSourceMap,
inputSourceMap: shouldUseSourceMap,
},
},
// "postcss" loader applies autoprefixer to our CSS.
// "css" loader resolves paths in CSS and adds assets as dependencies.
// "style" loader turns CSS into JS modules that inject <style> tags.
// In production, we use MiniCSSExtractPlugin to extract that CSS
// to a file, but in development "style" loader enables hot editing
// of CSS.
// By default we support CSS Modules with the extension .module.css
{
test: cssRegex,
exclude: cssModuleRegex,
use: getStyleLoaders({
importLoaders: 1,
sourceMap: isEnvProduction && shouldUseSourceMap,
}),
// Don't consider CSS imports dead code even if the
// containing package claims to have no side effects.
// Remove this when webpack adds a warning or an error for this.
// See https://github.com/webpack/webpack/issues/6571
sideEffects: true,
},
// Adds support for CSS Modules (https://github.com/css-modules/css-modules)
// using the extension .module.css
{
test: cssModuleRegex,
use: getStyleLoaders({
importLoaders: 1,
sourceMap: isEnvProduction && shouldUseSourceMap,
modules: {
getLocalIdent: getCSSModuleLocalIdent,
},
}),
},
// Opt-in support for SASS (using .scss or .sass extensions).
// By default we support SASS Modules with the
// extensions .module.scss or .module.sass
{
test: lessRegex,
exclude: lessModuleRegex,
use: getStyleLoaders(
{
importLoaders: 2,
sourceMap: isEnvProduction && shouldUseSourceMap,
},
'less-loader'
),
sideEffects: true,
},
{
test: lessModuleRegex,
use: getStyleLoaders(
{
importLoaders: 2,
sourceMap: isEnvProduction && shouldUseSourceMap,
modules: true,
getLocalIdent: getCSSModuleLocalIdent,
},
'less-loader'
)
},
// "file" loader makes sure those assets get served by WebpackDevServer.
// When you `import` an asset, you get its (virtual) filename.
// In production, they would get copied to the `build` folder.
// This loader doesn't use a "test" so it will catch all modules
// that fall through the other loaders.
{
loader: require.resolve('file-loader'),
// Exclude `js` files to keep "css" loader working as it injects
// its runtime that would otherwise be processed through "file" loader.
// Also exclude `html` and `json` extensions so they get processed
// by webpacks internal loaders.
exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
options: {
name: 'static/media/[name].[hash:8].[ext]',
},
},
// ** STOP ** Are you adding a new loader?
// Make sure to add the new loader(s) before the "file" loader.
],
},
],
},
plugins: [
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin(
Object.assign(
{},
{
inject: true,
template: paths.appHtml,
},
isEnvProduction
? {
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
}
: undefined
)
),
// Inlines the webpack runtime script. This script is too small to warrant
// a network request.
// https://github.com/facebook/create-react-app/issues/5358
isEnvProduction &&
shouldInlineRuntimeChunk &&
new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime-.+[.]js/]),
// Makes some environment variables available in index.html.
// The public URL is available as %PUBLIC_URL% in index.html, e.g.:
// <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
// It will be an empty string unless you specify "homepage"
// in `package.json`, in which case it will be the pathname of that URL.
new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),
// This gives some necessary context to module not found errors, such as
// the requesting resource.
new ModuleNotFoundPlugin(paths.appPath),
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
// It is absolutely essential that NODE_ENV is set to production
// during a production build.
// Otherwise React will be compiled in the very slow development mode.
new webpack.DefinePlugin(env.stringified),
// This is necessary to emit hot updates (currently CSS only):
isEnvDevelopment && new webpack.HotModuleReplacementPlugin(),
// Watcher doesn't work well if you mistype casing in a path so we use
// a plugin that prints an error when you attempt to do this.
// See https://github.com/facebook/create-react-app/issues/240
isEnvDevelopment && new CaseSensitivePathsPlugin(),
// If you require a missing module and then `npm install` it, you still have
// to restart the development server for webpack to discover it. This plugin
// makes the discovery automatic so you don't have to restart.
// See https://github.com/facebook/create-react-app/issues/186
isEnvDevelopment &&
new WatchMissingNodeModulesPlugin(paths.appNodeModules),
isEnvProduction &&
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: 'static/css/[name].[contenthash:8].css',
chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
}),
// Generate an asset manifest file with the following content:
// - "files" key: Mapping of all asset filenames to their corresponding
// output file so that tools can pick it up without having to parse
// `index.html`
// - "entrypoints" key: Array of files which are included in `index.html`,
// can be used to reconstruct the HTML if necessary
new ManifestPlugin({
fileName: 'asset-manifest.json',
publicPath: paths.publicUrlOrPath,
generate: (seed, files, entrypoints) => {
const manifestFiles = files.reduce((manifest, file) => {
manifest[file.name] = file.path;
return manifest;
}, seed);
const entrypointFiles = entrypoints.main.filter(
fileName => !fileName.endsWith('.map')
);
return {
files: manifestFiles,
entrypoints: entrypointFiles,
};
},
}),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how webpack interprets its code. This is a practical
// solution that requires the user to opt into importing specific locales.
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
// You can remove this if you don't use Moment.js:
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
// Generate a service worker script that will precache, and keep up to date,
// the HTML & assets that are part of the webpack build.
isEnvProduction &&
new WorkboxWebpackPlugin.GenerateSW({
clientsClaim: true,
exclude: [/\.map$/, /asset-manifest\.json$/],
importWorkboxFrom: 'cdn',
navigateFallback: paths.publicUrlOrPath + 'index.html',
navigateFallbackBlacklist: [
// Exclude URLs starting with /_, as they're likely an API call
new RegExp('^/_'),
// Exclude any URLs whose last part seems to be a file extension
// as they're likely a resource and not a SPA route.
// URLs containing a "?" character won't be blacklisted as they're likely
// a route with query params (e.g. auth callbacks).
new RegExp('/[^/?]+\\.[^/]+$'),
],
}),
// TypeScript type checking
useTypeScript &&
new ForkTsCheckerWebpackPlugin({
typescript: resolve.sync('typescript', {
basedir: paths.appNodeModules,
}),
async: isEnvDevelopment,
useTypescriptIncrementalApi: true,
checkSyntacticErrors: true,
resolveModuleNameModule: process.versions.pnp
? `${__dirname}/pnpTs.js`
: undefined,
resolveTypeReferenceDirectiveModule: process.versions.pnp
? `${__dirname}/pnpTs.js`
: undefined,
tsconfig: paths.appTsConfig,
reportFiles: [
'**',
'!**/__tests__/**',
'!**/?(*.)(spec|test).*',
'!**/src/setupProxy.*',
'!**/src/setupTests.*',
],
silent: true,
// The formatter is invoked directly in WebpackDevServerUtils during development
formatter: isEnvProduction ? typescriptFormatter : undefined,
}),
].filter(Boolean),
// Some libraries import Node modules but don't use them in the browser.
// Tell webpack to provide empty mocks for them so importing them works.
node: {
module: 'empty',
dgram: 'empty',
dns: 'mock',
fs: 'empty',
http2: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty',
},
// Turn off performance processing because we utilize
// our own hints via the FileSizeReporter
performance: false,
};
};
'use strict';
const fs = require('fs');
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware');
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
const ignoredFiles = require('react-dev-utils/ignoredFiles');
const redirectServedPath = require('react-dev-utils/redirectServedPathMiddleware');
const paths = require('./paths');
const getHttpsConfig = require('./getHttpsConfig');
const host = process.env.HOST || '0.0.0.0';
const sockHost = process.env.WDS_SOCKET_HOST;
const sockPath = process.env.WDS_SOCKET_PATH; // default: '/sockjs-node'
const sockPort = process.env.WDS_SOCKET_PORT;
module.exports = function(proxy, allowedHost) {
return {
// WebpackDevServer 2.4.3 introduced a security fix that prevents remote
// websites from potentially accessing local content through DNS rebinding:
// https://github.com/webpack/webpack-dev-server/issues/887
// https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
// However, it made several existing use cases such as development in cloud
// environment or subdomains in development significantly more complicated:
// https://github.com/facebook/create-react-app/issues/2271
// https://github.com/facebook/create-react-app/issues/2233
// While we're investigating better solutions, for now we will take a
// compromise. Since our WDS configuration only serves files in the `public`
// folder we won't consider accessing them a vulnerability. However, if you
// use the `proxy` feature, it gets more dangerous because it can expose
// remote code execution vulnerabilities in backends like Django and Rails.
// So we will disable the host check normally, but enable it if you have
// specified the `proxy` setting. Finally, we let you override it if you
// really know what you're doing with a special environment variable.
disableHostCheck:
!proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true',
// Enable gzip compression of generated files.
compress: true,
// Silence WebpackDevServer's own logs since they're generally not useful.
// It will still show compile warnings and errors with this setting.
clientLogLevel: 'none',
// By default WebpackDevServer serves physical files from current directory
// in addition to all the virtual build products that it serves from memory.
// This is confusing because those files won’t automatically be available in
// production build folder unless we copy them. However, copying the whole
// project directory is dangerous because we may expose sensitive files.
// Instead, we establish a convention that only files in `public` directory
// get served. Our build script will copy `public` into the `build` folder.
// In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:
// <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
// In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
// Note that we only recommend to use `public` folder as an escape hatch
// for files like `favicon.ico`, `manifest.json`, and libraries that are
// for some reason broken when imported through webpack. If you just want to
// use an image, put it in `src` and `import` it from JavaScript instead.
contentBase: paths.appPublic,
contentBasePublicPath: paths.publicUrlOrPath,
// By default files from `contentBase` will not trigger a page reload.
watchContentBase: true,
// Enable hot reloading server. It will provide WDS_SOCKET_PATH endpoint
// for the WebpackDevServer client so it can learn when the files were
// updated. The WebpackDevServer client is included as an entry point
// in the webpack development configuration. Note that only changes
// to CSS are currently hot reloaded. JS changes will refresh the browser.
hot: true,
// Use 'ws' instead of 'sockjs-node' on server since we're using native
// websockets in `webpackHotDevClient`.
transportMode: 'ws',
// Prevent a WS client from getting injected as we're already including
// `webpackHotDevClient`.
injectClient: false,
// Enable custom sockjs pathname for websocket connection to hot reloading server.
// Enable custom sockjs hostname, pathname and port for websocket connection
// to hot reloading server.
sockHost,
sockPath,
sockPort,
// It is important to tell WebpackDevServer to use the same "publicPath" path as
// we specified in the webpack config. When homepage is '.', default to serving
// from the root.
// remove last slash so user can land on `/test` instead of `/test/`
publicPath: paths.publicUrlOrPath.slice(0, -1),
// WebpackDevServer is noisy by default so we emit custom message instead
// by listening to the compiler events with `compiler.hooks[...].tap` calls above.
quiet: true,
// Reportedly, this avoids CPU overload on some systems.
// https://github.com/facebook/create-react-app/issues/293
// src/node_modules is not ignored to support absolute imports
// https://github.com/facebook/create-react-app/issues/1065
watchOptions: {
ignored: ignoredFiles(paths.appSrc),
},
https: getHttpsConfig(),
host,
overlay: false,
headers: {
'Access-Control-Allow-Origin': '*'
},
historyApiFallback: {
// Paths with dots should still use the history fallback.
// See https://github.com/facebook/create-react-app/issues/387.
disableDotRule: true,
index: paths.publicUrlOrPath,
},
public: allowedHost,
// `proxy` is run between `before` and `after` `webpack-dev-server` hooks
proxy,
before(app, server) {
// Keep `evalSourceMapMiddleware` and `errorOverlayMiddleware`
// middlewares before `redirectServedPath` otherwise will not have any effect
// This lets us fetch source contents from webpack for the error overlay
app.use(evalSourceMapMiddleware(server));
// This lets us open files from the runtime error overlay.
app.use(errorOverlayMiddleware());
if (fs.existsSync(paths.proxySetup)) {
// This registers user provided middleware for proxy reasons
require(paths.proxySetup)(app);
}
},
after(app) {
// Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
app.use(redirectServedPath(paths.publicUrlOrPath));
// This service worker file is effectively a 'no-op' that will reset any
// previous service worker registered for the same host:port combination.
// We do this in development to avoid hitting the production cache if
// it used the same host and port.
// https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath));
},
};
};
{
"files": {
"main.css": "./static/css/main.9d619ca9.chunk.css",
"main.js": "./static/js/main.f0daf0a1.chunk.js",
"main.js.map": "./static/js/main.f0daf0a1.chunk.js.map",
"runtime-main.js": "./static/js/runtime-main.92b18eb7.js",
"runtime-main.js.map": "./static/js/runtime-main.92b18eb7.js.map",
"static/css/2.781455bf.chunk.css": "./static/css/2.781455bf.chunk.css",
"static/js/2.78b55eb5.chunk.js": "./static/js/2.78b55eb5.chunk.js",
"static/js/2.78b55eb5.chunk.js.map": "./static/js/2.78b55eb5.chunk.js.map",
"index.html": "./index.html",
"precache-manifest.608c6b753287828e5b320c9cea320eb2.js": "./precache-manifest.608c6b753287828e5b320c9cea320eb2.js",
"service-worker.js": "./service-worker.js",
"static/css/2.781455bf.chunk.css.map": "./static/css/2.781455bf.chunk.css.map",
"static/css/main.9d619ca9.chunk.css.map": "./static/css/main.9d619ca9.chunk.css.map",
"static/js/2.78b55eb5.chunk.js.LICENSE.txt": "./static/js/2.78b55eb5.chunk.js.LICENSE.txt"
},
"entrypoints": [
"static/js/runtime-main.92b18eb7.js",
"static/css/2.781455bf.chunk.css",
"static/js/2.78b55eb5.chunk.js",
"static/css/main.9d619ca9.chunk.css",
"static/js/main.f0daf0a1.chunk.js"
]
}
\ No newline at end of file
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="manifest" href="./manifest.json"/><title>React App</title><script type="text/javascript" src="https://image.xiaomaiketang.com/xm/PhotoClip.js"></script><link href="./static/css/2.781455bf.chunk.css" rel="stylesheet"><link href="./static/css/main.9d619ca9.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,l,a=r[0],c=r[1],f=r[2],p=0,s=[];p<a.length;p++)l=a[p],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(i&&i(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var c=t[a];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="./";var a=this.webpackJsonp_cloudclass=this.webpackJsonp_cloudclass||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var f=0;f<a.length;f++)r(a[f]);var i=c;t()}([])</script><script src="./static/js/2.78b55eb5.chunk.js"></script><script src="./static/js/main.f0daf0a1.chunk.js"></script></body></html>
\ No newline at end of file
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "14c27cadc75a21ddf21673fb27143a39",
"url": "./index.html"
},
{
"revision": "6fd175c303b4f0744c7b",
"url": "./static/css/2.781455bf.chunk.css"
},
{
"revision": "a32e318eb8839b913662",
"url": "./static/css/main.9d619ca9.chunk.css"
},
{
"revision": "6fd175c303b4f0744c7b",
"url": "./static/js/2.78b55eb5.chunk.js"
},
{
"revision": "6083d9c769f39b252a49c0c719a4b64c",
"url": "./static/js/2.78b55eb5.chunk.js.LICENSE.txt"
},
{
"revision": "a32e318eb8839b913662",
"url": "./static/js/main.f0daf0a1.chunk.js"
},
{
"revision": "1adbb2ea27cf985e253b",
"url": "./static/js/runtime-main.92b18eb7.js"
}
]);
\ No newline at end of file
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
/**
* Welcome to your Workbox-powered service worker!
*
* You'll need to register this file in your web app and you should
* disable HTTP caching for this file too.
* See https://goo.gl/nhQhGp
*
* The rest of the code is auto-generated. Please don't update this file
* directly; instead, make changes to your Workbox build configuration
* and re-run your build process.
* See https://goo.gl/2aRDsh
*/
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
importScripts(
"./precache-manifest.608c6b753287828e5b320c9cea320eb2.js"
);
self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'SKIP_WAITING') {
self.skipWaiting();
}
});
workbox.core.clientsClaim();
/**
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
* requests for URLs in the manifest.
* See https://goo.gl/S9QRab
*/
self.__precacheManifest = [].concat(self.__precacheManifest || []);
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("./index.html"), {
blacklist: [/^\/_/,/\/[^/?]+\.[^/]+$/],
});
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
*{margin:0;padding:0;box-sizing:border-box}.ant-layout-content{height:100vh;padding:16px;background-color:#f0f2f5}.page-body{background:#fff;padding:16px;margin-top:16px}.video-course .operate{display:flex}.video-course .operate__item{color:#ff7519;cursor:pointer}.video-course .operate__item.split{margin:0 8px}
/*# sourceMappingURL=main.9d619ca9.chunk.css.map */
\ No newline at end of file
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAOA,EACE,QAAA,CACA,SAAA,CACA,qBACF,CAQA,oBACE,YAAA,CACA,YAAA,CACA,wBACF,CACA,WACE,eAAA,CACA,YAAA,CACA,eACF,CA5BA,uBACE,YACF,CACA,6BACE,aAAA,CACA,cACF,CACA,mCACE,YACF","file":"main.9d619ca9.chunk.css","sourcesContent":[".video-course .operate {\n display: flex;\n}\n.video-course .operate__item {\n color: #FF7519;\n cursor: pointer;\n}\n.video-course .operate__item.split {\n margin: 0 8px;\n}\n"]}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/** @license React v0.19.1
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.14.0
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.14.0
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
//! moment.js
This source diff could not be displayed because it is too large. You can view the blob instead.
!function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports.cloudclass=t():e.cloudclass=t()}(this,(function(){return(this.webpackJsonp_cloudclass=this.webpackJsonp_cloudclass||[]).push([[0],{120:function(e,t,n){},177:function(e,t,n){e.exports=n(350)},243:function(e,t,n){},350:function(e,t,n){"use strict";n.r(t),n.d(t,"bootstrap",(function(){return V})),n.d(t,"mount",(function(){return z})),n.d(t,"unmount",(function(){return G})),n.d(t,"update",(function(){return D}));var a=n(34),o=n.n(a),c=n(69),r=n(0),u=n.n(r),s=n(4),i=n.n(s),l=n(112),p=n(17),d=n(25),m=n(174),f=n(172),h=n(21),v=n(22),y=window.localStorage,b=new(function(){function e(){Object(h.a)(this,e)}return Object(v.a)(e,[{key:"supportLocalStorage",value:function(){return!!y}},{key:"get",value:function(e){if(this.supportLocalStorage())return y.getItem(e)}},{key:"set",value:function(e,t){this.supportLocalStorage()&&y.setItem(e,t)}},{key:"setObj",value:function(e,t){this.supportLocalStorage()&&y.setItem(e,JSON.stringify(t))}},{key:"getObj",value:function(e){var t=null;if(this.supportLocalStorage()){var n=y.getItem(e);try{n&&(t=JSON.parse(n))}catch(a){t=n}}return t}},{key:"remove",value:function(e){this.supportLocalStorage()&&y.removeItem(e)}},{key:"clear",value:function(){this.supportLocalStorage()&&y.clear()}}]),e}()),g="xiaomai",k="https://dev-heimdall.xiaomai5.com/",j=(n(183),n(120),n(40)),O=n(39),w=n(16),E=n(351),N=n(173),_=n(352),I=n(162),S=n.n(I),x=n(353),C=new(function(){function e(){Object(h.a)(this,e)}return Object(v.a)(e,[{key:"getUid",value:function(){return b.get("".concat(g,"_uid"))||"1115167164014264433"}},{key:"getAid",value:function(){return b.get("".concat(g,"_aid"))||"1298172751712686082"}},{key:"getTid",value:function(){return b.get("".concat(g,"_tid"))||"1298172751712686082"}},{key:"getCid",value:function(){return b.get("".concat(g,"_cid"))}},{key:"getToken",value:function(){return b.get("".concat(g,"_token"))||"f24733242f634815a30184dfa5edf9b6"}}]),e}()),T=function(){function e(){Object(h.a)(this,e)}return Object(v.a)(e,null,[{key:"post",value:function(e,t,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{requestType:"json"},o="".concat(t,"?p=w&v=v").concat("5.4.8","&userType=").concat("B","&token=").concat(C.getToken(),"&uid=").concat(C.getUid(),"&tid=").concat(C.getTid(),"&aid=").concat(C.getAid());return new Promise((function(t,c){var r=window,u=r.NewVersion,s=r.currentUserInstInfo.instId,i=S.a.create({timeout:2e4,responseType:"json",headers:{instId:s,p:"w",v:"VERSION",vn:"v".concat("5.4.8"),project:"xmzj-web-b",userType:"B",cid:C.getCid(),uid:C.getUid(),tid:C.getTid(),token:C.getToken(),bizAccountId:C.getAid(),xmVersion:u?"5.0":"4.0","Content-Type":"json"===a.requestType?"application/json; charset=UTF-8":"application/x-www-form-urlencoded"}});"GET"!==e&&"form"===a.requestType&&(i.defaults.transformRequest=[function(e){var t="",n=Object.keys(e);return n.forEach((function(a,o){o<n.length-1?t+="".concat(encodeURIComponent(a),"=").concat(encodeURIComponent(e[a]),"&"):t+="".concat(encodeURIComponent(a),"=").concat(encodeURIComponent(e[a]))})),t.replace(/&$/,""),t}]),i.interceptors.request.use((function(e){return e}),(function(e){return Promise.reject(e)})),i.interceptors.response.use((function(e){var t=e.data,n=t.message,a=t.success,o=t.resultMsg,c=t.resultCode;return a||0===c?e:(x.a.error(n||o),Promise.reject(e.data))}),(function(e){return x.a.error(e.message),Promise.reject(e.message)})),i("GET"===e?Object.assign({params:n,url:"".concat(k).concat(o),method:e}):Object.assign({data:n,url:"".concat(k).concat(o),method:e})).then((function(e){t(e.data)})).catch((function(e){c(e)}))}))}}]),e}(),L=function(){function e(){Object(h.a)(this,e)}return Object(v.a)(e,null,[{key:"Business",value:function(e,t,n){return T.post("POST","business/".concat(e),t,n)}},{key:"Apollo",value:function(e,t,n){return T.post("POST","apollo/".concat(e),t,n)}},{key:"Sales",value:function(e,t,n){return T.post("POST","sales/".concat(e),t,n)}},{key:"post",value:function(e,t,n){return T.post("POST",e,t,n)}}]),e}(),U=(n(243),[{key:"cloudClass",name:"\u4e91\u8bfe\u5802",routes:[{key:"video_course",name:"\u89c6\u9891\u8bfe",path:"/cloudclass/video_course",component:function(e){Object(j.a)(n,e);var t=Object(O.a)(n);function n(e){var a;Object(h.a)(this,n),(a=t.call(this,e)).parseColumns=function(){return[{title:"\u89c6\u9891\u8bfe",key:"scheduleName",dataIndex:"scheduleName",width:"25%"},{title:"\u5b66\u5458\u4eba\u6570",key:"stuNum",dataIndex:"stuNum"},{title:"\u521b\u5efa\u4eba",key:"teacherName",dataIndex:"teacherName"},{title:"\u64cd\u4f5c",key:"operate",dataIndex:"operate",render:function(e,t){return u.a.createElement("div",{className:"operate"},u.a.createElement("div",{className:"operate__item"},"\u5206\u4eab"),u.a.createElement("span",{className:"operate__item split"}," | "),u.a.createElement("div",{className:"operate__item"},"\u7f16\u8f91"),u.a.createElement("span",{className:"operate__item split"}," | "),u.a.createElement("div",{className:"operate__item"},"\u5220\u9664"))}}]},a.handleFetchVideoCourseList=function(){L.Apollo("public/apollo/lessonScheduleListPage",a.state.query).then((function(e){var t=e.result,n=(void 0===t?{}:t).records,o=void 0===n?[]:n;a.setState({dataSource:o})}))};var o=window.currentUserInstInfo.instId;return a.state={query:{instId:o,size:10,current:1},dataSource:[]},a}return Object(v.a)(n,[{key:"componentDidMount",value:function(){this.handleFetchVideoCourseList()}},{key:"render",value:function(){var e=this.state.dataSource;return u.a.createElement("div",{className:"video-course"},u.a.createElement("div",{className:"page-header"},"\u89c6\u9891\u8bfe"),u.a.createElement("div",{className:"page-body"},u.a.createElement(_.a,{rowKey:function(e){return e.id},dataSource:e,columns:this.parseColumns()})))}}]),n}(u.a.Component)},{key:"prepare_lesson",name:"\u8d44\u6599\u4e91\u76d8",path:"/cloudclass/prepare_lesson",component:function(e){Object(j.a)(n,e);var t=Object(O.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={},a}return Object(v.a)(n,[{key:"render",value:function(){return u.a.createElement("div",{className:"prepare-lesson-page page"},u.a.createElement("div",{className:"content-header"},"\u8d44\u6599\u4e91\u76d8"),u.a.createElement("div",{className:"box content-body"}))}}]),n}(u.a.Component)},{key:"test",name:"\u9875\u9762\u6d4b\u8bd5",path:"/cloudclass/test",component:function(e){Object(j.a)(n,e);var t=Object(O.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={},a}return Object(v.a)(n,[{key:"render",value:function(){return u.a.createElement("div",{className:"prepare-lesson-page page"},u.a.createElement("div",{className:"content-header"},"\u6d4b\u8bd5"),u.a.createElement("div",{className:"box content-body"},"\u6d4b\u8bd5\u5185\u5bb9"))}}]),n}(u.a.Component)}]}].map((function(e){return e.routes||[]})).reduce((function(e,t){return e.concat.apply(e,Object(N.a)(t))}))),P=E.a.Content,B=function(e){Object(j.a)(n,e);var t=Object(O.a)(n);function n(){return Object(h.a)(this,n),t.apply(this,arguments)}return Object(v.a)(n,[{key:"render",value:function(){return u.a.createElement("div",{className:"app"},u.a.createElement("div",{className:"content__body"},u.a.createElement(P,null,U.map((function(e){return u.a.createElement(w.a,{key:e.path,component:e.component,path:e.path,exact:e.exact})})))))}}]),n}(u.a.Component),q=Object(d.b)();window.RCHistory=f.a.extend({},q,{push:function(e){q.push(e)},pushState:function(e){q.push(e)},pushStateWithStatus:function(e){q.push(e)},goBack:q.goBack,location:q.location,replace:function(e){q.replace(e)}});var A=function(e){var t=e.verifyInfo;R(t)},R=function(e){var t=e.aid,n=e.tid,a=e.uid,o=e.cid,c=e.token;b.set("".concat(g,"_aid"),t),b.set("".concat(g,"_tid"),n),b.set("".concat(g,"_uid"),a),b.set("".concat(g,"_cid"),o),b.set("".concat(g,"_token"),c)};function V(){return J.apply(this,arguments)}function J(){return(J=Object(c.a)(o.a.mark((function e(){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("react app bootstraped");case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function z(e){return F.apply(this,arguments)}function F(){return(F=Object(c.a)(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:A(t),i.a.render(u.a.createElement(l.a,q,u.a.createElement(p.a,{locale:m.a},u.a.createElement(B,null))),document.getElementById("root"));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function G(){return M.apply(this,arguments)}function M(){return(M=Object(c.a)(o.a.mark((function e(){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:document.getElementById("root")&&i.a.unmountComponentAtNode(document.getElementById("root"));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e){return H.apply(this,arguments)}function H(){return(H=Object(c.a)(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("update props",t);case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}}},[[177,1,2]]])}));
//# sourceMappingURL=main.f0daf0a1.chunk.js.map
\ No newline at end of file
{"version":3,"sources":["../webpack/universalModuleDefinition","common/js/storage.ts","domains/basic-domain/constants.ts","common/js/user.ts","common/js/axios.ts","common/js/service.ts","routes/index.tsx","routes/config/cloudClass.tsx","modules/video-course/index.jsx","modules/class-book/index.jsx","modules/test/index.jsx","App.tsx","index.tsx"],"names":["root","factory","exports","module","define","amd","this","LS","window","localStorage","key","supportLocalStorage","getItem","value","setItem","obj","JSON","stringify","LSItem","parse","error","removeItem","clear","PREFIX","BASIC_HOST","Storage","get","Axios","method","url","params","options","requestType","_url","User","getToken","getUid","getTid","getAid","Promise","resolve","reject","NewVersion","instId","currentUserInstInfo","instance","axios","create","timeout","responseType","headers","p","v","vn","project","userType","cid","getCid","uid","tid","token","bizAccountId","xmVersion","defaults","transformRequest","queryParam","ret","queryKeys","Object","keys","forEach","item","index","length","encodeURIComponent","replace","interceptors","request","use","config","response","data","ResMessage","message","success","resultMsg","resultCode","assign","then","res","catch","Service","option","post","allRoutes","name","routes","path","component","props","parseColumns","title","dataIndex","width","render","val","record","className","handleFetchVideoCourseList","Apollo","state","query","result","records","setState","dataSource","size","current","rowKey","id","columns","React","Component","map","reduce","prev","next","concat","Content","Layout","App","route","exact","history","createHashHistory","RCHistory","_","extend","push","pushState","pushStateWithStatus","goBack","location","mergeWindowProps","superProps","verifyInfo","storeVerifyInfo","aid","set","bootstrap","a","console","log","mount","ReactDOM","locale","zh_CN","document","getElementById","unmount","unmountComponentAtNode","update"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,kBAAZC,SAA0C,kBAAXC,OACxCA,OAAOD,QAAUD,IACQ,oBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,kBAAZC,QACdA,QAAoB,WAAID,IAExBD,EAAiB,WAAIC,IARvB,CASGK,MAAM,WACT,O,2dCCMC,EAAcC,OAAOC,aAsDZ,M,8GAjDX,QAASF,I,0BAGPG,GACF,GAAIJ,KAAKK,sBACP,OAAOJ,EAAGK,QAAQF,K,0BAIlBA,EAAaG,GACXP,KAAKK,uBACPJ,EAAGO,QAAQJ,EAAKG,K,6BAIbH,EAAaK,GACdT,KAAKK,uBACPJ,EAAGO,QAAQJ,EAAKM,KAAKC,UAAUF,M,6BAI5BL,GACL,IAAIG,EAAuB,KAC3B,GAAIP,KAAKK,sBAAuB,CAC9B,IAAMO,EAASX,EAAGK,QAAQF,GAC1B,IACMQ,IACFL,EAAQG,KAAKG,MAAMD,IAErB,MAAOE,GACPP,EAAQK,GAGZ,OAAOL,I,6BAGFH,GACDJ,KAAKK,uBACPJ,EAAGc,WAAWX,K,8BAKZJ,KAAKK,uBACPJ,EAAGe,Y,MClCIC,EAAS,UAETC,EAdN,qC,8FCqBQ,M,iGApBX,OAAOC,EAAQC,IAAR,UAAeH,EAAf,UAAgC,wB,+BAIvC,OAAOE,EAAQC,IAAR,UAAeH,EAAf,UAAgC,wB,+BAIvC,OAAOE,EAAQC,IAAR,UAAeH,EAAf,UAAgC,wB,+BAIvC,OAAOE,EAAQC,IAAR,UAAeH,EAAf,W,iCAIP,OAAOE,EAAQC,IAAR,UAAeH,EAAf,YAAkC,uC,MC8E9BI,E,kGAhFXC,EACAC,EACAC,GAEe,IADfC,EACc,uDADU,CAAEC,YAAa,QAEjCC,EAAI,UAAMJ,EAAN,mBFTS,QEST,qBFXmB,IEWnB,kBAA2DK,EAAKC,WAAhE,gBAAkFD,EAAKE,SAAvF,gBAAuGF,EAAKG,SAA5G,gBAA4HH,EAAKI,UAC3I,OAAO,IAAIC,SAAQ,SAACC,EAASC,GAAY,IAAD,EACMjC,OAApCkC,EAD8B,EAC9BA,WACAC,EAF8B,EAClBC,oBACZD,OAEFE,EAA0BC,IAAMC,OAAO,CAC3CC,QFlBwB,IEmBxBC,aAAc,OACdC,QAAS,CACPP,SACAQ,EAAG,IACHC,EAAG,UACHC,GAAG,IAAD,OFrBW,SEsBbC,QFvBa,aEwBbC,SFzBuB,IE0BvBC,IAAKtB,EAAKuB,SACVC,IAAKxB,EAAKE,SACVuB,IAAKzB,EAAKG,SACVuB,MAAO1B,EAAKC,WACZ0B,aAAc3B,EAAKI,SACnBwB,UAAWpB,EAAa,MAAQ,MAChC,eAAwC,SAAxBX,EAAQC,YAAyB,kCAAoC,uCAI1E,QAAXJ,GAA4C,SAAxBG,EAAQC,cAC9Ba,EAASkB,SAASC,iBAAmB,CAAC,SAACC,GACrC,IAAIC,EAAc,GACZC,EAAYC,OAAOC,KAAKJ,GAS9B,OARAE,EAAUG,SAAQ,SAACC,EAAcC,GAC3BA,EAAQL,EAAUM,OAAS,EAC7BP,GAAG,UAAOQ,mBAAmBH,GAA1B,YAAmCG,mBAAmBT,EAAWM,IAAjE,KAEHL,GAAG,UAAOQ,mBAAmBH,GAA1B,YAAmCG,mBAAmBT,EAAWM,QAGxEL,EAAIS,QAAQ,KAAM,IACXT,KAIXrB,EAAS+B,aAAaC,QAAQC,KAAI,SAACC,GACjC,OAAOA,KACN,SAAC3D,GACF,OAAOmB,QAAQE,OAAOrB,MAGxByB,EAAS+B,aAAaI,SAASF,KAAI,SAACE,GAA2D,IAAD,EAC5BA,EAASC,KAAxDC,EAD2E,EACpFC,QAAqBC,EAD+D,EAC/DA,QAASC,EADsD,EACtDA,UAAWC,EAD2C,EAC3CA,WACjD,OAAIF,GAA0B,IAAfE,EACNN,GAETG,IAAQ/D,MAAM8D,GAAcG,GACrB9C,QAAQE,OAAOuC,EAASC,UAC9B,SAAC7D,GAEF,OADA+D,IAAQ/D,MAAMA,EAAM+D,SACb5C,QAAQE,OAAOrB,EAAM+D,YAU9BtC,EANe,QAAXjB,EACOwC,OAAOmB,OAAO,CAAEzD,SAAQD,IAAI,GAAD,OAAKL,GAAL,OAAkBS,GAAQL,WAErDwC,OAAOmB,OAAO,CAAEN,KAAMnD,EAAQD,IAAI,GAAD,OAAKL,GAAL,OAAkBS,GAAQL,YAGrD4D,MAAK,SAACC,GACrBjD,EAAQiD,EAAIR,SACXS,OAAM,SAACtE,GACRqB,EAAOrB,a,KCzEAuE,E,sGAjBG9D,EAAaC,EAAa8D,GACxC,OAAOjE,EAAMkE,KAAK,OAAX,mBAA+BhE,GAAOC,EAAQ8D,K,6BAGzC/D,EAAaC,EAAa8D,GACtC,OAAOjE,EAAMkE,KAAK,OAAX,iBAA6BhE,GAAOC,EAAQ8D,K,4BAGxC/D,EAAaC,EAAa8D,GACrC,OAAOjE,EAAMkE,KAAK,OAAX,gBAA4BhE,GAAOC,EAAQ8D,K,2BAGxC/D,EAAaC,EAAa8D,GACpC,OAAOjE,EAAMkE,KAAK,OAAQhE,EAAKC,EAAQ8D,O,KCN5BE,G,OAT0B,CCGJ,CACnCpF,IAAK,aACLqF,KAAM,qBACNC,OAAQ,CACN,CACEtF,IAAK,eACLqF,KAAM,qBACNE,KAAM,2BACNC,U,kDCbJ,WAAYC,GAAQ,IAAD,uBACjB,cAAMA,IAiBRC,aAAe,WAmCb,MAlCgB,CACd,CACEC,MAAO,qBACP3F,IAAK,eACL4F,UAAW,eACXC,MAAO,OAET,CACEF,MAAO,2BACP3F,IAAK,SACL4F,UAAW,UAEb,CACED,MAAO,qBACP3F,IAAK,cACL4F,UAAW,eAEb,CACED,MAAO,eACP3F,IAAK,UACL4F,UAAW,UACXE,OAAQ,SAACC,EAAKC,GACZ,OACE,yBAAKC,UAAU,WACb,yBAAKA,UAAU,iBAAf,gBACA,0BAAMA,UAAU,uBAAhB,OACA,yBAAKA,UAAU,iBAAf,gBACA,0BAAMA,UAAU,uBAAhB,OACA,yBAAKA,UAAU,iBAAf,qBA/CO,EAwDnBC,2BAA6B,WAC3BjB,EAAQkB,OAAO,uCAAwC,EAAKC,MAAMC,OAC/DvB,MAAK,SAACC,GAAS,IAAD,EACWA,EAAhBuB,OADK,cACI,GADJ,GAELC,eAFK,MAEK,GAFL,EAIb,EAAKC,SAAS,CACZC,WAAYF,QA/DD,IAETtE,EAAWnC,OAAOoC,oBAAlBD,OAFS,OAIjB,EAAKmE,MAAQ,CACXC,MAAO,CACLpE,SACAyE,KAAM,GACNC,QAAS,GAEXF,WAAY,IAVG,E,gEAejB7G,KAAKsG,+B,+BAqDG,IACAO,EAAe7G,KAAKwG,MAApBK,WAER,OACE,yBAAKR,UAAU,gBACb,yBAAKA,UAAU,eAAf,sBAEA,yBAAKA,UAAU,aACb,kBAAC,IAAD,CACEW,OAAQ,SAAAZ,GAAM,OAAIA,EAAOa,IACzBJ,WAAYA,EACZK,QAASlH,KAAK8F,uB,GAjFAqB,IAAMC,YDiB5B,CACEhH,IAAK,iBACLqF,KAAM,2BACNE,KAAM,6BACNC,U,kDExBJ,WAAYC,GAAQ,IAAD,8BACjB,cAAMA,IACDW,MAAQ,GAFI,E,qDAQjB,OACE,yBAAKH,UAAU,4BACb,yBAAKA,UAAU,kBAAf,4BACA,yBAAKA,UAAU,0B,GAbSc,IAAMC,YF4BlC,CACEhH,IAAK,OACLqF,KAAM,2BACNE,KAAM,mBACNC,U,kDG9BJ,WAAYC,GAAQ,IAAD,8BACjB,cAAMA,IACDW,MAAQ,GAFI,E,qDAQjB,OACE,yBAAKH,UAAU,4BACb,yBAAKA,UAAU,kBAAf,gBACA,yBAAKA,UAAU,oBAAf,iC,GAbec,IAAMC,eJYgBC,KAAI,SAAC5C,GAChD,OAAOA,EAAOiB,QAAU,MACvB4B,QAAO,SAACC,EAAqBC,GAC9B,OAAOD,EAAKE,OAAL,MAAAF,EAAI,YAAWC,QKVhBE,EAAaC,IAAbD,QA4BOE,E,uKAvBX,OACE,yBAAKvB,UAAU,OACb,yBAAKA,UAAU,iBACb,kBAACqB,EAAD,KAEIlC,EAAU6B,KAAI,SAACQ,GACb,OACE,kBAAC,IAAD,CACEzH,IAAKyH,EAAMlC,KACXC,UAAWiC,EAAMjC,UACjBD,KAAMkC,EAAMlC,KACZmC,MAAOD,EAAMC,kB,GAdfX,IAAMC,WCkBlBW,EAAUC,cAEhB9H,OAAO+H,UAAYC,IAAEC,OAAO,GAAIJ,EAAS,CACvCK,KAAM,SAAC3H,GACLsH,EAAQK,KAAK3H,IAEf4H,UAAY,SAAC5H,GACXsH,EAAQK,KAAK3H,IAEf6H,oBAAqB,SAAC7H,GACpBsH,EAAQK,KAAK3H,IAEf8H,OAAQR,EAAQQ,OACjBC,SAAUT,EAAQS,SAClBnE,QAAS,SAAC5D,GACTsH,EAAQ1D,QAAQ5D,MAMlB,IAAMgI,EAAmB,SAACC,GAAqB,IACrCC,EAAeD,EAAfC,WACRC,EAAgBD,IAIZC,EAAkB,SAACD,GAA4B,IAC3CE,EAA8BF,EAA9BE,IAAKxF,EAAyBsF,EAAzBtF,IAAKD,EAAoBuF,EAApBvF,IAAKF,EAAeyF,EAAfzF,IAAKI,EAAUqF,EAAVrF,MAE5BnC,EAAQ2H,IAAR,UAAe7H,EAAf,QAA6B4H,GAC7B1H,EAAQ2H,IAAR,UAAe7H,EAAf,QAA6BoC,GAC7BlC,EAAQ2H,IAAR,UAAe7H,EAAf,QAA6BmC,GAC7BjC,EAAQ2H,IAAR,UAAe7H,EAAf,QAA6BiC,GAC7B/B,EAAQ2H,IAAR,UAAe7H,EAAf,UAA+BqC,IAO1B,SAAeyF,IAAtB,+B,4CAAO,sBAAAC,EAAA,sDACLC,QAAQC,IAAI,yBADP,4C,sBAMA,SAAeC,EAAtB,kC,4CAAO,WAAqBtD,GAArB,SAAAmD,EAAA,sDAGLP,EAAiB5C,GAEjBuD,IAASlD,OACP,kBAAC,IAAe6B,EACd,kBAAC,IAAD,CAAgBsB,OAAQC,KACtB,kBAAC,EAAD,QAGHC,SAASC,eAAe,SAXtB,4C,sBAgBA,SAAeC,IAAtB,+B,4CAAO,sBAAAT,EAAA,sDACDO,SAASC,eAAe,SAC1BJ,IAASM,uBAAuBH,SAASC,eAAe,SAFrD,4C,sBAQA,SAAeG,EAAtB,kC,4CAAO,WAAsB9D,GAAtB,SAAAmD,EAAA,sDACLC,QAAQC,IAAI,eAAgBrD,GADvB,4C","file":"static/js/main.f0daf0a1.chunk.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"cloudclass\"] = factory();\n\telse\n\t\troot[\"cloudclass\"] = factory();\n})(this, function() {\nreturn ","/*\r\n * @Author: 吴文洁\r\n * @Date: 2020-08-31 09:34:36\r\n * @LastEditors: 吴文洁\r\n * @LastEditTime: 2020-08-31 09:35:14\r\n * @Description: \r\n * @Copyright: 杭州杰竞科技有限公司 版权所有\r\n */\r\n\r\nimport { XMStorageImplements } from '@/domains/basic-domain/interface';\r\n\r\nconst LS: Storage = window.localStorage;\r\n\r\nclass XMStorage implements XMStorageImplements {\r\n\r\n supportLocalStorage() {\r\n return !!LS;\r\n }\r\n\r\n get(key: string) {\r\n if (this.supportLocalStorage()) {\r\n return LS.getItem(key);\r\n }\r\n }\r\n\r\n set(key: string, value: any) {\r\n if (this.supportLocalStorage()) {\r\n LS.setItem(key, value);\r\n }\r\n }\r\n\r\n setObj(key: string, obj: any) {\r\n if (this.supportLocalStorage()) {\r\n LS.setItem(key, JSON.stringify(obj));\r\n }\r\n }\r\n\r\n getObj(key: string) {\r\n let value: null | string = null;\r\n if (this.supportLocalStorage()) {\r\n const LSItem = LS.getItem(key);\r\n try {\r\n if (LSItem) {\r\n value = JSON.parse(LSItem);\r\n }\r\n } catch (error) {\r\n value = LSItem;\r\n }\r\n }\r\n return value;\r\n }\r\n\r\n remove(key: string) {\r\n if (this.supportLocalStorage()) {\r\n LS.removeItem(key);\r\n }\r\n }\r\n\r\n clear() {\r\n if (this.supportLocalStorage()) {\r\n LS.clear();\r\n }\r\n }\r\n}\r\n\r\nexport default new XMStorage();","/*\r\n * @Author: 陈剑宇\r\n * @Date: 2020-05-07 14:43:01\r\n * @LastEditTime: 2020-11-09 09:52:03\r\n * @LastEditors: 吴文洁\r\n * @Description: \r\n * @FilePath: /wheat-web-demo/src/domains/basic-domain/constants.ts\r\n */\r\nimport { MapInterface } from '@/domains/basic-domain/interface'\r\n\r\n// 默认是 dev 环境\r\nconst ENV: string = process.env.DEPLOY_ENV || 'dev';\r\n\r\nconst BASIC_HOST_MAP: MapInterface = {\r\n dev: 'https://dev-heimdall.xiaomai5.com/',\r\n dev1: 'https://dev1-heimdall.xiaomai5.com/',\r\n rc: 'https://rc-heimdall.xiaomai5.com/',\r\n gray: 'https://gray-heimdall.xiaomai5.com/',\r\n prod: 'https://gateway-heimdall.xiaomai5.com/'\r\n};\r\n\r\n// axios headers config\r\nexport const TIME_OUT: number = 20000;\r\nexport const USER_TYPE: string = 'B';\r\nexport const PROJECT = 'xmzj-web-b';\r\nexport const VERSION = '5.4.8';\r\nexport const PREFIX = 'xiaomai';\r\n// host\r\nexport const BASIC_HOST: string = BASIC_HOST_MAP[ENV];","/*\r\n * @Author: 吴文洁\r\n * @Date: 2020-08-31 09:34:25\r\n * @LastEditors: 吴文洁\r\n * @LastEditTime: 2020-08-31 09:54:34\r\n * @Description: \r\n * @Copyright: 杭州杰竞科技有限公司 版权所有\r\n */\r\n\r\nimport Storage from './storage';\r\nimport { PREFIX } from '@/domains/basic-domain/constants';\r\n\r\nclass User {\r\n \r\n getUid() {\r\n return Storage.get(`${PREFIX}_uid`) || '1115167164014264433';\r\n }\r\n\r\n getAid() {\r\n return Storage.get(`${PREFIX}_aid`) || '1298172751712686082';\r\n }\r\n\r\n getTid() {\r\n return Storage.get(`${PREFIX}_tid`) || '1298172751712686082';\r\n }\r\n\r\n getCid() {\r\n return Storage.get(`${PREFIX}_cid`);\r\n }\r\n\r\n getToken() {\r\n return Storage.get(`${PREFIX}_token`) || 'f24733242f634815a30184dfa5edf9b6';\r\n }\r\n}\r\n\r\nexport default new User();","/*\r\n * @Author: 吴文洁\r\n * @Date: 2020-08-31 09:34:31\r\n * @LastEditors: 吴文洁\r\n * @LastEditTime: 2020-08-31 09:35:36\r\n * @Description: \r\n * @Copyright: 杭州杰竞科技有限公司 版权所有\r\n */\r\n\r\nimport axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosPromise } from 'axios';\r\nimport { message } from 'antd';\r\n\r\nimport { BASIC_HOST, TIME_OUT, USER_TYPE, VERSION, PROJECT } from '@/domains/basic-domain/constants';\r\n\r\nimport User from './user';\r\n\r\ninterface FetchParams {\r\n url: string,\r\n data: any,\r\n options?: FetchOptions\r\n}\r\n\r\ninterface FetchOptions {\r\n requestType: string // 请求类型 form为表单类型 json为json类型,默认json类型\r\n}\r\n\r\nclass Axios {\r\n\r\n static post(\r\n method: string,\r\n url: string,\r\n params: any,\r\n options: FetchOptions = { requestType: 'json' }\r\n ): Promise<any> {\r\n const _url = `${url}?p=w&v=v${VERSION}&userType=${USER_TYPE}&token=${User.getToken()}&uid=${User.getUid()}&tid=${User.getTid()}&aid=${User.getAid()}`;\r\n return new Promise((resolve, reject) => {\r\n const { NewVersion, currentUserInstInfo } = window;\r\n const { instId } = currentUserInstInfo;\r\n\r\n const instance: AxiosInstance = axios.create({\r\n timeout: TIME_OUT,\r\n responseType: 'json',\r\n headers: {\r\n instId,\r\n p: 'w',\r\n v: 'VERSION',\r\n vn: `v${VERSION}`,\r\n project: PROJECT,\r\n userType: USER_TYPE,\r\n cid: User.getCid(),\r\n uid: User.getUid(),\r\n tid: User.getTid(),\r\n token: User.getToken(),\r\n bizAccountId: User.getAid(),\r\n xmVersion: NewVersion ? '5.0' : '4.0',\r\n 'Content-Type': options.requestType === 'json' ? 'application/json; charset=UTF-8' : 'application/x-www-form-urlencoded',\r\n }\r\n });\r\n \r\n if (method !== 'GET' && options.requestType === 'form') {\r\n instance.defaults.transformRequest = [(queryParam): string => {\r\n let ret: string = '';\r\n const queryKeys = Object.keys(queryParam);\r\n queryKeys.forEach((item: string, index: number): void => {\r\n if (index < queryKeys.length - 1) {\r\n ret += `${encodeURIComponent(item)}=${encodeURIComponent(queryParam[item])}&`;\r\n } else {\r\n ret += `${encodeURIComponent(item)}=${encodeURIComponent(queryParam[item])}`;\r\n }\r\n });\r\n ret.replace(/&$/, '');\r\n return ret;\r\n }]\r\n }\r\n\r\n instance.interceptors.request.use((config: AxiosRequestConfig): AxiosRequestConfig => {\r\n return config;\r\n }, (error: Error): Promise<any> => {\r\n return Promise.reject(error);\r\n })\r\n\r\n instance.interceptors.response.use((response: AxiosResponse): AxiosResponse | AxiosPromise => {\r\n const { message: ResMessage, success, resultMsg, resultCode } = response.data;\r\n if (success || resultCode === 0) {\r\n return response;\r\n }\r\n message.error(ResMessage || resultMsg);\r\n return Promise.reject(response.data);\r\n }, (error): AxiosPromise => {\r\n message.error(error.message)\r\n return Promise.reject(error.message);\r\n });\r\n\r\n let config: any;\r\n if (method === 'GET') {\r\n config = Object.assign({ params, url: `${BASIC_HOST}${_url}`, method });\r\n } else {\r\n config = Object.assign({ data: params, url: `${BASIC_HOST}${_url}`, method });\r\n }\r\n\r\n instance(config).then((res: AxiosResponse): void => {\r\n resolve(res.data);\r\n }).catch((error: Error) => {\r\n reject(error);\r\n })\r\n })\r\n }\r\n}\r\n\r\nexport default Axios;","/*\r\n * @Author: 吴文洁\r\n * @Date: 2020-08-31 09:34:51\r\n * @LastEditors: 吴文洁\r\n * @LastEditTime: 2020-08-31 09:35:25\r\n * @Description: \r\n * @Copyright: 杭州杰竞科技有限公司 版权所有\r\n */\r\n\r\nimport Axios from './axios';\r\n\r\nclass Service {\r\n\r\n static Business(url: string, params: any, option: any) {\r\n return Axios.post('POST', `business/${url}`, params, option);\r\n }\r\n\r\n static Apollo(url: string, params: any, option: any) {\r\n return Axios.post('POST', `apollo/${url}`, params, option);\r\n }\r\n\r\n static Sales(url: string, params: any, option: any) {\r\n return Axios.post('POST', `sales/${url}`, params, option);\r\n }\r\n\r\n static post(url: string, params: any, option: any) {\r\n return Axios.post('POST', url, params, option);\r\n }\r\n}\r\n\r\nexport default Service;","/*\r\n * @Author: 吴文洁\r\n * @Date: 2020-04-28 18:05:30\r\n * @LastEditors: 吴文洁\r\n * @LastEditTime: 2020-08-13 11:23:36\r\n * @Description: \r\n */\r\nimport { MenuConfig, RouteConfig } from '@/routes/interface';\r\nimport CloudClass from './config/cloudClass';\r\n\r\n// 领域路由配置\r\nexport const menuConfigs: MenuConfig[] = [ CloudClass ];\r\n\r\n/** 所有处理后的路由的集合,用于生成Route组件 */\r\nconst allRoutes: RouteConfig[] = menuConfigs.map((config: MenuConfig) => {\r\n return config.routes || [];\r\n}).reduce((prev: RouteConfig[], next: RouteConfig[]) => {\r\n return prev.concat(...next);\r\n});\r\n\r\nexport default allRoutes;\r\n","/*\r\n * @Author: 吴文洁\r\n * @Date: 2020-04-29 10:26:32\r\n * @LastEditors: 吴文洁\r\n * @LastEditTime: 2020-08-27 10:07:47\r\n * @Description: 内容线路由配置\r\n */\r\n\r\nimport { MenuConfig } from '@/routes/interface';\r\n\r\nimport VideoCourse from '@/modules/video-course';\r\nimport ClassBook from '@/modules/class-book';\r\nimport TestPage from '@/modules/test';\r\n\r\nconst CloudClassConfig: MenuConfig = {\r\n key: 'cloudClass',\r\n name: '云课堂',\r\n routes: [\r\n {\r\n key: 'video_course',\r\n name: '视频课',\r\n path: '/cloudclass/video_course',\r\n component: VideoCourse\r\n },\r\n {\r\n key: 'prepare_lesson',\r\n name: '资料云盘',\r\n path: '/cloudclass/prepare_lesson',\r\n component: ClassBook\r\n },\r\n {\r\n key: 'test',\r\n name: '页面测试',\r\n path: '/cloudclass/test',\r\n component: TestPage\r\n },\r\n ]\r\n};\r\n\r\nexport default CloudClassConfig;","import React from 'react';\r\nimport { Table } from 'antd';\r\n\r\nimport Service from '@/common/js/service';\r\n\r\nimport './index.less';\r\n\r\nclass VideoCourse extends React.Component {\r\n\r\n constructor(props) {\r\n super(props);\r\n const { instId } = window.currentUserInstInfo;\r\n\r\n this.state = {\r\n query: {\r\n instId,\r\n size: 10,\r\n current: 1,\r\n },\r\n dataSource: []\r\n }\r\n }\r\n\r\n componentDidMount() {\r\n this.handleFetchVideoCourseList();\r\n }\r\n\r\n parseColumns = () => {\r\n const columns = [\r\n {\r\n title: '视频课',\r\n key: 'scheduleName',\r\n dataIndex: 'scheduleName',\r\n width: '25%',\r\n },\r\n {\r\n title: '学员人数',\r\n key: \"stuNum\",\r\n dataIndex: \"stuNum\",\r\n },\r\n {\r\n title: '创建人',\r\n key: 'teacherName',\r\n dataIndex: 'teacherName'\r\n },\r\n {\r\n title: '操作',\r\n key: 'operate',\r\n dataIndex: 'operate',\r\n render: (val, record) => {\r\n return (\r\n <div className=\"operate\">\r\n <div className=\"operate__item\">分享</div>\r\n <span className=\"operate__item split\"> | </span>\r\n <div className=\"operate__item\">编辑</div>\r\n <span className=\"operate__item split\"> | </span>\r\n <div className=\"operate__item\">删除</div>\r\n </div>\r\n )\r\n }\r\n }\r\n ];\r\n return columns;\r\n }\r\n\r\n handleFetchVideoCourseList = () => {\r\n Service.Apollo('public/apollo/lessonScheduleListPage', this.state.query)\r\n .then((res) => {\r\n const { result = {} } = res;\r\n const { records = [] } = result;\r\n\r\n this.setState({\r\n dataSource: records\r\n })\r\n })\r\n }\r\n\r\n render() {\r\n const { dataSource } = this.state;\r\n\r\n return (\r\n <div className=\"video-course\">\r\n <div className=\"page-header\">视频课</div>\r\n\r\n <div className=\"page-body\">\r\n <Table\r\n rowKey={record => record.id}\r\n dataSource={dataSource}\r\n columns={this.parseColumns()}\r\n />\r\n </div>\r\n </div>\r\n )\r\n }\r\n}\r\n\r\nexport default VideoCourse;\r\n","import React from 'react';\r\n\r\nclass PrepareLessonPage extends React.Component {\r\n\r\n constructor(props) {\r\n super(props);\r\n this.state = {}\r\n }\r\n\r\n\r\n render() {\r\n\r\n return (\r\n <div className=\"prepare-lesson-page page\">\r\n <div className=\"content-header\">资料云盘</div>\r\n <div className=\"box content-body\">\r\n \r\n </div>\r\n </div>\r\n )\r\n }\r\n}\r\n\r\nexport default PrepareLessonPage;","import React from 'react';\r\n\r\nclass testPage extends React.Component {\r\n\r\n constructor(props) {\r\n super(props);\r\n this.state = {}\r\n }\r\n\r\n\r\n render() {\r\n\r\n return (\r\n <div className=\"prepare-lesson-page page\">\r\n <div className=\"content-header\">测试</div>\r\n <div className=\"box content-body\">\r\n 测试内容\r\n </div>\r\n </div>\r\n )\r\n }\r\n}\r\n\r\nexport default testPage;","import React from 'react';\r\nimport { Route } from 'react-router-dom';\r\nimport { Layout } from 'antd';\r\n\r\nimport allRoutes from '@/routes';\r\nimport { RouteConfig } from '@/routes/interface';\r\n\r\nconst { Content } = Layout;\r\n\r\nclass App extends React.Component {\r\n\r\n render() {\r\n return (\r\n <div className=\"app\">\r\n <div className=\"content__body\">\r\n <Content>\r\n {\r\n allRoutes.map((route: RouteConfig) => {\r\n return (\r\n <Route\r\n key={route.path}\r\n component={route.component}\r\n path={route.path}\r\n exact={route.exact}\r\n />\r\n )\r\n })\r\n }\r\n </Content>\r\n </div>\r\n </div>\r\n )\r\n }\r\n}\r\n\r\nexport default App;","/*\r\n * @Author: 吴文洁\r\n * @Date: 2020-04-27 20:35:34\r\n * @LastEditors: 吴文洁\r\n * @LastEditTime: 2020-11-09 09:43:33\r\n * @Description:\r\n */\r\n\r\nimport React from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport { HashRouter } from 'react-router-dom';\r\nimport { ConfigProvider } from 'antd';\r\nimport { createHashHistory } from 'history';\r\nimport zh_CN from 'antd/es/locale/zh_CN';\r\nimport _ from 'underscore';\r\n\r\nimport Storage from '@/common/js/storage';\r\nimport { PREFIX } from '@/domains/basic-domain/constants';\r\nimport { VerifyInfo } from '@/domains/basic-domain/interface';\r\n\r\nimport 'antd/dist/antd.less';\r\nimport '@/common/less/index.less';\r\n\r\nimport App from './App';\r\n\r\nimport '@/common/less/index.less';\r\n\r\nconst history = createHashHistory();\r\n\r\nwindow.RCHistory = _.extend({}, history, {\r\n push: (obj: any) => {\r\n history.push(obj)\r\n },\r\n pushState: (obj: any) => {\r\n history.push(obj)\r\n },\r\n pushStateWithStatus: (obj: any) => {\r\n history.push(obj)\r\n },\r\n goBack: history.goBack,\r\n\tlocation: history.location,\r\n\treplace: (obj: any) => {\r\n\t\thistory.replace(obj)\r\n\t}\r\n});\r\n\r\n\r\n// 合并父子属性\r\nconst mergeWindowProps = (superProps: any) => {\r\n const { verifyInfo } = superProps;\r\n storeVerifyInfo(verifyInfo);\r\n}\r\n\r\n// 存储身份信息\r\nconst storeVerifyInfo = (verifyInfo: VerifyInfo) => {\r\n const { aid, tid, uid, cid, token } = verifyInfo;\r\n\r\n Storage.set(`${PREFIX}_aid`, aid);\r\n Storage.set(`${PREFIX}_tid`, tid);\r\n Storage.set(`${PREFIX}_uid`, uid);\r\n Storage.set(`${PREFIX}_cid`, cid);\r\n Storage.set(`${PREFIX}_token`, token);\r\n}\r\n\r\n/**\r\n * bootstrap 只会在微应用初始化的时候调用一次,下次微应用重新进入时会直接调用 mount 钩子,不会再重复触发 bootstrap。\r\n * 通常我们可以在这里做一些全局变量的初始化,比如不会在 unmount 阶段被销毁的应用级别的缓存等。\r\n */\r\nexport async function bootstrap() {\r\n console.log('react app bootstraped');\r\n}\r\n/**\r\n * 应用每次进入都会调用 mount 方法,通常我们在这里触发应用的渲染方法\r\n */\r\nexport async function mount(props: any) {\r\n\r\n // 将父应用的window中的属性全部复制到子应用\r\n mergeWindowProps(props);\r\n\r\n ReactDOM.render((\r\n <HashRouter {...history} >\r\n <ConfigProvider locale={zh_CN}>\r\n <App />\r\n </ConfigProvider>\r\n </HashRouter>\r\n ), document.getElementById('root'));\r\n}\r\n/**\r\n * 应用每次 切出/卸载 会调用的方法,通常在这里我们会卸载微应用的应用实例\r\n */\r\nexport async function unmount() {\r\n if (document.getElementById('root')) {\r\n ReactDOM.unmountComponentAtNode(document.getElementById('root') as any);\r\n }\r\n}\r\n/**\r\n * 可选生命周期钩子,仅使用 loadMicroApp 方式加载微应用时生效\r\n */\r\nexport async function update(props: any) {\r\n console.log('update props', props);\r\n}"],"sourceRoot":""}
\ No newline at end of file
!function(e){function r(r){for(var n,l,a=r[0],c=r[1],f=r[2],p=0,s=[];p<a.length;p++)l=a[p],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(i&&i(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var c=t[a];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="./";var a=this.webpackJsonp_cloudclass=this.webpackJsonp_cloudclass||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var f=0;f<a.length;f++)r(a[f]);var i=c;t()}([]);
//# sourceMappingURL=runtime-main.92b18eb7.js.map
\ No newline at end of file
{"version":3,"sources":["../webpack/bootstrap"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","1","exports","module","l","m","c","d","name","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","p","jsonpArray","this","oldJsonpFunction","slice"],"mappings":"aACE,SAASA,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,GAIHM,EAAI,EAAGC,EAAW,GACpCD,EAAIH,EAASK,OAAQF,IACzBJ,EAAUC,EAASG,GAChBG,OAAOC,UAAUC,eAAeC,KAAKC,EAAiBX,IAAYW,EAAgBX,IACpFK,EAASO,KAAKD,EAAgBX,GAAS,IAExCW,EAAgBX,GAAW,EAE5B,IAAID,KAAYG,EACZK,OAAOC,UAAUC,eAAeC,KAAKR,EAAaH,KACpDc,EAAQd,GAAYG,EAAYH,IAKlC,IAFGe,GAAqBA,EAAoBhB,GAEtCO,EAASC,QACdD,EAASU,OAATV,GAOD,OAHAW,EAAgBJ,KAAKK,MAAMD,EAAiBb,GAAkB,IAGvDe,IAER,SAASA,IAER,IADA,IAAIC,EACIf,EAAI,EAAGA,EAAIY,EAAgBV,OAAQF,IAAK,CAG/C,IAFA,IAAIgB,EAAiBJ,EAAgBZ,GACjCiB,GAAY,EACRC,EAAI,EAAGA,EAAIF,EAAed,OAAQgB,IAAK,CAC9C,IAAIC,EAAQH,EAAeE,GACG,IAA3BX,EAAgBY,KAAcF,GAAY,GAE3CA,IACFL,EAAgBQ,OAAOpB,IAAK,GAC5Be,EAASM,EAAoBA,EAAoBC,EAAIN,EAAe,KAItE,OAAOD,EAIR,IAAIQ,EAAmB,GAKnBhB,EAAkB,CACrBiB,EAAG,GAGAZ,EAAkB,GAGtB,SAASS,EAAoB1B,GAG5B,GAAG4B,EAAiB5B,GACnB,OAAO4B,EAAiB5B,GAAU8B,QAGnC,IAAIC,EAASH,EAAiB5B,GAAY,CACzCK,EAAGL,EACHgC,GAAG,EACHF,QAAS,IAUV,OANAhB,EAAQd,GAAUW,KAAKoB,EAAOD,QAASC,EAAQA,EAAOD,QAASJ,GAG/DK,EAAOC,GAAI,EAGJD,EAAOD,QAKfJ,EAAoBO,EAAInB,EAGxBY,EAAoBQ,EAAIN,EAGxBF,EAAoBS,EAAI,SAASL,EAASM,EAAMC,GAC3CX,EAAoBY,EAAER,EAASM,IAClC5B,OAAO+B,eAAeT,EAASM,EAAM,CAAEI,YAAY,EAAMC,IAAKJ,KAKhEX,EAAoBgB,EAAI,SAASZ,GACX,qBAAXa,QAA0BA,OAAOC,aAC1CpC,OAAO+B,eAAeT,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DrC,OAAO+B,eAAeT,EAAS,aAAc,CAAEe,OAAO,KAQvDnB,EAAoBoB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQnB,EAAoBmB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,kBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKzC,OAAO0C,OAAO,MAGvB,GAFAxB,EAAoBgB,EAAEO,GACtBzC,OAAO+B,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOnB,EAAoBS,EAAEc,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRvB,EAAoB2B,EAAI,SAAStB,GAChC,IAAIM,EAASN,GAAUA,EAAOiB,WAC7B,WAAwB,OAAOjB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAL,EAAoBS,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRX,EAAoBY,EAAI,SAASgB,EAAQC,GAAY,OAAO/C,OAAOC,UAAUC,eAAeC,KAAK2C,EAAQC,IAGzG7B,EAAoB8B,EAAI,KAExB,IAAIC,EAAaC,KAA8B,wBAAIA,KAA8B,yBAAK,GAClFC,EAAmBF,EAAW5C,KAAKuC,KAAKK,GAC5CA,EAAW5C,KAAOf,EAClB2D,EAAaA,EAAWG,QACxB,IAAI,IAAIvD,EAAI,EAAGA,EAAIoD,EAAWlD,OAAQF,IAAKP,EAAqB2D,EAAWpD,IAC3E,IAAIU,EAAsB4C,EAI1BxC,I","file":"static/js/runtime-main.92b18eb7.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t1: 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"./\";\n\n \tvar jsonpArray = this[\"webpackJsonp_cloudclass\"] = this[\"webpackJsonp_cloudclass\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// run deferred modules from other chunks\n \tcheckDeferredModules();\n"],"sourceRoot":""}
\ No newline at end of file
#! /usr/bin/env node
/*
* @Author: 吴文洁
* @Date: 2020-06-05 14:59:14
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-04 19:28:08
* @Description:
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
const fs = require('fs')
const [
messageFile,
commitType,
] = process.env.HUSKY_GIT_PARAMS.split(' ');
if (commitType == null) {
const currentMessage = fs.readFileSync(messageFile, 'utf8');
// eslint-disable-next-line no-console
const pattern = new RegExp('(feat|fix|style|docs|refactor|pref|test):');
const _currentMessage = currentMessage.replace('\n', '');
if (!pattern.test(currentMessage) && currentMessage.indexOf('Merge branch') === -1) {
// eslint-disable-next-line no-console
console.error(`\x1b[31m ${_currentMessage}不符合commit-msg规范,具体规范请访问 http://wiki.ixm5.cn/pages/viewpage.action?pageId=2918494 \x1b[31m`);
process.exit(1);
}
if (_currentMessage.length <= 10) {
// eslint-disable-next-line no-console
console.error(`\x1b[31m ${_currentMessage}提交的信息字数不得少于5个字符`);
process.exit(1);
}
process.exit(0);
}
#! /usr/bin/env node
/*
* @Author: 吴文洁
* @Date: 2020-06-05 09:38:03
* @LastEditors: 吴文洁
* @LastEditTime: 2020-09-02 15:45:50
* @Description:
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
const execSync = require('child_process').execSync;
// 获取当前分支名称
const branchName = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
// 校验分支名是否合法
const firstPattern = new RegExp('dev|rc|gray|master');
const secondPattern = new RegExp('(feature|hotfix)/[a-z]{4,}/[0-9]{8,}/[a-zA-Z-]{4,}');
const firstMatch = firstPattern.test(branchName);
const secondMatch = secondPattern.test(branchName);
if (!firstMatch && !secondMatch) {
// eslint-disable-next-line no-console
console.error(`\x1b[31m ${branchName}不符合分支规范,具体规范请访问 http://wiki.ixm5.cn/pages/viewpage.action?pageId=2918496 \x1b[31m`);
process.exit(1);
}
// 获取缓存区内容
// 通过diff指令获得所有改动过(不包括删除)的js文件路径
const fileNameStr = execSync('git diff --diff-filter=AM --cached HEAD --name-only').toString();
const fileNameList = fileNameStr.split('\n').filter(item => !!item);
// 获取需要检测的文件
const detectedFileList = fileNameList.filter(file => {
// 过滤掉空的和hooks文件夹下所有的文件
return file && file.indexOf('hooks') < 0;
});
// 遍历需要检测的文件
let errorFileList = [];
detectedFileList.forEach((file) => {
const results = execSync(`git diff --cached ${file}`);
const pattern = /^http:\/\/{1,}/;
if (pattern.test(results.toString())) {
errorFileList.push(file);
}
});
if (errorFileList.length > 0) {
const errorFileStr = JSON.stringify(errorFileList);
// eslint-disable-next-line no-console
console.error(`\x1b[31m ${errorFileStr}文件中存在不合法的http://,请将http替换为https \x1b[31m`);
process.exit(1);
}
// 校验是否有冲突
const conflictPattern = new RegExp('^<<<<<<<\\s|^=======$|^>>>>>>>\\s');
const conflictFileList = [];
fileNameList.forEach((file) => {
const results = execSync(`git diff --cached ${file}`);
if (conflictPattern.test(results)) {
conflictFileList.push(file);
}
})
if (conflictFileList.length > 0) {
const conflictFileStr = JSON.stringify(conflictFileList);
// eslint-disable-next-line no-console
console.error(`\x1b[31m ${conflictFileStr}文件中存在冲突,请解决冲突之后再提交 \x1b[31m`);
process.exit(1);
}
process.exit(0);
\ No newline at end of file
{
"name": "cloudclass",
"version": "0.1.0",
"private": true,
"homepage": "./",
"dependencies": {
"@babel/core": "7.9.0",
"@babel/plugin-transform-typescript": "^7.11.0",
"@babel/preset-typescript": "^7.10.4",
"@svgr/webpack": "4.3.3",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@types/react": "^16.9.46",
"@types/react-dom": "^16.9.8",
"@types/react-router-dom": "^5.1.5",
"@types/underscore": "^1.10.22",
"@typescript-eslint/eslint-plugin": "^2.10.0",
"@typescript-eslint/parser": "^2.10.0",
"antd": "3.26.6",
"axios": "^0.20.0",
"babel-eslint": "10.1.0",
"babel-jest": "^24.9.0",
"babel-loader": "8.1.0",
"babel-plugin-jsx-control-statements": "^4.1.0",
"babel-plugin-named-asset-import": "^0.3.6",
"babel-preset-react-app": "^9.1.2",
"camelcase": "^5.3.1",
"case-sensitive-paths-webpack-plugin": "2.3.0",
"cross-env": "^7.0.2",
"css-loader": "3.4.2",
"dotenv": "8.2.0",
"dotenv-expand": "5.1.0",
"eslint": "^6.6.0",
"eslint-config-react-app": "^5.2.1",
"eslint-loader": "3.0.3",
"eslint-plugin-flowtype": "4.6.0",
"eslint-plugin-import": "2.20.1",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-jsx-control-statements": "^2.2.1",
"eslint-plugin-react": "7.19.0",
"eslint-plugin-react-hooks": "^1.6.1",
"file-loader": "4.3.0",
"fs-extra": "^8.1.0",
"html-webpack-plugin": "4.0.0-beta.11",
"husky": "^4.2.5",
"identity-obj-proxy": "3.0.0",
"jest": "24.9.0",
"jest-environment-jsdom-fourteen": "1.0.1",
"jest-resolve": "24.9.0",
"jest-watch-typeahead": "0.4.2",
"less-loader": "^6.2.0",
"microevent": "^1.0.0",
"mini-css-extract-plugin": "0.9.0",
"optimize-css-assets-webpack-plugin": "5.0.3",
"pnp-webpack-plugin": "1.6.4",
"postcss-flexbugs-fixes": "4.1.0",
"postcss-loader": "3.0.0",
"postcss-normalize": "8.0.1",
"postcss-preset-env": "6.7.0",
"postcss-safe-parser": "4.0.1",
"react": "^16.13.1",
"react-app-polyfill": "^1.0.6",
"react-dev-utils": "^10.2.1",
"react-dom": "^16.13.1",
"react-router-dom": "^5.2.0",
"resolve": "1.15.0",
"resolve-url-loader": "3.1.1",
"semver": "6.3.0",
"style-loader": "0.23.1",
"terser-webpack-plugin": "2.3.8",
"ts-pnp": "1.1.6",
"typescript": "^4.0.2",
"underscore": "^1.10.2",
"url-loader": "2.3.0",
"webpack": "4.42.0",
"webpack-dev-server": "3.11.0",
"webpack-manifest-plugin": "2.2.0",
"workbox-webpack-plugin": "4.3.1"
},
"scripts": {
"start": "node scripts/start.js",
"build:dev": "cross-env DEPLOY_ENV=dev node scripts/build.js",
"build:dev1": "cross-env DEPLOY_ENV=dev node scripts/build.js",
"build:rc": "cross-env DEPLOY_ENV=rc node scripts/build.js",
"build:gray": "cross-env DEPLOY_ENV=gray node scripts/build.js",
"build:prod": "cross-env DEPLOY_ENV=prod node scripts/build.js"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"babel": {
"presets": [
"react-app"
],
"plugins": [
"jsx-control-statements"
]
},
"husky": {
"hooks": {
"pre-commit": "node hooks/pre-commit.js",
"commit-msg": "node hooks/commit-msg.js",
"pre-push": "node hooks/pre-commit.js"
}
}
}
<!--
* @Author: 吴文洁
* @Date: 2020-08-24 12:20:57
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-27 10:10:06
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<script type="text/javascript" src="https://image.xiaomaiketang.com/xm/PhotoClip.js"></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
'use strict';
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'production';
process.env.NODE_ENV = 'production';
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});
// Ensure environment variables are read.
require('../config/env');
const path = require('path');
const chalk = require('react-dev-utils/chalk');
const fs = require('fs-extra');
const webpack = require('webpack');
const configFactory = require('../config/webpack.config');
const paths = require('../config/paths');
const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
const printHostingInstructions = require('react-dev-utils/printHostingInstructions');
const FileSizeReporter = require('react-dev-utils/FileSizeReporter');
const printBuildError = require('react-dev-utils/printBuildError');
const measureFileSizesBeforeBuild =
FileSizeReporter.measureFileSizesBeforeBuild;
const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild;
const useYarn = fs.existsSync(paths.yarnLockFile);
// These sizes are pretty large. We'll warn for bundles exceeding them.
const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
const isInteractive = process.stdout.isTTY;
// Warn and crash if required files are missing
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
process.exit(1);
}
// Generate configuration
const config = configFactory('production');
// We require that you explicitly set browsers and do not fall back to
// browserslist defaults.
const { checkBrowsers } = require('react-dev-utils/browsersHelper');
checkBrowsers(paths.appPath, isInteractive)
.then(() => {
// First, read the current file sizes in build directory.
// This lets us display how much they changed later.
return measureFileSizesBeforeBuild(paths.appBuild);
})
.then(previousFileSizes => {
// Remove all content but keep the directory so that
// if you're in it, you don't end up in Trash
fs.emptyDirSync(paths.appBuild);
// Merge with the public folder
copyPublicFolder();
// Start the webpack build
return build(previousFileSizes);
})
.then(
({ stats, previousFileSizes, warnings }) => {
if (warnings.length) {
console.log(chalk.yellow('Compiled with warnings.\n'));
console.log(warnings.join('\n\n'));
console.log(
'\nSearch for the ' +
chalk.underline(chalk.yellow('keywords')) +
' to learn more about each warning.'
);
console.log(
'To ignore, add ' +
chalk.cyan('// eslint-disable-next-line') +
' to the line before.\n'
);
} else {
console.log(chalk.green('Compiled successfully.\n'));
}
console.log('File sizes after gzip:\n');
printFileSizesAfterBuild(
stats,
previousFileSizes,
paths.appBuild,
WARN_AFTER_BUNDLE_GZIP_SIZE,
WARN_AFTER_CHUNK_GZIP_SIZE
);
console.log();
const appPackage = require(paths.appPackageJson);
const publicUrl = paths.publicUrlOrPath;
const publicPath = config.output.publicPath;
const buildFolder = path.relative(process.cwd(), paths.appBuild);
printHostingInstructions(
appPackage,
publicUrl,
publicPath,
buildFolder,
useYarn
);
},
err => {
const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
if (tscCompileOnError) {
console.log(
chalk.yellow(
'Compiled with the following type errors (you may want to check these before deploying your app):\n'
)
);
printBuildError(err);
} else {
console.log(chalk.red('Failed to compile.\n'));
printBuildError(err);
process.exit(1);
}
}
)
.catch(err => {
if (err && err.message) {
console.log(err.message);
}
process.exit(1);
});
// Create the production build and print the deployment instructions.
function build(previousFileSizes) {
// We used to support resolving modules according to `NODE_PATH`.
// This now has been deprecated in favor of jsconfig/tsconfig.json
// This lets you use absolute paths in imports inside large monorepos:
if (process.env.NODE_PATH) {
console.log(
chalk.yellow(
'Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.'
)
);
console.log();
}
console.log('Creating an optimized production build...');
const compiler = webpack(config);
return new Promise((resolve, reject) => {
compiler.run((err, stats) => {
let messages;
if (err) {
if (!err.message) {
return reject(err);
}
let errMessage = err.message;
// Add additional information for postcss errors
if (Object.prototype.hasOwnProperty.call(err, 'postcssNode')) {
errMessage +=
'\nCompileError: Begins at CSS selector ' +
err['postcssNode'].selector;
}
messages = formatWebpackMessages({
errors: [errMessage],
warnings: [],
});
} else {
messages = formatWebpackMessages(
stats.toJson({ all: false, warnings: true, errors: true })
);
}
if (messages.errors.length) {
// Only keep the first error. Others are often indicative
// of the same problem, but confuse the reader with noise.
if (messages.errors.length > 1) {
messages.errors.length = 1;
}
return reject(new Error(messages.errors.join('\n\n')));
}
if (
process.env.CI &&
(typeof process.env.CI !== 'string' ||
process.env.CI.toLowerCase() !== 'false') &&
messages.warnings.length
) {
console.log(
chalk.yellow(
'\nTreating warnings as errors because process.env.CI = true.\n' +
'Most CI servers set it automatically.\n'
)
);
return reject(new Error(messages.warnings.join('\n\n')));
}
return resolve({
stats,
previousFileSizes,
warnings: messages.warnings,
});
});
});
}
function copyPublicFolder() {
fs.copySync(paths.appPublic, paths.appBuild, {
dereference: true,
filter: file => file !== paths.appHtml,
});
}
'use strict';
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'development';
process.env.NODE_ENV = 'development';
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});
// Ensure environment variables are read.
require('../config/env');
const fs = require('fs');
const chalk = require('react-dev-utils/chalk');
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const clearConsole = require('react-dev-utils/clearConsole');
const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
const {
choosePort,
createCompiler,
prepareProxy,
prepareUrls,
} = require('react-dev-utils/WebpackDevServerUtils');
const openBrowser = require('react-dev-utils/openBrowser');
const paths = require('../config/paths');
const configFactory = require('../config/webpack.config');
const createDevServerConfig = require('../config/webpackDevServer.config');
const useYarn = fs.existsSync(paths.yarnLockFile);
const isInteractive = process.stdout.isTTY;
// Warn and crash if required files are missing
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
process.exit(1);
}
// Tools like Cloud9 rely on this.
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
const HOST = process.env.HOST || '0.0.0.0';
if (process.env.HOST) {
console.log(
chalk.cyan(
`Attempting to bind to HOST environment variable: ${chalk.yellow(
chalk.bold(process.env.HOST)
)}`
)
);
console.log(
`If this was unintentional, check that you haven't mistakenly set it in your shell.`
);
console.log(
`Learn more here: ${chalk.yellow('https://bit.ly/CRA-advanced-config')}`
);
console.log();
}
// We require that you explicitly set browsers and do not fall back to
// browserslist defaults.
const { checkBrowsers } = require('react-dev-utils/browsersHelper');
checkBrowsers(paths.appPath, isInteractive)
.then(() => {
// We attempt to use the default port but if it is busy, we offer the user to
// run on a different port. `choosePort()` Promise resolves to the next free port.
return choosePort(HOST, DEFAULT_PORT);
})
.then(port => {
if (port == null) {
// We have not found a port.
return;
}
const config = configFactory('development');
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
const appName = require(paths.appPackageJson).name;
const useTypeScript = fs.existsSync(paths.appTsConfig);
const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
const urls = prepareUrls(
protocol,
HOST,
port,
paths.publicUrlOrPath.slice(0, -1)
);
const devSocket = {
warnings: warnings =>
devServer.sockWrite(devServer.sockets, 'warnings', warnings),
errors: errors =>
devServer.sockWrite(devServer.sockets, 'errors', errors),
};
// Create a webpack compiler that is configured with custom messages.
const compiler = createCompiler({
appName,
config,
devSocket,
urls,
useYarn,
useTypeScript,
tscCompileOnError,
webpack,
});
// Load proxy config
const proxySetting = require(paths.appPackageJson).proxy;
const proxyConfig = prepareProxy(
proxySetting,
paths.appPublic,
paths.publicUrlOrPath
);
// Serve webpack assets generated by the compiler over a web server.
const serverConfig = createDevServerConfig(
proxyConfig,
urls.lanUrlForConfig
);
const devServer = new WebpackDevServer(compiler, serverConfig);
devServer.headers = {
'Access-Control-Allow-Origin': '*',
};
// Launch WebpackDevServer.
devServer.listen(port, HOST, err => {
if (err) {
return console.log(err);
}
if (isInteractive) {
clearConsole();
}
// We used to support resolving modules according to `NODE_PATH`.
// This now has been deprecated in favor of jsconfig/tsconfig.json
// This lets you use absolute paths in imports inside large monorepos:
if (process.env.NODE_PATH) {
console.log(
chalk.yellow(
'Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.'
)
);
console.log();
}
console.log(chalk.cyan('Starting the development server...\n'));
openBrowser(urls.localUrlForBrowser);
});
['SIGINT', 'SIGTERM'].forEach(function(sig) {
process.on(sig, function() {
devServer.close();
process.exit();
});
});
if (isInteractive || process.env.CI !== 'true') {
// Gracefully exit when stdin ends
process.stdin.on('end', function() {
devServer.close();
process.exit();
});
process.stdin.resume();
}
})
.catch(err => {
if (err && err.message) {
console.log(err.message);
}
process.exit(1);
});
'use strict';
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'test';
process.env.NODE_ENV = 'test';
process.env.PUBLIC_URL = '';
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});
// Ensure environment variables are read.
require('../config/env');
const jest = require('jest');
const execSync = require('child_process').execSync;
let argv = process.argv.slice(2);
function isInGitRepository() {
try {
execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' });
return true;
} catch (e) {
return false;
}
}
function isInMercurialRepository() {
try {
execSync('hg --cwd . root', { stdio: 'ignore' });
return true;
} catch (e) {
return false;
}
}
// Watch unless on CI or explicitly running all tests
if (
!process.env.CI &&
argv.indexOf('--watchAll') === -1 &&
argv.indexOf('--watchAll=false') === -1
) {
// https://github.com/facebook/create-react-app/issues/5210
const hasSourceControl = isInGitRepository() || isInMercurialRepository();
argv.push(hasSourceControl ? '--watch' : '--watchAll');
}
jest.run(argv);
/*
* @Author: 吴文洁
* @Date: 2020-08-19 18:11:13
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-31 09:50:53
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
interface Window {
[key: string]: string,
RCHistory: any,
currentUserInstInfo: {
instId: string,
teacherId?: string,
name?: string
},
Service: any
}
\ No newline at end of file
/*
* @Author: 吴文洁
* @Date: 2020-04-29 19:16:17
* @LastEditors: 吴文洁
* @LastEditTime: 2020-04-30 10:45:06
* @Description:
*/
declare var If: React.SFC<{ condition: boolean }>;
declare var For: React.SFC<{ each: string; index?: string; of: any[] }>;
declare var Choose: React.SFC;
declare var When: React.SFC<{ condition: boolean }>;
declare var Otherwise: React.SFC;
\ No newline at end of file
/*
* @Author: 吴文洁
* @Date: 2020-08-24 11:46:58
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-24 11:47:25
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
/// <reference types="node" />
/// <reference types="react" />
/// <reference types="react-dom" />
declare namespace NodeJS {
interface ProcessEnv {
readonly NODE_ENV: 'development' | 'production';
readonly PUBLIC_URL: string;
}
}
declare module '*.bmp' {
const src: string;
export default src;
}
declare module '*.gif' {
const src: string;
export default src;
}
declare module '*.jpg' {
const src: string;
export default src;
}
declare module '*.jpeg' {
const src: string;
export default src;
}
declare module '*.png' {
const src: string;
export default src;
}
declare module '*.webp' {
const src: string;
export default src;
}
declare module '*.svg' {
import * as React from 'react';
export const ReactComponent: React.FunctionComponent<React.SVGProps<
SVGSVGElement
> & { title?: string }>;
const src: string;
export default src;
}
declare module '*.module.css' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.less' {
const classes: { readonly [key: string]: string };
export default classes;
}
\ No newline at end of file
import React from 'react';
import { Route } from 'react-router-dom';
import { Layout,ConfigProvider } from 'antd';
import { RouteConfig } from '@/routes/interface';
import Header from './modules/root/Header'
import Main from './modules/root/Main'
import Menu from './modules/root/Menu'
import zhCN from 'antd/es/locale/zh_CN'
const { Content } = Layout;
class App extends React.Component {
render() {
return (
<div id="home">
<Header/>
<ConfigProvider locale={zhCN}>
<Main/>
</ConfigProvider>
<Menu/>
</div>
)
}
}
export default App;
\ No newline at end of file
/*
* @Author: 吴文洁
* @Date: 2020-08-31 09:34:31
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-31 09:35:36
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosPromise } from 'axios';
import { message } from 'antd';
import { BASIC_HOST, TIME_OUT, USER_TYPE, VERSION, PROJECT } from '@/domains/basic-domain/constants';
import User from './user';
interface FetchParams {
url: string,
data: any,
options?: FetchOptions
}
interface FetchOptions {
requestType: string // 请求类型 form为表单类型 json为json类型,默认json类型
}
class Axios {
static post(
method: string,
url: string,
params: any,
options: FetchOptions = { requestType: 'json' }
): Promise<any> {
const _url = `${url}?p=w&v=v${VERSION}&userType=${USER_TYPE}&token=${User.getToken()}&uid=${User.getUid()}&tid=${User.getTid()}&aid=${User.getAid()}`;
return new Promise((resolve, reject) => {
const { NewVersion, currentUserInstInfo } = window;
const { instId } = currentUserInstInfo;
const instance: AxiosInstance = axios.create({
timeout: TIME_OUT,
responseType: 'json',
headers: {
instId,
p: 'w',
v: 'VERSION',
vn: `v${VERSION}`,
project: PROJECT,
userType: USER_TYPE,
cid: User.getCid(),
uid: User.getUid(),
tid: User.getTid(),
token: User.getToken(),
bizAccountId: User.getAid(),
xmVersion: NewVersion ? '5.0' : '4.0',
'Content-Type': options.requestType === 'json' ? 'application/json; charset=UTF-8' : 'application/x-www-form-urlencoded',
}
});
if (method !== 'GET' && options.requestType === 'form') {
instance.defaults.transformRequest = [(queryParam): string => {
let ret: string = '';
const queryKeys = Object.keys(queryParam);
queryKeys.forEach((item: string, index: number): void => {
if (index < queryKeys.length - 1) {
ret += `${encodeURIComponent(item)}=${encodeURIComponent(queryParam[item])}&`;
} else {
ret += `${encodeURIComponent(item)}=${encodeURIComponent(queryParam[item])}`;
}
});
ret.replace(/&$/, '');
return ret;
}]
}
instance.interceptors.request.use((config: AxiosRequestConfig): AxiosRequestConfig => {
return config;
}, (error: Error): Promise<any> => {
return Promise.reject(error);
})
instance.interceptors.response.use((response: AxiosResponse): AxiosResponse | AxiosPromise => {
const { message: ResMessage, success, resultMsg, resultCode } = response.data;
if (success || resultCode === 0) {
return response;
}
message.error(ResMessage || resultMsg);
return Promise.reject(response.data);
}, (error): AxiosPromise => {
message.error(error.message)
return Promise.reject(error.message);
});
let config: any;
if (method === 'GET') {
config = Object.assign({ params, url: `${BASIC_HOST}${_url}`, method });
} else {
config = Object.assign({ data: params, url: `${BASIC_HOST}${_url}`, method });
}
instance(config).then((res: AxiosResponse): void => {
resolve(res.data);
}).catch((error: Error) => {
reject(error);
})
})
}
}
export default Axios;
\ No newline at end of file
/*
* @Author: 吴文洁
* @Date: 2020-08-31 09:34:51
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-31 09:35:25
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
import Axios from './axios';
class Service {
static Business(url: string, params: any, option: any) {
return Axios.post('POST', `business/${url}`, params, option);
}
static Apollo(url: string, params: any, option: any) {
return Axios.post('POST', `apollo/${url}`, params, option);
}
static Sales(url: string, params: any, option: any) {
return Axios.post('POST', `sales/${url}`, params, option);
}
static post(url: string, params: any, option: any) {
return Axios.post('POST', url, params, option);
}
}
export default Service;
\ No newline at end of file
/*
* @Author: 吴文洁
* @Date: 2020-08-31 09:34:36
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-31 09:35:14
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
import { XMStorageImplements } from '@/domains/basic-domain/interface';
const LS: Storage = window.localStorage;
class XMStorage implements XMStorageImplements {
supportLocalStorage() {
return !!LS;
}
get(key: string) {
if (this.supportLocalStorage()) {
return LS.getItem(key);
}
}
set(key: string, value: any) {
if (this.supportLocalStorage()) {
LS.setItem(key, value);
}
}
setObj(key: string, obj: any) {
if (this.supportLocalStorage()) {
LS.setItem(key, JSON.stringify(obj));
}
}
getObj(key: string) {
let value: null | string = null;
if (this.supportLocalStorage()) {
const LSItem = LS.getItem(key);
try {
if (LSItem) {
value = JSON.parse(LSItem);
}
} catch (error) {
value = LSItem;
}
}
return value;
}
remove(key: string) {
if (this.supportLocalStorage()) {
LS.removeItem(key);
}
}
clear() {
if (this.supportLocalStorage()) {
LS.clear();
}
}
}
export default new XMStorage();
\ No newline at end of file
/*
* @Author: 吴文洁
* @Date: 2020-08-31 09:34:25
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-31 09:54:34
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
import Storage from './storage';
import { PREFIX } from '@/domains/basic-domain/constants';
class User {
getUid() {
return Storage.get(`${PREFIX}_uid`) || '1115167164014264433';
}
getAid() {
return Storage.get(`${PREFIX}_aid`) || '1298172751712686082';
}
getTid() {
return Storage.get(`${PREFIX}_tid`) || '1298172751712686082';
}
getCid() {
return Storage.get(`${PREFIX}_cid`);
}
getToken() {
return Storage.get(`${PREFIX}_token`) || 'f24733242f634815a30184dfa5edf9b6';
}
}
export default new User();
\ No newline at end of file
/*
* @Author: 吴文洁
* @Date: 2020-04-28 19:24:31
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-31 09:46:49
* @Description: 重写antd的样式
*/
.ant-layout-content {
height: 100vh;
padding: 16px;
background-color: #F0F2F5;
}
\ No newline at end of file
@import './normalize.less';
@import './antd-override.less';
@import './variable.less';
.page-body {
background: #fff;
padding: 16px;
margin-top: 16px;
}
\ No newline at end of file
/*
* @Author: 吴文洁
* @Date: 2020-04-28 18:14:52
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-31 09:36:52
* @Description: 样式格式化
*/
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
// color
@xm-color-primary: #FF7519;
// fonst-size
@xm-font-size-m: 14px;
\ No newline at end of file
<!--
* @Author: 吴文洁
* @Date: 2020-04-29 16:55:55
* @LastEditors: 吴文洁
* @LastEditTime: 2020-04-29 17:15:09
* @Description:
-->
### 全局公用组件
**本目录的引用别名是 @/components**
\ No newline at end of file
/*
* @Author: Michael
* @Date: 2017-09-08 17:38:18
* @Last Modified by: chenshu
* @Last Modified time: 2020-08-31 14:55:30
*/
@import './variables.less';
@active-color: #ff8534;
// 消息提示框
.ant-message {
&>span {
display: block !important;
}
}
.ant-drawer-content {
.ant-drawer-title {
font-weight: normal;
}
}
.ant-steps-item .ant-steps-item-icon>.ant-steps-icon {
top: -6%;
}
.ant-calendar-month-panel {
.ant-calendar-month-panel-header {
.ant-calendar-month-panel-next-year-btn,
.ant-calendar-month-panel-prev-year-btn {
height: auto;
}
}
}
.ant-form-item-children {
display: block;
}
.ant-btn-primary {
i {
color: #fff !important;
}
span {
color: #fff !important;
}
}
.ant-switch-small:after {
top: 0.3px;
}
.ant-pagination {
display: inline !important;
.ant-pagination-jump-next {
color: #f3f3f3 !important;
}
.ant-pagination-jump-next:after {
display: inherit !important;
}
.ant-pagination-jump-prev {
color: #f3f3f3 !important;
}
.ant-pagination-jump-prev:after {
display: inherit !important;
}
}
.ant-form-item {
margin-bottom: 16px !important;
}
.ant-form-item-margin0 {
margin-bottom: 0 !important;
}
.ant-radio {
.ant-radio-inner {
width: 14px !important;
height: 14px !important;
}
.ant-radio-inner:after {
height: 8px !important;
width: 8px !important;
left: 3px !important;
top: 3px !important;
}
}
.ant-dropdown-link {
color: #5D5D5E !important;
}
.ant-table-fixed-header {
.ant-table-scroll {
.ant-table-header {
// padding-bottom: 0 !important;
}
}
}
.ant-table-bordered {
.ant-table-thead {
tr {
th {
border-bottom: none;
border-right: none !important;
}
}
}
.ant-table-tbody {
tr {
td {
border-bottom: none;
border-right: none !important;
}
td:last-child {
&.table-no-right-border {
border-right: none !important;
}
}
}
tr:last-child {
border-bottom: 1px solid #e8e8e8 !important;
}
}
}
.ant-input {
font-size: 14px !important;
}
.ant-dropdown-link {
line-height: 20px !important;
}
.ant-table-thead {
tr {
.center {
text-align: center !important;
}
}
}
.ant-time-picker-panel-select-option-disabled {
display: none;
}
.ant-select-auto-complete.ant-select .ant-select-selection--single {
height: 32px !important;
}
.ant-table {
tr {
th {
background: @xm-table-header;
color: @xm-table-head-color;
}
}
tbody {
.ant-table-row-hover {
td {
background: @xm-table-body-active !important;
}
}
tr {
background: transparent;
td {
color: @xm-table-tbody-color;
}
&:nth-child(even) {
background: @xm-table-body-even;
}
&:hover {
td {
background: @xm-table-body-active !important;
}
}
}
}
}
.ant-table-bordered {
.ant-table-body {
border: 1px solid #e8e8e8;
}
.ant-table-header>table,.ant-table-body>table {
border: none !important;
border-radius: 3px;
.icon {
color: #bfbfbf;
}
}
}
.ant-table-fixed-right .ant-table-fixed {
border-left: none !important;
border-right: 1px solid #e8e8e8 !important;
}
/* 按钮padding改成8px */
.ant-btn {
height: 28px;
font-weight: 400 !important;
padding: 0 12px !important;
// border-radius: 2px !important;
border: 1px solid #e8e8e8;
// &:hover {
// border: 1px solid #fdb089 !important;
// color: #fdb089 !important;
// }
&:focus,
:active {
border: 1px solid #ff8534 !important;
color: #ff8534 !important;
}
}
.ant-btn-loading {
padding-left:18px !important;
}
.ant-avatar {
width: 35px;
height: 35px;
line-height: 35px;
border-radius: 25px;
}
/* tab选择 */
.ant-tabs-nav .ant-tabs-tab {
padding: 8px 20px 12px !important;
font-size: 16px !important;
>span {
font-size: 16px !important;
}
}
.ant-tabs-nav .ant-tabs-tab-active {
color: @active-color !important;
}
.ant-tabs-nav.ant-tabs-nav-animated {
.ant-tabs-tab {
&:hover {
color: @active-color !important;
}
}
}
.ant-tabs-ink-bar.ant-tabs-ink-bar-animated {
background-color: inherit !important;
}
// 修改ant tab 底部滚动条
.ant-tabs-bottom .ant-tabs-ink-bar-animated,
.ant-tabs-top .ant-tabs-ink-bar-animated {
//display: none!important;
&:after {
content: '';
display: inline-block;
position: absolute;
width: 30px;
height: 2px;
background: #ff8534 !important;
left: 50%;
transform: translateX(-50%);
}
}
// 当只有一个tab的时候特殊处理
.ant-tabs.single-tab {
.ant-tabs-ink-bar {
width: 100% !important;
}
}
.ant-checkbox-wrapper+.ant-checkbox-wrapper {
margin-left: 0 !important;
}
.ant-menu {
.iconfont {
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}
}
.ant-menu-inline,
.ant-menu-vertical {
border-right: none;
}
.ant-menu-inline .ant-menu-item:after,
.ant-menu-vertical .ant-menu-item:after {
display: none;
}
.ant-menu-inline .ant-menu-item,
.ant-menu-vertical .ant-menu-item {
left: 0px;
}
.ml16 {
margin-left: 16px !important;
}
.mr16 {
margin-right: 16px !important;
}
ml0 {
margin-left: 0 !important;
}
mr0 {
margin-right: 0 !important;
}
// 下拉框颜色
.ant-dropdown-menu-item-active.ant-dropdown-menu-item:hover {
background-color: @xm-select-item-hover !important;
}
// ant badge改小
.ant-badge {
transform: translate(-8px, -8px) scale(0.7) !important;
}
.ant-input,
.ant-btn {
border-color: @xm-color-border;
}
.ant-select-selection {
border-color: @xm-color-border !important;
}
// .ant-table-body {
// .ant-select-dropdown-menu-item-selected,
// .ant-select-dropdown-menu-item-selected:hover {
// background-color: @xm-select-item-hover !important;
// }
// }
// .dropdown-active-background {
// .ant-select-dropdown-menu-item-active {
// background-color: @xm-select-item-hover !important;
// }
// }
.ant-select-dropdown-menu-item-active:not(.ant-select-dropdown-menu-item-disabled) {
background: #F3F6FA;
.ant-select-selected-icon {
color: #FE8534 !important;
}
}
.ant-select-dropdown-menu-item-selected {
background: none;
font-weight: 400 !important;
color: #FE8534;
}
.ant-btn-primary.ant-btn {
background-color: @xm-color-text-select-primary !important;
border-color: @xm-color-text-select-primary !important;
&:hover {
background-color: #fdb089 !important;
border-color: #fdb089 !important;
}
&:focus,
:active {
border: 1px solid @xm-color-text-select-primary !important;
background-color: @xm-color-text-select-primary !important;
}
span {
color: #fff !important;
}
}
.ant-select-open .ant-select-selection {
box-shadow: none;
}
.ant-tabs-bar {
border-color: @xm-color-border !important;
}
// 日历今天不要加粗
.ant-calendar-today .ant-calendar-date {
font-weight: normal !important;
}
.ant-modal-wrap {
display: flex;
align-items: center;
.ant-modal {
padding-bottom: 0;
height: auto;
top: auto;
.ant-modal-body {
max-height: 70vh;
overflow-y: auto;
padding: 24px;
}
}
}
::-webkit-scrollbar {
width: 6px;
height: 6px;
display: block;
}
::-webkit-scrollbar-thumb {
/*滚动条里面小方块*/
border-radius: 3px; // background:rgba(204,204,204,1);
background: rgba(204, 204, 204, 1);
}
.ant-modal-footer {
.ant-btn {
font-weight: normal !important;
}
}
.ant-avatar {
background: #e8e8e8;
}
.ant-table-small {
border-radius: 0 !important;
}
.ant-table-small>.ant-table-content>.ant-table-body {
margin: 0px;
}
.ant-table-filter-dropdown .ant-dropdown-menu-without-submenu {
max-height: 300px;
overflow-x: hidden;
}
.ant-table-body {
position: relative;
.list {
padding: 24px;
box-sizing: content-box;
display: flex;
.item {
margin-right: 24px;
}
}
// &:hover {
// &::-webkit-scrollbar-thumb {
// /*滚动条里面小方块*/
// background: rgba(204, 204, 204, 1);
// }
// }
}
.no-scrollbar {
.ant-table-body {
&::-webkit-scrollbar {
display: none;
}
}
}
.table-no-scrollbar {
::-webkit-scrollbar {
width: 0;
}
}
.ant-table-small>.ant-table-content>.ant-table-body {
margin: 0 0px !important;
}
.right-container,
.ant-modal {
.ant-input {
&:focus {
border: 1px solid #ffbb94 !important;
}
}
}
.ant-dropdown:before {
display: none !important;
}
.ant-calendar-picker-container {
.ant-calendar-footer-extra {
.ant-tag-blue {
background: #fff;
color: #ffb000;
border-color: #ffb000;
}
}
}
.ant-table-filter-dropdown {
.ant-dropdown-menu-item-selected {
background: #f3f6fa;
}
}
.ant-select-selection__rendered {
margin: 0 12px;
}
.ant-btn-danger:hover,
.ant-btn-danger:focus {
color: #fff !important;
background-color: #ff7875 !important;
border-color: #ff7875 !important;
}
.ant-modal-confirm-info .ant-modal-confirm-body > .anticon {
color: #fdb089!important;
}
.ant-breadcrumb > span:last-child .ant-breadcrumb-separator {
display: none;
}
.ant-input-affix-wrapper .ant-input:not(:last-child) {
padding-right: 30px !important;
}
.ant-input-affix-wrapper .ant-input:not(:first-child) {
padding-left: 24px !important;
}
.ant-input-affix-wrapper .ant-input {
min-height: 100% !important;
position: relative !important;
text-align: inherit !important;
}
.ant-modal-confirm-info .ant-modal-confirm-body>.anticon {
color: #FFBB54 !important;
}
.ant-modal-confirm-info .ant-modal-confirm-body>.default-confirm-icon {
font-size: 22px !important;
line-height: 22px !important;
float: left !important;
color: #FC9C6B !important;
margin-right: 16px !important;
&.blue {
color: #5CBAFF !important;
}
}
// 气泡
.ant-tooltip {
.ant-tooltip-content {
.ant-tooltip-inner {
padding: 6px 12px !important;
}
}
}
// confirm弹窗自定义图标 相关样式调整
.ant-modal-body .ant-modal-confirm-body-wrapper .ant-modal-confirm-body {
>.solid-icon {
color: #faad14;
font-size: 22px;
line-height: 22px;
float: left;
margin-right: 16px;
}
>.confirm-icon{
color: #FC9C6B;
}
.ant-modal-confirm-content {
margin-left: 38px;
>.solid-icon-content {
margin-left: 40px;
}
}
}
.take-name-modal {
.ant-modal-body {
padding: 20px 24px !important;
.ant-form-item {
margin-bottom: 16px !important;
}
}
}
.ant-select-selection__clear {
width: 16px;
height: 16px;
}
.ant-select-dropdown--empty .ant-select-dropdown-menu-item-disabled {
cursor: default !important;
}
.batch-class-list {
.ant-modal-body {
padding: 16px 24px !important;
}
}
import MicroEvent from 'microevent';
class Bus {
}
MicroEvent.mixin(Bus);
export default new Bus();
@import './variables.less';
@theme-red: #fb6465;
@theme-green: #42bcA9;
@theme-blue: #5eb7ed;
@theme-yellow: #FFBF5A;
.page-control-theme(@color) {
.go {
color: @color;
}
.active {
background-color: @color;
border: 1px solid @color;
}
.back {
color: @color;
}
.jumper {
button {
&:active {
color: @color;
}
}
}
li {
a {
color: @color;
}
}
}
.table-theme(@color) when (@color = @theme-yellow) {
thead {
background-color: #FEECE1;
}
tbody {
tr{
border-bottom: 1px solid @xm-color-border;
}
}
.header {
.download {
color: @color;
}
}
}
.table-theme(@color) when (@color = @theme-blue) {
thead {
background-color: #E0F3FE;
}
tbody {
tr{
border-bottom: 1px solid @xm-color-border;
}
}
.header {
.download {
color: @color;
}
}
}
.table-theme(@color) when (@color = @theme-green) {
thead {
background-color: #CFECE8;
}
tbody {
tr {
border-bottom:1px solid @xm-color-border;
}
}
.header {
.download {
color: @color;
}
}
}
.table-theme(@color) when (@color = @theme-red) {
thead {
background-color: #FCE6E6;
}
tbody {
tr:nth-child(even) {
background-color: #FFF9F9;
}
}
.header {
.download {
color: @color;
}
}
}
.tab(@color) {
span {
color: @xm-sub-text-color;
border: 1px solid @color;
border-left: none;
&:first-child {
border-left: 1px solid @color;
}
}
.active {
color: #ffffff;
background: @color;
}
}
.graph-theme(@color) {
.ac-tooltip {
border: 1px solid @color;
}
}
.flexbox() {
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
.flex(@value: 1) {
-webkit-box-flex: @value;
-webkit-flex: @value;
flex: @value;
}
// order
.order(@value: 1) {
-webkit-box-ordinal-group: @value;
-webkit-border: @value;
order: @value;
}
.flex-wrap(@fw) when (@fw = nowrap) {
-webkit-box-lines: single;
-moz-box-lines: single;
-webkit-flex-wrap: nowrap;
-ms-flex-wrap: none;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
}
.flex-wrap(@fw) when (@fw = wrap) {
-webkit-box-lines: multiple;
-moz-box-lines: multiple;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
.flex-wrap(@fw) when not (@fw = wrap) and not (@fw = nowrap) {
-webkit-flex-wrap: @fw;
-ms-flex-wrap: @fw;
flex-wrap: @fw;
}
.flex-shrink(@fs) {
-webkit-flex-shrink: @fs;
-ms-flex: 0 @fs auto;
flex-shrink: @fs;
}
// flex-direction
.flex-direction (@direction) when (@direction = row) {
-webkit-box-direction: normal;
-webkit-box-orient: horizontal;
-webkit-flex-direction: row;
flex-direction: row;
}
.flex-direction (@direction) when (@direction = row-reverse) {
-webkit-box-pack: end;
-webkit-box-orient: reverse;
-webkit-flex-direction: row-reverse;
flex-direction: row-reverse;
}
.flex-direction (@direction) when (@direction = column) {
-webkit-box-direction: normal;
-webkit-box-orient: vertical;
-webkit-flex-direction: column;
flex-direction: column;
}
.flex-direction (@direction) when (@direction = column-reverse) {
-webkit-box-pack: end;
-webkit-box-orient: reverse;
-webkit-flex-direction: column-reverse;
flex-direction: column-reverse;
}
.justify-content(@jc) when (@jc = flex-start) {
-webkit-box-pack: start;
-ms-flex-pack: start;
-webkit-justify-content: flex-start;
justify-content: flex-start;
}
.justify-content(@jc) when (@jc = flex-end) {
-webkit-box-pack: end;
-ms-flex-pack: end;
-webkit-justify-content: flex-end;
justify-content: flex-end;
}
.justify-content(@jc) when (@jc = space-between) {
-webkit-box-pack: justify;
-moz-box-pack: justify;
-ms-flex-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
}
.justify-content(@jc) when not (@jc = flex-start) and not (@jc = flex-end) and not (@jc = space-between) {
-webkit-box-pack: @jc;
-ms-flex-pack: @jc;
-webkit-justify-content: @jc;
justify-content: @jc;
}
.align-items(@ai) when (@ai = flex-start) {
-webkit-box-align: start;
-ms-flex-align: start;
-webkit-align-items: flex-start;
align-items: flex-start;
}
.align-items(@ai) when (@ai = flex-end) {
-webkit-box-align: end;
-ms-flex-align: end;
-webkit-align-items: flex-end;
align-items: flex-end;
}
.align-items(@ai) when not (@ai = flex-start) and not (@ai = flex-end) {
-webkit-box-align: @ai;
-ms-flex-align: @ai;
-webkit-align-items: @ai;
align-items: @ai;
}
.align-content(@ai) {
-ms-flex-line-pack: @ai;
-webkit-align-content: @ai;
align-content: @ai;
}
.align-self(@as) {
-ms-flex-item-align: @as;
-webkit-align-self: @as;
align-self: @as;
}
.text-overflow-ellipsis(){
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
width: 100%;
display: inline-block;
}
.text-overflow-ellipsis-line(@line) {
text-overflow: ellipsis;
overflow: hidden;
word-break:break-all;
display:-webkit-box;
-webkit-line-clamp: @line;
/*! autoprefixer: off */
-webkit-box-orient:vertical;
/* autoprefixer: on */
}
.btn-poster() {
display: inline-block;
padding: 3px 12px;
color: #666;
border-radius:4px;
border: 1px solid #e8e8e8;
cursor: pointer;
}
@import './mixins.less';
@import './antd.less';
.page {
position: absolute;
top: 0px;
left: 0px;
right: 0;
bottom: 0;
z-index: 101;
background-color: #F0F2F5;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
.page {
position: fixed;
top: 50px;
left: 180px;
right: 0;
bottom: 0;
z-index: 102;
overflow: auto;
.box{
&:first-child{
margin-bottom: 8px;
}
&+.box{
margin: 8px 16px;
}
&:last-child{
margin-bottom: 16px;
}
}
}
.page-content {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
box-sizing: border-box;
overflow-y: auto;
animation: all 0.75;
padding-bottom: 16px;
}
.content-sub-header{
padding: 0px 16px 0;
line-height: 30px;
}
.content-header {
padding: 10px 16px;
line-height: 30px;
h1 {
font-size: 14px;
color: #898989;
font-weight: normal;
display: inline-block;
}
}
.box{
padding: 16px;
margin: 0 16px 16px;
margin-bottom: 8px;
background: #ffffff;
// min-height: 400px;
.box-header {
line-height: 30px;
padding-bottom: 12px;
&.searchOnly{
padding-bottom: 0px;
}
.filter-row {
min-height: 30px;
margin-bottom: 10px;
>* {
float: left;
margin-left: 16px;
height: 40px;
}
>.ant-btn {
height: 28px!important;
}
*:first-child {
margin-left: 0px;
}
}
}
.box-footer {
margin-top: 16px;
}
&:first-child{
margin-bottom: 8px;
}
&+.box{
margin: 8px 16px;
}
&:last-child{
margin-bottom: 16px;
}
}
// .ant-calendar-picker{
// top:-1px;
// }
}
.box-header {
.ant-row-flex {
padding-top: 2px;
>div:nth-child(1) {
display: flex;
flex-wrap: wrap;
align-items:space-between;
.flex(1);
>*{
flex-basis: 30%;
margin-right: 3%;
margin-bottom: 16px;
}
}
&.lastRow{
>div:nth-child(1) {
>*{
margin-bottom: 0px;
}
}
}
}
}
.full-screen-page {
min-width: 1000px;
height: 100%;
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
user-select: none;
background-color: #F0F2F5;
}
@import './variables.less';
// 常用的删除按钮
table {
a, .link {
cursor: pointer;
color: #FF7519;
}
td:nth-child(1):hover,
td:nth-child(2):hover {
.delete {
display: inline-block;
}
}
td:nth-child(1),
td:nth-child(2) {
position: relative;
.delete {
color: #999;
position: absolute;
right: 5px;
bottom: 10px;
display: none;
transition: all .5s;
cursor: pointer;
}
}
th {
background: @xm-table-header !important;
> .center {
text-align: center;
}
}
}
table.table {
table-layout: fixed;
width: 100%;
.left {
text-align: left;
padding-left: 10px;
}
.right {
text-align: right;
padding-right: 10px;
}
.center {
text-align: center;
}
.text-center {
text-align: center;
}
tr {
td, th {
min-height: 30px;
padding: 6px;
font-size: 14px;
color: #545455;
text-align: left;
border: 1px solid @xm-color-border;
}
th {
background: #ffece1;
border-bottom: none;
> .center {
text-align: center;
}
}
td {
overflow: hidden;
color:@xm-table-tbody-color;
white-space: nowrap;
text-overflow: ellipsis;
a {
color: #ff8534;
cursor: pointer;
}
}
}
thead {
border-top: 1px solid @xm-color-border;
tr {
border-left: 1px solid @xm-color-border;
border-bottom: 1px solid @xm-color-border;
border-right: 1px solid @xm-color-border;
background-color: @xm-table-header;
th {
background: none;
color:@xm-table-head-color;
}
}
}
tbody {
tr {
td {
background: none;
}
}
border-bottom: 1px solid @xm-color-border;
}
&.table-no-top-border{
border-top: none!important;
}
&.table-striped {
tbody {
tr:hover {
background-color: @xm-table-body-active;
}
}
th, td {
border-top: 0;
border-bottom: 0;
}
border: 1px solid @xm-color-border;
//border-bottom: 1px solid @xm-color-border;
}
&.table-striped-header {
border-bottom: none;
}
&.table-first-center {
td:first-child, th:first-child {
text-align: center;
}
}
}
.xm-table-filter {
display: inline-block;
vertical-align: top;
>* {
margin-left: 16px;
}
.xm-table-filter{
margin: 0px;
}
.date-range {
display: inline-block;
input {
display: inline-block;
width: 190px;
box-sizing: border-box;
height: 30px;
line-height: 30px;
}
}
.xm-divider {
position: relative;
width: 1px;
height: 10px;
}
.stockNum{
margin-left: 5px;
width: 18px;
height: 18px;
background-color: #FC0C0E;
border-radius: 50%;
color: #fff;
line-height: 18px;
text-align: center;
font-size: 12px;
font-weight: 300;
}
}
\ No newline at end of file
@sunLight: #FED951;
@sun: #Fc9C6B;
@sunDark: #DD8029;
@orangeLight: #FDBB70;
@orange: #FB863E;
@orangeDark: #D65E30;
@primaryLight: @sunLight;
@primary: @sun;
@primaryDark: @sunDark;
@secondaryLight: @orangeLight;
@secondary: @orange;
@secondaryDark: @orangeDark;
@sucess: @sun;
@warning: #FB696A;
@border: #e8e8e8;
@green: #3bdbaa;
@blue: #58b7ef;
@pink: #ff6767;
@text-main:#000000;
@text-sub:#686868;
@text-note:#c0c0c0;
.color-primary {
color: @sun;
}
.text-primary {
color: #fe8534;
}
.bg-primary {
background-color: @primary;
}
@font-xs: 12px;
@font-s: 13px;
@font-m: 14px;
@font-l: 15px;
@font-xl: 16px;
//old
//color
@xm-color-primary: #FF7519;
@xm-color-primary_active: #020201;
@xm-color-primary-darker: #ff8534;
@xm-color-selected: #F58E2C;
@xm-color-selected_active: #e58342;
@xm-color-secondary-light: #e28534;
@xm-color-secondary: #ff8534;
@xm-color-secondary-darker: #D65E30;
@xm-color-text-select-primary:#Fc9C6B;
@xm-color-text-select-warning:#ec4b35;
@xm-color-info: #45b2ff;
@xm-color-info2: #5e80bd;
@xm-color-danger: red;
@xm-color-danger1: #ff7538;
@xm-color-danger2: #ff0000;
@xm-color-success: #50b7a8;
@xm-color-success2: @xm-color-primary;
@xm-color-success3: @xm-color-primary;
@xm-color-success4: #139794;
@xm-color-green: #3bdbaa;
@xm-color-blue: #58b7ef;
@xm-color-pink:#ff6767;
// bg
@xm-bg-primary: @xm-color-primary;
@xm-bg-info: #45b2ff;
@xm-bg-info2: #5e80bd;
@xm-bg-danger: red;
@xm-bg-success: #50b7a8;
@xm-bg-success2: @xm-color-primary;
// btn-bg
@xm-btn-bg-info: #45b2ff;
@xm-btn-bg-info2: #5e80bd;
//分割线颜色
@xm-color-border: #e8e8e8;
//主文本色
@xm-main-text-color: #000000;
//副文本
@xm-sub-text-color: #686868;
//提示文本
@xm-note-text-color: #999;
@xm-primary-text-color: #ff8534;
// 通用阴影 1-n 阴影从小到大
@xm-box-shadow-1: 0 2px 2px rgba(0, 0, 0, 0.1);
@xm-box-shadow-2: 0 2px 4px #ccc;
@xm-box-shadow-3: 0 1px 10px #ccc;
@xm-font-size-xs: 10px;
@xm-font-size-s: 12px;
@xm-font-size-m: 14px;
@xm-font-size-l: 20px;
@xm-font-size-xl: 33px;
@xm-font-size-xxl: 34px;
// table颜色
@xm-table-header:#F7F8F9;
@xm-table-body-even:#Fafafa;
@xm-table-body-active:#F3f6fa;
@xm-table-head-color:#333;
@xm-table-tbody-color:#666;
//侧边栏宽度
@xm-left-width:180px;
@xm-left-min-width:64px;
@xm-color-text-menu:#9a9dA7;
// 下拉框
@xm-select-item-hover:#F3f6fa;
<!--
* @Author: 吴文洁
* @Date: 2020-04-29 16:57:38
* @LastEditors: 吴文洁
* @LastEditTime: 2020-04-29 17:02:39
* @Description:
-->
### 与后台的数据交互层(承担防腐重任)
**本目录的引用别名是 @/data-source**
request-apis.js和translators注意都是 复数。
translators.js 为前后端字段(or 数据结构)转换的方法集合。(防腐层)
### 注意:接口请求的所有返回数据结构,必须经过 translator 转后成与前端 domain 中的结构匹配后才能用于视图层。
<!--
* @Author: 吴文洁
* @Date: 2020-04-29 17:03:23
* @LastEditors: 吴文洁
* @LastEditTime: 2020-04-29 17:18:38
* @Description:
-->
### 本目录为“各个子域的集合”,所有领域的公共部分均放在这里
**本目录的 别名为 @/domains**
Service连接视图层和数据层
注意: Service 类中只有 static 方法。
\ No newline at end of file
/*
* @Author: 陈剑宇
* @Date: 2020-05-07 14:43:01
* @LastEditTime: 2020-11-09 09:52:03
* @LastEditors: 吴文洁
* @Description:
* @FilePath: /wheat-web-demo/src/domains/basic-domain/constants.ts
*/
import { MapInterface } from '@/domains/basic-domain/interface'
// 默认是 dev 环境
const ENV: string = process.env.DEPLOY_ENV || 'dev';
const BASIC_HOST_MAP: MapInterface = {
dev: 'https://dev-heimdall.xiaomai5.com/',
dev1: 'https://dev1-heimdall.xiaomai5.com/',
rc: 'https://rc-heimdall.xiaomai5.com/',
gray: 'https://gray-heimdall.xiaomai5.com/',
prod: 'https://gateway-heimdall.xiaomai5.com/'
};
// axios headers config
export const TIME_OUT: number = 20000;
export const USER_TYPE: string = 'B';
export const PROJECT = 'xmzj-web-b';
export const VERSION = '5.4.8';
export const PREFIX = 'xiaomai';
// host
export const BASIC_HOST: string = BASIC_HOST_MAP[ENV];
\ No newline at end of file
/*
* @Author: 吴文洁
* @Date: 2020-04-28 18:10:07
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-31 09:36:22
* @Description: 系统interface
*/
export interface VerifyInfo {
aid: string | undefined,
tid: string | undefined,
cid: string | undefined,
uid: string | undefined,
token: string | undefined,
}
// constants.ts
export interface MapInterface {
dev: string,
dev1: string,
rc: string,
gray: string,
prod: string,
[key: string]: any,
}
export interface XMStorageImplements {
get: (key: string) => any,
set: (key: string, value: any) => void,
getObj: (key: string) => any,
setObj: (key: string, obj: any) => void,
remove: (key: string) => void,
clear: () => void,
}
\ No newline at end of file
/*
* @Author: 吴文洁
* @Date: 2020-08-20 09:20:43
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-21 09:02:36
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
// 限制字数
const getEllipsText = (text: string, limitNum: number) => {
const limitText: string = text.replace(/\n/g, ' ');
if (limitText.length > limitNum) {
return `${limitText.substr(0, limitNum)}...`;
}
return limitText;
}
export {
getEllipsText
}
\ No newline at end of file
/*
* @Author: 吴文洁
* @Date: 2020-04-27 20:35:34
* @LastEditors: 吴文洁
* @LastEditTime: 2020-11-09 09:43:33
* @Description:
*/
import React from 'react';
import ReactDOM from 'react-dom';
import { HashRouter } from 'react-router-dom';
import { ConfigProvider } from 'antd';
import { createHashHistory } from 'history';
import zh_CN from 'antd/es/locale/zh_CN';
import _ from 'underscore';
import Storage from '@/common/js/storage';
import { PREFIX } from '@/domains/basic-domain/constants';
import { VerifyInfo } from '@/domains/basic-domain/interface';
import 'antd/dist/antd.less';
import '@/common/less/index.less';
import App from './modules/root/App';
import '@/common/less/index.less';
const history = createHashHistory();
window.RCHistory = _.extend({}, history, {
push: (obj: any) => {
history.push(obj)
},
pushState: (obj: any) => {
history.push(obj)
},
pushStateWithStatus: (obj: any) => {
history.push(obj)
},
goBack: history.goBack,
location: history.location,
replace: (obj: any) => {
history.replace(obj)
}
});
export async function mount() {
ReactDOM.render((
<HashRouter {...history} >
<ConfigProvider locale={zh_CN}>
<App/>
</ConfigProvider>
</HashRouter>
), document.getElementById('root'));
}
mount()
\ No newline at end of file
import React from 'react';
class PrepareLessonPage extends React.Component {
constructor(props) {
super(props);
this.state = {}
}
render() {
return (
<div className="prepare-lesson-page page">
<div className="content-header">资料云盘</div>
<div className="box content-body">
</div>
</div>
)
}
}
export default PrepareLessonPage;
\ No newline at end of file
/*
* @Author: 吴文洁
* @Date: 2019-07-10 10:30:49
* @LastEditors: wangyixi
* @LastEditTime: 2020-11-09 19:21:03
* @Description:
*/
import React from 'react'
import { withRouter} from 'react-router-dom';
import {ConfigProvider } from 'antd';
import Header from './Header'
import Menu from './Menu'
import Main from './Main'
import { Route, Switch } from 'react-router-dom'
import zhCN from 'antd/es/locale/zh_CN'
class App extends React.Component {
constructor(props) {
super(props)
this.state = {
}
}
componentDidMount() {
}
render() {
return [
<div id="home">
<Header/>
<ConfigProvider locale={zhCN}>
<Main/>
</ConfigProvider>
<Menu/>
</div>
]
}
}
export default withRouter(App)
/*
* @Author: 吴文洁
* @Date: 2019-09-10 18:26:03
* @LastEditors: wangyixi
* @LastEditTime: 2020-11-11 14:04:50
* @Description:
*/
import React from 'react';
import './Header.less';
import {
Menu,
Dropdown,
Icon,
message,
Modal,
Input,
Avatar,
Button,
Row,
Col,
Badge,
Tooltip,
Radio,
} from 'antd';
import { withRouter } from 'react-router-dom';
import Bus from '@/core/bus';
// var $topContainer = $('#top-container');
class Header extends React.Component {
constructor(props) {
super(props);
this.state = {
menuType: 1,
};
}
componentWillMount() {
}
componentDidMount() {
}
handleMenu = () => {
const menuType = !this.state.menuType;
this.setState({ menuType }, () => {
Bus.trigger('menuTypeChange', menuType);
});
};
render() {
const {
} = this.state;
return (
<div id="top-container" className="top-container">
<div className="top top-nav">
<div>
{this.state.menuType ? (
<img src="https://image.xiaomaiketang.com/xm/TP2x7aQ24y.png" className="logo" alt="" />
):(
<img src="https://dev.xiaomai5.com/admin/static/images/logo.928339cd.png" className="logo" alt="" />
)}
</div>
{this.state.menuType ? (
<span className="icon iconfont cursor ml20 handLike" onClick={this.handleMenu}>
&#xe7ff;{' '}
</span>
) : (
<span className="icon iconfont cursor ml20 handLike" onClick={this.handleMenu}>
&#xe7fe;
</span>
)}
<div className="message-help">
<Dropdown>
<div className="user">
<span className="name">张乐园</span>
</div>
</Dropdown>
</div>
</div>
</div>
);
}
}
export default withRouter(Header);
@import '../../core/variables.less';
@top-height: 50px;
@icon-color:#939393;
.top-container {
position: absolute;
top: 0;
left: 0;
right: 0;
height: @top-height;
background-color: #FFF;
z-index: 112;
.logo{
display: block;
height: 24px;
margin-left: 20px;
}
.top {
display: flex;
display: -webkit-flex;
flex-direction: row;
-webkit-flex-direction: row;
align-items: center;
-webkit-align-items: center;
padding: 0 24px 0 0;
height: 100%;
justify-content: space-between;
-webkit-justify-content: space-between;
border-bottom:1px solid @xm-color-border;
.backCenter{
color:rgba(0,0,0,1);
font-size: 16px;
}
.top-left {
display: flex;
display: -webkit-flex;
align-items: center;
-webkit-align-items: center;
height: 100%;
min-width: 200px;
padding-left: 20px;
box-sizing: content-box;
.org-logo-box {
display: flex;
display: -webkit-flex;
flex-direction: row;
-webkit-flex-direction: row;
align-items: center;
-webkit-align-items: center;
justify-content: center;
-webkit-justify-content: center;
position: relative;
.logo {
width: 40px;
height: 40px;
border-radius: 50%;
overflow: hidden;
cursor: pointer;
position: relative;
img {
width: 100%;
height: 100%;
}
.edit {
position: absolute;
width: 40px;
height: 0;
top: 0;
left: 0;
overflow: hidden;
color: #ffffff;
display: flex;
display: -webkit-flex;
justify-content: center;
-webkit-justify-content: center;
align-items: center;
-webkit-align-items: center;
}
&:hover {
.edit {
height: 40px;
background: rgba(0, 0, 0, 0.3);
.icon {
font-size: 20px;
}
}
}
}
.name-box {
flex: 1;
-webkit-flex: 1;
margin-left: 10px;
position: relative;
cursor: pointer;
.area-list {
width: 128px;
position: absolute;
top: 100%;
left: 0;
height: 0;
overflow-y: hidden;
border-radius: 4px;
padding: 4px 0;
-webkit-transition: all .3s;
-moz-transition: all .3s;
-ms-transition: all .3s;
-o-transition: all .3s;
transition: all .3s;
li {
margin: 2px 10px;
font-size: 12px;
color: #ffffff;
}
}
&:hover {
.area-list {
height: auto;
background: rgba(0, 0, 0, .6);
li {
-webkit-transition: all .3s;
-moz-transition: all .3s;
-ms-transition: all .3s;
-o-transition: all .3s;
transition: all .3s;
}
li:hover {
background-color: rgba(255, 255, 255, .2);
}
}
}
.name {
width: 120px !important;
font-size: 14px;
vertical-align: middle;
display: flex;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
align-items: center;
-webkit-align-items: center;
flex-direction: row;
-webkit-flex-direction: row;
justify-content: space-between;
-webkit-justify-content: space-between;
.icon {
cursor: pointer;
}
}
.backCenter {
cursor: pointer;
&:hover {
background: @xm-color-text-select-primary;
}
}
.all-name {
color: #afb7c7;
font-size: 12px;
}
}
}
}
.message-help {
display: flex;
display: -webkit-flex;
align-items: center;
-webkit-align-items: center;
height: 100%;
flex: 1;
-webkit-flex: 1;
justify-content: flex-end;
.inst-container {
width: calc(~'100% - 420px');
position: relative;
.inst {
margin-right: 12px;
display: flex;
align-items: center;
border-right: 1px solid #e8e8e8;
padding-right: 24px;
justify-content: flex-end;
.select {
cursor: pointer;
}
.name {
color: #333;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
max-width:230px;
}
.icon {
font-size: 16px;
margin-left: 8px;
color: #8c8e93;
&:hover {
color: #555;
}
}
}
.select-inst {
position: absolute;
top: 37px;
right: 11px;
background: #fff;
width: 285px;
padding: 14px;
box-shadow: 0 2px 7px 0 rgba(0, 0, 0, 0.06);
max-height: 321px;
border-radius: 2px;
display: none;
&.active {
display: block;
}
h2 {
margin-bottom: 10px;
}
.ant-radio-group {
overflow-y: auto;
max-height: 200px;
}
.ant-radio-wrapper {
display: inline-block;
width: calc(~'100% - 28px');
margin: 8px 0;
.ant-radio {
float: left;
margin: 3px 0;
}
.name {
color: #666;
white-space: pre-wrap;
}
}
.control {
display: flex;
justify-content: flex-end;
button {
margin-left: 8px;
}
}
}
}
.drop-menu {
height: 100%;
display: flex;
display: -webkit-flex;
align-items: center;
-webkit-align-items: center;
justify-content: center;
-webkit-justify-content: center;
position: relative;
.help-button {
display: flex;
align-items: center;
height: 100%;
cursor: pointer;
padding: 0 12px;
width: 106px;
.icon-text {
margin-left:4px;
color:#333;
}
}
.icon {
font-size: 16px;
color: @icon-color;
vertical-align: middle;
white-space: nowrap;
&.font-sm {
font-size: 14px;
}
}
&:hover {
color: #555;
.icon {
color: #555;
}
.help-center,
.message-center {
color: black;
}
}
}
.help-menu {
.help-center {
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
position: absolute;
overflow: hidden;
top: 50px;
left: 0;
height: 0;
background-color: #ffffff;
&.active {
height: auto;
}
.help-body {
li {
width: 125px;
padding: 10px 20px;
cursor: pointer;
display: flex;
align-items: center;
span:nth-child(1) {
margin-right: 10px;
color: @primary;
font-size: 18px;
}
span:nth-child(2) {
font-size: 12px;
vertical-align: middle;
color: @primary;
}
}
}
}
}
.message-menu {
.message-center {
box-shadow: 0 0 8px rgba(0,0,0,0.15);
position: absolute;
overflow: hidden;
top: 50px;
right: -96px;
width: 320px;
height: 0;
// -webkit-animation: flipInY 1s 0s ease both;
// -moz-animation: flipInY 1s 0s ease both;
background-color: #ffffff;
border-radius: 4px;
z-index: 1;
&.active {
height: auto;
}
.message-body {
overflow: auto;
// max-height: 255px;
.message-item:hover {
background: #F3F6FA;
}
li,a {
width: 100%;
display: block;
border-bottom: 1px solid @xm-color-border;
cursor: pointer;
padding: 16px;
&.load-more {
text-align: center;
color: @xm-color-text-select-primary;
font-size: 13px;
padding: 10px;
}
}
}
}
}
.user {
margin-left: 16px;
max-width: 160px;
display: flex;
align-items: center;
cursor: pointer;
.name {
margin-left: 8px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
.top-version {
.version-title {
cursor: pointer;
color: #f47564;
}
}
.edit-menu,
.exit {
height: 100%;
padding: 0 15px;
display: flex;
display: -webkit-flex;
align-items: center;
-webkit-align-items: center;
justify-content: center;
-webkit-justify-content: center;
position: relative;
cursor: pointer;
.icon {
margin-right: 4px;
font-size: 16px;
color: @icon-color;
vertical-align: middle;
&.font-sm {
font-size: 14px;
}
}
&:hover {
color: #ffffff;
background-color: @xm-color-text-select-primary;
.icon {
color: #ffffff;
}
.help-center {
color: black;
}
.message-center {
color: black;
}
}
}
}
}
\ No newline at end of file
import React, { useEffect, useRef, useState } from 'react';
import qs from 'qs';
import {
withRouter
} from 'react-router-dom';
import './Login.less';
import md5 from 'blueimp-md5';
import { message, Row, Col, Tabs, Input, Button, Popover , Select } from 'antd';
import originAxios from 'axios';
import CheckBeforeSendCode from '../../components/CheckBeforeSendCode';
const {Option} = Select;
const {TabPane} = Tabs;
const GH = require('../../images/guohui.png')
function Login(props) {
const initApi = LS.get('DRURL') || '';
const [api, setApi] = useState(initApi);
const [drList, setDrList] = useState([]); // 线路列表
const [loginStyle, setLoginStyle] = useState('passwordLogin');// 登录方式
const [showPassword, setShowPassword] = useState(false);// 显示密码
const [phone, setPhone] = useState(''); // 登录手机号
const [password, setPwd] = useState(''); // 密码
const [phoneverify, setPhoneverify] = useState(''); // 密码登录验证码
const [certificate, setCertificate] = useState(''); // 语音电话参数
const [instName, setInstName] = useState(''); // 免费试用机构名字
const [regPhone, setRegPhone] = useState(''); // 免费试用手机号
const [code, setCode] = useState(''); // 免费试用验证码
const [btnText, setBtnText] = useState('登录'); // 登录按钮文本
const [btnDisabled, setBtnDisabled] = useState(false); // 登录按钮禁用状态
const [modalVisible, setModalVisible] = useState(false); // 注册弹窗可见状态
const [voiceCodeTip, setVoiceCodeTip] = useState(false); // 语音验证码提示状态
const [codeText, setCodeText] = useState('获取验证码'); // 验证码提示语
const [waitStatus, setWaitStatus] = useState(false); // 验证码是否在倒计时
const [regBtnText, setRegBtnText] = useState('提交'); // 注册弹窗按钮文本
const [regBtnDisabled, setRegBtnDisabled] = useState(false) // 注册按钮禁用状态
const [regCodeText, setRegCodeText] = useState('获取验证码'); // 注册弹窗文本
const [userType, setUserType] = useState('B'); // 账号类型 B or CRM_INST
const [regWaitStatus, setRegWaitStatus] = useState(false); // 验证码是否在倒计时
const [regVoiceCodeTip, setRegVoiceCodeTip] = useState(false); // 语音验证码提示状态
const [openCheck1, setOpenCheck1] = useState(false);
const [openCheck2, setOpenCheck2] = useState(false);
const [openCheck3, setOpenCheck3] = useState(false);
const [openCheck4, setOpenCheck4] = useState(false);
const [checking1, setChecking1] = useState(false);
const [checking3, setChecking3] = useState(false);
const [checkObject1, setCheckObject1] = useState({});
const [checkObject2, setCheckObject2] = useState({});
const [checkObject3, setCheckObject3] = useState({});
const [checkObject4, setCheckObject4] = useState({});
useEffect(() => {
getDrList();
window.WEBTRACING('Web_B_LoginPage_View', '曝光事件_首页_WebB_打开登录页');
// 默认
const sear = props.location.search
if(sear){
const urlParams = qs.parse(props.location.search.substr(1))
if(urlParams.tab=== "code"){
setLoginStyle("phoneverifyLogin")
}
if(urlParams.phone){
setPhone(urlParams.phone)
}
}
}, [])
function getDrList() {
originAxios.get('https://res.xiaomai5.com/devops/xmRouteConfig/xmRouteB.conf?spm=5176.8466032.0.dopenurl.218a1450V7oSvA&file=xmRouteB.conf').then((res) => {
setDrList(res.data.routes);
}).catch(() => { })
document.title = "机构管理端登录|小麦助教";
}
async function handleLogin(e) {
const ifVerifyLogin = (loginStyle == 'phoneverifyLogin');
e.preventDefault();
const data = {
account: phone,
pwd: password,
phoneverify
};
if (!data.account) {
setBtnText('请输入手机号');
setBtnDisabled(true);
setTimeout(function () {
setBtnText('登录');
setBtnDisabled(false);
}, 1500);
return;
}
if (data.account.length != 11) {
message.warning('请输入11位长度手机号')
return;
}
if (ifVerifyLogin) {
if (!data.phoneverify) {
setBtnText('无有效验证码,请先获取短信验证码');
setBtnDisabled(true);
setTimeout(function () {
setBtnText('登录');
setBtnDisabled(false);
}, 1500);
return;
}
} else if (!data.pwd) {
setBtnText('请输入密码');
setBtnDisabled(true);
setTimeout(function () {
setBtnText('登录');
setBtnDisabled(false);
}, 1500);
return;
}
data.pwd = md5(data.pwd);
const param = {
accountNo: data.account,
certificate: ifVerifyLogin ? data.phoneverify : data.pwd,
appTerm: 'PC',
loginType: ifVerifyLogin ? 'PHONE_AUTH_CODE' : 'PHONE_PWD'
}
setBtnText('登录中...');
setBtnDisabled(true);
setTimeout(() => {
setBtnText('登录');
setBtnDisabled(false);
}, 3000);
const option = {
sync: true, noCache: true, userType, success: (res) => {
if (typeof res === 'object') {
if (res.code == '200' && !res.result.exists) { // 非机构用户
setRegPhone(data.account)
setModalVisible(true)
return
}
switch (res.code) {
// 成功
case "200":
window.location.reload();
window.WEBTRACING('Web_B_LoginPage_Loginin', '曝光事件_首页_WebB_登陆成功');
localStorage.removeItem('xmsy');
window.LS.set('isCrmInstAdmin', false); // 机构后台账号
var storageDate = window.LS.get('storageDate');
if (storageDate != CONFIG.cacheUpdateTime) {
const apis = localStorage.getItem('server-apis');
// window.LS.clear();
window.LS.set('storageDate', CONFIG.cacheUpdateTime);
if (apis) {
localStorage.setItem('server-apis', apis)
}
}
window.LS.set('token', res.result.xmToken);
window.LS.set('uid', res.result.userId);
window.LS.set('uPhone', /^\d{11}$/.test(data.account) ? data
.account : '');
window.LS.set('crmInstIds', JSON.stringify(res.result.crmInstIds));
if (res.result.userType === 'CRM_INST') {
window.LS.set('isCrmInstAdmin', true); // 机构后台账号
window.RCHistory.push({
pathname: `/campus_panel`,
})
} else if (res.result.isCenterAccount && process.env.DEPLOY_ENV !== 'beta') {
window.LS.set('hasCenter', true);
if (process.env.DEPLOY_ENV === 'dev1') {
location.href = `${location.origin }/dev1/center/index.html${ drLink ? '?type=dr' : ''}`;
} else if (process.env.DEPLOY_ENV === 'gray') {
location.href = `${location.origin }/center/gray/index.html${ drLink ? '?type=dr' : ''}`;
} else {
location.href = `${location.origin }/center/index.html${ drLink ? '?type=dr' : ''}`;
}
} else {
window.RCHistory.push({
pathname: `/`,
})
}
break;
// token非法
case '404':
break;
// 手机号,密码错误
case '500':
setBtnText('手机号或密码错误');
setBtnDisabled(true);
setTimeout(function () {
setBtnText('登录');
setBtnDisabled(false);
}, 1500);
break;
default:
setBtnText(res.message);
setBtnDisabled(true);
setTimeout(function () {
setBtnText('登录');
setBtnDisabled(false);
}, 1500);
break;
}
}
}
}
axios.postJSON('business/anon/b/login', param, option)
}
function handleSendSMSCode(checkData, userType) {
if (waitStatus) return;
const phoneLength = phone.trim().length;
const params = {
phone,
sig: checkData.sig,
sessionId: checkData.csessionid,
token: checkData.token,
scene: 'nc_login',
serverType: 'B_LOGIN',
sideType: 0,
};
if (userType === 'CRM_INST') {
params.serverType = 'CRM_INST';
};
axios.postJSON('business/anon/sms/sendSmsCode', params, { reject: true }).then((res) => {
if (!res.success) {
message.warning(res.message);
} else {
timeSub(60);
setChecking1(true)
setCertificate(res.result);
}
})
let timer;
function timeSub(waitTime, unit) {
clearTimeout(timer);
timer = setTimeout(function () {
if (waitTime == 0) {
setCodeText('发送验证码')
setChecking1(false)
setWaitStatus(false)
clearTimeout(timer);
} else {
if (waitTime < 40) {
setVoiceCodeTip(true)
}
setCodeText(`${waitTime }秒后重发`)
setWaitStatus(true)
timeSub(--waitTime, 1000);
}
}, unit || 0);
}
}
function handleSendVoiceCode(checkData, code) {
let calledVoiceSend = false;
const thePhone = code < 3 ? phone : regPhone;
const phoneLength = thePhone.trim().length;
if (isValidPhone(thePhone) && !calledVoiceSend) {
calledVoiceSend = true;
const params = {
certificate,
sig: checkData.sig,
sessionId: checkData.csessionid,
token: checkData.token,
scene: 'nc_login',
}
axios.postJSON('business/anon/sms/bSendLoginVoiceCode', params, { reject: true }).then((res) => {
if (!res.success) {
message.warning(res.message);
return;
}
message.success('验证码将以电话的形式通知到您,请注意接听');
timeSub(60);
let timer;
function timeSub(waitTime, unit) {
clearTimeout(timer);
timer = setTimeout(function () {
if (waitTime == 0) {
calledVoiceSend = false;
clearTimeout(timer);
} else {
calledVoiceSend = true;
timeSub(--waitTime, 1000);
}
}, unit || 0);
}
})
} else if (calledVoiceSend) {
message.warning('验证码将以电话的形式通知到您,请注意接听');
} else {
setBtnText('请输入正确的手机号');
setBtnDisabled(true);
setTimeout(function () {
setBtnText('登录');
setBtnDisabled(false);
}, 2500);
}
}
function handleSendCode(checkData) {
if (regWaitStatus) { return }
const phoneLength = regPhone.trim().length;
if (phoneLength == 11) {
const params = {
phone: regPhone,
sig: checkData.sig,
sessionId: checkData.csessionid,
token: checkData.token,
scene: 'nc_login',
serverType: 'TRIAL_SAAS',
sideType: 0, // 0 表示web端
}
axios.postJSON('business/anon/sms/sendSmsCode', params, { reject: true }).then((res) => {
if (!res.success) {
message.warning(res.message);
} else {
timeSub(60);
setChecking3(true);
setCertificate(res.result);
}
})
let timer;
function timeSub(waitTime, unit) {
clearTimeout(timer);
timer = setTimeout(function () {
if (waitTime == 0) {
setRegCodeText('发送验证码');
setRegWaitStatus(false)
setChecking3(false);
clearTimeout(timer);
} else {
if (waitTime < 40) {
setRegVoiceCodeTip(true)
}
setRegCodeText(`${waitTime }秒后重发`);
setRegWaitStatus(true)
timeSub(--waitTime, 1000);
}
}, unit || 0);
}
} else {
setRegBtnText('请输入正确的手机号');
setRegBtnDisabled(true)
setTimeout(function () {
setRegBtnText('提交');
setRegBtnDisabled(false)
}, 2500);
}
}
function handleRegiste(e) {
e.preventDefault();
const data = {
instName,
phone: regPhone,
code
};
function verifity(tips) {
setRegBtnText(tips);
setRegBtnDisabled(true)
setTimeout(function () {
setRegBtnText('提交');
setRegBtnDisabled(false)
}, 2500);
}
if (!data.phone) {
verifity('请输入手机号');
return;
}
if (data.phone.length != 11) {
verifity('请输入正确的手机号');
return;
}
if (!data.code) {
verifity('请输入验证码');
return;
}
if (!data.instName) {
verifity('请输入机构名');
return;
}
data.inviteCode = 'web-b'
data.contract = '-';
data.source = 'web-b-免费试用'
data.pwd = '';
data.serverType = 'TRIAL_SAAS';
axios.post('api-b/b/web/register', data).then((res) => {
if (res.resultCode == 1103) {
message.info('请输入正确的验证码');
return;
}
setInstName('');
setRegPhone('');
setCode('');
setModalVisible(false);
message.success("申请成功,我们会在1-2个工作日审核完,请耐心等待!", "提醒");
})
.catch((res) => {
setRegBtnText('提交');
setRegBtnDisabled(false);
});
}
function handleDownloadChrome() {
const url = 'http://www.chromeliulanqi.com/';
window.open(url, '_black');
}
function checkSend(code) {
const value = code < 3 ? phone : regPhone;
if (!value) {
message.warning('请输入手机号');
return;
}
if (value.length != 11) {
message.warning('请输入11位手机号')
return;
}
switch (code) {
case 1:
!_.isEmpty(checkObject1) && checkObject1.reset();
setOpenCheck1(true)
break;
case 2:
!_.isEmpty(checkObject2) && checkObject2.reset();
setOpenCheck2(true)
break;
case 3:
!_.isEmpty(checkObject3) && checkObject3.reset();
setOpenCheck3(true)
break;
case 4:
!_.isEmpty(checkObject4) && checkObject4.reset();
setOpenCheck4(true)
break;
default:
break;
}
}
async function checkAccount(code, callback = () => { }) {
const value = code < 3 ?
phone
: regPhone;
const userType = await axios
.postJSON('business/anon/b/checkUserType', { "mainAccount": value })
.then(({ result: { userType } }) => {
return userType
})
if (userType === 'CRM_INST') {
setUserType('CRM_INST');
callback('CRM_INST');
return;
}
callback();
}
return (
<div className="login-page" style={{ background: `url(${ require('../../images/main_banner.png') })`, backgroundSize: '100%', backgroundRepeat: 'no-repeat', backgroundColor: '#21242E' }}>
<div className="header">
<Row className="header-main" type="flex" justify="space-between" align="middle">
<Col>
<a target="_blank" href="http://www.xiaomai5.com/">
<img src={require("../../images/logo_primary_new.png")} className='logo' alt="" />
</a>
</Col>
<Col>
<Select defaultValue={api} style={{ width: 150 }} onChange={
(val) => {
LS.set('DRURL', val);
setApi(val);
DRURL = val;
LS.set('DRURL', DRURL);
}
}>
<Option value="">线路1-杭州</Option>
{
_.map(drList, (item) => {
return <Option value={`${item.url }/`}>{item.describe}</Option>
})
}
</Select>
</Col>
</Row>
</div>
<div className="login-main">
<div className="left-banner">
<img src='https://image.xiaomaiketang.com/xm/DXDsNKB3Fn.png' alt="" style={{ width: 448, marginTop: 60 }} />
</div>
<div className="login-box stage">
<div className="login">
<div className="r">
<div className="title">
<Tabs activeKey={loginStyle} tabBarStyle={{ border: 'none', padding: '0 25px' }} onChange={(activeKey) => { setLoginStyle(activeKey) }}>
<TabPane tab="密码登录" key="passwordLogin" />
<TabPane tab="验证码登录" key="phoneverifyLogin" />
</Tabs>
</div>
<form action="" className="login-form" onSubmit={handleLogin}>
<div className="form">
<div className="username" style={{ marginBottom: 16 }}>
<Input
type="phone"
autoComplete="off"
name="account"
maxLength={11}
placeholder="手机号"
value={phone}
onChange={(e) => { setPhone(e.target.value) }}
/>
</div>
{loginStyle == 'passwordLogin' &&
<div className="password" style={{ marginBottom: 16 }}>
<Input type={showPassword ? 'text' : 'password'} id="pwd" name="pwd" placeholder="密码" value={password} onChange={(e) => { setPwd(e.target.value) }} />
<span className="icon iconfont" id="password-icon" onClick={() => { setShowPassword(!showPassword) }} dangerouslySetInnerHTML={{ __html: showPassword ? '&#xe6af;' : '&#xe6ae;' }} />
</div>
}
{
loginStyle == 'phoneverifyLogin' &&
[
<div className="phoneverify">
<Input
type="text"
id="phoneverify"
name="phoneverify"
placeholder="验证码"
autoComplete="off"
value={phoneverify}
onChange={(e) => { setPhoneverify(e.target.value) }}
/>
<Popover
visible={openCheck1}
trigger="click"
title=""
content={<div>
<span style={{ fontSize: '12px', color: '#999', marginBottom: 8, display: 'block' }}>请完成安全验证</span>
<CheckBeforeSendCode
callback={(data, nc) => {
setCheckObject1(nc);
checkAccount(1, (userType) => {
handleSendSMSCode(data, userType);
setTimeout(() => {
setOpenCheck1(false);
}, 500)
})
}}
/>
</div>}
onVisibleChange={(value) => {
if (!value) {
setOpenCheck1(false);
}
}}
placement="bottomRight"
>
<div
className="btn"
id="sendVerifyCode"
onClick={() => {
if (checking1) return;
checkSend(1)
}}
>{codeText}</div>
</Popover>
</div>,
<div className="phoneverify-voice" style={{ display: voiceCodeTip ? 'block' : 'none', marginBottom: 10 }}>
<span style={{ color: '#333' }}>收不到短信? </span>
<Popover
visible={openCheck2}
trigger="click"
title=""
content={<div>
<span style={{ fontSize: '12px', color: '#999', marginBottom: 8, display: 'block' }}>请完成安全验证</span>
<CheckBeforeSendCode
callback={(data, nc) => {
handleSendVoiceCode(data, 2);
setCheckObject2(nc);
setTimeout(() => {
setOpenCheck2(false);
}, 500);
}}
/>
</div>}
onVisibleChange={(value) => {
if (!value) {
setOpenCheck2(false);
}
}}
placement="bottomRight"
>
<span
style={{ color: '#58B7EF', }}
id="sendVoiceVerifyCode"
onClick={() => {
checkSend(2)
}}
>使用语音验证码</span>
</Popover>
</div>
]
}
<div className="submit">
<div className="btn">
<button id='loginIn' type="submit" disabled={btnDisabled}>{btnText}</button>
</div>
<div className="apply" onClick={() => { setModalVisible(true) }}>
<span>免费试用</span>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div className="footer">
<div className="footer-main" style={{marginTop:4}}>
<span><span className="icon iconfont">&#xe627;</span>杭州市西湖区古墩路598号同人广场A座3楼</span>
<span className="tel ml22"><span className="icon iconfont">&#xe628;</span>400-6677-456(小麦助教) </span>
<span className="download-chrome ml22" onClick={handleDownloadChrome}><img src={require("../../images/chrome.png")} />前往下载chrome谷歌浏览器 </span>
</div>
<div className="footer-main mt8">
<span>@2015-2020 杭州杰竞科技有限公司</span>
<a target="_blank"
href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=33010602006090"><img src={GH} alt="" style={{width: '16px', height: '16px', display: 'inline-block', margin: '0 4px 0 0'}}/>浙公网安备33010602006090号</a>
<a target="_blank"
href="http://www.beian.miit.gov.cn/state/outPortal/loginPortal.action;jsessionid=oLD4DenLthr_n8liJdOYupeEe9iZYycUySDz15TmoSGC9ZeRF157!1870117190">浙ICP备15025826号-2</a>
<a target="_blank" href="https://image.xiaomaiketang.com/xm/ffXeG5fXn8.jpg">增值电信业务经营许可证:浙B2-20180802</a>
</div>
</div>
<div className="layout layout-reg" style={{ display: modalVisible ? 'block' : 'none' }}>
<div className="box">
<div className="reg">
<div className="t clearfix" onClick={() => { setModalVisible(false) }}>
<span style={{ float: 'right' }} className="close icon iconfont">&#xe608;</span>
</div>
<div className="c">
<div className="title">免费试用</div>
<div className="form" style={{ textAlign: 'center' }}>
<form action="" className="register-form" onSubmit={handleRegiste}>
<Input type="text" placeholder="机构名" name="instName" id="instName" autoComplete="off" value={instName} onChange={(e) => { setInstName(e.target.value) }} />
<Input
type="text"
placeholder="手机号"
name="phone"
id="phone"
maxLength={11}
autoComplete="off"
value={regPhone}
onChange={(e) => {
const value = (`${e.target.value }`).replace(/[^0-9]/g, '');
setRegPhone(value);
}}
/>
<div className="vertify-code">
<Input type="text" placeholder="验证码" name="code" id="code" autoComplete="off" value={code} onChange={(e) => { setCode(e.target.value) }} />
<Popover
visible={openCheck3}
trigger="click"
title=""
content={<div>
<span style={{ fontSize: '12px', color: '#999', marginBottom: 8, display: 'block' }}>请完成安全验证</span>
<CheckBeforeSendCode
callback={(data, nc) => {
handleSendCode(data);
setCheckObject3(nc);
setTimeout(() => {
setOpenCheck3(false);
}, 500);
}}
/>
</div>}
onVisibleChange={(value) => {
if (!value) {
setOpenCheck3(false);
}
}}
placement="bottomRight"
>
<div
className="btn"
id="sendCode"
onClick={() => {
if (checking3) return;
checkSend(3)
}}
>{regCodeText}</div>
</Popover>
</div>
<div className="phoneverify-voice" style={{ display: regVoiceCodeTip ? 'block' : 'none' }}>
<span style={{ color: '#686868' }}>收不到短信?</span>
<Popover
visible={openCheck4}
trigger="click"
title=""
content={<div>
<span style={{ fontSize: '12px', color: '#999', marginBottom: 8, display: 'block' }}>请完成安全验证</span>
<CheckBeforeSendCode
callback={(data, nc) => {
handleSendVoiceCode(data, 4);
setCheckObject4(nc);
setTimeout(() => {
setOpenCheck4(false);
}, 500);
}}
/>
</div>}
onVisibleChange={(value) => {
if (!value) {
setOpenCheck4(false);
}
}}
placement="bottomRight"
>
<span
style={{ color: '#FFAB1A', cursor: 'pointer' }}
id="sendRegVoiceVerifyCode"
onClick={() => {
checkSend(4)
}}
>使用语音验证码</span>
</Popover>
</div>
<button type="submit" disabled={regBtnDisabled}>{regBtnText}</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
)
}
export default withRouter(Login);
@import url('../../core/variables.less');
.login-page {
position: static; // background: url('../../images/main_banner.png');
// background-size: 100%;
font-family: "微软雅黑";
padding: 0;
height: 100%;
min-width: 1200px;
.login-main {
min-width: 1200px;
}
.header {
height: 60px;
background: #fff;
.header-main {
width: 80%;
margin: auto;
.logo {
height: 64px;
}
}
.ant-select-selection {
&:focus,
&:active,
&:hover {
outline: none;
border: none !important;
box-shadow: none;
}
&:hover {
color: #FC9C6B;
.ant-select-arrow {
color: #FC9C6B;
}
}
&:active {
border-color: #fff;
}
}
}
.left-banner {
// width: 448px;
position: fixed;
top: 50%;
left: 30%;
-webkit-transform: translate(-50%, -60%);
-moz-transform: translate(-50%, -60%);
-ms-transform: translate(-50%, -60%);
-o-transform: translate(-50%, -60%);
transform: translate(-50%, -60%);
.left-qrcorde {
margin: 25px auto 10px;
display: block;
}
.qrcorde-tip {
font-size: 12px;
color: rgba(255, 255, 255, 0.4);
text-align: center;
}
}
.login-box {
min-width: 360px;
height: 340px;
position: fixed;
top: 50%;
left: 70%;
-webkit-transform: translate(-50%, -60%);
-moz-transform: translate(-50%, -60%);
-ms-transform: translate(-50%, -60%);
-o-transform: translate(-50%, -60%);
transform: translate(-50%, -60%);
.go-to-site {
position: absolute;
bottom: -80px;
width: 200px;
margin: 0 auto;
left: 50%;
margin-left: -50px;
a {
color: #FFF;
text-decoration: none;
}
span.icon {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
-o-transform: rotate(180deg);
transform: rotate(180deg);
font-size: 12px;
display: inline-block;
margin-right: 10px;
}
}
.login {
display: flex;
display: -webkit-flex;
flex-direction: row;
-webkit-flex-direction: row;
height: 100%;
overflow: hidden;
background-color: #ffffff;
border-radius: 4px; //box-shadow: 0 0 17px @sun;
.l {
width: 280px;
height: 100%;
background: @sun;
background: -webkit-gradient(linear, left top, left bottom, from(#ffaa1a), to(#ff8634)) !important;
display: flex;
display: -webkit-flex;
-webkit-flex-direction: column;
flex-direction: column;
align-items: center;
color: #ffffff;
font-size: 12px;
justify-content: center;
-webkit-justify-content: center;
.logo {
height: 125px;
img {
height: 100%;
}
}
.name {
font-size: 16px;
margin-bottom: 20px;
}
.desc {
opacity: .7;
margin-bottom: 20px;
}
.items {
ul {
padding: 0;
li {
.icon {
-webkit-transform: scale(.8);
-moz-transform: scale(.8);
-ms-transform: scale(.8);
-o-transform: scale(.8);
transform: scale(.8);
display: inline-block;
margin-right: 10px;
}
line-height: 30px;
list-style-type: none;
}
}
}
}
.r {
flex: 1;
-webkit-flex: 1;
height: 100%;
padding: 30px;
box-sizing: border-box;
position: relative;
&.show-qrcode {
.qrcode {
display: block;
}
.top-right-tip {
.computer {
display: inline-block;
}
.icon-container {
display: none;
}
}
}
.qrcode {
display: none;
text-align: center;
position: absolute;
background: #FFF;
z-index: 1;
left: 20px;
top: 28px;
padding-top: 20px;
img {
display: inline-block;
width: 180px;
}
}
.top-right-tip {
cursor: pointer;
position: absolute;
top: 4px;
right: 4px;
.computer {
display: none;
}
.icon-container {
position: relative;
height: 32px;
width: 32px;
display: inline-block;
.tips {
width: 69px;
position: absolute;
top: 0;
right: 36px;
img {
width: 100%;
}
}
.shade {
position: absolute;
width: 100%;
height: 150%;
top: 0;
margin-left: -100%;
background: #FFF;
transform-origin: right top;
transform: rotate(-45deg);
}
}
span.icon {
font-size: 32px;
}
}
.title {
color: @sun;
margin-bottom: 30px;
display: flex;
display: -webkit-flex;
justify-content: space-between;
-webkit-justify-content: space-between;
.text1 {
color: black;
}
.icon {
font-size: 11px;
}
#login-method {
width: 100%;
text-align: center;
span {
color: #999;
font-weight: 400;
&:hover {
color: #333;
}
}
span.active {
font-weight: 500;
color: #333;
&::after {
content: '';
display: block;
width: 24px;
height: 4px;
border-radius: 3px;
background: #FF8534;
margin: 10px auto 0;
}
}
#password-login {
margin-right: 32px;
}
}
}
#password-icon {
color: #BFBFBF;
margin-right: 10px;
cursor: pointer;
&:hover {
color: #FC9C6B;
}
-webkit-user-select: none;
-moz-user-select:none;
-o-user-select:none;
-ms-user-select:none;
}
input {
display: block;
width: 100%;
height: 40px;
line-height: 40px;
border: 1px solid #e8e8e8; // border-bottom: 1px solid @xm-color-border;
padding-right: 30px;
padding-left: 10px;
margin-bottom: 16px;
background-color: transparent;
background-image: none;
border-radius: 4px;
box-sizing: border-box;
-webkit-transition: all .3s linear;
-moz-transition: all .3s linear;
-ms-transition: all .3s linear;
-o-transition: all .3s linear;
transition: all .3s linear;
&:focus,
&:active,
&:hover {
outline: none; // border: none!important;
// border-bottom: 1px solid @sun!important;
box-shadow: none;
border-color: #FF8534;
}
}
::-webkit-input-placeholder {
/* WebKit, Blink, Edge */
color: #ccc;
}
:-moz-placeholder {
/* Mozilla Firefox 4 to 18 */
color: #ccc;
}
::-moz-placeholder {
/* Mozilla Firefox 19+ */
color: #ccc;
}
:-ms-input-placeholder {
/* Internet Explorer 10-11 */
color: #ccc
}
input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
-webkit-box-shadow: 0 0 0 1000px white inset;
}
.username,
.password,
.phoneverify {
height: 40px;
position: relative;
color: #666666;
.icon {
position: absolute;
right: 5px;
top: 5px;
font-size: 20px;
}
#sendVerifyCode {
cursor: pointer;
display: flex;
display: -webkit-flex;
justify-content: center;
-webkit-justify-content: center;
align-items: center;
-webkit-align-items: center;
position: absolute;
right: 10px;
top: -53px; // border: 1px solid @sun;
color: #333;
height: 25px;
width: 90px;
border-radius: 3px;
margin-top: 60px;
font-size: 14px; // font-weight: 300;
&:hover {
color: #FF8534;
}
&::before {
content: '';
display: block;
height: 20px;
width: 1px;
background-color: #e8e8e8;
margin-right: 10px;
}
}
}
#sendVoiceVerifyCode {
cursor: pointer;
}
.phoneverify-voice {
// padding-left: 5px;
margin-top: 10px;
&::after {}
}
.submit {
position: absolute;
bottom: 20px;
width: 310px;
button {
// font-weight: 300;
}
}
.apply {
cursor: pointer;
text-align: right;
margin-top: 10px;
color: #999;
float: right; // font-weight: 300;
span.icon {
font-size: 12px;
margin-left: 7px;
}
&:hover {
color: #FC9C6B;
}
}
.btn {
button {
display: block;
width: 100%;
background: linear-gradient(90deg, rgba(255, 133, 52, 1) 0%, rgba(255, 173, 52, 1) 100%);
color: #fff;
font-size: 14px;
font-weight: 400;
line-height: 40px;
border-radius: 4px;
-webkit-transition: all .3s;
-moz-transition: all .3s;
-ms-transition: all .3s;
-o-transition: all .3s;
transition: all .3s;
cursor: pointer;
&:hover {
opacity: 0.8;
}
}
}
}
}
}
.footer {
// height: 60px; // padding: 0 60px;
// width: 80%;
background: #fff;
position: absolute;
bottom: 0;
right: 0;
left: 0;
color: #A2A6B2;
// line-height: 60px;
font-size: 14px;
overflow: hidden;
font-weight: 400;
padding:12px;
a{
display:inline-block;
text-align: center;
margin-left: 22px;
color: #A2A6B2;
// margin-top: 8px;
}
.footer-main {
width: 80%;
margin: auto;
text-align: center;
}
address {
float: left;
font-style: normal;
margin-bottom: unset;
}
.icon {
margin-right: 6px;
} // .tel{
// float: right;
// }
.download-chrome {
&:hover {
color: #Fc9C6B;
}
cursor: pointer;
// line-height: 60px;
display: inline-block; // width: 250px;
// position: absolute;
// left: 50%;
// margin-left: -90px;
img {
display: inline-block;
// height: 40px;
// padding: 10px 0;
width: 16px;
vertical-align: middle;
margin-right: 6px;
}
}
}
.stage {
-webkit-transition: all 0.5s linear;
-moz-transition: all 0.5s linear;
-ms-transition: all 0.5s linear;
-o-transition: all 0.5s linear;
transition: all 0.5s linear;
}
// .stage.blur {
// -ms-filter: blur(3px);
// filter: blur(3px);
// -webkit-filter: blur(3px);
// }
.layout {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, .2);
z-index: 999;
display: none;
&.active {
display: block;
}
.box {
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
input {
display: block;
width: 100%;
border: none;
border-bottom: 1px solid @xm-color-border;
padding-right: 30px;
background-color: transparent;
background-image: none;
border-radius: 0;
box-sizing: border-box;
-webkit-transition: all .3s linear;
-moz-transition: all .3s linear;
-ms-transition: all .3s linear;
-o-transition: all .3s linear;
transition: all .3s linear;
&:focus,
&:active,
&:hover {
outline: none;
border: none !important;
border-bottom: 1px solid @sun !important;
box-shadow: none;
}
}
input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
-webkit-box-shadow: 0 0 0 1000px white inset;
}
}
}
.layout .reg {
width: 400px;
height: 320px;
background: #FFFFFF;
border-radius: 6px;
padding: 10px;
.t {
.close {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
&:hover {
cursor: pointer;
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
-o-transform: rotate(90deg);
transform: rotate(90deg);
color: @sun;
}
}
}
.c {
width: 250px;
margin: 0 auto;
font-size: 13px;
.title {
text-align: center;
font-size: 14px;
}
.form {
margin-top: 20px;
input {
display: block;
margin-bottom: 20px;
border-bottom: 1px solid @xm-color-border;
width: 100%;
line-height: 30px;
}
.vertify-code {
position: relative;
.btn {
position: absolute;
background: @sun;
color: #FFFFFF;
line-height: 26px;
top: 0;
right: 0;
padding: 0 8px;
border-radius: 4px;
cursor: pointer;
box-shadow: 0 0px 0px 0px #FFF inset;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-ms-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
border: 1px solid @sun;
&:hover {
box-shadow: 0 0px 0px 1px #FFF inset;
}
}
}
button {
display: block;
width: 100%;
background: @sun;
color: #FFFFFF;
text-align: center;
line-height: 39px;
border-radius: 5px;
margin-top: 20px;
box-shadow: 0 0px 0px 0px #FFF inset;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-ms-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
&:hover {
box-shadow: 0 0px 0px 3px #FFF inset;
}
border: 1px solid @sun;
}
}
}
} // .api{
// position: absolute;
// right: 50px;
// top: 50px;
// }
.ant-select-selection--single {
height: 28px;
position: relative;
cursor: pointer;
background: transparent;
border: none;
color: #999; // width: 100px;
font-size: 28px; // font-weight: 300;
}
.ant-select-arrow {
color: #999;
}
}
\ No newline at end of file
import React from 'react'
import './Main.less';
import Bus from "@/core/bus";
class Main extends React.Component {
constructor(props) {
super(props);
this.state = {
menuType: 1,
}
}
componentDidMount() {
Bus.bind("menuTypeChange", (menuType) => {
this.setState({ menuType })
});
}
render() {
const { hasBanner } = this.props;
return (
<div
className={this.state.menuType ? `right-container has-nav ${hasBanner ? 'has_banner' : ''}` : `right-container has-nav right-container-vertical ${hasBanner ? 'has_banner' : ''}`}
id="rightContainer"
>
我是内容区
</div>
)
}
}
export default Main;
@import '../../core/variables.less';
@import '../../core/page.less';
@import '../../core/table.less';
@top-height: 50px;
.right-container {
position: absolute;
left: @xm-left-width;
top: @top-height;
right: 0;
bottom: 0;
background-color: #f0f2f5;
overflow-x: scroll;
z-index: 1;
&.right-container-vertical{
left:@xm-left-min-width;
.page{
.page{
left: @xm-left-min-width;
}
}
}
&.has_banner {
.page {
.page {
top: 100px;
}
}
}
> .right {
position: absolute;
left: 0;
top: 0;
right: 0;
min-height: 100%;
overflow-y: auto;
min-width: 1050px;
}
}
.right-container {
// min-width: 1186px;
&:before {
content: ' ';
height: 1px;
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: 2;
}
.right {
.normal-content {
padding-bottom: 50px;
.body {
> div {
// 页面标题头
section.content-header {
.xm-btn {
margin-left: 15px;
}
h1 {
font-size: 16px;
color: #898989;
font-weight: normal;
padding: 15px;
display: inline-block;
}
&.selectable {
margin: 15px;
padding: 0;
h1 {
box-sizing: border-box;
cursor: pointer;
display: inline-block;
background: #fff;
padding: 0;
border: 1px solid @border;
border-right: 0;
font-weight: bold;
a {
padding: 8px 30px;
font-weight: bold;
}
&.on {
border: 1px solid @primary;
background: @primary;
color: #fff;
}
&:nth-child(1) {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
&:nth-last-child(1) {
&.on {
border-right: 1px solid @primary;
}
border-right: 1px solid @border;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
}
&.multiple {
h1{
&.on {
border-left: 1px solid @border;
}
}
}
&.with-arrow {
border: 1px solid @xm-color-border;
display: inline-block;
font-size: 0;
border-radius: 10px;
overflow: hidden;
h1 {
display: inline-block;
padding: 0px 24px;
margin: 0;
cursor: default;
font-size: 15px;
line-height: 42px;
font-weight: bold;
position: relative;
background: #fff;
&:before,
&:after {
position: absolute;
content: ' ';
border: 22px solid transparent;
border-left: 15px solid #fff;
width: 0;
height: 0;
left: 99%;
top: 0;
z-index: 100;
}
&:after {
border-left: 15px solid #eee;
left: 100%;
z-index: 99;
}
&.on {
background: @primary;
&:before {
position: absolute;
content: ' ';
border: 23px solid transparent;
border-left: 17px solid @primary;
width: 0;
height: 0;
left: 100%;
top: -1px;
z-index: 100;
}
&:after {
display: none;
}
}
&:nth-last-child(1) {
&:before {
display: none;
}
}
}
}
}
}
// 右侧容器样式
.box {
padding: 16px;
margin: 0 16px;
background: #ffffff;
box-shadow: 0 2px 4px #ccc;
}
}
}
}
}
}
import React from "react";
import { HashRouter as Router, withRouter, Link } from "react-router-dom";
import "./Menu.less";
import classNames from "classnames";
import { Menu, Icon, Modal, Badge } from "antd";
import Bus from '@/core/bus'
const MenuItem = Menu.Item;
const SubMenu = Menu.SubMenu;
const mircoLink = ["cloudclass"];
window.Router = Router;
class Menus extends React.Component {
constructor(props) {
super(props);
this.state = {
menuType: 1, // 目录的宽屏和窄屏模式
};
}
async componentDidMount() {
Bus.bind("menuTypeChange", (menuType) => {
if (menuType) {
this.setState({ menuType });
} else {
this.setState({ openKeys: [] }, () => this.setState({ menuType }));
}
})
}
render() {
return (
<div id="left-container"
className={
this.state.menuType
? "left-container"
: "left-container left-container-vertical"
}>
<div className="left">
<div className="nav">
<Menu
defaultSelectedKeys={["1"]}
defaultOpenKeys={["sub1"]}
mode={this.state.menuType ? "inline" : "vertical"}
theme="dark"
inlineCollapsed={this.state.collapsed}
>
<SubMenu
key="1"
title={
<span>
<Icon type="mail" />
{!!this.state.menuType &&(
<span>课程管理</span>
)}
</span>
}
>
<Menu.Item key="1-1">
<span>直播课</span>
</Menu.Item>
<Menu.Item key="1-2">
<span>视频课</span>
</Menu.Item>
</SubMenu>
<Menu.Item key="2">
<Icon type="pie-chart" />
{!!this.state.menuType &&(
<span>资料云盘</span>
)}
</Menu.Item>
<SubMenu
key="2"
title={
<span>
<Icon type="mail" />
{!!this.state.menuType &&(
<span>课程管理</span>
)}
</span>
}
>
<Menu.Item key="3-1">
<span>讲师管理</span>
</Menu.Item>
<Menu.Item key="3-2">
<span>用户管理</span>
</Menu.Item>
<Menu.Item key="3-3">
<span>课程分类</span>
</Menu.Item>
<Menu.Item key="3-4">
<span>店铺装修</span>
</Menu.Item>
</SubMenu>
</Menu>
</div>
</div>
<div></div>
</div>
);
}
}
export default withRouter(Menus);
@import '../../core/variables.less';
@top-height: 50px;
@menu-bakg: #21242e;
@active-color: #ff8534;
.left-container {
position: absolute;
z-index: 2;
top: @top-height;
left: 0;
bottom: 0;
width: @xm-left-width;
background: @menu-bakg;
color: #FFFFFF;
.ant-menu {
padding-left: 0 !important;
background: transparent;
}
.left {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
display: flex;
display: -webkit-flex;
flex-direction: column;
-webkit-flex-direction: column;
height: 100%;
.nav {
-webkit-flex: 1;
cursor: default;
font-size: 16px;
margin-top: 16px;
height: calc(~'100% - 72px');
overflow: auto;
&::-webkit-scrollbar {
display: none;
}
.icon {
margin-right: 20px
}
.fistLevel {
position: relative;
&:hover {
.ant-menu-submenu-title,
.home-title {
color: #fff !important;
.iconfont {
color: #fff !important;
}
.listType {
background: #fff !important;
}
.ant-menu-submenu-arrow {
&::before {
background: #fff !important;
}
&::after {
background: #fff !important;
}
}
}
}
.submenu-item-cls {
position: relative;
&.new-icon {
position: absolute;
background: #d90b1b;
height: 8px;
width: 8px;
border-radius: 50%;
right: 56px;
top: 10px;
}
}
.menu-item {
position: relative;
.menu-item-cls {
&.new-icon {
&::before {
line-height: 18px;
content: "\65B0\529F\80FD";
display: block;
width: 39px;
height: 18px;
background-color: #d90b1b;
background-size: cover;
color: #fff;
font-size: 10px;
position: absolute;
top: 10px;
right: 6px;
text-align: center;
border-radius: 10px;
}
}
}
}
}
.ant-menu-submenu-selected,
.ant-menu-item-selected {
&:hover {
.iconfont {
color: @active-color !important;
}
.ant-menu-submenu-title,
.home-title {
color: @active-color !important;
.iconfont {
color: @active-color !important;
}
.listType {
background: @active-color !important;
}
.ant-menu-submenu-arrow {
&::before {
background: @active-color !important;
}
&::after {
background: @active-color !important;
}
}
}
}
}
.ant-menu-submenu-title {
line-height: 40px;
height: 40px;
}
.ant-menu-submenu > .ant-menu {
background-color: transparent;
}
.ant-menu-submenu,
.ant-menu-item {
position: relative;
transition: none !important;
background: @menu-bakg;
color: #9A9DA7;
width: 100%;
.icon {
color: #9A9DA7;
}
div {
.name {
margin-left: 15px;
}
position: relative;
.listType {
width: 5px;
height: 5px;
background: #9A9DA7;
border-radius: 50%;
top: 18px;
left: 5px;
position: absolute;
}
}
}
.ant-menu-item {
color: @xm-color-text-menu;
}
.ant-menu-item-selected {
.name {
color: #fff;
}
}
.activeMenu,
.ant-menu-item-selected {
background: @menu-bakg;
color: @active-color;
.icon {
color: @active-color;
}
.ant-menu-submenu-arrow {
&::before {
background: @active-color;
}
&::after {
background: @active-color;
}
}
}
.rc-menu-hidden {
display: none;
}
.homeBar {
.iconfont {
transition: none;
}
.ant-menu-submenu-title:after {
display: none;
}
}
}
.border-tip {
display: inline-block;
margin: 0 auto;
border: 1px solid #979797;
height: 28px;
line-height: 28px;
border-radius: 14px;
padding: 0 8px;
box-sizing: content-box;
cursor: pointer;
}
.referral-tip {
position: relative;
text-align: center;
img{
width: 121px;
cursor: pointer;
}
.gif-style {
width: 180px;
}
.referral-content{
position: relative;
width:116px;
height:28px;
white-space: nowrap;
border-radius:14px;
border:1px solid rgba(255,133,52,1);
font-size:13px;
line-height:25px;
padding-left: 20px;
color:rgba(255,133,52,1);
margin-left: 36px;
cursor: pointer;
&::before{
position: absolute;
top: 0px;
left: -11px;
content: '';
width: 25px;
height: 26px;
background: url("https://image.xiaomaiketang.com/xm/r2mDMKFtAw.png") no-repeat center;
background-size: 100% auto;
}
}
.close-referral {
position: absolute;
top: -7px;
right: 22px;
display: inline-block;
width: 10px;
height: 10px;
background: url("https://image.xiaomaiketang.com/xm/jBG6Hp4fF7.png") no-repeat center;
background-size: 100% auto;
cursor: pointer;
}
}
.pay-warning {
.icon {
color: #FBD140;
font-size: 16px;
margin-right: 4px;
}
.tip {
float: right;
color: #fff;
}
}
.update-order {
.updated {
margin: 10px 0;
color: #FFBF02;
border: 1px solid #FFBF02;
}
.upgrade_wrap {
margin: 10px 0;
text-align: center;
cursor: pointer;
&.zoom_in {
animation-duration: 0.5s;
animation-fill-mode: both;
animation-name: zoomIn;
}
img {
width: 130px;
height: 55px;
}
}
}
.copy-right {
padding-top: 10px;
padding-bottom: 10px;
display: flex;
display: -webkit-flex;
align-items: center;
-webkit-align-items: center;
justify-content: center;
-webkit-justify-content: center;
img {
width: 80px;
}
}
.questionButton {
position: fixed;
right: 0;
bottom: 100px;
width: 50px;
height: 100px;
z-index: 999;
background: #0c0c0c;
}
}
&.left-container-vertical {
width: 62px;
.ant-badge-not-a-wrapper .ant-badge-count{
box-shadow: none;
}
.left {
.ant-menu-item {
text-align: center;
}
.ant-menu-submenu-arrow {
display: none !important;
}
.ant-menu-submenu-title {
font-size: 25px;
line-height: 50px;
height: 50px;
text-align: center;
}
.ant-menu-vertical .ant-menu-submenu-title {
text-overflow: inherit;
}
.ant-menu-submenu-vertical>.ant-menu-submenu-title:after {
display: none;
}
.title {
text-align: center;
}
.pay-warning {
display: none;
}
.icon {
margin-right: 0px;
}
}
}
.ant-menu-submenu-inline {
.ant-menu-item {
>div {
padding-left: 10px;
.listType {
left: 12px !important;
}
}
}
}
.ant-menu-vertical.ant-menu-sub {
min-width: 135px;
.ant-menu-item {
&:nth-child(1) {
padding-top: 15px;
height: 57px;
}
&:nth-last-child(1) {
padding-bottom: 15px;
height: 57px;
}
>div {
padding-left: 10px;
.listType {
left: 12px !important;
}
}
}
}
.left .nav .ant-menu-item.ant-menu-item-selected div .listType {
background: @active-color !important;
}
.market-item-name {
position: relative;
.new-tip {
position: absolute;
top: 5px;
right: -34px;
width: 32px;
border-radius: 10px;
background: red;
color: #fff;
text-align: center;
height: 14px;
line-height: 13px;
font-size: 12px;
}
}
.market-badge {
.ant-badge-dot {
box-shadow: unset;
height: 10px;
width: 10px;
margin-left: 10px;
}
}
.menu-item-content{
position: relative;
.menu-item-tips{
position: absolute;
font-size: 12px;
color: #fff;
background: #EC4B35;
line-height: 18px;
height: 18px;
border-radius: 10px;
padding: 0 4px;
right: -11px;
top: 50%;
margin-top: -8px;
z-index: 1;
}
}
}
.ant-menu-submenu-popup>.ant-menu {
background: @menu-bakg !important;
color: #9A9DA7;
padding-left: 15px;
width: 132px;
min-width: auto;
li {
padding-left: 22px;
padding-right: 0;
width: 117px;
}
.listType {
width: 5px;
height: 5px;
background: #9A9DA7;
border-radius: 50%;
top: 18px;
left: 5px;
position: absolute;
}
.ant-menu-item-selected {
background: @menu-bakg;
color: #fff;
.listType {
background: @active-color;
}
}
&:hover {
.ant-menu-item-active {
color: #fff;
.listType {
background: #fff;
}
}
.ant-menu-item-selected {
.listType {
background: @active-color;
}
}
}
}
.v4-to-v5-update-modal {
.ant-modal-body {
padding: 0 !important;
.success-box {
position: relative;
.modal-main-bg {
width: 100%;
}
.try-btn {
background: linear-gradient(90deg, rgba(255, 158, 82, 1) 0%, rgba(255, 73, 31, 1) 100%);
box-shadow: 1px 10px 13px 0px rgba(230, 100, 0, 0.35);
width: 244px;
height: 50px;
line-height: 50px;
border-radius: 7px;
margin: auto;
bottom: 45px;
position: absolute;
z-index: 10;
color: #fff;
font-size: 23px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
text-align: center;
left: 0;
right: 0;
cursor: pointer;
}
}
.failed-box {
padding: 48px 72px 40px;
.close-bg {
width: 160px;
margin: auto;
display: block;
}
.content {
font-size: 16px;
color: #333;
margin-top: 24px;
}
.tip {
margin-top: 12px;
color: #999;
font-size: 16px;
}
.close-btn {
margin: auto;
margin-top: 90px;
color: #fff;
background: #FF8534;
border-radius: 4px;
width: 200px;
height: 40px;
line-height: 40px;
font-size: 16px;
text-align: center;
}
}
}
.ant-modal-close-x {
display: none;
}
}
@-webkit-keyframes zoomIn {
0% {
-webkit-transform: scale(0) translate3d(0%, 0%, 0);
transform: scale(0) translate3d(0%, 0%, 0);
opacity: 0;
}
100% {
-webkit-transform: scale(1) translate3d(-0%, 0%, 0);
transform: scale(1) translate3d(-0%, 0%, 0);
opacity: 1;
}
}
@keyframes zoomIn {
0% {
-webkit-transform: scale(0) translate3d(0%, 0%, 0);
transform: scale(0) translate3d(0%, 0%, 0);
opacity: 0;
}
100% {
-webkit-transform: scale(1) translate3d(-0%, 0%, 0);
transform: scale(1) translate3d(-0%, 0%, 0);
opacity: 1;
}
}
\ No newline at end of file
import PropTypes from 'prop-types';
import { Modal, Input, Form, Button, message, Row, Col } from 'antd';
import md5 from 'blueimp-md5';
import User from '@/core/user';
import { resolve } from 'url';
const FormItem = Form.Item;
export default class PasswordModal extends BaseComponent {
constructor(props) {
super(props);
this.state = {
newpwd: "",
renewpwd: "",
verifyCode: "",
phone: Number(LS.get("uPhone")) || Number(LS.get("bindingPhone")),
openEye: false,
showTip: false,
isSetPwd: window.currentUserInstInfo.isSetPwd,
openSetForm: false,
};
}
handleChange = e => {
let newState = {};
newState[e.target.name] = e.target.value.trim();
this.setState(newState);
};
//点击保存
handleSave = () => {
let newpwd = this.state.newpwd,
renewpwd = this.state.renewpwd,
verifyCode = this.state.verifyCode,
phone = this.state.phone;
if (verifyCode == "" && this.state.isSetPwd) {
message.warning("验证码不能为空!");
return new Promise((resolve, reject) => { });
}
if (newpwd == "") {
message.error("请输入密码");
return new Promise((resolve, reject) => { });
}
if (newpwd.match(/^[0-9]*$/) || newpwd.match(/^[a-zA-Z]*$/)) {
message.warning("密码不能为纯数字或纯字母!");
return new Promise((resolve, reject) => { });
}
else if (!newpwd.match(/^[a-zA-Z0-9]{6,16}$/)) {
message.warning("密码为6-16位数字与字母!");
return new Promise((resolve, reject) => { });
} else {
if (newpwd.length < 6 || newpwd.length > 20) {
message.error("密码长度为6-20个字符");
return new Promise((resolve, reject) => { });
}
return axios.post("api-b/b/changePassword", {
phone: phone,
newpwd: md5(newpwd),
code: verifyCode
})
.then(res => {
if (res.resultCode == 0) {
message.success("修改成功, 即将退出重新登录~");
setTimeout(() => {
User.logout();
}, 500);
} else {
message.error(res.resultMsg);
}
});
}
};
sendVoiceCode() {
let phone = Number(LS.get("uPhone")) || Number(LS.get("bindingPhone"));
return window.axios.post('api-b/b/send/voiceAuthCode', { phone }).then(() => {
message.warning('验证码将以电话的形式通知到您,请注意接听');
});
}
//获取验证码
getVerifyCode = () => {
const self = this;
let phone = Number(LS.get("uPhone")) || Number(LS.get("bindingPhone"));
axios
.post("api-b/b/changePassword/authcode", {
phone: phone
})
.then(() => {
message.success("验证码已发送");
});
let haveSend = $(".sendVerifyCodes");
if (haveSend.hasClass("wait")) return;
let timer;
let timeSub = (waitTime, unit) => {
clearTimeout(timer);
timer = setTimeout(function () {
if (waitTime == 0) {
haveSend.removeClass("wait").text("发送验证码");
clearTimeout(timer);
} else {
if (waitTime < 40) {
if (!self.state.showTip) {
self.setState({ showTip: true });
setTimeout(() => self.setState({ showTip: false }), 40000);
}
}
haveSend.addClass("wait").text(waitTime + "秒后重发");
timeSub(--waitTime, 1000);
}
}, unit || 0);
};
if (true) {
timeSub(60);
}
};
render() {
const { phone, openEye, showTip, isSetPwd, openSetForm } = this.state;
return (
<Form>
<FormItem
label="手机号"
labelCol={{ span: 2 }}
>
<span>{phone}</span>
</FormItem>
{openSetForm ?
[isSetPwd && <FormItem
label="验证码"
labelCol={{ span: 2 }}
>
<Input
id="verify_code_input"
type="text"
name="verifyCode"
value={this.state.verifyCode}
placeholder="请输入验证码"
onChange={this.handleChange}
style={{ width: 240 }}
/>
<Button
id="send_verify_codes_btn"
type="button"
className='sendVerifyCodes'
style={{ marginLeft: 8 }}
onClick={this.getVerifyCode}
>
获取验证码
</Button>
{showTip && <div style={{ fontSize: '12px' }}>
<span style={{ color: "#686868" }}>收不到短信?</span>
<span
style={{ color: "#FFAB1A", cursor: "pointer" }}
id="sendRegVoiceVerifyCode"
onClick={this.sendVoiceCode}
>
使用语音验证码
</span>
</div>}
</FormItem>,
<FormItem
label={!isSetPwd ? '登录密码' : '新密码'}
labelCol={{ span: 2 }}
>
<input style={{ display: 'none' }} />
<Input
id="new_password_input"
type={openEye ? 'string' : 'password'}
value={this.state.newpwd}
name="newpwd"
style={{ width: 240 }}
onChange={this.handleChange}
placeholder="6-16位数字或字母,区分大小写"
suffix={openEye ?
<span
className="icon iconfont"
onClick={() => this.setState({ openEye: false })}
style={{ cursor: 'pointer', color: '#999' }}
>&#xe6b5;</span>
: <span
className="icon iconfont"
onClick={() => this.setState({ openEye: true })}
style={{ cursor: 'pointer', color: '#999' }}
>&#xe6dc;</span>
}
/>
</FormItem>,
<Row>
<Col span={2}>
</Col>
<Col span={18}>
<div style={{ display: 'block', lineHeight: 2.5 }}>
<Button
id="save_new_password_btn"
type="primary"
onClick={() => {
this.handleSave().then(() => {
this.setState({ isSetPwd: true, openSetForm: false });
});
}}
>
保存
</Button>
<Button
id="cancel_new_password_btn"
type=""
style={{ marginLeft: 16 }}
onClick={() => {
this.setState({ openSetForm: false })
}}
>
取消
</Button>
</div>
</Col>
</Row>
]
: <FormItem
label="登录密码"
labelCol={{ span: 2 }}
>
{!isSetPwd ?
<Button id="edit_password_btn" onClick={() => this.setState({ openSetForm: true })}>
设置密码
</Button>
: <div>
******
<Button
id="reedit_password_btn"
style={{ marginLeft: 8 }}
onClick={() => this.setState({ openSetForm: true })}
>
重设密码
</Button>
</div>
}
</FormItem>
}
</Form>
);
}
}
PasswordModal.propTypes = {
};
\ No newline at end of file
import PropTypes from 'prop-types';
import { Form, Button, message, Switch, Input, Row, Col } from 'antd';
import {
withRouter
} from 'react-router-dom';
import UpLoad from "../common/UpLoad";
import PasswordModal from './PasswordModal';
import './UserInfo.less';
import Bus from '../../core/bus';
import { HookContext } from '../../routes';
const FormItem = Form.Item;
class UserInfo extends BaseComponent {
constructor(props) {
super(props);
this.state = {
avatar: window.currentUserInstInfo.avatar || '',
nickName: window.currentUserInstInfo.nickName || '',
homeworkNotice: false,
commentNotice: false,
submitNotice: false,
fileNotice: false,
};
}
componentDidMount() {
window.NewVersion ? this.newFetchMessageControl(): this.fetchMessageControl();
}
newFetchMessageControl() {
axios.Business('public/config/getAdminConfigs').then((res) => {
let data = {};
_.map(res.result, (item) => {
if (item.configType == 'HOMEWORK_REVERT') {
data.homeworkNotice = item.configValue == 'TRUE';
} else if (item.configType == 'ASSESSMENT_REVERT') {
data.commentNotice = item.configValue == 'TRUE';
} else if (item.configType == 'MI_PUSH_T_SUBMIT_HOMEWORK') {
data.submitNotice = item.configValue == 'TRUE';
} else if (item.configType == 'MI_PUSH_T_ARCHIVES_REVERT') {
data.fileNotice = item.configValue == 'TRUE';
}
})
this.setState(data);
})
}
fetchMessageControl() {
axios.post('api-b/b/inst/adminConfig').then((res) => {
if (res.data) {
try {
const homeworkNotice = !!(_.find(res.data, (item) => {
return item.code == '1';
})).status;
const commentNotice = !!(_.find(res.data, (item) => {
return item.code == '2';
})).status;
this.setState({ homeworkNotice, commentNotice });
} catch (error) {
// this._disconnected(ERROR.INTERNAL_ERROR.code, format(ERROR.INTERNAL_ERROR, [error.message, error.stack.toString()]));
// return;
}
}
});
}
changeMessageControl(messageType, status) {
window.NewVersion ?
axios.Business('public/config/modifyAdminConfig', { configType: ENUM.adminConfig[messageType], configValue: status == 1 ? 'TRUE' : 'FALSE' }).then(() => {
this.new FetchMessageControl();
})
: axios.post('api-b/b/inst/edit/adminConfig', { messageType, status }).then(() => {
this.fetchMessageControl();
});
}
handleEditNickName = () => {
// if (!this.state.nickName) {
// message.warning('请填写昵称');
// return
// }
const query = {
nickName: this.state.nickName
}
axios.post('api-b/b/inst/edit/nickName', query).then((res) => {
message.success('保存成功');
Bus.trigger('changeNickName')
})
}
render() {
const { avatar, homeworkNotice, commentNotice, submitNotice, fileNotice } = this.state;
return (
<div className="page user-info">
<div className="page-content">
<section className="content-header">
<h1>个人信息</h1>
</section>
</div>
<div className="box first">
<Form>
<header className="title">个人信息</header>
<FormItem
label="个人头像"
labelCol={{ span: 2 }}
>
<div id="avatar_edit" className="img-box" style={{ width: 54, height: 54, display: 'inline-block' }}>
<UpLoad
addIcon={avatar ?
<span className="icon iconfont">&#xe60b;</span>
: <span
className="icon iconfont"
style={{ fontSize: '12px' }}
>上传头像</span>
}
width={54}
height={54}
img={avatar}
radius="50%"
onChange={img => {
this.state.banner = img;
axios.post("api-b/b/inst/edit/avatar", {
avatar: img,
adminId: window.currentUserInstInfo.adminId,
})
.then(res => {
this.setState({ avatar: img });
Bus.trigger('update_avatar', img);
message.success("头像上传成功");
});
}}
/>
</div>
</FormItem>
<FormItem
label="姓名"
labelCol={{ span: 2 }}
>
<span>{window.currentUserInstInfo.adminName}</span>
</FormItem>
<FormItem
label="昵称"
labelCol={{ span: 2 }}
>
<Input
id="nick_name_input"
value={this.state.nickName}
placeholder="昵称不能超过10个字符"
style={{ width: 200 }}
onChange={(event) => {
let nickName = event.target.value;
this.setState({ nickName });
}} />
<Row>
<Col span={2}></Col>
<Col>
<span className="icon iconfont" style={{ color: '#20A1FF', marginRight: 10 }}>&#xe64d;</span>“昵称”将用于家长端中的家校互动展示
</Col>
</Row>
</FormItem>
<FormItem>
<Col span={2}></Col>
<Button
id="update_user_info_btn"
onClick={this.handleEditNickName}
type="primary" >
更新信息
</Button>
</FormItem>
</Form>
</div>
<div className="box">
<header className="title">账号与密码</header>
<PasswordModal />
</div>
<div className="box" style={{ marginBottom: 24 }}>
<header className="title">新消息通知</header>
<Form>
{window.NewVersion && <FormItem
label="作业提交提醒"
labelCol={{ span: 3 }}
>
<Switch
id="homework_notice_switch"
checked={submitNotice}
onChange={() => this.changeMessageControl(38, submitNotice ? 0 : 1)}
style={{ marginLeft: 30 }}
/>
</FormItem>}
<FormItem
label="作业回复提醒"
labelCol={{ span: 3 }}
>
<Switch
id="homework_notice_switch"
checked={homeworkNotice}
onChange={() => this.changeMessageControl(1, homeworkNotice ? 0 : 1)}
style={{ marginLeft: 30 }}
/>
</FormItem>
<FormItem
label="点评回复提醒"
labelCol={{ span: 3 }}
>
<Switch
id="comment_notice_switch"
checked={commentNotice}
onChange={() => this.changeMessageControl(2, commentNotice ? 0 : 1)}
style={{ marginLeft: 30 }}
/>
</FormItem>
{window.NewVersion && <FormItem
label="成长档案回复提醒"
labelCol={{ span: 3 }}
>
<Switch
id="homework_notice_switch"
checked={fileNotice}
onChange={() => this.changeMessageControl(31, fileNotice ? 0 : 1)}
style={{ marginLeft: 30 }}
/>
</FormItem>}
</Form>
</div>
</div>
);
}
}
UserInfo.contextType = HookContext;
export default withRouter(UserInfo);
\ No newline at end of file
.user-info {
.box {
margin-top: 36px;
padding-top: 0;
&.first {
margin-top: 50px;
}
.title {
font-weight: 500;
display: block;
font-size: 18px;
color: #333;
line-height: 50px;
border-bottom: 1px solid #e8e8e8;
margin-bottom: 24px;
}
.img-box {
.icon {
cursor: pointer;
}
}
}
}
\ No newline at end of file
import React from 'react';
class testPage extends React.Component {
constructor(props) {
super(props);
this.state = {}
}
render() {
return (
<div className="prepare-lesson-page page">
<div className="content-header">测试</div>
<div className="box content-body">
测试内容
</div>
</div>
)
}
}
export default testPage;
\ No newline at end of file
import React from 'react';
import { Table } from 'antd';
import Service from '@/common/js/service';
import './index.less';
class VideoCourse extends React.Component {
constructor(props) {
super(props);
const { instId } = window.currentUserInstInfo;
this.state = {
query: {
instId,
size: 10,
current: 1,
},
dataSource: []
}
}
componentDidMount() {
this.handleFetchVideoCourseList();
}
parseColumns = () => {
const columns = [
{
title: '视频课',
key: 'scheduleName',
dataIndex: 'scheduleName',
width: '25%',
},
{
title: '学员人数',
key: "stuNum",
dataIndex: "stuNum",
},
{
title: '创建人',
key: 'teacherName',
dataIndex: 'teacherName'
},
{
title: '操作',
key: 'operate',
dataIndex: 'operate',
render: (val, record) => {
return (
<div className="operate">
<div className="operate__item">分享</div>
<span className="operate__item split"> | </span>
<div className="operate__item">编辑</div>
<span className="operate__item split"> | </span>
<div className="operate__item">删除</div>
</div>
)
}
}
];
return columns;
}
handleFetchVideoCourseList = () => {
Service.Apollo('public/apollo/lessonScheduleListPage', this.state.query)
.then((res) => {
const { result = {} } = res;
const { records = [] } = result;
this.setState({
dataSource: records
})
})
}
render() {
const { dataSource } = this.state;
return (
<div className="video-course">
<div className="page-header">视频课</div>
<div className="page-body">
<Table
rowKey={record => record.id}
dataSource={dataSource}
columns={this.parseColumns()}
/>
</div>
</div>
)
}
}
export default VideoCourse;
.video-course {
.operate {
display: flex;
&__item {
color: #FF7519;
cursor: pointer;
&.split {
margin: 0 8px;
}
}
}
}
\ No newline at end of file
<!--
* @Author: 吴文洁
* @Date: 2020-04-29 10:18:07
* @LastEditors: 吴文洁
* @LastEditTime: 2020-04-29 10:18:23
* @Description:
-->
### 各个领域下的路由配置
\ No newline at end of file
/*
* @Author: 吴文洁
* @Date: 2020-04-29 10:26:32
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-27 10:07:47
* @Description: 内容线路由配置
*/
import { MenuConfig } from '@/routes/interface';
import VideoCourse from '@/modules/video-course';
import ClassBook from '@/modules/class-book';
import TestPage from '@/modules/test';
const CloudClassConfig: MenuConfig = {
key: 'cloudClass',
name: '云课堂',
routes: [
{
key: 'video_course',
name: '视频课',
path: '/cloudclass/video_course',
component: VideoCourse
},
{
key: 'prepare_lesson',
name: '资料云盘',
path: '/cloudclass/prepare_lesson',
component: ClassBook
},
{
key: 'test',
name: '页面测试',
path: '/cloudclass/test',
component: TestPage
},
]
};
export default CloudClassConfig;
\ No newline at end of file
/*
* @Author: 吴文洁
* @Date: 2020-04-28 18:05:30
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-13 11:23:36
* @Description:
*/
import { MenuConfig, RouteConfig } from '@/routes/interface';
import CloudClass from './config/cloudClass';
// 领域路由配置
export const menuConfigs: MenuConfig[] = [ CloudClass ];
/** 所有处理后的路由的集合,用于生成Route组件 */
const allRoutes: RouteConfig[] = menuConfigs.map((config: MenuConfig) => {
return config.routes || [];
}).reduce((prev: RouteConfig[], next: RouteConfig[]) => {
return prev.concat(...next);
});
export default allRoutes;
/*
* @Author: 吴文洁
* @Date: 2020-04-28 18:10:07
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-13 10:59:08
* @Description:
*/
/** 路由配置,最终解析后转给<Route>组件 */
export interface RouteConfig {
/** 标题,用于route组件和kio的description */
name?: string;
/** 子菜单key */
key?: string;
/** 子菜单路径 */
path?: string;
component?: React.ComponentType<any>;
// 是否精确匹配
exact?: boolean;
}
/** 左侧的菜单配置 */
export interface MenuConfig {
// 菜单名称
name: string;
// 菜单key
key: string;
// 菜单对应的路由
path?: string;
// 子路由
routes?: RouteConfig[];
}
\ No newline at end of file
// This optional code is used to register a service worker.
// register() is not called by default.
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on subsequent visits to a page, after all the
// existing tabs open on the page have been closed, since previously cached
// resources are updated in the background.
// To learn more about the benefits of this model and instructions on how to
// opt-in, read https://bit.ly/CRA-PWA
const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.0/8 are considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);
type Config = {
onSuccess?: (registration: ServiceWorkerRegistration) => void;
onUpdate?: (registration: ServiceWorkerRegistration) => void;
};
export function register(config?: Config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(
process.env.PUBLIC_URL,
window.location.href
);
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
return;
}
window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) {
// This is running on localhost. Let's check if a service worker still exists or not.
checkValidServiceWorker(swUrl, config);
// Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
console.log(
'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://bit.ly/CRA-PWA'
);
});
} else {
// Is not localhost. Just register service worker
registerValidSW(swUrl, config);
}
});
}
}
function registerValidSW(swUrl: string, config?: Config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
if (installingWorker == null) {
return;
}
installingWorker.onstatechange = () => {
if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) {
// At this point, the updated precached content has been fetched,
// but the previous service worker will still serve the older
// content until all client tabs are closed.
console.log(
'New content is available and will be used when all ' +
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
);
// Execute callback
if (config && config.onUpdate) {
config.onUpdate(registration);
}
} else {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
console.log('Content is cached for offline use.');
// Execute callback
if (config && config.onSuccess) {
config.onSuccess(registration);
}
}
}
};
};
})
.catch(error => {
console.error('Error during service worker registration:', error);
});
}
function checkValidServiceWorker(swUrl: string, config?: Config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl, {
headers: { 'Service-Worker': 'script' }
})
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type');
if (
response.status === 404 ||
(contentType != null && contentType.indexOf('javascript') === -1)
) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => {
window.location.reload();
});
});
} else {
// Service worker found. Proceed as normal.
registerValidSW(swUrl, config);
}
})
.catch(() => {
console.log(
'No internet connection found. App is running in offline mode.'
);
});
}
export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready
.then(registration => {
registration.unregister();
})
.catch(error => {
console.error(error.message);
});
}
}
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom/extend-expect';
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"baseUrl": "src",
"paths": {
"@/*": ["*"]
}
},
"include": [
"src"
]
}
{
"extends": [
"tslint:recommended",
"tslint-react"
],
"rules": {
"indent": [true, "spaces", 2],
"space-before-function-paren": false,
"no-angle-bracket-type-assertion": false,
"callable-types": false,
"unified-signatures": false,
"no-string-throw": false,
"ban-types": false,
"no-console": [true, "debug", "info", "log", "time", "timeEnd", "trace"],
"no-unnecessary-initializer": false,
"force-empty-line-after-jsx-annotation": true,
"jsx-alignment": false,
"jsx-no-multiline-js": false,
"jsx-wrap-multiline": false,
"jsx-no-string-ref": false,
"jsx-self-close": false,
"quotemark": [true, "single", "jsx-double"],
"member-access": false,
"arrow-parens": false,
"object-literal-sort-keys": false,
"member-ordering": [false],
"variable-name": false,
"no-var-requires": false,
"only-arrow-functions": [false],
"no-reference": false,
"trailing-comma": [false],
"prefer-const": true,
"no-namespace": [true, "allow-declarations"],
"no-empty-interface": false,
"max-line-length": [true, 200],
"react/jsx-no-undef": [2, { "allowGlobals": true }]
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
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