From 4a023f553d068b5a854e9d47447e57348d729568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 14:13:22 +0800 Subject: [PATCH 01/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/exercise/Studentshavecompletedthelist.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index a3ee9ef1a..f35e17ab7 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -760,7 +760,9 @@ class Studentshavecompletedthelist extends Component { {record.operating==="--"? {record.operating} - : + :record.submitstate === "未提交"? + -- + : {record.operating} } @@ -954,6 +956,9 @@ class Studentshavecompletedthelist extends Component { {record.finalscore==="--"? -- + :record.submitstate === "未提交"? + -- : {record.finalscore} @@ -1141,6 +1146,9 @@ class Studentshavecompletedthelist extends Component { {record.finalscore==="--"? -- + :record.submitstate === "未提交"? + -- : {record.finalscore} From 00053c02e356e1b84b3b26deac2fea742d819cf1 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 5 Jul 2019 14:30:51 +0800 Subject: [PATCH 02/39] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E3=80=81=E6=AF=95?= =?UTF-8?q?=E8=AE=BE=E9=80=89=E9=A2=98=E7=9B=B8=E5=85=B3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/graduation/topics/index.js | 2 +- .../courses/poll/PollDetailTabForth.js | 68 +++---------------- .../src/modules/courses/poll/PollListItem.js | 2 +- 3 files changed, 11 insertions(+), 61 deletions(-) diff --git a/public/react/src/modules/courses/graduation/topics/index.js b/public/react/src/modules/courses/graduation/topics/index.js index 391bcac18..8ed3118b9 100644 --- a/public/react/src/modules/courses/graduation/topics/index.js +++ b/public/react/src/modules/courses/graduation/topics/index.js @@ -352,8 +352,8 @@ onBoardsNew=()=>{ ( {/* 参考普通作业 - 题库选用 */} {/* this.useFromBank()}>题库选用 正式版没有,先隐藏*/} + < a href={`/api/courses/${this.props.match.params.coursesId}/graduation_topics/export.xlsx`} className={"fl color-blue mr30 font-16"}>导出

- < a href={`/api/courses/${this.props.match.params.coursesId}/graduation_topics/export.xlsx`} className={"color-blue mr20 font-16"}>导出 this.onBoardsNew()}>新建
):"" } diff --git a/public/react/src/modules/courses/poll/PollDetailTabForth.js b/public/react/src/modules/courses/poll/PollDetailTabForth.js index 3dff2bc87..e0cca8716 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabForth.js +++ b/public/react/src/modules/courses/poll/PollDetailTabForth.js @@ -187,56 +187,6 @@ class PollDetailTabForth extends Component{ } UnifiedSetting=()=>{ let { unit_e_tip , unit_p_tip , publish_time , end_time ,course_group }=this.state - // 如果两个时间都没有填写或者只选择了截止时间则先保存设置然后弹出立即发布弹框 - // if ( !publish_time ){ - // if(moment(end_time,dataformat)<=moment()){ - // this.setState({ - // unit_e_tip:"截止时间不能小于当前时间" - // }) - // }else{ - // this.setState({ - // unit_e_tip:"" - // }) - - // let list=[]; - // let pollId=this.props.match.params.pollId; - // let coursesId=this.props.match.params.coursesId; - // let url=`/courses/${coursesId}/polls/publish_modal.json`; - // axios.get(url,{ - // params:{ - // check_ids:[pollId] - // } - // }).then((response) => { - // if(response.data.course_info){ - // for(var i=0;i 0 ? 1 : 2, - // visible:true, - // Topval:"本操作只对“未发布”的对象生效", - // Botvalleft:"暂不发布", - // Botval:"则通过后续手动设置,定时发布", - // starttime:"发布时间:"+this.props.getNowFormatDates(1), - // endtime:"截止时间:" + moment(end_time || this.props.getNowFormatDates(2)).format(dataformat), - // Cancelname:"暂不发布", - // Savesname:"立即发布", - // Cancel:this.homeworkhide, - // Saves:this.homeworkstartend, - // publishCourse:list, - // publish_time:this.props.getNowFormatDates(1) - // }) - // } - // }).catch((error)=>{ - // console.log(error); - // }) - - // } - // } if( this.state.un_change_unified == false){ if ( !publish_time ){ this.setState({ @@ -275,16 +225,16 @@ class PollDetailTabForth extends Component{ unit_e_tip:"" }) } - this.commitSetting((result)=>{ - if(result.status==200){ - this.props.showNotification(`${result.data.message}`); - this.getSettingInfo(); - this.setState({ - flagPageEdit:false - }) - } - }) } + this.commitSetting((result)=>{ + if(result.status==200){ + this.props.showNotification(`${result.data.message}`); + this.getSettingInfo(); + this.setState({ + flagPageEdit:false + }) + } + }) } // 非统一设置提交 diff --git a/public/react/src/modules/courses/poll/PollListItem.js b/public/react/src/modules/courses/poll/PollListItem.js index 8c1d814ed..16770ce43 100644 --- a/public/react/src/modules/courses/poll/PollListItem.js +++ b/public/react/src/modules/courses/poll/PollListItem.js @@ -60,7 +60,7 @@ class PollListItem extends Component{ } { item.polls_status ==1 && item.publish_time ==null && item.created_at && - 创建于{moment(item.created_at).format(dataformat)} + 创建于{moment(item.created_at).fromNow()} } { item.polls_status ==1 && item.publish_time !=null && From d54294c600f2609baad0fc52fb600a15d877e7a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 14:33:08 +0800 Subject: [PATCH 03/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/poll/PollNew.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index 0316cd8fe..63143c59a 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -2763,7 +2763,17 @@ class PollNew extends Component { - : "" + : +
+ + this.deleteadddom(indexo)}>取消 + this.deleteadddomthree(indexo, itemo)}>保存 + this.deleteadddomtwo(indexo, itemo)}>保存并继续 + +
) : itemo.question.question_type === 3 ? From f04f6f7e5ebe47e1b519643e175fca75d71ce6f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 15:17:43 +0800 Subject: [PATCH 04/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/shixunHomework/Listofworks.js | 14 ++-- .../shixunHomework/ShixunStudentWork.js | 75 ++++++++++++++++++- 2 files changed, 79 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index d697694cb..17b9179d4 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -115,6 +115,7 @@ class Listofworks extends Component { key: 'name', align: 'center', className:'font-14', + width:'120px', render: (text, record) => ( {record.name} ) @@ -139,7 +140,7 @@ class Listofworks extends Component { dataIndex: 'classroom', align: 'center', className:'font-14', - width:'288px', + width:"260px", render: (text, record) => ( {record.classroom} ) @@ -239,9 +240,9 @@ class Listofworks extends Component {
: - + -- - + ) : ( {record.name} ) @@ -391,7 +393,7 @@ class Listofworks extends Component { dataIndex: 'classroom', align: 'center', className:'font-14', - width:'288px', + width:"260px", render: (text, record) => ( {record.classroom} ) @@ -491,9 +493,9 @@ class Listofworks extends Component { : - + -- - + ) : { + console.log("internshipreport"); + // var homeworkid = this.props.match.params.homeworkid; + // let url = "/zip/shixun_report"; + axios.get(url).then((response) => { + console.log("326"); + console.log(response); + if(response.data.status&&response.data.status===-1){ + + + }else if(response.data.status&&response.data.status===-2){ + + }else{ + window.open("/api"+url, '_blank'); + } + + }).catch((error) => { + console.log(error) + }); + } + + // 课堂学生成绩的导出下载 + Classstudentachievement = (url) => { + console.log("Classstudentachievement"); + // const course_id = this.props.match.params.coursesId; + // let url = "/courses/" + course_id + "/export_member_scores_excel.xlsx"; + axios.get(url).then((response) => { + console.log("1374"); + console.log(response); + if(response.data.status&&response.data.status===-1){ + }else if(response.data.status&&response.data.status===-2){ + + }else{ + window.open("/api"+url, '_blank'); + + } + }).catch((error) => { + console.log(error) + }); + } + render() { let { data, @@ -606,10 +648,35 @@ class ShixunStudentWork extends Component { 设置 - {this.props.isAdmin() ? 导出 : ""} + + {this.props.isAdmin() ?
  • + 导出 + +
  • : ""} {this.props.isAdmin()? data&&data.end_immediately===true? 立即截止 : "" : ""} From d6fe4bee4094f0c32000cbd1e285151491c2e553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 15:45:58 +0800 Subject: [PATCH 05/39] b --- public/react/src/modules/courses/shixunHomework/Listofworks.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 17b9179d4..09516a5f9 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1404,6 +1404,7 @@ class Listofworks extends Component { const name = decodeURI(response.headers['content-disposition'].split('=')[1]) console.log(response.headers['content-disposition'].split('=')[1]); console.log(name); + console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1])); downloadElement.href = href downloadElement.download = name document.body.appendChild(downloadElement) From 69eaf8ded9af5efdecf3d1217347a6797c31e5eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 5 Jul 2019 16:12:58 +0800 Subject: [PATCH 06/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/config/webpack.config.dev.js | 4 +- .../react/config/webpackDevServer.config.js | 190 ++++---- .../courses/exercise/Ecerciseallbackagain.js | 458 +++++++++--------- .../shixunHomework/ShixunWorkDetails.js | 11 +- 4 files changed, 331 insertions(+), 332 deletions(-) diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index 2fc1bbe64..11cfc1962 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/webpackDevServer.config.js b/public/react/config/webpackDevServer.config.js index 8e3d95c3d..0eb313cbe 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: false, + // 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/src/modules/courses/exercise/Ecerciseallbackagain.js b/public/react/src/modules/courses/exercise/Ecerciseallbackagain.js index f0a65a467..f593232d2 100644 --- a/public/react/src/modules/courses/exercise/Ecerciseallbackagain.js +++ b/public/react/src/modules/courses/exercise/Ecerciseallbackagain.js @@ -1,230 +1,230 @@ -import React,{ Component } from "react"; -import { Modal,Checkbox,notification} from "antd"; -import axios from 'axios'; - -class Ecerciseallbackagain extends Component{ - constructor(props){ - super(props); - this.state={ - data:undefined, - limit:10, - page:1, - datalist:undefined, - group_ids:undefined - } - } - componentDidMount() { - - let url="/exercises/"+this.props.match.params.Id+"/redo_modal.json"; - - axios.get(url,{params:{ - limit:10, - page:1, - } - }).then((response) => { - - this.setState({ - data:response.data, - datalist:response.data.exercise_users - }) - }).catch((error) => { - this.props.callback() - console.log(error) - }); - - - } - - //勾选实训 - shixunhomeworkedit=(checkedValues)=>{ - let{datalist}=this.state; - if(checkedValues.length===datalist.length){ - this.setState({ - onChangetype:true, - group_ids:checkedValues - }) - }else{ - this.setState({ - group_ids:checkedValues, - onChangetype:false - }) - } - } - - contentViewScroll=(e)=>{ - //滑动到底判断 - if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ - let {page,limit,datalist}=this.state; - let newpage=page+1; - let newdata=datalist; - - let url="/exercises/"+this.props.match.params.Id+"/redo_modal.json"; - - axios.get(url,{params:{ - limit:limit, - page:newpage, - } - }).then((response) => { - - response.data.exercise_users.map((item,key)=>{ - newdata.push(item) - }) - this.setState({ - datalist:newdata, - page:newpage - }) - }).catch((error) => { - console.log(error) - }); - - } - } - - onChange=(e)=>{ - let{datalist}=this.state; - if(e.target.checked===true){ - let id=[] - datalist.map((item,key)=>{ - id.push(item.user_id) - }) - - this.setState({ - group_ids:id, - onChangetype:e.target.checked - }) - }else{ - this.setState({ - group_ids:[], - onChangetype:e.target.checked - }) - } - } - - isSave=()=>{ - let{group_ids}=this.state; - if(group_ids===undefined||group_ids.length===0){ - notification.open({ - message:"提示", - description:"请先选择学生" - }); - return - } - let url="/exercises/"+this.props.match.params.Id+"/redo_exercise.json"; - axios.post(url, { - user_ids: group_ids, - }) - .then((response) => { - if (response.data.status === 0) { - this.props.callback(1) - notification.open({ - message:"提示", - description:response.data.message - }); - } - // else if(response.data.status === -1){ - // notification.open({ - // message: '参数错误', - // }); - // }else if(response.data.status === -2){ - // notification.open({ - // message: '当前作业不支持查重', - // }); - // }else if(response.data.status === -3){ - // notification.open({ - // message: '正在查重中', - // }); - // }else if(response.data.status === -4){ - // notification.open({ - // message: '查重异常', - // }); - // } - }) - .catch(function (error) { - console.log(error); - }); - } - - issCancel=()=>{ - this.props.callback() - } - - render(){ - let {datalist,group_ids,onChangetype}=this.state; - - console.log() - return( -
    - -
    - - -
    学生(仅限“提交中”)将得到一次重新答题的机会,现有的答题情况将被清空
    -
      -
    • 姓名
    • -
    • 学号
    • -
    • 成绩
    • -
    - - {datalist===undefined?"": -
      - - - { datalist.map((item,key)=>{ - return( -
      -
    • - - - -
    • -
    • - {item.student_id} -
    • -
    • - {item.user_score} -
    • -
      - ) - })} - -
      -
    - } - -
    - {onChangetype===true?"清除":"全选"} -
    - -
    - 取消 - 确认 -
    - -
    -
    -
    - ) - } -} +import React,{ Component } from "react"; +import { Modal,Checkbox,notification} from "antd"; +import axios from 'axios'; + +class Ecerciseallbackagain extends Component{ + constructor(props){ + super(props); + this.state={ + data:undefined, + limit:10, + page:1, + datalist:undefined, + group_ids:undefined + } + } + componentDidMount() { + + let url="/exercises/"+this.props.match.params.Id+"/redo_modal.json"; + + axios.get(url,{params:{ + limit:10, + page:1, + } + }).then((response) => { + + this.setState({ + data:response.data, + datalist:response.data.exercise_users + }) + }).catch((error) => { + this.props.callback() + console.log(error) + }); + + + } + + //勾选实训 + shixunhomeworkedit=(checkedValues)=>{ + let{datalist}=this.state; + if(checkedValues.length===datalist.length){ + this.setState({ + onChangetype:true, + group_ids:checkedValues + }) + }else{ + this.setState({ + group_ids:checkedValues, + onChangetype:false + }) + } + } + + contentViewScroll=(e)=>{ + //滑动到底判断 + if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ + let {page,limit,datalist}=this.state; + let newpage=page+1; + let newdata=datalist; + + let url="/exercises/"+this.props.match.params.Id+"/redo_modal.json"; + + axios.get(url,{params:{ + limit:limit, + page:newpage, + } + }).then((response) => { + + response.data.exercise_users.map((item,key)=>{ + newdata.push(item) + }) + this.setState({ + datalist:newdata, + page:newpage + }) + }).catch((error) => { + console.log(error) + }); + + } + } + + onChange=(e)=>{ + let{datalist}=this.state; + if(e.target.checked===true){ + let id=[] + datalist.map((item,key)=>{ + id.push(item.user_id) + }) + + this.setState({ + group_ids:id, + onChangetype:e.target.checked + }) + }else{ + this.setState({ + group_ids:[], + onChangetype:e.target.checked + }) + } + } + + isSave=()=>{ + let{group_ids}=this.state; + if(group_ids===undefined||group_ids.length===0){ + notification.open({ + message:"提示", + description:"请先选择学生" + }); + return + } + let url="/exercises/"+this.props.match.params.Id+"/redo_exercise.json"; + axios.post(url, { + user_ids: group_ids, + }) + .then((response) => { + if (response.data.status === 0) { + this.props.callback(1) + notification.open({ + message:"提示", + description:response.data.message + }); + } + // else if(response.data.status === -1){ + // notification.open({ + // message: '参数错误', + // }); + // }else if(response.data.status === -2){ + // notification.open({ + // message: '当前作业不支持查重', + // }); + // }else if(response.data.status === -3){ + // notification.open({ + // message: '正在查重中', + // }); + // }else if(response.data.status === -4){ + // notification.open({ + // message: '查重异常', + // }); + // } + }) + .catch(function (error) { + console.log(error); + }); + } + + issCancel=()=>{ + this.props.callback() + } + + render(){ + let {datalist,group_ids,onChangetype}=this.state; + + console.log() + return( +
    + +
    + + +
    学生将得到一次重新答题的机会,现有的答题情况将被清空
    +
      +
    • 姓名
    • +
    • 学号
    • +
    • 成绩
    • +
    + + {datalist===undefined?"": +
      + + + { datalist.map((item,key)=>{ + return( +
      +
    • + + + +
    • +
    • + {item.student_id} +
    • +
    • + {item.user_score} +
    • +
      + ) + })} + +
      +
    + } + +
    + {onChangetype===true?"清除":"全选"} +
    + +
    + 取消 + 确认 +
    + +
    +
    +
    + ) + } +} export default Ecerciseallbackagain; \ No newline at end of file diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js index 205fbd9e7..4cfdccab0 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js @@ -63,8 +63,9 @@ class ShixunWorkDetails extends Component { render() { let{data}=this.state; return ( - - {data===undefined? "":
    + +
    + {data===undefined? "":
    @@ -111,11 +112,9 @@ class ShixunWorkDetails extends Component { />
    - - -
    -
    } + } +
    ) } From 5ff50a1a34466a0b274bb66118455cfd03567581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 5 Jul 2019 16:32:09 +0800 Subject: [PATCH 07/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/config/webpack.config.prod.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/config/webpack.config.prod.js b/public/react/config/webpack.config.prod.js index a69eff349..0d5ef2747 100644 --- a/public/react/config/webpack.config.prod.js +++ b/public/react/config/webpack.config.prod.js @@ -58,8 +58,8 @@ 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 ? '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], output: { From 6e47803988303b1a8c98ce141a680af11e753024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 16:59:31 +0800 Subject: [PATCH 08/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/shixunHomework/Listofworks.js | 2 +- .../courses/shixunHomework/Listofworksstudentone.js | 2 +- public/react/src/modules/login/LoginDialog.js | 11 +++++++---- public/react/src/modules/tpm/NewHeader.js | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 09516a5f9..37ad51216 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1515,7 +1515,7 @@ class Listofworks extends Component { typelist={teacherdata === undefined ? [""] : teacherdata.homework_status} /> 返回 + href={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${jobsettingsdata === undefined ? "" : jobsettingsdata.data.category.category_id===undefined?"": jobsettingsdata.data.category.category_id}`}>返回 实训详情 diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index ed87ecc0d..4e9cb3e00 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -1005,7 +1005,7 @@ class Listofworksstudentone extends Component { > {jobsettingsdata === undefined ? "" : jobsettingsdata.data.category.category_name} + to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${jobsettingsdata === undefined ? "" : jobsettingsdata.data.category.category_id === undefined ? "" : jobsettingsdata.data.category.category_id}`}>{jobsettingsdata === undefined ? "" : jobsettingsdata.data.category.category_name} > 作业详情

    diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js index 9bcd35a1d..36a9530b9 100644 --- a/public/react/src/modules/login/LoginDialog.js +++ b/public/react/src/modules/login/LoginDialog.js @@ -317,10 +317,13 @@ class LoginDialog extends Component { }); } handleDialogClose() { - this.setState({ - isRender: false - }) - // window.location.href="/"; + if(this.props.match.path==="/"){ + this.setState({ + isRender: false + }) + }else{ + window.location.href="/"; + } } loginEDU=()=>{ diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 251f608ca..e31603f3c 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -613,6 +613,7 @@ submittojoinclass=(value)=>{ {/* isRender&& isRender === true?*/} {/* :""*/} {/*}*/} From d9ed04f79922a0688779d09142d01c2b98a7d447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 5 Jul 2019 17:01:37 +0800 Subject: [PATCH 09/39] b --- public/react/config/webpack.config.prod.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/config/webpack.config.prod.js b/public/react/config/webpack.config.prod.js index 0d5ef2747..0abd707af 100644 --- a/public/react/config/webpack.config.prod.js +++ b/public/react/config/webpack.config.prod.js @@ -58,8 +58,8 @@ 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 ? '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], output: { From b99cc427810f1158397a299ae0b751025160951b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 5 Jul 2019 17:20:27 +0800 Subject: [PATCH 10/39] =?UTF-8?q?=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/Resource/Fileslistitem.js | 8 ++------ .../src/modules/courses/exercise/ExerciseListItem.js | 6 ++---- .../courses/graduation/tasks/GraduateTaskItem.js | 7 ++----- .../courses/graduation/topics/GraduateTopicItem.js | 10 ++++++---- .../courses/shixunHomework/ShixunhomeWorkItem.js | 6 ++---- 5 files changed, 14 insertions(+), 23 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index a2f57a8e1..404214dfc 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -215,13 +215,9 @@ class Fileslistitem extends Component{ } { - this.props.isNotMember ? discussMessage.is_lock === true ? + this.props.isNotMember ? {discussMessage.title} - : - {discussMessage.title} :"" + :"" } diff --git a/public/react/src/modules/courses/exercise/ExerciseListItem.js b/public/react/src/modules/courses/exercise/ExerciseListItem.js index f11509fc8..8ffd16937 100644 --- a/public/react/src/modules/courses/exercise/ExerciseListItem.js +++ b/public/react/src/modules/courses/exercise/ExerciseListItem.js @@ -107,11 +107,9 @@ class ExerciseListItem extends Component{ } { - this.props.isNotMember()? item.lock_status === 0 ? + this.props.isNotMember()? {item.exercise_name} - : - - {item.exercise_name}:"" + :"" } { diff --git a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js index f66874330..10ce65436 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js @@ -229,12 +229,9 @@ class GraduateTaskItem extends Component{ } { - this.props.isNotMember?this.props.discussMessage.private_icon===true? + this.props.isNotMember? {discussMessage.name} - : - {discussMessage.name}:"" + :"" } diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js index c5130d299..9f61e69d4 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js @@ -70,15 +70,17 @@ class GraduateTopicItem extends Component{ `}
    { - isNotMember && discussMessage.private_icon===true ? - {discussMessage.name}: - this.toDetailPage(`${discussMessage.id}`)} className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name} + isNotMember? + {discussMessage.name}:"" + } { isStudent? this.toDetailPage(`${discussMessage.id}`)} className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}:"" } - + { + isAdmin? this.toDetailPage(`${discussMessage.id}`)} className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}:"" + } { discussMessage.private_icon===true? diff --git a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js index d6c96182b..06f22c87e 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js @@ -304,11 +304,9 @@ class ShixunhomeWorkItem extends Component{ } { - this.props.isNotMember?this.props.discussMessage.private_icon===true? + this.props.isNotMember? {discussMessage.name} - : - {discussMessage.name}:"" + : "" } From 05516fdff4d573862d26d14bc3a549e481df3415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 5 Jul 2019 17:23:27 +0800 Subject: [PATCH 11/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/shixunHomework/ShixunhomeWorkItem.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js index d6c96182b..3a2366848 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js @@ -304,11 +304,9 @@ class ShixunhomeWorkItem extends Component{ } { - this.props.isNotMember?this.props.discussMessage.private_icon===true? + this.props.isNotMember? {discussMessage.name} - : - {discussMessage.name}:"" + :"" } From 9f16821756f13f29fde68aed51a5506f5d408672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 5 Jul 2019 17:38:04 +0800 Subject: [PATCH 12/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shixunHomework/ShixunStudentWork.js | 59 ++++++++++++------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js index 3171349a0..109988fa9 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js @@ -21,7 +21,8 @@ import { DatePicker, Radio, Tooltip, - notification + notification, + Pagination } from "antd"; import {Link, Switch, Route, Redirect} from 'react-router-dom'; import axios from 'axios'; @@ -89,11 +90,22 @@ class ShixunStudentWork extends Component { }) } - getupdata=()=>{ + getupdata=(pages)=>{ + let {order,b_order,page,limit,group_infolist,search}=this.state; var homeworkid = this.props.match.params.homeworkid; let url = "/homework_commons/" + homeworkid + "/code_review_results.json"; - axios.get(url).then((response) => { + axios.get(url,{params:{ + order:order, + sort:b_order, + page:pages===undefined?page:pages, + limit:limit, + group_ids:group_infolist, + search:search + }, + paramsSerializer: function(params) { + return qs.stringify(params, {arrayFormat: 'brackets'}) + }}).then((response) => { if (response.data.status === undefined || response.data.status === 0) { if(response.data!=undefined){ if(response.data.status!=-2){ @@ -198,12 +210,12 @@ class ShixunStudentWork extends Component { } - TablePagination = (e) => { + TablePagination = (pages) => { this.setState({ - page:e.current + page:pages }) - + this.getupdata(pages) } inputSearchValue=(e)=>{ @@ -818,30 +830,33 @@ class ShixunStudentWork extends Component {
    + + .ant-spin-nested-loading > div > .ant-spin .ant-spin-dot { + top: 72%;} + } + `} {datalist === undefined ? "" : } - + :""} + + + { + datalist === undefined ? "":datalist.length<11? +
    + +
    + : "" + } - - - - + From 6f6e4e4eaf3f0214b826783d8c11cf5bf1fbb703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 18:09:31 +0800 Subject: [PATCH 13/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/shixunHomework/Listofworks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 37ad51216..c866f7592 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1336,7 +1336,7 @@ class Listofworks extends Component { }); } - + myBase64 // 导出实习报告批量 internshipreport = (url)=>{ console.log("internshipreport"); @@ -1366,7 +1366,7 @@ class Listofworks extends Component { //后台再header中传文件名 const name = decodeURI(response.headers['content-disposition'].split('=')[1]) downloadElement.href = href - downloadElement.download = name + // downloadElement.download = name document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 From dec937c5730504de4a460507a36c6fa1229ba999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 18:13:51 +0800 Subject: [PATCH 14/39] b --- public/react/src/modules/courses/shixunHomework/Listofworks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index c866f7592..b04692b44 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1406,7 +1406,7 @@ class Listofworks extends Component { console.log(name); console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1])); downloadElement.href = href - downloadElement.download = name + // downloadElement.download = name document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 From f4fd535e2a8bc8036629d505f84e5b886421d74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 18:15:59 +0800 Subject: [PATCH 15/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/shixunHomework/Listofworks.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index b04692b44..b5e5b5e35 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1336,7 +1336,9 @@ class Listofworks extends Component { }); } - myBase64 + myBase64(){ + + } // 导出实习报告批量 internshipreport = (url)=>{ console.log("internshipreport"); From 0014df024882f34a976f4d5ebb85a9261956ee95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 18:26:08 +0800 Subject: [PATCH 16/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/shixunHomework/Listofworks.js | 10 +- .../modules/courses/shixunHomework/base64.js | 103 ++++++++++++++++++ 2 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 public/react/src/modules/courses/shixunHomework/base64.js diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index b5e5b5e35..2df71929c 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -32,7 +32,7 @@ import moment from 'moment'; import 'moment/locale/zh-cn'; import {getImageUrl, toPath} from 'educoder'; import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; - +import Base64 from './base64' const Search = Input.Search; const RadioGroup = Radio.Group; const CheckboxGroup = Checkbox.Group; @@ -1336,8 +1336,11 @@ class Listofworks extends Component { }); } - myBase64(){ - + myBase64(strinb){ + var base = new Base64(); + var result2 = base.decode(strinb); + console.log("解密后的值")//解密后的值 + console.log(result2)//解密后的值 } // 导出实习报告批量 internshipreport = (url)=>{ @@ -1409,6 +1412,7 @@ class Listofworks extends Component { console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1])); downloadElement.href = href // downloadElement.download = name + this.myBase64(response.headers['content-disposition'].split('=')[1]); document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 diff --git a/public/react/src/modules/courses/shixunHomework/base64.js b/public/react/src/modules/courses/shixunHomework/base64.js new file mode 100644 index 000000000..4494a50e3 --- /dev/null +++ b/public/react/src/modules/courses/shixunHomework/base64.js @@ -0,0 +1,103 @@ +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 From 0681e86684078245e463af8dab1d5268503a38fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 20:17:31 +0800 Subject: [PATCH 17/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/shixunHomework/Listofworks.js | 1 - .../modules/courses/shixunHomework/base64.js | 103 ------------------ 2 files changed, 104 deletions(-) delete mode 100644 public/react/src/modules/courses/shixunHomework/base64.js diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 2df71929c..040ef24a1 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1412,7 +1412,6 @@ class Listofworks extends Component { console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1])); downloadElement.href = href // downloadElement.download = name - this.myBase64(response.headers['content-disposition'].split('=')[1]); document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 diff --git a/public/react/src/modules/courses/shixunHomework/base64.js b/public/react/src/modules/courses/shixunHomework/base64.js deleted file mode 100644 index 4494a50e3..000000000 --- a/public/react/src/modules/courses/shixunHomework/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 From 69a74a86c46a964a49bff718dc255d3e5e033c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 20:19:16 +0800 Subject: [PATCH 18/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/shixunHomework/Listofworks.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 040ef24a1..f895d5938 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1336,12 +1336,7 @@ class Listofworks extends Component { }); } - myBase64(strinb){ - var base = new Base64(); - var result2 = base.decode(strinb); - console.log("解密后的值")//解密后的值 - console.log(result2)//解密后的值 - } + // 导出实习报告批量 internshipreport = (url)=>{ console.log("internshipreport"); From 2b82b1cea155d17729cade645fc4bc6c863712f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 20:29:25 +0800 Subject: [PATCH 19/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/package.json | 2 + .../public/js/jsFromMiddleLayer/base64.js | 103 ------------------ .../courses/shixunHomework/Listofworks.js | 5 +- 3 files changed, 6 insertions(+), 104 deletions(-) delete mode 100755 public/react/public/js/jsFromMiddleLayer/base64.js 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/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index f895d5938..017ca3008 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -4,6 +4,7 @@ import {WordsBtn, ActionBtn} from 'educoder'; import TraineetraininginformationModal from './TraineetraininginformationModal'; import ModulationModal from "../coursesPublic/ModulationModal"; import HomeworkModal from "../coursesPublic/HomeworkModal"; +import Base64 from 'js-base64'; import { Form, Select, @@ -32,7 +33,6 @@ import moment from 'moment'; import 'moment/locale/zh-cn'; import {getImageUrl, toPath} from 'educoder'; import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; -import Base64 from './base64' const Search = Input.Search; const RadioGroup = Radio.Group; const CheckboxGroup = Checkbox.Group; @@ -1405,8 +1405,11 @@ class Listofworks extends Component { console.log(response.headers['content-disposition'].split('=')[1]); console.log(name); console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1])); + console.log("1409"); + console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); downloadElement.href = href // downloadElement.download = name + document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 From 22c89ddfc33243b01dfb4b728dc025c92ea9c9a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 20:29:59 +0800 Subject: [PATCH 20/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/shixunHomework/Listofworks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 017ca3008..893747da6 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -4,7 +4,7 @@ import {WordsBtn, ActionBtn} from 'educoder'; import TraineetraininginformationModal from './TraineetraininginformationModal'; import ModulationModal from "../coursesPublic/ModulationModal"; import HomeworkModal from "../coursesPublic/HomeworkModal"; -import Base64 from 'js-base64'; +import {Base64} from 'js-base64'; import { Form, Select, From 5bdc740aa6dc70779bd10ebdd7969354b390fba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 21:51:52 +0800 Subject: [PATCH 21/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/Resource/Fileslistitem.js | 4 ++- .../courses/shixunHomework/Listofworks.js | 30 ++++++++++++++----- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 404214dfc..0ce4fba46 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -27,6 +27,7 @@ class Fileslistitem extends Component{ this.props.Settingtypes(discussMessage.id) } showfiles=()=>{ + debugger let {discussMessage,coursesId}=this.props let file_id=discussMessage.id let url="/files/"+file_id+"/histories.json" @@ -35,12 +36,13 @@ 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; + link.download = ''; //兼容火狐浏览器 let evt = document.createEvent("MouseEvents"); evt.initEvent("click", false, false); diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 893747da6..c3604f314 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1359,14 +1359,16 @@ class Listofworks extends Component { }else{ // window.location.href("/api"+url); console.log("开始下载zip文件") - const type='application/zip'//ZIP文件 + // const type='application/zip'//ZIP文件 + const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件 + const blob = new Blob([response.data], { type: type }) const downloadElement = document.createElement('a') const href = window.URL.createObjectURL(blob) //后台再header中传文件名 const name = decodeURI(response.headers['content-disposition'].split('=')[1]) downloadElement.href = href - // downloadElement.download = name + downloadElement.download = '' document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 @@ -1387,6 +1389,12 @@ class Listofworks extends Component { // search: this.state.searchtext, // } // },{responseType: 'blob'}) + // 56S+5Yy65a+85biIX+iuoeeul+aAnee7tOWvvOiuujIwMTnmmKXlraPor77l,oIJfUHl0aG9u5a6e546w6YCJ5oup,.xls + // console.log(decodeURIComponent("b178a6c387c1dd2d4097b0dcaa19a043_1562205834")); + // console.log(decodeURI("b178a6c387c1dd2d4097b0dcaa19a043_1562205834")); + // console.log(Base64.decode("b178a6c387c1dd2d4097b0dcaa19a043_1562205834")); + // console.log(Base64.decode("56S-5Yy65a-85biIX-iuoeeul-aAnee7tOWvvOiuujIwMTnmmKXlraPor77loIJfUHl0aG9u5a6e546w6YCJ5oup")); + axios.get((url),{responseType: 'blob'}).then((response) => { console.log("1374"); console.log(response); @@ -1401,14 +1409,18 @@ class Listofworks extends Component { const downloadElement = document.createElement('a') const href = window.URL.createObjectURL(blob) //后台再header中传文件名 - const name = decodeURI(response.headers['content-disposition'].split('=')[1]) + // const name = decodeURI(response.headers['content-disposition'].split('=')[1]) console.log(response.headers['content-disposition'].split('=')[1]); - console.log(name); - console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1])); - console.log("1409"); + // console.log(name); + // console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1])); + console.log("1409"); console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); + const string = response.headers['content-disposition'].split('=')[1]; + var index=string.lastIndexOf("\."); + const name=obj.substring(0,index); + console.log(Base64.decode(name)); downloadElement.href = href - // downloadElement.download = name + downloadElement.download = Base64.decode(name)+".xlsx"; document.body.appendChild(downloadElement) downloadElement.click() @@ -1569,8 +1581,10 @@ class Listofworks extends Component { {this.props.isAdmin()?
  • 导出
  • :""} {this.props.isAdmin() ? From dfc6d44ae8bd2764363d1991c3c30c2741ea21a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 21:56:57 +0800 Subject: [PATCH 22/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/shixunHomework/Listofworks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index c3604f314..396995b78 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1417,7 +1417,7 @@ class Listofworks extends Component { console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); const string = response.headers['content-disposition'].split('=')[1]; var index=string.lastIndexOf("\."); - const name=obj.substring(0,index); + const name=string.substring(0,index); console.log(Base64.decode(name)); downloadElement.href = href downloadElement.download = Base64.decode(name)+".xlsx"; From c4df994aa2334898d644c2c5124945e5069bce74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 22:13:39 +0800 Subject: [PATCH 23/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/shixunHomework/Listofworks.js | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 396995b78..2983b80a4 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1359,16 +1359,15 @@ class Listofworks extends Component { }else{ // window.location.href("/api"+url); console.log("开始下载zip文件") - // const type='application/zip'//ZIP文件 - const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件 - + const type='application/zip'//ZIP文件 const blob = new Blob([response.data], { type: type }) const downloadElement = document.createElement('a') const href = window.URL.createObjectURL(blob) //后台再header中传文件名 - const name = decodeURI(response.headers['content-disposition'].split('=')[1]) + console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); + const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); downloadElement.href = href - downloadElement.download = '' + downloadElement.download = string+".zip" document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 @@ -1410,18 +1409,14 @@ class Listofworks extends Component { const href = window.URL.createObjectURL(blob) //后台再header中传文件名 // const name = decodeURI(response.headers['content-disposition'].split('=')[1]) - console.log(response.headers['content-disposition'].split('=')[1]); + // console.log(response.headers['content-disposition'].split('=')[1]); // console.log(name); // console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1])); - console.log("1409"); + console.log("1409"); console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); - const string = response.headers['content-disposition'].split('=')[1]; - var index=string.lastIndexOf("\."); - const name=string.substring(0,index); - console.log(Base64.decode(name)); + const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); downloadElement.href = href - downloadElement.download = Base64.decode(name)+".xlsx"; - + downloadElement.download =string+".xlsx"; document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 @@ -1581,8 +1576,7 @@ class Listofworks extends Component { {this.props.isAdmin()?
  • 导出 From af12d95753a60f1e23620eeca0332d09b6cb7307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 22:59:00 +0800 Subject: [PATCH 24/39] b --- .../src/modules/courses/shixunHomework/Listofworks.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 2983b80a4..f06acf8ec 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1415,8 +1415,17 @@ class Listofworks extends Component { console.log("1409"); console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); + var now=""; + try { + now = moment().year()+moment().month()+moment().date(); + console.log("1422"); + console.log(now); + + } catch (e) { + console.log("1432"); + } downloadElement.href = href - downloadElement.download =string+".xlsx"; + downloadElement.download =string+now+".xlsx"; document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 From 3e6d9bb0a12a304314bbb89b696bc2694e35b86e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 23:10:50 +0800 Subject: [PATCH 25/39] b --- .../courses/shixunHomework/Listofworks.js | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index f06acf8ec..ca1bcc1a0 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1351,10 +1351,10 @@ class Listofworks extends Component { axios.get((url),{responseType: 'blob'}).then((response) => { console.log("1350"); console.log(response); - if(response.data.status&&response.data.status===-1){ + if(response.status&&response.status===-1){ - }else if(response.data.status&&response.data.status===-2){ + }else if(response.status&&response.status===-2){ }else{ // window.location.href("/api"+url); @@ -1367,7 +1367,16 @@ class Listofworks extends Component { console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); downloadElement.href = href - downloadElement.download = string+".zip" + var now=""; + try { + now = moment().year()+""+moment().month()+""+moment().date(); + console.log("1422"); + console.log(now); + + } catch (e) { + console.log("1432"); + } + downloadElement.download = string+now+".zip" document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 @@ -1397,10 +1406,10 @@ class Listofworks extends Component { axios.get((url),{responseType: 'blob'}).then((response) => { console.log("1374"); console.log(response); - if(response.data.status&&response.data.status===-1){ + if(response.status&&response.status===-1){ - }else if(response.data.status&&response.data.status===-2){ + }else if(response.status&&response.status===-2){ }else{ const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件 @@ -1417,7 +1426,7 @@ class Listofworks extends Component { const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); var now=""; try { - now = moment().year()+moment().month()+moment().date(); + now = moment().year()+""+moment().month()+""+moment().date(); console.log("1422"); console.log(now); From 3dad6096e59ea3e659ea005ab13aa715315aea20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 23:28:41 +0800 Subject: [PATCH 26/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/shixunHomework/Listofworks.js | 4 ++-- .../src/modules/courses/shixunHomework/shixunHomework.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index ca1bcc1a0..4e0497a24 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1369,7 +1369,7 @@ class Listofworks extends Component { downloadElement.href = href var now=""; try { - now = moment().year()+""+moment().month()+""+moment().date(); + now = moment().year()+""+moment().month()+""+moment().date()+""+moment().hour()+""+moment().minute()+""+moment().second(); console.log("1422"); console.log(now); @@ -1426,7 +1426,7 @@ class Listofworks extends Component { const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); var now=""; try { - now = moment().year()+""+moment().month()+""+moment().date(); + now = moment().year()+""+moment().month()+""+moment().date()+""+moment().hour()+""+moment().minute()+""+moment().second(); console.log("1422"); console.log(now); diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index 9bf0d12a4..42f5fbf6a 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -1132,7 +1132,7 @@ class ShixunHomework extends Component{ {course_modules&&course_modules.main_category.map((item,key)=>{ return( - datas&&datas.category_id===null?"":
  • this.moveTos(item.main_category_id)}>{item.main_category_name}
  • :"" + datas&&datas.category_id===null?"":
  • this.moveTos(item.main_category_id)}>{item.main_category_name}
  • ) })} From 6e10c1c123d2f0e4963f3ce8f582ebf79af29531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 23:42:01 +0800 Subject: [PATCH 27/39] b --- .../react/src/modules/courses/shixunHomework/Listofworks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 4e0497a24..2ce92df78 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1369,7 +1369,7 @@ class Listofworks extends Component { downloadElement.href = href var now=""; try { - now = moment().year()+""+moment().month()+""+moment().date()+""+moment().hour()+""+moment().minute()+""+moment().second(); + now = moment().year()+""+moment().month()+1+""+moment().date()+""+moment().hour()+""+moment().minute()+"" console.log("1422"); console.log(now); @@ -1426,7 +1426,7 @@ class Listofworks extends Component { const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); var now=""; try { - now = moment().year()+""+moment().month()+""+moment().date()+""+moment().hour()+""+moment().minute()+""+moment().second(); + now = moment().year()+""+moment().month()+1+""+moment().date()+""+moment().hour()+""+moment().minute()+"" console.log("1422"); console.log(now); From 680be1bf0a96474ae7e49a4ac5332144ef762b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 6 Jul 2019 00:00:34 +0800 Subject: [PATCH 28/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/shixunHomework/Listofworks.js | 34 +++---------- .../shixunHomework/ShixunStudentWork.js | 46 ++++++++++++++++- .../shixunHomework/ShixunWorkReport.js | 45 +++++++++++++++-- .../shixunHomework/Trainingjobsetting.js | 47 +++++++++++++++++- .../shixunHomework/Workquestionandanswer.js | 49 +++++++++++++++++-- 5 files changed, 184 insertions(+), 37 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 2ce92df78..db008e2c4 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1358,23 +1358,22 @@ class Listofworks extends Component { }else{ // window.location.href("/api"+url); - console.log("开始下载zip文件") + // console.log("开始下载zip文件") const type='application/zip'//ZIP文件 const blob = new Blob([response.data], { type: type }) const downloadElement = document.createElement('a') const href = window.URL.createObjectURL(blob) //后台再header中传文件名 - console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); + // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); downloadElement.href = href var now=""; try { - now = moment().year()+""+moment().month()+1+""+moment().date()+""+moment().hour()+""+moment().minute()+"" - console.log("1422"); + now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+"" console.log(now); } catch (e) { - console.log("1432"); + console.log("1376"); } downloadElement.download = string+now+".zip" document.body.appendChild(downloadElement) @@ -1389,20 +1388,6 @@ class Listofworks extends Component { // 课堂学生成绩的导出下载 Classstudentachievement=(url)=>{ console.log("Classstudentachievement"); - // const course_id = this.props.match.params.coursesId; - // let url = "/courses/"+course_id+"/export_member_scores_excel.xlsx"; - // ,{ - // params: { - // group_id: this.state.checkedValuesineinfo, - // search: this.state.searchtext, - // } - // },{responseType: 'blob'}) - // 56S+5Yy65a+85biIX+iuoeeul+aAnee7tOWvvOiuujIwMTnmmKXlraPor77l,oIJfUHl0aG9u5a6e546w6YCJ5oup,.xls - // console.log(decodeURIComponent("b178a6c387c1dd2d4097b0dcaa19a043_1562205834")); - // console.log(decodeURI("b178a6c387c1dd2d4097b0dcaa19a043_1562205834")); - // console.log(Base64.decode("b178a6c387c1dd2d4097b0dcaa19a043_1562205834")); - // console.log(Base64.decode("56S-5Yy65a-85biIX-iuoeeul-aAnee7tOWvvOiuujIwMTnmmKXlraPor77loIJfUHl0aG9u5a6e546w6YCJ5oup")); - axios.get((url),{responseType: 'blob'}).then((response) => { console.log("1374"); console.log(response); @@ -1417,16 +1402,12 @@ class Listofworks extends Component { const downloadElement = document.createElement('a') const href = window.URL.createObjectURL(blob) //后台再header中传文件名 - // const name = decodeURI(response.headers['content-disposition'].split('=')[1]) - // console.log(response.headers['content-disposition'].split('=')[1]); - // console.log(name); - // console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1])); - console.log("1409"); - console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); + // console.log("1409"); + // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); var now=""; try { - now = moment().year()+""+moment().month()+1+""+moment().date()+""+moment().hour()+""+moment().minute()+"" + now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+"" console.log("1422"); console.log(now); @@ -1439,7 +1420,6 @@ class Listofworks extends Component { downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 window.URL.revokeObjectURL(href) // 释放掉blob对象 - } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js index 109988fa9..5744c8ffe 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js @@ -469,7 +469,27 @@ class ShixunStudentWork extends Component { }else if(response.data.status&&response.data.status===-2){ }else{ - window.open("/api"+url, '_blank'); + const type='application/zip'//ZIP文件 + const blob = new Blob([response.data], { type: type }) + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) + //后台再header中传文件名 + // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); + const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); + downloadElement.href = href + var now=""; + try { + now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+"" + console.log(now); + + } catch (e) { + console.log("1376"); + } + downloadElement.download = string+now+".zip" + document.body.appendChild(downloadElement) + downloadElement.click() + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放掉blob对象 } }).catch((error) => { @@ -491,7 +511,29 @@ class ShixunStudentWork extends Component { }else if(response.data.status&&response.data.status===-2){ }else{ - window.open("/api"+url, '_blank'); + const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件 + const blob = new Blob([response.data], { type: type }) + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) + //后台再header中传文件名 + // console.log("1409"); + // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); + const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); + var now=""; + try { + now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+"" + console.log("1422"); + console.log(now); + + } catch (e) { + console.log("1432"); + } + downloadElement.href = href + downloadElement.download =string+now+".xlsx"; + document.body.appendChild(downloadElement) + downloadElement.click() + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放掉blob对象 } }).catch((error) => { diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index d120ec5ad..e8a42bdae 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -17,6 +17,7 @@ import '../css/members.css'; import "../common/formCommon.css"; import '../css/Courses.css'; import './style.css'; +import moment from "./Trainingjobsetting"; class ShixunWorkReport extends Component { @@ -28,7 +29,47 @@ class ShixunWorkReport extends Component { spinning:true } } + // 导出实习报告批量 + internshipreport = (url) => { + console.log("internshipreport"); + // var homeworkid = this.props.match.params.homeworkid; + // let url = "/zip/shixun_report"; + axios.get(url).then((response) => { + console.log("326"); + console.log(response); + if(response.data.status&&response.data.status===-1){ + + }else if(response.data.status&&response.data.status===-2){ + + }else{ + const type='application/zip'//ZIP文件 + const blob = new Blob([response.data], { type: type }) + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) + //后台再header中传文件名 + // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); + const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); + downloadElement.href = href + var now=""; + try { + now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+"" + console.log(now); + + } catch (e) { + console.log("1376"); + } + downloadElement.download = string+now+".zip" + document.body.appendChild(downloadElement) + downloadElement.click() + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放掉blob对象 + } + + }).catch((error) => { + console.log(error) + }); + } componentDidMount() { this.setState({ spinning:true @@ -93,9 +134,7 @@ class ShixunWorkReport extends Component { {/*{this.props.isAdmin()?导出实训报告数据:""}*/} {this.props.isAdmin() ? this.internshipreport(`/zip/shixun_report?homework_common_id=${homeworkid}`)} >导出实训报告数据 : ""} diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index 8e857199b..efa418db0 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -24,6 +24,7 @@ import './style.css'; import '../css/busyWork.css' import '../poll/pollStyle.css' import moment from 'moment'; +import 'moment/locale/zh-cn'; import Modals from "../../modals/Modals"; const RadioGroup = Radio.Group; @@ -1621,7 +1622,27 @@ class Trainingjobsetting extends Component { }else if(response.data.status&&response.data.status===-2){ }else{ - window.open("/api"+url, '_blank'); + const type='application/zip'//ZIP文件 + const blob = new Blob([response.data], { type: type }) + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) + //后台再header中传文件名 + // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); + const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); + downloadElement.href = href + var now=""; + try { + now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+"" + console.log(now); + + } catch (e) { + console.log("1376"); + } + downloadElement.download = string+now+".zip" + document.body.appendChild(downloadElement) + downloadElement.click() + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放掉blob对象 } }).catch((error) => { @@ -1643,7 +1664,29 @@ class Trainingjobsetting extends Component { }else if(response.data.status&&response.data.status===-2){ }else{ - window.open("/api"+url, '_blank'); + const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件 + const blob = new Blob([response.data], { type: type }) + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) + //后台再header中传文件名 + // console.log("1409"); + // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); + const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); + var now=""; + try { + now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+"" + console.log("1422"); + console.log(now); + + } catch (e) { + console.log("1432"); + } + downloadElement.href = href + downloadElement.download =string+now+".xlsx"; + document.body.appendChild(downloadElement) + downloadElement.click() + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放掉blob对象 } }).catch((error) => { diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js index 8d88e9fb5..572f1e44f 100644 --- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js +++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js @@ -23,7 +23,8 @@ import { notification } from "antd"; import {Link, Switch, Route, Redirect} from 'react-router-dom'; -import moment from 'moment' +import moment from 'moment'; +import 'moment/locale/zh-cn'; import axios from 'axios'; import '../css/members.css' import "../common/formCommon.css" @@ -332,7 +333,27 @@ class Workquestionandanswer extends Component { }else if(response.data.status&&response.data.status===-2){ }else{ - window.open("/api"+url, '_blank'); + const type='application/zip'//ZIP文件 + const blob = new Blob([response.data], { type: type }) + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) + //后台再header中传文件名 + // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); + const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); + downloadElement.href = href + var now=""; + try { + now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+"" + console.log(now); + + } catch (e) { + console.log("1376"); + } + downloadElement.download = string+now+".zip" + document.body.appendChild(downloadElement) + downloadElement.click() + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放掉blob对象 } }).catch((error) => { @@ -354,7 +375,29 @@ class Workquestionandanswer extends Component { }else if(response.data.status&&response.data.status===-2){ }else{ - window.open("/api"+url, '_blank'); + const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件 + const blob = new Blob([response.data], { type: type }) + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) + //后台再header中传文件名 + // console.log("1409"); + // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); + const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); + var now=""; + try { + now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+"" + console.log("1422"); + console.log(now); + + } catch (e) { + console.log("1432"); + } + downloadElement.href = href + downloadElement.download =string+now+".xlsx"; + document.body.appendChild(downloadElement) + downloadElement.click() + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放掉blob对象 } }).catch((error) => { From a47fdee32f3b0fb8bca68bea48d8419dc9741a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 6 Jul 2019 00:01:14 +0800 Subject: [PATCH 29/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/shixunHomework/ShixunWorkReport.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index e8a42bdae..e8acd93c6 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -17,7 +17,8 @@ import '../css/members.css'; import "../common/formCommon.css"; import '../css/Courses.css'; import './style.css'; -import moment from "./Trainingjobsetting"; +import moment from 'moment'; +import 'moment/locale/zh-cn'; class ShixunWorkReport extends Component { From 6666c9ee6994e3502a434322a19d995181584845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 6 Jul 2019 00:08:18 +0800 Subject: [PATCH 30/39] b --- .../src/modules/courses/shixunHomework/ShixunStudentWork.js | 1 + .../src/modules/courses/shixunHomework/ShixunWorkReport.js | 2 +- .../src/modules/courses/shixunHomework/Trainingjobsetting.js | 1 + .../src/modules/courses/shixunHomework/Workquestionandanswer.js | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js index 5744c8ffe..3ac1b0bd2 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js @@ -32,6 +32,7 @@ import '../css/Courses.css' import './style.css' import moment from 'moment'; import 'moment/locale/zh-cn'; +import {Base64} from 'js-base64'; const Search = Input.Search; const CheckboxGroup = Checkbox.Group; diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index e8acd93c6..9c6ea2421 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -19,7 +19,7 @@ import '../css/Courses.css'; import './style.css'; import moment from 'moment'; import 'moment/locale/zh-cn'; - +import {Base64} from 'js-base64'; class ShixunWorkReport extends Component { diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index efa418db0..f7f7c80e5 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -4,6 +4,7 @@ import HomeworkModal from "../coursesPublic/HomeworkModal"; import {WordsBtn, ActionBtn, handleDateString} from 'educoder'; import PollDetailTabForthRules from '../poll/PollDetailTabForthRules'; import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; +import {Base64} from 'js-base64'; import { Button, Checkbox, diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js index 572f1e44f..5137351d2 100644 --- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js +++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js @@ -25,6 +25,7 @@ import { import {Link, Switch, Route, Redirect} from 'react-router-dom'; import moment from 'moment'; import 'moment/locale/zh-cn'; +import {Base64} from 'js-base64'; import axios from 'axios'; import '../css/members.css' import "../common/formCommon.css" From c4f5846cbdf87da33937d71e8274eb87ca2495b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 6 Jul 2019 00:39:44 +0800 Subject: [PATCH 31/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/config/webpack.config.dev.js | 2 +- .../react/config/webpackDevServer.config.js | 2 +- public/react/src/common/SnackbarHOC.js | 133 ++- .../modules/tpm/challengesnew/TPMquestion.js | 1008 +++-------------- .../tpm/challengesnew/TpmQuestionEdit.js | 220 ++++ .../tpm/challengesnew/TpmQuestionMain.js | 84 ++ .../tpm/challengesnew/TpmQuestionNew.js | 225 ++++ .../challengesnew/css/TPMchallengesnew.css | 14 +- 8 files changed, 749 insertions(+), 939 deletions(-) create mode 100644 public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js create mode 100644 public/react/src/modules/tpm/challengesnew/TpmQuestionMain.js create mode 100644 public/react/src/modules/tpm/challengesnew/TpmQuestionNew.js diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index 11cfc1962..80973be75 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -29,7 +29,7 @@ const env = getClientEnvironment(publicUrl); 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.s - // devtool: "source-map", // 开启调试 + 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/webpackDevServer.config.js b/public/react/config/webpackDevServer.config.js index 0eb313cbe..f12d31594 100644 --- a/public/react/config/webpackDevServer.config.js +++ b/public/react/config/webpackDevServer.config.js @@ -62,7 +62,7 @@ module.exports = function(proxy, allowedHost) { 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: false, + 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 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/tpm/challengesnew/TPMquestion.js b/public/react/src/modules/tpm/challengesnew/TPMquestion.js index aba4743d9..d05cc086e 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMquestion.js +++ b/public/react/src/modules/tpm/challengesnew/TPMquestion.js @@ -14,7 +14,11 @@ import './css/TPMchallengesnew.css'; import {getUrl} from 'educoder'; -import TPMeditorMD from './editorMD'; +import TpmQuestionMain from './TpmQuestionMain'; + +import TpmQuestionNew from './TpmQuestionNew'; + +import TpmQuestionEdit from './TpmQuestionEdit'; let origin = getUrl(); @@ -31,127 +35,15 @@ for (var i = 65, j = 0; i < 91; i++, j++) { letterArr[j] = String.fromCharCode(i); } -// 恢复数据 -function md_rec_data(k,mdu,id, editor){ - if(window.sessionStorage.getItem(k+mdu) !== null){ - editor.setValue(window.sessionStorage.getItem(k+mdu)); - md_clear_data(k,mdu,id); - } -} - -// 保存数据 -function md_add_data(k,mdu,d){ - window.sessionStorage.setItem(k+mdu,d); -} - -// 清空保存的数据 -function md_clear_data(k,mdu,id){ - window.sessionStorage.removeItem(k+mdu); - var id1 = "#e_tip_"+id; - var id2 = "#e_tips_"+id; - if(k == 'content'){ - $(id2).html(""); - }else{ - $(id1).html(""); - } -} - -function md_elocalStorage(editor,mdu,id){ - - if (window.sessionStorage){ - var oc = window.sessionStorage.getItem('content'+mdu); - if(oc !== null ){ - // console.log("#e_tips_"+id) - $("#e_tips_"+id).data('editor', editor); - var h = '您上次有已保存的数据,是否恢复 ? / 不恢复'; - $("#e_tips_"+id).html(h); - } - setInterval(function() { - var d = new Date(); - var h = d.getHours(); - var m = d.getMinutes(); - var s = d.getSeconds(); - h = h < 10 ? '0' + h : h; - m = m < 10 ? '0' + m : m; - s = s < 10 ? '0' + s : s; - if(editor.getValue().trim() != ""){ - md_add_data("content",mdu,editor.getValue()); - var id1 = "#e_tip_"+id; - var id2 = "#e_tips_"+id; - - $(id1).html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 "); - $(id2).html(""); - } - },10000); - - }else{ - $("#e_tip_"+id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!'); - } -} - -function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callback) { - var editorName = window.editormd(id, { - width: width, - height: high, - path: path, // "/editormd/lib/" - markdown : initValue, - syncScrolling: "single", - tex: true, - tocm: true, - emoji: true, - taskList: true, - codeFold: true, - searchReplace: true, - htmlDecode: "style,script,iframe", - sequenceDiagram: true, - autoFocus: false, - placeholder: placeholder, - toolbarIcons: function () { - // Or return editormd.toolbarModes[name]; // full, simple, mini - // Using "||" set icons align right. - return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"] - }, - toolbarCustomIcons: { - testIcon: "
    ", - testIcon1: "
    " - }, - //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 - saveHTMLToTextarea: true, - // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 - dialogMaskOpacity: 0.6, - imageUpload: true, - imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], - imageUploadURL: imageUrl,//url - onload: function () { - // this.previewing(); - $("#" + id + " [type=\"latex\"]").bind("click", function () { - editorName.cm.replaceSelection("```latex"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("```"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line - 1, 0); - }); - - $("#" + id + " [type=\"inline\"]").bind("click", function () { - editorName.cm.replaceSelection("$$$$"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); - editorName.cm.focus(); - }); - $("[type=\"inline\"]").attr("title", "行内公式"); - $("[type=\"latex\"]").attr("title", "多行公式"); - - callback && callback() - } - }); - return editorName; -} - export default class TPMquestion extends Component { constructor(props) { super(props) + this.contentMdRef = React.createRef(); + this.newquestioMDMdRef = React.createRef(); + this.newquestioMDMdCont=React.createRef(); + this.neweditanswerRef=React.createRef(); + this.editanswersRef=React.createRef(); this.state = { choice_url: undefined, practice_url: undefined, @@ -159,7 +51,7 @@ export default class TPMquestion extends Component { position: undefined, task_pass_default: undefined, submit_url: undefined, - questionInputvalue:undefined, + questionsInputvalue:undefined, questionaddsum:0, questionaddarray:[], questionaddtype:true, @@ -193,157 +85,14 @@ export default class TPMquestion extends Component { sumittype:false } } -questioMD=(initValue, id)=> { - - this.contentChanged = false; - const placeholder = "请输入选择题的过关任务内容"; -// amp; -// 编辑时要传memoId - // const imageUrl = `/upload_with_markdown?container_id=&container_type=Memo`; - const imageUrl = `/api/attachments.json`; -// 创建editorMd - - let questio_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,() => { - setTimeout(() => { - questio_editormd.resize() - questio_editormd.cm && questio_editormd.cm.refresh() - }, 500) - - if (initValue != undefined) { - questio_editormd.setValue(initValue) - } - questio_editormd.cm.on("change", (_cm, changeObj) => { - console.log('....contentChanged') - this.contentChanged = true; - }) - }); - md_elocalStorage(questio_editormd, `MemoQuestion_${id}`, `${id}Question`); - this.questio_editormd = questio_editormd; - window.questio_editormd = questio_editormd; - -} - -newanswerMD=(initValue, id)=> { - - this.contentChanged = false; -// amp; -// 编辑时要传memoId - const imageUrl = `/api/attachments.json`; -// 创建editorMd - let newanswerMD_editormd = create_editorMD(id, '100%', 400, "请输入各个选项的具体解析或其他相关信息", imageUrl, initValue,() => { - setTimeout(() => { - newanswerMD_editormd.resize() - newanswerMD_editormd.cm && newanswerMD_editormd.cm.refresh() - }, 500) - if (initValue != undefined) { - newanswerMD_editormd.setValue(initValue) - } - newanswerMD_editormd.cm.on("change", (_cm, changeObj) => { - console.log('....contentChanged') - this.contentChanged = true; - }) - }); - - md_elocalStorage(newanswerMD_editormd, `MemoQuestion_${id}`, `${id}Question`); - - this.newanswerMD_editormd = newanswerMD_editormd; - window.newanswerMD_editormd = newanswerMD_editormd; - -} - -newquestioMD=(initValue, id)=>{ - this.contentChanged = false; -// amp; -// 编辑时要传memoId - const imageUrl = `/api/attachments.json`; -// 创建editorMd - - let newquestioMD_editormd = create_editorMD(id, '100%', 400, "请输入选择题的题干内容", imageUrl, initValue,() => { - setTimeout(() => { - newquestioMD_editormd.resize() - newquestioMD_editormd.cm && newquestioMD_editormd.cm.refresh() - }, 500) - - if (initValue != undefined) { - newquestioMD_editormd.setValue(initValue) - } - newquestioMD_editormd.cm.on("change", (_cm, changeObj) => { - console.log('....contentChanged') - this.contentChanged = true; - }) - }); - md_elocalStorage(newquestioMD_editormd, `MemoQuestion_${id}`, `${id}Question`); - this.newquestioMD_editormd = newquestioMD_editormd; - window.newquestioMD_editormd = newquestioMD_editormd; - -} - -editanswerMD=(initValue, id)=> { - - this.contentChanged = false; - const placeholder = ""; -// amp; -// 编辑时要传memoId - const imageUrl = `/api/attachments.json`; -// 创建editorMd - - const neweditanswer_editormd =create_editorMD(id, '100%', 400, "请输入选择题的题干内容", imageUrl, initValue,()=> { - setTimeout(() => { - neweditanswer_editormd.resize() - neweditanswer_editormd.cm && neweditanswer_editormd.cm.refresh() - }, 500) - - if (initValue != undefined) { - neweditanswer_editormd.setValue(initValue) - } - neweditanswer_editormd.cm.on("change", (_cm, changeObj) => { - console.log('....contentChanged') - this.contentChanged = true; - }) - }); - md_elocalStorage(neweditanswer_editormd, `MemoQuestion_${id}`, `${id}Question`); - this.neweditanswer_editormd = neweditanswer_editormd; - window.neweditanswer_editormd = neweditanswer_editormd; - -} - -editanswersMD=(initValue, id)=> { - - this.contentChanged = false; - const placeholder = ""; -// amp; -// 编辑时要传memoId - const imageUrl = `/api/attachments.json`; -// 创建editorMd - - const editanswersMD_editormd = create_editorMD(id, '100%', 400, "请输入各个选项的具体解析或其他相关信息", imageUrl, initValue,() => { - setTimeout(() => { - editanswersMD_editormd.resize() - editanswersMD_editormd.cm && editanswersMD_editormd.cm.refresh() - }, 500) - - if (initValue != undefined) { - editanswersMD_editormd.setValue(initValue) - } - editanswersMD_editormd.cm.on("change", (_cm, changeObj) => { - console.log('....contentChanged') - this.contentChanged = true; - }) - }); - md_elocalStorage(editanswersMD_editormd, `MemoQuestion_${id}`, `${id}Question`); - this.editanswersMD_editormd = editanswersMD_editormd; - window.editanswersMD_editormd = editanswersMD_editormd; - -} - - //_______________________________________________________________________________ questionInputvalue=(e)=>{ this.setState({ - questionInputvalue: e.target.value + questionsInputvalue: e.target.value }) } + componentDidMount() { if(this.props.status===2){ @@ -380,18 +129,15 @@ editanswersMD=(initValue, id)=> { }) if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - this.questioMD("", "questioMD"); - this.setState({ - questioMD:"" + contentMdRefval:"" }) } else { - this.questioMD("", "questioMD"); - // this.create_mackdown(response.data.task_pass_default, "questioMD","") this.setState({ - questioMD:response.data.task_pass_default + contentMdRefval:response.data.task_pass_default }) + this.contentMdRef.current.setValue(response.data.task_pass_default || '') } this.shixunsautoHeight() } @@ -404,13 +150,6 @@ editanswersMD=(initValue, id)=> { //编辑模式 let url = "/shixuns/"+ id +"/challenges/"+checkpointId+"/edit.json?st=1" axios.get(url).then((response) => { - // if(choose_idlist!=undefined){ - // - // for(var i=0; i { activetype:"first", prev_challenge:newprev_challenge, next_challenge:next_challenge, - questionInputvalue:response.data.subject, + questionsInputvalue:response.data.subject, questionaddarray:response.data.chooses, challenge_id:response.data.id, mancheckpointId:checkpointId, @@ -449,11 +188,15 @@ editanswersMD=(initValue, id)=> { answer:response.data.answer }) - this.questioMD(response.data.task_pass, "questioMD"); + + this.setState({ + contentMdRefval:response.data.task_pass + }) + this.contentMdRef.current.setValue(response.data.task_pass || '') if(response.data.chooses.length===0){ this.questionadd() } - // this.create_mackdown(response.data.task_pass, "questioMD","","questio_editormd") + this.shixunsautoHeight() } @@ -472,13 +215,6 @@ editanswersMD=(initValue, id)=> { let id = this.props.match.params.shixunId; let url = "/shixuns/"+ id +"/challenges/"+checkpointId+"/edit.json?st=1" axios.get(url).then((response) => { - // if(choose_idlist!=undefined){ - // - // for(var i=0; i { newquestionaddtype:false, prev_challenge:newprev_challenge, next_challenge:next_challenge, - questionInputvalue:response.data.subject, + questionsInputvalue:response.data.subject, questionaddarray:response.data.chooses, challenge_id:response.data.id, mancheckpointId:checkpointId, @@ -515,11 +251,14 @@ editanswersMD=(initValue, id)=> { questioMD:response.data.task_pass, }) - this.questioMD(response.data.task_pass, "questioMD"); + + this.setState({ + contentMdRefval:response.data.task_pass + }) + this.contentMdRef.current.setValue(response.data.task_pass || '') if(response.data.chooses.length===0){ this.questionadd() } - // this.create_mackdown(response.data.task_pass, "questioMD","","questio_editormd") this.shixunsautoHeight() } @@ -549,12 +288,13 @@ editanswersMD=(initValue, id)=> { challenge_choose_id:this.props.match.params.choose_id, standard_answer:response.data.standard_answer, subject:response.data.subject, - answer:response.data.answer + answer:response.data.answer, + neweditanswerRefval:response.data.subject, + editanswersRefval:response.data.answer, }) - this.editanswerMD(response.data.subject, "neweditanswer") - - this.editanswersMD(response.data.answer, "editanswers") + this.neweditanswerRef.current.setValue(response.data.subject||'') + this.editanswersRef.current.setValue(response.data.answer||'') this.shixunsautoHeight() } @@ -578,11 +318,12 @@ editanswersMD=(initValue, id)=> { }) return } - let {questionInputvalue} =this.state; - const exercise_editormdvalue = this.questio_editormd.getValue(); + let {questionsInputvalue} =this.state; + // const exercise_editormdvalue = this.questio_editormd.getValue(); + const exercise_editormdvalue = this.contentMdRef.current.getValue().trim(); let id = this.props.match.params.shixunId; - if(questionInputvalue===undefined||questionInputvalue===null||questionInputvalue===""){ + if(questionsInputvalue===undefined||questionsInputvalue===null||questionsInputvalue===""){ this.setState({ questionInputvaluetype:true }) @@ -614,7 +355,7 @@ editanswersMD=(initValue, id)=> { axios.post(url, { identifier:id, - subject: questionInputvalue, + subject: questionsInputvalue, task_pass: exercise_editormdvalue, st: 1 }).then((response) => { @@ -637,7 +378,7 @@ editanswersMD=(initValue, id)=> { let url ="/shixuns/"+id+"/challenges/"+checkpointId+".json"; axios.put(url, { tab:0, - subject: questionInputvalue, + subject: questionsInputvalue, task_pass: exercise_editormdvalue, }).then((response) => { if(response.data.status===1){ @@ -659,13 +400,12 @@ editanswersMD=(initValue, id)=> { } questionall=()=>{ - let {task_pass_default}=this.state; this.setState({ activetype:"first", newquestionaddtype:false, - editquestionaddtype:false + editquestionaddtype:false, + questionaddtype:false }) - this.questioMD(task_pass_default, "questioMD"); } questionadd=()=>{ $('html').animate({ @@ -675,11 +415,21 @@ editanswersMD=(initValue, id)=> { let questionaddsums=questionaddarray.length; - if(questionaddarray.length-1>9){ + if(questionaddsums-1>9){ + this.props.showSnackbar("选择题目最大支持设置9道题") return } let questionaddarrays=questionaddarray; + + questionaddarrays.map((item,key)=>{ + if(item.choose_id===0){ + questionaddarrays.splice(key,1) + } + }) + + + questionaddarrays.push({type:0,choose_id:0}); this.setState({ activetype:0, @@ -692,14 +442,19 @@ editanswersMD=(initValue, id)=> { answeoptions:[10,20], answeonshixunsmark:10, shixunssanswerkillvalue:"", - shixunsskillanswerlist:[] + shixunsskillanswerlist:[], + contentMdRefval:"", + newquestioMDMdContval:"" }) - this.newanswerMD("","challenge_choose_answer") - this.newquestioMD("","newquestioMDs") - // this.create_mackdown("", "newquestioMDs","请输入选择题的题干内容","newanswerMD_editormd") - // this.create_mackdown("", "challenge_choose_answer","请输入各个选项的具体解析或其他相关信息","newquestioMD_editormd") - this.shixunsautoHeight() + + // setTimeout(() => { + // this.newquestioMDMdCont.current.setValue('') + // this.newquestioMDMdRef.current.setValue('') + // + // }, 2000) + + this.shixunsautoHeight() } editquestionlists=(newquestionlists)=>{ @@ -834,7 +589,6 @@ editanswersMD=(initValue, id)=> { } answer_subit=(sumtype,challenge_choose_id)=>{ - let {challenge_id,questionlists,shixunsskillanswerlist,answeonshixunsmark,answeshixunsGroup,questionaddarray} =this.state; if(challenge_id===undefined){ message.error("关卡id为空"); @@ -924,9 +678,7 @@ editanswersMD=(initValue, id)=> { let id = this.props.match.params.shixunId; let url; if(sumtype==="edit"){ - let newquestioMDvalue = this.neweditanswer_editormd.getValue(); - - + let newquestioMDvalue = this.neweditanswerRef.current.getValue().trim(); if(newquestioMDvalue===""||newquestioMDvalue==="请输入选择题的题干内容"){ this.setState({ newquestioMDvaluetype:true, @@ -938,21 +690,13 @@ editanswersMD=(initValue, id)=> { return } - let newnewanswerMDvalue = this.editanswersMD_editormd.getValue(); + + let newnewanswerMDvalue = this.editanswersRef.current.getValue().trim(); console.log(newnewanswerMDvalue) if(newnewanswerMDvalue===""||newnewanswerMDvalue===" "){ newnewanswerMDvalue=newlist } - // if(newnewanswerMDvalue===""||newnewanswerMDvalue==="请输入选择题的题干内容"){ - // this.setState({ - // newquestioMDvaluetypes:true, - // }) - // $('html').animate({ - // scrollTop:1300 - // }, 200); - // this.props.showSnackbar("参考答案为空"); - // return - // } + url="/shixuns/" + id + "/challenges/" + challenge_id + "/update_choose_question.json?choose_id="+challenge_choose_id; axios.post(url, { challenge_choose: {subject: newquestioMDvalue, answer: newnewanswerMDvalue, standard_answer:newlist, score: answeonshixunsmark, difficult: answeshixunsGroup}, @@ -976,8 +720,8 @@ editanswersMD=(initValue, id)=> { console.log(error) }); }else{ - let newquestioMDvalue = this.newquestioMD_editormd.getValue(); + let newquestioMDvalue = this.newquestioMDMdRef.current.getValue().trim(); if(newquestioMDvalue===""||newquestioMDvalue==="请输入选择题的题干内容"){ this.setState({ newquestioMDvaluetype:true, @@ -988,19 +732,8 @@ editanswersMD=(initValue, id)=> { message.error("题干为空"); return } - let newnewanswerMDvalue = this.newanswerMD_editormd.getValue(); - // - // if(newnewanswerMDvalue===""||newnewanswerMDvalue==="请输入选择题的题干内容"){ - // this.setState({ - // newquestioMDvaluetypes:true, - // }) - // - // $('html').animate({ - // scrollTop:1300 - // }, 200); - // this.props.showSnackbar("参考答案为空"); - // return - // } + let newnewanswerMDvalue = this.newquestioMDMdCont.current.getValue().trim(); + if(newnewanswerMDvalue===""||newnewanswerMDvalue===" "){ newnewanswerMDvalue=newlist } @@ -1042,39 +775,7 @@ editanswersMD=(initValue, id)=> { } - // getanswer_subitlist=()=>{ - // let{challenge_choose_id,challenge_id,questionaddarray} =this.state - // let id = this.props.match.params.shixunId; - // let url ='/shixuns/'+id+'/challenges/'+challenge_id+'/edit_choose_question.json?choose_id='+challenge_choose_id; - // axios.get(url).then((response) => { - // if(response.status===200){ - // this.create_mackdown(response.data.subject, "neweditanswer","","neweditanswer_editormd") - // this.create_mackdown(response.data.standard_answer, "editanswers","","editanswersMD_editormd") - // let choose_contents=response.data.choose_contents; - // let newchoose_contentslist=[] - // for(var i=0; i { - // }); - // } - questionlist=(key,challenge_choose_id,type)=>{ - $('html').animate({ scrollTop:10 }, 500); @@ -1083,8 +784,9 @@ editanswersMD=(initValue, id)=> { if(challenge_choose_id===""||type===0){ - this.newanswerMD("","neweditanswer") - this.editanswersMD("","editanswers") + + // this.neweditanswerRef.current.setValue('') + // this.editanswersRef.current.setValue('') this.setState({ activetype:challenge_choose_id, editquestionaddtype:true, @@ -1095,12 +797,11 @@ editanswersMD=(initValue, id)=> { answeoptions:[10,20], answeonshixunsmark:10, shixunssanswerkillvalue:"", - shixunsskillanswerlist:[] + shixunsskillanswerlist:[], + neweditanswerRefval:'', + editanswersRefval:'' }) - // this.create_mackdown("", "newquestioMDs","请输入选择题的题干内容","newanswerMD_editormd") - // this.create_mackdown("", "challenge_choose_answer","请输入各个选项的具体解析或其他相关信息","newquestioMD_editormd") - }else{ let id = this.props.match.params.shixunId; let url ='/shixuns/'+id+'/challenges/'+challenge_id+'/edit_choose_question.json?choose_id='+challenge_choose_id; @@ -1125,13 +826,13 @@ editanswersMD=(initValue, id)=> { challenge_choose_id:challenge_choose_id, standard_answer:response.data.standard_answer, subject:response.data.subject, - answer:response.data.answer + answer:response.data.answer, + neweditanswerRefval:response.data.subject, + editanswersRefval:response.data.subject }) - this.editanswerMD(response.data.subject, "neweditanswer") - - this.editanswersMD(response.data.answer, "editanswers") - + this.neweditanswerRef.current.setValue(response.data.subject||'') + this.editanswersRef.current.setValue(response.data.answer||'') this.shixunsautoHeight() } @@ -1152,9 +853,7 @@ editanswersMD=(initValue, id)=> { if(elem.scrollHeight===0){ elem.style.height = 62 + 'px'; }else{ - // if(elem.style.height>140){ - // - // } + elem.style.height = elem.scrollHeight + 'px'; } @@ -1170,56 +869,30 @@ editanswersMD=(initValue, id)=> { } gochooseid=(url)=>{ - window.location.href =url - } - onshixunsmarks=()=> { - this.setState({ - marktype:true - }) - } - - onshixunsmarkss=()=> { - this.setState({ - marktype:false - }) + window.location.href =url + // this.props.history.replace( url ); + // this.props.history.push( url ); + // 返回 + // this.props.history.goBack(); } + render() { let {choice_url, practice_url, go_back_url, position, - questionInputvalue, - challenge_tagtype, - questionInputvaluetype, - answeshixunsGroup, answeoptions, - answeonshixunsmark, - shixunssanswerkillvalue, - questionlistss,power, questionaddarray, questionaddtype, activetype, newquestionaddtype, - newquestioMDvaluetype, editquestionaddtype, - questionlists, - shixunsskillanswerlist, - newcnttype, challenge_choose_id, - mancheckpointId, - challenge_id, - questioMD, - standard_answer, - subject, - newquestioMDvaluetypes, - questionInputvaluetypes, prev_challenge, next_challenge, - newcnttypesum, - marktype, answer, - sumittype + } = this.state; let options; @@ -1230,7 +903,6 @@ editanswersMD=(initValue, id)=> { ) }) - console.log(answer) return (
    @@ -1261,9 +933,11 @@ editanswersMD=(initValue, id)=> {
    -
  • - 本关任务 -
  • + +
  • + 本关任务 +
  • +
    { questionaddarray.length===0?"":questionaddarray.map((item,key)=>{ @@ -1277,7 +951,7 @@ editanswersMD=(initValue, id)=> { item.choose_id!=0? this.gochooseid("/shixuns/"+this.props.match.params.shixunId+"/challenges/"+this.props.match.params.checkpointId+"/editquestion"+"/"+item.choose_id)}> {key+1}.{item.type===2?"多选题":item.type===1?"单选题":'选择题'} - :{key+1}.{item.type===2?"多选题":item.type===1?"单选题":'选择题'} + :activetype==="first"?"":{key+1}.{item.type===2?"多选题":item.type===1?"单选题":'选择题'} } @@ -1295,458 +969,57 @@ editanswersMD=(initValue, id)=> {
    -
    - -
    -
    -

    任务名称

    -
    - * -
    - -
    -
    - 必填项 -
    -
    -
    -
    - - -
    -

    过关任务

    -
    - * -
    -
    - -
    -
    -
    - {/**/} -
    -
    - 必填项 -
    -
    -

    -

    -
    - - -
    4||this.props.identity===undefined||power===false?"none":"block"}}> - 提交 - 取消 - -
    - -
    + {/*x选择题首页*/} + {activetype==="first"?this.questionInputvalue(e)} + clickquestionsumit={(e)=>this.clickquestionsumit(e)} + />:""} {/*新建*/} - {newquestionaddtype===true?
    - -
    -
    -

    题干

    -
    - * -
    -
    - {/**/} - {/*
    */} - {/*
    */} - {/**/} -
    - -
    - - -
    - 必填项 -
    - -
    -

    -

    - - -
    - { - questionlists===undefined||questionlists.length===0?"":questionlists.map((item,key)=>{ - return( -
  • - - - this.delquestionlists(key)}> - - - - - -
  • - ) - }) - } -

    - 新增选项 - - - {newcnttypesum===0?"请选择答案":"选项内容不能为空"} - -

    -
  • - - -
  • -
    -
    -
    - - -
    -
    -

    参考答案

    -
    -
    - {/**/} - {/*
    */} - {/*
    */} -
    - -
    - 必填项 -
    -
    -

    -

    - -
    -
    - -
    -

    难度系数

    -
    - - - 简单 - 中等 - 困难 - - -
    -

    奖励经验值

    -
    - * - - - -

    - 如果学员答题错误,则不能得到相应的经验值
    - 如果学员成功得到经验值,那么将同时获得等值的金币奖励,如:+10经验值、+10金币 -

    - - 必填项 -
    -
    - -
    -

    技能标签

    -
    - * -
    - - {/*+ 添加*/} -
    学员答题正确将获得技能,否则不能获得技能 - - 必填项 - -
    -
    - - { - shixunsskillanswerlist.length === 0 ? "" : shixunsskillanswerlist.map((itme, key) => { - return ( -
  • {itme} - this.delshixunssnswerllist(key)}>× -
  • - ) - }) - } - - -
    - -
    - -
    -
    - - -
    4||this.props.identity===undefined||power===false?"none":"block"}}> - 提交 - 取消 -
    - -
    :""} + {newquestionaddtype===true? + this.selquestionlists(key)} + onInputoquestionption={(e,key)=>this.onInputoquestionption(e,key)} + delquestionlists={(key)=>this.delquestionlists(key)} + addquestionlists={(e)=>this.addquestionlists(e)} + onshixunGroupanswe={(e)=>this.onshixunGroupanswe(e)} + onshixunsansweSelect={(e)=>this.onshixunsansweSelect(e)} + shixunssanswerkill={(e)=>this.shixunssanswerkill(e)} + clickshixunsanswerskill={(e)=>this.clickshixunsanswerskill(e)} + delshixunssnswerllist={(key)=>this.delshixunssnswerllist(key)} + answer_subit={()=>this.answer_subit()} + />:""} {/*修改*/} - {editquestionaddtype===true?
    - -
    -
    -

    题干

    -
    - * -
    -
    - -
    -
    -
    -
    - - -
    - 必填项 -
    - -
    -

    -

    -
    - { - questionlists===undefined||questionlists.length===0?"":questionlists.map((item,key)=>{ - return( -
  • - - - this.delquestionlists(key)}> - - -
  • - ) - }) - } -

    - 新增选项 - - - {newcnttypesum===0?"请选择答案":"选项内容不能为空"} - -

    -
  • - - -
  • -
    -
    -
    - - -
    -
    -

    参考答案

    -
    -
    - {/**/} - {/*
    */} - {/*
    */} -
    -
    - 必填项 -
    -
    -

    -

    -
    -
    - -
    -

    难度系数

    -
    - - - 简单 - 中等 - 困难 - - -
    -

    奖励经验值

    -
    - * - - - -

    - 如果学员答题错误,则不能得到相应的经验值
    - 如果学员成功得到经验值,那么将同时获得等值的金币奖励,如:+10经验值、+10金币 -

    - - 必填项 -
    -
    - -
    -

    技能标签

    -
    - * -
    - - {/*+ 添加*/} -
    学员答题正确将获得技能,否则不能获得技能 - - 必填项 - -
    -
    - - { - shixunsskillanswerlist.length === 0 ? "" : shixunsskillanswerlist.map((itme, key) => { - return ( -
  • {itme} - this.delshixunssnswerllist(key)}>× -
  • - ) - }) - } - - -
    - -
    - -
    -
    - - -
    4||this.props.identity===undefined||power===false?"none":"block"}}> - this.answer_subit("edit",challenge_choose_id)}>提交 - 取消 -
    - -
    + {editquestionaddtype===true? + this.selquestionlists(key)} + onInputoquestionption={(e,key)=>this.onInputoquestionption(e,key)} + delquestionlists={(key)=>this.delquestionlists(key)} + addquestionlists={(e)=>this.addquestionlists(e)} + onshixunGroupanswe={(e)=>this.onshixunGroupanswe(e)} + onshixunsansweSelect={(e)=>this.onshixunsansweSelect(e)} + shixunssanswerkill={(e)=>this.shixunssanswerkill(e)} + clickshixunsanswerskill={(e)=>this.clickshixunsanswerskill(e)} + delshixunssnswerllist={(key)=>this.delshixunssnswerllist(key)} + answer_subit={()=>this.answer_subit("edit",challenge_choose_id)} + /> :""}
    @@ -1755,4 +1028,3 @@ editanswersMD=(initValue, id)=> { } } - diff --git a/public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js b/public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js new file mode 100644 index 000000000..7de8529d7 --- /dev/null +++ b/public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js @@ -0,0 +1,220 @@ +import React, {Component} from 'react'; + +import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Tooltip} from 'antd'; + +import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; + +import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor'; + +const Option = Select.Option; + +const RadioGroup = Radio.Group; + +export default class TpmQuestionEdit extends Component { + constructor(props) { + super(props) + this.state = { + + } + } + + componentDidMount() { + + } + + + render() { + console.log( this.props.questionlists) + return ( +
    + +
    +
    +

    题干

    +
    + * +
    + +
    + + +
    + 必填项 +
    + +
    +

    +

    +
    + { + this.props.questionlists===undefined||this.props.questionlists.length===0?"":this.props.questionlists.map((item,key)=>{ + return( +
  • + + + this.props.delquestionlists(key)}> + + +
  • + ) + }) + } +

    + this.props.addquestionlists()} + className="fl edu-default-btn edu-greyline-btn mb20 option_icon_add">新增选项 + + + {this.props.newcnttypesum===0?"请选择答案":"选项内容不能为空"} + +

    +
  • + + +
  • +
    +
    +
    + + +
    +
    +

    参考答案

    +
    +
    + +
    +
    + 必填项 +
    +
    +

    +

    +
    +
    + +
    +

    难度系数

    +
    + + this.props.onshixunGroupanswe(e)}> + 简单 + 中等 + 困难 + + +
    +

    奖励经验值

    +
    + * + + + +

    + 如果学员答题错误,则不能得到相应的经验值
    + 如果学员成功得到经验值,那么将同时获得等值的金币奖励,如:+10经验值、+10金币 +

    + + 必填项 +
    +
    + +
    +

    技能标签

    +
    + * +
    + this.props.shixunssanswerkill(e)} + value={this.props.shixunssanswerkillvalue} + onPressEnter={(e)=>this.props.clickshixunsanswerskill(e)} + onBlur={(e)=>this.props.clickshixunsanswerskill(e)} + /> + {/*+ 添加*/} +
    学员答题正确将获得技能,否则不能获得技能 + + 必填项 + +
    +
    + + { + this.props.shixunsskillanswerlist.length === 0 ? "" : this.props.shixunsskillanswerlist.map((itme, key) => { + return ( +
  • {itme} + this.props.delshixunssnswerllist(key)}>× +
  • + ) + }) + } + + +
    + +
    + +
    +
    + + +
    4||this.props.identity===undefined||this.props.power===false?"none":"block"}}> + this.props.answer_subit()}>提交 + 取消 +
    + +
    + + ) + } +} + + + diff --git a/public/react/src/modules/tpm/challengesnew/TpmQuestionMain.js b/public/react/src/modules/tpm/challengesnew/TpmQuestionMain.js new file mode 100644 index 000000000..2de04f56a --- /dev/null +++ b/public/react/src/modules/tpm/challengesnew/TpmQuestionMain.js @@ -0,0 +1,84 @@ +import React, {Component} from 'react'; + +import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; +import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor'; + + +export default class TpmQuestionMain extends Component { + constructor(props) { + super(props) + this.state = { + + } + } + + componentDidMount() { + + } + + + render() { + return ( +
    +
    +
    +

    任务名称

    +
    + * +
    + +
    +
    + 必填项 +
    +
    +
    +
    + + +
    +

    过关任务

    +
    + * +
    + +
    +
    + 必填项 +
    +
    +

    +

    +
    + + +
    4 || this.props.identity === undefined || this.props.power === false ? "none" : "block"}}> + 提交 + 取消 + +
    + +
    + + ) + } + } + + + diff --git a/public/react/src/modules/tpm/challengesnew/TpmQuestionNew.js b/public/react/src/modules/tpm/challengesnew/TpmQuestionNew.js new file mode 100644 index 000000000..76a540e0c --- /dev/null +++ b/public/react/src/modules/tpm/challengesnew/TpmQuestionNew.js @@ -0,0 +1,225 @@ +import React, {Component} from 'react'; + +import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Tooltip} from 'antd'; + +import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; + +import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor'; + +const Option = Select.Option; + +const RadioGroup = Radio.Group; + +export default class TpmQuestionNew extends Component { + constructor(props) { + super(props) + this.state = { + + } + } + + componentDidMount() { + + } + + + render() { + console.log( this.props.questionlists) + return ( +
    + +
    +
    +

    题干

    +
    + * +
    + +
    + + +
    + 必填项 +
    + +
    +

    +

    + + +
    + { + this.props.questionlists===undefined||this.props.questionlists.length===0?"":this.props.questionlists.map((item,key)=>{ + return( +
  • + + + this.props.delquestionlists(key)}> + + + + + +
  • + ) + }) + } +

    + this.props.addquestionlists()} + className="fl edu-default-btn edu-greyline-btn mb20 option_icon_add">新增选项 + + + {this.props.newcnttypesum===0?"请选择答案":"选项内容不能为空"} + +

    +
  • + + +
  • +
    +
    +
    + + +
    +
    +

    参考答案

    +
    +
    + +
    +
    + 必填项 +
    +
    +

    +

    + +
    +
    + +
    +

    难度系数

    +
    + + this.props.onshixunGroupanswe(e)} + > + 简单 + 中等 + 困难 + + +
    +

    奖励经验值

    +
    + * + + + +

    + 如果学员答题错误,则不能得到相应的经验值
    + 如果学员成功得到经验值,那么将同时获得等值的金币奖励,如:+10经验值、+10金币 +

    + + 必填项 +
    +
    + +
    +

    技能标签

    +
    + * +
    + this.props.shixunssanswerkill(e)} + value={this.props.shixunssanswerkillvalue} + onPressEnter={(e)=>this.props.clickshixunsanswerskill(e)} + onBlur={(e)=>this.props.clickshixunsanswerskill(e)} + /> + {/*+ 添加*/} +
    学员答题正确将获得技能,否则不能获得技能 + + 必填项 + +
    +
    + + { + this.props.shixunsskillanswerlist.length === 0 ? "" : this.props.shixunsskillanswerlist.map((itme, key) => { + return ( +
  • {itme} + this.props.delshixunssnswerllist(key)}>× +
  • + ) + }) + } + + +
    + +
    + +
    +
    + + +
    4||this.props.identity===undefined||this.props.power===false?"none":"block"}}> + 提交 + 取消 +
    + +
    + + ) + } +} + + + diff --git a/public/react/src/modules/tpm/challengesnew/css/TPMchallengesnew.css b/public/react/src/modules/tpm/challengesnew/css/TPMchallengesnew.css index 5087e2f0d..37a65ef97 100644 --- a/public/react/src/modules/tpm/challengesnew/css/TPMchallengesnew.css +++ b/public/react/src/modules/tpm/challengesnew/css/TPMchallengesnew.css @@ -60,21 +60,21 @@ a{ #exercisememoMD .CodeMirror { margin-top: 31px !important; - height: 658px !important; + height: 370px !important; /*width: 579px !important;*/ } #exercisememoMD .editormd-preview { top: 40px !important; - height: 700px !important; + height: 370px !important; width: 578px !important; } #exercisememoMD{ - height: 700px !important; + /*height: 700px !important;*/ } #questioMD{ /*width: 95% !important;*/ - height: 586px !important; + height: 417px !important; margin-left: 0% !important; } @@ -82,13 +82,13 @@ a{ #questioMD .CodeMirror { /*width: 550.5px !important;*/ margin-top: 31px !important; - height: 550px !important; + height: 374px !important; } #questioMD .editormd-preview { top: 40px !important; - height: 550px !important; - width: 578px !important; + height: 375px !important; + width: 550px !important; } #newquestioMD .CodeMirror { From 56b75b7850f8cfae232e8d6bc37c0479040dffec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 6 Jul 2019 00:40:51 +0800 Subject: [PATCH 32/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/challengesnew/TPMquestion.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/tpm/challengesnew/TPMquestion.js b/public/react/src/modules/tpm/challengesnew/TPMquestion.js index d05cc086e..60840b81f 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMquestion.js +++ b/public/react/src/modules/tpm/challengesnew/TPMquestion.js @@ -875,7 +875,7 @@ export default class TPMquestion extends Component { // 返回 // this.props.history.goBack(); } - + render() { let {choice_url, From 5bcd9e21399082fa3f9db4badec4a129454232cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 6 Jul 2019 09:31:55 +0800 Subject: [PATCH 33/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/Resource/Fileslistitem.js | 4 +++- public/react/src/modules/courses/Resource/index.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 0ce4fba46..3ce5dbbf2 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -42,7 +42,9 @@ class Fileslistitem extends Component{ let link = document.createElement('a'); document.body.appendChild(link); link.href = result.data.url; - link.download = ''; + let filesname=decodeURI(result.data.title) + debugger + link.download = decodeURIComponent(filesname); //兼容火狐浏览器 let evt = document.createEvent("MouseEvents"); evt.initEvent("click", false, false); 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{ } } > -
    +
    +

    暂无数据哦~

    From b3cdc99433b32d55b777dbf02263900b6ca5d170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 6 Jul 2019 09:44:35 +0800 Subject: [PATCH 34/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/Resource/Fileslistitem.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 3ce5dbbf2..6fe7fa55d 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -42,9 +42,10 @@ class Fileslistitem extends Component{ let link = document.createElement('a'); document.body.appendChild(link); link.href = result.data.url; - let filesname=decodeURI(result.data.title) + let filesname=escape(result.data.title) debugger - link.download = decodeURIComponent(filesname); + console.log(filesname) + link.download = unescape(filesname); //兼容火狐浏览器 let evt = document.createEvent("MouseEvents"); evt.initEvent("click", false, false); From 38fd3e6db2218366748025744cbc187cb9401291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 6 Jul 2019 09:48:14 +0800 Subject: [PATCH 35/39] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/Resource/Fileslistitem.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 6fe7fa55d..6239f1b3d 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -26,8 +26,8 @@ class Fileslistitem extends Component{ }) this.props.Settingtypes(discussMessage.id) } - showfiles=()=>{ - debugger + showfiles=(value)=>{ + let {discussMessage,coursesId}=this.props let file_id=discussMessage.id let url="/files/"+file_id+"/histories.json" @@ -42,10 +42,8 @@ class Fileslistitem extends Component{ let link = document.createElement('a'); document.body.appendChild(link); link.href = result.data.url; - let filesname=escape(result.data.title) - debugger console.log(filesname) - link.download = unescape(filesname); + link.download = value; //兼容火狐浏览器 let evt = document.createEvent("MouseEvents"); evt.initEvent("click", false, false); @@ -208,13 +206,13 @@ 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} :"" } From f18b50406a577d3a7d007febdcc6b7de0a4138d5 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Sat, 6 Jul 2019 10:01:19 +0800 Subject: [PATCH 36/39] =?UTF-8?q?=E8=B4=A6=E6=88=B7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exercise/ExerciseReviewAndAnswer.js | 21 ++++-- .../courses/poll/PollDetailTabThird.js | 2 +- public/react/src/modules/user/AccountPage.js | 69 ++++++++++--------- .../src/modules/user/account/AccountBasic.js | 2 +- .../modules/user/account/AccountBasicEdit.js | 2 +- .../user/account/AccountCertification.js | 2 +- .../src/modules/user/account/AccountSecure.js | 2 +- 7 files changed, 55 insertions(+), 45 deletions(-) diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js index 31c293659..b9f0f67f9 100644 --- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js +++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js @@ -1,5 +1,5 @@ import React,{ Component } from "react"; -import {Checkbox,Radio, Input,InputNumber} from "antd"; +import {Checkbox,Radio, Input,InputNumber,Spin} from "antd"; import '../css/members.css' import '../css/busyWork.css' @@ -75,7 +75,10 @@ class ExerciseReviewAndAnswer extends Component{ Id:undefined, // 试卷总分 - exerciseTotalScore:undefined + exerciseTotalScore:undefined, + + // 加载效果 + isSpin:false } } componentDidUpdate (prevProps) { @@ -163,7 +166,8 @@ class ExerciseReviewAndAnswer extends Component{ getInfo=()=>{ this.setState({ courseName:this.props.current_user.course_name, - userName:this.props.current_user.username + userName:this.props.current_user.username, + isSpin:true }) let eId=this.props.match.params.Id; @@ -187,7 +191,8 @@ class ExerciseReviewAndAnswer extends Component{ exercise_questions:result.data.exercise_questions, user_exercise_status:1, Id:result.data.exercise_answer_user.user_id, - exerciseTotalScore:result.data.exercise_answer_user.score + exerciseTotalScore:result.data.exercise_answer_user.score, + isSpin:false }) } }).catch((error)=>{ @@ -210,7 +215,8 @@ class ExerciseReviewAndAnswer extends Component{ exercise_questions:result.data.exercise_questions, user_exercise_status:result.data.exercise.user_exercise_status, time:result.data.exercise.left_time, - exerciseTotalScore:result.data.user_score + exerciseTotalScore:result.data.user_score, + isSpin:false }) if(result.data.exercise.left_time != null){ this.remainTime(); @@ -498,7 +504,8 @@ class ExerciseReviewAndAnswer extends Component{ ModalCancel, ModalSave, Loadtype, - exerciseTotalScore + exerciseTotalScore, + isSpin }=this.state let isAdmin = this.props.isAdmin(); let isStudent =this.props.isStudent(); @@ -506,6 +513,7 @@ class ExerciseReviewAndAnswer extends Component{ console.log(data&&data.exercise.user_name) return(
    + - - - - () - } - > - () - } - > + + +
    + + () + } + > + () + } + > - () - } - > + () + } + > - () - } - > + () + } + > - () - } - > - + () + } + > + +
    ); diff --git a/public/react/src/modules/user/account/AccountBasic.js b/public/react/src/modules/user/account/AccountBasic.js index e1d084cc4..831fd39ca 100644 --- a/public/react/src/modules/user/account/AccountBasic.js +++ b/public/react/src/modules/user/account/AccountBasic.js @@ -22,7 +22,7 @@ class AccountBasicEdit extends Component { const {basicInfo} =this.props const showRealName = false; return ( -
    +