Merge branches 'dev_Ysm' and 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_Ysm

dev_aliyun_beta
杨树明 6 years ago
commit 472dac3029

@ -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
});

@ -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) {

@ -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) {
</span>
)},
}, {
width: 106,
width: 106, // isStudent ? undefined : 106 , // 匿评中 只有这几列: 序号 姓名 提交状态 更新时间 匿评评分 操作
title: '更新时间',
dataIndex: 'update_time',
key: 'update_time',

@ -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)

@ -126,7 +126,9 @@ function buildColumns(that) {
sortOrder: sortedInfo.columnKey === 'graduation_group' && sortedInfo.order,
render: text => (
<span>
<span className="overflowHidden1" style={{ maxWidth: '160px'}}
title={`${text && text.length > 10 ? title : ''}`}
>
{text}
</span>
),

@ -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)
}
}

@ -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 (
<div>
<div className="indexHOC">
{isRender===true ? <LoginDialog
Modifyloginvalue={()=>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;
}
`
}</style>
<Spin spinning={this.state.slowDownloading} delay={0} className="globalSpin"
size="large"
tip= {this._slowDownloadTip || "加载中..."}
>
<NewHeader {...this.state} {...this.props}></NewHeader>
<div className="newContainer newContainers">
<WrappedComponent initCommonState={(user)=>this.initCommonState(user)}
@ -440,6 +491,7 @@ export function TPMIndexHOC(WrappedComponent) {
<NewFooter
Footerdown={Footerdown}
/>
</Spin>
</div>
);
}

Loading…
Cancel
Save