diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js
index 2fc1bbe64..80973be75 100644
--- a/public/react/config/webpack.config.dev.js
+++ b/public/react/config/webpack.config.dev.js
@@ -28,8 +28,8 @@ const env = getClientEnvironment(publicUrl);
// The production configuration is different and lives in a separate file.
module.exports = {
// You may want 'eval' instead if you prefer to see the compiled output in DevTools.
- // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.
- devtool: 'cheap-module-source-map',
+ // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s
+ devtool: "source-map", // 开启调试
// These are the "entry points" to our application.
// This means they will be the "root" imports that are included in JS bundle.
// The first two entry points enable "hot" CSS and auto-refreshes for JS.
diff --git a/public/react/config/webpack.config.prod.js b/public/react/config/webpack.config.prod.js
index a69eff349..0abd707af 100644
--- a/public/react/config/webpack.config.prod.js
+++ b/public/react/config/webpack.config.prod.js
@@ -58,7 +58,7 @@ module.exports = {
bail: true,
// We generate sourcemaps in production. This is slow but gives good results.
// You can exclude the *.map files from the build during deployment.
- // devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版
+ // devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版
devtool: shouldUseSourceMap ? 'source-map' : false,//测试版
// In production, we only want to load the polyfills and the app code.
entry: [require.resolve('./polyfills'), paths.appIndexJs],
diff --git a/public/react/config/webpackDevServer.config.js b/public/react/config/webpackDevServer.config.js
index 8e3d95c3d..f12d31594 100644
--- a/public/react/config/webpackDevServer.config.js
+++ b/public/react/config/webpackDevServer.config.js
@@ -1,95 +1,95 @@
-'use strict';
-
-const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
-const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
-const ignoredFiles = require('react-dev-utils/ignoredFiles');
-const config = require('./webpack.config.dev');
-const paths = require('./paths');
-
-const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
-const host = process.env.HOST || '0.0.0.0';
-
-module.exports = function(proxy, allowedHost) {
- return {
- // WebpackDevServer 2.4.3 introduced a security fix that prevents remote
- // websites from potentially accessing local content through DNS rebinding:
- // https://github.com/webpack/webpack-dev-server/issues/887
- // https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
- // However, it made several existing use cases such as development in cloud
- // environment or subdomains in development significantly more complicated:
- // https://github.com/facebookincubator/create-react-app/issues/2271
- // https://github.com/facebookincubator/create-react-app/issues/2233
- // While we're investigating better solutions, for now we will take a
- // compromise. Since our WDS configuration only serves files in the `public`
- // folder we won't consider accessing them a vulnerability. However, if you
- // use the `proxy` feature, it gets more dangerous because it can expose
- // remote code execution vulnerabilities in backends like Django and Rails.
- // So we will disable the host check normally, but enable it if you have
- // specified the `proxy` setting. Finally, we let you override it if you
- // really know what you're doing with a special environment variable.
- disableHostCheck:
- !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true',
- // Enable gzip compression of generated files.
- compress: true,
- // Silence WebpackDevServer's own logs since they're generally not useful.
- // It will still show compile warnings and errors with this setting.
- clientLogLevel: 'none',
- // By default WebpackDevServer serves physical files from current directory
- // in addition to all the virtual build products that it serves from memory.
- // This is confusing because those files won’t automatically be available in
- // production build folder unless we copy them. However, copying the whole
- // project directory is dangerous because we may expose sensitive files.
- // Instead, we establish a convention that only files in `public` directory
- // get served. Our build script will copy `public` into the `build` folder.
- // In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:
- //
- // In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
- // Note that we only recommend to use `public` folder as an escape hatch
- // for files like `favicon.ico`, `manifest.json`, and libraries that are
- // for some reason broken when imported through Webpack. If you just want to
- // use an image, put it in `src` and `import` it from JavaScript instead.
- contentBase: paths.appPublic,
- // By default files from `contentBase` will not trigger a page reload.
- watchContentBase: true,
- // Enable hot reloading server. It will provide /sockjs-node/ endpoint
- // for the WebpackDevServer client so it can learn when the files were
- // updated. The WebpackDevServer client is included as an entry point
- // in the Webpack development configuration. Note that only changes
- // to CSS are currently hot reloaded. JS changes will refresh the browser.
- hot: true,
- // It is important to tell WebpackDevServer to use the same "root" path
- // as we specified in the config. In development, we always serve from /.
- publicPath: config.output.publicPath,
- // WebpackDevServer is noisy by default so we emit custom message instead
- // by listening to the compiler events with `compiler.plugin` calls above.
- quiet: true,
- // Reportedly, this avoids CPU overload on some systems.
- // https://github.com/facebookincubator/create-react-app/issues/293
- // src/node_modules is not ignored to support absolute imports
- // https://github.com/facebookincubator/create-react-app/issues/1065
- watchOptions: {
- ignored: ignoredFiles(paths.appSrc),
- },
- // Enable HTTPS if the HTTPS environment variable is set to 'true'
- https: protocol === 'https',
- host: host,
- overlay: false,
- historyApiFallback: {
- // Paths with dots should still use the history fallback.
- // See https://github.com/facebookincubator/create-react-app/issues/387.
- disableDotRule: true,
- },
- public: allowedHost,
- proxy,
- before(app) {
- // This lets us open files from the runtime error overlay.
- app.use(errorOverlayMiddleware());
- // This service worker file is effectively a 'no-op' that will reset any
- // previous service worker registered for the same host:port combination.
- // We do this in development to avoid hitting the production cache if
- // it used the same host and port.
- // https://github.com/facebookincubator/create-react-app/issues/2272#issuecomment-302832432
- app.use(noopServiceWorkerMiddleware());
- },
- };
-};
+'use strict';
+
+const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
+const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
+const ignoredFiles = require('react-dev-utils/ignoredFiles');
+const config = require('./webpack.config.dev');
+const paths = require('./paths');
+
+const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
+const host = process.env.HOST || '0.0.0.0';
+
+module.exports = function(proxy, allowedHost) {
+ return {
+ // WebpackDevServer 2.4.3 introduced a security fix that prevents remote
+ // websites from potentially accessing local content through DNS rebinding:
+ // https://github.com/webpack/webpack-dev-server/issues/887
+ // https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
+ // However, it made several existing use cases such as development in cloud
+ // environment or subdomains in development significantly more complicated:
+ // https://github.com/facebookincubator/create-react-app/issues/2271
+ // https://github.com/facebookincubator/create-react-app/issues/2233
+ // While we're investigating better solutions, for now we will take a
+ // compromise. Since our WDS configuration only serves files in the `public`
+ // folder we won't consider accessing them a vulnerability. However, if you
+ // use the `proxy` feature, it gets more dangerous because it can expose
+ // remote code execution vulnerabilities in backends like Django and Rails.
+ // So we will disable the host check normally, but enable it if you have
+ // specified the `proxy` setting. Finally, we let you override it if you
+ // really know what you're doing with a special environment variable.
+ disableHostCheck:
+ !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true',
+ // Enable gzip compression of generated files.
+ compress: true,
+ // Silence WebpackDevServer's own logs since they're generally not useful.
+ // It will still show compile warnings and errors with this setting.
+ clientLogLevel: 'none',
+ // By default WebpackDevServer serves physical files from current directory
+ // in addition to all the virtual build products that it serves from memory.
+ // This is confusing because those files won’t automatically be available in
+ // production build folder unless we copy them. However, copying the whole
+ // project directory is dangerous because we may expose sensitive files.
+ // Instead, we establish a convention that only files in `public` directory
+ // get served. Our build script will copy `public` into the `build` folder.
+ // In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:
+ //
+ // In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
+ // Note that we only recommend to use `public` folder as an escape hatch
+ // for files like `favicon.ico`, `manifest.json`, and libraries that are
+ // for some reason broken when imported through Webpack. If you just want to
+ // use an image, put it in `src` and `import` it from JavaScript instead.
+ contentBase: paths.appPublic,
+ // By default files from `contentBase` will not trigger a page reload.
+ watchContentBase: true,
+ // Enable hot reloading server. It will provide /sockjs-node/ endpoint
+ // for the WebpackDevServer client so it can learn when the files were
+ // updated. The WebpackDevServer client is included as an entry point
+ // in the Webpack development configuration. Note that only changes
+ // to CSS are currently hot reloaded. JS changes will refresh the browser.
+ hot: true,
+ // It is important to tell WebpackDevServer to use the same "root" path
+ // as we specified in the config. In development, we always serve from /.
+ publicPath: config.output.publicPath,
+ // WebpackDevServer is noisy by default so we emit custom message instead
+ // by listening to the compiler events with `compiler.plugin` calls above.
+ quiet: true,
+ // Reportedly, this avoids CPU overload on some systems.
+ // https://github.com/facebookincubator/create-react-app/issues/293
+ // src/node_modules is not ignored to support absolute imports
+ // https://github.com/facebookincubator/create-react-app/issues/1065
+ watchOptions: {
+ ignored: ignoredFiles(paths.appSrc),
+ },
+ // Enable HTTPS if the HTTPS environment variable is set to 'true'
+ https: protocol === 'https',
+ host: host,
+ overlay: false,
+ historyApiFallback: {
+ // Paths with dots should still use the history fallback.
+ // See https://github.com/facebookincubator/create-react-app/issues/387.
+ disableDotRule: true,
+ },
+ public: allowedHost,
+ proxy,
+ before(app) {
+ // This lets us open files from the runtime error overlay.
+ app.use(errorOverlayMiddleware());
+ // This service worker file is effectively a 'no-op' that will reset any
+ // previous service worker registered for the same host:port combination.
+ // We do this in development to avoid hitting the production cache if
+ // it used the same host and port.
+ // https://github.com/facebookincubator/create-react-app/issues/2272#issuecomment-302832432
+ app.use(noopServiceWorkerMiddleware());
+ },
+ };
+};
diff --git a/public/react/package.json b/public/react/package.json
index 54519f009..21f37b76e 100644
--- a/public/react/package.json
+++ b/public/react/package.json
@@ -42,6 +42,7 @@
"immutability-helper": "^2.6.6",
"install": "^0.12.2",
"jest": "20.0.4",
+ "js-base64": "^2.5.1",
"js-file-download": "^0.4.7",
"lodash": "^4.17.5",
"loglevel": "^1.6.1",
@@ -164,6 +165,7 @@
"babel-plugin-import": "^1.11.0",
"concat": "^1.0.3",
"happypack": "^5.0.1",
+ "js-base64": "^2.5.1",
"videojs-for-react": "^0.0.3",
"webpack-bundle-analyzer": "^3.0.3",
"webpack-parallel-uglify-plugin": "^1.1.0"
diff --git a/public/react/public/js/jsFromMiddleLayer/base64.js b/public/react/public/js/jsFromMiddleLayer/base64.js
deleted file mode 100755
index c4df1c0de..000000000
--- a/public/react/public/js/jsFromMiddleLayer/base64.js
+++ /dev/null
@@ -1,103 +0,0 @@
-function Base64() {
-
- // private property
- _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
-
- // public method for encoding
- this.encode = function (input) {
- var output = "";
- var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
- var i = 0;
- input = _utf8_encode(input);
- while (i < input.length) {
- chr1 = input.charCodeAt(i++);
- chr2 = input.charCodeAt(i++);
- chr3 = input.charCodeAt(i++);
- enc1 = chr1 >> 2;
- enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
- enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
- enc4 = chr3 & 63;
- if (isNaN(chr2)) {
- enc3 = enc4 = 64;
- } else if (isNaN(chr3)) {
- enc4 = 64;
- }
- output = output +
- _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
- _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
- }
- return output;
- }
-
- // public method for decoding
- this.decode = function (input) {
- var output = "";
- var chr1, chr2, chr3;
- var enc1, enc2, enc3, enc4;
- var i = 0;
- input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
- while (i < input.length) {
- enc1 = _keyStr.indexOf(input.charAt(i++));
- enc2 = _keyStr.indexOf(input.charAt(i++));
- enc3 = _keyStr.indexOf(input.charAt(i++));
- enc4 = _keyStr.indexOf(input.charAt(i++));
- chr1 = (enc1 << 2) | (enc2 >> 4);
- chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
- chr3 = ((enc3 & 3) << 6) | enc4;
- output = output + String.fromCharCode(chr1);
- if (enc3 != 64) {
- output = output + String.fromCharCode(chr2);
- }
- if (enc4 != 64) {
- output = output + String.fromCharCode(chr3);
- }
- }
- output = _utf8_decode(output);
- return output;
- }
-
- // private method for UTF-8 encoding
- _utf8_encode = function (string) {
- string = string.replace(/\r\n/g,"\n");
- var utftext = "";
- for (var n = 0; n < string.length; n++) {
- var c = string.charCodeAt(n);
- if (c < 128) {
- utftext += String.fromCharCode(c);
- } else if((c > 127) && (c < 2048)) {
- utftext += String.fromCharCode((c >> 6) | 192);
- utftext += String.fromCharCode((c & 63) | 128);
- } else {
- utftext += String.fromCharCode((c >> 12) | 224);
- utftext += String.fromCharCode(((c >> 6) & 63) | 128);
- utftext += String.fromCharCode((c & 63) | 128);
- }
-
- }
- return utftext;
- }
-
- // private method for UTF-8 decoding
- _utf8_decode = function (utftext) {
- var string = "";
- var i = 0;
- var c = c1 = c2 = 0;
- while ( i < utftext.length ) {
- c = utftext.charCodeAt(i);
- if (c < 128) {
- string += String.fromCharCode(c);
- i++;
- } else if((c > 191) && (c < 224)) {
- c2 = utftext.charCodeAt(i+1);
- string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
- i += 2;
- } else {
- c2 = utftext.charCodeAt(i+1);
- c3 = utftext.charCodeAt(i+2);
- string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
- i += 3;
- }
- }
- return string;
- }
-}
\ No newline at end of file
diff --git a/public/react/src/common/SnackbarHOC.js b/public/react/src/common/SnackbarHOC.js
index 1fd1407dd..a59607bf4 100644
--- a/public/react/src/common/SnackbarHOC.js
+++ b/public/react/src/common/SnackbarHOC.js
@@ -1,63 +1,72 @@
-import React, { Component } from 'react';
-import Snackbar from 'material-ui/Snackbar';
-import Fade from 'material-ui/transitions/Fade';
-
-export function SnackbarHOC(options = {}) {
- return function wrap(WrappedComponent) {
- return class Wrapper extends Component {
- constructor(props) {
- super(props);
- this.showSnackbar = this.showSnackbar.bind(this)
- this.state = {
- snackbarText: '',
- snackbarOpen: false,
- }
- }
-
- handleSnackbarClose() {
- this.setState({
- snackbarOpen: false,
- snackbarVertical: '',
- snackbarHorizontal: '',
- })
- }
-
- // 全局的snackbar this.props.showSnackbar调用即可
- showSnackbar(text, vertical, horizontal) {
- this.setState({
- snackbarOpen: true,
- snackbarText: text,
- snackbarVertical: vertical,
- snackbarHorizontal: horizontal,
- })
- }
- render() {
- const { snackbarOpen, snackbarText, snackbarHorizontal, snackbarVertical } = this.state;
-
-
- return (
-
- this.handleSnackbarClose()}
- transition={Fade}
- SnackbarContentProps={{
- 'aria-describedby': 'message-id',
- }}
- resumeHideDuration={2000}
- message={{this.state.snackbarText}}
- />
-
-
-
-
- )
- }
- }
- }
+import React, { Component } from 'react';
+import Snackbar from 'material-ui/Snackbar';
+import Fade from 'material-ui/transitions/Fade';
+import { notification } from 'antd'
+export function SnackbarHOC(options = {}) {
+ return function wrap(WrappedComponent) {
+ return class Wrapper extends Component {
+ constructor(props) {
+ super(props);
+ this.showSnackbar = this.showSnackbar.bind(this)
+ this.state = {
+ snackbarText: '',
+ snackbarOpen: false,
+ }
+ }
+
+ handleSnackbarClose() {
+ this.setState({
+ snackbarOpen: false,
+ snackbarVertical: '',
+ snackbarHorizontal: '',
+ })
+ }
+
+ // 全局的snackbar this.props.showSnackbar调用即可
+ showSnackbar(description, message = "提示",icon) {
+ // this.setState({
+ // snackbarOpen: true,
+ // snackbarText: text,
+ // snackbarVertical: vertical,
+ // snackbarHorizontal: horizontal,
+ // })
+ const data = {
+ message,
+ description
+ }
+ if (icon) {
+ data.icon = icon;
+ }
+ notification.open(data);
+ }
+
+ render() {
+ const { snackbarOpen, snackbarText, snackbarHorizontal, snackbarVertical } = this.state;
+
+
+ return (
+
+ this.handleSnackbarClose()}
+ transition={Fade}
+ SnackbarContentProps={{
+ 'aria-describedby': 'message-id',
+ }}
+ resumeHideDuration={2000}
+ message={{this.state.snackbarText}}
+ />
+
+
+
+
+ )
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js
index a2f57a8e1..6239f1b3d 100644
--- a/public/react/src/modules/courses/Resource/Fileslistitem.js
+++ b/public/react/src/modules/courses/Resource/Fileslistitem.js
@@ -26,7 +26,8 @@ class Fileslistitem extends Component{
})
this.props.Settingtypes(discussMessage.id)
}
- showfiles=()=>{
+ showfiles=(value)=>{
+
let {discussMessage,coursesId}=this.props
let file_id=discussMessage.id
let url="/files/"+file_id+"/histories.json"
@@ -35,12 +36,14 @@ class Fileslistitem extends Component{
course_id:coursesId
},
}).then((result)=>{
+
if(result.data.attachment_histories.length===0){
let link = document.createElement('a');
document.body.appendChild(link);
link.href = result.data.url;
- link.download = result.data.title;
+ console.log(filesname)
+ link.download = value;
//兼容火狐浏览器
let evt = document.createEvent("MouseEvents");
evt.initEvent("click", false, false);
@@ -203,25 +206,21 @@ class Fileslistitem extends Component{
{
this.props.isAdmin ? this.showfiles(discussMessage.title)}
title={discussMessage.title}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title} : ""
}
{
this.props.isStudent? this.showfiles(discussMessage.title)}
title={discussMessage.title}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title} :""
}
{
- this.props.isNotMember ? discussMessage.is_lock === true ?
+ this.props.isNotMember ?
{discussMessage.title}
- :
- {discussMessage.title} :""
+ :""
}
diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js
index 1ad136934..6501716b7 100644
--- a/public/react/src/modules/courses/Resource/index.js
+++ b/public/react/src/modules/courses/Resource/index.js
@@ -954,8 +954,8 @@ class Fileslists extends Component{
}
}
>
-