diff --git a/public/react/package.json b/public/react/package.json
index 19b8286d9..5aebf0d41 100644
--- a/public/react/package.json
+++ b/public/react/package.json
@@ -3,10 +3,9 @@
"version": "0.1.0",
"private": true,
"dependencies": {
- "@novnc/novnc": "^1.1.0",
-
"@flatten/array": "^1.1.7",
"@icedesign/base": "^0.2.5",
+ "@novnc/novnc": "^1.1.0",
"antd": "^3.6.5",
"array-flatten": "^2.1.2",
"autoprefixer": "7.1.6",
@@ -41,6 +40,7 @@
"fs-extra": "3.0.1",
"html-webpack-plugin": "2.29.0",
"immutability-helper": "^2.6.6",
+ "install": "^0.12.2",
"jest": "20.0.4",
"js-file-download": "^0.4.7",
"lodash": "^4.17.5",
diff --git a/public/react/public/css/edu-all.css b/public/react/public/css/edu-all.css
index 9b9bf6960..e1a4640c8 100644
--- a/public/react/public/css/edu-all.css
+++ b/public/react/public/css/edu-all.css
@@ -296,7 +296,7 @@ label.infolabel{display: block;float: left;width: 56px;text-align: right;margin-
.subshaicontent a{float: left;margin-right: 20px;color: #999;cursor: pointer}
-.search-new{width: 248px;height:32px;position: relative}
+.search-new{width: 248px;height:32px;position: relative;margin-right: 35px;}
.search-span{display: block;position: absolute;width: 100%;height: 100%;left:0px;top:0px;background-color: #F4F4F4;border: 1px solid #EAEAEA; border-radius: 4px;z-index: 1}
.search-new-input{height: 32px;padding-left: 5px;width: 225px;border: none;box-sizing: border-box;background: none;outline: none;position: absolute;left:0px;top:1px;z-index: 2}
.search-new img,.search-new a,.search-new .searchicon{cursor: pointer;position: absolute;right:2px;top:2px;z-index: 2}
diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js
index 9ebc54de8..61ab83126 100644
--- a/public/react/src/AppConfig.js
+++ b/public/react/src/AppConfig.js
@@ -4,6 +4,7 @@ import axios from 'axios';
import { requestProxy } from "./indexEduplus2RequestProxy";
import { broadcastChannelOnmessage } from 'educoder'
import { notification } from 'antd';
+import './index.css'
broadcastChannelOnmessage('refreshPage', () => {
window.location.reload()
})
@@ -30,8 +31,7 @@ export function initAxiosInterceptors(props) {
// proxy = "http://testbdweb.trustie.net"
// proxy = "http://testbdweb.educoder.net"
proxy = "https://testeduplus2.educoder.net"
- proxy = "http://47.96.87.25:48080"
-
+ //proxy="http://47.96.87.25:48080"
// 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求;
// 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制
@@ -115,7 +115,9 @@ export function initAxiosInterceptors(props) {
notification.open({
message:"提示",
description: response.data.message || '服务器异常,请联系管理员。',
-
+ style: {
+ zIndex: 99999999
+ },
});
// notification['error']({
// message:"提示",
diff --git a/public/react/src/common/Const.js b/public/react/src/common/Const.js
index ed90302e3..f680cb78d 100644
--- a/public/react/src/common/Const.js
+++ b/public/react/src/common/Const.js
@@ -1,7 +1,19 @@
+/**
+EDU_ADMIN = 1 # 超级管理员
+EDU_BUSINESS = 2 # 运营人员
+EDU_SHIXUN_MANAGER = 3 # 实训管理员
+EDU_SHIXUN_MEMBER = 4 # 实训成员
+EDU_CERTIFICATION_TEACHER = 5 # 平台认证的老师
+EDU_GAME_MANAGER = 6 # TPI的创建者
+EDU_TEACHER = 7 # 平台老师,但是未认证
+EDU_NORMAL = 8 # 普通用户
+*/
+
export const EDU_ADMIN = 1 // 超级管理员
-export const EDU_SHIXUN_MANAGER = 2 // 实训管理员
-export const EDU_SHIXUN_MEMBER = 3 // 实训成员
-export const EDU_CERTIFICATION_TEACHER = 4 // 平台认证的老师
-export const EDU_GAME_MANAGER = 5 // TPI的创建者
-export const EDU_TEACHER = 6 // 平台老师,但是未认证
-export const EDU_NORMAL = 7 // 普通用户
\ No newline at end of file
+export const EDU_BUSINESS = 2 // # 运营人员
+export const EDU_SHIXUN_MANAGER = 3 // 实训管理员
+export const EDU_SHIXUN_MEMBER = 4 // 实训成员
+export const EDU_CERTIFICATION_TEACHER = 5 // 平台认证的老师
+export const EDU_GAME_MANAGER = 6 // TPI的创建者
+export const EDU_TEACHER = 7 // 平台老师,但是未认证
+export const EDU_NORMAL = 8 // 普通用户
\ No newline at end of file
diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js
index c77d42908..2088918da 100644
--- a/public/react/src/common/educoder.js
+++ b/public/react/src/common/educoder.js
@@ -24,7 +24,7 @@ export { toStore as toStore, fromStore as fromStore } from './Store'
export { trace_collapse, trace, debug, info, warn, error, trace_c, debug_c, info_c, warn_c, error_c } from './LogUtil'
-export { EDU_ADMIN, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER
+export { EDU_ADMIN, EDU_BUSINESS, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER
, EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from './Const'
export { ModalHOC } from './components/ModalHOC'
diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js
index d5d8715f5..60d63a1bd 100644
--- a/public/react/src/context/TPIContextProvider.js
+++ b/public/react/src/context/TPIContextProvider.js
@@ -1,867 +1,882 @@
-import React, { Component } from 'react';
-import ReactDOM from 'react-dom';
-
-import axios from 'axios';
-import Snackbar from 'material-ui/Snackbar';
-import Fade from 'material-ui/transitions/Fade';
-
-import update from 'immutability-helper'
-
-import Dialog, {
- DialogActions,
- DialogContent,
- DialogContentText,
- DialogTitle,
-} from 'material-ui/Dialog';
-
-import Button from 'material-ui/Button';
-
-import EvaluateSuccessEffectDisplay from './EvaluateSuccessEffectDisplay'
-
-import _ from 'lodash'
-
-/*
- 若干js库
- http://inorganik.github.io/countUp.js/
-
-*/
-/*
- 切下一关需要更新:
- LeftViewContainer state.gameAnswer
-*/
-
-import TPIContext from './TPIContext'
-import { EDU_ADMIN, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER
- , EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from 'educoder'
-import { MuiThemeProvider, createMuiTheme, withStyles } from 'material-ui/styles';
-import MUIDialogStyleUtil from '../modules/page/component/MUIDialogStyleUtil'
-
-const styles = MUIDialogStyleUtil.getTwoButtonStyle()
-
-// 主题自定义
-const theme = createMuiTheme({
- palette: {
- primary: {
- main: '#4CACFF',
- contrastText: 'rgba(255, 255, 255, 0.87)'
- },
- secondary: { main: '#4CACFF' }, // This is just green.A700 as hex.
- },
-});
-
-const testSetsExpandedArrayInitVal = [false, false, false, false, false,
- false, false, false, false, false,
- false, false, false, false, false,
- false, false, false, false, false]
-window.__fetchAllFlag = false; // 是否调用过fetchAll TODO 如何多次使用provider?
-class TPIContextProvider extends Component {
- constructor(props) {
- super(props)
- this.onRunCodeTestFinish = this.onRunCodeTestFinish.bind(this)
- this.onRunChooseTestFinish = this.onRunChooseTestFinish.bind(this)
- this.testSetUnlock = this.testSetUnlock.bind(this)
-
- this.onTestSetHeaderClick = this.onTestSetHeaderClick.bind(this)
-
- this.onShowPrevStage = this.onShowPrevStage.bind(this)
- this.onShowNextStage = this.onShowNextStage.bind(this)
-
- this.readGameAnswer = this.readGameAnswer.bind(this)
- this.praisePlus = this.praisePlus.bind(this)
-
- this.onGamePassed = this.onGamePassed.bind(this)
-
- this.onPathChange = this.onPathChange.bind(this)
-
- this.showSnackbar = this.showSnackbar.bind(this)
- this.showDialog = this.showDialog.bind(this)
-
- this.onShowUpdateDialog = this.onShowUpdateDialog.bind(this)
- this.updateDialogClose = this.updateDialogClose.bind(this)
-
- // this.showEffectDisplay();
-
- this.state = {
- loading: true, // 正在加载数据
- gDialogOpen: false,
- currentGamePassed: false, // 当前game评测通过
- currentPassedGameGainGold: 0, // 当前通过的game获得的金币数
- currentPassedGameGainExperience: 0, // 当前通过的game获得的经验数
-
- user: {},
- challenge: {},
- shixun_name: '',
- hide_code: false,
-
- showUpdateDialog: false,
-
- testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0),
- }
- }
-
- showEffectDisplay = (data) => {
- const dom = document.getElementById('picture_display');
- window.$(dom).show();
- ReactDOM.render(, dom);
- }
-
- onShowUpdateDialog() {
- this.setState({showUpdateDialog: true})
- }
- // updateNowSuccess true 立即更新成功
- // TODO updateDialogClose方法名不对, 改为updateDialogCallback
- updateDialogClose(nextUpdateSuccess, updateNowSuccess) {
- const { myshixun } = this.state;
- if (nextUpdateSuccess) {
- myshixun.system_tip = true;
- }
- let { tpm_cases_modified, tpm_modified, tpm_script_modified } = this.state;
- if (updateNowSuccess) {
- tpm_cases_modified = false;
- tpm_modified = false;
- tpm_script_modified = false;
- }
- this.setState({
- myshixun,
- tpm_cases_modified,
- tpm_modified,
- tpm_script_modified,
- showUpdateDialog: false
- })
- }
-
- componentWillUnmount() {
- this.costTimeInterval && window.clearInterval(this.costTimeInterval)
- }
- componentDidMount() {
-
- // TODO 登录状态的判断?
- // request
- // var shixunId = this.props.match.params.shixunId;
- var stageId = this.props.match.params.stageId;
-
- window.__fetchAllFlag = false;
- this.fetchAll(stageId);
-
- this.costTimeInterval = window.setInterval(()=> {
- const { game } = this.state;
- if (!game || game.status === 2) { // 已完成的任务不需要计时
- return;
- }
- if (game.cost_time || game.cost_time === 0) {
- // game.cost_time += 1;
- this.setState({
- game: update(game, {cost_time: { $set: (game.cost_time+1) }})
- })
- }
- }, 1000)
-
- // 页面离开时存下用户的任务耗时
-
- window.$(window).unload( ()=>{
- this._updateCostTime();
- });
- }
- // force 评测通过后,异步执行该方法,强制同步costTime到服务端
- _updateCostTime(async = false, force) {
- const { game, loading } = this.state;
- // TODO 还有一种情况,通关后cost_time计时停止,没法通过这个判断
- if (!force && (loading || !game || game.status === 2)) {
- return; // 已完成的任务不需要处理
- }
- let testPath = ''
- if (window.location.port == 3007) {
- testPath = 'https://testeduplus2.educoder.net'
- }
- // var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time`
- var url = `${testPath}/api/tasks/${ game.identifier }/cost_time`
- window.$.ajax({
- type: 'get',
- url: url,
- async: async, //IMPORTANT, the call will be synchronous
- data: {
- time: game.cost_time
- }
- }).done((data) => {
- console.log('complete');
- });
- }
-
- onGamePassed(passed) {
- const { game } = this.state
- // 随便给个分,以免重新评测时又出现评星组件(注意:目前game.star没有显示在界面上,如果有则不能这么做)
- // game.star = 6;
- this.setState({
- game: update(game, {star: { $set: 6 }}),
- currentGamePassed: !!passed
- })
- }
- onTestSetHeaderClick(index) {
- // let { testSetsExpandedArray } = this.state;
- let testSetsExpandedArray;
- // 一次只打开一个
- if (this.state.testSetsExpandedArray[index] === false) {
- testSetsExpandedArray = testSetsExpandedArrayInitVal.slice(0);
- } else {
- testSetsExpandedArray = this.state.testSetsExpandedArray.slice(0);
- }
- testSetsExpandedArray[index] = !testSetsExpandedArray[index];
- this.setState({
- testSetsExpandedArray,
- })
- }
-
- onShowPrevStage() {
-
- }
- onShowNextStage() {
- window.__fetchAllFlag = false;
- console.log('onShowNextStage.........')
- // this.fetchAll('vznhx7mctwfq')
- }
-
- componentWillReceiveProps(newProps, oldProps) {
- var newStageId = newProps.match.params.stageId;
- if (!this.props || newStageId !== this.props.match.params.stageId) {
- window.__fetchAllFlag = false;
- this.fetchAll(newStageId)
- }
- }
-
-
- // praise_tread/praise_plus?obj_id=569&obj_type=Challenge&horizontal=true&game_praise=true
- /*
- TODO 旧的接口在未登录时的返回值
- //获取登录页面地址
-var signinPath = '/';
-var htmlvalue = '
';
-pop_box_new(htmlvalue, 480, 182);
- */
- praisePlus() {
- const { challenge, game } = this.state;
- let praise = true;
- const url = `/tasks/${game.identifier}/plus_or_cancel_praise.json`
- // const url = `/praise_tread/praise_plus?obj_id=${challenge.id}&obj_type=Challenge&horizontal=${praise}&game_praise=true`
- axios.post(url)
- .then((response) => {
-
- if (response.data) {
- const { praise_count, praise } = response.data;
- // challenge.praise_count = praise_tread_count;
- // challenge.user_praise = praise;
- this.setState({ challenge: update(challenge,
- {
- praise_count: { $set: praise_count },
- user_praise: { $set: praise },
- })
- })
- }
-
- })
- .catch(function (error) {
- console.log(error);
- });
- }
-
- onPathChange(index) {
- let { challenge } = this.state;
- // challenge = Object.assign({}, challenge)
- // challenge.pathIndex = index;
- this.setState({
- challenge: update(challenge, {pathIndex: { $set: index }}),
- })
- // TODO load new path content
- }
-
- updateChallengePath = (path) => {
- const challenge = this.state.challenge;
- if (challenge.path === path) {
- return;
- }
- const { myshixun } = this.state;
- // myshixun.system_tip = false;
-
-
- challenge.path = path;
- const newChallenge = this.handleChallengePath(challenge);
- this.setState({ challenge: newChallenge,
- myshixun: update(myshixun, {system_tip: { $set: false }}),
- })
- }
-
- handleChallengePath(challenge) {
- if (challenge.path && typeof challenge.path === "string") { // 多path的处理
- let path = challenge.path.split(';');
- _.remove(path, (item)=> !item)
- if (path.length > 1) {
- challenge.path = path;
- challenge.multiPath = true;
- } else {
- challenge.path = challenge.path.replace(';', '').trim() // 多path 改为单path 出现了 aaa.java;的情况
- challenge.multiPath = false;
- }
- }
- challenge.pathIndex = 0;
- return challenge;
- }
-
- newResData2OldResData(newResData) {
- newResData.latest_output = newResData.last_compile_output
- // newResData.power
- newResData.record = newResData.record_onsume_time
-
- // 老版用的hide_code
- newResData.hide_code = newResData.shixun.hide_code;
-
- newResData.image_url = newResData.user.image_url
- newResData.grade = newResData.user.grade
- newResData.user_url = newResData.user.user_url
- newResData.username = newResData.user.name
-
- newResData.output_sets = {}
- // newResData.output_sets.had_test_count = newResData.test_sets_count
- newResData.output_sets.test_sets = newResData.test_sets // JSON.stringify()
- newResData.output_sets.test_sets_count = newResData.test_sets_count
- // newResData.output_sets.had_passed_testsests_error_count = newResData.sets_error_count
- newResData.output_sets.had_passed_testsests_error_count = newResData.test_sets_count
- - newResData.sets_error_count
- // allowed_hidden_testset
- // sets_error_count
- // test_sets_count
- // test_sets
- // had_passed_testsests_error_count
- // test_sets
- // test_sets
-
- return newResData
- }
- // 将若干数据重新组织一下
- _handleResponseData(resData_arg) {
- const resData = this.newResData2OldResData(Object.assign({}, resData_arg))
- let challenge = resData.challenge;
- challenge.isHtml = false;
- challenge.isWeb = false;
- challenge.isAndroid = false;
- challenge.showLanguagePictrue = false;
- challenge.hasAnswer = resData.has_answer;
-
- let output_sets = resData.output_sets;
- if (resData.st === 0) { // 代码题
- challenge = this.handleChallengePath(challenge)
-
- const mirror_name = (resData.mirror_name && resData.mirror_name.join)
- ? resData.mirror_name.join(';') : (resData.mirror_name || '');
- if (mirror_name.indexOf('Html') !== -1) {
- challenge.isHtml = true;
- challenge.showLanguagePictrue = true;
- } else if (mirror_name.indexOf('Web') !== -1 || mirror_name.indexOf('JFinal') !== -1) {
- challenge.isWeb = true;
- } else if (mirror_name.indexOf('Android') !== -1) {
- challenge.isAndroid = true;
- }
-
- if (output_sets && output_sets.test_sets && typeof output_sets.test_sets == 'string') {
- const test_sets_array = JSON.parse("[" + output_sets.test_sets + "]");
- output_sets.test_sets_array = test_sets_array;
- } else {
- output_sets.test_sets_array = output_sets.test_sets
- }
-
- } else { // 选择题
- // 选择题题干markdown初始化
- const $ = window.$
- window.setTimeout(()=>{
- var lens = $("#choiceRepositoryView textarea").length;
-
- for(var i = 1; i <= lens; i++){
- window.editormd.markdownToHTML("choose_subject_" + i, {
- htmlDecode: "style,script,iframe", // you can filter tags decode
- taskList: true,
- tex: true, // 数学公式
- // flowChart: true, // 默认不解析
- // sequenceDiagram: true // 默认不解析
- });
- }
- }, 400)
- }
- challenge.user_praise = resData.user_praise;
- challenge.praise_count = resData.praise_count;
- challenge.showWebDisplayButton = false;
- resData.challenge = challenge;
-
- // 将一些属性写到game上
- let game = resData.game;
- game.prev_game = resData.prev_game;
- game.next_game = resData.next_game;
- resData.game = game;
-
- const { tpm_cases_modified, tpm_modified, tpm_script_modified, myshixun } = resData;
- if (myshixun.system_tip) {
- // system_tip为true的时候 不弹框提示用户更新
- resData.showUpdateDialog = false
- } else {
- let needUpdateScript = (tpm_modified || tpm_script_modified) && challenge.st === 0;
- resData.showUpdateDialog = needUpdateScript || tpm_cases_modified
- }
-
- /**
- email: "721773699@qq.com"
- grade: 213996
- identity: 1
- image_url: "avatars/User/1"
- login: "innov"
- name: "Coder"
- user_url: "/users/innov"
- */
- let user = resData.user;
- user.username = resData.user.name;
- user.user_url = `/user/${resData.user.login}`;
- // user.image_url = resData.image_url;
- user.is_teacher = resData.is_teacher;
- resData.user = user;
- this._handleUserAuthor(resData)
- // TODO 测试
- // resData.power = 0;
-
- this.setState({
- ...resData,
-
- currentGamePassed: false,
- loading: false,
- testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0),
- })
-
- window.document.title = resData.shixun.name
-
- window.__myshixun = resData.myshixun; // tpi_html_show需要用到
- }
- _handleUserAuthor(resData) {
- // tpi tpm权限控制
- // const EDU_ADMIN = 1 // 超级管理员
- // const EDU_SHIXUN_MANAGER = 2 // 实训管理员
- // const EDU_SHIXUN_MEMBER = 3 // 实训成员
- // const EDU_CERTIFICATION_TEACHER = 4 // 平台认证的老师
- // const EDU_GAME_MANAGER = 5 // TPI的创建者
- // const EDU_TEACHER = 6 // 平台老师,但是未认证
- // const EDU_NORMAL = 7 // 普通用户
-
- // myshixun_manager power is_teacher
- resData.power = 0
- resData.myshixun_manager = false
- resData.is_teacher = false
-
- if (resData.user.identity === EDU_ADMIN) {
- resData.power = 1
- resData.myshixun_manager = true
- } else if (resData.user.identity === EDU_SHIXUN_MANAGER) {
- resData.power = 1
- resData.myshixun_manager = true
- } else if (resData.user.identity === EDU_SHIXUN_MEMBER) {
- resData.power = 1
- resData.myshixun_manager = true
- } else if (resData.user.identity === EDU_CERTIFICATION_TEACHER) {
- resData.power = 1
- resData.is_teacher = true
-
- } else if (resData.user.identity === EDU_TEACHER) {
- resData.is_teacher = true
- } else if (resData.user.identity === EDU_NORMAL) {
-
- }
- return resData
- }
-
- fetchAll(stageId) {
-
- if (window.__fetchAllFlag == true ) {
- console.log('TPIContextProvider call fetchAll repeatly!')
- return;
- }
- // 切换关卡的时候,同步costTime
- this._updateCostTime(true);
-
- if (!stageId) {
- // stageId = 'zl6kx8f7vfpo';
- // http://localhost:3000/myshixuns/so5w6iap97/stages/zl6kx8f7vfpo
- }
-
- // var url = `/api/v1/games/${stageId}`
- var url = `/tasks/${stageId}.json`
-
- // {"status":1,"message":"undefined method `authenticate!' for #"}
- window.__fetchAllFlag = true;
-
-
- this.setState({
- loading: true,
- currentGamePassed: false, // 切换game时重置passed字段
- })
-
- axios.get(url, {
- // https://stackoverflow.com/questions/48861290/the-value-of-the-access-control-allow-origin-header-in-the-response-must-not-b
- // withCredentials: true,
- })
- .then((response) => {
- // {"status":1,"message":"Unauthorized. \u7528\u6237\u8ba4\u8bc1\u5931\u8d25."}
-
- if (response.data.status == 403) {
- window.location.href = "/403";
- return;
- }
- if (response.data.status == 404) {
- window.location.href = '/myshixuns/not_found'
- return;
- }
-
- this._handleResponseData(response.data)
-
- })
- .catch(function (error) {
- console.log(error);
- });
-
- }
-
- readGameAnswer(resData) {
- // game.final_score = resData.final_score;
- if (resData.final_score) {
- var game = this.state.game;
- this.setState({
- game: update(game, {final_score: { $set: resData.final_score }}),
- grade: resData.grade
- })
- } else {
- this.setState({
- grade: resData.grade
- })
- }
-
- }
- closeTaskResultLayer() {
- this.setState({
- currentGamePassed: false
- })
- }
- onRunChooseTestFinish(response) {
- const { test_sets, challenge_chooses_count, choose_correct_num, grade, experience, gold, had_submmit, next_game } = response;
- response.had_submmit = true; // 是否已提交
- const { game } = this.state;
- let currentGamePassed = false
- if (challenge_chooses_count === choose_correct_num) {
- game.status = 2;
- game.next_game = next_game;
-
- currentGamePassed = true;
-
-
- this._updateCostTime(true, true);
- }
- this.setState({
- choose_test_cases: response,
- grade: grade,
-
- game,
- next_game,
- currentGamePassed: currentGamePassed,
- currentPassedGameGainGold: gold,
- currentPassedGameGainExperience: experience,
- })
- }
- language_display(data) {
- const { game, tomcat_url } = this.state;
- const $ = window.$;
- const challenge = Object.assign({}, this.state.challenge)
- if(challenge.isWeb && data.port != -1) {
- // var $result = $("#php_display");
- challenge.showWebDisplayButton = true; // ActionView处是否出现查看效果按钮
- const path = challenge.web_route || challenge.path
- const webDisplayUrl = `${tomcat_url}:${data.port}/${path}`
- challenge.webDisplayUrl = webDisplayUrl
- challenge.showLanguagePictrue = true; // 评测通过弹出层是否出现查看效果按钮
- }
- // else if(challenge.isAndroid && data.picture != 0){
- // // https://www.educoder.net/shixuns/qrcode?game_id=218589&_=1525571882782
- // $.ajax({
- // url: `/shixuns/qrcode?game_id=${game.id}`,
- // dataType: 'script'
- // });
- // challenge.showLanguagePictrue = true;
- // }
- else if(data.picture != 0){
- // 对应服务端erb文件为 _picture_display.html.erb
- // $.ajax({
- // url: "/users/picture_show?game_id="+data.picture,
- // cache: false,
- // dataType: 'script'
- // });
-
- /**
- {
- "type": "image",
- "orignal_picture": [],
- "user_picture": [],
- "answer_picture": []
- }
- */
- const url = `/tasks/${game.identifier}/picture_display.json`
- axios.get(url)
- .then((response) => {
- // response.data.type qrcode_str
- this.showEffectDisplay(response.data)
- })
-
- challenge.showLanguagePictrue = true;
- }
- this.setState({
- challenge
- })
- }
- onRunCodeTestFinish(response) {
- console.log('onRunCodeTestFinish', response)
- const { test_sets, test_sets_count, test_sets_hidden_count, test_sets_public_count
- , had_test_count, had_passed_testsests_error_count, had_passed_testsests_hidden_count
- , had_passed_testsests_public_count, final_score, gold, experience, latest_output, status
- , had_done, score, tag_count, power, record, next_game, grade, picture,
- sets_error_count, last_compile_output, record_consume_time} = response;
-
- const { game } = this.state;
-
- const currentGamePassed = this.props.game !== 2 && status === 2
-
- currentGamePassed && this.language_display(response);
-
- // 评测通过了,立即同步costTime
- currentGamePassed && this._updateCostTime(true, true);
-
- if (currentGamePassed) {
- game.status = 2;
- game.next_game = next_game;
-
- } else {
- this.showDialog({
- contentText: ,
- isSingleButton: true
- })
- }
-
- const output_sets = {
- "test_sets": test_sets,
- "test_sets_array": test_sets,
- "had_test_count": had_test_count || test_sets_count,
- "test_sets_count": test_sets_count,
- // "had_passed_testsests_error_count": had_passed_testsests_error_count,
- "had_passed_testsests_error_count": test_sets_count - sets_error_count,
- "test_sets_hidden_count": test_sets_hidden_count,
- "test_sets_public_count": test_sets_public_count,
- "had_passed_testsests_hidden_count": had_passed_testsests_hidden_count,
- "had_passed_testsests_public_count": had_passed_testsests_public_count
- };
- // if (output_sets && output_sets.test_sets) {
- // const test_sets_array = JSON.parse("[" + output_sets.test_sets + "]");
- // output_sets.test_sets_array = test_sets_array;
- // }
-
-
- this.setState({
- testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), // 重置测试集展开状态
- currentGamePassed,
- currentPassedGameGainGold: gold,
- currentPassedGameGainExperience: experience,
-
- output_sets,
- game,
- next_game,
-
- latest_output: last_compile_output,
- record: record_consume_time,
- grade,
- had_done,
-
- })
- }
- resetTestSetsExpandedArray = () => {
- this.setState({
- testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), // 重置测试集展开状态
- })
- }
-
- testSetUnlock() {
- const { game } = this.state;
- const url = `/v1/games/${game.identifier}/check_test_sets.json`
- axios.get(url, {
- withCredentials: true,
- })
- .then((response) => {
- // TODO status -2 重复操作,直接解锁
- if (response.data.test_sets == -1) {
- console.error('testSetUnlock失败!')
- this.showSnackbar(response.data.message)
- return;
- } else {
- // 被扣除的金币,是负数
- const deltaScore = response.data.score;
- // output_sets
- let { output_sets } = this.state;
- output_sets = Object.assign({}, output_sets);
- const test_sets_array = JSON.parse("[" + response.data.test_sets + "]");
- output_sets.test_sets_array = test_sets_array;
- this.setState({
- output_sets: output_sets,
- grade: this.state.grade + deltaScore,
- game : update(game, {test_sets_view: { $set: true }}),
- testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0)
- })
- this.handleGdialogClose();
- }
-
- })
- .catch(function (error) {
- console.log(error);
- });
- }
-
- handleSnackbarClose() {
- this.setState({
- snackbarOpen: false,
- snackbarVertical: '',
- snackbarHorizontal: '',
- })
- }
- // 全局的snackbar this.props.showSnackbar调用即可
- showSnackbar(text, vertical, horizontal) {
- this.setState({
- snackbarOpen: true,
- snackbarText: text,
- snackbarVertical: vertical,
- snackbarHorizontal: horizontal,
- })
- }
-
- /*
- TODO 写成HOC组件,更好复用
- 全局的Dialog this.props.showDialog调用即可
- @param contentText dialog显示的提示文本
- @param callback 确定按钮回调方法
- @param moreButtonsRender 除了“确定”、“取消”按钮外的其他按钮
- @param okButtonText “确定”按钮显示文本,如 继续查看
- */
- showDialog(params) {
- const { contentText, callback, moreButtonsRender, okButtonText, isSingleButton } = params;
-
- this.dialogOkCallback = callback;
- this.moreButtonsRender = moreButtonsRender
- this.okButtonText = okButtonText;
- this.isSingleButton = isSingleButton;
- this.setState({
- gDialogOpen: true,
- gDialogContentText: contentText
- })
- }
- onGdialogOkBtnClick() {
-
- this.dialogOkCallback && this.dialogOkCallback();
- // this.setState({
- // gDialogOpen: true
- // })
- }
- handleGdialogClose = () => {
- this.setState({
- gDialogOpen: false
- })
- }
- render() {
- const { classes } = this.props;
- return (
- this.closeTaskResultLayer(),
-
- onPathChange: this.onPathChange,
- updateChallengePath: this.updateChallengePath,
-
- showSnackbar: this.showSnackbar,
- showDialog: this.showDialog,
- handleGdialogClose: () => this.handleGdialogClose(),
-
- onShowUpdateDialog: this.onShowUpdateDialog,
- updateDialogClose: this.updateDialogClose,
-
- match: this.props.match
- }}
- >
-
-
- this.handleSnackbarClose()}
- transition={Fade}
- SnackbarContentProps={{
- 'aria-describedby': 'message-id',
- }}
- resumeHideDuration={2000}
- message={{this.state.snackbarText}}
- />
- {this.props.children}
-
- )
- }
-}
-
-export default withStyles(styles) (TPIContextProvider);
-
-
-
+import React, { Component } from 'react';
+import ReactDOM from 'react-dom';
+
+import axios from 'axios';
+import Snackbar from 'material-ui/Snackbar';
+import Fade from 'material-ui/transitions/Fade';
+
+import update from 'immutability-helper'
+
+import Dialog, {
+ DialogActions,
+ DialogContent,
+ DialogContentText,
+ DialogTitle,
+} from 'material-ui/Dialog';
+
+import Button from 'material-ui/Button';
+
+import EvaluateSuccessEffectDisplay from './EvaluateSuccessEffectDisplay'
+
+import _ from 'lodash'
+
+/*
+ 若干js库
+ http://inorganik.github.io/countUp.js/
+
+*/
+/*
+ 切下一关需要更新:
+ LeftViewContainer state.gameAnswer
+*/
+
+import TPIContext from './TPIContext'
+import { EDU_ADMIN, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER
+ , EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL, EDU_BUSINESS} from 'educoder'
+import { MuiThemeProvider, createMuiTheme, withStyles } from 'material-ui/styles';
+import MUIDialogStyleUtil from '../modules/page/component/MUIDialogStyleUtil'
+
+const styles = MUIDialogStyleUtil.getTwoButtonStyle()
+
+// 主题自定义
+const theme = createMuiTheme({
+ palette: {
+ primary: {
+ main: '#4CACFF',
+ contrastText: 'rgba(255, 255, 255, 0.87)'
+ },
+ secondary: { main: '#4CACFF' }, // This is just green.A700 as hex.
+ },
+});
+
+const testSetsExpandedArrayInitVal = [false, false, false, false, false,
+ false, false, false, false, false,
+ false, false, false, false, false,
+ false, false, false, false, false]
+window.__fetchAllFlag = false; // 是否调用过fetchAll TODO 如何多次使用provider?
+class TPIContextProvider extends Component {
+ constructor(props) {
+ super(props)
+ this.onRunCodeTestFinish = this.onRunCodeTestFinish.bind(this)
+ this.onRunChooseTestFinish = this.onRunChooseTestFinish.bind(this)
+ this.testSetUnlock = this.testSetUnlock.bind(this)
+
+ this.onTestSetHeaderClick = this.onTestSetHeaderClick.bind(this)
+
+ this.onShowPrevStage = this.onShowPrevStage.bind(this)
+ this.onShowNextStage = this.onShowNextStage.bind(this)
+
+ this.readGameAnswer = this.readGameAnswer.bind(this)
+ this.praisePlus = this.praisePlus.bind(this)
+
+ this.onGamePassed = this.onGamePassed.bind(this)
+
+ this.onPathChange = this.onPathChange.bind(this)
+
+ this.showSnackbar = this.showSnackbar.bind(this)
+ this.showDialog = this.showDialog.bind(this)
+
+ this.onShowUpdateDialog = this.onShowUpdateDialog.bind(this)
+ this.updateDialogClose = this.updateDialogClose.bind(this)
+
+ // this.showEffectDisplay();
+
+ this.state = {
+ loading: true, // 正在加载数据
+ gDialogOpen: false,
+ currentGamePassed: false, // 当前game评测通过
+ currentPassedGameGainGold: 0, // 当前通过的game获得的金币数
+ currentPassedGameGainExperience: 0, // 当前通过的game获得的经验数
+
+ user: {},
+ challenge: {},
+ shixun_name: '',
+ hide_code: false,
+
+ showUpdateDialog: false,
+
+ testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0),
+ }
+ }
+
+ showEffectDisplay = (data) => {
+ const dom = document.getElementById('picture_display');
+ window.$(dom).show();
+ ReactDOM.render(, dom);
+ }
+
+ onShowUpdateDialog() {
+ this.setState({showUpdateDialog: true})
+ }
+ // updateNowSuccess true 立即更新成功
+ // TODO updateDialogClose方法名不对, 改为updateDialogCallback
+ updateDialogClose(nextUpdateSuccess, updateNowSuccess) {
+ const { myshixun } = this.state;
+ if (nextUpdateSuccess) {
+ myshixun.system_tip = true;
+ }
+ let { tpm_cases_modified, tpm_modified, tpm_script_modified } = this.state;
+ if (updateNowSuccess) {
+ tpm_cases_modified = false;
+ tpm_modified = false;
+ tpm_script_modified = false;
+ }
+ this.setState({
+ myshixun,
+ tpm_cases_modified,
+ tpm_modified,
+ tpm_script_modified,
+ showUpdateDialog: false
+ })
+ }
+
+ componentWillUnmount() {
+ this.costTimeInterval && window.clearInterval(this.costTimeInterval)
+ }
+ componentDidMount() {
+
+ // TODO 登录状态的判断?
+ // request
+ // var shixunId = this.props.match.params.shixunId;
+ var stageId = this.props.match.params.stageId;
+
+ window.__fetchAllFlag = false;
+ this.fetchAll(stageId);
+
+ this.costTimeInterval = window.setInterval(()=> {
+ const { game } = this.state;
+ if (!game || game.status === 2) { // 已完成的任务不需要计时
+ return;
+ }
+ if (game.cost_time || game.cost_time === 0) {
+ // game.cost_time += 1;
+ this.setState({
+ game: update(game, {cost_time: { $set: (game.cost_time+1) }})
+ })
+ }
+ }, 1000)
+
+ // 页面离开时存下用户的任务耗时
+
+ window.$(window).unload( ()=>{
+ this._updateCostTime();
+ });
+ }
+ // force 评测通过后,异步执行该方法,强制同步costTime到服务端
+ _updateCostTime(async = false, force) {
+ const { game, loading } = this.state;
+ // TODO 还有一种情况,通关后cost_time计时停止,没法通过这个判断
+ if (!force && (loading || !game || game.status === 2)) {
+ return; // 已完成的任务不需要处理
+ }
+ let testPath = ''
+ if (window.location.port == 3007) {
+ testPath = 'https://testeduplus2.educoder.net'
+ }
+ // var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time`
+ var url = `${testPath}/api/tasks/${ game.identifier }/cost_time`
+ window.$.ajax({
+ type: 'get',
+ url: url,
+ async: async, //IMPORTANT, the call will be synchronous
+ data: {
+ time: game.cost_time
+ }
+ }).done((data) => {
+ console.log('complete');
+ });
+ }
+
+ onGamePassed(passed) {
+ const { game } = this.state
+ // 随便给个分,以免重新评测时又出现评星组件(注意:目前game.star没有显示在界面上,如果有则不能这么做)
+ // game.star = 6;
+ this.setState({
+ game: update(game, {star: { $set: 6 }}),
+ currentGamePassed: !!passed
+ })
+ }
+ onTestSetHeaderClick(index) {
+ // let { testSetsExpandedArray } = this.state;
+ let testSetsExpandedArray;
+ // 一次只打开一个
+ if (this.state.testSetsExpandedArray[index] === false) {
+ testSetsExpandedArray = testSetsExpandedArrayInitVal.slice(0);
+ } else {
+ testSetsExpandedArray = this.state.testSetsExpandedArray.slice(0);
+ }
+ testSetsExpandedArray[index] = !testSetsExpandedArray[index];
+ this.setState({
+ testSetsExpandedArray,
+ })
+ }
+
+ onShowPrevStage() {
+
+ }
+ onShowNextStage() {
+ window.__fetchAllFlag = false;
+ console.log('onShowNextStage.........')
+ // this.fetchAll('vznhx7mctwfq')
+ }
+
+ componentWillReceiveProps(newProps, oldProps) {
+ var newStageId = newProps.match.params.stageId;
+ if (!this.props || newStageId !== this.props.match.params.stageId) {
+ window.__fetchAllFlag = false;
+ this.fetchAll(newStageId)
+ }
+ }
+
+
+ // praise_tread/praise_plus?obj_id=569&obj_type=Challenge&horizontal=true&game_praise=true
+ /*
+ TODO 旧的接口在未登录时的返回值
+ //获取登录页面地址
+var signinPath = '/';
+var htmlvalue = '';
+pop_box_new(htmlvalue, 480, 182);
+ */
+ praisePlus() {
+ const { challenge, game } = this.state;
+ let praise = true;
+ const url = `/tasks/${game.identifier}/plus_or_cancel_praise.json`
+ // const url = `/praise_tread/praise_plus?obj_id=${challenge.id}&obj_type=Challenge&horizontal=${praise}&game_praise=true`
+ axios.post(url)
+ .then((response) => {
+
+ if (response.data) {
+ const { praise_count, praise } = response.data;
+ // challenge.praise_count = praise_tread_count;
+ // challenge.user_praise = praise;
+ this.setState({ challenge: update(challenge,
+ {
+ praise_count: { $set: praise_count },
+ user_praise: { $set: praise },
+ })
+ })
+ }
+
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
+ }
+
+ onPathChange(index) {
+ let { challenge } = this.state;
+ // challenge = Object.assign({}, challenge)
+ // challenge.pathIndex = index;
+ this.setState({
+ challenge: update(challenge, {pathIndex: { $set: index }}),
+ })
+ // TODO load new path content
+ }
+
+ updateChallengePath = (path) => {
+ const challenge = this.state.challenge;
+ if (challenge.path === path) {
+ return;
+ }
+ const { myshixun } = this.state;
+ // myshixun.system_tip = false;
+
+
+ challenge.path = path;
+ const newChallenge = this.handleChallengePath(challenge);
+ this.setState({ challenge: newChallenge,
+ myshixun: update(myshixun, {system_tip: { $set: false }}),
+ })
+ }
+
+ handleChallengePath(challenge) {
+ if (challenge.path && typeof challenge.path === "string") { // 多path的处理
+ let path = challenge.path.split(';');
+ _.remove(path, (item)=> !item)
+ if (path.length > 1) {
+ challenge.path = path;
+ challenge.multiPath = true;
+ } else {
+ challenge.path = challenge.path.replace(';', '').trim() // 多path 改为单path 出现了 aaa.java;的情况
+ challenge.multiPath = false;
+ }
+ }
+ challenge.pathIndex = 0;
+ return challenge;
+ }
+
+ newResData2OldResData(newResData) {
+ newResData.latest_output = newResData.last_compile_output
+ // newResData.power
+ newResData.record = newResData.record_onsume_time
+
+ // 老版用的hide_code
+ newResData.hide_code = newResData.shixun.hide_code;
+
+ newResData.image_url = newResData.user.image_url
+ newResData.grade = newResData.user.grade
+ newResData.user_url = newResData.user.user_url
+ newResData.username = newResData.user.name
+
+ newResData.output_sets = {}
+ // newResData.output_sets.had_test_count = newResData.test_sets_count
+ newResData.output_sets.test_sets = newResData.test_sets // JSON.stringify()
+ newResData.output_sets.test_sets_count = newResData.test_sets_count
+ // newResData.output_sets.had_passed_testsests_error_count = newResData.sets_error_count
+ newResData.output_sets.had_passed_testsests_error_count = newResData.test_sets_count
+ - newResData.sets_error_count
+ // allowed_hidden_testset
+ // sets_error_count
+ // test_sets_count
+ // test_sets
+ // had_passed_testsests_error_count
+ // test_sets
+ // test_sets
+
+ return newResData
+ }
+ // 将若干数据重新组织一下
+ _handleResponseData(resData_arg) {
+ const resData = this.newResData2OldResData(Object.assign({}, resData_arg))
+ let challenge = resData.challenge;
+ challenge.isHtml = false;
+ challenge.isWeb = false;
+ challenge.isAndroid = false;
+ challenge.showLanguagePictrue = false;
+ challenge.hasAnswer = resData.has_answer;
+
+ let output_sets = resData.output_sets;
+ if (resData.st === 0) { // 代码题
+ challenge = this.handleChallengePath(challenge)
+
+ const mirror_name = (resData.mirror_name && resData.mirror_name.join)
+ ? resData.mirror_name.join(';') : (resData.mirror_name || '');
+ if (mirror_name.indexOf('Html') !== -1) {
+ challenge.isHtml = true;
+ challenge.showLanguagePictrue = true;
+ } else if (mirror_name.indexOf('Web') !== -1 || mirror_name.indexOf('JFinal') !== -1) {
+ challenge.isWeb = true;
+ } else if (mirror_name.indexOf('Android') !== -1) {
+ challenge.isAndroid = true;
+ }
+
+ if (output_sets && output_sets.test_sets && typeof output_sets.test_sets == 'string') {
+ const test_sets_array = JSON.parse("[" + output_sets.test_sets + "]");
+ output_sets.test_sets_array = test_sets_array;
+ } else {
+ output_sets.test_sets_array = output_sets.test_sets
+ }
+
+ } else { // 选择题
+ // 选择题题干markdown初始化
+ const $ = window.$
+ window.setTimeout(()=>{
+ var lens = $("#choiceRepositoryView textarea").length;
+
+ for(var i = 1; i <= lens; i++){
+ window.editormd.markdownToHTML("choose_subject_" + i, {
+ htmlDecode: "style,script,iframe", // you can filter tags decode
+ taskList: true,
+ tex: true, // 数学公式
+ // flowChart: true, // 默认不解析
+ // sequenceDiagram: true // 默认不解析
+ });
+ }
+ }, 400)
+ }
+ challenge.user_praise = resData.user_praise;
+ challenge.praise_count = resData.praise_count;
+ challenge.showWebDisplayButton = false;
+ resData.challenge = challenge;
+
+ // 将一些属性写到game上
+ let game = resData.game;
+ game.prev_game = resData.prev_game;
+ game.next_game = resData.next_game;
+ resData.game = game;
+
+ const { tpm_cases_modified, tpm_modified, tpm_script_modified, myshixun } = resData;
+ if (myshixun.system_tip) {
+ // system_tip为true的时候 不弹框提示用户更新
+ resData.showUpdateDialog = false
+ } else {
+ let needUpdateScript = (tpm_modified || tpm_script_modified) && challenge.st === 0;
+ resData.showUpdateDialog = needUpdateScript || tpm_cases_modified
+ }
+
+ /**
+ email: "721773699@qq.com"
+ grade: 213996
+ identity: 1
+ image_url: "avatars/User/1"
+ login: "innov"
+ name: "Coder"
+ user_url: "/users/innov"
+ */
+ let user = resData.user;
+ user.username = resData.user.name;
+ user.user_url = `/user/${resData.user.login}`;
+ // user.image_url = resData.image_url;
+ user.is_teacher = resData.is_teacher;
+ resData.user = user;
+ this._handleUserAuthor(resData)
+ // TODO 测试
+ // resData.power = 0;
+
+ this.setState({
+ ...resData,
+
+ currentGamePassed: false,
+ loading: false,
+ testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0),
+ })
+
+ window.document.title = resData.shixun.name
+
+ window.__myshixun = resData.myshixun; // tpi_html_show需要用到
+ }
+ _handleUserAuthor(resData) {
+ // tpi tpm权限控制
+ // const EDU_ADMIN = 1 // 超级管理员
+ // const EDU_SHIXUN_MANAGER = 2 // 实训管理员
+ // const EDU_SHIXUN_MEMBER = 3 // 实训成员
+ // const EDU_CERTIFICATION_TEACHER = 4 // 平台认证的老师
+ // const EDU_GAME_MANAGER = 5 // TPI的创建者
+ // const EDU_TEACHER = 6 // 平台老师,但是未认证
+ // const EDU_NORMAL = 7 // 普通用户
+
+
+ /**
+ EDU_ADMIN = 1 # 超级管理员
+ EDU_BUSINESS = 2 # 运营人员
+ EDU_SHIXUN_MANAGER = 3 # 实训管理员
+ EDU_SHIXUN_MEMBER = 4 # 实训成员
+ EDU_CERTIFICATION_TEACHER = 5 # 平台认证的老师
+ EDU_GAME_MANAGER = 6 # TPI的创建者
+ EDU_TEACHER = 7 # 平台老师,但是未认证
+ EDU_NORMAL = 8 # 普通用户
+ */
+
+ // myshixun_manager power is_teacher
+ resData.power = 0
+ resData.myshixun_manager = false
+ resData.is_teacher = false
+
+ if (resData.user.identity === EDU_ADMIN) {
+ resData.power = 1
+ resData.myshixun_manager = true
+ } else if (resData.user.identity === EDU_BUSINESS) {
+ resData.power = 1
+ resData.myshixun_manager = true
+ } else if (resData.user.identity === EDU_SHIXUN_MANAGER) {
+ resData.power = 1
+ resData.myshixun_manager = true
+ } else if (resData.user.identity === EDU_SHIXUN_MEMBER) {
+ resData.power = 1
+ resData.myshixun_manager = true
+ } else if (resData.user.identity === EDU_CERTIFICATION_TEACHER) {
+ resData.power = 1
+ resData.is_teacher = true
+
+ } else if (resData.user.identity === EDU_TEACHER) {
+ resData.is_teacher = true
+ } else if (resData.user.identity === EDU_NORMAL) {
+
+ }
+ return resData
+ }
+
+ fetchAll(stageId) {
+
+ if (window.__fetchAllFlag == true ) {
+ console.log('TPIContextProvider call fetchAll repeatly!')
+ return;
+ }
+ // 切换关卡的时候,同步costTime
+ this._updateCostTime(true);
+
+ if (!stageId) {
+ // stageId = 'zl6kx8f7vfpo';
+ // http://localhost:3000/myshixuns/so5w6iap97/stages/zl6kx8f7vfpo
+ }
+
+ // var url = `/api/v1/games/${stageId}`
+ var url = `/tasks/${stageId}.json`
+
+ // {"status":1,"message":"undefined method `authenticate!' for #"}
+ window.__fetchAllFlag = true;
+
+
+ this.setState({
+ loading: true,
+ currentGamePassed: false, // 切换game时重置passed字段
+ })
+
+ axios.get(url, {
+ // https://stackoverflow.com/questions/48861290/the-value-of-the-access-control-allow-origin-header-in-the-response-must-not-b
+ // withCredentials: true,
+ })
+ .then((response) => {
+ // {"status":1,"message":"Unauthorized. \u7528\u6237\u8ba4\u8bc1\u5931\u8d25."}
+
+ if (response.data.status == 403) {
+ window.location.href = "/403";
+ return;
+ }
+ if (response.data.status == 404) {
+ window.location.href = '/myshixuns/not_found'
+ return;
+ }
+
+ this._handleResponseData(response.data)
+
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
+
+ }
+
+ readGameAnswer(resData) {
+ // game.final_score = resData.final_score;
+ if (resData.final_score) {
+ var game = this.state.game;
+ this.setState({
+ game: update(game, {final_score: { $set: resData.final_score }}),
+ grade: resData.grade
+ })
+ } else {
+ this.setState({
+ grade: resData.grade
+ })
+ }
+
+ }
+ closeTaskResultLayer() {
+ this.setState({
+ currentGamePassed: false
+ })
+ }
+ onRunChooseTestFinish(response) {
+ const { test_sets, challenge_chooses_count, choose_correct_num, grade, experience, gold, had_submmit, next_game } = response;
+ response.had_submmit = true; // 是否已提交
+ const { game } = this.state;
+ let currentGamePassed = false
+ if (challenge_chooses_count === choose_correct_num) {
+ game.status = 2;
+ game.next_game = next_game;
+
+ currentGamePassed = true;
+
+
+ this._updateCostTime(true, true);
+ }
+ this.setState({
+ choose_test_cases: response,
+ grade: grade,
+
+ game,
+ next_game,
+ currentGamePassed: currentGamePassed,
+ currentPassedGameGainGold: gold,
+ currentPassedGameGainExperience: experience,
+ })
+ }
+ language_display(data) {
+ const { game, tomcat_url } = this.state;
+ const $ = window.$;
+ const challenge = Object.assign({}, this.state.challenge)
+ if(challenge.isWeb && data.port != -1) {
+ // var $result = $("#php_display");
+ challenge.showWebDisplayButton = true; // ActionView处是否出现查看效果按钮
+ const path = challenge.web_route || challenge.path
+ const webDisplayUrl = `${tomcat_url}:${data.port}/${path}`
+ challenge.webDisplayUrl = webDisplayUrl
+ challenge.showLanguagePictrue = true; // 评测通过弹出层是否出现查看效果按钮
+ }
+ // else if(challenge.isAndroid && data.picture != 0){
+ // // https://www.educoder.net/shixuns/qrcode?game_id=218589&_=1525571882782
+ // $.ajax({
+ // url: `/shixuns/qrcode?game_id=${game.id}`,
+ // dataType: 'script'
+ // });
+ // challenge.showLanguagePictrue = true;
+ // }
+ else if(data.picture != 0){
+ // 对应服务端erb文件为 _picture_display.html.erb
+ // $.ajax({
+ // url: "/users/picture_show?game_id="+data.picture,
+ // cache: false,
+ // dataType: 'script'
+ // });
+
+ /**
+ {
+ "type": "image",
+ "orignal_picture": [],
+ "user_picture": [],
+ "answer_picture": []
+ }
+ */
+ const url = `/tasks/${game.identifier}/picture_display.json`
+ axios.get(url)
+ .then((response) => {
+ // response.data.type qrcode_str
+ this.showEffectDisplay(response.data)
+ })
+
+ challenge.showLanguagePictrue = true;
+ }
+ this.setState({
+ challenge
+ })
+ }
+ onRunCodeTestFinish(response) {
+ console.log('onRunCodeTestFinish', response)
+ const { test_sets, test_sets_count, test_sets_hidden_count, test_sets_public_count
+ , had_test_count, had_passed_testsests_error_count, had_passed_testsests_hidden_count
+ , had_passed_testsests_public_count, final_score, gold, experience, latest_output, status
+ , had_done, score, tag_count, power, record, next_game, grade, picture,
+ sets_error_count, last_compile_output, record_consume_time} = response;
+
+ const { game } = this.state;
+
+ const currentGamePassed = this.props.game !== 2 && status === 2
+
+ currentGamePassed && this.language_display(response);
+
+ // 评测通过了,立即同步costTime
+ currentGamePassed && this._updateCostTime(true, true);
+
+ if (currentGamePassed) {
+ game.status = 2;
+ game.next_game = next_game;
+
+ } else {
+ this.showDialog({
+ contentText: ,
+ isSingleButton: true
+ })
+ }
+
+ const output_sets = {
+ "test_sets": test_sets,
+ "test_sets_array": test_sets,
+ "had_test_count": had_test_count || test_sets_count,
+ "test_sets_count": test_sets_count,
+ // "had_passed_testsests_error_count": had_passed_testsests_error_count,
+ "had_passed_testsests_error_count": test_sets_count - sets_error_count,
+ "test_sets_hidden_count": test_sets_hidden_count,
+ "test_sets_public_count": test_sets_public_count,
+ "had_passed_testsests_hidden_count": had_passed_testsests_hidden_count,
+ "had_passed_testsests_public_count": had_passed_testsests_public_count
+ };
+ // if (output_sets && output_sets.test_sets) {
+ // const test_sets_array = JSON.parse("[" + output_sets.test_sets + "]");
+ // output_sets.test_sets_array = test_sets_array;
+ // }
+
+
+ this.setState({
+ testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), // 重置测试集展开状态
+ currentGamePassed,
+ currentPassedGameGainGold: gold,
+ currentPassedGameGainExperience: experience,
+
+ output_sets,
+ game,
+ next_game,
+
+ latest_output: last_compile_output,
+ record: record_consume_time,
+ grade,
+ had_done,
+
+ })
+ }
+ resetTestSetsExpandedArray = () => {
+ this.setState({
+ testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), // 重置测试集展开状态
+ })
+ }
+
+ testSetUnlock() {
+ const { game } = this.state;
+ const url = `/v1/games/${game.identifier}/check_test_sets.json`
+ axios.get(url, {
+ withCredentials: true,
+ })
+ .then((response) => {
+ // TODO status -2 重复操作,直接解锁
+ if (response.data.test_sets == -1) {
+ console.error('testSetUnlock失败!')
+ this.showSnackbar(response.data.message)
+ return;
+ } else {
+ // 被扣除的金币,是负数
+ const deltaScore = response.data.score;
+ // output_sets
+ let { output_sets } = this.state;
+ output_sets = Object.assign({}, output_sets);
+ const test_sets_array = JSON.parse("[" + response.data.test_sets + "]");
+ output_sets.test_sets_array = test_sets_array;
+ this.setState({
+ output_sets: output_sets,
+ grade: this.state.grade + deltaScore,
+ game : update(game, {test_sets_view: { $set: true }}),
+ testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0)
+ })
+ this.handleGdialogClose();
+ }
+
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
+ }
+
+ handleSnackbarClose() {
+ this.setState({
+ snackbarOpen: false,
+ snackbarVertical: '',
+ snackbarHorizontal: '',
+ })
+ }
+ // 全局的snackbar this.props.showSnackbar调用即可
+ showSnackbar(text, vertical, horizontal) {
+ this.setState({
+ snackbarOpen: true,
+ snackbarText: text,
+ snackbarVertical: vertical,
+ snackbarHorizontal: horizontal,
+ })
+ }
+
+ /*
+ TODO 写成HOC组件,更好复用
+ 全局的Dialog this.props.showDialog调用即可
+ @param contentText dialog显示的提示文本
+ @param callback 确定按钮回调方法
+ @param moreButtonsRender 除了“确定”、“取消”按钮外的其他按钮
+ @param okButtonText “确定”按钮显示文本,如 继续查看
+ */
+ showDialog(params) {
+ const { contentText, callback, moreButtonsRender, okButtonText, isSingleButton } = params;
+
+ this.dialogOkCallback = callback;
+ this.moreButtonsRender = moreButtonsRender
+ this.okButtonText = okButtonText;
+ this.isSingleButton = isSingleButton;
+ this.setState({
+ gDialogOpen: true,
+ gDialogContentText: contentText
+ })
+ }
+ onGdialogOkBtnClick() {
+
+ this.dialogOkCallback && this.dialogOkCallback();
+ // this.setState({
+ // gDialogOpen: true
+ // })
+ }
+ handleGdialogClose = () => {
+ this.setState({
+ gDialogOpen: false
+ })
+ }
+ render() {
+ const { classes } = this.props;
+ return (
+ this.closeTaskResultLayer(),
+
+ onPathChange: this.onPathChange,
+ updateChallengePath: this.updateChallengePath,
+
+ showSnackbar: this.showSnackbar,
+ showDialog: this.showDialog,
+ handleGdialogClose: () => this.handleGdialogClose(),
+
+ onShowUpdateDialog: this.onShowUpdateDialog,
+ updateDialogClose: this.updateDialogClose,
+
+ match: this.props.match
+ }}
+ >
+
+
+ this.handleSnackbarClose()}
+ transition={Fade}
+ SnackbarContentProps={{
+ 'aria-describedby': 'message-id',
+ }}
+ resumeHideDuration={2000}
+ message={{this.state.snackbarText}}
+ />
+ {this.props.children}
+
+ )
+ }
+}
+
+export default withStyles(styles) (TPIContextProvider);
+
+
+
diff --git a/public/react/src/index.css b/public/react/src/index.css
index 6249aa94a..5b7639ce3 100644
--- a/public/react/src/index.css
+++ b/public/react/src/index.css
@@ -33,4 +33,7 @@ body {
}
.anticon anticon-paper-clip{
color: #29bd8b !important;
+}
+.notificationmystyle{
+ z-index: 99999999;
}
\ No newline at end of file
diff --git a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js
index a43576acf..77317792e 100644
--- a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js
+++ b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js
@@ -180,6 +180,12 @@ class CommonWorkAppraise extends Component{
*/}
+
+
{(description || (attachments && attachments.length != 0)) &&
内容
@@ -209,7 +215,7 @@ class CommonWorkAppraise extends Component{
{ update_time &&
更新
- {update_user_name}
+ {update_user_name}
{moment(update_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"":moment(update_time).format('YYYY-MM-DD HH:mm')}
@@ -218,7 +224,7 @@ class CommonWorkAppraise extends Component{
{ commit_time &&
提交
- {author_name}
+ {author_name}
{moment(commit_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"":moment(commit_time).format('YYYY-MM-DD HH:mm')}
@@ -286,6 +292,7 @@ class CommonWorkAppraise extends Component{
}
+
{/* task_type={datalist&&datalist.task_type} */}
diff --git a/public/react/src/modules/courses/busyWork/CommonWorkItem.js b/public/react/src/modules/courses/busyWork/CommonWorkItem.js
index ad755338c..2ac4761e1 100644
--- a/public/react/src/modules/courses/busyWork/CommonWorkItem.js
+++ b/public/react/src/modules/courses/busyWork/CommonWorkItem.js
@@ -8,7 +8,6 @@ import { WordsBtn } from 'educoder'
import AccessoryModal2 from '../coursesPublic/AccessoryModal2'
import AccessoryModal from '../coursesPublic/AccessoryModal'
import axios from 'axios'
-import ConnectProject from './ConnectProject'
class CommonWorkItem extends Component{
constructor(props){
super(props);
@@ -98,6 +97,13 @@ class CommonWorkItem extends Component{
setupdate = () => {
}
+ toCreateProject = () => {
+ if (window.location.port == 3007) {
+ window.location.href = '/testbdweb.educoder.net/projects/new'
+ } else {
+ window.location.href = '/projects/new'
+ }
+ }
render(){
let { mainList,workType }=this.props;
const { aModalVisible, fileList, revise_reason } = this.state
@@ -128,7 +134,7 @@ class CommonWorkItem extends Component{
}
{
- mainList && mainList.homeworks.length>0 && mainList.homeworks.map((item,index)=>{
+ mainList && mainList.homeworks && mainList.homeworks.length>0 && mainList.homeworks.map((item,index)=>{
let canNotLink = !isAdminOrStudent && item.private_icon == true
return(
@@ -196,12 +202,22 @@ class CommonWorkItem extends Component{
{ //
item.work_status && item.work_status.indexOf('关联项目') != -1 &&
-
+
+ this.props.toCreateProject(item)}>创建项目
+ this.props.openConnectionProject(item)}>关联项目
+
+ }
+
+ { //
+ item.work_status && item.work_status.indexOf('取消关联') != -1 &&
+ this.props.cancelConnectionProject(item)}>取消关联
}
{ //
item.work_status && item.work_status.indexOf('提交作品') != -1 &&
this.props.toWorkPostPage(this.props.match.params, item.homework_id)}>提交作品
}
+
+
{
//
item.work_status && item.work_status.indexOf('补交作品') != -1 &&
diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js
index 7142d3d00..a9090a02e 100644
--- a/public/react/src/modules/courses/busyWork/CommonWorkList.js
+++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js
@@ -31,7 +31,9 @@ function renderScore(score, content) {
} else if (score >= 60) {
color = '#FF6800'
}
- return {score == '--' ? '--': (content || score)}
+ return
+ {score == null || score == undefined || score == '--' ? '--': (content || score)}
+
}
function getScoreTip(score, dom) {
return score == '--' ? '未评分' : score == '**' ? '未公开' : dom
@@ -47,9 +49,14 @@ function buildColumns(that, student_works) {
}
let courseId= that.props.match.params.coursesId;
let workId= that.props.match.params.workId;
- const { course_group_count } = that.state;
+ const { course_group_count, homework_status } = that.state;
const isAdmin = that.props.isAdmin()
const isAdminOrStudent = that.props.isAdminOrStudent()
+ const isStudent = that.props.isStudent()
+ const isNiPing = homework_status && homework_status.indexOf('匿评中') != -1
+ // https://www.trustie.net/issues/21450 分组作业作品列表 学时视角,匿评阶段的列表显示信息不正确
+ const niPingAndIsStudent = isStudent && isNiPing
+
let columns = [{
width: 60,
title: '序号',
@@ -76,21 +83,24 @@ function buildColumns(that, student_works) {
{text}
),
- }, {
- width: 180,
- title: '学号',
- dataIndex: 'student_id',
- key: 'student_id',
-
- render: (text, record) => (
-
- {record.student_id}
-
- ),
}]
+ if (!niPingAndIsStudent) {
+ columns.push({
+ width: 88,
+ title: '学号',
+ dataIndex: 'student_id',
+ key: 'student_id',
+
+ render: (text, record) => (
+
+ {record.student_id}
+
+ ),
+ })
+ }
// TODO 只有有分班时才显示分班列
- if (course_group_count != 0) {
+ if (course_group_count != 0 && !niPingAndIsStudent) {
columns.push( {
title: '分班',
key: 'group_name',
@@ -103,7 +113,7 @@ function buildColumns(that, student_works) {
),
} )
}
- if (gotWorkGroup) {
+ if (gotWorkGroup && !niPingAndIsStudent) {
columns.push({
width: 72,
title: '分组',
@@ -144,7 +154,7 @@ function buildColumns(that, student_works) {
)},
}, {
- width: 133,
+ width: 150,
title: '更新时间',
dataIndex: 'update_time',
key: 'update_time',
@@ -154,45 +164,52 @@ function buildColumns(that, student_works) {
{update_time ? moment(update_time).format('YYYY-MM-DD hh:mm') : '--'}
),
- }, {
- width: 72,
- title: '教师评分',
- key: 'teacher_score',
- dataIndex: 'teacher_score',
-
- render: (teacher_score, record) => (
-
-
+ }])
+ if (!niPingAndIsStudent) {
+ columns.push({
+ width: 72,
+ title: '教师评分',
+ key: 'teacher_score',
+ dataIndex: 'teacher_score',
+
+ render: (teacher_score, record) => (
+
+
+
+ { renderScore(teacher_score) }
+
+
+ ),
+ })
+
+ columns.push({
+ width: 72,
+ title: '助教评分',
+ key: 'teaching_asistant_score',
+ dataIndex: 'teaching_asistant_score',
+ /**
+ * 2名助教进行了评分
+ 平均分:85.0分
+ *
+ */
+ render: (teaching_asistant_score, record) => (
- { renderScore(teacher_score) }
-
-
- ),
- }, {
- width: 72,
- title: '助教评分',
- key: 'teaching_asistant_score',
- dataIndex: 'teaching_asistant_score',
-/**
- * 2名助教进行了评分
-平均分:85.0分
- *
- */
- render: (teaching_asistant_score, record) => (
-
- {
- {record.ta_comment_count}名助教进行了评分
- {that.state.ta_mode == 1 ? '平均分': '复审分'}:{teaching_asistant_score}分
- ) }
- >
-
- {renderScore(teaching_asistant_score) }
- }
-
- ),
- }])
+ {
+ {record.ta_comment_count}名助教进行了评分
+ {that.state.ta_mode == 1 ? '平均分': '复审分'}:{teaching_asistant_score}分
+ ) }
+ >
+
+ {renderScore(teaching_asistant_score) }
+ }
+
+ ),
+ })
+ }
+
+
if (that.state.anonymous_comment) {
/**
@@ -211,7 +228,7 @@ function buildColumns(that, student_works) {
- {`${record.student_comment_count}名学生进行了匿评`}
+ {record.student_comment_count && {`${record.student_comment_count}名学生进行了匿评`}
}
有效平均分:{record.student_score}分
)
@@ -235,43 +252,45 @@ function buildColumns(that, student_works) {
{ !!appeal_all_count &&
- {`${appeal_all_count}/${record.appeal_deal_count}`}
+ {`${record.appeal_deal_count}/${appeal_all_count}`}
}
+ { !appeal_all_count && '-/-'}
),
})
}
-
- columns.push({
- width: 72,
- title: '最终成绩',
- key: 'work_score',
- dataIndex: 'work_score',
- render: (work_score, record) => {
- return (
-
-
- {`${record.user_name}(${record.user_login})`}
- { record.ultimate_score ?
- 最终调整成绩:{record.work_score}分
:
+ if (!niPingAndIsStudent) {
+ columns.push({
+ width: 72,
+ title: '最终成绩',
+ key: 'work_score',
+ dataIndex: 'work_score',
+ render: (work_score, record) => {
+ return (
+
+
- { record.final_score && 作业评分:{record.final_score}分
}
- { record.late_penalty >= 0 && 迟交扣分:{record.late_penalty}分
}
- { record.absence_penalty >= 0 && 缺评扣分:{record.absence_penalty}分
}
- { record.appeal_penalty >= 0 && 违规匿评扣分:{record.appeal_penalty}分
}
- 最终成绩:{record.work_score}分
- }
- )
- }>
- { renderScore(work_score) }
-
-
- )
- },
- })
+ {`${record.user_name}(${record.user_login})`}
+ { record.ultimate_score ?
+ 最终调整成绩:{record.work_score}分
:
+
+ { record.final_score &&
作业评分:{record.final_score}分
}
+ { record.late_penalty >= 0 &&
迟交扣分:{record.late_penalty}分
}
+ { record.absence_penalty >= 0 &&
缺评扣分:{record.absence_penalty}分
}
+ { record.appeal_penalty >= 0 &&
违规匿评扣分:{record.appeal_penalty}分
}
+
最终成绩:{record.work_score}分
+
}
+ )
+ }>
+ { renderScore(work_score) }
+
+
+ )
+ },
+ })
+ }
if (isAdminOrStudent || that.props.work_public == true) {
columns.push({
width: 92,
diff --git a/public/react/src/modules/courses/busyWork/CommonWorkPost.js b/public/react/src/modules/courses/busyWork/CommonWorkPost.js
index c75e62a10..0193d8659 100644
--- a/public/react/src/modules/courses/busyWork/CommonWorkPost.js
+++ b/public/react/src/modules/courses/busyWork/CommonWorkPost.js
@@ -173,7 +173,7 @@ class CommonWorkPost extends Component{
}
if(isGroup){
if(userids!=undefined){
- if(userids.lengthmemberNumMax){
+ }else if(userids.length + 1>memberNumMax){
this.setState({
minvalue: memberNumMax,
setvalue:"大于",
diff --git a/public/react/src/modules/courses/busyWork/CommonWorkQuestion.js b/public/react/src/modules/courses/busyWork/CommonWorkQuestion.js
index 2c1902e59..7932311b1 100644
--- a/public/react/src/modules/courses/busyWork/CommonWorkQuestion.js
+++ b/public/react/src/modules/courses/busyWork/CommonWorkQuestion.js
@@ -101,14 +101,13 @@ class CommonWorkQuestion extends Component{
{isGroup &&
-
分组要求:
-
分组人数: {group_info.min_num} - {group_info.max_num} 人
-
{group_info.base_on_project ? '基于项目实施' : '不基于项目实施'}:
+
分组要求: {group_info.min_num} ~ {group_info.max_num}
+
{group_info.base_on_project ? '基于项目实施' : '不基于项目'}:
-
(提交作品时需要关联同组成员,组内成员作品共享)
-
({group_info.base_on_project ? '基于项目,则项目管理员角色的成员可以提交作品' : '非基于项目,则任意小组成员可以提交作品'})
-
(各小组必须在educoder平台创建项目)
+
(学生提交作品时需要关联同组成员,组内成员作品共享)
+
({group_info.base_on_project ? '学生必须在本平台创建项目,项目管理员可以提交作品' : '无需再平台创建项目,任意小组成员均可以提交作品'})
+ {/*
(各小组必须在educoder平台创建项目)
*/}
}
diff --git a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js
index 1574d692d..4a30990ef 100644
--- a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js
+++ b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js
@@ -259,15 +259,20 @@ class CommonWorkSetting extends Component{
unified_setting: checked
})
}
+ // 启用匿评
anonymous_comment_change = (e) => {
const checked = e.target.checked;
- const { end_time } = this.state;
+ const currentEndTime = this._getCurrentEndTime()
let evaluation_start, evaluation_end, evaluation_num = 0, absence_penalty = 0;
if (checked) {
- if (end_time) {
- evaluation_start = moment(end_time).add(7, 'days').format(dateFormat)
- evaluation_end = moment(end_time).add(21, 'days').format(dateFormat)
+ if (currentEndTime) {
+ evaluation_start = moment(currentEndTime).add(7, 'days').format(dateFormat)
+ evaluation_end = moment(currentEndTime).add(21, 'days').format(dateFormat)
+ }
+ if (!this.state.evaluation_num) {
evaluation_num = 3
+ }
+ if (!this.state.absence_penalty) {
absence_penalty = 2
}
} else {
@@ -310,6 +315,7 @@ class CommonWorkSetting extends Component{
absence_penalty:value
})
}
+ // 启用匿评申诉
anonymous_appeal_change = (e) => {
const { evaluation_end } = this.state;
const anonymous_appeal = e.target.checked
@@ -389,9 +395,10 @@ class CommonWorkSetting extends Component{
this.setState({
late_penalty: 5
})
- if (this.state.end_time && !this.state.late_time) {
+ const currentEndTime = this._getCurrentEndTime();
+ if (currentEndTime && !this.state.late_time) {
this.setState({
- late_time: moment(handleDateString(this.state.end_time)).add(1, 'months').format(dateFormat)
+ late_time: moment(handleDateString(currentEndTime)).add(1, 'months').format(dateFormat)
})
}
}
@@ -469,6 +476,20 @@ class CommonWorkSetting extends Component{
// }
}
+ _getCurrentEndTime = () => {
+ const { unified_setting, end_time, rules } = this.state;
+ if (unified_setting) {
+ return end_time
+ } else {
+ let max_un_unified_setting_end_time = null;
+ rules.map(item => {
+ if (!max_un_unified_setting_end_time || moment(item.end_time) > moment(max_un_unified_setting_end_time)) {
+ max_un_unified_setting_end_time = item.end_time;
+ }
+ })
+ return max_un_unified_setting_end_time
+ }
+ }
saveWorkSetting=()=>{
let workId=this.props.match.params.workId;
@@ -524,8 +545,8 @@ class CommonWorkSetting extends Component{
let temp_publish_time
let temp_end_time
if (unified_setting) {
- let temp_publish_time = publish_time
- let temp_end_time = end_time
+ temp_publish_time = publish_time
+ temp_end_time = end_time
if (!temp_publish_time) {
const publish_time_moment = getNextHalfHourOfMoment(moment());
temp_publish_time = publish_time_moment.format(dateFormat);
@@ -1077,6 +1098,7 @@ class CommonWorkSetting extends Component{
course_group={adaptered_group_settings}
rulesCheckInfo={(info)=>this.rulesCheckInfo(info)}
flagPageEdit={true}
+ moduleName="作业"
>
}
@@ -1254,7 +1276,7 @@ class CommonWorkSetting extends Component{
margin-left: 18px;
}
`}
-
+
允许学生对自己作品的匿评评分进行申诉,由教师和助教处理申诉
@@ -1297,7 +1319,7 @@ class CommonWorkSetting extends Component{
-
+ (学生提交匿评申诉的时间截点)
{{appeal_time_tip}
}
@@ -1311,7 +1333,7 @@ class CommonWorkSetting extends Component{
/>
-
+ (学生违规匿评TA人作品时,其成绩将被扣减的分值)
{this.state.appeal_penalty_tip && {this.state.appeal_penalty_tip}
}
@@ -1346,21 +1368,17 @@ class CommonWorkSetting extends Component{
多项评分配比(选中,则按照比例计算最终成绩)
-
+
计算说明:
- 优先顺序排前的非零评分 * 100% -
- ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )
- 例:有教师评分则教师评分100%,否则教辅评分100%,依次类推
- {/* 教师评分 * 其百分比 + 助教评分 * 其百分比 + 学生匿评平均分 * 其百分比 -
- ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )
-
-
+ 教师评分 * 其百分比 + 助教评分 * 其百分比 + 学生匿评平均分 * 其百分比 - (
+ 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )
注意
- 非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到另外的评
- 分选项上。例如:教师评分40% + 助教评分35% + 学生匿评25%,学生A没
- 有得到教师评分,则最终成绩将按照助教评分55% + 学生匿评45%进行计算 */}
+ 非零百分比的评分选项,若评分记录为空,则其百分比将自动平摊到其它非零
+ 评分选项上。
+ 例:教师评分40% + 助教评分35% + 学生匿评25%,学生A没有教师评分记
+ 录,则其最终成绩按照助教评分55% + 学生匿评45%进行计算
@@ -1392,12 +1410,30 @@ class CommonWorkSetting extends Component{
{{final_mode_false_tip}
}
单项评分优先(选中,则按照优先顺序计算最终成绩)
+
+
+ 计算说明:
+
+ 优先顺序排前的非零评分 * 100% -
+ ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )
+ 例:有教师评分则教师评分100%,否则教辅评分100%,依次类推
+ {/* 教师评分 * 其百分比 + 助教评分 * 其百分比 + 学生匿评平均分 * 其百分比 -
+ ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )
+
+
+ 注意
+ 非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到另外的评
+ 分选项上。例如:教师评分40% + 助教评分35% + 学生匿评25%,学生A没
+ 有得到教师评分,则最终成绩将按照助教评分55% + 学生匿评45%进行计算 */}
+
+
+
教师评分 → 教辅评分 → 学生匿评评分
- (有教师评分则教师评分100%,否则教辅评分100%,依次类推 )
+ {/* (有教师评分则教师评分100%,否则教辅评分100%,依次类推 ) */}
diff --git a/public/react/src/modules/courses/busyWork/ConnectProject.js b/public/react/src/modules/courses/busyWork/ConnectProject.js
index 9d201009d..73a4da8f8 100644
--- a/public/react/src/modules/courses/busyWork/ConnectProject.js
+++ b/public/react/src/modules/courses/busyWork/ConnectProject.js
@@ -5,6 +5,7 @@ import '../css/members.css'
import { WordsBtn } from 'educoder'
import axios from 'axios'
import InfiniteScroll from 'react-infinite-scroller';
+import NoneData from "../coursesPublic/NoneData"
const Search =Input.Search;
const LIMIT = 15
@@ -36,13 +37,14 @@ class ConnectProject extends Component{
this.connectProject(radioValue)
}
connectProject = (project_id) => {
- let workId=this.props.work.homework_id;
+ let workId=this.work.homework_id;
const url = `/homework_commons/${workId}/student_works/relate_project.json`
axios.post(url, {
project_id: project_id
}).then((result)=>{
if(result.data.status==0){
this.closeConnectionProject()
+ this.props.connectSuccess()
this.props.showNotification('关联成功')
}
}).catch((error)=>{
@@ -75,6 +77,9 @@ class ConnectProject extends Component{
loading: false,
hasMore: result.data.projects.length != 0
})
+ if (page == 1) {
+ this.setState({ haveProjects: result.data.projects.length > 0 })
+ }
}
}).catch((error)=>{
console.log(error);
@@ -84,11 +89,12 @@ class ConnectProject extends Component{
if (window.location.port == 3007) {
window.location.href = '/testbdweb.educoder.net/projects/new'
} else {
- window.location.href = '/educoder.net/projects/new'
+ window.location.href = '/projects/new'
}
}
//关联项目
- openConnectionProject=()=>{
+ openConnectionProject=(work)=>{
+ this.work = work;
this.fetchData()
this.setState({
project_flag:true
@@ -104,10 +110,9 @@ class ConnectProject extends Component{
}
render(){
- let {project_flag, projects, loading, hasMore }=this.state;
+ let {project_flag, projects, loading, hasMore, haveProjects }=this.state;
return(
- 关联项目
-
+
+
{
- projects && !!projects.length &&
+ (projects && !!projects.length || this.state.keyword) &&
{this.setState({keyword: e.target.value})}}
onSearch={this.onSearchValue}
>
-
+
{ projects.map(item => {
- return {item.name}
+ return
+ 12 ? item.name : ''} className="name">{item.name}
+
})}
@@ -145,7 +169,11 @@ class ConnectProject extends Component{
}
{
- (!projects || projects.length == 0) &&
+ haveProjects && projects.length == 0 &&
+
+ }
+ {
+ (!haveProjects) &&
您当前尚未管理任何项目,请先创建项目再关联
diff --git a/public/react/src/modules/courses/busyWork/Index.js b/public/react/src/modules/courses/busyWork/Index.js
index 1f03551fa..e109c36f5 100644
--- a/public/react/src/modules/courses/busyWork/Index.js
+++ b/public/react/src/modules/courses/busyWork/Index.js
@@ -75,12 +75,6 @@ class CoursesWorkIndex extends Component{
(props) => ()
}
>
- ()
- }
- >
-
{/* 作业问答 */}
()
}
>
- ()
}
diff --git a/public/react/src/modules/courses/busyWork/IndexGroup.js b/public/react/src/modules/courses/busyWork/IndexGroup.js
index 0a4415f2f..cfe38766a 100644
--- a/public/react/src/modules/courses/busyWork/IndexGroup.js
+++ b/public/react/src/modules/courses/busyWork/IndexGroup.js
@@ -117,7 +117,7 @@ class CoursesWorkIndex extends Component{
(props) => ()
}
>
- ()
}
diff --git a/public/react/src/modules/courses/busyWork/PublishRightnow.js b/public/react/src/modules/courses/busyWork/PublishRightnow.js
index b4576f58d..da2054124 100644
--- a/public/react/src/modules/courses/busyWork/PublishRightnow.js
+++ b/public/react/src/modules/courses/busyWork/PublishRightnow.js
@@ -52,9 +52,9 @@ class PublishRightnow extends Component{
modalname: isPublish ? "立即发布" : "立即截止",
modaltype:1,
visible:true,
- Topval: isPublish ? "本操作只对“未发布”的对象生效" : "本操作只对“提交中”的对象生效",
- Botvalleft: isPublish ? "暂不发布" : "暂不截止",
- Botval: isPublish ? "则通过后续手动设置,定时发布" : "则将根据已设置的截止时间,定时截止",
+ Topval: isPublish ? "学生将立即收到作业" : "学生将不能再提交作品",
+ // Botvalleft: isPublish ? "暂不发布" : "暂不截止",
+ Botval: this.props.fromListPage ? (isPublish ? "本操作只对“未发布”的分班有效" : "本操作只对“提交中”的分班有效") : '',
starttime: isPublish ? `发布时间:${startMoment.format(dateFormat)}` : '',
starttimes:isPublish ? `${startMoment.format(dateFormat)}` : '',
endtime: isPublish ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '',
diff --git a/public/react/src/modules/courses/busyWork/common.js b/public/react/src/modules/courses/busyWork/common.js
index 902e5f34d..61bd7fcee 100644
--- a/public/react/src/modules/courses/busyWork/common.js
+++ b/public/react/src/modules/courses/busyWork/common.js
@@ -67,9 +67,9 @@ export function RouteHOC(options = {}) {
this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/${_studentWorkId}/appraise`)
}
}
- toNewPage = (courseId, workId) => {
+ toNewPage = (courseId) => {
const secondName = this.getModuleName()
- this.props.history.push(`/courses/${courseId.coursesId}/${secondName}/new`)
+ this.props.history.push(`/courses/${courseId.coursesId}/${secondName}/${courseId.category_id}/new`)
}
toListPage = (_courseId, _workId) => {
const secondName = this.getModuleName()
diff --git a/public/react/src/modules/courses/busyWork/commonWork.js b/public/react/src/modules/courses/busyWork/commonWork.js
index 9f3d8dda0..28199c4c0 100644
--- a/public/react/src/modules/courses/busyWork/commonWork.js
+++ b/public/react/src/modules/courses/busyWork/commonWork.js
@@ -9,6 +9,7 @@ import '../css/busyWork.css'
import CoursesListType from '../coursesPublic/CoursesListType'
import CommonWorkItem from './CommonWorkItem'
import PublishRightnow from './PublishRightnow'
+import ConnectProject from './ConnectProject'
import { WordsBtn } from 'educoder'
import Modals from '../../modals/Modals'
@@ -53,7 +54,9 @@ class commonWork extends Component{
let {page,search,order}=this.state;
this.getList(page,search,order);
}
-
+ openConnectionProject = (work) => {
+ this.refs['connectProject'].openConnectionProject(work)
+ }
// 新建
createCommonWork=(type)=>{
@@ -72,7 +75,6 @@ class commonWork extends Component{
}
componentDidUpdate(prevProps, prevState) {
- debugger;
if (prevProps.match.path != this.props.match.path) {
this.componentDidMount()
}
@@ -195,6 +197,7 @@ class commonWork extends Component{
this.clearSelection()
let {search,order}=this.state;
this.getList(1,search,order);
+ this.props.updataleftNavfun()
}
console.log(response)
}).catch((error) => {
@@ -276,6 +279,26 @@ class commonWork extends Component{
console.log(error)
})
}
+ connectSuccess = () => {
+ let {page,search,order}=this.state;
+ this.getList(page,search,order);
+ }
+
+ cancelConnectionProject = (work) => {
+ let workId=this.props.match.params.workId;
+ let courseId=this.props.match.params.coursesId;
+
+ const url = `/homework_commons/${work.homework_id}/student_works/cancel_relate_project.json`
+ axios.get(url).then((response)=> {
+ if (response.data.status == 0) {
+ let {page,search,order}=this.state;
+ this.getList(page,search,order);
+ this.props.showNotification('取消关联成功')
+ }
+ }).catch((error)=>{
+ console.log(error)
+ })
+ }
render(){
@@ -338,6 +361,8 @@ class commonWork extends Component{
*/}
+
+
+ isPublish={true} doWhenSuccess={this.doWhenSuccess} fromListPage={true}>
+ isPublish={false} doWhenSuccess={this.doWhenSuccess} fromListPage={true}>
{ !!course_public && 设为公开}
@@ -418,12 +443,15 @@ class commonWork extends Component{
-
+
{
- mainList && mainList.homeworks.length==0 &&
+ mainList && mainList.homeworks && mainList.homeworks.length==0 &&
}
{
diff --git a/public/react/src/modules/courses/common/CNotificationHOC.js b/public/react/src/modules/courses/common/CNotificationHOC.js
index 89908223a..6be60db3f 100644
--- a/public/react/src/modules/courses/common/CNotificationHOC.js
+++ b/public/react/src/modules/courses/common/CNotificationHOC.js
@@ -28,6 +28,14 @@ export function CNotificationHOC(options = {}) {
notification.open(data);
}
+ bytesToSize = (bytes) => {
+ if (bytes === 0) return '0 B';
+ let k = 1024,
+ sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
+ i = Math.floor(Math.log(bytes) / Math.log(k));
+ return (bytes / Math.pow(k, i)). toFixed(2) + ' ' + sizes[i];
+ }
+
configNotification = (placement) => {
placement && notification.config({
placement: placement,
@@ -127,6 +135,7 @@ export function CNotificationHOC(options = {}) {
this.getNowFormatDates(value,type)}
configNotification={ this.configNotification }
confirm={ this.confirm }
diff --git a/public/react/src/modules/courses/common/comments/CCommentItem.js b/public/react/src/modules/courses/common/comments/CCommentItem.js
index d02c76f5d..45ebb364b 100644
--- a/public/react/src/modules/courses/common/comments/CCommentItem.js
+++ b/public/react/src/modules/courses/common/comments/CCommentItem.js
@@ -46,9 +46,9 @@ class CCommentItem extends Component{
let { item, commentIndex }=this.props;
const url = `/student_works/${studentWorkId}/cancel_appeal.json`
- axios.post(url, { data: {
+ axios.post(url, {
score_id: item.id
- }})
+ })
.then((response) => {
if (response.data.status == 0) {
this.showNotification('撤销成功')
@@ -262,9 +262,21 @@ class CCommentItem extends Component{
return(
diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js
index e0333c333..3a1ab9331 100644
--- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js
+++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js
@@ -1,7 +1,7 @@
import React, {Component} from 'react';
import {Link} from "react-router-dom";
import axios from 'axios';
-import {getImageUrl, trigger} from 'educoder';
+import {getImageUrl, trigger, on, off} from 'educoder';
import { Tooltip, message,Popover} from 'antd';
import CoursesListType from '../coursesPublic/CoursesListType';
import Addcourses from '../coursesPublic/Addcourses';
@@ -9,7 +9,6 @@ import '../css/Courses.css';
import Modals from "../../modals/Modals";
import AddStudentModal from '../members/modal/AddStudentModal'
import AddTeacherModal from '../members/modal/AddTeacherModal'
-import Trialapplication from "../../login/Trialapplication";
// 点击按钮复制功能
// function jsCopy(){
@@ -44,39 +43,33 @@ class CoursesBanner extends Component {
modalsBottomval: "",
antIcon:false,
coursedata:undefined,
- user_phone_binded:false,
- isRenders:false,
- showTrial:false,
}
- console.log("CoursesBanner");
- console.log("48");
- console.log(props);
}
componentDidMount() {
- this.updatabanner()
- this.setState({
- user_phone_binded :this.props.user_phone_binded,
- })
+
+ this.onloadupdatabanner()
+ on('updatabanner', this.updatabanner)
+ }
+ componentWillUnmount() {
+ off('updatabanner', this.updatabanner)
}
+
+
+ onloadupdatabanner=()=>{
+ this.updatabanner()
+ }
updatabanner=()=>{
let courseId = this.props.match.params.coursesId;
let url = "/courses/" + courseId + "/top_banner.json"
axios.get(url).then((result) => {
if( result!=undefined){
let data = result.data;
- if(result.data.status === 407){
- this.setState({
- isRenders:true,
- coursedata: data,
- showTrial:false,
- })
- }else{
this.setState({
coursedata: data,
- showTrial:true,
})
- }
+ }else{
+ this.onloadupdatabanner()
}
})
}
@@ -332,11 +325,10 @@ class CoursesBanner extends Component {
}
render() {
- let { Addcoursestypes, coursedata, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,user_phone_binded} = this.state;
+ let { Addcoursestypes, coursedata, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon} = this.state;
return (
-
{
coursedata === undefined || coursedata.status===401?
:
@@ -370,7 +362,7 @@ class CoursesBanner extends Component {
{
coursedata===undefined || coursedata.status===401 || coursedata.status===407?"":
-
+
{coursedata.name}
@@ -411,7 +403,9 @@ class CoursesBanner extends Component {
{coursedata.switch_to_student === true ?
-
+ 由教师/助教身份切换至学生
可进行提交作品、答题等操作
+ }>
this.switchidentity(1)}
> 切换为学生
@@ -419,7 +413,9 @@ class CoursesBanner extends Component {
:""}
{coursedata.switch_to_teacher === true ?
-
+ 由学生身份切换至教师
拥有添加成员、发布作业等管理权限
+ }>
this.switchidentity(2)}
> 切换为老师
@@ -427,7 +423,9 @@ class CoursesBanner extends Component {
{coursedata.switch_to_assistant === true ?
-
+ 由学生身份切换至助教
拥有添加成员、发布作业等管理权限
+ }>
this.switchidentity(3)}
> 切换为助教
@@ -466,7 +464,9 @@ class CoursesBanner extends Component {
学生
{coursedata.student_count}
+ className={coursedata.credit===null?"color-white fl font-16 bannerurlis":"color-white fl font-16 bannerurli"}>
+ {coursedata.student_count}
+
@@ -530,10 +530,13 @@ class CoursesBanner extends Component {
{coursedata.code_halt === true? "已停用" : coursedata.invite_code}
{coursedata.code_halt === true ? "" :
- 成员可以通过邀请码主动加入课堂
- 点击立刻复制邀请码
-
+ coursedata.code_halt === true?
+ 邀请码已停用
+ 成员不能主动加入课堂
+
:
+ 成员可以通过邀请码主动加入课堂
+ 点击立刻复制邀请码
+
}>
{
diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js
index d0afc4b5b..f3212d9bd 100644
--- a/public/react/src/modules/courses/coursesPublic/Addcourses.js
+++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js
@@ -119,14 +119,29 @@ class Addcourses extends Component{
}
submitasyn=(course_id)=>{
+ let{professor}=this.state;
+ if(professor===1){
+ this.setState({
+ loadtype:true,
+ modalsType:true,
+ modalsTopval:"申请已提交,请等待审核",
+ modalSave:(course_id)=>this.submitasyns(course_id),
+ Addcoursestype:false
+ })
+ this.props.hideAddcoursestype();
+ }else{
+ // let{course_id}=this.state;
+ this.setState({
+ Addcoursestype:false
+ })
+ this.props.hideAddcoursestype();
+ window.location.href ="/courses/"+course_id+"/students";
+ }
- // let{course_id}=this.state;
- this.setState({
- Addcoursestype:false
- })
- this.props.hideAddcoursestype();
- window.location.href ="/courses/"+course_id+"/students";
}
+ submitasyns=(course_id)=>{
+ window.location.href ="/courses/"+course_id+"/students";
+ }
submittojoinclass=()=>{
let {invite_code,professor,assistant_professor,student}=this.state;
diff --git a/public/react/src/modules/courses/coursesPublic/PathModal.js b/public/react/src/modules/courses/coursesPublic/PathModal.js
index 6bf85f3d2..787c70d3e 100644
--- a/public/react/src/modules/courses/coursesPublic/PathModal.js
+++ b/public/react/src/modules/courses/coursesPublic/PathModal.js
@@ -1,246 +1,246 @@
-import React,{ Component } from "react";
-import { Modal,Checkbox,Select,Input,Tooltip } from "antd";
-import axios from'axios';
-import Loading from '@icedesign/base/lib/loading';
-import '@icedesign/base/lib/loading/style.js';
-import Modals from '../../modals/Modals';
-
-const Option = Select.Option;
-const Search = Input.Search;
-class PathModal extends Component{
- constructor(props){
- super(props);
- this.state={
- StudentList_value:"",
- Searchvalue:undefined,
- type:'all',
- page:1,
- patheditarry:undefined
- }
- }
-
- hidecouseShixunModal=()=>{
- this.props.hidecouseShixunModal()
- }
-
- //tag
- changeTag=(types)=>{
- let {Searchvalue}=this.state;
- this.setState({
- type:types,
- page:1,
- })
- this.props.funshixunpathlist(Searchvalue,types,true,1)
- }
-
- //搜索
- SenttotheValue=(e)=>{
- this.setState({
- Searchvalue:e.target.value
- })
- }
- SenttotheSearch=(value)=>{
- let{type}=this.state;
- this.setState({
- page:1,
- })
- this.props.funshixunpathlist(value,type,true,1)
- }
-
-
- //勾选实训
- shixunhomeworkedit=(list)=>{
- this.setState({
- patheditarry:list
- })
- // this.props.funpatheditarry(newpatheditarry)
- }
-
- contentViewScrolledit=(e)=>{
- //滑动到底判断
-
- if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){
-
- let {Searchvalue,type,page,shixunpathlist}=this.state;
- let newpage=page+1
- this.props.funshixunpathlist(Searchvalue,type,true,newpage)
- this.setState({
- page:newpage
- })
-
- }
-
- }
- //提交
- savecouseShixunModal=()=>{
- let {patheditarry}=this.state;
- let {coursesId,Coursename,page,order,category_id,datas}=this.props;
- let url="/courses/"+coursesId+"/homework_commons/create_subject_homework.json";
- if(patheditarry===undefined){
- this.setState({
- patheditarrytype:true,
- patheditarryvalue:"请先选择实训课程"
- })
- return
- }else if(patheditarry.length===0){
- this.setState({
- patheditarrytype:true,
- patheditarryvalue:"请先选择实训课程"
- })
- return
- }
- axios.post(url, {
- // category_id: datas&&datas.category_name===undefined||datas&&datas.category_name===null?undefined:category_id,
- subject_ids:patheditarry,
- }
- ).then((response) => {
- if(response.data.status===-1){
- // this.setState({
- // Modalstype:true,
- // Modalstopval:response.data.message,
- // ModalsBottomval:"",
- // ModalSave:this.cancelmodel,
- // Loadtype:true
- // })
- this.props.showNotification(response.data.message)
-
- }else{
- // this.homeworkstart
- //调用立即发布弹窗
- this.props.hidecouseShixunModal();
- this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
- // this.props.showNotification("选用成功")
- // this.props.showNotification(response.data.message)
- // this.props.homeworkupdatalists(Coursename,page,order);
- }
-
- // if(response.status===200) {
- // this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
- // }
-
-
- }).catch((error) => {
- console.log(error)
- })
- }
- render(){
- let {Searchvalue,type,Modalstype}=this.state;
- let {visible,shixunmodallist,hometypepvisible,newshixunmodallist}=this.props;
-
-
- return(
-
- {/*提示*/}
- {Modalstype&&Modalstype===true?
:""}
-
-
-
-
- { shixunmodallist && shixunmodallist.tags.length===0?"":
}
-
-
- - 实训路径名称
- - 已发布实训数
- - 使用人数
-
-
-
-
-
-
-
-
- {
- newshixunmodallist&&newshixunmodallist.map((item,key)=>{
- return(
-
-
-
-
-
-
-
{item.shixun_count}
-
{item.myshixun_count}
-
- 详情
-
-
- )
- })
- }
-
-
-
- { this.state.patheditarrytype===true?
{this.state.patheditarryvalue}:""}
-
-
-
-
-
- )
- }
-}
+import React,{ Component } from "react";
+import { Modal,Checkbox,Select,Input,Tooltip } from "antd";
+import axios from'axios';
+import Loading from '@icedesign/base/lib/loading';
+import '@icedesign/base/lib/loading/style.js';
+import Modals from '../../modals/Modals';
+
+const Option = Select.Option;
+const Search = Input.Search;
+class PathModal extends Component{
+ constructor(props){
+ super(props);
+ this.state={
+ StudentList_value:"",
+ Searchvalue:undefined,
+ type:'all',
+ page:1,
+ patheditarry:undefined
+ }
+ }
+
+ hidecouseShixunModal=()=>{
+ this.props.hidecouseShixunModal()
+ }
+
+ //tag
+ changeTag=(types)=>{
+ let {Searchvalue}=this.state;
+ this.setState({
+ type:types,
+ page:1,
+ })
+ this.props.funshixunpathlist(Searchvalue,types,true,1)
+ }
+
+ //搜索
+ SenttotheValue=(e)=>{
+ this.setState({
+ Searchvalue:e.target.value
+ })
+ }
+ SenttotheSearch=(value)=>{
+ let{type}=this.state;
+ this.setState({
+ page:1,
+ })
+ this.props.funshixunpathlist(value,type,true,1)
+ }
+
+
+ //勾选实训
+ shixunhomeworkedit=(list)=>{
+ this.setState({
+ patheditarry:list
+ })
+ // this.props.funpatheditarry(newpatheditarry)
+ }
+
+ contentViewScrolledit=(e)=>{
+ //滑动到底判断
+
+ if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){
+
+ let {Searchvalue,type,page,shixunpathlist}=this.state;
+ let newpage=page+1
+ this.props.funshixunpathlist(Searchvalue,type,true,newpage)
+ this.setState({
+ page:newpage
+ })
+
+ }
+
+ }
+ //提交
+ savecouseShixunModal=()=>{
+ let {patheditarry}=this.state;
+ let {coursesId,Coursename,page,order,category_id,datas}=this.props;
+ let url="/courses/"+coursesId+"/homework_commons/create_subject_homework.json";
+ if(patheditarry===undefined){
+ this.setState({
+ patheditarrytype:true,
+ patheditarryvalue:"请先选择实训课程"
+ })
+ return
+ }else if(patheditarry.length===0){
+ this.setState({
+ patheditarrytype:true,
+ patheditarryvalue:"请先选择实训课程"
+ })
+ return
+ }
+ axios.post(url, {
+ // category_id: datas&&datas.category_name===undefined||datas&&datas.category_name===null?undefined:category_id,
+ subject_ids:patheditarry,
+ }
+ ).then((response) => {
+ if(response.data.status===-1){
+ // this.setState({
+ // Modalstype:true,
+ // Modalstopval:response.data.message,
+ // ModalsBottomval:"",
+ // ModalSave:this.cancelmodel,
+ // Loadtype:true
+ // })
+ this.props.showNotification(response.data.message)
+
+ }else{
+ // this.homeworkstart
+ //调用立即发布弹窗
+ this.props.hidecouseShixunModal();
+ this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
+ // this.props.showNotification("选用成功")
+ // this.props.showNotification(response.data.message)
+ // this.props.homeworkupdatalists(Coursename,page,order);
+ }
+
+ // if(response.status===200) {
+ // this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
+ // }
+
+
+ }).catch((error) => {
+ console.log(error)
+ })
+ }
+ render(){
+ let {Searchvalue,type,Modalstype}=this.state;
+ let {visible,shixunmodallist,hometypepvisible,newshixunmodallist}=this.props;
+
+
+ return(
+
+ {/*提示*/}
+ {Modalstype&&Modalstype===true?
:""}
+
+
+
+
+ { shixunmodallist && shixunmodallist.tags.length===0?"":
}
+
+
+ - 实训路径名称
+ - 已发布实训数
+ - 使用人数
+
+
+
+
+
+
+
+
+ {
+ newshixunmodallist&&newshixunmodallist.map((item,key)=>{
+ return(
+
+
+
+
+
+
+
{item.shixun_count}
+
{item.myshixun_count}
+
+ 详情
+
+
+ )
+ })
+ }
+
+
+
+ { this.state.patheditarrytype===true?
{this.state.patheditarryvalue}:""}
+
+
+
+
+
+ )
+ }
+}
export default PathModal;
\ No newline at end of file
diff --git a/public/react/src/modules/courses/coursesPublic/SelectResource.js b/public/react/src/modules/courses/coursesPublic/SelectResource.js
index 1b400b800..878395144 100644
--- a/public/react/src/modules/courses/coursesPublic/SelectResource.js
+++ b/public/react/src/modules/courses/coursesPublic/SelectResource.js
@@ -285,6 +285,11 @@ class Selectresource extends Component{
padding: 0 30px;
padding-top:30px;
}
+ .search-news{
+ width: 237px!important;
+ height: 30px;
+ margin-bottom: 30px;
+ }
`}
@@ -292,7 +297,7 @@ class Selectresource extends Component{
this.changeTag("all")} className={ type==="all" ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部
this.changeTag("my")} className={ type==="my" ? " active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>我的资源
-
+
- {item.response===undefined?"":isNaN(bytesToSize(item.response.filesize))?"":bytesToSize(item.response.filesize)}
+ {item.response===undefined?"":isNaN(this.props.bytesToSize(item.response.filesize))?"":this.props.bytesToSize(item.response.filesize)}
{
-
- let newpatheditarry=[];
- if (this.props.singleChoose == true) {
- if (list.length > 0) {
- newpatheditarry.push(list[list.length - 1])
- }
- } else {
- for(var i=0; i{
- //滑动到底判断
-
- if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){
-
- let {Searchvalue,type,page}=this.state;
- let newpage=page+1
- this.props.funshixunmodallist(Searchvalue,type,true,newpage)
- this.setState({
- page:newpage
- })
-
- }
-
- }
-
- //搜索
- SenttotheValue=(e)=>{
- this.setState({
- Searchvalue:e.target.value
- })
- }
- SenttotheSearch=(value)=>{
- let{type}=this.state;
- this.setState({
- page:1,
- })
-
- this.props.funshixunmodallist(value,type,true,1)
- this.props.funpatheditarry([])
- }
-
- //tag
- changeTag=(types)=>{
- let {Searchvalue}=this.state;
- this.setState({
- type:types,
- page:1,
- })
-
- this.props.funshixunmodallist(Searchvalue,types,true,1)
- this.props.funpatheditarry([])
- }
-
-
- hidecouseShixunModal=()=>{
- this.props.hidecouseShixunModal()
- }
-
- savecouseShixunModal=()=>{
- let {coursesId,patheditarry,datas}=this.props;
-
- let{category_id}=this.state;
- if (this.props.chooseShixun) {
- this.props.chooseShixun(patheditarry)
- return;
- }
- if(patheditarry.length===0){
- this.setState({
- shixunmodelchke:true,
- chekicmessage:"请先选择实训"
- })
-
- return
- }
- let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json";
- axios.post(url, {
- category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id),
- shixun_ids:patheditarry,
- }
- ).then((response) => {
- if(response.data.status===-1){
- // this.props.showNotification(response.data.message)
-
- }else{
- this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
- this.props.hidecouseShixunModal()
- }
-
- // category_id: 3
- // homework_ids: (5) [9171, 9172, 9173, 9174, 9175]
- }).catch((error) => {
- console.log(error)
- })
- }
-
- selectCloseList=(value)=>{
- this.setState({
- category_id:value
- })
- }
- render(){
- let {Searchvalue,type,category_id}=this.state;
- let {visible,shixunmodallist,hometypepvisible,newshixunmodallist,patheditarry}=this.props;
- const antIcon = ;
- // console.log(patheditarry)
- return(
-
-
-
-
-
- {/**/}
- {/*{*/}
- {/*shixunmodallist === undefined ? "":shixunmodallist.homework_category.length>0?*/}
-
- {/*
选择目录名称:
*/}
- {/*
*/}
- {/**/}
- {/*
*/}
-
- {/*
:""}*/}
-
-
-
-
-
- {
-
- }
-
- - 实训名称
- - 使用院校
- - 使用人数
- - 评价等级
-
-
-
-
-
-
-
- {/*
*/}
-
- {
- newshixunmodallist === undefined ? "": newshixunmodallist.map((item,key)=>{
- return(
-
-
-
- {item.shixun_name}
-
-
-
{item.school_users}
-
{item.myshixuns_count}
-
{item.preference}
-
- 详情
-
-
- )
- })
- }
-
- {/**/}
-
-
-
- {this.state.shixunmodelchke===true?{this.state.chekicmessage}:""}
-
-
-
- )
- }
-}
+import React,{ Component } from "react";
+import { Modal,Checkbox,Select,Input,Tooltip,Spin,Icon} from "antd";
+import axios from'axios';
+// import Loading from '@icedesign/base/lib/loading';
+// import '@icedesign/base/lib/loading/style.js';
+
+const Option = Select.Option;
+const Search = Input.Search;
+class ShixunModal extends Component{
+ constructor(props){
+ super(props);
+ this.state={
+ Searchvalue:undefined,
+ type:'all',
+ category_id:0,
+ page:1
+ }
+ }
+ componentDidMount() {
+
+
+ }
+
+ //勾选实训
+ shixunhomeworkedit=(list)=>{
+
+ let newpatheditarry=[];
+ if (this.props.singleChoose == true) {
+ if (list.length > 0) {
+ newpatheditarry.push(list[list.length - 1])
+ }
+ } else {
+ for(var i=0; i{
+ //滑动到底判断
+
+ if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){
+
+ let {Searchvalue,type,page}=this.state;
+ let newpage=page+1
+ this.props.funshixunmodallist(Searchvalue,type,true,newpage)
+ this.setState({
+ page:newpage
+ })
+
+ }
+
+ }
+
+ //搜索
+ SenttotheValue=(e)=>{
+ this.setState({
+ Searchvalue:e.target.value
+ })
+ }
+ SenttotheSearch=(value)=>{
+ let{type}=this.state;
+ this.setState({
+ page:1,
+ })
+
+ this.props.funshixunmodallist(value,type,true,1)
+ this.props.funpatheditarry([])
+ }
+
+ //tag
+ changeTag=(types)=>{
+ let {Searchvalue}=this.state;
+ this.setState({
+ type:types,
+ page:1,
+ })
+
+ this.props.funshixunmodallist(Searchvalue,types,true,1)
+ this.props.funpatheditarry([])
+ }
+
+
+ hidecouseShixunModal=()=>{
+ this.props.hidecouseShixunModal()
+ }
+
+ savecouseShixunModal=()=>{
+ let {coursesId,patheditarry,datas}=this.props;
+
+ let{category_id}=this.state;
+ if (this.props.chooseShixun) {
+ this.props.chooseShixun(patheditarry)
+ return;
+ }
+ if(patheditarry.length===0){
+ this.setState({
+ shixunmodelchke:true,
+ chekicmessage:"请先选择实训"
+ })
+
+ return
+ }
+ let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json";
+ axios.post(url, {
+ category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id),
+ shixun_ids:patheditarry,
+ }
+ ).then((response) => {
+ if(response.data.status===-1){
+ // this.props.showNotification(response.data.message)
+
+ }else{
+ this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
+ this.props.hidecouseShixunModal()
+ }
+
+ // category_id: 3
+ // homework_ids: (5) [9171, 9172, 9173, 9174, 9175]
+ }).catch((error) => {
+ console.log(error)
+ })
+ }
+
+ selectCloseList=(value)=>{
+ this.setState({
+ category_id:value
+ })
+ }
+ render(){
+ let {Searchvalue,type,category_id}=this.state;
+ let {visible,shixunmodallist,hometypepvisible,newshixunmodallist,patheditarry}=this.props;
+ const antIcon = ;
+ // console.log(patheditarry)
+ return(
+
+
+
+
+
+ {/**/}
+ {/*{*/}
+ {/*shixunmodallist === undefined ? "":shixunmodallist.homework_category.length>0?*/}
+
+ {/*
选择目录名称:
*/}
+ {/*
*/}
+ {/**/}
+ {/*
*/}
+
+ {/*
:""}*/}
+
+
+
+
+
+ {
+
+ }
+
+ - 实训名称
+ - 使用院校
+ - 使用人数
+ - 评价等级
+
+
+
+
+
+
+
+ {/*
*/}
+
+ {
+ newshixunmodallist === undefined ? "": newshixunmodallist.map((item,key)=>{
+ return(
+
+
+
+ {item.shixun_name}
+
+
+
{item.school_users}
+
{item.myshixuns_count}
+
{item.preference}
+
+ 详情
+
+
+ )
+ })
+ }
+
+ {/**/}
+
+
+
+ {this.state.shixunmodelchke===true?{this.state.chekicmessage}:""}
+
+
+
+ )
+ }
+}
export default ShixunModal;
\ No newline at end of file
diff --git a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js
index 064ec645a..9cf44c9a7 100644
--- a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js
+++ b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js
@@ -1,163 +1,171 @@
-import React,{ Component } from "react";
-import { WordsBtn } from 'educoder';
-import {Tooltip,message,Modal} from 'antd';
-import {Link} from 'react-router-dom';
-import axios from 'axios';
-import Modals from '../../modals/Modals';
-
-
-
-class Startshixuntask extends Component{
- constructor(props){
- super(props);
- this.state = {
- startbtn:false
- }
-
- }
-
- componentDidMount() {
-
- }
-
- taskoperationId=(list)=>{
- this.setState({
- startbtn:true,
- })
- let url= list+".json";
- axios.get(url).then((response) => {
-
- if(response.status===200){
- if(response.data.status===-2){
-
- this.setState({
- startbtn:false,
- shixunsreplace:true,
- hidestartshixunsreplacevalue:response.data.message+".json"
- })
- }else if(response.data.status===-1){
- console.log(response)
- }else if(response.data.status===-3){
- this.setState({
- shixunsmessage:response.data.message,
- startshixunCombattype:true,
- startbtn:false
- })
- }else{
-
- if(response.data.status!=401&&response.data.status!=403){
- window.location.href = "/tasks/"+response.data.game_identifier;
- }
-
- }
- }
- }).catch((error) => {
- this.setState({
- startbtn:false
- })
- });
-
- }
-
- hidestartshixunsreplace=(url)=>{
- axios.get(url).then((response) => {
- if(response.status===200){
-
- this.setState({
- shixunsreplace:false
- })
- message.success('重置成功,正在进入实训!');
- let path="/shixuns/"+response.data.shixun_identifier+"/challenges";
- this.props.history.push(path);
-
- }}
- ).catch((error) => {
- this.setState({
- startbtn:false,
- shixunsreplace:false
- })
- });
-
- }
-
- hidestartshixunCombattype=()=>{
- this.setState({
- startshixunCombattype:false
- })
- }
-
- render(){
- let {
- Modalstype,
- Modalstopval,
- Modalsbottomval,
- cardsModalcancel,
- cardsModalsavetype,
- loadtype,
- shixunsreplace,
- hidestartshixunsreplacevalue,
- startshixunCombattype,
- shixunsmessage,
- startbtn
- } = this.state;
-
- return(
-
-
-
-
-
-
-
-
-
-
-
本实训的开启时间:{shixunsmessage}
开启时间之前不能挑战
-
-
-
- {/**/}
- {/*知道了*/}
- {/*
*/}
-
-
- {this.props.isStudent?
-
- {this.props.data.task_operation&&this.props.data.task_operation?startbtn===false?this.taskoperationId( this.props.data.task_operation[1])}>
- {this.props.data.task_operation[0]}
- :"开启中":""}
- :""
- }
-
-
- )
- }
-}
+import React,{ Component } from "react";
+import { WordsBtn } from 'educoder';
+import {Tooltip,message,Modal,Spin} from 'antd';
+import {Link} from 'react-router-dom';
+import axios from 'axios';
+import Modals from '../../modals/Modals';
+
+
+class Startshixuntask extends Component{
+ constructor(props){
+ super(props);
+ this.state = {
+ startbtn:false,
+ isSpin:false,
+ }
+
+ }
+
+ componentDidMount() {
+
+ }
+
+ taskoperationId=(list)=>{
+ this.setState({
+ startbtn:true,
+ })
+ let url= list+".json";
+ axios.get(url).then((response) => {
+
+ if(response.status===200){
+ if(response.data.status===-2){
+
+ this.setState({
+ startbtn:false,
+ shixunsreplace:true,
+ hidestartshixunsreplacevalue:response.data.message+".json"
+ })
+ }else if(response.data.status===-1){
+ console.log(response)
+ }else if(response.data.status===-3){
+ this.setState({
+ shixunsmessage:response.data.message,
+ startshixunCombattype:true,
+ startbtn:false
+ })
+ }else{
+
+ if(response.data.status!=401&&response.data.status!=403){
+ window.location.href = "/tasks/"+response.data.game_identifier;
+ }
+
+ }
+ }
+ }).catch((error) => {
+ this.setState({
+ startbtn:false
+ })
+ });
+
+ }
+
+ hidestartshixunsreplace=(url)=>{
+ this.setState({
+ isSpin:true
+ })
+ axios.get(url).then((response) => {
+ if(response.status===200){
+
+ this.setState({
+ shixunsreplace:false,
+ isSpin:false,
+ })
+ message.success('重置成功,正在进入实训!');
+ let path="/shixuns/"+response.data.shixun_identifier+"/challenges";
+ this.props.history.push(path);
+
+ }}
+ ).catch((error) => {
+ this.setState({
+ startbtn:false,
+ shixunsreplace:false,
+ isSpin:false,
+ })
+ });
+
+ }
+
+ hidestartshixunCombattype=()=>{
+ this.setState({
+ startshixunCombattype:false
+ })
+ }
+
+ render(){
+ let {
+ Modalstype,
+ Modalstopval,
+ Modalsbottomval,
+ cardsModalcancel,
+ cardsModalsavetype,
+ loadtype,
+ shixunsreplace,
+ hidestartshixunsreplacevalue,
+ startshixunCombattype,
+ shixunsmessage,
+ startbtn,
+ isSpin
+ } = this.state;
+
+ return(
+
+
+
+
+
+
+
+
+
+
+
+
+
本实训的开启时间:{shixunsmessage}
开启时间之前不能挑战
+
+
+
+ {/**/}
+ {/*知道了*/}
+ {/*
*/}
+
+
+ {this.props.isStudent?
+
+ {this.props.data.task_operation&&this.props.data.task_operation?startbtn===false?this.taskoperationId( this.props.data.task_operation[1])}>
+ {this.props.data.task_operation[0]}
+ :"开启中":""}
+ :""
+ }
+
+
+ )
+ }
+}
export default Startshixuntask;
\ No newline at end of file
diff --git a/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js b/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js
index 1cb47ae7e..d01c8d986 100644
--- a/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js
+++ b/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js
@@ -230,11 +230,11 @@ class ShixunModal extends Component{
this.SenttotheSearch(value)}
- style={{width: '100%'}}
+ style={{width: '115%'}}
/>
diff --git a/public/react/src/modules/courses/coursesPublic/sendResource.js b/public/react/src/modules/courses/coursesPublic/sendResource.js
index 544c44286..bdd597495 100644
--- a/public/react/src/modules/courses/coursesPublic/sendResource.js
+++ b/public/react/src/modules/courses/coursesPublic/sendResource.js
@@ -22,13 +22,6 @@ function disabledDateTime() {
};
}
-function bytesToSize(bytes) {
- if (bytes === 0) return '0 B';
- let k = 1024,
- sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
- i = Math.floor(Math.log(bytes) / Math.log(k));
- return (bytes / Math.pow(k, i)). toFixed(2) + ' ' + sizes[i];
-}
const dateFormat="YYYY-MM-DD HH:mm";
class Sendresource extends Component{
constructor(props){
@@ -456,7 +449,7 @@ class Sendresource extends Component{
{item.name}
- {item.response===undefined?"":isNaN(bytesToSize(item.response.filesize))?"":bytesToSize(item.response.filesize)}
+ {item.response===undefined?"":isNaN(this.props.bytesToSize(item.response.filesize))?"":this.props.bytesToSize(item.response.filesize)}
{
+ //onAttachmentRemove = (file) => {
// confirm({
// title: '确定要删除这个附件吗?',
@@ -228,14 +228,14 @@ class GraduationTasksSubmitedit extends Component{
// });
// return false;
- this.setState({
- Modalstype:true,
- Modalstopval:'确定要删除这个附件吗?',
- ModalSave: ()=>this.deleteAttachment(file),
- ModalCancel:this.cancelAttachment
- })
- return false;
- }
+ // this.setState({
+ // Modalstype:true,
+ // Modalstopval:'确定要删除这个附件吗?',
+ // ModalSave: ()=>this.deleteAttachment(file),
+ // ModalCancel:this.cancelAttachment
+ // })
+ // return false;
+ //}
cancelAttachment=()=>{
this.setState({
@@ -246,8 +246,8 @@ class GraduationTasksSubmitedit extends Component{
})
}
- deleteAttachment = (file) => {
- let {attachments}=this.state;
+ onAttachmentRemove = (file) => {
+ let {attachments,fileList}=this.state;
const url = `/attachments/${file.uid===undefined?file.id:file.uid}.json`
axios.delete(url, {
})
@@ -426,7 +426,7 @@ class GraduationTasksSubmitedit extends Component{
multiple: true,
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
- // showUploadList: false,
+ showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
@@ -553,7 +553,37 @@ class GraduationTasksSubmitedit extends Component{
)
})}
-
+
+ {this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{
+ return(
+
+
+
+
+
+ {item.name}
+
+
+ {item.response===undefined?"":isNaN(this.props.bytesToSize(item.response.filesize))?"":this.props.bytesToSize(item.response.filesize)}
+
+ this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}>
+
+ )
+ })}
@@ -571,7 +601,7 @@ class GraduationTasksSubmitedit extends Component{
成员要求:2~5人
-
+
-
+
- {memberslist&&memberslist.members.map((item,key)=>{
+ {memberslist===undefined?"":memberslist.members.length===0?
+
+
+
未找到包含{search}的学生
+
+
:memberslist&&memberslist.members.map((item,key)=>{
return(
-
-
{item.user_name}
-
{item.group_name}
-
{item.student_id}
-
{item.commit_status===true?已提交 :""}
+
{
+ return parseInt(task_status[key])===item.user_id?true:false
+ })
+ }
+ disabled={item.commit_status===true?true:false} className="fl ">
+
+ {item.user_name}
+
+
{item.group_name}
+
{item.student_id}
+
{item.commit_status===false?已提交 :""}
)
})}
@@ -622,10 +680,12 @@ class GraduationTasksSubmitedit extends Component{
height: '30px',
display:item.user_name===undefined?"none":""
}}>
- {item.user_name}
- {item.group_name}
- {item.student_id}
- {key>0?this.delecttask_status(item.user_id)}>
:""}
+
+ {item.user_name}
+
+ {item.group_name}
+ {item.student_id}
+ {key>0?this.delecttask_status(item.user_id)}>
:""}
)
})}
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js
index fd0e265c5..b68458e3f 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js
@@ -2,7 +2,7 @@ import React,{Component} from "React";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Tooltip,Spin} from "antd";
import {Link} from 'react-router-dom';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
-import { WordsBtn,getUrl } from 'educoder';
+import { WordsBtn,getUrl,getImageUrl} from 'educoder';
import axios from 'axios';
import Modals from '../../../modals/Modals';
const Search = Input.Search;
@@ -83,7 +83,7 @@ class GraduationTasksSubmitnew extends Component{
}
handleSubmit=(e) => {
-
+ console.log("86");
let {fileList,selectmemberslist,workslist}=this.state;
if(fileList.length === 0){
@@ -91,7 +91,7 @@ class GraduationTasksSubmitnew extends Component{
Modalstype:true,
Modalstopval:'请上传附件!',
Loadtype:true,
- ModalCancel:this.cancelAttachment
+ ModalSave:this.cancelAttachment,
})
@@ -119,7 +119,7 @@ class GraduationTasksSubmitnew extends Component{
listid.push(list.response.id)
}
- e.preventDefault();
+ // e.preventDefault();
if( GraduationTasksnewtype===true){
this.props.form.validateFields((err, values) => {
if (!err) {
@@ -367,7 +367,6 @@ class GraduationTasksSubmitnew extends Component{
let newlist =memberslist.members;
let newcheckedValues=checkedValues;
let selects=[];
-
selects.push(selectobjct)
for(var i=0; i
{
+ if (e.keyCode === 13) {
+ }
+ }
+ onSearckeyd=(e)=>{
+ if(e.keyCode){
+
+ let {search} = this.state;
+ this.searchList(search,1,10)
+ }
+ }
+ onSearchKeywordKeyUps= (e)=>{
+ if(e.keyCode=== 13){
+ }
+ }
+ onKeywordSearchKeyDown = (e) => {
+ if(e.keyCode == 13) {
+ return false;
+ }
+ }
gocannel=()=>{
window.history.go(-1)
}
@@ -482,7 +503,8 @@ render(){
返回
-
}
{datalist&&datalist.project_info===undefined?"":
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js
index e722ac00b..15300c628 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js
@@ -197,7 +197,6 @@ class GraduationTasksappraiseMainEditor extends Component{
.mainEditor {
padding: 0 10px;
padding-bottom: 8px;
- height: 288px;
}
.mainEditorTitle {
margin-bottom: 6px;
@@ -218,7 +217,7 @@ class GraduationTasksappraiseMainEditor extends Component{
-
+
tr:last-child > td{
- border:none!important;
- }
`
}
@@ -1548,24 +1545,43 @@ class GraduationTaskssettinglist extends Component{
- {this.props.isAdmin()?
{taskslistdata&&taskslistdata.work_count}个检索结果({taskslistdata&&taskslistdata.work_count} 学生) :""}
- {
- this.props.isAdmin() ?
-
-
- {order==="updated_at"?"更新时间":order==="work_score"?"最终成绩":order==="student_id"?"学生学号":""}排序
-
-
- - this.funorder("updated_at")}>更新时间
- - this.funorder("work_score" )}>最终成绩
- - this.funorder("student_id" )}>学生学号
-
+ {this.props.isAdmin()===true?
+ {taskslistdata&&taskslistdata.work_count}
+ 个检索结果({taskslistdata&&taskslistdata.work_count} 学生) :""}
+ {this.props.isAdmin()===true?
- :""
- }
+ this.funorder("work_score" )}>最终成绩
+
+
this.funorder("student_id" )}>学生学号
+
+
+
:""}
+ {this.props.isStudent()===true?
+
+
+ {taskslistdata&&taskslistdata.commit_count}
+ 已交
+
+ {taskslistdata&&taskslistdata.uncommit_count}
+ 未交
+
+
+ {taskslistdata&&taskslistdata.left_time.status} :
+
+ {taskslistdata&&taskslistdata.left_time.time}
+
+
+
+ :""}
+
{
@@ -1785,24 +1801,49 @@ class GraduationTaskssettinglist extends Component{
-
-
{taskslistdata&&taskslistdata.work_count}个检索结果({taskslistdata&&taskslistdata.work_count} 学生)
-
-
-
+ {this.props.isAdmin()===true?
+
+
+ {taskslistdata&&taskslistdata.work_count}
+ 个检索结果({taskslistdata&&taskslistdata.work_count} 学生)
+
+
+
+ :""}
+
+
+ {this.props.isStudent()===true?
+
+
+ {taskslistdata&&taskslistdata.commit_count}
+ 已交
+
+ {taskslistdata&&taskslistdata.uncommit_count}
+ 未交
+
+
+ {taskslistdata&&taskslistdata.left_time.status} :
+
+ {taskslistdata&&taskslistdata.left_time.time}
+
+
+
+ :""}
+
+
diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js
index e75baa3fe..3cb9bff77 100644
--- a/public/react/src/modules/courses/members/studentsList.js
+++ b/public/react/src/modules/courses/members/studentsList.js
@@ -1,5 +1,5 @@
import React,{ Component } from "react";
-import { Input,Checkbox,Table, Pagination, Modal,Menu ,Spin} from "antd";
+import { Input,Checkbox,Table, Pagination, Modal,Menu ,Spin, Tooltip} from "antd";
import ClipboardJS from 'clipboard'
import '../css/Courses.css'
import '../css/members.css'
@@ -31,14 +31,6 @@ const dataSource = [{
const buildColumns = (that) => {
const columns=[{
- title: '',
- dataIndex: 'check',
- key: 'check',
- render: (text, item) => {
- return
- },
- width:"5%"
- },{
title: '序号',
dataIndex: 'id',
key: 'id',
@@ -71,10 +63,23 @@ const buildColumns = (that) => {
width:"50%",
className:"color-grey-6"
}];
+ const isAdmin = that.props.isAdmin()
+ if (isAdmin) {
+ columns.unshift({
+ title: '',
+ dataIndex: 'check',
+ key: 'check',
+ render: (text, item) => {
+ return
+ },
+ width:"5%"
+ })
+ }
+
return columns;
}
-// 1-按照学号排序 2-按照分班排序,
+// 1-按照学生学号 2-按照分班名称,
const ORDER_BY_NUM = 1;
const ORDER_BY_GROUP = 2;
@@ -312,6 +317,8 @@ class studentsList extends Component{
if (result.data.status == 0) {
this.props.showNotification('移动成功')
this.fetchAll()
+ this.props.updataleftNavfun()
+
}
}).catch((error)=>{
console.log(error);
@@ -357,6 +364,7 @@ class studentsList extends Component{
this.props.showNotification('删除成功')
this.fetchAll()
this.setState({checkBoxValues: []})
+ trigger('updatabanner')
}
}).catch((error)=>{
console.log(error);
@@ -423,9 +431,9 @@ class studentsList extends Component{
checkBoxValues,
checkAllValue
}=this.state;
- let currentOrderName = '学号排序'
+ let currentOrderName = '学生学号'
if (order == ORDER_BY_GROUP) {
- currentOrderName = '分班排序'
+ currentOrderName = '分班名称'
}
const { coursesids } = this.props
const course_group_id = this.props.match.params.course_group_id
@@ -445,7 +453,14 @@ class studentsList extends Component{
{invite_code}
-
+
+ 成员可以通过邀请码主动加入课堂
+ 点击立刻复制邀请码
+ }>
+
+
+
+
}
@@ -528,7 +543,7 @@ class studentsList extends Component{
total_count > 0 ?
-
已选 {checkBoxValues.length} 个
+ {isAdmin &&
已选 {checkBoxValues.length} 个}
{isAdmin &&
删除}
{isAdmin &&
@@ -562,8 +577,8 @@ class studentsList extends Component{
{currentOrderName}
- - this.onSortTypeChange(ORDER_BY_NUM)} >学号排序
- - this.onSortTypeChange(ORDER_BY_GROUP)} >分班排序
+ - this.onSortTypeChange(ORDER_BY_NUM)} >学生学号
+ - this.onSortTypeChange(ORDER_BY_GROUP)} >分班名称
diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js
index 0ee44c210..b474547b8 100644
--- a/public/react/src/modules/courses/members/teacherList.js
+++ b/public/react/src/modules/courses/members/teacherList.js
@@ -32,13 +32,6 @@ function buildColumns(that) {
const isAdminOrTeacher = that.props.isAdminOrTeacher()
const { course_groups } = that.state
const columns = [{
- title: '',
- dataIndex: 'course_member_id',
- key: 'course_member_id',
- render: (content, item, index) => {
- return
- }
- },{
title: '序号',
// dataIndex: 'name',
key: 'index',
@@ -62,7 +55,7 @@ function buildColumns(that) {
dataIndex: 'role',
key: 'role',
}]
- that.course_groups && that.course_groups.length && columns.push({
+ that.state.course_groups && that.state.course_groups.length && columns.push({
title:
管理权限,
width: 230,
key: 'course_groups',
@@ -116,7 +109,8 @@ function buildColumns(that) {
}
,
});
- if (that.hasGraduationModule()) {
+ const hasGraduationModule = that.hasGraduationModule()
+ if (hasGraduationModule) {
columns.push({
title: '答辩组',
key: 'graduation_group',
@@ -156,6 +150,16 @@ function buildColumns(that) {
},
})
}
+ if(isAdmin && hasGraduationModule) {
+ columns.unshift({
+ title: '',
+ dataIndex: 'course_member_id',
+ key: 'course_member_id',
+ render: (content, item, index) => {
+ return
+ }
+ })
+ }
return columns
}
@@ -185,7 +189,7 @@ class studentsList extends Component{
searchValue:e.target.value
})
}
-
+ // approval 2 - 拒绝
onAgree = (record, approval = 1) => {
const courseId = this.props.match.params.coursesId
@@ -198,7 +202,7 @@ class studentsList extends Component{
})
.then((response) => {
if (response.data.status == 0) {
- this.props.showNotification(`已${approval ? '同意' : '拒绝'}`)
+ this.props.showNotification(`已${approval == 1? '同意' : '拒绝'}`)
this.fetchAll(1)
}
})
@@ -216,14 +220,22 @@ class studentsList extends Component{
})
this.fetchAll(1);
const isAdminOrTeacher = this.props.isAdminOrTeacher()
+ const isAdmin = this.props.isAdmin()
isAdminOrTeacher && this.getGroupList();
this.getCourseGroups();
on('addTeacherSuccess', this.addTeacherSuccessListener)
+ isAdmin && on('updateNavSuccess', this.updateNavSuccess)
+
}
componentWillUnmount() {
off('addTeacherSuccess', this.addTeacherSuccessListener)
+ const isAdmin = this.props.isAdmin()
+ isAdmin && off('updateNavSuccess', this.updateNavSuccess)
+ }
+ updateNavSuccess = () => {
+ this.getCourseGroups()
}
addTeacherSuccessListener = (e, data) => {
// const params = JSON.parse(data)
@@ -454,6 +466,7 @@ class studentsList extends Component{
if (response.data.status == 0) {
// {"status":1,"message":"删除成功"}
this.props.showNotification('删除成功')
+ trigger('updatabanner')
this.fetchAll()
}
})
@@ -499,6 +512,7 @@ class studentsList extends Component{
})
}
const isAdminOrTeacher = this.props.isAdminOrTeacher()
+ const hasGraduationModule = this.hasGraduationModule()
return(
@@ -544,9 +558,9 @@ class studentsList extends Component{
`}
-
已选 {checkBoxValues.length} 个
+ { isAdmin && hasGraduationModule &&
已选 {checkBoxValues.length} 个 }
{
- { this.hasGraduationModule() && isAdminOrTeacher &&
+ { hasGraduationModule && isAdminOrTeacher &&
加入答辩组
diff --git a/public/react/src/modules/courses/poll/PollDetailTabForthRules.js b/public/react/src/modules/courses/poll/PollDetailTabForthRules.js
index ad5a07432..4193cdc62 100644
--- a/public/react/src/modules/courses/poll/PollDetailTabForthRules.js
+++ b/public/react/src/modules/courses/poll/PollDetailTabForthRules.js
@@ -340,8 +340,8 @@ class PollDetailTabForthRules extends Component{
- (学生收到{this.props.type==="Exercise"?"试卷":"问卷"}的时间)
- (学生可以答题的时间截点)
+ (学生收到{this.props.moduleName || (this.props.type==="Exercise"?"试卷":"问卷")}的时间)
+ ({this.props.moduleName == '作业' ? '学生“按时”提交作品的时间截点' : '学生可以答题的时间截点'})
{
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index 3e3bf95c4..62953fedb 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -299,9 +299,11 @@ class Listofworks extends Component {
var data = {
search: "",
order: "",
- b_order: "",
+ b_order: "asc",
work_status: "",
course_group: "",
+ page:1,
+ limit:20,
}
axios.post(urll, data).then((result) => {
if (result !== undefined) {
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
index 673d864de..f456cdd5d 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
@@ -90,7 +90,9 @@ class Listofworksstudentone extends Component {
var data = {
search: "",
order: "",
- b_order: "",
+ b_order: "asc",
+ page:1,
+ limit:20,
work_status: "",
course_group: "",
}
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
index 8ad70753f..272ac6418 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
@@ -210,7 +210,7 @@ class ShixunhomeWorkItem extends Component{
{
@@ -54,68 +57,116 @@ class TraineetraininginformationModal extends Component {
// console.log(datalist)
// }
render() {
- let columns = [
- {
- title: '关卡',
- dataIndex: 'number',
- key: 'number',
- width: 150,
- align: "center",
- render: (text, record) => (
-
- {record.number}
+ const columns = [
+ {
+ title: '关卡',
+ dataIndex: 'number',
+ key: 'number',
+ align: "center",
+ render: (text, record) => (
+
+ {record.number}
+
+ ),
+ },
+ {
+ title: '完成时间',
+ dataIndex: 'name',
+ key: 'name',
+ width: 178,
+ align: "center",
+ render: (text, record) => (
+
+ {record.name==='Invalid date'?"--":record.name}
+
+ ),
+ },
+ {
+ title: '耗时',
+ dataIndex: 'stduynumber',
+ key: 'stduynumber',
+ align: "center",
+ render: (text, record) => (
+
+ {record.stduynumber}
+
+ ),
+ },
+ {
+ title: '经验值',
+ key: 'classroom',
+ dataIndex: 'classroom',
+ align: "center",
+ render: (text, record) => (
+
+ {record.classroom}
- ),
- },
- {
- title: '完成时间',
- dataIndex: 'name',
- key: 'name',
- width: 150,
- align: "center",
- render: (text, record) => (
-
+ ),
+ }
+ ];
+ const columnss = [
+ {
+ title: '关卡',
+ dataIndex: 'number',
+ key: 'number',
+ width: 92,
+ align: "center",
+ render: (text, record) => (
+
+ {record.number}
+
+ ),
+ },
+ {
+ title: '完成时间',
+ dataIndex: 'name',
+ key: 'name',
+ width: 178,
+ align: "center",
+ render: (text, record) => (
+
{record.name==='Invalid date'?"--":record.name}
- ),
- },
- {
- title: '',
- dataIndex: 'complete_status',
- key: 'complete_status',
- width: 150,
- align: "center",
- render: (text, record) => (
-
- {record.complete_status===2?:record.complete_status===3?:""}
+ ),
+ },
+ {
+ title: '',
+ dataIndex: 'complete_status',
+ key: 'complete_status',
+ width: 100,
+ align: "center",
+ render: (text, record) => (
+
+ {record.complete_status===2?:record.complete_status===3?:""}
+
- ),
- },
- {
- title: '耗时',
- dataIndex: 'stduynumber',
- key: 'stduynumber',
- width: 150,
- align: "center",
- render: (text, record) => (
-
+ ),
+ },
+ {
+ title: '耗时',
+ dataIndex: 'stduynumber',
+ key: 'stduynumber',
+ width: 92,
+ align: "center",
+ render: (text, record) => (
+
{record.stduynumber}
- ),
- },
- {
- title: '经验值',
- key: 'classroom',
- width: 150,
- dataIndex: 'classroom',
- align: "center",
- render: (text, record) => (
-
+ ),
+ },
+ {
+ title: '经验值',
+ key: 'classroom',
+ width: 92,
+ dataIndex: 'classroom',
+ align: "center",
+ render: (text, record) => (
+
{record.classroom}
- ),
- }
- ];
+ ),
+ }
+ ];
return (
@@ -128,62 +179,81 @@ class TraineetraininginformationModal extends Component {
onCancel={this.Cancel}
>
-
-
+
+
-
-
-
-
- {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.username} 通关:{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.complete_count}/{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.challenges_count}
-
- 完成效率:{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.efficiency}
-
- 通关时间: {this.props.viewtrainingdata === undefined ? "":moment(this.props.viewtrainingdata.passed_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"--":moment(this.props.viewtrainingdata.passed_time).format('YYYY-MM-DD HH:mm')}
+
-
-
- 课堂最高完成效率: {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.max_efficiency}
-
- 总耗时: {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.total_spend_time}
+
+
- {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.username} 通关:{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.complete_count}/{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.challenges_count}
+ - 完成效率:{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.efficiency}
+ - 通关时间: {this.props.viewtrainingdata === undefined ? "":moment(this.props.viewtrainingdata.passed_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"--":moment(this.props.viewtrainingdata.passed_time).format('YYYY-MM-DD HH:mm')}
+
+
+
- 课堂最高完成效率: {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.max_efficiency}
+ - 总耗时: {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.total_spend_time}
+
- {
- this.props.game_list === undefined?"" : this.props.game_list.length<4?
-
- :""
- }
-
-
- {this.props.game_list === undefined ? "" :
+
+
+ {this.props.game_list === undefined ? "" : }
+
+ :
+
+
+ {this.props.game_list === undefined ? "" :
}
-
+ loading={false}
+ pagination={false}
+ onChange={this.TablePagination}
+ scroll={{ y: 300 }}
+ />}
+
+ }
+
+
+
diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
index a15fd16b1..bd24abb02 100644
--- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
+++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
@@ -141,7 +141,7 @@ class Trainingjobsetting extends Component {
// console.log(homeworkid)
let url = `/homework_commons/${homeworkid}/settings.json`;
axios.get(url).then((result) => {
- if (result.status === 200) {
+ if (result!=undefined) {
// console.log(result.data.code_review)
// console.log("设置页")
// console.log(JSON.stringify(result))
@@ -637,11 +637,12 @@ class Trainingjobsetting extends Component {
//允许补交
onChanges = (e) => {
- // debugger
+ // console.log("640");
+ // console.log(this.state.end_time);
if(e.target.value ==="允许补交"){
if(this.state.end_time !== null && this.state.end_time!== undefined){
// console.log(this.state.end_time);
- var times = this.state.end_time.format('YYYY-MM-DD HH:mm');
+ var times = this.state.deadline.format('YYYY-MM-DD HH:mm');
this.setState({
late_time:moment(handleDateString(times)).add(1, 'months'),
late_times:moment(handleDateString(times)).add(1, 'months').format('YYYY-MM-DD HH:mm'),
@@ -955,26 +956,60 @@ class Trainingjobsetting extends Component {
- disabledEndDate = (end_time) => {
- const publish_time = this.state.publish_time;
- if (!end_time || !publish_time) {
+ // disabledEndDate = (end_time) => {
+ // const publish_time = this.state.publish_time;
+ // if (!end_time || !publish_time) {
+ // return false;
+ // }
+ // return end_time.valueOf() <= publish_time.valueOf();
+ //
+ // }
+ // disabledEndDates = (end_time) => {
+ // const publish_time = this.state.end_time
+ // if (!end_time || !publish_time) {
+ // return false;
+ // }
+ // console.log("end_time.valueOf()")
+ // // console.log(end_time.valueOf());
+ // // console.log(publish_time.valueOf());
+ // return end_time.valueOf() <= publish_time.valueOf();
+ //
+ //
+ // }
+
+ disabledStartDatestart= (startValue) => {
+ const endValue = this.state.end_time
+
+ if (!startValue || !endValue) {
return false;
}
- return end_time.valueOf() <= publish_time.valueOf();
+ var endValues= moment(endValue).subtract(1, 'days');
+ return startValue.valueOf() > endValues.valueOf();
+ };
- }
- disabledEndDates = (end_time) => {
- const publish_time = this.state.end_time
- if (!end_time || !publish_time) {
+ disabledEndDateend = (endValue) => {
+ const startValue = this.state.publish_time;
+ if (!endValue || !startValue) {
return false;
}
- console.log("end_time.valueOf()")
- // console.log(end_time.valueOf());
- // console.log(publish_time.valueOf());
- return end_time.valueOf() <= publish_time.valueOf();
+ var endValuesys= moment(startValue).subtract(1, 'days');
+
+ return endValue.valueOf() <= endValuesys.valueOf();
+ };
+
+ disabledEndDateendd = (endsValue) => {
+ const endValues = this.state.end_time
+
+ if (!endsValue|| !endValues) {
+ return false;
+ }
+ var endValuesyss= moment(endValues).subtract(1, 'days');
+
+ return endsValue.valueOf() <= endValuesyss.valueOf();
+ };
+
- }
onChangedata = (field, value, dateString) => {
this.setState({
[field]: handleDateString(dateString),
@@ -1085,7 +1120,10 @@ class Trainingjobsetting extends Component {
// console.log(value);
console.log(dateString);
// console.log(handleDateString(dateString));
- this.onChangedata('publish_time', value, dateString);
+ // this.onChangedata('publish_time', value, dateString);
+ this.setState({
+ publish_time:moment(handleDateString(dateString))
+ })
if(this.state.allowreplenishment === "允许补交") {
this.setState({
end_time:moment(handleDateString(dateString)).add(1, 'months'),
@@ -1123,13 +1161,15 @@ class Trainingjobsetting extends Component {
deadline:undefined,
})
} else {
+ // console.log(moment(value, "YYYY-MM-DD HH:mm"));
+ // console.log(moment(this.state.publish_time, "YYYY-MM-DD HH:mm"));
if (moment(value, "YYYY-MM-DD HH:mm") <= moment(this.state.publish_time, "YYYY-MM-DD HH:mm")) {
this.setState({
unit_e_tip: "截止时间不能早于发布时间",
p_flag: true,
borredss:"bor-reds",
- end_time:undefined,
- deadline:undefined,
+ end_time:value.format('YYYY-MM-DD HH:mm'),
+ deadline:value.format('YYYY-MM-DD HH:mm'),
})
return
@@ -1144,11 +1184,13 @@ class Trainingjobsetting extends Component {
} catch (e) {
}
- this.onChangedata('end_time', value, dateString);
+ // this.onChangedata('end_time', value, dateString);
if(this.state.allowreplenishment === "允许补交"){
this.setState({
- late_time:moment(handleDateString(dateString)).add(1, 'months'),
- late_times:moment(handleDateString(dateString)).add(1, 'months').format('YYYY-MM-DD HH:mm'),
+ end_time:moment(handleDateString(dateString)),
+ deadline:moment(handleDateString(dateString)).format('YYYY-MM-DD HH:mm'),
+ late_time:moment(handleDateString(dateString)).add(2, 'months'),
+ late_times:moment(handleDateString(dateString)).add(2, 'months').format('YYYY-MM-DD HH:mm'),
})
}
@@ -1164,7 +1206,7 @@ class Trainingjobsetting extends Component {
})
return;
}
- let{publish_time,unifiedsetting,rulesdata}=this.state;
+ let{publish_time,end_time,unifiedsetting,rulesdata}=this.state;
if(unifiedsetting===true){
if (moment(value, "YYYY-MM-DD HH:mm") <= moment(publish_time)) {
@@ -1172,20 +1214,30 @@ class Trainingjobsetting extends Component {
hand__e_tip: "补交时间不能早于发布时间",
hand_flags: true,
handclass:"bor-reds",
- late_times:undefined,
- late_time:undefined,
+ late_times:value.format('YYYY-MM-DD HH:mm'),
+ late_time:value.format('YYYY-MM-DD HH:mm'),
})
- } else {
+ }
+ else if (moment(value, "YYYY-MM-DD HH:mm") <= moment(end_time)) {
+ this.setState({
+ hand__e_tip: "补交时间不能早于截止时间",
+ hand_flags: true,
+ handclass:"bor-reds",
+ late_times: value.format('YYYY-MM-DD HH:mm'),
+ late_time:value.format('YYYY-MM-DD HH:mm'),
+ })
+ }
+ else {
try {
this.setState({
late_times: value.format('YYYY-MM-DD HH:mm'),
+ late_time:value.format('YYYY-MM-DD HH:mm'),
hand__e_tip: "",
hand_flags: false,
handclass:"",
})
- this.onChangedata('late_time', value, dateString);
}catch (e) {
}
@@ -1206,11 +1258,11 @@ class Trainingjobsetting extends Component {
}else{
this.setState({
late_times: value.format('YYYY-MM-DD HH:mm'),
+ late_time:value.format('YYYY-MM-DD HH:mm'),
hand__e_tip: "",
hand_flags: false,
handclass:undefined,
})
- this.onChangedata('late_time', value, dateString);
}
}
@@ -1587,6 +1639,19 @@ class Trainingjobsetting extends Component {
{this.props.isAdmin()?this.state.code_review===false?"": 代码查重 : ""}
+
设置
@@ -1611,7 +1676,7 @@ class Trainingjobsetting extends Component {
-
+
分值
{/*公开设置*/}
-
+
@@ -1879,7 +1943,6 @@ class Trainingjobsetting extends Component {
-
diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
index 02107b912..7ebbeb473 100644
--- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
+++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
@@ -427,7 +427,7 @@ class Workquestionandanswer extends Component {
- {jobsettingsdata === undefined|| jobsettingsdata.data.description===null? "" :
+ {jobsettingsdata === undefined|| jobsettingsdata.data.description===null? "无" :
@@ -466,7 +466,8 @@ class Workquestionandanswer extends Component {
- {jobsettingsdata === undefined ? "" : jobsettingsdata === null ? "" : jobsettingsdata === "null" ? "" :
+ {jobsettingsdata === undefined ? "无" : jobsettingsdata === null ? "无" : jobsettingsdata === "null" ? "无" :
+ jobsettingsdata.data.explanation=== undefined?"无" :jobsettingsdata.data.explanation=== null?"无":
}
diff --git a/public/react/src/modules/forums/RightSection.css b/public/react/src/modules/forums/RightSection.css
index 3efe0bc43..73994ae24 100644
--- a/public/react/src/modules/forums/RightSection.css
+++ b/public/react/src/modules/forums/RightSection.css
@@ -1,52 +1,53 @@
-/* 右侧搜索区域*/
-.searchFor .searchCon {
- width: 215px;
-}
-
-.search-new {
- width:237px!important;
- height: 30px;
- margin-bottom: 30px;
-}
- .search-new-input {
- padding-left: 16px;
- height: 30px;
- }
- .search-span {
- border-radius: 17px;
- }
-
-.search-new img {
- right: 10px;
-}
-
-
-/* 右侧 热门标签 */
-.HotLabelList a{display: block;float: left;padding: 0px 9px;height: 28px;line-height: 28px;border-radius: 14px;background-color: #f5f5f5;color: #666;margin-right: 10px;margin-bottom: 9px;}
-.HotLabelList a.selected {
- background: #4CACFF;
- color: #fff;
-}
-
-
-
-/* 右侧 热门问题 */
-.hotQuestionItem{padding:20px 0px;border-bottom: 1px solid #eee;}
-.questiontName{max-width: 100%;display: block;}
-
-
-
-/* 用户信息-UserSection*/
-.user_default_btn {width: 114px;}
-.userPrivateName{line-height: 25px;margin-bottom: 9px;}
-.userPrivatePost{line-height: 20px;}
-.noteDetailTitle{line-height: 38px;font-size: 24px;font-weight: normal;text-align:justify }
-
-.noteDetailNum{float: left;padding:0px 12px;position: relative;color: #999!important;height: 28px;line-height: 26px;}
-.noteDetailNum.rightline:after{position: absolute;content: '';right: 0px;width: 1px;background-color: #EAEAEA;height: 8px;top:10px;}
-
-/*帖子详情点赞*/
-.noteDetailPoint{width: 100px;height: 70px;background-color: #4cacff;border-radius: 35px;color: #FFFFff;text-align: center;margin: 0px auto;box-sizing: border-box;padding: 2px 0px;cursor: pointer; line-height: 22px;
- padding-top: 12px;}
-.Pointed{background-color:#f0f0f0;color: #b3b3b3; cursor: default}
-.notefileDownload{height: 25px;line-height: 22px;}
+/* 右侧搜索区域*/
+.searchFor .searchCon {
+ width: 215px;
+}
+
+.search-new {
+ width:237px!important;
+ height: 30px;
+ margin-bottom: 30px;
+ margin-right: 35px;
+}
+ .search-new-input {
+ padding-left: 16px;
+ height: 30px;
+ }
+ .search-span {
+ border-radius: 17px;
+ }
+
+.search-new img {
+ right: 10px;
+}
+
+
+/* 右侧 热门标签 */
+.HotLabelList a{display: block;float: left;padding: 0px 9px;height: 28px;line-height: 28px;border-radius: 14px;background-color: #f5f5f5;color: #666;margin-right: 10px;margin-bottom: 9px;}
+.HotLabelList a.selected {
+ background: #4CACFF;
+ color: #fff;
+}
+
+
+
+/* 右侧 热门问题 */
+.hotQuestionItem{padding:20px 0px;border-bottom: 1px solid #eee;}
+.questiontName{max-width: 100%;display: block;}
+
+
+
+/* 用户信息-UserSection*/
+.user_default_btn {width: 114px;}
+.userPrivateName{line-height: 25px;margin-bottom: 9px;}
+.userPrivatePost{line-height: 20px;}
+.noteDetailTitle{line-height: 38px;font-size: 24px;font-weight: normal;text-align:justify }
+
+.noteDetailNum{float: left;padding:0px 12px;position: relative;color: #999!important;height: 28px;line-height: 26px;}
+.noteDetailNum.rightline:after{position: absolute;content: '';right: 0px;width: 1px;background-color: #EAEAEA;height: 8px;top:10px;}
+
+/*帖子详情点赞*/
+.noteDetailPoint{width: 100px;height: 70px;background-color: #4cacff;border-radius: 35px;color: #FFFFff;text-align: center;margin: 0px auto;box-sizing: border-box;padding: 2px 0px;cursor: pointer; line-height: 22px;
+ padding-top: 12px;}
+.Pointed{background-color:#f0f0f0;color: #b3b3b3; cursor: default}
+.notefileDownload{height: 25px;line-height: 22px;}
diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js
index df5b5f8b8..f084dec66 100644
--- a/public/react/src/modules/login/EducoderLogin.js
+++ b/public/react/src/modules/login/EducoderLogin.js
@@ -149,7 +149,7 @@ class EducoderLogin extends Component {
"align-items": "center",
"width": "100%",
}}>
-
+
@@ -163,7 +163,7 @@ class EducoderLogin extends Component {
"align-items": "center",
"width": "100%",
}}>
-
+
@@ -171,15 +171,13 @@ class EducoderLogin extends Component {
}
-
-
© 2019 EduCoder 湘ICP备17009477号 Trustie & IntelliDE inside
-
-
+
© 2019 EduCoder
湘ICP备17009477号Trustie & IntelliDE inside.
diff --git a/public/react/src/modules/login/Trialapplication.js b/public/react/src/modules/login/Trialapplication.js
index 9285bd1f0..4f8c5d114 100644
--- a/public/react/src/modules/login/Trialapplication.js
+++ b/public/react/src/modules/login/Trialapplication.js
@@ -12,7 +12,7 @@ import {broadcastChannelPostMessage} from 'educoder'
import {Tabs, Input, Checkbox, Button, notification, Menu} from 'antd';
-//试用申请页面
+//试用申请
class Trialapplication extends Component {
// isRender控制弹出窗口显示
constructor(props) {
@@ -34,8 +34,8 @@ class Trialapplication extends Component {
showTrial: false,
}
//user_phone_binded 判断是否手机号验证
- console.log("Trialapplication");
- console.log(props);
+ // console.log("Trialapplication");
+ // console.log(props);
}
Cancel = () => {
@@ -77,9 +77,9 @@ class Trialapplication extends Component {
//TODO 这里如果样式变了会出现css不加载的情况
});
- console.log(this.props.isRenders);
- console.log("89");
- console.log(this.state.props.user_phone_binded );
+ // console.log(this.props.isRenders);
+ // console.log("89");
+ // console.log(this.state.props.user_phone_binded );
try {
if (this.state.props.user_phone_binded !== undefined) {
console.log(this.state.props.user_phone_binded);
diff --git a/public/react/src/modules/page/tpiPage.css b/public/react/src/modules/page/tpiPage.css
index e803ca51f..34274907e 100644
--- a/public/react/src/modules/page/tpiPage.css
+++ b/public/react/src/modules/page/tpiPage.css
@@ -1,375 +1,376 @@
-
-.page--header {
- z-index: 1399 !important;
-}
-
-/* 左右分隔条 */
-.b-label {
- background: #111c24;
-}
-.b-label>.resize-helper {
- height: 30px;
- position: relative;
- margin-top: -20px;
- margin-left: -17px;
- left: 50%;
- top: 50%;
- z-index: 50;
-}
-.b-label>.resize-helper button{
- width: 24px;
- height: 24px;
- min-height: 24px;
- opacity: 0.7;
-}
-.b-label>.resize-helper button:hover {
- opacity: 1;
-}
-
-.b-label>.resize-helper button path {
- color: #666666;
- fill: currentColor;
-}
-
-/* 所有i都加上动画 */
-#game_right_contents i {
- transition: transform .3s ease;
-}
-
-
-/* */
-.h-center {
- height: 3px;
- background: rgb(17, 28, 36);
- border-top: 1px solid rgb(25, 82, 123);
-}
-
-
-/* */
-/* codemirror初始化的时候高度没100% */
-#codetab_con_1 {
- /*display: flex;*/
-}
-.CodeMirror{
- /*height: -webkit-fill-available !important;*/
- line-height: 1.2;
-
- /*height: auto !important;
- flex: 1 1 auto;*/
-}
-
-/* LeftView markdown */
-#game_show_content #tab_con_1 .editormd-preview, #game_show_content #tab_con_2 .editormd-preview
- ,#game_show_content #tab_con_3 .editormd-preview
- ,#game_show_content #tab_con_5 .editormd-preview {
- width: 100% !important;
- height: 100% !important;
-}
-
-/* tab 样式覆盖 */
-#blacktab_nav {
- background-color: #111C24;
- border-bottom: 1px solid #222C34;
-}
-.blacktab_hover {
-
-}
-.blacktab_hover a:after {
- content: '';
- position: absolute;
- left: 50%;
- margin-left: -10px;
- top: auto;
- bottom: 0;
- right: auto;
- height: 2px;
- width: 20px;
- background-color: #29BD8B;
-}
-
-button.buttonHoverColor:hover a {
- color: #FF7500!important;
-}
-
-/*--------------------------------------------------- Header Start */
-.leftNavDrawer {
- z-index: 8000 !important;
-}
-.leftNavDrawer>div:nth-child(2) {
- /*left:80px !important;*/
- z-index: 8000 !important;
- top: 54px;
- overflow: hidden;
-}
-.leftNavDrawer .MuiDrawer-paper-2 {
- width: 500px;
-}
-
-.leftNavDrawer .page--over {
- left: 0px;
- position: static;
-}
-.leftNavDrawer .col-width-3 {
- position: static;
- width: 400px;
- border: none;
-}
-
-
-#myshixun_top {
- display: flex;
- height: 54px;
-}
-.headerLeft {
- flex: 0 0 400px;
-}
- #user_grade a {
- color: white;
- }
- .-header-right {
- right: inherit;
- margin-left: 24px;
- display: inline-block;
- top: 10px;
- height: 32px;
- padding: 3px 15px
- }
- .userInfo {
- display: inline-block;
- top: 4px;
- position: relative;
- margin-left: 10px;
- }
- .userInfo img {
- border-radius: 18px;
- vertical-align: bottom;
- }
- .userInfo .userInfoName {
- margin-left: 12px;
- color: #fff;
- font-size: 16px;
- }
- #user_grade {
- margin-top: -1px;
- }
-.headerCenter {
- flex: 1 1 auto;
- text-align: center;
- flex-direction: column;
-}
- .headerCenter h2 {
- max-width: none;
- width: 100%;
- font-size: 16px;
- flex: 0 0 24px;
- }
- .headerCenter .timeRecord {
- font-size: 13px;
- color: #CCCCCC;
- width: 100px;
- margin: auto;
- }
-.headerRight {
- flex: 0 0 400px;
-}
- .headerRight a {
- color: #1A3F5F;
- font-size: 16px;
- }
- .headerRight .exitBtn {
- color: #1a3f5f !important;
- }
- .headerRight a:hover {
- color: #4CACFF !important;
- }
- .headerRight i {
- font-size: 24px !important;
- margin-right: 8px;
- margin-top: 12px;
- vertical-align: -4px;
- }
-
-
-/*--------------------------------------------------- Header End */
-/* picture_display 样式,language_display处理*/
-.photo_display {
- padding-top: 54px;
- padding-left: 0px;
-}
-.with33{ width: 33%;}
-.with49{ width: 49%;}
-.mr1precent{margin-right: 1%;}
-.mr03precent{margin-right: 0.3%;}
-/*TPI输出TXT文件显示*/
-.output-txt{padding: 10px;box-shadow:1px 6px 24px rgba(17,28,36,0.2);min-height: 500px;width: 100%;box-sizing: border-box;outline: none;}
-
-/* -------------------------------------- m design 控件样式修改*/
-.rootSnackbar {
- top: 60px !important;
- z-index: 99999999 !important;
-}
-.rootSnackbar>div>div {
- margin: 0 auto;
-}
-
-/* Dialog */
-#alert-dialog-title>h2 {
- text-align: center;
-}
- #alert-dialog-title {
- border-bottom: 1px solid #eee;
- margin-bottom: 18px;
- }
-body>div[role=dialog]>div[role=document]>div:nth-child(3) {
- justify-content: center;
-}
-body>div[role=dialog]>div {
- /* tpi dialog按钮改成平铺的大按钮 */
- /* padding-bottom: 10px; */
-}
-/* tpi 窗口宽度*/
-body>div[role=dialog] div[role=document] {
- min-width: 400px;
-}
-#alert-dialog-title + div {
- text-align: center;
-}
-
-body>div>div[role=tooltip] {
- font-size: 12px;
-}
-
-/* -------------------------------------- m design 控件样式修改 END*/
-
-/*rc-tree样式*/
-.repoFilesDrawer .rc-tree li span.rc-tree-checkbox, .rc-tree li span.rc-tree-iconEle, .rc-tree li span.rc-tree-switcher {
- background-image:url('../../images/component/rc-tree.png');
-}
-.rc-tree li span.rc-tree-node-selected .rc-tree-iconEle {
- background-image:url('../../images/component/selectFile.png');
- background-position: 0;
- margin-bottom: 4px;
-}
-.repoFilesDrawer .rc-tree li span.rc-tree-icon_loading {
- margin-right: 2px;
- vertical-align: top;
- background: url(data:image/gif;base64,R0lGODlhEAAQAKIGAMLY8YSx5HOm4Mjc88/g9Ofw+v///wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFCgAGACwAAAAAEAAQAAADMGi6RbUwGjKIXCAA016PgRBElAVlG/RdLOO0X9nK61W39qvqiwz5Ls/rRqrggsdkAgAh+QQFCgAGACwCAAAABwAFAAADD2hqELAmiFBIYY4MAutdCQAh+QQFCgAGACwGAAAABwAFAAADD1hU1kaDOKMYCGAGEeYFCQAh+QQFCgAGACwKAAIABQAHAAADEFhUZjSkKdZqBQG0IELDQAIAIfkEBQoABgAsCgAGAAUABwAAAxBoVlRKgyjmlAIBqCDCzUoCACH5BAUKAAYALAYACgAHAAUAAAMPaGpFtYYMAgJgLogA610JACH5BAUKAAYALAIACgAHAAUAAAMPCAHWFiI4o1ghZZJB5i0JACH5BAUKAAYALAAABgAFAAcAAAMQCAFmIaEp1motpDQySMNFAgA7) no-repeat scroll 0 0 transparent;
-}
-
-/*去除选中的颜色*/
-.repoFilesDrawer .rc-tree-node-selected {
- background-color: #4CACFF;
- border: 1px solid #4CACFF;
- opacity: 1;
- height: 26px !important;
-}
-.repoFilesDrawer .rc-tree-node-selected span.rc-tree-title {
- color: #fff;
-}
-
-/*
-
- Name: Railscasts
- Author: Ryan Bates (http://railscasts.com)
-
- CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
- Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
-
-*/
-
-.cm-s-railscasts.CodeMirror {background: #2b2b2b;color: #f4f1ed;line-height: 21px;}
-.cm-s-railscasts div.CodeMirror-selected {background: #214283 !important;}
-.cm-s-railscasts .CodeMirror-gutters {/*background: #2b2b2b; */border-right: 0px;}
-.cm-s-railscasts .CodeMirror-linenumber {color: #5a647e;}
-.cm-s-railscasts .CodeMirror-cursor {border-left: 1px solid #d4cfc9 !important;}
-
-.cm-s-railscasts span.cm-comment {color: #bc9458;}
-.cm-s-railscasts span.cm-atom {color: #b6b3eb;}
-.cm-s-railscasts span.cm-number {color: #b6b3eb;}
-
-.cm-s-railscasts span.cm-property, .cm-s-railscasts span.cm-attribute {color: #a5c261;}
-.cm-s-railscasts span.cm-keyword {color: #da4939;}
-.cm-s-railscasts span.cm-string {color: #ffc66d;}
-
-.cm-s-railscasts span.cm-variable {color: #a5c261;}
-.cm-s-railscasts span.cm-variable-2 {color: #6d9cbe;}
-.cm-s-railscasts span.cm-def {color: #cc7833;}
-/*.cm-s-railscasts span.cm-error {background: #da4939; color: #d4cfc9;}*/
-.cm-s-railscasts span.cm-bracket {color: #f4f1ed;}
-.cm-s-railscasts span.cm-tag {color: #da4939;}
-.cm-s-railscasts span.cm-link {color: #b6b3eb;}
-
-.cm-s-railscasts .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
-.cm-s-railscasts .CodeMirror-activeline-background { background: #303040; }
-
-
-
-
-/* evaluateView*/
-
-.CodeMirror-lines{padding: 0px!important;}
-.cm-s-blackboard.CodeMirror {background: #0C1021; color: #F8F8F8; }
-.cm-s-blackboard div.CodeMirror-selected { background: #253B76; }
-.cm-s-blackboard .CodeMirror-line::selection, .cm-s-blackboard .CodeMirror-line > span::selection, .cm-s-blackboard .CodeMirror-line > span > span::selection { background: rgba(37, 59, 118, .99); }
-.cm-s-blackboard .CodeMirror-line::-moz-selection, .cm-s-blackboard .CodeMirror-line > span::-moz-selection, .cm-s-blackboard .CodeMirror-line > span > span::-moz-selection { background: rgba(37, 59, 118, .99); }
-.cm-s-blackboard .CodeMirror-gutters { background: #585858; border-right: 0; }
-.cm-s-blackboard .CodeMirror-guttermarker { color: #FBDE2D; }
-.cm-s-blackboard .CodeMirror-guttermarker-subtle { color: #888; }
-.cm-s-blackboard .CodeMirror-linenumber { color: #888;/*background: #585858;*/ }
-.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7; }
-
-.cm-s-blackboard .cm-keyword { color: #FBDE2D; }
-.cm-s-blackboard .cm-atom { color: #D8FA3C; }
-.cm-s-blackboard .cm-number { color: #D8FA3C; }
-.cm-s-blackboard .cm-def { color: #8DA6CE; }
-.cm-s-blackboard .cm-variable { color: #FF6400; }
-.cm-s-blackboard .cm-operator { color: #FBDE2D; }
-.cm-s-blackboard .cm-comment { color: #AEAEAE; }
-.cm-s-blackboard .cm-string { color: #61CE3C; }
-.cm-s-blackboard .cm-string-2 { color: #61CE3C; }
-.cm-s-blackboard .cm-meta { color: #D8FA3C; }
-.cm-s-blackboard .cm-builtin { color: #8DA6CE; }
-.cm-s-blackboard .cm-tag { color: #8DA6CE; }
-.cm-s-blackboard .cm-attribute { color: #8DA6CE; }
-.cm-s-blackboard .cm-header { color: #FF6400; }
-.cm-s-blackboard .cm-hr { color: #AEAEAE; }
-.cm-s-blackboard .cm-link { color: #8DA6CE; }
-.cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; }
-
-.cm-s-blackboard .CodeMirror-activeline-background { background: #3C3636; }
-.cm-s-blackboard .CodeMirror-matchingbracket { outline:1px solid grey;color:white !important; }
-
-.cm-s-railscasts span.cm-error {
- color: #bc9458;
-}
-
-/* 弹框 */
-.popupAll{width: 100%;height: 100%;position: fixed;z-index: 99998;background-color: rgba(5,16,26,0.6);left: 0;top:0;}
-.task-popup{ width: 30%;background: #fff; border:1px solid #e8e8e8; border-radius:10px; -webkit-box-shadow:0 0 10px #ccc; -moz-box-shadow:0 0 10px #ccc; box-shadow:0 0 10px #ccc;}
-.task-popup-text-center{ text-align: center; color: #333;}
-.task-popup-title{ border-bottom: 1px solid #eee; padding:0px 15px;text-align: center;box-sizing: border-box;line-height: 70px;height: 70px; border-radius: 10px 10px 0px 0px;font-size: 16px; }
-.task-popup-content{ padding:15px;}
-/*注释这个地方是因为会影响到实训哪块合作者删除的样式*/
-/*.task-popup-submit{ margin:0px auto 15px; width: 120px;}*/
-.task-popup-sure{ margin:0px auto 15px; width: 54px;}
-.task-popup-right-sure{margin:0px auto 15px;text-align: center}
-.task-popup-OK{ margin:15px auto; text-align: center}
-.task-popup-bggrey{ background:#fff; color:#333;}
-a.task-btn-orange{background: #4CACFF; color:#fff!important;}
-a:hover.task-btn-orange{background: #4CACFF; color:#fff!important;}
-
-
-/* 代码区域样式 */
-#games_repository_contents .readRepoFailed {
- color: #fff;
- width: 100%;
- text-align: center;
- margin-top: 120px;
-}
- #games_repository_contents .readRepoFailed .retry {
- color:#4CACFF;
- }
-
-
-
-
+
+.page--header {
+ z-index: 1399 !important;
+}
+
+/* 左右分隔条 */
+.b-label {
+ background: #111c24;
+}
+.b-label>.resize-helper {
+ height: 30px;
+ position: relative;
+ margin-top: -20px;
+ margin-left: -17px;
+ left: 50%;
+ top: 50%;
+ z-index: 50;
+}
+.b-label>.resize-helper button{
+ width: 24px;
+ height: 24px;
+ min-height: 24px;
+ opacity: 0.7;
+}
+.b-label>.resize-helper button:hover {
+ opacity: 1;
+}
+
+.b-label>.resize-helper button path {
+ color: #666666;
+ fill: currentColor;
+}
+
+/* 所有i都加上动画 */
+#game_right_contents i {
+ transition: transform .3s ease;
+}
+
+
+/* */
+.h-center {
+ height: 3px;
+ background: rgb(17, 28, 36);
+ border-top: 1px solid rgb(25, 82, 123);
+}
+
+
+/* */
+/* codemirror初始化的时候高度没100% */
+#codetab_con_1 {
+ /*display: flex;*/
+}
+.CodeMirror{
+ /*height: -webkit-fill-available !important;*/
+ line-height: 1.2;
+
+ /*height: auto !important;
+ flex: 1 1 auto;*/
+}
+
+/* LeftView markdown */
+#game_show_content #tab_con_1 .editormd-preview, #game_show_content #tab_con_2 .editormd-preview
+ ,#game_show_content #tab_con_3 .editormd-preview
+ ,#game_show_content #tab_con_5 .editormd-preview {
+ width: 100% !important;
+ height: 100% !important;
+}
+
+/* tab 样式覆盖 */
+#blacktab_nav {
+ background-color: #111C24;
+ border-bottom: 1px solid #222C34;
+}
+.blacktab_hover {
+
+}
+.blacktab_hover a:after {
+ content: '';
+ position: absolute;
+ left: 50%;
+ margin-left: -10px;
+ top: auto;
+ bottom: 0;
+ right: auto;
+ height: 2px;
+ width: 20px;
+ background-color: #29BD8B;
+}
+
+button.buttonHoverColor:hover a {
+ color: #FF7500!important;
+}
+
+/*--------------------------------------------------- Header Start */
+.leftNavDrawer {
+ z-index: 8000 !important;
+}
+.leftNavDrawer>div:nth-child(2) {
+ /*left:80px !important;*/
+ z-index: 8000 !important;
+ top: 54px;
+ overflow: hidden;
+}
+.leftNavDrawer .MuiDrawer-paper-2 {
+ width: 500px;
+}
+
+.leftNavDrawer .page--over {
+ left: 0px;
+ position: static;
+}
+.leftNavDrawer .col-width-3 {
+ position: static;
+ width: 400px;
+ border: none;
+}
+
+
+#myshixun_top {
+ display: flex;
+ height: 54px;
+}
+.headerLeft {
+ flex: 0 0 400px;
+}
+ #user_grade a {
+ color: white;
+ }
+ .-header-right {
+ right: inherit;
+ margin-left: 24px;
+ display: inline-block;
+ top: 10px;
+ height: 32px;
+ padding: 3px 15px
+ }
+ .userInfo {
+ display: inline-block;
+ top: 4px;
+ position: relative;
+ margin-left: 10px;
+ }
+ .userInfo img {
+ border-radius: 18px;
+ vertical-align: bottom;
+ }
+ .userInfo .userInfoName {
+ margin-left: 12px;
+ color: #fff;
+ font-size: 16px;
+ }
+ #user_grade {
+ margin-top: -1px;
+ }
+.headerCenter {
+ flex: 1 1 auto;
+ text-align: center;
+ flex-direction: column;
+}
+ .headerCenter h2 {
+ max-width: none;
+ width: 100%;
+ font-size: 16px;
+ flex: 0 0 24px;
+ }
+ .headerCenter .timeRecord {
+ font-size: 13px;
+ color: #CCCCCC;
+ width: 100px;
+ margin: auto;
+ }
+.headerRight {
+ flex: 0 0 400px;
+}
+ .headerRight a {
+ color: #1A3F5F;
+ font-size: 16px;
+ }
+ .headerRight .exitBtn {
+ color: #1a3f5f !important;
+ }
+ .headerRight a:hover {
+ color: #4CACFF !important;
+ }
+ .headerRight i {
+ font-size: 24px !important;
+ margin-right: 8px;
+ margin-top: 12px;
+ vertical-align: -4px;
+ }
+
+
+/*--------------------------------------------------- Header End */
+/* picture_display 样式,language_display处理*/
+.photo_display {
+ padding-top: 54px;
+ padding-left: 0px;
+}
+.with33{ width: 33%;}
+.with49{ width: 49%;}
+.mr1precent{margin-right: 1%;}
+.mr03precent{margin-right: 0.3%;}
+/*TPI输出TXT文件显示*/
+.output-txt{padding: 10px;box-shadow:1px 6px 24px rgba(17,28,36,0.2);min-height: 500px;width: 100%;box-sizing: border-box;outline: none;}
+
+/* -------------------------------------- m design 控件样式修改*/
+.rootSnackbar {
+ top: 60px !important;
+ z-index: 99999999 !important;
+}
+.rootSnackbar>div>div {
+ margin: 0 auto;
+}
+
+
+/* Dialog */
+#alert-dialog-title>h2 {
+ text-align: center;
+}
+ #alert-dialog-title {
+ border-bottom: 1px solid #eee;
+ margin-bottom: 18px;
+ }
+body>div[role=dialog]>div[role=document]>div:nth-child(3) {
+ justify-content: center;
+}
+body>div[role=dialog]>div {
+ /* tpi dialog按钮改成平铺的大按钮 */
+ /* padding-bottom: 10px; */
+}
+/* tpi 窗口宽度*/
+body>div[role=dialog] div[role=document] {
+ min-width: 400px;
+}
+#alert-dialog-title + div {
+ text-align: center;
+}
+
+body>div>div[role=tooltip] {
+ font-size: 12px;
+}
+
+/* -------------------------------------- m design 控件样式修改 END*/
+
+/*rc-tree样式*/
+.repoFilesDrawer .rc-tree li span.rc-tree-checkbox, .rc-tree li span.rc-tree-iconEle, .rc-tree li span.rc-tree-switcher {
+ background-image:url('../../images/component/rc-tree.png');
+}
+.rc-tree li span.rc-tree-node-selected .rc-tree-iconEle {
+ background-image:url('../../images/component/selectFile.png');
+ background-position: 0;
+ margin-bottom: 4px;
+}
+.repoFilesDrawer .rc-tree li span.rc-tree-icon_loading {
+ margin-right: 2px;
+ vertical-align: top;
+ background: url(data:image/gif;base64,R0lGODlhEAAQAKIGAMLY8YSx5HOm4Mjc88/g9Ofw+v///wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFCgAGACwAAAAAEAAQAAADMGi6RbUwGjKIXCAA016PgRBElAVlG/RdLOO0X9nK61W39qvqiwz5Ls/rRqrggsdkAgAh+QQFCgAGACwCAAAABwAFAAADD2hqELAmiFBIYY4MAutdCQAh+QQFCgAGACwGAAAABwAFAAADD1hU1kaDOKMYCGAGEeYFCQAh+QQFCgAGACwKAAIABQAHAAADEFhUZjSkKdZqBQG0IELDQAIAIfkEBQoABgAsCgAGAAUABwAAAxBoVlRKgyjmlAIBqCDCzUoCACH5BAUKAAYALAYACgAHAAUAAAMPaGpFtYYMAgJgLogA610JACH5BAUKAAYALAIACgAHAAUAAAMPCAHWFiI4o1ghZZJB5i0JACH5BAUKAAYALAAABgAFAAcAAAMQCAFmIaEp1motpDQySMNFAgA7) no-repeat scroll 0 0 transparent;
+}
+
+/*去除选中的颜色*/
+.repoFilesDrawer .rc-tree-node-selected {
+ background-color: #4CACFF;
+ border: 1px solid #4CACFF;
+ opacity: 1;
+ height: 26px !important;
+}
+.repoFilesDrawer .rc-tree-node-selected span.rc-tree-title {
+ color: #fff;
+}
+
+/*
+
+ Name: Railscasts
+ Author: Ryan Bates (http://railscasts.com)
+
+ CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
+ Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
+
+*/
+
+.cm-s-railscasts.CodeMirror {background: #2b2b2b;color: #f4f1ed;line-height: 21px;}
+.cm-s-railscasts div.CodeMirror-selected {background: #214283 !important;}
+.cm-s-railscasts .CodeMirror-gutters {/*background: #2b2b2b; */border-right: 0px;}
+.cm-s-railscasts .CodeMirror-linenumber {color: #5a647e;}
+.cm-s-railscasts .CodeMirror-cursor {border-left: 1px solid #d4cfc9 !important;}
+
+.cm-s-railscasts span.cm-comment {color: #bc9458;}
+.cm-s-railscasts span.cm-atom {color: #b6b3eb;}
+.cm-s-railscasts span.cm-number {color: #b6b3eb;}
+
+.cm-s-railscasts span.cm-property, .cm-s-railscasts span.cm-attribute {color: #a5c261;}
+.cm-s-railscasts span.cm-keyword {color: #da4939;}
+.cm-s-railscasts span.cm-string {color: #ffc66d;}
+
+.cm-s-railscasts span.cm-variable {color: #a5c261;}
+.cm-s-railscasts span.cm-variable-2 {color: #6d9cbe;}
+.cm-s-railscasts span.cm-def {color: #cc7833;}
+/*.cm-s-railscasts span.cm-error {background: #da4939; color: #d4cfc9;}*/
+.cm-s-railscasts span.cm-bracket {color: #f4f1ed;}
+.cm-s-railscasts span.cm-tag {color: #da4939;}
+.cm-s-railscasts span.cm-link {color: #b6b3eb;}
+
+.cm-s-railscasts .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
+.cm-s-railscasts .CodeMirror-activeline-background { background: #303040; }
+
+
+
+
+/* evaluateView*/
+
+.CodeMirror-lines{padding: 0px!important;}
+.cm-s-blackboard.CodeMirror {background: #0C1021; color: #F8F8F8; }
+.cm-s-blackboard div.CodeMirror-selected { background: #253B76; }
+.cm-s-blackboard .CodeMirror-line::selection, .cm-s-blackboard .CodeMirror-line > span::selection, .cm-s-blackboard .CodeMirror-line > span > span::selection { background: rgba(37, 59, 118, .99); }
+.cm-s-blackboard .CodeMirror-line::-moz-selection, .cm-s-blackboard .CodeMirror-line > span::-moz-selection, .cm-s-blackboard .CodeMirror-line > span > span::-moz-selection { background: rgba(37, 59, 118, .99); }
+.cm-s-blackboard .CodeMirror-gutters { background: #585858; border-right: 0; }
+.cm-s-blackboard .CodeMirror-guttermarker { color: #FBDE2D; }
+.cm-s-blackboard .CodeMirror-guttermarker-subtle { color: #888; }
+.cm-s-blackboard .CodeMirror-linenumber { color: #888;/*background: #585858;*/ }
+.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7; }
+
+.cm-s-blackboard .cm-keyword { color: #FBDE2D; }
+.cm-s-blackboard .cm-atom { color: #D8FA3C; }
+.cm-s-blackboard .cm-number { color: #D8FA3C; }
+.cm-s-blackboard .cm-def { color: #8DA6CE; }
+.cm-s-blackboard .cm-variable { color: #FF6400; }
+.cm-s-blackboard .cm-operator { color: #FBDE2D; }
+.cm-s-blackboard .cm-comment { color: #AEAEAE; }
+.cm-s-blackboard .cm-string { color: #61CE3C; }
+.cm-s-blackboard .cm-string-2 { color: #61CE3C; }
+.cm-s-blackboard .cm-meta { color: #D8FA3C; }
+.cm-s-blackboard .cm-builtin { color: #8DA6CE; }
+.cm-s-blackboard .cm-tag { color: #8DA6CE; }
+.cm-s-blackboard .cm-attribute { color: #8DA6CE; }
+.cm-s-blackboard .cm-header { color: #FF6400; }
+.cm-s-blackboard .cm-hr { color: #AEAEAE; }
+.cm-s-blackboard .cm-link { color: #8DA6CE; }
+.cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; }
+
+.cm-s-blackboard .CodeMirror-activeline-background { background: #3C3636; }
+.cm-s-blackboard .CodeMirror-matchingbracket { outline:1px solid grey;color:white !important; }
+
+.cm-s-railscasts span.cm-error {
+ color: #bc9458;
+}
+
+/* 弹框 */
+.popupAll{width: 100%;height: 100%;position: fixed;z-index: 99998;background-color: rgba(5,16,26,0.6);left: 0;top:0;}
+.task-popup{ width: 30%;background: #fff; border:1px solid #e8e8e8; border-radius:10px; -webkit-box-shadow:0 0 10px #ccc; -moz-box-shadow:0 0 10px #ccc; box-shadow:0 0 10px #ccc;}
+.task-popup-text-center{ text-align: center; color: #333;}
+.task-popup-title{ border-bottom: 1px solid #eee; padding:0px 15px;text-align: center;box-sizing: border-box;line-height: 70px;height: 70px; border-radius: 10px 10px 0px 0px;font-size: 16px; }
+.task-popup-content{ padding:15px;}
+/*注释这个地方是因为会影响到实训哪块合作者删除的样式*/
+/*.task-popup-submit{ margin:0px auto 15px; width: 120px;}*/
+.task-popup-sure{ margin:0px auto 15px; width: 54px;}
+.task-popup-right-sure{margin:0px auto 15px;text-align: center}
+.task-popup-OK{ margin:15px auto; text-align: center}
+.task-popup-bggrey{ background:#fff; color:#333;}
+a.task-btn-orange{background: #4CACFF; color:#fff!important;}
+a:hover.task-btn-orange{background: #4CACFF; color:#fff!important;}
+
+
+/* 代码区域样式 */
+#games_repository_contents .readRepoFailed {
+ color: #fff;
+ width: 100%;
+ text-align: center;
+ margin-top: 120px;
+}
+ #games_repository_contents .readRepoFailed .retry {
+ color:#4CACFF;
+ }
+
+
+
+
diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js
index 3ac61cb1e..393c28c9f 100644
--- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js
+++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js
@@ -1,618 +1,619 @@
-import React, { Component } from 'react';
-import {getImageUrl} from 'educoder';
-import {Modal,Input,Checkbox,Tooltip} from "antd";
-import { DragDropContext , Draggable, Droppable} from 'react-beautiful-dnd';
-import Modals from '../../modals/Modals';
-import Loading from '@icedesign/base/lib/loading';
-import '@icedesign/base/lib/loading/style.js';
-import '../ShixunPaths.css';
-import axios from 'axios';
-const $ = window.$;
-const Search = Input.Search;
-
-//a little function to help us with reordering the result
-const reorder = (list, startIndex, endIndex) => {
- // console.log(list)
- // console.log(startIndex)
- // console.log(endIndex)
-
- let newlist=list;
- const result = Array.from(newlist);
- const [removed] = result.splice(startIndex, 1);
- result.splice(endIndex, 0, removed);
-
- return result;
-};
-
-const getItemStyle = (isDragging, draggableStyle) => ({
- // change background colour if dragging
- background: isDragging ? '#dceeff' : '',
- // styles we need to apply on draggables
- ...draggableStyle,
-});
-
-class DetailCardsEditAndAdd extends Component{
- constructor(props){
- super(props);
- this.state={
- selectShixun:false,
- editPanel:false,
- search:"",
- type:0,
- page:1,
- ChooseShixunList:undefined,
- hometypepvisible:true,
- shixuns_listedit:undefined,
- shixuns_listeditlist:[],
- patheditarry:[],
- stage_descriptions:undefined,
- stage_names:undefined,
- delectfunvalue:undefined,
- Modalstype:false,
- Modalstopval:"",
- Modalsbottomval:"",
- ChooseShixunListshixun_list:undefined,
- stage_nametype:false,
- descriptiontype:false
- }
- this.onDragEnd = this.onDragEnd.bind(this);
- }
- //选择实训弹框
- AddShixunBox = () =>{
- this.setState({
- selectShixun:true,
- patheditarry:[]
- })
- this.changeTag(0,"");
- }
-
- //关闭选择实训弹框
- cloasShixunBox =()=>{
- this.setState({
- selectShixun:false,
- patheditarry:[]
- })
- }
- clickShixunchoose=()=>{
-
- let{patheditarry,shixuns_listeditlist}=this.state
- let newshixuns_listedit=[];
- let list=shixuns_listeditlist
-
- if(patheditarry.length===0){
- this.setState({
- Modalstype:true,
- Modalstopval:'请选择实训',
- cardsModalsave:this.cardsModalsave
- })
-
- return
- }
-
- let url='/paths/append_to_stage.json'
- axios.post(url,{
- shixun_id:patheditarry
- }).then((response) => {
- let newshixun_lists=response.data.shixun_lists;
-
- for(var z=0; z
{
- console.log(error)
- });
-
- }
-
- //点击新建阶段
- addStage=()=>{
- this.props.editeditbuttomtypes();
- this.setState({
- editPanel:true
- })
-
- }
- //取消新建阶段
- cancelAddState = () =>{
- this.setState({
- editPanel:false,
- stage_names:undefined,
- stage_descriptions:undefined,
- shixuns_listeditlist:[],
- shixuns_listedit:undefined
- })
- this.props.getPathCardsLists();
- }
-
- searchNameInput=(e)=>{
- this.setState({
- search:e.target.value
- })
- }
-
- //打开选择实训弹框初始化tag标签和列表
- changeTag=(id,search)=>{
- this.setState({
- hometypepvisible:true
- })
- let pathId=this.props.pathid;
- let {page}=this.state;
- let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+page
- if(search!="" && search!=undefined){
- url+="&search="+search;
- }
- if(id!=0){
- url+="&type="+id;
- }
- axios.get(url).then((result)=>{
- if(result.status===200){
- this.setState({
- ChooseShixunList:result.data,
- hometypepvisible:false,
- type:id,
- ChooseShixunListshixun_list:result.data.shixun_list
- })
- }
- }).catch((error)=>{
- console.log(error);
- })
- }
-
- //勾选实训
- shixunhomeworkedit=(list)=>{
-
- let newpatheditarry=[];
- for(var i=0; i{
-
- this.setState({
- stage_names:e.target.value
- })
-
- }
-
- updatastage_descriptions=(e)=>{
-
- this.setState({
- stage_descriptions:e.target.value
- })
-
- }
-
- //删除实训
- shixunslisteditdelect=(e)=>{
- this.setState({
- Modalstype:true,
- Modalstopval:'是否删除该实训?',
- Modalsbottomval:'',
- delectfunvalue:e.target.id
- })
- }
- shixunslisteditdelectfun=()=>{
- let {delectfunvalue}=this.state;
- let sum = parseInt(delectfunvalue);
- let {shixuns_listedit,shixuns_listeditlist} =this.state;
- let newshixuns_listedit=shixuns_listedit
- let newshixuns_listeditlist=shixuns_listeditlist
- newshixuns_listedit.splice(sum, 1);
- newshixuns_listeditlist.splice(sum, 1);
- this.setState({
- shixuns_listedit:newshixuns_listedit,
- shixuns_listeditlist:newshixuns_listeditlist
- })
- this.setState({
- Modalstype:false,
- Modalstopval:'',
- Modalsbottomval:'',
- delectfunvalue:undefined
- })
- }
- cardsModalcancel=()=>{
- this.setState({
- Modalstype:false,
- Modalstopval:'',
- Modalsbottomval:'',
- delectfunvalue:undefined
- })
- }
-
- //保存
- clickShixunsaves=()=>{
- let{stage_names,stage_descriptions,shixuns_listeditlist}=this.state;
- let newstage_descriptions=stage_descriptions;
-
- if(stage_names===""||stage_names===undefined){
-
- this.setState({
- stage_nametype:true
- })
-
- return
- }else{
- this.setState({
- stage_nametype:false
- })
- }
-
- if(newstage_descriptions!=undefined){
-
- if(newstage_descriptions.length>300){
-
- this.setState({
- descriptiontype:true
- })
-
- return
- }
- }else{
- newstage_descriptions=""
- }
-
-
-
- let pathId=this.props.pathid;
- let url='/stages.json?subject_id='+pathId
- axios.post(url, {
- name:stage_names,
- description:newstage_descriptions,
- shixun_id:shixuns_listeditlist
- }).then((response) => {
- // window.location.href = "/paths/" + response.data.subject_id
- this.props.getPathCardsLists();
-
- this.cancelAddState();
- this.setState({
- stage_nametype:false,
- descriptiontype:false
- })
- }).catch((error) => {
- console.log(error)
- });
- }
-
-
- contentViewScrolladd=(e)=>{
-
- //滑动到底判断
- if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){
- // console.log("到达底部");
- this.setState({
- hometypepvisible:true
- })
- let pathId=this.props.pathid;
- let {search,page,type,ChooseShixunListshixun_list}=this.state;
- let newpage=page+1;
- let newChooseShixunListshixun_list=ChooseShixunListshixun_list;
- let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage
- if(search!="" && search!=undefined){
- url+="&search="+search;
- }
- if(type!=0){
- url+="&type="+type;
- }
- axios.get(url).then((result)=>{
- if(result.status===200){
- let list =result.data.shixun_list;
-
- for(var i=0; i{
- console.log(error);
- })
- }
-
- }
- onDragEnd (result) {
-
- let {shixuns_listedit,shixuns_listeditlist} =this.state;
- const listedit = reorder(
- shixuns_listedit,
- result.source.index,
- result.destination.index
- );
- const listeditlist = reorder(
- shixuns_listeditlist,
- result.source.index,
- result.destination.index
- );
- this.setState({
- shixuns_listedit:listedit,
- shixuns_listeditlist:listeditlist
- })
- }
-
-
- render(){
- let {selectShixun,
- editPanel,
- ChooseShixunList,
- type,
- page,
- search,
- hometypepvisible,
- stage_descriptions,
- stage_names,
- shixuns_listedit,
- delectfunvalue,
- Modalstype,
- Modalstopval,
- Modalsbottomval,
- ChooseShixunListshixun_list,
- stage_nametype,
- descriptiontype} = this.state
-
-
- return(
-
-
-
-
- { editPanel &&
-
-
-
-
-
-
- 第{this.props.sum}部分
- {/**/}
-
-
-
章节名称
-
-
描述
-
-
-
-
-
- 选择实训
- 选择下面实训后,可以通过拖拽进行排序调整
-
-
- {selectShixun===true?:""}
-
-
-
-
-
-
-
- - 实训名称
- - 使用院校
- - 使用人数
- - 评价等级
-
-
-
-
-
-
- {
- ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{
- return(
-
-
-
-
-
-
-
-
- {item.school_users}
-
- {item.myshixuns_count}
-
- {item.preference}
-
- 详情
-
- )
- })
- }
-
-
-
-
-
-
-
-
- {/* 可拖拽选择实训列表*/}
- {shixuns_listedit===undefined?'':
-
-
-
- {(provided, snapshot) => (
-
- {shixuns_listedit.map((item,key)=>{
- return(
-
- {(provided, snapshot) => (
-
- )}
-
- )})}
-
- )}
-
-
- }
-
- {/*老版本实训新建卡片*/}
- {/*
*/}
- {/*
*/}
- {/*
×*/}
- {/*
*/}
- {/*
*/}
- {/*
*/}
- {/*
*/}
-
-
-
-
-
-
-
- }
-
- {this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_statistics===true?editPanel===false?
- +点击新建阶段(选择1至多个实训项目,组成一个阶段)
-
:'':''}
-
- )
- }
-}
+import React, { Component } from 'react';
+import {getImageUrl} from 'educoder';
+import {Modal,Input,Checkbox,Tooltip} from "antd";
+import { DragDropContext , Draggable, Droppable} from 'react-beautiful-dnd';
+import Modals from '../../modals/Modals';
+import Loading from '@icedesign/base/lib/loading';
+import '@icedesign/base/lib/loading/style.js';
+import '../ShixunPaths.css';
+import axios from 'axios';
+const $ = window.$;
+const Search = Input.Search;
+
+//a little function to help us with reordering the result
+const reorder = (list, startIndex, endIndex) => {
+ // console.log(list)
+ // console.log(startIndex)
+ // console.log(endIndex)
+
+ let newlist=list;
+ const result = Array.from(newlist);
+ const [removed] = result.splice(startIndex, 1);
+ result.splice(endIndex, 0, removed);
+
+ return result;
+};
+
+const getItemStyle = (isDragging, draggableStyle) => ({
+ // change background colour if dragging
+ background: isDragging ? '#dceeff' : '',
+ // styles we need to apply on draggables
+ ...draggableStyle,
+});
+
+class DetailCardsEditAndAdd extends Component{
+ constructor(props){
+ super(props);
+ this.state={
+ selectShixun:false,
+ editPanel:false,
+ search:"",
+ type:0,
+ page:1,
+ ChooseShixunList:undefined,
+ hometypepvisible:true,
+ shixuns_listedit:undefined,
+ shixuns_listeditlist:[],
+ patheditarry:[],
+ stage_descriptions:undefined,
+ stage_names:undefined,
+ delectfunvalue:undefined,
+ Modalstype:false,
+ Modalstopval:"",
+ Modalsbottomval:"",
+ ChooseShixunListshixun_list:undefined,
+ stage_nametype:false,
+ descriptiontype:false
+ }
+ this.onDragEnd = this.onDragEnd.bind(this);
+ }
+ //选择实训弹框
+ AddShixunBox = () =>{
+ this.setState({
+ selectShixun:true,
+ patheditarry:[]
+ })
+ this.changeTag(0,"");
+ }
+
+ //关闭选择实训弹框
+ cloasShixunBox =()=>{
+ this.setState({
+ selectShixun:false,
+ patheditarry:[]
+ })
+ }
+ clickShixunchoose=()=>{
+
+ let{patheditarry,shixuns_listeditlist}=this.state
+ let newshixuns_listedit=[];
+ let list=shixuns_listeditlist
+
+ if(patheditarry.length===0){
+ this.setState({
+ Modalstype:true,
+ Modalstopval:'请选择实训',
+ cardsModalsave:this.cardsModalsave
+ })
+
+ return
+ }
+
+ let url='/paths/append_to_stage.json'
+ axios.post(url,{
+ shixun_id:patheditarry
+ }).then((response) => {
+ let newshixun_lists=response.data.shixun_lists;
+
+ for(var z=0; z {
+ console.log(error)
+ });
+
+ }
+
+ //点击新建阶段
+ addStage=()=>{
+ this.props.editeditbuttomtypes();
+ this.setState({
+ editPanel:true
+ })
+
+ }
+ //取消新建阶段
+ cancelAddState = () =>{
+ this.setState({
+ editPanel:false,
+ stage_names:undefined,
+ stage_descriptions:undefined,
+ shixuns_listeditlist:[],
+ shixuns_listedit:undefined
+ })
+ this.props.getPathCardsLists();
+ }
+
+ searchNameInput=(e)=>{
+ this.setState({
+ search:e.target.value
+ })
+ }
+
+ //打开选择实训弹框初始化tag标签和列表
+ changeTag=(id,search)=>{
+ this.setState({
+ hometypepvisible:true
+ })
+ let pathId=this.props.pathid;
+ let {page}=this.state;
+ let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+page
+ if(search!="" && search!=undefined){
+ url+="&search="+search;
+ }
+ if(id!=0){
+ url+="&type="+id;
+ }
+ axios.get(url).then((result)=>{
+ if(result.status===200){
+ this.setState({
+ ChooseShixunList:result.data,
+ hometypepvisible:false,
+ type:id,
+ ChooseShixunListshixun_list:result.data.shixun_list
+ })
+ }
+ }).catch((error)=>{
+ console.log(error);
+ })
+ }
+
+ //勾选实训
+ shixunhomeworkedit=(list)=>{
+
+ let newpatheditarry=[];
+ for(var i=0; i{
+
+ this.setState({
+ stage_names:e.target.value
+ })
+
+ }
+
+ updatastage_descriptions=(e)=>{
+
+ this.setState({
+ stage_descriptions:e.target.value
+ })
+
+ }
+
+ //删除实训
+ shixunslisteditdelect=(e)=>{
+ this.setState({
+ Modalstype:true,
+ Modalstopval:'是否删除该实训?',
+ Modalsbottomval:'',
+ delectfunvalue:e.target.id
+ })
+ }
+ shixunslisteditdelectfun=()=>{
+ let {delectfunvalue}=this.state;
+ let sum = parseInt(delectfunvalue);
+ let {shixuns_listedit,shixuns_listeditlist} =this.state;
+ let newshixuns_listedit=shixuns_listedit
+ let newshixuns_listeditlist=shixuns_listeditlist
+ newshixuns_listedit.splice(sum, 1);
+ newshixuns_listeditlist.splice(sum, 1);
+ this.setState({
+ shixuns_listedit:newshixuns_listedit,
+ shixuns_listeditlist:newshixuns_listeditlist
+ })
+ this.setState({
+ Modalstype:false,
+ Modalstopval:'',
+ Modalsbottomval:'',
+ delectfunvalue:undefined
+ })
+ }
+ cardsModalcancel=()=>{
+ this.setState({
+ Modalstype:false,
+ Modalstopval:'',
+ Modalsbottomval:'',
+ delectfunvalue:undefined
+ })
+ }
+
+ //保存
+ clickShixunsaves=()=>{
+ let{stage_names,stage_descriptions,shixuns_listeditlist}=this.state;
+ let newstage_descriptions=stage_descriptions;
+
+ if(stage_names===""||stage_names===undefined){
+
+ this.setState({
+ stage_nametype:true
+ })
+
+ return
+ }else{
+ this.setState({
+ stage_nametype:false
+ })
+ }
+
+ if(newstage_descriptions!=undefined){
+
+ if(newstage_descriptions.length>300){
+
+ this.setState({
+ descriptiontype:true
+ })
+
+ return
+ }
+ }else{
+ newstage_descriptions=""
+ }
+
+
+
+ let pathId=this.props.pathid;
+ let url='/stages.json?subject_id='+pathId
+ axios.post(url, {
+ name:stage_names,
+ description:newstage_descriptions,
+ shixun_id:shixuns_listeditlist
+ }).then((response) => {
+ // window.location.href = "/paths/" + response.data.subject_id
+ this.props.getPathCardsLists();
+
+ this.cancelAddState();
+ this.setState({
+ stage_nametype:false,
+ descriptiontype:false
+ })
+ }).catch((error) => {
+ console.log(error)
+ });
+ }
+
+
+ contentViewScrolladd=(e)=>{
+
+ //滑动到底判断
+ if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){
+ // console.log("到达底部");
+ this.setState({
+ hometypepvisible:true
+ })
+ let pathId=this.props.pathid;
+ let {search,page,type,ChooseShixunListshixun_list}=this.state;
+ let newpage=page+1;
+ let newChooseShixunListshixun_list=ChooseShixunListshixun_list;
+ let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage
+ if(search!="" && search!=undefined){
+ url+="&search="+search;
+ }
+ if(type!=0){
+ url+="&type="+type;
+ }
+ axios.get(url).then((result)=>{
+ if(result.status===200){
+ let list =result.data.shixun_list;
+
+ for(var i=0; i{
+ console.log(error);
+ })
+ }
+
+ }
+ onDragEnd (result) {
+
+ let {shixuns_listedit,shixuns_listeditlist} =this.state;
+ const listedit = reorder(
+ shixuns_listedit,
+ result.source.index,
+ result.destination.index
+ );
+ const listeditlist = reorder(
+ shixuns_listeditlist,
+ result.source.index,
+ result.destination.index
+ );
+ this.setState({
+ shixuns_listedit:listedit,
+ shixuns_listeditlist:listeditlist
+ })
+ }
+
+
+ render(){
+ let {selectShixun,
+ editPanel,
+ ChooseShixunList,
+ type,
+ page,
+ search,
+ hometypepvisible,
+ stage_descriptions,
+ stage_names,
+ shixuns_listedit,
+ delectfunvalue,
+ Modalstype,
+ Modalstopval,
+ Modalsbottomval,
+ ChooseShixunListshixun_list,
+ stage_nametype,
+ descriptiontype} = this.state
+
+
+ return(
+
+
+
+
+ { editPanel &&
+
+
+
+
+
+
+ 第{this.props.sum}部分
+ {/**/}
+
+
+
章节名称
+
+
描述
+
+
+
+
+
+ 选择实训
+ 选择下面实训后,可以通过拖拽进行排序调整
+
+
+ {selectShixun===true?:""}
+
+
+
+
+
+
+
+ - 实训名称
+ - 使用院校
+ - 使用人数
+ - 评价等级
+
+
+
+
+
+
+ {
+ ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{
+ return(
+
+
-
+
+
+
+
+
- {item.school_users}
+
- {item.myshixuns_count}
+
- {item.preference}
+
- 详情
+
+ )
+ })
+ }
+
+
+
+
+
+
+
+
+ {/* 可拖拽选择实训列表*/}
+ {shixuns_listedit===undefined?'':
+
+
+
+ {(provided, snapshot) => (
+
+ {shixuns_listedit.map((item,key)=>{
+ return(
+
+ {(provided, snapshot) => (
+
+ )}
+
+ )})}
+
+ )}
+
+
+ }
+
+ {/*老版本实训新建卡片*/}
+ {/*
*/}
+ {/*
*/}
+ {/*
×*/}
+ {/*
*/}
+ {/*
*/}
+ {/*
*/}
+ {/*
*/}
+
+
+
+
+
+
+
+ }
+
+ {this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_statistics===true?editPanel===false?
+ +点击新建阶段(选择1至多个实训项目,组成一个阶段)
+
:'':''}
+
+ )
+ }
+}
export default DetailCardsEditAndAdd;
\ No newline at end of file
diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js
index 8b33bb793..63263dfc1 100644
--- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js
+++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js
@@ -1,702 +1,703 @@
-import React, { Component } from 'react';
-import {getImageUrl} from 'educoder';
-import {Modal,Input,Checkbox,Tooltip} from "antd";
-import { DragDropContext,Draggable, Droppable} from 'react-beautiful-dnd';
-import Modals from '../../modals/Modals';
-import Loading from '@icedesign/base/lib/loading';
-import '@icedesign/base/lib/loading/style.js';
-import '../ShixunPaths.css';
-import axios from 'axios';
-const $ = window.$;
-const Search = Input.Search;
-
-
-//a little function to help us with reordering the result
-const reorder = (list, startIndex, endIndex) => {
- // console.log(list)
- // console.log(startIndex)
- // console.log(endIndex)
-
- let newlist=list;
- const result = Array.from(newlist);
- const [removed] = result.splice(startIndex, 1);
- result.splice(endIndex, 0, removed);
-
- return result;
-};
-
-const getItemStyle = (isDragging, draggableStyle) => ({
- // change background colour if dragging
- background: isDragging ? '#dceeff' : '',
- // styles we need to apply on draggables
- ...draggableStyle,
-});
-
-
-class DetailCardsEditAndEdit extends Component{
- constructor(props){
- super(props);
- this.state={
- selectShixun:false,
- editPanel:true,
- search:"",
- type:0,
- page:1,
- ChooseShixunList:undefined,
- hometypepvisible:true,
- shixuns_listedit:undefined,
- patheditarry:[],
- stage_name:undefined,
- stage_description:undefined,
- stageid:undefined,
- Modalstype:false,
- Modalstopval:'',
- Modalsbottomval:'',
- delectfunvalue:undefined,
- ChooseShixunListshixun_list:undefined,
- stage_nametype:false,
- descriptiontype:false
- }
- this.onDragEnd = this.onDragEnd.bind(this);
- }
- //选择实训弹框
- AddShixunBox = () =>{
- this.setState({
- selectShixun:true,
- patheditarry:[]
- })
- this.changeTag(0,"");
- }
- //关闭选择实训弹框
- cloasShixunBox =()=>{
- this.setState({
- selectShixun:false,
- patheditarry:[]
- })
- }
-
- searchNameInput=(e)=>{
- this.setState({
- search:e.target.value
- })
- }
-
- //打开选择实训弹框初始化tag标签和列表
- changeTag(id,search){
- this.setState({
- hometypepvisible:true
- })
- let pathId=this.props.pathid;
- let {page}=this.state;
- let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+page
- if(search!="" && search!=undefined){
- url+="&search="+search;
- }
- if(id!=0){
- url+="&type="+id;
- }
- axios.get(url).then((result)=>{
- if(result.status===200){
- this.setState({
- ChooseShixunList:result.data,
- hometypepvisible:false,
- type:id,
- search:search,
- ChooseShixunListshixun_list:result.data.shixun_list
- })
- }
- }).catch((error)=>{
- console.log(error);
- })
- }
-
- shixunhomeworkedit=(list)=>{
-
- let newpatheditarry=[];
- for(var i=0; i{
-
- this.setState({
- stage_name:e.target.value
- })
-
- }
-
- updatastage_description=(e)=>{
-
- this.setState({
- stage_description:e.target.value
- })
-
- }
-
- clickShixunchoose=()=>{
-
- let{patheditarry,shixuns_listedit,shixuns_listeditlist}=this.state
- let newshixuns_listedit=shixuns_listedit;
- let list=shixuns_listeditlist
-
- if(patheditarry.length===0){
- this.setState({
- Modalstype:true,
- Modalstopval:'请选择实训',
-
- })
-
- return
- }
-
- let url='/paths/append_to_stage.json'
- axios.post(url,{
- shixun_id:patheditarry
- }).then((response) => {
- let newshixun_lists=response.data.shixun_lists;
-
-
- for(var j=0; j {
- console.log(error)
- });
-
- }
-
- //保存
- clickShixunsave=()=>{
- let{stage_name,stage_description,stageid,shixuns_listeditlist}=this.state;
- let newstage_descriptions=stage_description;
-
- if(stage_name===""||stage_name===undefined){
-
- this.setState({
- stage_nametype:true
- })
-
- return
- }
- if(newstage_descriptions!=undefined){
-
- if(newstage_descriptions.length>300){
-
- this.setState({
- descriptiontype:true
- })
-
- return
- }
- }else{
- newstage_descriptions=""
- }
-
-
-
- let url='/stages/'+stageid+'.json'
- axios.put(url, {
- name:stage_name,
- description:newstage_descriptions,
- shixun_id:shixuns_listeditlist
- }).then((response) => {
- // window.location.href = "/paths/" + response.data.subject_id
- this.setState({
- stage_name:undefined,
- stage_description:undefined,
- shixuns_listeditlist:[],
- shixuns_listedit:undefined,
- stage_nametype:false,
- descriptiontype:false
- })
- this.props.updatapathCardsedits()
- }).catch((error) => {
- console.log(error)
- });
- }
-
- //删除实训
- shixunslisteditdelect=(e)=>{
-
- this.setState({
- Modalstype:true,
- Modalstopval:'是否删除该实训?',
- Modalsbottomval:'',
- delectfunvalue:e.target.id
- })
-
- }
-
- shixunslisteditdelectfun=()=>{
- let{delectfunvalue}=this.state;
- let sum = parseInt(delectfunvalue);
- let {shixuns_listedit,shixuns_listeditlist} =this.state;
- let newshixuns_listedit=shixuns_listedit
- let newshixuns_listeditlist=shixuns_listeditlist
- newshixuns_listedit.splice(sum, 1);
- newshixuns_listeditlist.splice(sum, 1);
- this.setState({
- shixuns_listedit:newshixuns_listedit,
- shixuns_listeditlist:newshixuns_listeditlist,
- Modalstype:false,
- Modalstopval:' ',
- Modalsbottomval:'',
- delectfunvalue:undefined
- })
- }
-
-
- cardsModalcancel=()=>{
- this.setState({
- Modalstype:false,
- Modalstopval:'',
- Modalsbottomval:'',
- delectfunvalue:undefined
- })
- }
- cardsModalsave=()=>{
- this.setState({
- Modalstype:false,
- Modalstopval:'',
- Modalsbottomval:''
- })
- }
-
-
-
- onDragStart = () => {
- /*...*/
- };
- onDragUpdate = () => {
- /*...*/
- }
-
-
- onDragEnd (result) {
-
- let {shixuns_listedit,shixuns_listeditlist} =this.state;
- const listedit = reorder(
- shixuns_listedit,
- result.source.index,
- result.destination.index
- );
- const listeditlist = reorder(
- shixuns_listeditlist,
- result.source.index,
- result.destination.index
- );
- this.setState({
- shixuns_listedit:listedit,
- shixuns_listeditlist:listeditlist
- })
- }
-
- contentViewScrolledit=(e)=>{
- //滑动到底判断
-
- if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){
- this.setState({
- hometypepvisible:true
- })
- // console.log("到达底部");
-
- let {page,type,search,ChooseShixunListshixun_list}=this.state;
-
- let newpage=page+1;
-
- let pathId=this.props.pathid;
-
- let newChooseShixunListshixun_list=ChooseShixunListshixun_list;
-
- let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage
-
- if(search!="" && search!=undefined){
- url+="&search="+search;
- }
-
- if(type!=0){
- url+="&type="+type;
- }
- axios.get(url).then((result)=>{
- if(result.status===200){
-
- let list =result.data.shixun_list;
-
- for(var i=0; i{
- console.log(error);
- })
-
- }
-
- }
-
-
- render(){
- let {selectShixun,
- editPanel,
- ChooseShixunList,
- type,
- page,
- search,
- hometypepvisible,
- shixuns_listedit,
- patheditarry,
- stage_name,
- stage_description,
- Modalstype,
- Modalstopval,
- Modalsbottomval,
- delectfunvalue,
- ChooseShixunListshixun_list,
- stage_nametype,
- descriptiontype
- } = this.state
-
- return(
-
-
this.cardsModalsave():()=>this.shixunslisteditdelectfun()}
- >
-
-
- { this.props.idsum===this.props.keys&&this.props.pathCardsedittype===true?
-
-
-
-
-
- {/**/}
- {/**/}
- {/**/}
-
- {/**/}
-
-
- {/*
章节名称
*/}
-
-
描述
-
-
-
- 选择实训
-
- 选择下面实训后,可以通过拖拽进行排序调整
-
-
- {selectShixun===true?:""}
-
-
-
-
-
-
-
-
- - 实训名称
- - 使用院校
- - 使用人数
- - 评价等级
-
-
-
-
-
-
- {
- ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{
- return(
-
-
-
-
-
-
-
-
- {item.school_users}
-
- {item.myshixuns_count}
-
- {item.preference}
-
- 详情
-
- )
- })
- }
-
-
-
-
-
-
-
-
- {/* 可拖拽选择实训列表*/}
- {shixuns_listedit===undefined?'':
-
-
-
- {(provided, snapshot) => (
-
- {shixuns_listedit.map((item,key)=>{
- return(
-
- {(provided, snapshot) => (
-
- )}
-
- )})}
-
- )}
-
-
- }
-
- {/*
*/}
- {/*
*/}
- {/*
×*/}
- {/*
*/}
- {/*
*/}
- {/*
*/}
- {/*
*/}
-
-
- {/*
*/}
- {/*取消*/}
- {/*保存*/}
- {/*
*/}
-
-
-
-
-
-
-
-
- :''}
-
- )
- }
-}
-export default DetailCardsEditAndEdit;
-
-
-
-
-
-// {
-// shixuns_listedit===undefined?'':shixuns_listedit.map((item,key)=>{
-// return(
-//
-// )
-// })
+import React, { Component } from 'react';
+import {getImageUrl} from 'educoder';
+import {Modal,Input,Checkbox,Tooltip} from "antd";
+import { DragDropContext,Draggable, Droppable} from 'react-beautiful-dnd';
+import Modals from '../../modals/Modals';
+import Loading from '@icedesign/base/lib/loading';
+import '@icedesign/base/lib/loading/style.js';
+import '../ShixunPaths.css';
+import axios from 'axios';
+const $ = window.$;
+const Search = Input.Search;
+
+
+//a little function to help us with reordering the result
+const reorder = (list, startIndex, endIndex) => {
+ // console.log(list)
+ // console.log(startIndex)
+ // console.log(endIndex)
+
+ let newlist=list;
+ const result = Array.from(newlist);
+ const [removed] = result.splice(startIndex, 1);
+ result.splice(endIndex, 0, removed);
+
+ return result;
+};
+
+const getItemStyle = (isDragging, draggableStyle) => ({
+ // change background colour if dragging
+ background: isDragging ? '#dceeff' : '',
+ // styles we need to apply on draggables
+ ...draggableStyle,
+});
+
+
+class DetailCardsEditAndEdit extends Component{
+ constructor(props){
+ super(props);
+ this.state={
+ selectShixun:false,
+ editPanel:true,
+ search:"",
+ type:0,
+ page:1,
+ ChooseShixunList:undefined,
+ hometypepvisible:true,
+ shixuns_listedit:undefined,
+ patheditarry:[],
+ stage_name:undefined,
+ stage_description:undefined,
+ stageid:undefined,
+ Modalstype:false,
+ Modalstopval:'',
+ Modalsbottomval:'',
+ delectfunvalue:undefined,
+ ChooseShixunListshixun_list:undefined,
+ stage_nametype:false,
+ descriptiontype:false
+ }
+ this.onDragEnd = this.onDragEnd.bind(this);
+ }
+ //选择实训弹框
+ AddShixunBox = () =>{
+ this.setState({
+ selectShixun:true,
+ patheditarry:[]
+ })
+ this.changeTag(0,"");
+ }
+ //关闭选择实训弹框
+ cloasShixunBox =()=>{
+ this.setState({
+ selectShixun:false,
+ patheditarry:[]
+ })
+ }
+
+ searchNameInput=(e)=>{
+ this.setState({
+ search:e.target.value
+ })
+ }
+
+ //打开选择实训弹框初始化tag标签和列表
+ changeTag(id,search){
+ this.setState({
+ hometypepvisible:true
+ })
+ let pathId=this.props.pathid;
+ let {page}=this.state;
+ let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+page
+ if(search!="" && search!=undefined){
+ url+="&search="+search;
+ }
+ if(id!=0){
+ url+="&type="+id;
+ }
+ axios.get(url).then((result)=>{
+ if(result.status===200){
+ this.setState({
+ ChooseShixunList:result.data,
+ hometypepvisible:false,
+ type:id,
+ search:search,
+ ChooseShixunListshixun_list:result.data.shixun_list
+ })
+ }
+ }).catch((error)=>{
+ console.log(error);
+ })
+ }
+
+ shixunhomeworkedit=(list)=>{
+
+ let newpatheditarry=[];
+ for(var i=0; i{
+
+ this.setState({
+ stage_name:e.target.value
+ })
+
+ }
+
+ updatastage_description=(e)=>{
+
+ this.setState({
+ stage_description:e.target.value
+ })
+
+ }
+
+ clickShixunchoose=()=>{
+
+ let{patheditarry,shixuns_listedit,shixuns_listeditlist}=this.state
+ let newshixuns_listedit=shixuns_listedit;
+ let list=shixuns_listeditlist
+
+ if(patheditarry.length===0){
+ this.setState({
+ Modalstype:true,
+ Modalstopval:'请选择实训',
+
+ })
+
+ return
+ }
+
+ let url='/paths/append_to_stage.json'
+ axios.post(url,{
+ shixun_id:patheditarry
+ }).then((response) => {
+ let newshixun_lists=response.data.shixun_lists;
+
+
+ for(var j=0; j {
+ console.log(error)
+ });
+
+ }
+
+ //保存
+ clickShixunsave=()=>{
+ let{stage_name,stage_description,stageid,shixuns_listeditlist}=this.state;
+ let newstage_descriptions=stage_description;
+
+ if(stage_name===""||stage_name===undefined){
+
+ this.setState({
+ stage_nametype:true
+ })
+
+ return
+ }
+ if(newstage_descriptions!=undefined){
+
+ if(newstage_descriptions.length>300){
+
+ this.setState({
+ descriptiontype:true
+ })
+
+ return
+ }
+ }else{
+ newstage_descriptions=""
+ }
+
+
+
+ let url='/stages/'+stageid+'.json'
+ axios.put(url, {
+ name:stage_name,
+ description:newstage_descriptions,
+ shixun_id:shixuns_listeditlist
+ }).then((response) => {
+ // window.location.href = "/paths/" + response.data.subject_id
+ this.setState({
+ stage_name:undefined,
+ stage_description:undefined,
+ shixuns_listeditlist:[],
+ shixuns_listedit:undefined,
+ stage_nametype:false,
+ descriptiontype:false
+ })
+ this.props.updatapathCardsedits()
+ }).catch((error) => {
+ console.log(error)
+ });
+ }
+
+ //删除实训
+ shixunslisteditdelect=(e)=>{
+
+ this.setState({
+ Modalstype:true,
+ Modalstopval:'是否删除该实训?',
+ Modalsbottomval:'',
+ delectfunvalue:e.target.id
+ })
+
+ }
+
+ shixunslisteditdelectfun=()=>{
+ let{delectfunvalue}=this.state;
+ let sum = parseInt(delectfunvalue);
+ let {shixuns_listedit,shixuns_listeditlist} =this.state;
+ let newshixuns_listedit=shixuns_listedit
+ let newshixuns_listeditlist=shixuns_listeditlist
+ newshixuns_listedit.splice(sum, 1);
+ newshixuns_listeditlist.splice(sum, 1);
+ this.setState({
+ shixuns_listedit:newshixuns_listedit,
+ shixuns_listeditlist:newshixuns_listeditlist,
+ Modalstype:false,
+ Modalstopval:' ',
+ Modalsbottomval:'',
+ delectfunvalue:undefined
+ })
+ }
+
+
+ cardsModalcancel=()=>{
+ this.setState({
+ Modalstype:false,
+ Modalstopval:'',
+ Modalsbottomval:'',
+ delectfunvalue:undefined
+ })
+ }
+ cardsModalsave=()=>{
+ this.setState({
+ Modalstype:false,
+ Modalstopval:'',
+ Modalsbottomval:''
+ })
+ }
+
+
+
+ onDragStart = () => {
+ /*...*/
+ };
+ onDragUpdate = () => {
+ /*...*/
+ }
+
+
+ onDragEnd (result) {
+
+ let {shixuns_listedit,shixuns_listeditlist} =this.state;
+ const listedit = reorder(
+ shixuns_listedit,
+ result.source.index,
+ result.destination.index
+ );
+ const listeditlist = reorder(
+ shixuns_listeditlist,
+ result.source.index,
+ result.destination.index
+ );
+ this.setState({
+ shixuns_listedit:listedit,
+ shixuns_listeditlist:listeditlist
+ })
+ }
+
+ contentViewScrolledit=(e)=>{
+ //滑动到底判断
+
+ if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){
+ this.setState({
+ hometypepvisible:true
+ })
+ // console.log("到达底部");
+
+ let {page,type,search,ChooseShixunListshixun_list}=this.state;
+
+ let newpage=page+1;
+
+ let pathId=this.props.pathid;
+
+ let newChooseShixunListshixun_list=ChooseShixunListshixun_list;
+
+ let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage
+
+ if(search!="" && search!=undefined){
+ url+="&search="+search;
+ }
+
+ if(type!=0){
+ url+="&type="+type;
+ }
+ axios.get(url).then((result)=>{
+ if(result.status===200){
+
+ let list =result.data.shixun_list;
+
+ for(var i=0; i{
+ console.log(error);
+ })
+
+ }
+
+ }
+
+
+ render(){
+ let {selectShixun,
+ editPanel,
+ ChooseShixunList,
+ type,
+ page,
+ search,
+ hometypepvisible,
+ shixuns_listedit,
+ patheditarry,
+ stage_name,
+ stage_description,
+ Modalstype,
+ Modalstopval,
+ Modalsbottomval,
+ delectfunvalue,
+ ChooseShixunListshixun_list,
+ stage_nametype,
+ descriptiontype
+ } = this.state
+
+ return(
+
+
this.cardsModalsave():()=>this.shixunslisteditdelectfun()}
+ >
+
+
+ { this.props.idsum===this.props.keys&&this.props.pathCardsedittype===true?
+
+
+
+
+
+ {/**/}
+ {/**/}
+ {/**/}
+
+ {/**/}
+
+
+ {/*
章节名称
*/}
+
+
描述
+
+
+
+ 选择实训
+
+ 选择下面实训后,可以通过拖拽进行排序调整
+
+
+ {selectShixun===true?:""}
+
+
+
+
+
+
+
+
+ - 实训名称
+ - 使用院校
+ - 使用人数
+ - 评价等级
+
+
+
+
+
+
+ {
+ ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{
+ return(
+
+
-
+
+
+
+
+
- {item.school_users}
+
- {item.myshixuns_count}
+
- {item.preference}
+
- 详情
+
+ )
+ })
+ }
+
+
+
+
+
+
+
+
+ {/* 可拖拽选择实训列表*/}
+ {shixuns_listedit===undefined?'':
+
+
+
+ {(provided, snapshot) => (
+
+ {shixuns_listedit.map((item,key)=>{
+ return(
+
+ {(provided, snapshot) => (
+
+ )}
+
+ )})}
+
+ )}
+
+
+ }
+
+ {/*
*/}
+ {/*
*/}
+ {/*
×*/}
+ {/*
*/}
+ {/*
*/}
+ {/*
*/}
+ {/*
*/}
+
+
+ {/*
*/}
+ {/*取消*/}
+ {/*保存*/}
+ {/*
*/}
+
+
+
+
+
+
+
+
+ :''}
+
+ )
+ }
+}
+export default DetailCardsEditAndEdit;
+
+
+
+
+
+// {
+// shixuns_listedit===undefined?'':shixuns_listedit.map((item,key)=>{
+// return(
+//
+// )
+// })
// }
\ No newline at end of file
diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js
index bdb6b2a09..6ea5360b4 100644
--- a/public/react/src/modules/tpm/NewHeader.js
+++ b/public/react/src/modules/tpm/NewHeader.js
@@ -170,10 +170,11 @@ class NewHeader extends Component {
submitapplications:false,
isRender:false,
isRenders:false,
+ user_phone_binded:false,
showTrial:false,
}
- console.log("176")
- console.log(props);
+ // console.log("176")
+ // console.log(props);
}
componentDidMount() {
@@ -207,7 +208,20 @@ class NewHeader extends Component {
}
+ componentDidUpdate = (prevProps) => {
+ if(prevProps.user!=this.props.user){
+ // console.log("216")
+ // console.log(prevProps.user);
+ // console.log(this.props.user);
+ if(this.props.user !== undefined){
+ this.setState({
+ user_phone_binded :this.props.user.user_phone_binded,
+ })
+ }
+
+ }
+ }
componentWillReceiveProps(newProps, oldProps) {
this.setState({
user:newProps.user
@@ -330,6 +344,24 @@ class NewHeader extends Component {
})
}
educoderlogin=()=>{
+ //退出账号
+ this.setState({
+ isRender:true
+ })
+ // var url = `/accounts/logout.json`;
+ //
+ // axios.get((url)).then((result) => {
+ // if(result!==undefined){
+ // // this.setState({
+ // // isRender:true
+ // // })
+ // window.location.href = "/";
+ // }
+ // }).catch((error) => {
+ // console.log(error);
+ // })
+ }
+ educoderloginysl=()=>{
//退出账号
// this.setState({
// isRender:true
@@ -337,17 +369,16 @@ class NewHeader extends Component {
var url = `/accounts/logout.json`;
axios.get((url)).then((result) => {
- if(result!==undefined){
- // this.setState({
- // isRender:true
- // })
- window.location.href = "/";
- }
+ if(result!==undefined){
+ // this.setState({
+ // isRender:true
+ // })
+ window.location.href = "/";
+ }
}).catch((error) => {
- console.log(error);
+ console.log(error);
})
}
-
onKeywordSearch = () => {
header_search(this)
}
@@ -550,6 +581,7 @@ submittojoinclass=(value)=>{
user,
isRender,
isRenders,
+ user_phone_binded,
}=this.state;
/*
用户名称 用户头像url
@@ -571,11 +603,11 @@ submittojoinclass=(value)=>{
}else {
activeIndex = true;
}
-
// join_course_url: "https://www.educoder.net/courses/join_course_multi_role"
// join_project_url: "https://www.educoder.net/applied_project/applied_project_info"
// rolearr:["",""],
- // console.log()
+ // console.log("618");
+ // console.log(user_phone_binded);
return (
+
+
+ );
+ }
}
export default (LoginRegisterComponent);
diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js
index 38ecbac45..c5a2175a9 100644
--- a/public/react/src/modules/user/LoginRegisterComponent.js
+++ b/public/react/src/modules/user/LoginRegisterComponent.js
@@ -212,8 +212,8 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: true,
})
+ this.Emailphonenumberverification(value, id)
}
- this.Emailphonenumberverification(value, id)
return
}
@@ -222,8 +222,11 @@ class LoginRegisterComponent extends Component {
stringdata = "邮箱格式不正确";
} else {
stringdata = "手机号格式不正确";
-
- }
+ // if (!regph.test(value)) {
+ // // 这里先判断是不是手机号然后在判断是不是邮箱然后又判断是不是手机号,如果不是手机号就是账号
+ // stringdata=undefined;
+ // }
+ }
if (id === 1) {
this.setState({
Phonenumberisnotco: stringdata,
@@ -234,8 +237,8 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotcos: stringdata,
Phonenumberisnotcobool: false,
})
+ this.Emailphonenumberverification(value, id)
}
- this.Emailphonenumberverification(value, id)
return
} else {
if (id === 1) {
@@ -248,8 +251,8 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: true,
})
+ this.Emailphonenumberverification(value, id)
}
- this.Emailphonenumberverification(value, id)
return
}
}
@@ -548,13 +551,13 @@ class LoginRegisterComponent extends Component {
// console.log(activeKey);
return (
-