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)