diff --git a/public/react/src/common/TextUtil.js b/public/react/src/common/TextUtil.js index 74cdef3e6..4c445dcbf 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) { @@ -41,7 +41,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/common/UrlTool.js b/public/react/src/common/UrlTool.js index 12505186a..3d3053805 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/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', diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index 3726704cb..070d96b84 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -7,8 +7,7 @@ import CourseLayoutcomponent from '../common/CourseLayoutComponent' import Titlesearchsection from '../common/titleSearch/TitleSearchSection' import ColorCountText from '../common/titleSearch/ColorCountText' - -import { WordsBtn, trigger, on, off ,downloadFile} from 'educoder' +import { WordsBtn, trigger, on, off, getUrl, downloadFile } from 'educoder' import Modals from "../../modals/Modals"; import axios from 'axios' import _ from 'lodash' @@ -151,10 +150,19 @@ class studentsList extends Component{ }) } }else { - this.props.showNotification(`正在下载中`); - window.open("/api"+url, '_blank'); + + // this.props.showNotification(`正在下载中`); + // window.open("/api"+url, '_blank'); + this.props.slowDownload(url) + + // getUrl() + "/api"+ + // const fileUrl = url; + + // this.props.slowDownload(fileUrl) + // return; + // downloadFile({ - // url: url, + // url: fileUrl, // successCallback: (url) => { // console.log('successCallback') // }, @@ -162,6 +170,7 @@ class studentsList extends Component{ // console.log('failCallback') // } // }) + // window.open(fileUrl, "_self");// , '_blank' } }).catch((error) => { console.log(error) 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} ), diff --git a/public/react/src/modules/forums/MemoDetailMDEditor.js b/public/react/src/modules/forums/MemoDetailMDEditor.js index c48dd04c9..78aa54182 100644 --- a/public/react/src/modules/forums/MemoDetailMDEditor.js +++ b/public/react/src/modules/forums/MemoDetailMDEditor.js @@ -57,6 +57,7 @@ class MemoDetailMDEditor extends Component { errorMsg: '' }) }) + commentMDEditor.cm.focus() }, { watch: false, dialogLockScreen: false, @@ -124,7 +125,7 @@ class MemoDetailMDEditor extends Component { this.initMDEditor() } else { setTimeout(() => { - this.commentMDEditor && this.commentMDEditor.focus() + this.commentMDEditor && this.commentMDEditor.cm.focus() }, 10) } } diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 1166e94cf..f1c9d5253 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 } } @@ -133,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"){ @@ -364,6 +377,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,10 +416,12 @@ 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 ( -
+
{isRender===true ? this.hideLoginDialog()} {...this.props} @@ -423,8 +454,28 @@ 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; + } ` } + +
this.initCommonState(user)} @@ -440,6 +491,7 @@ export function TPMIndexHOC(WrappedComponent) { +
); }