From 199bb1862f45da260a5ed15002c5abc44f53a294 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 22 Aug 2019 14:24:00 +0800 Subject: [PATCH 01/52] =?UTF-8?q?=E4=BD=BF=E7=94=A8downloadFile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/common/TextUtil.js | 4 ++-- .../src/modules/courses/members/studentsList.js | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/public/react/src/common/TextUtil.js b/public/react/src/common/TextUtil.js index 4c83131f1..013ea2a8f 100644 --- a/public/react/src/common/TextUtil.js +++ b/public/react/src/common/TextUtil.js @@ -1,4 +1,4 @@ -import { bytesToSize, getUrl2 } from 'educoder'; +import { bytesToSize, getUrl, getUrl2 } from 'educoder'; const $ = window.$ export function isImageExtension(fileName) { @@ -40,7 +40,7 @@ export function markdownToHTML(oldContent, selector) { } } function _doDownload(options) { - $.fileDownload("/api" + options.url, { + $.fileDownload(getUrl() + "/api" + options.url, { successCallback: options.successCallback, failCallback: options.failCallback }); diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index 2a510789e..5ec3acab5 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -8,7 +8,7 @@ import CourseLayoutcomponent from '../common/CourseLayoutComponent' import Titlesearchsection from '../common/titleSearch/TitleSearchSection' import ColorCountText from '../common/titleSearch/ColorCountText' -import { WordsBtn, trigger, on, off } from 'educoder' +import { WordsBtn, trigger, on, off, getUrl, downloadFile } from 'educoder' import Modals from "../../modals/Modals"; import axios from 'axios' import _ from 'lodash' @@ -150,7 +150,19 @@ class studentsList extends Component{ } }else { this.props.showNotification(`正在下载中`); - window.open("/api"+url, '_blank'); + + // getUrl() + "/api"+ + const fileUrl = url; + downloadFile({ + url: fileUrl, + successCallback: (url) => { + console.log('successCallback') + }, + failCallback: (responseHtml, url) => { + console.log('failCallback') + } + }) + // window.open(fileUrl, "_self");// , '_blank' } }).catch((error) => { console.log(error) From bae43137a537ecc503caf6d53af59d7d887f9c13 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 22 Aug 2019 15:26:12 +0800 Subject: [PATCH 02/52] slowdownload --- public/react/src/common/UrlTool.js | 8 +++++ .../modules/courses/members/studentsList.js | 4 +++ public/react/src/modules/tpm/TPMIndexHOC.js | 33 ++++++++++++++++--- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/public/react/src/common/UrlTool.js b/public/react/src/common/UrlTool.js index fc2100694..aeb9a8d62 100644 --- a/public/react/src/common/UrlTool.js +++ b/public/react/src/common/UrlTool.js @@ -37,6 +37,14 @@ export function getUrl(path, goTest) { } return `${path ? path: ''}`; } +export function getStaticUrl() { + const local = TEST_HOST; + if (isDev) { + return local + } + // todo cdn + return '' +} export function getUrl2(path, goTest) { const local = 'http://localhost:3000' if (isDev) { diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index 5ec3acab5..76112692a 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -153,6 +153,10 @@ class studentsList extends Component{ // getUrl() + "/api"+ const fileUrl = url; + + this.props.slowDownload(fileUrl) + return; + downloadFile({ url: fileUrl, successCallback: (url) => { diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 6149687bc..820451525 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -5,9 +5,9 @@ import PropTypes from 'prop-types'; import NewHeader from './NewHeader' import NewFooter from './NewFooter' import SiderBar from './SiderBar' -import { getUrl } from 'educoder' +import { getUrl, downloadFile } from 'educoder' import axios from 'axios'; - +import { Spin } from 'antd' import './TPMIndex.css' import LoginDialog from '../login/LoginDialog'; import AccountProfile from '../user/AccountProfile'; @@ -79,7 +79,9 @@ export function TPMIndexHOC(WrappedComponent) { coursedata: {}, isRender: false, - AccountProfiletype: false + AccountProfiletype: false, + + slowDownloading: false } } @@ -364,6 +366,22 @@ export function TPMIndexHOC(WrappedComponent) { DownloadOpenPdf=(type,url)=>{ type===true?window.open(url):window.location.href=url; } + slowDownload = (url, tip) => { + this._slowDownloadTip = tip || '正在生成文件,请稍后...'; + this.setState({ slowDownloading: true }) + const fileUrl = url; + downloadFile({ + url: fileUrl, + successCallback: (url) => { + this.setState({ slowDownloading: false }) + console.log('successCallback') + }, + failCallback: (responseHtml, url) => { + this.setState({ slowDownloading: false }) + console.log('failCallback') + } + }) + } render() { let{Headertop,Footerdown, isRender, AccountProfiletype}=this.state; const common = { @@ -387,7 +405,9 @@ export function TPMIndexHOC(WrappedComponent) { ShowOnlinePdf:(url)=>this.ShowOnlinePdf(url), DownloadFileA:(title,url)=>this.DownloadFileA(title,url), - DownloadOpenPdf:(type,url)=>this.DownloadOpenPdf(type,url) + DownloadOpenPdf:(type,url)=>this.DownloadOpenPdf(type,url), + + slowDownload: this.slowDownload } return (
@@ -425,6 +445,10 @@ export function TPMIndexHOC(WrappedComponent) { } ` } + +
this.initCommonState(user)} @@ -440,6 +464,7 @@ export function TPMIndexHOC(WrappedComponent) { +
); } From 639f07cea42d4d5216af386bba7f3ee265ddafa5 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 22 Aug 2019 15:53:28 +0800 Subject: [PATCH 03/52] esc --- public/react/src/modules/tpm/TPMIndexHOC.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 820451525..146582f76 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -135,7 +135,18 @@ export function TPMIndexHOC(WrappedComponent) { }) } + keyupListener = (e) => { + if (e.key === "Escape") { + this.setState({ slowDownloading: false }) + } + } + componentWillUnmount() { + window.removeEventListener('keyup', this.keyupListener) + } + componentDidMount() { + window.addEventListener('keyup', this.keyupListener) + if(this.props.match.path==="/"){ document.title="创新源于实践"; }else if(this.props.match.path==="/403"){ From 4d677358c0644c4370fd1ddd0ff9e062f1ee5c11 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 22 Aug 2019 16:03:39 +0800 Subject: [PATCH 04/52] noti --- public/react/src/modules/courses/members/studentsList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index 76112692a..8a1f1f5cc 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -149,7 +149,7 @@ class studentsList extends Component{ }) } }else { - this.props.showNotification(`正在下载中`); + // this.props.showNotification(`正在下载中`); // getUrl() + "/api"+ const fileUrl = url; From 2c3fd0aac9a8b602c8ec9f19c8fbd121d6a850c8 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 27 Aug 2019 15:32:19 +0800 Subject: [PATCH 05/52] =?UTF-8?q?spin=20=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMIndexHOC.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 9091aac5b..f1c9d5253 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -421,7 +421,7 @@ export function TPMIndexHOC(WrappedComponent) { slowDownload: this.slowDownload } return ( -
+
{isRender===true ? this.hideLoginDialog()} {...this.props} @@ -454,9 +454,25 @@ export function TPMIndexHOC(WrappedComponent) { -moz-box-shadow: 0px 0px 12px rgba(0,0,0,0.1); box-shadow: 0px 0px 12px rgba(0,0,0,0.1); } + + .globalSpin { + + } + .indexHOC > .ant-spin-nested-loading { + background: #000; + } + + .globalSpin .ant-spin-text { + text-shadow: none !important; + color: #fff; + } + .globalSpin .ant-spin-dot-item { + background-color: #fff; + } ` } - From cbd349777d6bc13751c3d7daff7554938422ee08 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 28 Aug 2019 09:14:19 +0800 Subject: [PATCH 06/52] focus --- public/react/src/modules/forums/MemoDetailMDEditor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/forums/MemoDetailMDEditor.js b/public/react/src/modules/forums/MemoDetailMDEditor.js index 00a87274d..86b95e629 100644 --- a/public/react/src/modules/forums/MemoDetailMDEditor.js +++ b/public/react/src/modules/forums/MemoDetailMDEditor.js @@ -52,6 +52,7 @@ class MemoDetailMDEditor extends Component { errorMsg: '' }) }) + commentMDEditor.cm.focus() }, { watch: false, dialogLockScreen: false, @@ -119,7 +120,7 @@ class MemoDetailMDEditor extends Component { this.initMDEditor() } else { setTimeout(() => { - this.commentMDEditor.focus() + this.commentMDEditor.cm.focus() }, 10) } } From ed55567b4ec37d6ef294986d03ab5ef787bf380b Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 28 Aug 2019 09:31:29 +0800 Subject: [PATCH 07/52] title --- public/react/src/modules/courses/members/teacherList.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js index e3fd4a98d..09108f043 100644 --- a/public/react/src/modules/courses/members/teacherList.js +++ b/public/react/src/modules/courses/members/teacherList.js @@ -126,7 +126,9 @@ function buildColumns(that) { sortOrder: sortedInfo.columnKey === 'graduation_group' && sortedInfo.order, render: text => ( - + 10 ? title : ''}`} + > {text} ), From b5dd35302b8d8069f4de16670ada33fc23276d65 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 28 Aug 2019 11:18:04 +0800 Subject: [PATCH 08/52] =?UTF-8?q?=E5=AD=A6=E5=8F=B7=E5=88=97=E4=B9=9F?= =?UTF-8?q?=E5=8F=82=E4=B8=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/busyWork/CommonWorkList.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index d6c3d8946..a489e7c3d 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -108,7 +108,7 @@ function buildColumns(that, student_works, studentData) { }] if (!niPingAndIsStudent && isAdminOrStudent) { columns.push({ - width: 88, + width: isStudent ? undefined : 88, title: '学号', dataIndex: 'student_id', key: 'student_id', @@ -197,7 +197,7 @@ function buildColumns(that, student_works, studentData) { )}, }, { - width: 106, + width: 106, // isStudent ? undefined : 106 , // 匿评中 只有这几列: 序号 姓名 提交状态 更新时间 匿评评分 操作 title: '更新时间', dataIndex: 'update_time', key: 'update_time', From f70758c62194ee7624f401d3ea0770eb73c780ab Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Thu, 29 Aug 2019 15:56:06 +0800 Subject: [PATCH 09/52] =?UTF-8?q?MD=E6=B8=B2=E6=9F=93=E5=90=8E=E6=AE=B5?= =?UTF-8?q?=E8=90=BD=E7=9A=84=E8=A1=8C=E9=AB=98=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/react/src/App.css b/public/react/src/App.css index 2b3d8d08c..42e40f8c8 100644 --- a/public/react/src/App.css +++ b/public/react/src/App.css @@ -55,6 +55,9 @@ html, body { .markdown-body p { white-space: pre-wrap; } +.markdown-body > p { + line-height: 25px; +} /* https://www.educoder.net/courses/2346/group_homeworks/34405/question */ .renderAsHtml.markdown-body p { white-space: inherit; From b39b97fe9caa39c65dcb9bf9ff73f3f6a17123ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 29 Aug 2019 17:05:18 +0800 Subject: [PATCH 10/52] b --- public/react/src/modules/courses/members/studentsList.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index 5ae3c3c9d..2dfaa4336 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -609,8 +609,8 @@ class studentsList extends Component{ `} { isAdmin && - -
  • + +
  • 导出