Commit 9e46dec4 by maolipeng

Merge branch 'dev' of…

Merge branch 'dev' of ssh://xmgit.ixm5.cn:10022/xiaomai-cloud-class/xiaomai-cloud-class-web into dev
parents 6e0718c5 57ea00d5
'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 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 vConsolePlugin = require('vconsole-webpack-plugin')
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 postcssNormalize = require('postcss-normalize')
const appPackageJson = require(paths.appPackageJson)
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'
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 shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';
const isExtendingEslintConfig = process.env.EXTEND_ESLINT === 'true'
const isExtendingEslintConfig = process.env.EXTEND_ESLINT === 'true';
const imageInlineSizeLimit = parseInt(process.env.IMAGE_INLINE_SIZE_LIMIT || '10000')
const imageInlineSizeLimit = parseInt(process.env.IMAGE_INLINE_SIZE_LIMIT || '10000');
// Check if TypeScript is setup
const useTypeScript = fs.existsSync(paths.appTsConfig)
const useTypeScript = fs.existsSync(paths.appTsConfig);
// style files regexes
const cssRegex = /\.css$/
const cssModuleRegex = /\.module\.css$/
const lessRegex = /\.less$/
const lessModuleRegex = /\.module\.less$/
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'
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')
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))
const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
var PREFIX = 'b-'; //static 文件夹前缀
// common function to get style loaders
const getStyleLoaders = (cssOptions, preProcessor) => {
const loaders = [
......@@ -73,11 +70,11 @@ module.exports = function (webpackEnv) {
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: '../../' } : {}
options: paths.publicUrlOrPath.startsWith('.') ? { publicPath: '../../' } : {},
},
{
loader: require.resolve('css-loader'),
options: cssOptions
options: cssOptions,
},
{
// Options for PostCSS as we reference these options twice
......@@ -92,32 +89,32 @@ module.exports = function (webpackEnv) {
require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({
autoprefixer: {
flexbox: 'no-2009'
flexbox: 'no-2009',
},
stage: 3
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()
postcssNormalize(),
],
sourceMap: isEnvProduction && shouldUseSourceMap
}
}
].filter(Boolean)
sourceMap: isEnvProduction && shouldUseSourceMap,
},
},
].filter(Boolean);
if (preProcessor) {
loaders.push(
{
loader: require.resolve('resolve-url-loader'),
options: {
sourceMap: isEnvProduction && shouldUseSourceMap
}
sourceMap: isEnvProduction && shouldUseSourceMap,
},
},
{
loader: require.resolve(preProcessor),
options: {
sourceMap: true
}
sourceMap: true,
},
},
{
loader: require.resolve('less-loader'),
......@@ -127,14 +124,14 @@ module.exports = function (webpackEnv) {
'primary-color': '#2966FF',
'border-radius-base': '2px',
},
javascriptEnabled: true
}
}
javascriptEnabled: true,
},
},
}
)
);
}
return loaders
}
return loaders;
};
return {
mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development',
......@@ -156,7 +153,7 @@ module.exports = function (webpackEnv) {
isEnvDevelopment && require.resolve('webpack/hot/dev-server'),
isEnvDevelopment && require.resolve('react-dev-utils/webpackHotDevClient'),
// Finally, this is your app's code:
paths.appIndexJs
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.
......@@ -168,11 +165,11 @@ module.exports = function (webpackEnv) {
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',
filename: isEnvProduction ? PREFIX + 'static/js/[name].[contenthash:8].js' : isEnvDevelopment && PREFIX + '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',
chunkFilename: isEnvProduction ? PREFIX + 'static/js/[name].[contenthash:8].chunk.js' : isEnvDevelopment && PREFIX + '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.
......@@ -189,7 +186,7 @@ module.exports = function (webpackEnv) {
globalObject: 'this',
library: appPackageJson.name,
libraryTarget: 'umd',
jsonpFunction: `webpackJsonp_${appPackageJson.name}`
jsonpFunction: `webpackJsonp_${appPackageJson.name}`,
},
optimization: {
minimize: isEnvProduction,
......@@ -203,7 +200,7 @@ module.exports = function (webpackEnv) {
// 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
ecma: 8,
},
compress: {
ecma: 5,
......@@ -217,10 +214,10 @@ module.exports = function (webpackEnv) {
// https://github.com/facebook/create-react-app/issues/5250
// Pending further investigation:
// https://github.com/terser-js/terser/issues/120
inline: 2
inline: 2,
},
mangle: {
safari10: true
safari10: true,
},
// Added for profiling in devtools
keep_classnames: isEnvProductionProfile,
......@@ -230,10 +227,10 @@ module.exports = function (webpackEnv) {
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
}
ascii_only: true,
},
},
sourceMap: shouldUseSourceMap
sourceMap: shouldUseSourceMap,
}),
// This is only used in production mode
new OptimizeCSSAssetsPlugin({
......@@ -246,28 +243,28 @@ module.exports = function (webpackEnv) {
inline: false,
// `annotation: true` appends the sourceMappingURL to the end of
// the css file, helping the browser find the sourcemap
annotation: true
annotation: true,
}
: false
: false,
},
cssProcessorPluginOptions: {
preset: ['default', { minifyFontValues: { removeQuotes: false } }]
}
})
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
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}`
}
name: (entrypoint) => `runtime-${entrypoint.name}`,
},
},
resolve: {
// This allows you to set a fallback for where webpack should look for modules.
......@@ -290,9 +287,9 @@ module.exports = function (webpackEnv) {
// Allows for better profiling with ReactDevTools
...(isEnvProductionProfile && {
'react-dom$': 'react-dom/profiling',
'scheduler/tracing': 'scheduler/tracing-profiling'
'scheduler/tracing': 'scheduler/tracing-profiling',
}),
...(modules.webpackAliases || {})
...(modules.webpackAliases || {}),
},
plugins: [
// Adds support for installing with Plug'n'Play, leading to faster installs and adding
......@@ -303,15 +300,15 @@ module.exports = function (webpackEnv) {
// 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])
]
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)
]
PnpWebpackPlugin.moduleLoader(module),
],
},
module: {
strictExportPresence: true,
......@@ -330,12 +327,12 @@ module.exports = function (webpackEnv) {
cache: true,
formatter: require.resolve('react-dev-utils/eslintFormatter'),
eslintPath: require.resolve('eslint'),
resolvePluginsRelativeTo: __dirname
resolvePluginsRelativeTo: __dirname,
},
loader: require.resolve('eslint-loader')
}
loader: require.resolve('eslint-loader'),
},
],
include: paths.appSrc
include: paths.appSrc,
},
{
// "oneOf" will traverse all following loaders until one will
......@@ -350,8 +347,8 @@ module.exports = function (webpackEnv) {
loader: require.resolve('url-loader'),
options: {
limit: imageInlineSizeLimit,
name: 'static/media/[name].[hash:8].[ext]'
}
name: PREFIX + 'static/media/[name].[hash:8].[ext]',
},
},
// Process application JS with Babel.
// The preset includes JSX, Flow, TypeScript, and some ESnext features.
......@@ -368,11 +365,11 @@ module.exports = function (webpackEnv) {
{
loaderMap: {
svg: {
ReactComponent: '@svgr/webpack?-svgo,+titleProp,+ref![path]'
}
}
}
]
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/
......@@ -380,8 +377,8 @@ module.exports = function (webpackEnv) {
cacheDirectory: true,
// See #6846 for context on why cacheCompression is disabled
cacheCompression: false,
compact: isEnvProduction
}
compact: isEnvProduction,
},
},
// Process any JS outside of the app with Babel.
// Unlike the application JS, we only compile the standard ES features.
......@@ -402,8 +399,8 @@ module.exports = function (webpackEnv) {
// code. Without the options below, debuggers like VSCode
// show incorrect code and set breakpoints on the wrong lines.
sourceMaps: shouldUseSourceMap,
inputSourceMap: shouldUseSourceMap
}
inputSourceMap: shouldUseSourceMap,
},
},
// "postcss" loader applies autoprefixer to our CSS.
// "css" loader resolves paths in CSS and adds assets as dependencies.
......@@ -417,13 +414,13 @@ module.exports = function (webpackEnv) {
exclude: cssModuleRegex,
use: getStyleLoaders({
importLoaders: 1,
sourceMap: isEnvProduction && shouldUseSourceMap
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
sideEffects: true,
},
// Adds support for CSS Modules (https://github.com/css-modules/css-modules)
// using the extension .module.css
......@@ -433,9 +430,9 @@ module.exports = function (webpackEnv) {
importLoaders: 1,
sourceMap: isEnvProduction && shouldUseSourceMap,
modules: {
getLocalIdent: getCSSModuleLocalIdent
}
})
getLocalIdent: getCSSModuleLocalIdent,
},
}),
},
// Opt-in support for SASS (using .scss or .sass extensions).
// By default we support SASS Modules with the
......@@ -446,11 +443,11 @@ module.exports = function (webpackEnv) {
use: getStyleLoaders(
{
importLoaders: 2,
sourceMap: isEnvProduction && shouldUseSourceMap
sourceMap: isEnvProduction && shouldUseSourceMap,
},
'less-loader'
),
sideEffects: true
sideEffects: true,
},
{
test: lessModuleRegex,
......@@ -459,10 +456,10 @@ module.exports = function (webpackEnv) {
importLoaders: 2,
sourceMap: isEnvProduction && shouldUseSourceMap,
modules: true,
getLocalIdent: getCSSModuleLocalIdent
getLocalIdent: getCSSModuleLocalIdent,
},
'less-loader'
)
),
},
// "file" loader makes sure those assets get served by WebpackDevServer.
// When you `import` an asset, you get its (virtual) filename.
......@@ -477,14 +474,14 @@ module.exports = function (webpackEnv) {
// by webpacks internal loaders.
exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
options: {
name: 'static/media/[name].[hash:8].[ext]'
}
}
name: PREFIX + '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.
......@@ -493,7 +490,7 @@ module.exports = function (webpackEnv) {
{},
{
inject: true,
template: paths.appHtml
template: paths.appHtml,
},
isEnvProduction
? {
......@@ -507,8 +504,8 @@ module.exports = function (webpackEnv) {
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true
}
minifyURLs: true,
},
}
: undefined
)
......@@ -547,8 +544,8 @@ module.exports = function (webpackEnv) {
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'
filename: PREFIX + 'static/css/[name].[contenthash:8].css',
chunkFilename: PREFIX + '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
......@@ -561,16 +558,16 @@ module.exports = function (webpackEnv) {
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'))
manifest[file.name] = file.path;
return manifest;
}, seed);
const entrypointFiles = entrypoints.main.filter((fileName) => !fileName.endsWith('.map'));
return {
files: manifestFiles,
entrypoints: entrypointFiles
}
}
entrypoints: entrypointFiles,
};
},
}),
// Moment.js is an extremely popular library that bundles large locale files
......@@ -594,14 +591,14 @@ module.exports = function (webpackEnv) {
// 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('/[^/?]+\\.[^/]+$')
]
new RegExp('/[^/?]+\\.[^/]+$'),
],
}),
// TypeScript type checking
useTypeScript &&
new ForkTsCheckerWebpackPlugin({
typescript: resolve.sync('typescript', {
basedir: paths.appNodeModules
basedir: paths.appNodeModules,
}),
async: isEnvDevelopment,
useTypescriptIncrementalApi: true,
......@@ -612,12 +609,8 @@ module.exports = function (webpackEnv) {
reportFiles: ['**', '!**/__tests__/**', '!**/?(*.)(spec|test).*', '!**/src/setupProxy.*', '!**/src/setupTests.*'],
silent: true,
// The formatter is invoked directly in WebpackDevServerUtils during development
formatter: isEnvProduction ? typescriptFormatter : undefined
formatter: isEnvProduction ? typescriptFormatter : undefined,
}),
new vConsolePlugin({
enable: (process.env.DEPLOY_ENV === 'prod' || process.env.DEPLOY_ENV === 'beta') ? false : true
})
].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.
......@@ -629,10 +622,10 @@ module.exports = function (webpackEnv) {
http2: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
child_process: 'empty',
},
// Turn off performance processing because we utilize
// our own hints via the FileSizeReporter
performance: false
}
}
performance: false,
};
};
......@@ -110,6 +110,7 @@
"start:dev1": "cross-env DEPLOY_ENV=dev node scripts/start.js",
"start:rc": "cross-env DEPLOY_ENV=rc node scripts/start.js",
"start:gray": "cross-env DEPLOY_ENV=gray node scripts/start.js",
"start:prod": "cross-env DEPLOY_ENV=prod node scripts/start.js",
"build:dev": "cross-env DEPLOY_ENV=dev node --max_old_space_size=4096 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",
......
......@@ -44,6 +44,10 @@ const FileVerifyMap = {
type: "word",
maxSize: 100
},
"application/wps-writer": {
type: "word",
maxSize: 100,
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
type: "word",
maxSize: 100
......
......@@ -26,35 +26,39 @@ export default class WechatApi {
nonceStr: res.nonceStr, // 必填,生成签名的随机串
signature: res.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
jsApiList: ['chooseImage', 'shareToExternalContact', 'selectExternalContact', 'selectEnterpriseContact'],
});
if (params.isAgentConfig) {
return new Promise(async (resolve, reject) => {
Service.Hades('anon/hades/getWxWorkJSAPISignature', {
storeId: User.getStoreId(),
url: params.url,
}).then((result2) => {
const res2 = result2.result;
this.agentConfig({
corpid: res2.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
agentid: res2.agentid, // 必填,企业微信的应用id (e.g. 1000247)
timestamp: res2.timestamp, // 必填,生成签名的时间戳
nonceStr: res2.nonceStr, // 必填,生成签名的随机串
signature: res2.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
jsApiList: ['selectExternalContact', 'getCurExternalContact', 'getContext', 'shareToExternalContact', 'sendChatMessage', 'shareToExternalChat'],
success: (res) => {
console.log(res, 'res-agentconfig');
console.info('window.WWOpenData', window.WWOpenData);
resolve(res);
},
fail: (err) => {
console.log(err, 'err-agentconfig');
reject(err);
},
}).then(() => {
console.log('微信config设置完毕')
if (params.isAgentConfig) {
return new Promise(async (resolve, reject) => {
Service.Hades('anon/hades/getWxWorkJSAPISignature', {
storeId: User.getStoreId(),
url: params.url,
}).then((result2) => {
const res2 = result2.result;
this.agentConfig({
corpid: res2.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
agentid: res2.agentid, // 必填,企业微信的应用id (e.g. 1000247)
timestamp: res2.timestamp, // 必填,生成签名的时间戳
nonceStr: res2.nonceStr, // 必填,生成签名的随机串
signature: res2.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
jsApiList: ['selectExternalContact', 'getCurExternalContact', 'getContext', 'shareToExternalContact', 'sendChatMessage', 'shareToExternalChat'],
success: (res) => {
console.log(res, 'res-agentconfig');
console.info('window.WWOpenData', window.WWOpenData);
resolve(res);
},
fail: (err) => {
console.log(1213545344545)
console.log(err, 'err-agentconfig');
reject(err);
},
});
});
});
});
}
}
})
});
}
......
......@@ -2,7 +2,8 @@ import React, { useRef, useLayoutEffect } from 'react'
export default function WWOpenDataCom({ type, openid }) {
const ref = useRef(null)
useLayoutEffect(() => {
WWOpenData.bind(ref.current)
console.log(WWOpenData)
WWOpenData && WWOpenData.bind(ref.current)
})
return <ww-open-data ref={ref} type={type} openid={openid} />
......
......@@ -6,7 +6,7 @@
*/
@import './variables.less';
@active-color: #2966FF;
@active-color: #2966ff;
// 消息提示框
.ant-message {
......@@ -41,6 +41,9 @@
.ant-switch-small:after {
top: 0.3px;
}
tbody .ant-switch-small {
min-width: 32px;
}
.ant-pagination {
display: inline !important;
......@@ -234,7 +237,7 @@
}
.ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn {
font-weight: 500!important;
font-weight: 500 !important;
}
.ant-tabs-nav .ant-tabs-tab-active {
......@@ -264,7 +267,7 @@
position: absolute;
width: 30px;
height: 4px;
background: #2966FF !important;
background: #2966ff !important;
left: 50%;
transform: translateX(-50%);
}
......@@ -339,14 +342,14 @@ mr0 {
background: #f3f6fa;
.ant-select-selected-icon {
color:#2966FF !important;
color: #2966ff !important;
}
}
.ant-select-dropdown-menu-item-selected {
background: none;
font-weight: 400 !important;
color:#2966FF;
color: #2966ff;
}
.ant-select-open .ant-select-selection {
......@@ -444,7 +447,7 @@ mr0 {
.ant-modal {
.ant-input {
&:focus {
border: 1px solid #2966FF !important;
border: 1px solid #2966ff !important;
}
}
}
......@@ -457,8 +460,8 @@ mr0 {
.ant-calendar-footer-extra {
.ant-tag-blue {
background: #fff;
color: #2966FF;
border-color: #2966FF;
color: #2966ff;
border-color: #2966ff;
}
}
}
......@@ -474,7 +477,7 @@ mr0 {
}
.ant-modal-confirm-info .ant-modal-confirm-body > .anticon {
color: #2966FF!important;
color: #2966ff !important;
}
.ant-breadcrumb > span:last-child .ant-breadcrumb-separator {
......@@ -502,7 +505,7 @@ mr0 {
font-size: 22px !important;
line-height: 22px !important;
float: left !important;
color:#2966FF !important;
color: #2966ff !important;
margin-right: 16px !important;
&.blue {
color: #5cbaff !important;
......@@ -527,8 +530,8 @@ mr0 {
float: left;
margin-right: 16px;
}
>.confirm-icon{
color: #2966FF;
> .confirm-icon {
color: #2966ff;
}
.ant-modal-confirm-content {
margin-left: 38px;
......@@ -594,9 +597,9 @@ mr0 {
// background: #FAFAFA !important;
// }
.ant-table-thead > tr > th{
font-weight:bold !important;
color:#333 !important;
.ant-table-thead > tr > th {
font-weight: bold !important;
color: #333 !important;
}
td.ant-table-column-sort {
background: none;
......@@ -657,11 +660,11 @@ td.ant-table-column-sort {
border-color: @xm-color-text-select-primary !important;
border: none !important;
&:hover {
background-color: #2966FF !important;
background-color: #2966ff !important;
opacity: 0.8 !important;
}
&:active{
background-color:#5C8AFF !important;
&:active {
background-color: #5c8aff !important;
}
}
......@@ -720,9 +723,9 @@ td.ant-table-column-sort {
border-right: 0px !important;
}
.ant-input-search > .ant-input-group > .ant-input-group-addon:last-child .ant-input-search-button span{
color:#bfbfbf !important;
font-size:12px;
.ant-input-search > .ant-input-group > .ant-input-group-addon:last-child .ant-input-search-button span {
color: #bfbfbf !important;
font-size: 12px;
}
.ant-modal-footer {
......@@ -774,4 +777,3 @@ td.ant-table-column-sort {
.ant-table-column-sorter {
margin-left: 8px !important;
}
......@@ -16,19 +16,21 @@ export default class WechatApi {
signature: res.signature,
jsApiList: ['startLiving','downloadLivingReplay'],
success: function(res) {
console.log('agentConfig注册成功')
console.log(res,'agentConfig')
},
fail: function(res) {
console.log(res,' agentConfig 错误')
console.log(res,' agentConfig1 错误')
if(res.errMsg.indexOf('function not exist') > -1){
alert('版本过低请升级')
}
},
complete:(res)=>{
console.log(res,' agentConfig 错误')
console.log(res,' agentConfig2 错误')
}
}
console.log(conf)
wx.agentConfig(conf);
});
// }
......
/*
* @Author: 吴文洁
* @Date: 2020-08-20 09:21:40
* @LastEditors: zhangleyuan
* @LastEditTime: 2021-03-04 17:16:30
* @LastEditors: yuananting
* @LastEditTime: 2021-07-15 11:48:58
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
......@@ -77,6 +77,10 @@ const FILR_VERIFY_MAP = {
type: "word",
maxSize: 100
},
"application/wps-writer": {
type: "word",
maxSize: 100,
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
type: "word",
maxSize: 100
......
......@@ -108,12 +108,10 @@ function EmployeeManage() {
useEffect(() => {
getListInfo();
// initWechatConfig();
}, [storeId]);
async function initWechatConfig() {
WechatApi.initConfig({ isAgentConfig: true, url: window.location.href.split('#')[0] })
}
async function getListInfo() {
await getStoreRole();
......@@ -159,10 +157,11 @@ function EmployeeManage() {
/>
)}
<span className="title">{val}</span>
{/* <span className="title">
<WWOpenDataCom type="userName" openid={val}/>
</span> */}
{/* <span className="title">{val}</span> */}
<span className="title">
<WWOpenDataCom type="userName" openid={val} />
</span>
</div>
);
},
......@@ -198,7 +197,7 @@ function EmployeeManage() {
<span className="divider-line">{" | "}</span>
<span
className="delete"
onClick={() =>{
onClick={() => {
handleDeleteWorkWechatEmployeeConfirm(record)
}}
>
......@@ -247,7 +246,7 @@ function EmployeeManage() {
role: [],
avatar: "",
storeUserId: "",
weChatAccount:""
weChatAccount: ""
});
}}
isWorkWechat={isWorkWechat}
......@@ -278,7 +277,7 @@ function EmployeeManage() {
function handleDeleteEmployee(storeUserId: string) {
StoreService.deleteEmployee({ storeUserId }).then((res: any) => {
const msg = isWorkWechat ? "员工已删除":"讲师已删除";
const msg = isWorkWechat ? "员工已删除" : "讲师已删除";
message.success(msg);
getEmployeeList();
});
......@@ -286,147 +285,147 @@ function EmployeeManage() {
return (
<div className="page employee-manage-page">
<div className="content-header">员工管理</div>
<div className="box">
<div className="box-header">
<div
style={{
display: "flex",
alignItems: "center",
justifyContent: "flex-start",
padding: "0px 0 4px",
}}
>
<div>
<div className="content-header">员工管理</div>
<div className="box">
<div className="box-header">
<div
style={{
display: "flex",
alignItems: "center",
justifyContent: "flex-start",
padding: "0px 0 4px",
}}
>
<div>
搜索员工:
<Search
style={{
width: 300,
marginRight: 40,
}}
placeholder={
isWorkWechat ? "请输入员工昵称" : "搜索员工昵称/手机号"
<Search
style={{
width: 300,
marginRight: 40,
}}
placeholder={
isWorkWechat ? "请输入员工昵称" : "搜索员工昵称/手机号"
}
onSearch={(value) => {
const _query = { ...query };
// 企业微信用户只能搜索员工昵称
if (isWorkWechat) {
_query.nickName = value;
_query.current = 0;
setQuery(_query);
return;
}
onSearch={(value) => {
const _query = { ...query };
// 企业微信用户只能搜索员工昵称
if (isWorkWechat) {
_query.nickName = value;
_query.current = 0;
setQuery(_query);
return;
}
if (value) {
const isPhone = (value || "").match(/^\d+$/);
const name = isPhone ? "phone" : "nickName";
const otherName = isPhone ? "nickName" : "phone";
_query[name] = value;
_query[otherName] = "";
_query.current = 0;
} else {
_query.nickName = "";
_query.phone = "";
_query.current = 0;
}
setQuery(_query);
}}
enterButton={<span className="icon iconfont">&#xe832;</span>}
/>
</div>
if (value) {
const isPhone = (value || "").match(/^\d+$/);
const name = isPhone ? "phone" : "nickName";
const otherName = isPhone ? "nickName" : "phone";
_query[name] = value;
_query[otherName] = "";
_query.current = 0;
} else {
_query.nickName = "";
_query.phone = "";
_query.current = 0;
}
setQuery(_query);
}}
enterButton={<span className="icon iconfont">&#xe832;</span>}
/>
</div>
<div>
身份:
{_.map(roleIds, (item: any) => {
return (
<CheckBox
key={item.roleCode}
text={item.name}
name={item.roleCode}
onChange={(e: any) => {
const { checked, name } = e.target;
const _query = { ...query };
_query.roleCodes = [];
_query.current = 0;
const _roleIds: Array<RoleItemType> = roleIds.map(
(_item: RoleItemType) => {
if (name === _item.roleCode) {
if (checked) {
_item.isChecked = true;
} else {
_item.isChecked = false;
}
}
if (_item.isChecked) {
_query.roleCodes.push(_item.roleCode);
<div>
身份:
{_.map(roleIds, (item: any) => {
return (
<CheckBox
key={item.roleCode}
text={item.name}
name={item.roleCode}
onChange={(e: any) => {
const { checked, name } = e.target;
const _query = { ...query };
_query.roleCodes = [];
_query.current = 0;
const _roleIds: Array<RoleItemType> = roleIds.map(
(_item: RoleItemType) => {
if (name === _item.roleCode) {
if (checked) {
_item.isChecked = true;
} else {
_item.isChecked = false;
}
return _item;
}
);
if (_item.isChecked) {
_query.roleCodes.push(_item.roleCode);
}
return _item;
}
);
setRoleIds(_roleIds);
setQuery(_query);
}}
defaultChecked={item.isChecked}
/>
);
})}
</div>
setRoleIds(_roleIds);
setQuery(_query);
}}
defaultChecked={item.isChecked}
/>
);
})}
</div>
{(User.getUserRole() === 'CloudManager' || User.getUserRole() === 'StoreManager') &&
<Button
onClick={() => {
handleToAddEmployee();
}}
type="primary"
className="add-show-btn"
>
添加员工
</Button>
}
</div>
<LimitTip type="员工" total={realTotal} tip={()=>{return (<div>数据为当前学院的员工数,若员工存在多个学院,企业人数只统计为1人</div>)}}/>
<div className="box-body">
<XMTable
renderEmpty={{
image: college,
description: '暂无数据'
{(User.getUserRole() === 'CloudManager' || User.getUserRole() === 'StoreManager') &&
<Button
onClick={() => {
handleToAddEmployee();
}}
size={"middle"}
pagination={false}
dataSource={employeeList}
columns={parseColumn()}
rowKey={(item: any) => item.id}
bordered
/>
</div>
<div className="box-footer">
<PageControl
current={query.current}
pageSize={query.size}
total={total}
toPage={(page: any) => {
const queryStates = _.clone(query);
queryStates.current = page;
setQuery(queryStates);
}}
/>
</div>
type="primary"
className="add-show-btn"
>
添加员工
</Button>
}
</div>
<LimitTip type="员工" total={realTotal} tip={() => { return (<div>数据为当前学院的员工数,若员工存在多个学院,企业人数只统计为1人</div>) }} />
<div className="box-body">
<XMTable
renderEmpty={{
image: college,
description: '暂无数据'
}}
size={"middle"}
pagination={false}
dataSource={employeeList}
columns={parseColumn()}
rowKey={(item: any) => item.id}
bordered
/>
</div>
{model}
{employeeModal &&
<ChooseMembersModal
isOpen={employeeModal}
type="USER"
handleChooseModal={(bool: any) => {
setEmployeeModal(false)
if (bool) {
message.success('添加成功')
getEmployeeList();
}
<div className="box-footer">
<PageControl
current={query.current}
pageSize={query.size}
total={total}
toPage={(page: any) => {
const queryStates = _.clone(query);
queryStates.current = page;
setQuery(queryStates);
}}
/>
}
</div>
</div>
{model}
{employeeModal &&
<ChooseMembersModal
isOpen={employeeModal}
type="USER"
handleChooseModal={(bool: any) => {
setEmployeeModal(false)
if (bool) {
message.success('添加成功')
getEmployeeList();
}
}}
/>
}
</div>
);
}
......
......@@ -149,7 +149,7 @@ class AddLiveBasic extends React.Component {
<span className={`default-btn ${isDefaultCover ? 'disabled' : ''}`} onClick={this.handleResetCoverUrl}>
使用默认图
</span>
<div className='tips'>建议尺寸1280*720px,图片支持jpg、jpeg、png格式</div>
<div className='tips'>建议尺寸1280*720px或16:9。封面图最大5M,支持jpg、jpeg和png</div>
</div>
<div className='img-content'>
{isDefaultCover && <span className='tag'>默认图</span>}
......
......@@ -2,7 +2,7 @@
* @Author: 吴文洁
* @Date: 2020-07-23 14:54:16
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-07-14 11:43:49
* @LastEditTime: 2021-07-14 18:19:22
* @Description: 大班直播课预览弹窗
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
......@@ -166,12 +166,7 @@ class PreviewCourseModal extends React.Component {
<div className='container__header'>
<Choose>
<When condition={type === 'videoCourse'}>
<video
controls
src={courseChapterList.length && courseChapterList[0].mediaUrl || scheduleVideoUrl }
poster={coverUrl ? coverUrl : `https://image.xiaomaiketang.com/xm/TwtGPQGE4K.png`}
className='course-url'
/>
<img src={coverUrl ? coverUrl : `https://image.xiaomaiketang.com/xm/TwtGPQGE4K.png`} className='course-cover' alt='' />
</When>
<Otherwise>
<img src={coverUrl} className='course-cover' alt='' />
......
/*
* @Author: 吴文洁
* @Date: 2020-08-05 10:07:47
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-07-14 11:44:14
* @LastEditors: yuananting
* @LastEditTime: 2021-07-15 12:08:28
* @Description: 线下课新增/编辑页
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
......@@ -751,7 +751,7 @@ class AddOfflineCourse extends React.Component {
<span className={`default-btn ${isDefaultCover ? 'disabled' : ''}`} onClick={this.handleResetCoverUrl}>
使用默认图
</span>
<div className='tips'>建议尺寸1280*720px,图片支持jpg、jpeg、png格式</div>
<div className='tips'>建议尺寸1280*720px或16:9。封面图最大5M,支持jpg、jpeg和png</div>
</div>
<div className='img-content'>
{isDefaultCover && <span className='tag'>默认图</span>}
......@@ -853,7 +853,6 @@ class AddOfflineCourse extends React.Component {
})}
</Select>
</div>
<div className='introduce'>
<span className='label'>课程简介:</span>
<div className='content'>
......
......@@ -2,7 +2,7 @@
* @Author: 吴文洁
* @Date: 2020-08-05 10:07:47
* @LastEditors: yuananting
* @LastEditTime: 2021-07-14 16:41:36
* @LastEditTime: 2021-07-15 12:04:40
* @Description: 线上课新增/编辑页
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
......@@ -821,7 +821,7 @@ class AddVideoCourse extends React.Component {
</If>
<div className='cover-url flex mt16'>
<div className='label'>课程封面</div>
<div className='label'>封面图</div>
<div className='cover-url__wrap'>
<div className='opt-btns'>
<div>
......
......@@ -171,7 +171,7 @@ function VideoCourseDetail(){
</div>
<div className="course-detail__info">
<div className="info__title">{courseName}</div>
<div className="info__category">{`分类:${categoryName}`}</div>
<div className="info__category">{`课程分类:${categoryName}`}</div>
<div className="info__chapterNum">{`课节数量:${courseChapterList.length}`}</div>
</div>
</div>
......
......@@ -126,8 +126,8 @@ class VideoCourseList extends React.Component {
width: 100,
align: 'right',
render: (val, item) => {
return <div onClick={() => this.handleLinkToCourseDetail(item.id)}>{val || 1}</div>;
},
return <div onClick={() => this.handleLinkToCourseDetail(item.id)}>{val || 1}</div>
}
},
{
title: (
......@@ -364,8 +364,8 @@ class VideoCourseList extends React.Component {
// 显示分享弹窗
handleShowShareModal = (record, needStr = false) => {
const { type } = this.props;
const { id, scheduleVideoUrl } = record;
const htmlUrl = `${LIVE_SHARE}video_detail/${id}?id=${User.getStoreId()}`;
const { id, scheduleVideoUrl, chapterNum } = record;
const htmlUrl = chapterNum > 1 ? `${LIVE_SHARE}course_detail/${id}?id=${User.getStoreId()}` : `${LIVE_SHARE}video_detail/${id}?id=${User.getStoreId()}`;
const longUrl = htmlUrl;
const { coverUrl, courseName } = record;
const shareData = {
......
......@@ -15,7 +15,7 @@ import zhCN from 'antd/es/locale/zh_CN'
import User from '@/common/js/user';
import BaseService from "@/domains/basic-domain/baseService";
import moment from 'moment';
import WechatApi from "@/core/wechatApi"
import WechatApi from '@/common/js/wechatApi';
import { VersionContext, VersionInfo, XMContext } from '@/store/context';
import { setStoreGroupPermission, setStorePermission, setStoreGroupList, setStoreList } from '@/store/actions/index';
import Service from "@/common/js/service";
......@@ -29,15 +29,15 @@ declare var window: any;
const App: React.FC = (props: any) => {
const [storeUserId, setStoreUserId] = useState('')
const ctx: any = useContext(XMContext);
const [versionInfo, setVersionInfo] = useState<VersionInfo|null>(null)
const [versionInfo, setVersionInfo] = useState<VersionInfo | null>(null)
const userId = User.getUserId();
const [menuType, setMenuType] = useState(true);
const enterpriseId = User.getEnterpriseId();
window.ctx = ctx;
useEffect(() => {
WechatApi.initShareConfig();
initWechatConfig();
getStoreAndUserInfo();
getVersion();
if (window.location.hash === "#/") {
......@@ -47,6 +47,10 @@ const App: React.FC = (props: any) => {
}
}, [])
async function initWechatConfig() {
WechatApi.initConfig({ isAgentConfig: true, url: window.location.href.split('#')[0] })
}
useEffect(() => {
getStorePermission();
}, [window.location.hash])
......@@ -68,7 +72,7 @@ const App: React.FC = (props: any) => {
let version = res.result;
User.setVersion(version);
User.setExpirationTime(res.result.validEndTime)
let versioninfo:VersionInfo = {
let versioninfo: VersionInfo = {
dayTime: version.dayTime,
stateEnum: version.stateEnum,
userNum: version.userNum === -1 ? '不限人数' : version.userNum,
......@@ -87,30 +91,30 @@ const App: React.FC = (props: any) => {
async function getStoreAndUserInfo() {
await (enterpriseId ? getStoreInfo() : getStoreGroupAndStoreList());
}
function getStoreInfo() {
console.log("currentStoreUserInfo",window.currentStoreUserInfo);
console.log("currentStoreUserInfo", window.currentStoreUserInfo);
const params = {
storeId: User.getStoreId(),
userId: User.getUserId(),
};
Service.Hades('public/customerHades/getStoreAndUserMsg', params).then((res) => {
if(res.success){
if (res.success) {
const { id, storeUserId, storeName, userRole, storeType } = res.result;
User.setStoreId(id);
User.setStoreUserId(storeUserId);
User.setStoreName(storeName);
Bus.trigger('storeNameChange',storeName);
Bus.trigger('storeNameChange', storeName);
User.setUserRole(userRole);
User.setStoreType(storeType);
setCurrentStoreUserInfo(id,storeUserId)
setCurrentStoreUserInfo(id, storeUserId)
setStoreUserId(storeUserId);
getUserPermission();
}
})
}
function setCurrentStoreUserInfo(storeId:any,storeUserId:any){
function setCurrentStoreUserInfo(storeId: any, storeUserId: any) {
window.currentStoreUserInfo.storeId = storeId;
window.currentStoreUserInfo.storeUserId = storeUserId;
window.currentStoreUserInfo.userId = User.getUserId();
......@@ -136,7 +140,7 @@ const App: React.FC = (props: any) => {
Bus.trigger('storeNameChange', storeName);
User.setUserRole(userRole);
User.setStoreType(storeType);
setCurrentStoreUserInfo(id,storeUserId);
setCurrentStoreUserInfo(id, storeUserId);
ctx.dispatch(setStoreGroupList(storeGroupVOS))
ctx.dispatch(setStoreList(storeVOS));
setStoreUserId(storeUserId)
......
import React, { useState, useRef, useEffect, useContext } from 'react';
import React, { useState, useRef, useEffect } from 'react';
import Breadcrumbs from '@/components/Breadcrumbs';
import { Form, Alert, Input, Button, InputNumber, DatePicker, Switch, Radio, message, Modal, Tooltip } from 'antd';
import { Route, withRouter } from 'react-router-dom';
import { Form, Input, Button, InputNumber, DatePicker, Switch, Radio, message, Modal, Tooltip } from 'antd';
import { withRouter } from 'react-router-dom';
import User from '@/common/js/user';
import moment from 'moment';
import Service from '@/common/js/service';
......
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