caishi 6 years ago
commit d50af67946

113
.gitignore vendored

@ -1,56 +1,57 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files. # See https://help.github.com/articles/ignoring-files for more about ignoring files.
# #
# If you find yourself ignoring temporary files generated by your text editor # If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead: # or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global' # git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config. # Ignore bundler config.
/.bundle /.bundle
# mac # mac
*.DS_Store *.DS_Store
# Ignore all logfiles and tempfiles. # Ignore all logfiles and tempfiles.
/log/* /log/*
/tmp/* /tmp/*
!/log/.keep !/log/.keep
!/tmp/.keep !/tmp/.keep
# Ignore uploaded files in development # Ignore uploaded files in development
/storage/* /storage/*
/node_modules /node_modules
/yarn-error.log /yarn-error.log
# /public/assets # /public/assets
.byebug_history .byebug_history
# Ignore master key for decrypting credentials and more. # Ignore master key for decrypting credentials and more.
/config/master.key /config/master.key
/config/database.yml /config/database.yml
/.idea/* /.idea/*
# Ignore react node_modules # Ignore react node_modules
/public/react/build /public/react/build
/public/react/build/ /public/react/build/
/public/react/node_modules/ /public/react/.cache
/public/react/config/stats.json /public/react/node_modules/
/public/react/stats.json /public/react/config/stats.json
/public/react/stats.json
/public/npm-debug.log
/public/npm-debug.log
# avatars
/public/images/avatars # avatars
/public/images/avatars
/config/secrets.yml
/files/archiveZip/* /config/secrets.yml
/files/cache_store/* /files/archiveZip/*
public/upload.html /files/cache_store/*
/config/configuration.yml public/upload.html
/config/initializers/gitlab_config.rb /config/configuration.yml
/db/schema.rb /config/initializers/gitlab_config.rb
.vscode/ /db/schema.rb
vendor/bundle/ .vscode/
.ruby-version vendor/bundle/
.ruby-gemset .ruby-version
.ruby-gemset

@ -9,6 +9,7 @@ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
const eslintFormatter = require('react-dev-utils/eslintFormatter'); const eslintFormatter = require('react-dev-utils/eslintFormatter');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin');
// const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); // const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const getClientEnvironment = require('./env'); const getClientEnvironment = require('./env');
const paths = require('./paths'); const paths = require('./paths');
@ -249,6 +250,46 @@ module.exports = {
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
// You can remove this if you don't use Moment.js: // You can remove this if you don't use Moment.js:
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new ParallelUglifyPlugin({
// 传递给 UglifyJS的参数如下
uglifyJS: {
output: {
/*
是否输出可读性较强的代码即会保留空格和制表符默认为输出为了达到更好的压缩效果
可以设置为false
*/
beautify: false,
/*
是否保留代码中的注释默认为保留为了达到更好的压缩效果可以设置为false
*/
comments: false
},
compress: {
/*
是否在UglifyJS删除没有用到的代码时输出警告信息默认为输出可以设置为false关闭这些作用
不大的警告
*/
warnings: false,
/*
是否删除代码中所有的console语句默认为不删除开启后会删除所有的console语句
*/
drop_console: false,
/*
是否内嵌虽然已经定义了但是只用到一次的变量比如将 var x = 1; y = x, 转换成 y = 5, 默认为不
转换为了达到更好的压缩效果可以设置为false
*/
collapse_vars: false,
/*
是否提取出现了多次但是没有定义成变量去引用的静态值比如将 x = 'xxx'; y = 'xxx' 转换成
var a = 'xxxx'; x = a; y = a; 默认为不转换为了达到更好的压缩效果可以设置为false
*/
reduce_vars: false
}
}
}),
], ],
// Some libraries import Node modules but don't use them in the browser. // 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. // Tell Webpack to provide empty mocks for them so importing them works.

@ -1,349 +1,365 @@
'use strict'; 'use strict';
const autoprefixer = require('autoprefixer'); const autoprefixer = require('autoprefixer');
const path = require('path'); const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin'); const ManifestPlugin = require('webpack-manifest-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin'); const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
const eslintFormatter = require('react-dev-utils/eslintFormatter'); const eslintFormatter = require('react-dev-utils/eslintFormatter');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const paths = require('./paths'); const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin');
const getClientEnvironment = require('./env');
const paths = require('./paths');
// Webpack uses `publicPath` to determine where the app is being served from. const getClientEnvironment = require('./env');
// It requires a trailing slash, or the file assets will get an incorrect path.
const publicPath = paths.servedPath; // Webpack uses `publicPath` to determine where the app is being served from.
// Some apps do not use client-side routing with pushState. // It requires a trailing slash, or the file assets will get an incorrect path.
// For these, "homepage" can be set to "." to enable relative asset paths. const publicPath = paths.servedPath;
const shouldUseRelativeAssetPaths = publicPath === './'; // Some apps do not use client-side routing with pushState.
// Source maps are resource heavy and can cause out of memory issue for large source files. // For these, "homepage" can be set to "." to enable relative asset paths.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false'; const shouldUseRelativeAssetPaths = publicPath === './';
// `publicUrl` is just like `publicPath`, but we will provide it to our app // Source maps are resource heavy and can cause out of memory issue for large source files.
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript. const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz. // `publicUrl` is just like `publicPath`, but we will provide it to our app
const publicUrl = publicPath.slice(0, -1); // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Get environment variables to inject into our app. // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
const env = getClientEnvironment(publicUrl); const publicUrl = publicPath.slice(0, -1);
// Get environment variables to inject into our app.
// Assert this just to be safe. const env = getClientEnvironment(publicUrl);
// Development builds of React are slow and not intended for production.
if (env.stringified['process.env'].NODE_ENV !== '"production"') { // Assert this just to be safe.
throw new Error('Production builds must have NODE_ENV=production.'); // Development builds of React are slow and not intended for production.
} if (env.stringified['process.env'].NODE_ENV !== '"production"') {
throw new Error('Production builds must have NODE_ENV=production.');
// Note: defined here because it will be used more than once. }
const cssFilename = './static/css/[name].[contenthash:8].css';
// Note: defined here because it will be used more than once.
// ExtractTextPlugin expects the build output to be flat. const cssFilename = './static/css/[name].[contenthash:8].css';
// (See https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/27)
// However, our output is structured with css, js and media folders. // ExtractTextPlugin expects the build output to be flat.
// To have this structure working with relative paths, we have to use custom options. // (See https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/27)
const extractTextPluginOptions = shouldUseRelativeAssetPaths // However, our output is structured with css, js and media folders.
? // Making sure that the publicPath goes back to to build folder. // To have this structure working with relative paths, we have to use custom options.
{ publicPath: Array(cssFilename.split('/').length).join('../') } const extractTextPluginOptions = shouldUseRelativeAssetPaths
: {}; ? // Making sure that the publicPath goes back to to build folder.
{ publicPath: Array(cssFilename.split('/').length).join('../') }
// This is the production configuration. : {};
// It compiles slowly and is focused on producing a fast and minimal bundle.
// The development configuration is different and lives in a separate file. // This is the production configuration.
// It compiles slowly and is focused on producing a fast and minimal bundle.
// console.log('publicPath ', publicPath) // The development configuration is different and lives in a separate file.
module.exports = {
// Don't attempt to continue if there are any errors. // console.log('publicPath ', publicPath)
bail: true, module.exports = {
// We generate sourcemaps in production. This is slow but gives good results. // Don't attempt to continue if there are any errors.
// You can exclude the *.map files from the build during deployment. bail: true,
devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版 // We generate sourcemaps in production. This is slow but gives good results.
// devtool: shouldUseSourceMap ? 'source-map' : false,//测试版 // You can exclude the *.map files from the build during deployment.
// In production, we only want to load the polyfills and the app code. // devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版
entry: [require.resolve('./polyfills'), paths.appIndexJs], devtool: shouldUseSourceMap ? 'source-map' : false,//测试版
output: { // In production, we only want to load the polyfills and the app code.
// The build folder. entry: [require.resolve('./polyfills'), paths.appIndexJs],
path: paths.appBuild, output: {
// Generated JS file names (with nested folders). // The build folder.
// There will be one main bundle, and one file per asynchronous chunk. path: paths.appBuild,
// We don't currently advertise code splitting but Webpack supports it. // Generated JS file names (with nested folders).
filename: './static/js/[name].[chunkhash:8].js', // There will be one main bundle, and one file per asynchronous chunk.
chunkFilename: './static/js/[name].[chunkhash:8].chunk.js', // We don't currently advertise code splitting but Webpack supports it.
// We inferred the "public path" (such as / or /my-project) from homepage. filename: './static/js/[name].[chunkhash:8].js',
// cdn chunkFilename: './static/js/[name].[chunkhash:8].chunk.js',
// publicPath: 'https://shixun.educoder.net/react/build/', //publicPath, https://cdn.educoder.net // We inferred the "public path" (such as / or /my-project) from homepage.
// publicPath: 'https://cdn-testeduplus2.educoder.net/react/build/', //publicPath, https://cdn.educoder.net // cdn
publicPath: '/react/build/', //publicPath, https://cdn.educoder.net // publicPath: 'https://shixun.educoder.net/react/build/', //publicPath, https://cdn.educoder.net
// publicPath: 'https://cdn-testeduplus2.educoder.net/react/build/', //publicPath, https://cdn.educoder.net
// Point sourcemap entries to original disk location (format as URL on Windows) publicPath: '/react/build/', //publicPath, https://cdn.educoder.net
devtoolModuleFilenameTemplate: info =>
path // Point sourcemap entries to original disk location (format as URL on Windows)
.relative(paths.appSrc, info.absoluteResourcePath) devtoolModuleFilenameTemplate: info =>
.replace(/\\/g, '/'), path
}, .relative(paths.appSrc, info.absoluteResourcePath)
resolve: { .replace(/\\/g, '/'),
// 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" resolve: {
// if there are any conflicts. This matches Node resolution mechanism. // This allows you to set a fallback for where Webpack should look for modules.
// https://github.com/facebookincubator/create-react-app/issues/253 // We placed these paths second because we want `node_modules` to "win"
modules: ['node_modules', paths.appNodeModules].concat( // if there are any conflicts. This matches Node resolution mechanism.
// It is guaranteed to exist because we tweak it in `env.js` // https://github.com/facebookincubator/create-react-app/issues/253
process.env.NODE_PATH.split(path.delimiter).filter(Boolean) modules: ['node_modules', paths.appNodeModules].concat(
), // It is guaranteed to exist because we tweak it in `env.js`
// These are the reasonable defaults supported by the Node ecosystem. process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
// We also include JSX as a common component filename extension to support ),
// some tools, although we do not recommend using it, see: // These are the reasonable defaults supported by the Node ecosystem.
// https://github.com/facebookincubator/create-react-app/issues/290 // We also include JSX as a common component filename extension to support
// `web` extension prefixes have been added for better support // some tools, although we do not recommend using it, see:
// for React Native Web. // https://github.com/facebookincubator/create-react-app/issues/290
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'], // `web` extension prefixes have been added for better support
alias: { // for React Native Web.
"educoder": __dirname + "/../src/common/educoder.js", extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'],
// Support React Native Web alias: {
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/ "educoder": __dirname + "/../src/common/educoder.js",
'react-native': 'react-native-web', // Support React Native Web
}, // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
plugins: [ 'react-native': 'react-native-web',
// 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. plugins: [
// To fix this, we prevent you from importing files out of src/ -- if you'd like to, // Prevents users from importing files from outside of src/ (or node_modules/).
// please link the files into your node_modules/ and let module-resolution kick in. // This often causes confusion because we only process files within src/ with babel.
// Make sure your source files are compiled, as they will not be processed in any way. // To fix this, we prevent you from importing files out of src/ -- if you'd like to,
new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]), // 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]),
module: { ],
strictExportPresence: true, },
rules: [ module: {
// TODO: Disable require.ensure as it's not a standard language feature. strictExportPresence: true,
// We are waiting for https://github.com/facebookincubator/create-react-app/issues/2176. rules: [
// { parser: { requireEnsure: false } }, // TODO: Disable require.ensure as it's not a standard language feature.
// We are waiting for https://github.com/facebookincubator/create-react-app/issues/2176.
// First, run the linter. // { parser: { requireEnsure: false } },
// It's important to do this before Babel processes the JS.
// { // First, run the linter.
// test: /\.(js|jsx|mjs)$/, // It's important to do this before Babel processes the JS.
// enforce: 'pre', // {
// use: [ // test: /\.(js|jsx|mjs)$/,
// { // enforce: 'pre',
// options: { // use: [
// formatter: eslintFormatter, // {
// eslintPath: require.resolve('eslint'), // options: {
// // formatter: eslintFormatter,
// }, // eslintPath: require.resolve('eslint'),
// 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 // },
// match the requirements. When no loader matches it will fall {
// back to the "file" loader at the end of the loader list. // "oneOf" will traverse all following loaders until one will
oneOf: [ // match the requirements. When no loader matches it will fall
// "url" loader works just like "file" loader but it also embeds // back to the "file" loader at the end of the loader list.
// assets smaller than specified size as data URLs to avoid requests. oneOf: [
{ // "url" loader works just like "file" loader but it also embeds
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/], // assets smaller than specified size as data URLs to avoid requests.
loader: require.resolve('url-loader'), {
options: { test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
limit: 10000, loader: require.resolve('url-loader'),
name: 'static/media/[name].[hash:8].[ext]', options: {
}, limit: 10000,
}, name: 'static/media/[name].[hash:8].[ext]',
// Process JS with Babel. },
{ },
test: /\.(js|jsx|mjs)$/, // Process JS with Babel.
include: paths.appSrc, {
loader: require.resolve('babel-loader'), test: /\.(js|jsx|mjs)$/,
options: { include: paths.appSrc,
loader: require.resolve('babel-loader'),
compact: true, options: {
},
}, compact: true,
// The notation here is somewhat confusing. },
// "postcss" loader applies autoprefixer to our CSS. },
// "css" loader resolves paths in CSS and adds assets as dependencies. // The notation here is somewhat confusing.
// "style" loader normally turns CSS into JS modules injecting <style>, // "postcss" loader applies autoprefixer to our CSS.
// but unlike in development configuration, we do something different. // "css" loader resolves paths in CSS and adds assets as dependencies.
// `ExtractTextPlugin` first applies the "postcss" and "css" loaders // "style" loader normally turns CSS into JS modules injecting <style>,
// (second argument), then grabs the result CSS and puts it into a // but unlike in development configuration, we do something different.
// separate file in our build process. This way we actually ship // `ExtractTextPlugin` first applies the "postcss" and "css" loaders
// a single CSS file in production instead of JS code injecting <style> // (second argument), then grabs the result CSS and puts it into a
// tags. If you use code splitting, however, any async bundles will still // separate file in our build process. This way we actually ship
// use the "style" loader inside the async code so CSS from them won't be // a single CSS file in production instead of JS code injecting <style>
// in the main CSS file. // tags. If you use code splitting, however, any async bundles will still
{ // use the "style" loader inside the async code so CSS from them won't be
test: /\.css$/, // in the main CSS file.
loader: ExtractTextPlugin.extract( {
Object.assign( test: /\.css$/,
{ loader: ExtractTextPlugin.extract(
fallback: { Object.assign(
loader: require.resolve('style-loader'), {
options: { fallback: {
hmr: false, loader: require.resolve('style-loader'),
}, options: {
}, hmr: false,
use: [ },
{ },
loader: require.resolve('css-loader'), use: [
options: { {
importLoaders: 1, loader: require.resolve('css-loader'),
minimize: true, options: {
sourceMap: shouldUseSourceMap, importLoaders: 1,
}, minimize: true,
}, sourceMap: shouldUseSourceMap,
{ },
loader: require.resolve('postcss-loader'), },
options: { {
// Necessary for external CSS imports to work loader: require.resolve('postcss-loader'),
// https://github.com/facebookincubator/create-react-app/issues/2677 options: {
ident: 'postcss', // Necessary for external CSS imports to work
plugins: () => [ // https://github.com/facebookincubator/create-react-app/issues/2677
require('postcss-flexbugs-fixes'), ident: 'postcss',
autoprefixer({ plugins: () => [
browsers: [ require('postcss-flexbugs-fixes'),
'>1%', autoprefixer({
'last 4 versions', browsers: [
'Firefox ESR', '>1%',
'not ie < 9', // React doesn't support IE8 anyway 'last 4 versions',
], 'Firefox ESR',
flexbox: 'no-2009', 'not ie < 9', // React doesn't support IE8 anyway
}), ],
], flexbox: 'no-2009',
}, }),
}, ],
], },
}, },
extractTextPluginOptions ],
) },
), extractTextPluginOptions
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`. )
}, ),
// "file" loader makes sure assets end up in the `build` folder. // Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
// When you `import` an asset, you get its filename. },
// This loader doesn't use a "test" so it will catch all modules // "file" loader makes sure assets end up in the `build` folder.
// that fall through the other loaders. // When you `import` an asset, you get its filename.
{ // This loader doesn't use a "test" so it will catch all modules
loader: require.resolve('file-loader'), // that fall through the other loaders.
// Exclude `js` files to keep "css" loader working as it injects {
// it's runtime that would otherwise processed through "file" loader. loader: require.resolve('file-loader'),
// Also exclude `html` and `json` extensions so they get processed // Exclude `js` files to keep "css" loader working as it injects
// by webpacks internal loaders. // it's runtime that would otherwise processed through "file" loader.
exclude: [/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/], // Also exclude `html` and `json` extensions so they get processed
options: { // by webpacks internal loaders.
name: 'static/media/[name].[hash:8].[ext]', exclude: [/\.(js|jsx|mjs)$/, /\.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. },
], // ** STOP ** Are you adding a new loader?
}, // Make sure to add the new loader(s) before the "file" loader.
], ],
}, },
plugins: [ ],
// Makes some environment variables available in index.html. },
// The public URL is available as %PUBLIC_URL% in index.html, e.g.: plugins: [
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> // Makes some environment variables available in index.html.
// In production, it will be an empty string unless you specify "homepage" // The public URL is available as %PUBLIC_URL% in index.html, e.g.:
// in `package.json`, in which case it will be the pathname of that URL. // <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
new InterpolateHtmlPlugin(env.raw), // In production, it will be an empty string unless you specify "homepage"
// Generates an `index.html` file with the <script> injected. // in `package.json`, in which case it will be the pathname of that URL.
new HtmlWebpackPlugin({ new InterpolateHtmlPlugin(env.raw),
inject: true, // Generates an `index.html` file with the <script> injected.
template: paths.appHtml, new HtmlWebpackPlugin({
minify: { inject: true,
removeComments: true, template: paths.appHtml,
collapseWhitespace: true, minify: {
removeRedundantAttributes: true, removeComments: true,
useShortDoctype: true, collapseWhitespace: true,
removeEmptyAttributes: true, removeRedundantAttributes: true,
removeStyleLinkTypeAttributes: true, useShortDoctype: true,
keepClosingSlash: true, removeEmptyAttributes: true,
minifyJS: true, removeStyleLinkTypeAttributes: true,
minifyCSS: true, keepClosingSlash: true,
minifyURLs: true, minifyJS: true,
}, minifyCSS: true,
}), minifyURLs: true,
// 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 was set to production here. // Makes some environment variables available to the JS code, for example:
// Otherwise React will be compiled in the very slow development mode. // if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
new webpack.DefinePlugin(env.stringified), // It is absolutely essential that NODE_ENV was set to production here.
// Minify the code. // Otherwise React will be compiled in the very slow development mode.
new webpack.optimize.UglifyJsPlugin({ new webpack.DefinePlugin(env.stringified),
compress: { // Minify the code.
warnings: false, // new webpack.optimize.UglifyJsPlugin({
// Disabled because of an issue with Uglify breaking seemingly valid code: // compress: {
// https://github.com/facebookincubator/create-react-app/issues/2376 // warnings: false,
// Pending further investigation: // // Disabled because of an issue with Uglify breaking seemingly valid code:
// https://github.com/mishoo/UglifyJS2/issues/2011 // // https://github.com/facebookincubator/create-react-app/issues/2376
comparisons: false, // // Pending further investigation:
}, // // https://github.com/mishoo/UglifyJS2/issues/2011
mangle: { // comparisons: false,
safari10: true, // },
}, // mangle: {
output: { // safari10: true,
comments: false, // },
// Turned on because emoji and regex is not minified properly using default // output: {
// https://github.com/facebookincubator/create-react-app/issues/2488 // comments: false,
ascii_only: true, // // Turned on because emoji and regex is not minified properly using default
}, // // https://github.com/facebookincubator/create-react-app/issues/2488
sourceMap: shouldUseSourceMap, // ascii_only: true,
}), // },
// Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`. // sourceMap: shouldUseSourceMap,
new ExtractTextPlugin({ // }),
filename: cssFilename, //正式版上线后打开去掉debuger和console
}), new ParallelUglifyPlugin({
// Generate a manifest file which contains a mapping of all asset filenames cacheDir: '.cache/',
// to their corresponding output file so that tools can pick it up without uglifyJS:{
// having to parse `index.html`. output: {
new ManifestPlugin({ comments: false
fileName: 'asset-manifest.json', },
}), warnings: false,
// Generate a service worker script that will precache, and keep up to date, compress: {
// the HTML & assets that are part of the Webpack build. drop_debugger: false,
new SWPrecacheWebpackPlugin({ drop_console: false
// By default, a cache-busting query parameter is appended to requests }
// used to populate the caches, to ensure the responses are fresh. }
// If a URL is already hashed by Webpack, then there is no concern }),
// about it being stale, and the cache-busting can be skipped. // Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`.
dontCacheBustUrlsMatching: /\.\w{8}\./, new ExtractTextPlugin({
filename: 'service-worker.js', filename: cssFilename,
logger(message) { }),
if (message.indexOf('Total precache size is') === 0) { // Generate a manifest file which contains a mapping of all asset filenames
// This message occurs for every build and is a bit too noisy. // to their corresponding output file so that tools can pick it up without
return; // having to parse `index.html`.
} new ManifestPlugin({
if (message.indexOf('Skipping static resource') === 0) { fileName: 'asset-manifest.json',
// This message obscures real errors so we ignore it. }),
// https://github.com/facebookincubator/create-react-app/issues/2612 // Generate a service worker script that will precache, and keep up to date,
return; // the HTML & assets that are part of the Webpack build.
} new SWPrecacheWebpackPlugin({
// console.log(message); // By default, a cache-busting query parameter is appended to requests
}, // used to populate the caches, to ensure the responses are fresh.
minify: true, // If a URL is already hashed by Webpack, then there is no concern
// For unknown URLs, fallback to the index page // about it being stale, and the cache-busting can be skipped.
navigateFallback: publicUrl + '/index.html', dontCacheBustUrlsMatching: /\.\w{8}\./,
// Ignores URLs starting from /__ (useful for Firebase): filename: 'service-worker.js',
// https://github.com/facebookincubator/create-react-app/issues/2237#issuecomment-302693219 logger(message) {
navigateFallbackWhitelist: [/^(?!\/__).*/], if (message.indexOf('Total precache size is') === 0) {
// Don't precache sourcemaps (they're large) and build asset manifest: // This message occurs for every build and is a bit too noisy.
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/], return;
}), }
// Moment.js is an extremely popular library that bundles large locale files if (message.indexOf('Skipping static resource') === 0) {
// by default due to how Webpack interprets its code. This is a practical // This message obscures real errors so we ignore it.
// solution that requires the user to opt into importing specific locales. // https://github.com/facebookincubator/create-react-app/issues/2612
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack return;
// You can remove this if you don't use Moment.js: }
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), // console.log(message);
], },
// Some libraries import Node modules but don't use them in the browser. minify: true,
// Tell Webpack to provide empty mocks for them so importing them works. // For unknown URLs, fallback to the index page
node: { navigateFallback: publicUrl + '/index.html',
dgram: 'empty', // Ignores URLs starting from /__ (useful for Firebase):
fs: 'empty', // https://github.com/facebookincubator/create-react-app/issues/2237#issuecomment-302693219
net: 'empty', navigateFallbackWhitelist: [/^(?!\/__).*/],
tls: 'empty', // Don't precache sourcemaps (they're large) and build asset manifest:
child_process: 'empty', staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
}, }),
}; // 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$/),
],
// 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: {
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty',
},
};

@ -88,6 +88,7 @@
"webpack": "3.8.1", "webpack": "3.8.1",
"webpack-dev-server": "2.9.4", "webpack-dev-server": "2.9.4",
"webpack-manifest-plugin": "1.3.2", "webpack-manifest-plugin": "1.3.2",
"webpack-parallel-uglify-plugin": "^1.1.0",
"whatwg-fetch": "2.0.3", "whatwg-fetch": "2.0.3",
"wrap-md-editor": "^0.2.20" "wrap-md-editor": "^0.2.20"
}, },
@ -164,6 +165,7 @@
"concat": "^1.0.3", "concat": "^1.0.3",
"happypack": "^5.0.1", "happypack": "^5.0.1",
"videojs-for-react": "^0.0.3", "videojs-for-react": "^0.0.3",
"webpack-bundle-analyzer": "^3.0.3" "webpack-bundle-analyzer": "^3.0.3",
"webpack-parallel-uglify-plugin": "^1.1.0"
} }
} }

@ -224,7 +224,12 @@ class App extends Component {
componentDidMount() { componentDidMount() {
// force an update if the URL changes // force an update if the URL changes
history.listen(() => this.forceUpdate()); history.listen(() => {
this.forceUpdate()
const $ = window.$
// https://www.trustie.net/issues/21919 可能会有问题
$("html").animate({ scrollTop: $('html').scrollTop() - 0 })
});
initAxiosInterceptors(this.props) initAxiosInterceptors(this.props)

@ -6,27 +6,8 @@ const $ = window.$
let _url_origin = getUrl2() let _url_origin = getUrl2()
// let _url_origin = `http://47.96.87.25:48080`; // let _url_origin = `http://47.96.87.25:48080`;
if (!window.Cropper) {
$.ajaxSetup({
cache: true
});
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/react/public/js/cropper/cropper.min.css`));
$.getScript(
`${_url_origin}/react/public/js/cropper/cropper.js`,
(data, textStatus, jqxhr) => {
});
$.getScript(
`${_url_origin}/react/public/js/cropper/html2canvas.min.js`,
(data, textStatus, jqxhr) => {
});
}
function save_avatar(){ function save_avatar(){
// if($(img_lg).html().trim() == ""){ // if($(img_lg).html().trim() == ""){
@ -93,9 +74,30 @@ class Cropper extends Component {
// console.log(event.detail.scaleX); // console.log(event.detail.scaleX);
// console.log(event.detail.scaleY); // console.log(event.detail.scaleY);
}, },
preview: this.props.previewId ? `#${this.props.previewId}` : '.img-preview', preview: this.props.previewId ? `#${this.props.previewId}` : '.img-preview',
} }
if (!window.Cropper) {
$.ajaxSetup({
cache: true
});
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/react/public/js/cropper/cropper.min.css`));
$.getScript(
`${_url_origin}/react/public/js/cropper/cropper.js`,
(data, textStatus, jqxhr) => {
});
$.getScript(
`${_url_origin}/react/public/js/cropper/html2canvas.min.js`,
(data, textStatus, jqxhr) => {
});
}
setTimeout(() => { setTimeout(() => {
const image = document.getElementById(this.props.imageId || '__image'); const image = document.getElementById(this.props.imageId || '__image');
this.cropper = new window.Cropper(image, this.options); this.cropper = new window.Cropper(image, this.options);

@ -401,7 +401,7 @@ class commonWork extends Component{
} }
secondRowLeft={ secondRowLeft={
<div style={{"display":"inline-block", "marginTop": "22px"}}> <div style={{"display":"inline-block", "marginTop": "22px"}}>
<span> {mainList&&mainList.all_count} 作业</span> <span> {mainList&&mainList.all_count} {moduleChineseName}</span>
<span style={{"marginLeft":"16px"}}>已发布{published_count}</span> <span style={{"marginLeft":"16px"}}>已发布{published_count}</span>
{/* {this.props.isAdmin()?:""} */} {/* {this.props.isAdmin()?:""} */}
<span style={{"marginLeft":"16px"}}>未发布{unpublished_count}</span> <span style={{"marginLeft":"16px"}}>未发布{unpublished_count}</span>

@ -75,13 +75,13 @@ class PathModal extends Component{
if(patheditarry===undefined){ if(patheditarry===undefined){
this.setState({ this.setState({
patheditarrytype:true, patheditarrytype:true,
patheditarryvalue:"请先选择实课程" patheditarryvalue:"请先选择实课程"
}) })
return return
}else if(patheditarry.length===0){ }else if(patheditarry.length===0){
this.setState({ this.setState({
patheditarrytype:true, patheditarrytype:true,
patheditarryvalue:"请先选择实课程" patheditarryvalue:"请先选择实课程"
}) })
return return
} }
@ -137,7 +137,7 @@ class PathModal extends Component{
/>:""} />:""}
<Modal <Modal
keyboard={false} keyboard={false}
title="选择实课程" title="选择实课程"
visible={visible} visible={visible}
closable={false} closable={false}
footer={null} footer={null}

@ -77,7 +77,7 @@ class GraduationTasksappraiseReplyChild extends Component{
{this.props.ultimate===true ? "": isAdmin && <GraduationTasksappraiseMainEditor {...this.props} {this.props.ultimate===true ? "": isAdmin && <GraduationTasksappraiseMainEditor {...this.props}
addSuccess={() => this.props.addSuccess()} addSuccess={() => this.props.addSuccess()}
showSameScore={true} showSameScore={this.props.task_type == 2}
></GraduationTasksappraiseMainEditor> } ></GraduationTasksappraiseMainEditor> }
</div> </div>

@ -1350,15 +1350,22 @@ class Listofworks extends Component {
},{responseType: 'blob'}).then((response) => { },{responseType: 'blob'}).then((response) => {
console.log("1342"); console.log("1342");
console.log(response); console.log(response);
var blob = new Blob([response.data]) if (response.status == 200) {
var blob = new Blob([response.data])
var downloadElement = document.createElement('a'); var downloadElement = document.createElement('a');
var href = window.URL.createObjectURL(blob); //创建下载的链接 var href = window.URL.createObjectURL(blob); //创建下载的链接
downloadElement.href = href; let filename = response.headers.get('Content-Disposition');
downloadElement.download = '实习报告.pdf'; //下载后文件名 if (filename) {
document.body.appendChild(downloadElement); filename = filename.match(/\"(.*)\"/)[1]; //提取文件名
downloadElement.click(); //点击下载 downloadElement.href = href;
document.body.removeChild(downloadElement); //下载完成移除元素 downloadElement.download = filename; //下载后文件名
document.body.appendChild(downloadElement);
downloadElement.click(); //点击下载
document.body.removeChild(downloadElement); //下载完成移除元素
}
window.URL.revokeObjectURL(href); //释放掉blob对象 window.URL.revokeObjectURL(href); //释放掉blob对象
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
@ -1377,15 +1384,21 @@ class Listofworks extends Component {
},{responseType: 'blob'}).then((response) => { },{responseType: 'blob'}).then((response) => {
console.log("1306"); console.log("1306");
console.log(response); console.log(response);
if (response.status == 200) {
var blob = new Blob([response.data]) var blob = new Blob([response.data])
var downloadElement = document.createElement('a'); var downloadElement = document.createElement('a');
var href = window.URL.createObjectURL(blob); //创建下载的链接 var href = window.URL.createObjectURL(blob); //创建下载的链接
downloadElement.href = href; let filename = response.headers.get('Content-Disposition');
downloadElement.download = '课堂学生成绩.xlsx'; //下载后文件名 if (filename) {
document.body.appendChild(downloadElement); filename = filename.match(/\"(.*)\"/)[1]; //提取文件名
downloadElement.click(); //点击下载 downloadElement.href = href;
document.body.removeChild(downloadElement); //下载完成移除元素 downloadElement.download = filename; //下载后文件名
document.body.appendChild(downloadElement);
downloadElement.click(); //点击下载
document.body.removeChild(downloadElement); //下载完成移除元素
}
window.URL.revokeObjectURL(href); //释放掉blob对象 window.URL.revokeObjectURL(href); //释放掉blob对象
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });

@ -572,10 +572,10 @@ class ShixunStudentWork extends Component {
</div> </div>
<div className="educontent mb30"> <div className="educontent mb30">
<p className=" fl color-black summaryname" style={{heigth:"33px"}}> <p className=" fl color-black summaryname" style={{heigth:"33px"}}>
{data&&data.homework_name} {jobsettingsdata === undefined ? "" : jobsettingsdata.data.homework_name}
</p> </p>
<CoursesListType <CoursesListType
typelist={data&&data.homework_status} typelist={jobsettingsdata === undefined ? [] : jobsettingsdata.data.homework_status}
/> />
<a className="color-grey-9 fr font-16 summaryname ml20 mr20" <a className="color-grey-9 fr font-16 summaryname ml20 mr20"
href={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${jobsettingsdata === undefined ? "" :jobsettingsdata.data.category.category_id}`}>返回</a> href={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${jobsettingsdata === undefined ? "" :jobsettingsdata.data.category.category_id}`}>返回</a>

@ -1607,7 +1607,7 @@ class Trainingjobsetting extends Component {
showmodel:false showmodel:false
}) })
} }
// 导出实习报告批量 // 导出实习报告批量
internshipreport = () => { internshipreport = () => {
console.log("internshipreport"); console.log("internshipreport");
var homeworkid = this.props.match.params.homeworkid; var homeworkid = this.props.match.params.homeworkid;
@ -1616,14 +1616,26 @@ class Trainingjobsetting extends Component {
params: { params: {
homework_common_id: homeworkid, homework_common_id: homeworkid,
} }
}).then((response) => { },{responseType: 'blob'}).then((response) => {
console.log("1593"); console.log("326");
console.log(response); console.log(response);
var blob = new Blob([response.data])
var downloadElement = document.createElement('a');
var href = window.URL.createObjectURL(blob); //创建下载的链接
let filename = response.headers.get('Content-Disposition');
if (filename) {
filename = filename.match(/\"(.*)\"/)[1]; //提取文件名
downloadElement.href = href;
downloadElement.download = filename; //下载后文件名
document.body.appendChild(downloadElement);
downloadElement.click(); //点击下载
document.body.removeChild(downloadElement); //下载完成移除元素
}
window.URL.revokeObjectURL(href); //释放掉blob对象
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
} }
// 课堂学生成绩的导出下载 // 课堂学生成绩的导出下载
@ -1631,9 +1643,22 @@ class Trainingjobsetting extends Component {
console.log("Classstudentachievement"); console.log("Classstudentachievement");
const course_id = this.props.match.params.coursesId; const course_id = this.props.match.params.coursesId;
let url = "/courses/" + course_id + "/export_member_scores_excel.xlsx"; let url = "/courses/" + course_id + "/export_member_scores_excel.xlsx";
axios.get(url).then((response) => { axios.get((url),{responseType: 'blob'}).then((response) => {
console.log("1607"); console.log("339");
console.log(response); console.log(response);
var blob = new Blob([response.data])
var downloadElement = document.createElement('a');
var href = window.URL.createObjectURL(blob); //创建下载的链接
let filename = response.headers.get('Content-Disposition');
if (filename) {
filename = filename.match(/\"(.*)\"/)[1]; //提取文件名
downloadElement.href = href;
downloadElement.download = filename; //下载后文件名
document.body.appendChild(downloadElement);
downloadElement.click(); //点击下载
document.body.removeChild(downloadElement); //下载完成移除元素
}
window.URL.revokeObjectURL(href); //释放掉blob对象
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

@ -327,9 +327,22 @@ class Workquestionandanswer extends Component {
params: { params: {
homework_common_id: homeworkid, homework_common_id: homeworkid,
} }
}).then((response) => { },{responseType: 'blob'}).then((response) => {
console.log("326"); console.log("326");
console.log(response); console.log(response);
var blob = new Blob([response.data])
var downloadElement = document.createElement('a');
var href = window.URL.createObjectURL(blob); //创建下载的链接
let filename = response.headers.get('Content-Disposition');
if (filename) {
filename = filename.match(/\"(.*)\"/)[1]; //提取文件名
downloadElement.href = href;
downloadElement.download = filename; //下载后文件名
document.body.appendChild(downloadElement);
downloadElement.click(); //点击下载
document.body.removeChild(downloadElement); //下载完成移除元素
}
window.URL.revokeObjectURL(href); //释放掉blob对象
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -341,9 +354,22 @@ class Workquestionandanswer extends Component {
console.log("Classstudentachievement"); console.log("Classstudentachievement");
const course_id = this.props.match.params.coursesId; const course_id = this.props.match.params.coursesId;
let url = "/courses/" + course_id + "/export_member_scores_excel.xlsx"; let url = "/courses/" + course_id + "/export_member_scores_excel.xlsx";
axios.get(url).then((response) => { axios.get((url),{responseType: 'blob'}).then((response) => {
console.log("339"); console.log("339");
console.log(response); console.log(response);
var blob = new Blob([response.data])
var downloadElement = document.createElement('a');
var href = window.URL.createObjectURL(blob); //创建下载的链接
let filename = response.headers.get('Content-Disposition');
if (filename) {
filename = filename.match(/\"(.*)\"/)[1]; //提取文件名
downloadElement.href = href;
downloadElement.download = filename; //下载后文件名
document.body.appendChild(downloadElement);
downloadElement.click(); //点击下载
document.body.removeChild(downloadElement); //下载完成移除元素
}
window.URL.revokeObjectURL(href); //释放掉blob对象
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

@ -1074,7 +1074,7 @@ class ShixunHomework extends Component{
{/*<WordsBtn style="blue" onClick={()=>this.editname(datas&&datas.main_category_name)} className={"mr30"}>目录重命名</WordsBtn>*/} {/*<WordsBtn style="blue" onClick={()=>this.editname(datas&&datas.main_category_name)} className={"mr30"}>目录重命名</WordsBtn>*/}
</span>: </span>:
<WordsBtn style="blue" onClick={()=>this.editDir(datas&&datas.category_name)} className={"mr30 font-16"}>目录重命名</WordsBtn>:""} <WordsBtn style="blue" onClick={()=>this.editDir(datas&&datas.category_name)} className={"mr30 font-16"}>目录重命名</WordsBtn>:""}
{this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?<WordsBtn style="blue" className="mr30 font-16" onClick={this.createCommonpath}>选用实课程</WordsBtn>:"":""} {this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?<WordsBtn style="blue" className="mr30 font-16" onClick={this.createCommonpath}>选用实课程</WordsBtn>:"":""}
{this.props.isAdmin()===true?<a className={"btn colorblue font-16"} onClick={()=>this.createCommonWork()}>选用实训</a>:""} {this.props.isAdmin()===true?<a className={"btn colorblue font-16"} onClick={()=>this.createCommonWork()}>选用实训</a>:""}
</li> </li>
</p> </p>

@ -189,7 +189,7 @@ class ShixunsHome extends Component {
{/*实训路径*/} {/*实训路径*/}
<div className="clearfix pt20 educontent pr pb20"> <div className="clearfix pt20 educontent pr pb20">
<div className="edu-txt-center"> <div className="edu-txt-center">
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>课程</p> <p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>课程</p>
<p className="color-grey-cd font-12">TRAINING COURSE</p> <p className="color-grey-cd font-12">TRAINING COURSE</p>
</div> </div>
<Link to={"/paths"} className="moreitem">更多<i className="fa fa-angle-right ml5"></i></Link> <Link to={"/paths"} className="moreitem">更多<i className="fa fa-angle-right ml5"></i></Link>

@ -94,7 +94,7 @@ class PathNew extends Component{
submitNewPath=()=>{ submitNewPath=()=>{
let {pathName} = this.state; let {pathName} = this.state;
if(pathName===""){ if(pathName===""){
this.props.showSnackbar("请输入实课程名称"); this.props.showSnackbar("请输入实课程名称");
window.location.href="#part_Name"; window.location.href="#part_Name";
this.setState({ this.setState({
flag_name:false flag_name:false
@ -103,23 +103,23 @@ class PathNew extends Component{
} }
let des=this.Des_editMD.getValue(); let des=this.Des_editMD.getValue();
if(des===""){ if(des===""){
this.props.showSnackbar("请输入实课程的简介"); this.props.showSnackbar("请输入实课程的简介");
window.location.href="#part_Des"; window.location.href="#part_Des";
return; return;
} }
if (des.length > 5000) { if (des.length > 5000) {
this.props.showSnackbar("实课程的简介最大限制5000个字符"); this.props.showSnackbar("实课程的简介最大限制5000个字符");
window.location.href="#part_Des"; window.location.href="#part_Des";
return; return;
} }
let point = this.Point_editMD.getValue(); let point = this.Point_editMD.getValue();
if(point===""){ if(point===""){
this.props.showSnackbar("请输入实课程的学习须知"); this.props.showSnackbar("请输入实课程的学习须知");
window.location.href="#part_point"; window.location.href="#part_point";
return; return;
} }
if(point.length > 500){ if(point.length > 500){
this.props.showSnackbar("实课程的学习须知最大限制500个字符"); this.props.showSnackbar("实课程的学习须知最大限制500个字符");
window.location.href="#part_point"; window.location.href="#part_point";
return; return;
} }
@ -177,10 +177,10 @@ class PathNew extends Component{
}) })
const Des_editMD = create_editorMD("shixun_introduction","100%","490px" const Des_editMD = create_editorMD("shixun_introduction","100%","490px"
,"请在此输入实课程的简介最大限制5000个字符","/api/attachments.json", response.data.description,""); ,"请在此输入实课程的简介最大限制5000个字符","/api/attachments.json", response.data.description,"");
this.Des_editMD=Des_editMD; this.Des_editMD=Des_editMD;
const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px" const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px"
,"请在此输入实课程的学习须知最大限制500个字符","/api/attachments.json",response.data.learning_notes,""); ,"请在此输入实课程的学习须知最大限制500个字符","/api/attachments.json",response.data.learning_notes,"");
this.Point_editMD=Point_editMD; this.Point_editMD=Point_editMD;
} }
}).catch((error)=>{ }).catch((error)=>{
@ -189,9 +189,9 @@ class PathNew extends Component{
} else { } else {
this.isEditPage = false this.isEditPage = false
const Des_editMD = create_editorMD("shixun_introduction","100%","490px","请在此输入实课程的简介最大限制5000个字符","/api/attachments.json","",""); const Des_editMD = create_editorMD("shixun_introduction","100%","490px","请在此输入实课程的简介最大限制5000个字符","/api/attachments.json","","");
this.Des_editMD=Des_editMD; this.Des_editMD=Des_editMD;
const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px","请在此输入实课程的学习须知最大限制500个字符","/api/attachments.json","",""); const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px","请在此输入实课程的学习须知最大限制500个字符","/api/attachments.json","","");
this.Point_editMD=Point_editMD; this.Point_editMD=Point_editMD;
} }
@ -210,9 +210,9 @@ class PathNew extends Component{
<div className="newMain clearfix"> <div className="newMain clearfix">
<div className="educontent mt10 mb50"> <div className="educontent mt10 mb50">
<div className="mb10 edu-back-white"> <div className="mb10 edu-back-white">
<p className="padding20 bor-bottom-greyE font-18 color-grey-3">创建实课程</p> <p className="padding20 bor-bottom-greyE font-18 color-grey-3">创建实课程</p>
<div className="padding30-20" id="part_Name"> <div className="padding30-20" id="part_Name">
<p className="color-grey-6 font-16 mb15">课程名称</p> <p className="color-grey-6 font-16 mb15">课程名称</p>
<div className="df"> <div className="df">
<span className="mr30 color-orange pt10">*</span> <span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20"> <div className="flex1 mr20">
@ -233,7 +233,7 @@ class PathNew extends Component{
<span className="mr30 color-orange pt10">*</span> <span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20"> <div className="flex1 mr20">
<div id="shixun_introduction" className="new_li editormd editormd-vertical"> <div id="shixun_introduction" className="new_li editormd editormd-vertical">
<textarea className="input-100-45" name="description" placeholder="请在此输入实课程的简介" value={description}></textarea> <textarea className="input-100-45" name="description" placeholder="请在此输入实课程的简介" value={description}></textarea>
</div> </div>
<p id="e_tip_shixun_introduction" className="edu-txt-right color-grey-cd font-12"></p> <p id="e_tip_shixun_introduction" className="edu-txt-right color-grey-cd font-12"></p>
<p id="e_tips_shixun_introduction" className="edu-txt-right color-grey-cd font-12"></p> <p id="e_tips_shixun_introduction" className="edu-txt-right color-grey-cd font-12"></p>
@ -247,7 +247,7 @@ class PathNew extends Component{
<span className="mr30 color-orange pt10">*</span> <span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20"> <div className="flex1 mr20">
<div id="shixun_propaedeutics" className="new_li editormd editormd-vertical"> <div id="shixun_propaedeutics" className="new_li editormd editormd-vertical">
<textarea name="learning_notes" placeholder="请在此输入实课程的学习须知" value={point}></textarea> <textarea name="learning_notes" placeholder="请在此输入实课程的学习须知" value={point}></textarea>
</div> </div>
<p id="e_tip_shixun_propaedeutics" className="edu-txt-right color-grey-cd font-12"></p> <p id="e_tip_shixun_propaedeutics" className="edu-txt-right color-grey-cd font-12"></p>
<p id="e_tips_shixun_propaedeutics" className="edu-txt-right color-grey-cd font-12"></p> <p id="e_tips_shixun_propaedeutics" className="edu-txt-right color-grey-cd font-12"></p>

@ -751,9 +751,9 @@ submittojoinclass=(value)=>{
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/courses`}>我的课堂</Link></li> <li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/courses`}>我的课堂</Link></li>
{/* p 老师 l 学生 */} {/* p 老师 l 学生 */}
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/shixuns`}>我的实训</Link></li> <li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/shixuns`}>我的实训</Link></li>
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/paths`}>我的实课程</Link></li> <li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/paths`}>我的实课程</Link></li>
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/projects`}>我的项目</Link></li> <li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/projects`}>我的项目</Link></li>
<li><a href={this.props.Headertop===undefined?"":this.props.Headertop.account_manager_url}>账号管理</a></li> <li><a href={`/account/basic`}>账号管理</a></li>
{/*<li><a onClick={()=>this.educoderlogin()} >登入测试接口</a></li>*/} {/*<li><a onClick={()=>this.educoderlogin()} >登入测试接口</a></li>*/}
{/*<li><a onClick={()=>this.trialapplications()} >试用申请</a> </li>*/} {/*<li><a onClick={()=>this.trialapplications()} >试用申请</a> </li>*/}
{/*<li><Link to={`/interest`}>兴趣页</Link></li>*/} {/*<li><Link to={`/interest`}>兴趣页</Link></li>*/}
@ -788,7 +788,7 @@ submittojoinclass=(value)=>{
<ul className="fl with50 edu-txt-center pr ul-leftline"> <ul className="fl with50 edu-txt-center pr ul-leftline">
<li><Link to={"/courses/new"}>新建课堂</Link></li> <li><Link to={"/courses/new"}>新建课堂</Link></li>
<li><a href="/shixuns/new">新建实训</a></li> <li><a href="/shixuns/new">新建实训</a></li>
<li><a href={this.props.Headertop===undefined?"":"/paths/new"}>新建实课程</a></li> <li><a href={this.props.Headertop===undefined?"":"/paths/new"}>新建实课程</a></li>
<li><a href={this.props.Headertop===undefined?"":this.props.Headertop.new_project_url} target="_blank">新建项目</a></li> <li><a href={this.props.Headertop===undefined?"":this.props.Headertop.new_project_url} target="_blank">新建项目</a></li>
</ul> </ul>
<ul className="fl with50 edu-txt-center"> <ul className="fl with50 edu-txt-center">

@ -60,7 +60,7 @@ a{
#exercisememoMD .CodeMirror { #exercisememoMD .CodeMirror {
margin-top: 31px !important; margin-top: 31px !important;
height: 700px !important; height: 374px !important;
/*width: 579px !important;*/ /*width: 579px !important;*/
} }
@ -125,7 +125,7 @@ a{
#neweditanswer .editormd-preview { #neweditanswer .editormd-preview {
top: 40px !important; top: 40px !important;
height: 364px !important; height: 364px !important;
width: 578px !important; width: 551px !important;
} }
#repository_url_tip { #repository_url_tip {

@ -1,205 +1,205 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link } from "react-router-dom"; import { BrowserRouter as Router, Route, Link } from "react-router-dom";
import axios from 'axios'; import axios from 'axios';
import { getImageUrl,} from "educoder"; import { getImageUrl,} from "educoder";
import './TPMright.css'; import './TPMright.css';
import {Icon,Tooltip} from 'antd'; import {Icon,Tooltip} from 'antd';
// import "antd/dist/antd.css"; // import "antd/dist/antd.css";
class TPMRightSection extends Component { class TPMRightSection extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
TPMRightSection:false, TPMRightSection:false,
clickNewsubscripttype:false clickNewsubscripttype:false
} }
} }
// componentDidMount() { // componentDidMount() {
// let id=this.props.match.params.shixunId; // let id=this.props.match.params.shixunId;
// //
// let shixunsDetailsURL=`/shixuns/`+id+`/show_right.json`; // let shixunsDetailsURL=`/shixuns/`+id+`/show_right.json`;
// //
// axios.get(shixunsDetailsURL).then((response)=> { // axios.get(shixunsDetailsURL).then((response)=> {
// if(response.status===200){ // if(response.status===200){
// this.setState({ // this.setState({
// TPMRightSectionData: response.data // TPMRightSectionData: response.data
// }); // });
// } // }
// }).catch((error)=>{ // }).catch((error)=>{
// console.log(error) // console.log(error)
// }); // });
// } // }
// shouldComponentUpdate(nextProps, nextState) { // shouldComponentUpdate(nextProps, nextState) {
// return nextProps.TPMRightSectionData !== this.state.TPMRightSectionData // return nextProps.TPMRightSectionData !== this.state.TPMRightSectionData
// } // }
clickNewsubscript=(val)=>{ clickNewsubscript=(val)=>{
if(val===0){ if(val===0){
this.setState({ this.setState({
TPMRightSection:true, TPMRightSection:true,
clickNewsubscripttype:true clickNewsubscripttype:true
}) })
}else{ }else{
this.setState({ this.setState({
TPMRightSection:false, TPMRightSection:false,
clickNewsubscripttype:false clickNewsubscripttype:false
}) })
} }
} }
render() { render() {
let {TPMRightSection,clickNewsubscripttype}=this.state; let {TPMRightSection,clickNewsubscripttype}=this.state;
let {TPMRightSectionData}=this.props let {TPMRightSectionData}=this.props
return ( return (
<div> <div>
{ {
TPMRightSectionData===undefined?"": TPMRightSectionData===undefined?"":
<div> <div>
<div className="edu-back-white padding40-20 mb10"> <div className="edu-back-white padding40-20 mb10">
<p className="font-16 mb20">创建者</p> <p className="font-16 mb20">创建者</p>
<div className="df"> <div className="df">
<a href={TPMRightSectionData===undefined?"":TPMRightSectionData.creator===undefined?"":TPMRightSectionData.creator.user_url}> <a href={TPMRightSectionData===undefined?"":TPMRightSectionData.creator===undefined?"":TPMRightSectionData.creator.user_url}>
<img alt="头像" className="radius mr10" height="80" src={getImageUrl(TPMRightSectionData===undefined?"":TPMRightSectionData.creator===undefined?"":'images/'+TPMRightSectionData.creator.image_url+"?1532489442")} width="80" /> <img alt="头像" className="radius mr10" height="80" src={getImageUrl(TPMRightSectionData===undefined?"":TPMRightSectionData.creator===undefined?"":'images/'+TPMRightSectionData.creator.image_url+"?1532489442")} width="80" />
</a> </a>
<div className="flex1"> <div className="flex1">
<p className="mb20">{TPMRightSectionData===undefined?"":TPMRightSectionData.creator===undefined?"":TPMRightSectionData.creator.name}</p> <p className="mb20">{TPMRightSectionData===undefined?"":TPMRightSectionData.creator===undefined?"":TPMRightSectionData.creator.name}</p>
<div className="clearfix"> <div className="clearfix">
<span>发布 {TPMRightSectionData.user_shixuns_count}</span> <span>发布 {TPMRightSectionData.user_shixuns_count}</span>
{/*<span className="ml20">粉丝 <span id="user_h_fan_count">{TPMRightSectionData.fans_count}</span></span>*/} {/*<span className="ml20">粉丝 <span id="user_h_fan_count">{TPMRightSectionData.fans_count}</span></span>*/}
{/* <a href="/watchers/unwatch?className=fr+user_watch_btn+edu-default-btn+edu-focus-btn&amp;object_id=3039&amp;object_type=user&amp;shixun_id=61&amp;target_id=3039" className="fr edu-default-btn user_watch_btn edu-focus-btn" data-method="post" data-remote="true" id="cancel_watch" rel="nofollow">取消关注</a> */} {/* <a href="/watchers/unwatch?className=fr+user_watch_btn+edu-default-btn+edu-focus-btn&amp;object_id=3039&amp;object_type=user&amp;shixun_id=61&amp;target_id=3039" className="fr edu-default-btn user_watch_btn edu-focus-btn" data-method="post" data-remote="true" id="cancel_watch" rel="nofollow">取消关注</a> */}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{ {
TPMRightSectionData === undefined ? "" :TPMRightSectionData.tags===undefined?"": TPMRightSectionData.tags.length === 0 ? "" : TPMRightSectionData === undefined ? "" :TPMRightSectionData.tags===undefined?"": TPMRightSectionData.tags.length === 0 ? "" :
<div className="edu-back-white padding40-20 mb10 relative"> <div className="edu-back-white padding40-20 mb10 relative">
<p className="font-16 mb20">技能标签 <span className="color-grey-c">{TPMRightSectionData.tags.length}</span></p> <p className="font-16 mb20">技能标签 <span className="color-grey-c">{TPMRightSectionData.tags.length}</span></p>
<div className={TPMRightSection===false?"newedbox newedboxheight":"newedbox newminheight"}> <div className={TPMRightSection===false?"newedbox newedboxheight":"newedbox newminheight"}>
<div className="clearfix" id="boxheight"> <div className="clearfix" id="boxheight">
{ TPMRightSectionData.tags.map((item,key)=>{ { TPMRightSectionData.tags.map((item,key)=>{
return( return(
<span className={item.status===false?"newedu-filter-btn fl":"edu-filter-btn29BD8B fl"} <span className={item.status===false?"newedu-filter-btn fl":"edu-filter-btn29BD8B fl"}
style={{display:item.tag_name===" "||item.tag_name===""?"none":""}} style={{display:item.tag_name===" "||item.tag_name===""?"none":""}}
key={key}>{item.tag_name}</span> key={key}>{item.tag_name}</span>
)}) )})
} }
</div> </div>
</div> </div>
<div className={TPMRightSectionData.tags.length>15&&clickNewsubscripttype===false?"newsubscript mb9 color-grey-9":"newsubscript mb9 color-grey-9 none"} <div className={TPMRightSectionData.tags.length>15&&clickNewsubscripttype===false?"newsubscript mb9 color-grey-9":"newsubscript mb9 color-grey-9 none"}
data-tip-down="显示全部" data-tip-down="显示全部"
onClick={()=>this.clickNewsubscript(0)}><span className="mr8">...</span><Icon type="caret-down" /> onClick={()=>this.clickNewsubscript(0)}><span className="mr8">...</span><Icon type="caret-down" />
</div> </div>
<div className={clickNewsubscripttype===false?"newsubscript mb9 color-grey-9 none":"newsubscript mb9 color-grey-9"} <div className={clickNewsubscripttype===false?"newsubscript mb9 color-grey-9 none":"newsubscript mb9 color-grey-9"}
data-tip-down="显示全部" data-tip-down="显示全部"
onClick={()=>this.clickNewsubscript(1)}><Icon type="caret-up" /> onClick={()=>this.clickNewsubscript(1)}><Icon type="caret-up" />
</div> </div>
</div> </div>
} }
<div className="padding20 edu-back-white" <div className="padding20 edu-back-white"
style={{ style={{
display: display:
TPMRightSectionData === undefined?"none":TPMRightSectionData.recommands===undefined?"none":TPMRightSectionData.recommands.length === 0 ? "none" : "block" TPMRightSectionData === undefined?"none":TPMRightSectionData.recommands===undefined?"none":TPMRightSectionData.recommands.length === 0 ? "none" : "block"
}} }}
> >
<p className="mb20 font-16 clearfix">推荐实训</p> <p className="mb20 font-16 clearfix">推荐实训</p>
<div className="recommend-list"> <div className="recommend-list">
{ {
TPMRightSectionData===undefined?"":TPMRightSectionData.recommands===undefined?"":TPMRightSectionData.recommands.map((item,key)=>{ TPMRightSectionData===undefined?"":TPMRightSectionData.recommands===undefined?"":TPMRightSectionData.recommands.map((item,key)=>{
return( return(
<div className="recomments clearfix df" key={key}> <div className="recomments clearfix df" key={key}>
<a href={"/shixuns/"+item.identifier+"/challenges"} target="_blank"> <a href={"/shixuns/"+item.identifier+"/challenges"} target="_blank">
<img alt="69?1526971094" height="96" src={item.pic} width="128"/> <img alt="69?1526971094" height="96" src={item.pic} width="128"/>
</a> </a>
<div className="ml10 flex1"> <div className="ml10 flex1">
<Tooltip placement="bottom" title={item.name}> <Tooltip placement="bottom" title={item.name}>
<a href={"/shixuns/"+item.identifier+"/challenges"} target="_blank" className="color-grey-6 task-hide mb12 recomment-name">{item.name}</a> <a href={"/shixuns/"+item.identifier+"/challenges"} target="_blank" className="color-grey-6 task-hide mb12 recomment-name">{item.name}</a>
</Tooltip> </Tooltip>
<p className="clearfix mt8 font-12 color-grey-B4"> <p className="clearfix mt8 font-12 color-grey-B4">
{item.stu_num} 人学习 {item.stu_num} 人学习
</p> </p>
<p className="edu-txt-right color-orange pr10">{item.level}</p> <p className="edu-txt-right color-orange pr10">{item.level}</p>
</div> </div>
</div> </div>
) )
}) })
} }
</div> </div>
</div> </div>
<div className="padding20 edu-back-white mb10 mt10" style={{ <div className="padding20 edu-back-white mb10 mt10" style={{
display: TPMRightSectionData === undefined?"none":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.length === 0 ? "none" : "block" display: TPMRightSectionData === undefined?"none":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.length === 0 ? "none" : "block"
}}> }}>
<p className="mb20 font-16 clearfix">相关实课程</p> <p className="mb20 font-16 clearfix">相关实课程</p>
<div className="recommend-list" > <div className="recommend-list" >
{ {
TPMRightSectionData===undefined?"":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.map((i,k)=>{ TPMRightSectionData===undefined?"":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.map((i,k)=>{
return( return(
<div className="recomments clearfix df" key={k}> <div className="recomments clearfix df" key={k}>
<a href={"/paths/"+i.id} height="96" width="128" target="_blank"> <a href={"/paths/"+i.id} height="96" width="128" target="_blank">
<img alt="实训" height="96" src={i.image_url} width="128" /> <img alt="实训" height="96" src={i.image_url} width="128" />
</a> </a>
<div className="ml10 flex1"> <div className="ml10 flex1">
<a href={"/paths/"+i.id} target="_blank" data-tip-down={i.name} className="color-grey-6 task-hide mb12 recomment-name">{i.name}</a> <a href={"/paths/"+i.id} target="_blank" data-tip-down={i.name} className="color-grey-6 task-hide mb12 recomment-name">{i.name}</a>
<p className="clearfix mt8 font-12 color-grey-B4"> <p className="clearfix mt8 font-12 color-grey-B4">
<Tooltip placement="bottom" title={"章节"}> <Tooltip placement="bottom" title={"章节"}>
<span className="mr10 fl squareIconSpan"><i className="iconfont icon-shixun fl mr3"></i>{i.stages_count}</span> <span className="mr10 fl squareIconSpan"><i className="iconfont icon-shixun fl mr3"></i>{i.stages_count}</span>
</Tooltip> </Tooltip>
{/*<Tooltip placement="bottom" title={"经验值"}>*/} {/*<Tooltip placement="bottom" title={"经验值"}>*/}
{/*<span className="mr10 fl squareIconSpan"><i className="iconfont icon-jingyan fl mr3"></i>{i.score_count}</span>*/} {/*<span className="mr10 fl squareIconSpan"><i className="iconfont icon-jingyan fl mr3"></i>{i.score_count}</span>*/}
{/*</Tooltip>*/} {/*</Tooltip>*/}
<Tooltip placement="bottom" title={"学习人数"}> <Tooltip placement="bottom" title={"学习人数"}>
<span className="mr10 fl squareIconSpan"><i className="iconfont icon-chengyuan fl mr3"></i>{i.members_count}</span> <span className="mr10 fl squareIconSpan"><i className="iconfont icon-chengyuan fl mr3"></i>{i.members_count}</span>
</Tooltip> </Tooltip>
</p> </p>
</div> </div>
</div> </div>
) )
}) })
} }
</div> </div>
</div> </div>
</div> </div>
} }
</div> </div>
) )
} }
} }
export default TPMRightSection; export default TPMRightSection;

@ -1,391 +1,391 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { SnackbarHOC } from 'educoder'; import { SnackbarHOC } from 'educoder';
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import {Tooltip,Menu} from 'antd'; import {Tooltip,Menu} from 'antd';
import Loadable from 'react-loadable'; import Loadable from 'react-loadable';
import Loading from '../../../Loading'; import Loading from '../../../Loading';
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
import axios from 'axios'; import axios from 'axios';
import {getImageUrl} from 'educoder'; import {getImageUrl} from 'educoder';
import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; import { TPMIndexHOC } from '../../tpm/TPMIndexHOC';
import { CNotificationHOC } from '../../courses/common/CNotificationHOC' import { CNotificationHOC } from '../../courses/common/CNotificationHOC'
import "./usersInfo.css" import "./usersInfo.css"
import "../../courses/css/members.css" import "../../courses/css/members.css"
import "../../courses/css/Courses.css" import "../../courses/css/Courses.css"
import update from 'immutability-helper' import update from 'immutability-helper'
import Trialapplication from '../../login/Trialapplication' import Trialapplication from '../../login/Trialapplication'
const InfosCourse = Loadable({ const InfosCourse = Loadable({
loader: () => import('./InfosCourse'), loader: () => import('./InfosCourse'),
loading:Loading, loading:Loading,
}) })
const InfosShixun = Loadable({ const InfosShixun = Loadable({
loader: () => import('./InfosShixun'), loader: () => import('./InfosShixun'),
loading:Loading, loading:Loading,
}) })
const InfosPath = Loadable({ const InfosPath = Loadable({
loader: () => import('./InfosPath'), loader: () => import('./InfosPath'),
loading:Loading, loading:Loading,
}) })
const InfosProject = Loadable({ const InfosProject = Loadable({
loader: () => import('./InfosProject'), loader: () => import('./InfosProject'),
loading:Loading, loading:Loading,
}) })
const $ = window.$; const $ = window.$;
class Infos extends Component{ class Infos extends Component{
constructor(props){ constructor(props){
super(props); super(props);
this.state={ this.state={
data:undefined, data:undefined,
is_current:true, is_current:true,
is_edit:false, is_edit:false,
sign:undefined, sign:undefined,
type:0, type:0,
login:undefined, login:undefined,
isRenders:false, isRenders:false,
moduleName:"courses", moduleName:"courses",
next_gold:undefined next_gold:undefined
} }
} }
componentDidMount =()=>{ componentDidMount =()=>{
this.getInfo(this.props.match.params.username); this.getInfo(this.props.match.params.username);
} }
//判断是否看的是当前用户的个人主页 //判断是否看的是当前用户的个人主页
componentDidUpdate =(prevProps)=> { componentDidUpdate =(prevProps)=> {
if(this.props.current_user && prevProps.current_user != this.props.current_user){ if(this.props.current_user && prevProps.current_user != this.props.current_user){
console.log(this.props); console.log(this.props);
if(this.props.current_user.login != this.props.match.params.username){ if(this.props.current_user.login != this.props.match.params.username){
this.setState({ this.setState({
is_current:false, is_current:false,
login:this.props.current_user.login login:this.props.current_user.login
}) })
} }
} }
} }
//获取个人主页信息 //获取个人主页信息
getInfo = (user_login) =>{ getInfo = (user_login) =>{
let url =`/users/${user_login}/homepage_info.json`; let url =`/users/${user_login}/homepage_info.json`;
axios.get(url).then((result)=>{ axios.get(url).then((result)=>{
if(result){ if(result){
this.setState({ this.setState({
data:result.data, data:result.data,
followed:result.data.followed, followed:result.data.followed,
sign:result.data.brief_introduction, sign:result.data.brief_introduction,
id:result.data.id, id:result.data.id,
next_gold:result.data.tomorrow_attendance_gold next_gold:result.data.tomorrow_attendance_gold
}) })
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
}) })
} }
// 编辑签名 // 编辑签名
editmysign=()=>{ editmysign=()=>{
this.setState({ this.setState({
is_edit:true is_edit:true
},()=>{ },()=>{
$("#mysign").focus(); $("#mysign").focus();
}) })
} }
// 输入签名 // 输入签名
inputSign=(e)=>{ inputSign=(e)=>{
this.setState({ this.setState({
sign:e.target.value sign:e.target.value
}) })
} }
//取消编辑签名 //取消编辑签名
savemysign=()=>{ savemysign=()=>{
let { sign } =this.state; let { sign } =this.state;
let url=`/users/brief_introduction.json`; let url=`/users/brief_introduction.json`;
axios.post((url),{ axios.post((url),{
content:sign content:sign
}).then((result)=>{ }).then((result)=>{
if(result){ if(result){
this.setState({ this.setState({
is_edit:false is_edit:false
}) })
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error) console.log(error)
}) })
} }
changeType=(e)=>{ changeType=(e)=>{
this.setState({ this.setState({
type:e.key type:e.key
}) })
} }
turnTo=(url)=>{ turnTo=(url)=>{
this.props.history.push(url); this.props.history.push(url);
} }
//签到 //签到
signFor=()=>{ signFor=()=>{
let url=`/users/attendance.json` let url=`/users/attendance.json`
axios.post(url).then((result)=>{ axios.post(url).then((result)=>{
if(result){ if(result){
// this.setState( // this.setState(
// (prevState) => ({ // (prevState) => ({
// data : update(prevState.data, {attendance_signed: {$set: true} }) // data : update(prevState.data, {attendance_signed: {$set: true} })
// }) // })
// ) // )
// this.setState({ // this.setState({
// next_gold:result.data.next_gold // next_gold:result.data.next_gold
// }) // })
this.getInfo(this.props.match.params.username); this.getInfo(this.props.match.params.username);
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
}) })
} }
// 关注 // 关注
followPerson=()=>{ followPerson=()=>{
let{followed,id}=this.state; let{followed,id}=this.state;
let url=`/users/${id}/watch.json`; let url=`/users/${id}/watch.json`;
// 取消关注 // 取消关注
if(followed){ if(followed){
axios.delete(url).then((result)=>{ axios.delete(url).then((result)=>{
if(result){ if(result){
this.setState({ this.setState({
followed:false followed:false
}) })
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error) console.log(error)
}) })
}else{ }else{
// 关注 // 关注
axios.post(url).then((result)=>{ axios.post(url).then((result)=>{
if(result){ if(result){
this.setState({ this.setState({
followed:true followed:true
}) })
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
}) })
} }
} }
// 试用申请 // 试用申请
trialapplications =()=>{ trialapplications =()=>{
this.setState({ this.setState({
isRenders: true, isRenders: true,
showTrial:true showTrial:true
}) })
} }
cancelModulationModels=()=>{ cancelModulationModels=()=>{
this.setState({ this.setState({
isRenders: false isRenders: false
}) })
} }
ToBank=(url)=>{ ToBank=(url)=>{
window.location.href=url; window.location.href=url;
} }
render(){ render(){
let { let {
data , data ,
is_current, is_current,
is_edit, is_edit,
sign, sign,
type, type,
followed, followed,
id, id,
login, login,
isRenders, isRenders,
moduleName, moduleName,
next_gold next_gold
}=this.state; }=this.state;
let {username}= this.props.match.params; let {username}= this.props.match.params;
let {pathname}=this.props.location; let {pathname}=this.props.location;
moduleName=pathname.split("/")[3]; moduleName=pathname.split("/")[3];
return( return(
<div className="newMain"> <div className="newMain">
{ {
isRenders && <Trialapplication {...this.state} Cancel={() => this.cancelModulationModels()}/> isRenders && <Trialapplication {...this.state} Cancel={() => this.cancelModulationModels()}/>
} }
<div className="user-main-half"> <div className="user-main-half">
<div className="user-headImg"></div> <div className="user-headImg"></div>
<div className="user-headCon"> <div className="user-headCon">
<div className="pr" style={{"min-height": "465px"}}> <div className="pr" style={{"min-height": "465px"}}>
<div className="educontent pt80 clearfix edu-txt-center"> <div className="educontent pt80 clearfix edu-txt-center">
<div className="inline"> <div className="inline">
<div className="fl headtab"> <div className="fl headtab">
<span>{is_current ? "我":"TA"}的经验值</span> <span>{is_current ? "我":"TA"}的经验值</span>
<a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${username}/user_experience`}>{data && data.experience}</a> <a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${username}/user_experience`}>{data && data.experience}</a>
</div> </div>
<em className="v-h-line fl"></em> <em className="v-h-line fl"></em>
<div className="fl headtab"> <div className="fl headtab">
<span>{is_current ? "我":"TA"}的金币</span> <span>{is_current ? "我":"TA"}的金币</span>
<a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${username}/user_grade`} id="user_code">{data && data.grade}</a> <a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${username}/user_grade`} id="user_code">{data && data.grade}</a>
</div> </div>
<div className="headphoto mt14"> <div className="headphoto mt14">
<img alt="头像" id="user_avatar_show" nhname="avatar_image" src={data && `${getImageUrl('images/'+data.avatar_url)}`}/> <img alt="头像" id="user_avatar_show" nhname="avatar_image" src={data && `${getImageUrl('images/'+data.avatar_url)}`}/>
</div> </div>
<div className="fl headtab"> <div className="fl headtab">
<span>{is_current ? "我":"TA"}的粉丝</span> <span>{is_current ? "我":"TA"}的粉丝</span>
<a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${username}/user_fanslist`} id="user_h_fan_count">{data && data.fan_count}</a> <a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${username}/user_fanslist`} id="user_h_fan_count">{data && data.fan_count}</a>
</div> </div>
<em className="v-h-line fl"></em> <em className="v-h-line fl"></em>
<div className="fl headtab"> <div className="fl headtab">
<span>{is_current ? "我":"TA"}的关注</span> <span>{is_current ? "我":"TA"}的关注</span>
<a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${username}/user_watchlist`}>{data && data.follow_count}</a> <a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${username}/user_watchlist`}>{data && data.follow_count}</a>
</div> </div>
<span className="clearfix"></span> <span className="clearfix"></span>
<span className="myName">{data && data.name}</span> <span className="myName">{data && data.name}</span>
</div> </div>
</div> </div>
<div className="educontent mt10 clearfix edu-txt-center"> <div className="educontent mt10 clearfix edu-txt-center">
<div className="inline"> <div className="inline">
{ {
data && is_current == false && data.identity =="学生" ? "" : <span className="mypost fl mr10">{data && data.identity}</span> data && is_current == false && data.identity =="学生" ? "" : <span className="mypost fl mr10">{data && data.identity}</span>
} }
<a href={is_current ? `${this.props.Headertop && this.props.Headertop.old_url}/account/authentication` :"javascript:void(0)"} target="_blank" className={is_current ? "ringauto fl" :"ringauto fl cdefault"}> <a href={is_current ? `${this.props.Headertop && this.props.Headertop.old_url}/account/authentication` :"javascript:void(0)"} target="_blank" className={is_current ? "ringauto fl" :"ringauto fl cdefault"}>
<Tooltip placement='bottom' title={ data && data.authentication ?"已实名认证":"未实名认证"}> <Tooltip placement='bottom' title={ data && data.authentication ?"已实名认证":"未实名认证"}>
<i className={ data && data.authentication ? "iconfont icon-shenfenrenzheng font-13 color-blue":"iconfont icon-shenfenrenzheng font-13 color-grey-9"}></i> <i className={ data && data.authentication ? "iconfont icon-shenfenrenzheng font-13 color-blue":"iconfont icon-shenfenrenzheng font-13 color-grey-9"}></i>
</Tooltip> </Tooltip>
</a> </a>
<a href={is_current ? `${this.props.Headertop && this.props.Headertop.old_url}/account/professional_certification` :"javascript:void(0)"} target="_blank" className={is_current ? "ringauto fl" :"ringauto fl cdefault"}> <a href={is_current ? `${this.props.Headertop && this.props.Headertop.old_url}/account/professional_certification` :"javascript:void(0)"} target="_blank" className={is_current ? "ringauto fl" :"ringauto fl cdefault"}>
<Tooltip placement='bottom' title={ data && data.professional_certification ?"已职业认证":"未职业认证"}> <Tooltip placement='bottom' title={ data && data.professional_certification ?"已职业认证":"未职业认证"}>
<i className={ data && data.professional_certification ? "iconfont icon-zhiyerenzheng font-13 color-blue":"iconfont icon-zhiyerenzheng font-13 color-grey-9"}></i> <i className={ data && data.professional_certification ? "iconfont icon-zhiyerenzheng font-13 color-blue":"iconfont icon-zhiyerenzheng font-13 color-grey-9"}></i>
</Tooltip> </Tooltip>
</a> </a>
<a href={is_current ? `${this.props.Headertop && this.props.Headertop.old_url}/account/change_or_bind?type=phone` :"javascript:void(0)"} target="_blank" className={is_current ? "ringauto fl" :"ringauto fl cdefault"}> <a href={is_current ? `${this.props.Headertop && this.props.Headertop.old_url}/account/change_or_bind?type=phone` :"javascript:void(0)"} target="_blank" className={is_current ? "ringauto fl" :"ringauto fl cdefault"}>
<Tooltip placement='bottom' title={ data && data.phone_binded ?"已手机认证":"未手机认证"}> <Tooltip placement='bottom' title={ data && data.phone_binded ?"已手机认证":"未手机认证"}>
<i className={ data && data.phone_binded ? "iconfont icon-shoujirenzheng font-13 color-blue":"iconfont icon-shoujirenzheng font-13 color-grey-9"}></i> <i className={ data && data.phone_binded ? "iconfont icon-shoujirenzheng font-13 color-blue":"iconfont icon-shoujirenzheng font-13 color-grey-9"}></i>
</Tooltip> </Tooltip>
</a> </a>
<a href={is_current ? `${this.props.Headertop && this.props.Headertop.old_url}/my/account` :"javascript:void(0)"} target="_blank" className={is_current ? "ringauto fl" :"ringauto fl cdefault"}> <a href={is_current ? `${this.props.Headertop && this.props.Headertop.old_url}/my/account` :"javascript:void(0)"} target="_blank" className={is_current ? "ringauto fl" :"ringauto fl cdefault"}>
<Tooltip placement='bottom' title={ data && data.email_binded ?"已邮箱认证":"未邮箱认证"}> <Tooltip placement='bottom' title={ data && data.email_binded ?"已邮箱认证":"未邮箱认证"}>
<i className={ data && data.email_binded ? "iconfont icon-youxiangrenzheng font-13 color-blue":"iconfont icon-youxiangrenzheng font-13 color-grey-9"}></i> <i className={ data && data.email_binded ? "iconfont icon-youxiangrenzheng font-13 color-blue":"iconfont icon-youxiangrenzheng font-13 color-grey-9"}></i>
</Tooltip> </Tooltip>
</a> </a>
{/* <!--学院管理员身份--> */} {/* <!--学院管理员身份--> */}
{ {
data && data.college_identifier && data && data.college_identifier &&
<a href={`${this.props.Headertop && this.props.Headertop.old_url}/colleges/${data.college_identifier}/statistics`} target="_blank" className={is_current ? "ringauto fl" :"ringauto fl cdefault"}> <a href={`${this.props.Headertop && this.props.Headertop.old_url}/colleges/${data.college_identifier}/statistics`} target="_blank" className={is_current ? "ringauto fl" :"ringauto fl cdefault"}>
<Tooltip placement='bottom' title="学院管理员"> <Tooltip placement='bottom' title="学院管理员">
<i className="iconfont icon-chengyuanguanli font-12 color-blue" data-tip-down="学院管理员"></i> <i className="iconfont icon-chengyuanguanli font-12 color-blue" data-tip-down="学院管理员"></i>
</Tooltip> </Tooltip>
</a> </a>
} }
</div> </div>
</div> </div>
<div className="mt15 educontent clearfix edu-txt-center"> <div className="mt15 educontent clearfix edu-txt-center">
<p className="mb20" style={{"height": "28px"}}> <p className="mb20" style={{"height": "28px"}}>
{ {
is_edit && is_current ? is_edit && is_current ?
<input type="text" id="mysign" class="mysign-input" placeholder="请输入您的个性签名" style={{height:"20px"}} value={sign} onInput={this.inputSign} onBlur={this.savemysign}/> <input type="text" id="mysign" class="mysign-input" placeholder="请输入您的个性签名" style={{height:"20px"}} value={sign} onInput={this.inputSign} onBlur={this.savemysign}/>
: :
is_current ? is_current ?
<a className="mysign-span" onClick={this.editmysign} style={{"display": "block"}}>{sign || "这家伙很懒,什么都没留下~"}</a> <a className="mysign-span" onClick={this.editmysign} style={{"display": "block"}}>{sign || "这家伙很懒,什么都没留下~"}</a>
: :
<span className="mysign-span" style={{"display": "block","cursor":"default"}}>{sign || "这家伙很懒,什么都没留下~"}</span> <span className="mysign-span" style={{"display": "block","cursor":"default"}}>{sign || "这家伙很懒,什么都没留下~"}</span>
} }
</p> </p>
{ {
is_current ? is_current ?
<div className="inline"> <div className="inline">
{ {
data && data.can_apply_trial == false ? data && data.can_apply_trial == false ?
data.attendance_signed ? data.attendance_signed ?
<React.Fragment> <React.Fragment>
<span className="user_default_btn user_grey_btn mb5">已签到</span> <span className="user_default_btn user_grey_btn mb5">已签到</span>
<p id="attendance_notice" className="none font-12 color-grey-6" style={{"display":"block"}}>明日签到&nbsp;<font className="color-orange">+{next_gold}</font>&nbsp;</p> <p id="attendance_notice" className="none font-12 color-grey-6" style={{"display":"block"}}>明日签到&nbsp;<font className="color-orange">+{next_gold}</font>&nbsp;</p>
</React.Fragment> </React.Fragment>
: :
<a herf="javascript:void(0);" onClick={this.signFor} id="attendance" className="user_default_btn user_orange_btn fl mb15">签到</a> <a herf="javascript:void(0);" onClick={this.signFor} id="attendance" className="user_default_btn user_orange_btn fl mb15">签到</a>
: :
<a herf="javascript:void(0);" onClick={this.trialapplications} id="authentication_apply" className="user_default_btn user_private_btn fl ml15">试用申请</a> <a herf="javascript:void(0);" onClick={this.trialapplications} id="authentication_apply" className="user_default_btn user_private_btn fl ml15">试用申请</a>
} }
</div> </div>
: :
<div className="inline"> <div className="inline">
<a href="javascript:void(0);" onClick={this.followPerson} className="user_default_btn user_watch_btn user_private_btn fl mr20">{followed ? "取消关注":"关注"}</a> <a href="javascript:void(0);" onClick={this.followPerson} className="user_default_btn user_watch_btn user_private_btn fl mr20">{followed ? "取消关注":"关注"}</a>
<a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${login}/message_detail?user_id=${id}`} className="user_default_btn user_private_btn fl">私信</a> <a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${login}/message_detail?user_id=${id}`} className="user_default_btn user_private_btn fl">私信</a>
</div> </div>
} }
</div> </div>
<div className="edu-txt-center navInfo"> <div className="edu-txt-center navInfo">
<div className="inline"> <div className="inline">
<li className={`${moduleName == 'courses' ||moduleName == undefined ? 'active' : '' }`}> <li className={`${moduleName == 'courses' ||moduleName == undefined ? 'active' : '' }`}>
<Link <Link
onClick={() => this.setState({moduleName: 'courses'})} onClick={() => this.setState({moduleName: 'courses'})}
to={`/users/${username}/courses`}>课堂</Link> to={`/users/${username}/courses`}>课堂</Link>
</li> </li>
<li className={`${moduleName == 'shixuns' ? 'active' : '' }`}> <li className={`${moduleName == 'shixuns' ? 'active' : '' }`}>
<Link <Link
onClick={() => this.setState({moduleName: 'shixuns'})} onClick={() => this.setState({moduleName: 'shixuns'})}
to={`/users/${username}/shixuns`}>实训</Link> to={`/users/${username}/shixuns`}>实训</Link>
</li> </li>
<li className={`${moduleName == 'paths' ? 'active' : '' }`}> <li className={`${moduleName == 'paths' ? 'active' : '' }`}>
<Link <Link
onClick={() => this.setState({moduleName: 'paths'})} onClick={() => this.setState({moduleName: 'paths'})}
to={`/users/${username}/paths`}>课程</Link> to={`/users/${username}/paths`}>课程</Link>
</li> </li>
<li className={`${moduleName == 'projects' ? 'active' : '' }`}> <li className={`${moduleName == 'projects' ? 'active' : '' }`}>
<Link <Link
onClick={() => this.setState({moduleName: 'projects'})} onClick={() => this.setState({moduleName: 'projects'})}
to={`/users/${username}/projects`}>项目</Link> to={`/users/${username}/projects`}>项目</Link>
</li> </li>
{ data && data.identity!="学生" && <li> <a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${username}?type=m_bank`}>题库</a></li>} { data && data.identity!="学生" && <li> <a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${username}?type=m_bank`}>题库</a></li>}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<Switch {...this.props}> <Switch {...this.props}>
{/* --------------------------------------------------------------------- */} {/* --------------------------------------------------------------------- */}
{/* 课堂 */} {/* 课堂 */}
{/* http://localhost:3007/courses/1309/homework/9300/setting */} {/* http://localhost:3007/courses/1309/homework/9300/setting */}
<Route exact path="/users/:username/courses" <Route exact path="/users/:username/courses"
render={ render={
(props) => (<InfosCourse {...this.props} {...props} {...this.state} />) (props) => (<InfosCourse {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
{/* 实训 */} {/* 实训 */}
<Route exact path="/users/:username/shixuns" <Route exact path="/users/:username/shixuns"
render={ render={
(props) => (<InfosShixun {...this.props} {...props} {...this.state} />) (props) => (<InfosShixun {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
{/* 实训课程 */} {/* 实训课程 */}
<Route exact path="/users/:username/paths" <Route exact path="/users/:username/paths"
render={ render={
(props) => (<InfosPath {...this.props} {...props} {...this.state} />) (props) => (<InfosPath {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
{/* 项目 */} {/* 项目 */}
<Route exact path="/users/:username/projects" <Route exact path="/users/:username/projects"
render={ render={
(props) => (<InfosProject {...this.props} {...props} {...this.state} />) (props) => (<InfosProject {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/users/:username" <Route exact path="/users/:username"
render={ render={
(props) => (<InfosCourse {...this.props} {...props} {...this.state} />) (props) => (<InfosCourse {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
</Switch> </Switch>
</div> </div>
) )
} }
} }
export default CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC(Infos) )); export default CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC(Infos) ));

@ -1,197 +1,197 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { SnackbarHOC } from 'educoder'; import { SnackbarHOC } from 'educoder';
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
import {Tooltip,Menu,Pagination, Spin} from 'antd'; import {Tooltip,Menu,Pagination, Spin} from 'antd';
import Loadable from 'react-loadable'; import Loadable from 'react-loadable';
import Loading from '../../../Loading'; import Loading from '../../../Loading';
import NoneData from '../../courses/coursesPublic/NoneData' import NoneData from '../../courses/coursesPublic/NoneData'
import axios from 'axios'; import axios from 'axios';
import {getImageUrl,setImagesUrl} from 'educoder'; import {getImageUrl,setImagesUrl} from 'educoder';
import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; import { TPMIndexHOC } from '../../tpm/TPMIndexHOC';
import { CNotificationHOC } from '../../courses/common/CNotificationHOC' import { CNotificationHOC } from '../../courses/common/CNotificationHOC'
import "./usersInfo.css" import "./usersInfo.css"
import Create from './publicCreatNew' import Create from './publicCreatNew'
class InfosPath extends Component{ class InfosPath extends Component{
constructor(props){ constructor(props){
super(props); super(props);
this.state={ this.state={
category:undefined, category:undefined,
page:1, page:1,
sort_by:'time', sort_by:'time',
status:undefined, status:undefined,
per_page:16, per_page:16,
isSpin:false, isSpin:false,
totalCount:undefined, totalCount:undefined,
data:undefined data:undefined
} }
} }
componentDidMount=()=>{ componentDidMount=()=>{
this.setState({ this.setState({
isSpin:true isSpin:true
}) })
let{category,status,sort_by,page,per_page}=this.state; let{category,status,sort_by,page,per_page}=this.state;
this.getCourses(category,status,sort_by,page,per_page); this.getCourses(category,status,sort_by,page,per_page);
} }
getCourses=(category,status,sort_by,page,per_page)=>{ getCourses=(category,status,sort_by,page,per_page)=>{
let url=`/users/${this.props.match.params.username}/subjects.json`; let url=`/users/${this.props.match.params.username}/subjects.json`;
axios.get((url),{params:{ axios.get((url),{params:{
category, category,
status, status,
sort_by, sort_by,
page, page,
per_page:this.props.is_current && category && page ==1?17:16 per_page:this.props.is_current && category && page ==1?17:16
}}).then((result)=>{ }}).then((result)=>{
if(result){ if(result){
this.setState({ this.setState({
totalCount:result.data.count, totalCount:result.data.count,
data:result.data, data:result.data,
isSpin:false isSpin:false
}) })
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
}) })
} }
//切换种类 //切换种类
changeCategory=(cate)=>{ changeCategory=(cate)=>{
this.setState({ this.setState({
category:cate, category:cate,
status:undefined, status:undefined,
page:1, page:1,
isSpin:true isSpin:true
}) })
let{sort_by}=this.state; let{sort_by}=this.state;
this.getCourses(cate,undefined,sort_by,1); this.getCourses(cate,undefined,sort_by,1);
} }
// 切换状态 // 切换状态
changeStatus=(status)=>{ changeStatus=(status)=>{
let{category,sort_by}=this.state; let{category,sort_by}=this.state;
this.setState({ this.setState({
status, status,
page:1, page:1,
isSpin:true isSpin:true
}) })
this.getCourses(category,status,sort_by,1); this.getCourses(category,status,sort_by,1);
} }
//切换页数 //切换页数
changePage=(page)=>{ changePage=(page)=>{
this.setState({ this.setState({
page, page,
isSpin:true isSpin:true
}) })
let{category,sort_by,status}=this.state; let{category,sort_by,status}=this.state;
this.getCourses(category,status,sort_by,page); this.getCourses(category,status,sort_by,page);
} }
// 进入课堂 // 进入课堂
turnToCourses=(url)=>{ turnToCourses=(url)=>{
this.props.history.push(url); this.props.history.push(url);
} }
// 切换排序方式 // 切换排序方式
changeOrder= (sort)=>{ changeOrder= (sort)=>{
this.setState({ this.setState({
sort_by:sort, sort_by:sort,
isSpin:true isSpin:true
}) })
let{category,status,page}=this.state; let{category,status,page}=this.state;
this.getCourses(category,status,sort,page); this.getCourses(category,status,sort,page);
} }
render(){ render(){
let{ let{
category, category,
status, status,
sort_by, sort_by,
page, page,
data, data,
totalCount, totalCount,
isSpin isSpin
} = this.state; } = this.state;
let isStudent = this.props.isStudent(); let isStudent = this.props.isStudent();
let is_current=this.props.is_current; let is_current=this.props.is_current;
return( return(
<div className="educontent"> <div className="educontent">
<Spin size="large" spinning={isSpin}> <Spin size="large" spinning={isSpin}>
<div className="white-panel edu-back-white pt25 pb25 clearfix "> <div className="white-panel edu-back-white pt25 pb25 clearfix ">
<li className={category ? "" : "active"}><a href="javascript:void(0)" onClick={()=>this.changeCategory()}>全部</a></li> <li className={category ? "" : "active"}><a href="javascript:void(0)" onClick={()=>this.changeCategory()}>全部</a></li>
<li className={category=="manage" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("manage")}>{is_current ? "我":"TA"}管理的</a></li> <li className={category=="manage" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("manage")}>{is_current ? "我":"TA"}管理的</a></li>
<li className={category=="study" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("study")}>{is_current ? "我":"TA"}学习的</a></li> <li className={category=="study" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("study")}>{is_current ? "我":"TA"}学习的</a></li>
</div> </div>
{ {
category && category == "manage" && is_current && category && category == "manage" && is_current &&
<div className="edu-back-white padding20-30 clearfix secondNav bor-top-greyE"> <div className="edu-back-white padding20-30 clearfix secondNav bor-top-greyE">
<li className={status ? "" : "active"}><a href="javascript:void(0)" onClick={()=>this.changeStatus()}>全部</a></li> <li className={status ? "" : "active"}><a href="javascript:void(0)" onClick={()=>this.changeStatus()}>全部</a></li>
<li className={status=="editing" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeStatus("editing")}>编辑中</a></li> <li className={status=="editing" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeStatus("editing")}>编辑中</a></li>
<li className={status=="applying" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeStatus("applying")}>待审核</a></li> <li className={status=="applying" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeStatus("applying")}>待审核</a></li>
<li className={status=="published" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeStatus("published")}>已发布</a></li> <li className={status=="published" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeStatus("published")}>已发布</a></li>
</div> </div>
} }
{ {
category && category == "study" && is_current && category && category == "study" && is_current &&
<div className="edu-back-white padding20-30 clearfix secondNav bor-top-greyE"> <div className="edu-back-white padding20-30 clearfix secondNav bor-top-greyE">
<li className={status ? "" : "active"}><a href="javascript:void(0)" onClick={()=>this.changeStatus()}>全部</a></li> <li className={status ? "" : "active"}><a href="javascript:void(0)" onClick={()=>this.changeStatus()}>全部</a></li>
<li className={status=="unfinished" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeStatus("unfinished")}>未完成</a></li> <li className={status=="unfinished" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeStatus("unfinished")}>未完成</a></li>
<li className={status=="finished" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeStatus("finished")}>已完成</a></li> <li className={status=="finished" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeStatus("finished")}>已完成</a></li>
</div> </div>
} }
<div className="pl25 pr25 clearfix font-12 mb20 mt20"> <div className="pl25 pr25 clearfix font-12 mb20 mt20">
<span className="fl color-grey-9">共参与{totalCount}{category?category=="manage"?"发布":"学习":"实课程"}</span> <span className="fl color-grey-9">共参与{totalCount}{category?category=="manage"?"发布":"学习":"实课程"}</span>
<span className="fr color-grey-9">时间最新</span> <span className="fr color-grey-9">时间最新</span>
</div> </div>
<div className="square-list clearfix"> <div className="square-list clearfix">
{ {
!isStudent && page == 1 && !category && is_current && !isStudent && page == 1 && !category && is_current &&
<Create href={"/paths/new"} name={"新建实课程"} index="3"></Create> <Create href={"/paths/new"} name={"新建实课程"} index="3"></Create>
} }
{ {
(!data || data.subjects.length==0) && (isStudent || category) && <NoneData></NoneData> (!data || data.subjects.length==0) && (isStudent || category) && <NoneData></NoneData>
} }
{ {
data && data.subjects && data.subjects.map((item,key)=>{ data && data.subjects && data.subjects.map((item,key)=>{
return( return(
<div className="square-Item" onClick={()=>this.turnToCourses(`/paths/${item.id}`)}> <div className="square-Item" onClick={()=>this.turnToCourses(`/paths/${item.id}`)}>
{ {
item.tag && <div className="tag-green"><span className="tag-name">{item.tag}</span><img src={setImagesUrl("images/educoder/tag2.png")} className="fl"/></div> item.tag && <div className="tag-green"><span className="tag-name">{item.tag}</span><img src={setImagesUrl("images/educoder/tag2.png")} className="fl"/></div>
} }
<a href="javascript:void(0)" className="square-img"><img alt="Subject12" src={getImageUrl(`${item.image_url}`)}/></a> <a href="javascript:void(0)" className="square-img"><img alt="Subject12" src={getImageUrl(`${item.image_url}`)}/></a>
<div className="square-main"> <div className="square-main">
<p className="task-hide"> <p className="task-hide">
<a href="javascript:void(0)" className="justify color-grey-name">{item.name}</a> <a href="javascript:void(0)" className="justify color-grey-name">{item.name}</a>
</p> </p>
<div className="mt10"> <div className="mt10">
<p className="color-grey-6 clearfix"> <p className="color-grey-6 clearfix">
<a href="javascript:void(0)" className="fl color-grey-9">{item.owner_name}</a> <a href="javascript:void(0)" className="fl color-grey-9">{item.owner_name}</a>
<span className="fr squareIconSpan"> <span className="fr squareIconSpan">
<Tooltip placement='bottom' title="访问量"> <Tooltip placement='bottom' title="访问量">
<i className="iconfont icon-liulanyan fl mr5"></i> <i className="iconfont icon-liulanyan fl mr5"></i>
</Tooltip> </Tooltip>
{item.visits_count} {item.visits_count}
</span> </span>
</p> </p>
</div> </div>
</div> </div>
</div> </div>
) )
}) })
} }
</div> </div>
{ {
totalCount > 15 && totalCount > 15 &&
<div className="mt30 mb50 edu-txt-center"> <div className="mt30 mb50 edu-txt-center">
<Pagination showQuickJumper total={totalCount} onChange={this.changePage} pageSize={16} current={page}/> <Pagination showQuickJumper total={totalCount} onChange={this.changePage} pageSize={16} current={page}/>
</div> </div>
} }
</Spin> </Spin>
</div> </div>
) )
} }
} }
export default InfosPath; export default InfosPath;
Loading…
Cancel
Save