diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7aa89dbd7..3c501267a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -189,8 +189,8 @@ class ApplicationController < ActionController::Base # 资料是否完善 def check_account if !current_user.profile_completed? - info_url = '/account/profile' - tip_exception(402, info_url) + #info_url = '/account/profile' + tip_exception(402, nil) end end diff --git a/app/views/memos/_memo.json.jbuilder b/app/views/memos/_memo.json.jbuilder index f0ac5cd3d..a09b7f293 100644 --- a/app/views/memos/_memo.json.jbuilder +++ b/app/views/memos/_memo.json.jbuilder @@ -1,5 +1,6 @@ json.memo do json.id memo.id + json.forum_id memo.forum_id json.subject memo.subject json.is_md memo.is_md json.content memo.content @@ -9,6 +10,6 @@ json.memo do json.tag memo.tag_repertoires.map(&:name) json.time memo.created_at json.replies_count memo.all_replies_count - json.user_praise memo.praise_treads.user_liker(@user.try(:id)).count > 0 ? true : false + json.user_praise memo.praise_treads.user_liker(@user.try(:id)).count > 0 json.memo_praise_count memo.praise_treads.liker.count end diff --git a/app/views/users/homepage_info.json.jbuilder b/app/views/users/homepage_info.json.jbuilder index 1621448f3..3fabd110b 100644 --- a/app/views/users/homepage_info.json.jbuilder +++ b/app/views/users/homepage_info.json.jbuilder @@ -16,7 +16,7 @@ json.college_identifier @user.college_identifier json.followed User.current.watched?(@user) if @user.logged_user? - json.can_apply_trial @user.can_apply_trial? + #json.can_apply_trial @user.can_apply_trial? json.attendance_signed @user.attendance_signed? json.tomorrow_attendance_gold @user.tomorrow_attendance_gold end diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index 15e7e6bef..81afdb70b 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -29,7 +29,7 @@ const env = getClientEnvironment(publicUrl); module.exports = { // You may want 'eval' instead if you prefer to see the compiled output in DevTools. // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s - devtool: "source-map", // 开启调试 + devtool: "cheap-module-eval-source-map", // 开启调试 // These are the "entry points" to our application. // This means they will be the "root" imports that are included in JS bundle. // The first two entry points enable "hot" CSS and auto-refreshes for JS. diff --git a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js index 8baee4b45..aeda66ae1 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js @@ -42,6 +42,9 @@ function disabledDateTime() { // disabledSeconds: () => [55, 56], }; } +function disabledDateFunc(current) { + return current && current < moment().endOf('day').subtract(1, 'days'); +} // 类似页面 http://localhost:3007/courses/1309/graduation/graduation_tasks/48/76/setting class CommonWorkSetting extends Component{ @@ -1093,6 +1096,7 @@ class CommonWorkSetting extends Component{ onChange={this.onChangeTimeend} disabled={this.props.isSuperAdmin()?false:end_time_type===true?true:false} disabled={moment(this.state.init_end_time) < moment() || noAuth} + disabledDate={disabledDateFunc} // disabledDate={ (end_time) => // { @@ -1166,6 +1170,7 @@ class CommonWorkSetting extends Component{ disabledTime={disabledDateTime} // || moment(init_late_time) < moment() disabled={!allow_late || noAuth } + disabledDate={disabledDateFunc} // disabledDate={ (late_time) => // { // const end_time = this.state.end_time @@ -1247,6 +1252,8 @@ class CommonWorkSetting extends Component{ onChange={this.onChangeEvaluationEnd} disabledTime={disabledDateTime} disabled={(anonymous_comment && !noAuth ? false : true) || moment(init_evaluation_end) < moment()} + disabledDate={disabledDateFunc} + // disabledDate={ (evaluation_end) => // { // const evaluation_start = this.state.evaluation_start @@ -1335,6 +1342,7 @@ class CommonWorkSetting extends Component{ dropdownClassName="hideDisable" showTime={{ format: 'HH:mm' }} disabledTime={disabledDateTime} + disabledDate={disabledDateFunc} showToday={false} locale={locale} format={dateFormat} diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 7e3b2e0e4..c6c3ff93c 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -2,7 +2,7 @@ import React, {Component} from 'react'; import {Link} from "react-router-dom"; import axios from 'axios'; import {getImageUrl, trigger, on, off} from 'educoder'; -import { Tooltip, message,Popover} from 'antd'; +import { Tooltip, message,Popover,Breadcrumb} from 'antd'; import CoursesListType from '../coursesPublic/CoursesListType'; import AccountProfile from"../../user/AccountProfile"; import Addcourses from '../coursesPublic/Addcourses'; @@ -489,23 +489,42 @@ class CoursesBanner extends Component {
: } +
+ { this.hasGraduationModule() &&
+ 添加至答辩组: + +
} + + { course_groups && !!course_groups.length &&
+ 管理权限: + +
} +
) } diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index 26e2350a6..b5059cf34 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -900,18 +900,25 @@ class TPMBanner extends Component { {this.state.Senttothevcaluetype===true?
请选择你要发送的课堂
:""} -
- 12 ? "block" : "none"}} +
12 ? "block" : "none"}}> + +
- 确定 +
+
+
+
+ 取消 + 确定 +
- 取消 -
+ +
diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js index 2e34bcffb..ef79f739f 100644 --- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js +++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js @@ -3,7 +3,7 @@ import React, { Component } from 'react'; import MonacoEditor from 'react-monaco-editor'; //MonacoDiffEditor 对比模式 -import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb} from 'antd'; +import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification} from 'antd'; // import "antd/dist/antd.css"; @@ -207,6 +207,7 @@ export default class TPMsettings extends Component { constructor(props) { super(props) this.state = { + fileList: [], commandLine: 0, Openpublic: 0, settingsData: undefined, @@ -268,7 +269,8 @@ export default class TPMsettings extends Component { pod_exist_time: undefined, pod_exist_timetype: false, shixunmemoMDvalue:"", - language:"" + language:"", + deleteisnot:true } } descriptionMD=(initValue, id)=> { @@ -1011,32 +1013,160 @@ export default class TPMsettings extends Component { }) } - sendsure_apply = () => { - let {sendsure_applyvalue} = this.state; - let url = "/shixuns/apply_shixun_mirror.json"; - axios.post(url, { - note: sendsure_applyvalue - }).then((response) => { - if (response.status === 200) { - if (response.data.status == 1) { - this.setState({ - postapplyvisible: false, - postapplytitle: true - }) - } + setlanguagewrite = (e)=>{ + this.setState({ + languagewrite: e.target.value + }) + } - } - }).catch((error) => { - console.log(error) - }); + setsystemenvironment = (e) => { + this.setState({ + systemenvironment: e.target.value + }) + } - } + settestcoderunmode = (e) => { + this.setState({ + testcoderunmode: e.target.value + }) - sendhideModaly = () => { - this.setState({ - postapplyvisible: false - }) - } + } + + sendsure_apply = () => { + let {languagewrite,systemenvironment,testcoderunmode} = this.state; + // console.log("点击确定") + // console.log("languagewrite"+languagewrite); + // console.log("systemenvironment"+systemenvironment); + // console.log("testcoderunmode"+testcoderunmode); + + // let attachment_ids = undefined + // if (this.state.fileList) { + // attachment_ids = this.state.fileList.map(item => { + // return item.response ? item.response.id : item.id + // }) + // } + if(languagewrite === undefined || languagewrite === "" ){ + // this.props.showNotification(`请填写该镜像是基于什么语言`); + this.setState({ + languagewritetype:true + }) + return + } + if(systemenvironment === undefined || systemenvironment === ""){ + // this.props.showNotification(`请填写该镜像是基于什么语言系统环境`); + this.setState({ + systemenvironmenttype:true + }) + return; + + } + if(testcoderunmode === undefined || testcoderunmode === "") { + // this.props.showNotification(`请填写该镜像中测试代码运行方式`); + this.setState({ + testcoderunmodetype:true + }) + return; + } + var attachment_ids=undefined; + if (this.state.fileList) { + attachment_ids = this.state.fileList.map(item => { + return item.response ? item.response.id : item.id + }) + } + + if( attachment_ids === undefined || attachment_ids.length===0){ + + // notification.open( + // { + // message: '提示', + // description: + // '请上传附件!', + // + // } + // ) + this.setState({ + attachmentidstype:true + }) + return; + } + // console.log("attachment_ids"+attachment_ids); + + // alert(languagewrite +" "+systemenvironment +" "+testcoderunmode + " "+attachment_ids); + + var data={ + language:languagewrite, + runtime:systemenvironment, + run_method:testcoderunmode, + attachment_id:attachment_ids[0], + } + var url =`/shixuns/apply_shixun_mirror.json`; + axios.post(url,data + ).then((response) => { + + try { + if (response.data) { + // const { id } = response.data; + // if (id) { + if(this.state.file !== undefined){ + console.log("549"); + // this.deleteAttachment(this.state.file); + this.setState({ + file:undefined, + languagewrite:"", + systemenvironment:"", + testcoderunmode:"", + }) + }else { + this.setState({ + file:undefined, + languagewrite:"", + systemenvironment:"", + testcoderunmode:"", + }) + } + // this.props.showNotification('提交成功!'); + notification.open( + { + message: '提示', + description: + '提交成功!', + + } + ) + this.sendhideModaly() + // this.props.history.push(`/courses/${cid}/graduation_topics`); + // } + } + }catch (e) { + + } + + }) + + } + + sendhideModaly = () => { + this.setState({ + postapplyvisible: false, + }) + if(this.state.file !== undefined){ + console.log("580"); + // this.deleteAttachment(this.state.file); + this.setState({ + file:undefined, + languagewrite:"", + systemenvironment:"", + testcoderunmode:"", + }) + }else { + this.setState({ + file:undefined, + languagewrite:"", + systemenvironment:"", + testcoderunmode:"", + }) + } + } yeshidemodel = () => { this.setState({ @@ -1198,29 +1328,76 @@ export default class TPMsettings extends Component { }) } + handleChange = (info) => { + console.log("handleChange1"); + let fileList = info.fileList; + this.setState({ fileList:fileList, + deleteisnot:false}); + } + + onAttachmentRemove = (file) => { + confirm({ + title: '确定要删除这个附件吗?', + okText: '确定', + cancelText: '取消', + // content: 'Some descriptions', + onOk: () => { + console.log("665") + this.deleteAttachment(file) + }, + onCancel() { + console.log('Cancel'); + }, + }); + return false; + } + + deleteAttachment = (file) => { + console.log(file); + let id=file.response ==undefined ? file.id : file.response.id + const url = `/attachments/${id}.json` + axios.delete(url, { + }) + .then((response) => { + if (response.data) { + const { status } = response.data; + if (status == 0) { + // console.log('--- success') + + this.setState((state) => { + + const index = state.fileList.indexOf(file); + const newFileList = state.fileList.slice(); + newFileList.splice(index, 1); + return { + fileList: newFileList, + deleteisnot:true + }; + }); + } + } + }) + .catch(function (error) { + console.log(error); + }); + } + + - render() { + render() { let { postapplyvisible, - sendsure_applyvalue, postapplytitle, shixunnametype, shixunmaintype, evaluate_scripttype, - exec_timetype, traineetype, standard_scripts, - description, - evaluate_script, name, settingsData, webssh, use_scope, - shixunsstatus, shixunsID, - exec_time, - pod_exist_time, - pod_exist_timetype, can_copy, choice_standard_scripts, Executiveordervalue, @@ -1241,19 +1418,15 @@ export default class TPMsettings extends Component { standard_scriptsModal, standard_scriptsModals, SelectTheCommandtype, - status, - opers, - operss, - opersss, testscripttiptype, operateshixunstype, opening_time, - opensmail, scope_partmenttype, newuse_scope, scope_partments, shixunmemoMDvalue,delType, - shixun_service_configs + shixun_service_configs, + fileList, } = this.state; let options; @@ -1265,7 +1438,46 @@ export default class TPMsettings extends Component { ) }) } + const uploadProps = { + width: 600, + fileList, + multiple: true, + // https://github.com/ant-design/ant-design/issues/15505 + // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 + // showUploadList: false, + action: `${getUrl()}/api/attachments.json`, + onChange: this.handleChange, + onRemove: this.onAttachmentRemove, + beforeUpload: (file) => { + // console.log('beforeUpload', file.name); + const isLt150M = file.size / 1024 / 1024 < 50; + if (!isLt150M) { + // this.props.showNotification(`文件大小必须小于50MB`); + notification.open( + { + message: '提示', + description: + '文件大小必须小于50MB', + + } + ) + } + if(thiss.state.file !== undefined){ + console.log("763") + // thiss.deleteAttachment(thiss.state.file); + thiss.setState({ + file:file + }) + }else { + thiss.setState({ + file:file + }) + } + console.log("handleChange2"); + return isLt150M; + }, + } const dateFormat = 'YYYY-MM-DD HH:mm:ss'; let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.state.status==0?true:false; @@ -1391,13 +1603,13 @@ export default class TPMsettings extends Component { }) } - {/**/} - {/*列表中没有?*/} - {/*申请新建*/} - {/*

*/} +

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

-
  • - +
  • + + style={{width:'89%',height:'100px'}} + onInput={this.setlanguagewrite} + value={this.state.languagewrite} + placeholder="请填写该镜像是基于什么语言:示例:Python" + id="demand_info"> +
  • +
    {this.state.languagewritetype===true?"请填写该镜像语言":""}
    +
  • + + +
  • +
    {this.state.systemenvironmenttype===true?"请填写该镜像语言系统环境":""}
    +
  • + + + +
  • +
    {this.state.testcoderunmodetype===true?"请填写该镜像测试代码运行方式":""}
    +
  • + +
    + { + this.state.deleteisnot=== true? + + + 上传附件 + (单个文件50M以内) + + + : + + + 上传附件 + (单个文件50M以内) + + + } +
    +
  • +
    + {this.state.attachmentidstype===true?"请上传附件":""} +
    +
  • + this.sendhideModaly()} + >取消 +
  • - this.sendsure_apply()} - className="task-btn task-btn-orange fr mr12">确定 - this.sendhideModaly()} - >取消
    +
    + + + {/*
    */}
    -
  • +
  • {this.state.languagewritetype===true?"请填写该镜像语言":""}
    -
  • +