diff --git a/public/react/src/modules/courses/ListPageIndex.js b/public/react/src/modules/courses/ListPageIndex.js index a93b8de47..538281620 100644 --- a/public/react/src/modules/courses/ListPageIndex.js +++ b/public/react/src/modules/courses/ListPageIndex.js @@ -33,10 +33,6 @@ const CourseGroupList = Loadable({ loading: Loading, }); -const Signinmain = Loadable({ - loader: () => import('./signin/mymain/Signinmain'), - loading: Loading, -}); const Eduinforms = Loadable({ loader: () => import('./gradinforms/Eduinforms'), @@ -258,12 +254,6 @@ class ListPageIndex extends Component { (props) => () } > - {/* 主签到 */} - () - } - > { - if (response.data) { - let updata = response.data; - this.setState({ - updata: updata - }) - } - }).catch((error) => { - console.log(error); - }) - let url = `/home/index.json`; - axios.get(url).then((response) => { - if (response.status === 200) { - this.setState({ - homedatalist: response.data, - hometypepvisible: false - }) - } - }).catch((error) => { - // console.log(error) - }); - } - - bannaronmousemove = () => { - $("#bannerrightimg").show(); - $("#bannerleftimg").show(); - } - - bannaronmouseout = () => { - $("#bannerrightimg").hide(); - $("#bannerleftimg").hide(); - } - render() { - - let { homedatalist, hometypepvisible } = this.state; - - const arrowStylel = { - left: "-76px", - width: "76px", - textAlign: "left", - height: "100%", - cursor: "pointer" - }; - - const arrowStyler = { - right: "-120px", - width: "76px", - textAlign: "left", - height: "100%", - cursor: "pointer" - }; - const noneStyler = { - display: "none" - } - const CustomNextArrow = props => { - return ( -
- -
- ); - }; - - const CustomPrevArrow = props => { - return ( -
- -
- ); - }; - - let homedatalistreps; - - if (homedatalist != undefined) { - homedatalistreps = []; - homedatalist.reps.map((item, key) => { - homedatalistreps.push(item) - }) - - } - const MyRate = ({ defaultValue, ...rest }) => { - let myValue = defaultValue; - return ; - }; - - let shixuntype = false; - let pathstype = false; - if (this.props && this.props.mygetHelmetapi != null) { - let shixun = "/shixuns"; - let paths = "/paths"; - this.props.mygetHelmetapi.navbar.map((item, key) => { - var reg = RegExp(item.link); - if (shixun.match(reg)) { - if (item.hidden === true) { - shixuntype = true - } - } - if (paths.match(reg)) { - if (item.hidden === true) { - pathstype = true - } - } - }) - } - - - return ( -
- {this.state.updata === undefined ? "" : } - - {/*懒加载*/} - - {/**/} -
- -
-
- {homedatalist === undefined ? "" : - } - prevArrow={} - autoplay - autoplaySpeed={5000} - animation={false} - pauseOnHover={true} - style={{ width: "100%" }} - arrowPos="outer"> - {homedatalist.images_url.map((item, index) => ( -
- - - -
- ))} -
- } - {this.props.user && this.props.user.main_site === true ? -
-
-
    - {homedatalist === undefined ? "" : homedatalistreps.map((item, key) => { - return ( -
  • - - - {item.name} - - - -
      - { - item.sub_repertoires.map((i, k) => { - return ( -
      -
      - - {i.name} - -
      - { - i.tags.map((t, e) => { - return ( - {t.name} - ) - }) - } - -
      - - ) - }) - } -
    -
  • - ) - }) - - } -
-
-
: ""} -
- -
- - {/*实训路径*/} - {pathstype === true || homedatalist === undefined ? "" : homedatalist.subjects.length === 0 ? "" :
-
-

实践课程

-

TRAINING COURSE

-
- 更多 - -
- - - {homedatalist === undefined ? "" : homedatalist.subjects.map((item, key) => { - if (key < 8) - return ( -
- - {item.excellent === false ? "" : -
- 开放课程 -
} - -
- {item.tag_name} - {/**/} -
- -
- -

非试用内容,需要授权

-
- - - - - -
-

- - {item.name} - -

- -

- - - {item.stages_count} - - - - {/**/} - {/**/} - {/*{item.shixuns_count}*/} - {/**/} - {/**/} - - - - {item.members_count} - - - {item.level} - -

- -
-
- ) - }) - } - -
-
} - - {/*精选实训 改为 开发社区*/} - {shixuntype === true || homedatalist === undefined ? "" : homedatalist.shixuns.length === 0 ? "" : -
-
-

实训项目

-

DEVELOPMENT COMMUNITY

-
- 更多 - -
- - {homedatalist === undefined ? "" : homedatalist.shixuns.map((item, key) => { - return ( -
- -
- {item.tag_name} - {/**/} -
- { - item.is_jupyter === true ? -
-

Jupyter

- {/**/} -
- : ""} -
- -

非试用内容,需要授权

-
- - - - - -
-

- - {item.name} - -

- -

- - - - {item.score_info === null ? "5分" : item.score_info + "分"} -

- -

- - - - {item.challenges_count} - - - - - - - {item.stu_num} - - - - {item.level} -

- -
-
- ) - }) - } - - -
-
} - -
-
-
- ); - } -} - -export default SnackbarHOC()(TPMIndexHOC(ShixunsHome)); diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index d9e43da97..6eb1aaeab 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -5,7 +5,6 @@ import NewFooter from './NewFooter' import SiderBar from './SiderBar' import { downloadFile } from 'educoder' import axios from 'axios'; -import { Spin } from 'antd'; import './TPMIndex.css'; import LoginDialog from '../login/LoginDialog'; import AccountProfile from '../user/AccountProfile'; @@ -50,7 +49,7 @@ export default function TPMIndexHOC(WrappedComponent) { Footerdown: undefined, coursedata: {}, - isRender: false, + isRender: true, AccountProfiletype: false, AccountPhoneemailtype: false, globalLoading: false, diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js index 8ec401f09..3ab3e70fd 100644 --- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js +++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js @@ -744,10 +744,4 @@ class Newshixuns extends Component { const NewshixunsNew = Form.create({ name: 'newshixun' })(Newshixuns); -export default SnackbarHOC()(TPMIndexHOC(NewshixunsNew)); - - - - - - +export default SnackbarHOC()(TPMIndexHOC(NewshixunsNew)); \ No newline at end of file diff --git a/public/react/src/modules/tpm/newshixuns/oldNewshixuns.js b/public/react/src/modules/tpm/newshixuns/oldNewshixuns.js deleted file mode 100644 index 85b4ea798..000000000 --- a/public/react/src/modules/tpm/newshixuns/oldNewshixuns.js +++ /dev/null @@ -1,1356 +0,0 @@ -import React, { Component } from 'react'; - -import TPMIndexHOC from '../TPMIndexHOC'; - -import { SnackbarHOC, appendFileSizeToUploadFileAll, getUploadActionUrl } from 'educoder'; - -import { Input, Select, Radio, Checkbox, Modal, Icon, DatePicker, Upload, Button, message, Form, notification, Tooltip } from 'antd'; - -// import "antd/dist/antd.css"; - -import locale from 'antd/lib/date-picker/locale/zh_CN'; - -import axios from 'axios'; - -import './css/Newshixuns.css'; - -import { getUrl } from 'educoder' - -import moment from 'moment'; - -let path = getUrl("/editormd/lib/") - -const $ = window.$; - -let timeout; - -let currentValue; - -const Option = Select.Option; - -const RadioGroup = Radio.Group; -const confirm = Modal.confirm; - - -// 处理整点 半点 -// 取传入时间往后的第一个半点 -export function handleDateStrings(dateString) { - if (!dateString) return dateString; - const ar = dateString.split(':') - if (ar[1] == '00' || ar[1] == '30') { - return dateString - } - const miniute = parseInt(ar[1]); - if (miniute < 30 || miniute == 60) { - return [ar[0], '30'].join(':') - } - if (miniute < 60) { - // 加一个小时 - const tempStr = [ar[0], '00'].join(':'); - const format = "YYYY-MM-DD HH:mm"; - const _moment = moment(tempStr, format) - _moment.add(1, 'hours') - return _moment.format(format) - } - - return dateString -} - - - -// 恢复数据 -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) { - $("#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, callback) { - var editorName = window.editormd(id, { - width: width, - height: high, - path: path, // "/editormd/lib/" - - syncScrolling: "single", - tex: true, - tocm: true, - emoji: true, - taskList: true, - codeFold: true, - searchReplace: true, - htmlDecode: "style,script,iframe", - sequenceDiagram: true, - autoFocus: false, - 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, - placeholder: placeholder, - 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 - 3); - editorName.cm.focus(); - }); - $("[type=\"inline\"]").attr("title", "行内公式"); - $("[type=\"latex\"]").attr("title", "多行公式"); - - md_elocalStorage(editorName, `memoNew_${id}`, "memoNew"); - - callback && callback() - } - }); - return editorName; -} - -function range(start, end) { - const result = []; - for (let i = start; i < end; i++) { - result.push(i); - } - return result; -} -function disabledDateTime() { - return { - // disabledHours: () => range(0, 24).splice(4, 20), - disabledMinutes: () => range(1, 30).concat(range(31, 60)), - // disabledSeconds: () => [0, 60], - }; -} - -function disabledDate(current) { - return current && current < moment().endOf('day').subtract(1, 'days'); -} -class Newshixuns extends Component { - constructor(props) { - super(props) - this.state = { - fileList: [], - newshixunlist: undefined, - departmentslist: undefined, - name: "", - main_type: "", - small_type: "", - trainee: "", - webssh: 0, - use_scope: 0, - can_copy: "", - scope_partment: undefined, - vnc: "", - scopetype: false, - postapplyvisible: false, - sendsure_applyvalue: undefined, - postapplytitle: false, - shixun_nametype: false, - main_types: false, - trainee_types: false, - SelectTheCommandtype: false, - opers: false, - operss: false, - TimePickervalue: "", - opensmail: false, - onSearchvalue: "", - scope_partmenttype: false, - languagewrite: undefined, - systemenvironment: undefined, - testcoderunmode: undefined, - file: undefined, - deleteisnot: true, - languagewritetype: false, - systemenvironmenttype: false, - testcoderunmodetype: false, - attachmentidstype: false, - datalisttype: false, - bottonloading: false - } - } - - initMD(initValue) { - this.contentChanged = false; - const placeholder = ""; - // amp; - // 编辑时要传memoId - const imageUrl = `getUploadActionUrl`; - // 创建editorMd - - const taskpass_editormd = create_editorMD("memoMD", '100%', 400, placeholder, imageUrl, () => { - setTimeout(() => { - taskpass_editormd.resize() - taskpass_editormd.cm && taskpass_editormd.cm.refresh() - }, 500) - - if (initValue) { - taskpass_editormd.setValue(initValue) - } - taskpass_editormd.cm.on("change", (_cm, changeObj) => { - // console.log('....contentChanged') - this.contentChanged = true; - }) - }); - this.taskpass_editormd = taskpass_editormd; - window.taskpass_editormd = taskpass_editormd; - - } - - componentDidMount() { - let newshixunUrl = `/shixuns/new.json`; - axios.get(newshixunUrl).then((response) => { - if (response.status === 200) { - if (response.data.message === undefined) { - this.setState({ - newshixunlist: response.data - }); - this.initMD(response.data.sample[0][1]); - } - - } - }).catch((error) => { - console.log(error) - }); - - let departmentsUrl = `/shixuns/departments.json`; - axios.get(departmentsUrl).then((response) => { - if (response.status === 200) { - if (response.data.message === undefined) { - this.setState({ - departmentslist: response.data.shools_name - }); - } - } - }).catch((error) => { - console.log(error) - }); - } - - setlanguagewrite = (e) => { - this.setState({ - languagewrite: e.target.value - }) - } - - setsystemenvironment = (e) => { - this.setState({ - systemenvironment: e.target.value - }) - } - settestcoderunmode = (e) => { - this.setState({ - testcoderunmode: e.target.value - }) - - } - shixunname = (e) => { - this.setState({ - name: e.target.value, - shixun_nametype: false - }); - } - - bigClass = (value) => { - this.setState({ - main_type: value - }) - } - - littleClass = (value) => { - this.setState({ - small_type: value - }) - } - - Selectthestudent = (value) => { - this.setState({ - trainee: value - }) - } - - SelectTheCommand = (e) => { - this.setState({ - webssh: e.target.value, - }); - - if (e.target.value === 2) { - this.setState({ - SelectTheCommandtype: true, - multi_webssh: false - }); - } else { - this.setState({ - SelectTheCommandtype: false, - multi_webssh: false - }); - } - } - - Selectpublic = (e) => { - this.setState({ - scopetype: false, - use_scope: e.target.value, - }); - if (e.target.value === 1) { - this.setState({ - scopetype: true - }); - } - - } - - Teacherscopy = (e) => { - let sum = "" - if (e.target.checked === false) { - sum = 0 - } else if (e.target.checked === true) { - sum = 1 - } - this.setState({ - can_copy: sum, - }); - } - - TeachersUbuntu = (e) => { - let sum = "" - if (e.target.checked === false) { - sum = 0 - } else if (e.target.checked === true) { - sum = 1 - } - this.setState({ - vnc: sum, - }); - } - - adduse_scopeinput = () => { - let { scope_partment } = this.state; - let array = scope_partment; - let newarray = "" - array.push(newarray) - this.setState({ - scope_partment: array, - }); - } - - shixunScopeInput = (e, id) => { - let types = false - let { scope_partment } = this.state; - let datalist = scope_partment; - if (datalist === undefined) { - datalist = [] - } - - datalist.map((item, key) => { - if (e === item) { - types = true - this.setState({ - datalisttype: true - }) - return - } - }) - - if (types === false) { - datalist.push(e) - this.setState({ - scope_partment: datalist, - onSearchvalue: "" - }); - } - - - } - - deleteScopeInput = (key) => { - let { scope_partment } = this.state; - let datalist = scope_partment; - datalist.splice(key, 1); - this.setState({ - scope_partment: datalist - }); - } - - //提交数据 - submit_new_shixun = () => { - const mdVal = this.taskpass_editormd.getValue(); - let { can_copy, main_type, name, scope_partment, small_type, trainee, use_scope, vnc, webssh, multi_webssh, TimePickervalue } = this.state; - let Url = `/shixuns.json` - if (name === "") { - this.setState({ - shixun_nametype: true - }) - this.props.showSnackbar("实训名称为空"); - $('html').animate({ - scrollTop: 10 - }, 1000); - return - } - if (main_type === "") { - this.setState({ - main_types: true - }) - $('html').animate({ - scrollTop: 700 - }, 1000); - this.props.showSnackbar("请选择技术平台大类别"); - - return - } - - if (use_scope === 1) { - if (scope_partment === undefined || scope_partment.length === 0) { - this.setState({ - scope_partmenttype: true - }) - $('html').animate({ - scrollTop: 900 - }, 1000); - this.props.showSnackbar("公开程度,指定单位为空"); - return - } - } - if (trainee === "") { - this.setState({ - trainee_types: true - }) - // $('html').animate({ - // scrollTop: 700 - // }, 1000); - this.props.showSnackbar("请选择发布信息"); - return - } - let newmulti_webssh = multi_webssh; - if (newmulti_webssh === true) { - newmulti_webssh = 1 - } else { - newmulti_webssh = "" - } - this.setState({ - bottonloading: true - }) - axios.post(Url, { - name: name, - can_copy: can_copy, - description: mdVal, - main_type: main_type, - scope_partment: scope_partment, - small_type: small_type, - trainee: trainee, - use_scope: use_scope, - vnc: vnc, - webssh: webssh, - multi_webssh: newmulti_webssh, - task_pass: 1, - opening_time: TimePickervalue - } - ).then((response) => { - if (response.status === 200) { - window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; - // window.open("/shixuns/"+response.data.shixun_identifier+"/challenges"); - } else { - this.setState({ - bottonloading: false - }) - } - }).catch((error) => { - console.log(error) - this.setState({ - bottonloading: false - }) - }) - } - - - shixunsfetch = (value, callback) => { - if (timeout) { - clearTimeout(timeout); - timeout = null; - } - currentValue = value; - - function fake() { - let departmentsUrl = `/shixuns/departments.json?q=` + currentValue; - axios.get(departmentsUrl).then((response) => { - if (response.data.message === undefined) { - callback(response.data.shools_name); - } - }).catch((error) => { - console.log(error) - }); - } - - timeout = setTimeout(fake, 300); - } - - shixunHandleSearch = (value) => { - - this.shixunsfetch(value, departmentslist => this.setState({ departmentslist })); - - this.setState({ - onSearchvalue: "" - }) - } - - post_apply = () => { - this.setState({ - postapplyvisible: true - }) - } - sendsure_apply = () => { - let { languagewrite, systemenvironment, testcoderunmode } = this.state; - // console.log("点击确定") - // console.log("languagewrite"+languagewrite); - // console.log("systemenvironment"+systemenvironment); - // console.log("testcoderunmode"+testcoderunmode); - - // let attachment_ids = undefined - // if (this.state.fileList) { - // attachment_ids = this.state.fileList.map(item => { - // return item.response ? item.response.id : item.id - // }) - // } - if (languagewrite === undefined || languagewrite === "") { - // this.props.showNotification(`请填写该镜像是基于什么语言`); - this.setState({ - languagewritetype: true - }) - return - } - if (systemenvironment === undefined || systemenvironment === "") { - // this.props.showNotification(`请填写该镜像是基于什么语言系统环境`); - this.setState({ - systemenvironmenttype: true - }) - return; - - } - if (testcoderunmode === undefined || testcoderunmode === "") { - // this.props.showNotification(`请填写该镜像中测试代码运行方式`); - this.setState({ - testcoderunmodetype: true - }) - return; - } - var attachment_ids = undefined; - if (this.state.fileList) { - attachment_ids = this.state.fileList.map(item => { - return item.response ? item.response.id : item.id - }) - } - - if (attachment_ids === undefined || attachment_ids.length === 0) { - - // notification.open( - // { - // message: '提示', - // description: - // '请上传附件!', - // - // } - // ) - this.setState({ - attachmentidstype: true - }) - return; - } - // console.log("attachment_ids"+attachment_ids); - - // alert(languagewrite +" "+systemenvironment +" "+testcoderunmode + " "+attachment_ids); - - var data = { - language: languagewrite, - runtime: systemenvironment, - run_method: testcoderunmode, - attachment_id: attachment_ids[0], - } - var url = `/shixuns/apply_shixun_mirror.json`; - axios.post(url, data - ).then((response) => { - - try { - if (response.data) { - // const { id } = response.data; - // if (id) { - if (this.state.file !== undefined) { - console.log("549"); - // this.deleteAttachment(this.state.file); - this.setState({ - file: undefined, - deleteisnot: true, - languagewrite: "", - systemenvironment: "", - testcoderunmode: "", - fileList: [] - }) - } else { - this.setState({ - file: undefined, - deleteisnot: true, - languagewrite: "", - systemenvironment: "", - testcoderunmode: "", - fileList: [] - }) - } - // this.props.showNotification('提交成功!'); - notification.open( - { - message: '提示', - description: - '提交成功!', - - } - ) - this.sendhideModaly() - // this.props.history.push(`/classrooms/${cid}/graduation_topics`); - // } - } - } catch (e) { - - } - - }) - - } - sendhideModaly = () => { - this.setState({ - postapplyvisible: false, - }) - if (this.state.file !== undefined) { - console.log("580"); - // this.deleteAttachment(this.state.file); - this.setState({ - file: undefined, - deleteisnot: true, - languagewrite: "", - systemenvironment: "", - testcoderunmode: "", - fileList: [] - }) - } else { - this.setState({ - file: undefined, - deleteisnot: true, - languagewrite: "", - systemenvironment: "", - testcoderunmode: "", - fileList: [] - }) - } - } - sendsure_applyvalues = (e) => { - this.setState({ - sendsure_applyvalue: e.target.value - }) - } - yeshidemodel = () => { - this.setState({ - postapplytitle: false - }) - } - - SelectTheCommandonChange = (e) => { - this.setState({ - multi_webssh: e.target.checked - }) - } - - - bigopen = (e) => { - this.setState({ - opers: true - }) - - } - - bigopens = (e) => { - this.setState({ - opers: false, - operss: false, - opensmail: false - }) - - } - - bigopensmal = (e) => { - this.setState({ - opensmail: true - }) - - } - - sbigopen = (e) => { - this.setState({ - operss: true - }) - - } - - // sbigopens=()=>{ - // this.setState({ - // operss:false - // }) - // } - - onChangeTimePicker = (value, dateString) => { - this.setState({ - TimePickervalue: dateString === "" ? "" : moment(handleDateStrings(dateString)) - }) - } - - // 附件相关 START - handleChange = (info) => { - if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { - let { fileList } = this.state; - - if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { - console.log("handleChange1"); - // if(fileList.length===0){ - let fileLists = info.fileList; - this.setState({ - // fileList:appendFileSizeToUploadFileAll(fileList), - fileList: fileLists, - deleteisnot: false - }); - // } - } - } - } - onAttachmentRemove = (file) => { - if (!file.percent || file.percent == 100) { - confirm({ - title: '确定要删除这个附件吗?', - okText: '确定', - cancelText: '取消', - // content: 'Some descriptions', - onOk: () => { - console.log("665") - this.deleteAttachment(file) - }, - onCancel() { - console.log('Cancel'); - }, - }); - return false; - } - - } - deleteAttachment = (file) => { - console.log(file); - let id = file.response == undefined ? file.id : file.response.id - const url = `/attachments/${id}.json` - axios.delete(url, { - }) - .then((response) => { - if (response.data) { - const { status } = response.data; - if (status == 0) { - // console.log('--- success') - - this.setState((state) => { - - const index = state.fileList.indexOf(file); - const newFileList = state.fileList.slice(); - newFileList.splice(index, 1); - return { - fileList: newFileList, - deleteisnot: true - }; - }); - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - - - handleSubmit = () => { - // console.log(this.state.languagewrite) - // console.log(this.state.systemenvironment) - // console.log(this.state.testcoderunmode) - var attachment_ids; - if (this.state.fileList) { - attachment_ids = this.state.fileList.map(item => { - return item.response ? item.response.id : item.id - }) - } - // console.log(attachment_ids); - // var data={ - // language:"", - // runtime:"", - // run_method:"", - // attachment_id:"", - // } - // axios.post(url,data - // ).then((response) => { - // if (response.data) { - // // const { id } = response.data; - // // if (id) { - // this.props.showNotification('提交成功!'); - // // this.props.history.push(`/classrooms/${cid}/graduation_topics`); - // // } - // } - // }) - - - - } - render() { - const { getFieldDecorator } = this.props.form; - let { testcoderunmode, systemenvironment, languagewrite, deleteisnot, fileList, TimePickervalue, scope_partmenttype, opensmail, newshixunlist, name, scope_partment, departmentslist, postapplyvisible, sendsure_applyvalue, postapplytitle, shixun_nametype, main_types, trainee_types, SelectTheCommandtype, opers, datalisttype, onSearchvalue } = this.state; - let options - if (departmentslist != undefined) { - options = this.state.departmentslist.map((d, k) => { - return ( - - ) - }) - } - const uploadProps = { - width: 600, - fileList, - multiple: true, - // https://github.com/ant-design/ant-design/issues/15505 - // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, - action: `${getUploadActionUrl()}`, - onChange: this.handleChange, - onRemove: this.onAttachmentRemove, - beforeUpload: (file, fileList) => { - - if (this.state.fileList.length >= 1) { - return false - } - // console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 50; - if (!isLt150M) { - // this.props.showNotification(`文件大小必须小于50MB`); - notification.open( - { - message: '提示', - description: - '文件大小必须小于50MB', - - } - ) - } - if (this.state.file !== undefined) { - console.log("763") - this.setState({ - file: file - }) - } else { - this.setState({ - file: file - }) - } - - console.log("handleChange2"); - return isLt150M; - }, - } - // const uploadProps = { - // width: 600, - // fileList, - // multiple: true, - // // https://github.com/ant-design/ant-design/issues/15505 - // // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // // showUploadList: false, - // action: `${getUrl()}/api/attachments.json`, - // onChange: this.handleChange, - // onRemove: this.onAttachmentRemove, - // beforeUpload: (file) => { - // // console.log('beforeUpload', file.name); - // const isLt50M = file.size / 1024 / 1024 < 50; - // if (!isLt50M) { - // this.props.showNotification('文件大小必须小于150MB!'); - // } - // return isLt50M; - // }, - // }; - - return ( - -
-
-
- -
-

- 创建实训 - {this.props.user && this.props.user.main_site === true ? 实训制作指南 : ""} -

- -
-

实训名称

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

简介

- -
-
- -
-
-

-

-
- -
-

技术平台

-
- * -
- -

- 列表中没有? - 申请新建 -

- - - {/*
*/} -
-
  • - - -
  • -
    {this.state.languagewritetype === true ? "请填写该镜像语言" : ""}
    -
  • - - -
  • -
    {this.state.systemenvironmenttype === true ? "请填写该镜像语言系统环境" : ""}
    -
  • - - - -
  • -
    {this.state.testcoderunmodetype === true ? "请填写该镜像测试代码运行方式" : ""}
    -
  • - -
    - - - 上传附件 - (单个文件50M以内) - - -
    - -
  • -
    - {this.state.attachmentidstype === true ? "请上传附件" : ""} -
    -
  • - this.sendhideModaly()} - >取消 - -
  • -
    -
    - {/*
    */} -
    - - - - -
    -

    新建申请已提交,请等待管理员的审核

    -
  • 我们将在1-2个工作日内与您联系 -
  • -
    -
    - 知道啦 -
    -
    -
    -
    -
    - -
    -

    请在配置页面完成后续的评测脚本设置操作

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

    命令行

    -
    - - 无命令行窗口 (选中则不给学员的实践任务提供命令窗口) - 命令行练习窗口 (选中则给学员提供用于练习操作的命令行窗口) - 命令行评测窗口 (选中则给学员提供用于关卡评测的命令行窗口) - - 多个命令行窗口(选中则允许学员同时开启多个命令行窗口) - - -
    -
    - - -
    -

    公开程度

    -
    - - 对所有公开 (选中则所有已被试用授权的用户可以学习) - 对指定单位公开 (选中则下方指定单位的已被试用授权的用户可以学习) - - -
    -
    -
    -
    -
    - -
    - (搜索选中添加单位名称) - {this.state.datalisttype === true ? 请勿选择重复单位 : ""} - {/*+ 添加*/} -
    -
    - -
    -
    - { - scope_partment === undefined ? "" : scope_partment.map((item, key) => { - return ( -
  • {item} - this.deleteScopeInput(key)}>× -
  • - ) - }) - } -
    - {/*{*/} - {/*scope_partment===undefined?"":scope_partment.map((item,key)=>{*/} - {/*return(*/} - {/*
    */} - {/*this.deleteScopeInput(key)} style={{ color: 'rgba(0,0,0,.25)' }} />}*/} - {/*value={item}*/} - {/*/>*/} - {/*
    */} - - {/*)*/} - {/*})*/} - {/*}*/} -
    - - - - 请选择需要公开的单位 - -
    -
    -
    -
    - - -
    -

    发布信息

    -
    -
    - *面向学员: -
    - -
    - 实训难易度定位,不限定用户群体 -
    - 必填项 -
    -
    -
    -
  • - 复制: - - -
  • -
    - 开启时间: -
  • - - -
  • -
    -
    - {/*
    */} - {/*

    VNC图形化

    */} - {/*
  • */} - {/**/} - {/**/} - {/*
  • */} - {/*
    */} - - -
    - - 取消 -
    - - -
    -
    -
    - - ); - } -} -const NewshixunsNew = Form.create({ name: 'newshixunsnew' })(Newshixuns); -export default SnackbarHOC()(TPMIndexHOC(NewshixunsNew)); - - - - - -