Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_Ysl

dev_cs_new
杨树林 6 years ago
commit e45d3b3d99

@ -189,8 +189,8 @@ class ApplicationController < ActionController::Base
# 资料是否完善 # 资料是否完善
def check_account def check_account
if !current_user.profile_completed? if !current_user.profile_completed?
info_url = '/account/profile' #info_url = '/account/profile'
tip_exception(402, info_url) tip_exception(402, nil)
end end
end end

@ -1,5 +1,6 @@
json.memo do json.memo do
json.id memo.id json.id memo.id
json.forum_id memo.forum_id
json.subject memo.subject json.subject memo.subject
json.is_md memo.is_md json.is_md memo.is_md
json.content memo.content json.content memo.content
@ -9,6 +10,6 @@ json.memo do
json.tag memo.tag_repertoires.map(&:name) json.tag memo.tag_repertoires.map(&:name)
json.time memo.created_at json.time memo.created_at
json.replies_count memo.all_replies_count 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 json.memo_praise_count memo.praise_treads.liker.count
end end

@ -16,7 +16,7 @@ json.college_identifier @user.college_identifier
json.followed User.current.watched?(@user) json.followed User.current.watched?(@user)
if @user.logged_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.attendance_signed @user.attendance_signed?
json.tomorrow_attendance_gold @user.tomorrow_attendance_gold json.tomorrow_attendance_gold @user.tomorrow_attendance_gold
end end

@ -29,7 +29,7 @@ const env = getClientEnvironment(publicUrl);
module.exports = { module.exports = {
// You may want 'eval' instead if you prefer to see the compiled output in DevTools. // 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 // 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. // These are the "entry points" to our application.
// This means they will be the "root" imports that are included in JS bundle. // 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. // The first two entry points enable "hot" CSS and auto-refreshes for JS.

@ -59,4 +59,8 @@ export { default as Clappr } from './components/media/Clappr'
export { default as ImageLayerHook } from './hooks/ImageLayerHook' export { default as ImageLayerHook } from './hooks/ImageLayerHook'
// 外部
export { default as CBreadcrumb } from '../modules/courses/common/CBreadcrumb'

@ -42,6 +42,9 @@ function disabledDateTime() {
// disabledSeconds: () => [55, 56], // 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 // 类似页面 http://localhost:3007/courses/1309/graduation/graduation_tasks/48/76/setting
class CommonWorkSetting extends Component{ class CommonWorkSetting extends Component{
@ -1093,6 +1096,7 @@ class CommonWorkSetting extends Component{
onChange={this.onChangeTimeend} onChange={this.onChangeTimeend}
disabled={this.props.isSuperAdmin()?false:end_time_type===true?true:false} disabled={this.props.isSuperAdmin()?false:end_time_type===true?true:false}
disabled={moment(this.state.init_end_time) < moment() || noAuth} disabled={moment(this.state.init_end_time) < moment() || noAuth}
disabledDate={disabledDateFunc}
// disabledDate={ (end_time) => // disabledDate={ (end_time) =>
// { // {
@ -1166,6 +1170,7 @@ class CommonWorkSetting extends Component{
disabledTime={disabledDateTime} disabledTime={disabledDateTime}
// || moment(init_late_time) < moment() // || moment(init_late_time) < moment()
disabled={!allow_late || noAuth } disabled={!allow_late || noAuth }
disabledDate={disabledDateFunc}
// disabledDate={ (late_time) => // disabledDate={ (late_time) =>
// { // {
// const end_time = this.state.end_time // const end_time = this.state.end_time
@ -1247,6 +1252,8 @@ class CommonWorkSetting extends Component{
onChange={this.onChangeEvaluationEnd} onChange={this.onChangeEvaluationEnd}
disabledTime={disabledDateTime} disabledTime={disabledDateTime}
disabled={(anonymous_comment && !noAuth ? false : true) || moment(init_evaluation_end) < moment()} disabled={(anonymous_comment && !noAuth ? false : true) || moment(init_evaluation_end) < moment()}
disabledDate={disabledDateFunc}
// disabledDate={ (evaluation_end) => // disabledDate={ (evaluation_end) =>
// { // {
// const evaluation_start = this.state.evaluation_start // const evaluation_start = this.state.evaluation_start
@ -1335,6 +1342,7 @@ class CommonWorkSetting extends Component{
dropdownClassName="hideDisable" dropdownClassName="hideDisable"
showTime={{ format: 'HH:mm' }} showTime={{ format: 'HH:mm' }}
disabledTime={disabledDateTime} disabledTime={disabledDateTime}
disabledDate={disabledDateFunc}
showToday={false} showToday={false}
locale={locale} locale={locale}
format={dateFormat} format={dateFormat}

@ -8,7 +8,7 @@ class CBreadcrumb extends Component{
} }
render(){ render(){
let { items, className }=this.props; let { items, className, separator }=this.props;
return( return(
<p className={`clearfix mb10 ${className}`}> <p className={`clearfix mb10 ${className}`}>
{ items && items.map( (item, index) => { { items && items.map( (item, index) => {
@ -18,7 +18,7 @@ class CBreadcrumb extends Component{
if (item.to) { if (item.to) {
return <React.Fragment> return <React.Fragment>
<WordsBtn style="grey" className="fl hovercolorblue" to={item.to}>{item.name}</WordsBtn> <WordsBtn style="grey" className="fl hovercolorblue" to={item.to}>{item.name}</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span> <span className="color-grey-9 fl ml3 mr3">{separator || '&gt;'}</span>
</React.Fragment> </React.Fragment>
} else { } else {
return <span>{item.name}</span> return <span>{item.name}</span>

@ -2,7 +2,7 @@ import React, {Component} from 'react';
import {Link} from "react-router-dom"; import {Link} from "react-router-dom";
import axios from 'axios'; import axios from 'axios';
import {getImageUrl, trigger, on, off} from 'educoder'; 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 CoursesListType from '../coursesPublic/CoursesListType';
import AccountProfile from"../../user/AccountProfile"; import AccountProfile from"../../user/AccountProfile";
import Addcourses from '../coursesPublic/Addcourses'; import Addcourses from '../coursesPublic/Addcourses';
@ -489,23 +489,42 @@ class CoursesBanner extends Component {
<div className="clearfix clearfixborder"> <div className="clearfix clearfixborder">
<ul className="fl color-grey-eb pathInfo pathInfobox mt10"> <ul className="fl color-grey-eb pathInfo pathInfobox mt10">
<li className={"mt7 teachersbox"} > <style>
<Link to={"/courses/"+this.props.match.params.coursesId+"/teachers"}> {`
<span className="color-grey-c fl font-16">教师</span> .ant-breadcrumb-separator{
<span color: rgba(255,255,255,0.3) !important;
className="color-white fl font-16 bannerurli">{coursedata.teacher_count}</span> }
</Link> `}
</li> </style>
<Breadcrumb separator="|" className={"mt5"}>
<Breadcrumb.Item href={"/courses/"+this.props.match.params.coursesId+"/teachers"}>
<span className="color-grey-c font-16">教师 {coursedata.teacher_count}</span>
</Breadcrumb.Item>
<Breadcrumb.Item href={"/courses/"+this.props.match.params.coursesId+"/students"}>
<span className="color-grey-c font-16">学生 {coursedata.student_count}</span>
</Breadcrumb.Item>
<Breadcrumb.Item>{coursedata.credit===null?"":
<span className="color-grey-c font-16">学分 {coursedata.credit}</span>
}</Breadcrumb.Item>
</Breadcrumb>
{/*<li className={"mt7 teachersbox"} >*/}
{/*<Link to={"/courses/"+this.props.match.params.coursesId+"/teachers"}>*/}
{/*<span className="color-grey-c fl font-16">教师</span>*/}
{/*<span*/}
{/*className="color-white fl font-16 bannerurli">{coursedata.teacher_count}</span>*/}
{/*</Link>*/}
{/*</li>*/}
<li className={"mt7"}> {/*<li className={"mt7 teachersbox"}>*/}
<Link to={"/courses/"+this.props.match.params.coursesId+"/students"}> {/*<Link to={"/courses/"+this.props.match.params.coursesId+"/students"}>*/}
<span className="color-grey-c fl font-16">学生</span> {/*<span className="color-grey-c fl font-16">学生</span>*/}
<span {/*<span*/}
className={coursedata.credit===null?"color-white fl font-16 bannerurlis":"color-white fl font-16 bannerurli"}> {/*className={coursedata.credit===null?"color-white fl font-16 bannerurlis":"color-white fl font-16 bannerurli"}>*/}
{coursedata.student_count} {/*{coursedata.student_count}*/}
</span> {/*</span>*/}
</Link> {/*</Link>*/}
</li> {/*</li>*/}
{/*<li className={"mt7"}>*/} {/*<li className={"mt7"}>*/}
{/*<a>*/} {/*<a>*/}
@ -514,13 +533,13 @@ class CoursesBanner extends Component {
{/*</a>*/} {/*</a>*/}
{/*</li>*/} {/*</li>*/}
{coursedata.credit===null?"":<li className={"mt7"}> {/*{coursedata.credit===null?"":<li className={"mt7"}>*/}
<a> {/*<a>*/}
<span className="color-grey-c fl font-16 mr10">学分</span> {/*<span className="color-grey-c fl font-16 mr10">学分</span>*/}
<span className="color-white fl font-16 " {/*<span className="color-white fl font-16 "*/}
>{coursedata.credit}</span> {/*>{coursedata.credit}</span>*/}
</a> {/*</a>*/}
</li>} {/*</li>}*/}
{/*{coursedata.course_end===true? <li className={"mt7"}>*/} {/*{coursedata.course_end===true? <li className={"mt7"}>*/}
{/*<span className="color-grey-c fl font-16">已结束</span>*/} {/*<span className="color-grey-c fl font-16">已结束</span>*/}

@ -219,8 +219,7 @@ class AddTeacherModal extends Component{
} }
.df span.label { .df span.label {
margin-right: 8px; margin-right: 8px;
text-align: right; text-align: left;
margin-left: 12px;
} }
.df .ant-input-affix-wrapper { .df .ant-input-affix-wrapper {
width: 32%; width: 32%;
@ -232,11 +231,11 @@ class AddTeacherModal extends Component{
`} `}
</style> </style>
<div className="df"> <div className="df">
<span className="firstLabel label">姓名:</span> <span className="firstLabel label" style={{ flex: '0 0 40px' }}>姓名:</span>
<Input allowClear placeholder="请输入真实姓名" value={name} onChange={(e) => {this.setState({name: e.target.value})}} <Input allowClear placeholder="请输入真实姓名" value={name} onChange={(e) => {this.setState({name: e.target.value})}}
style={{ width: '200px'}}> style={{ width: '200px', marginRight: '18px' }}>
</Input> </Input>
<span className="label" style={{ minWidth: '36px' }}>单位:</span> <span className="label" style={{ minWidth: '36px', flex: '0 0 40px' }}>单位:</span>
<SchoolSelect <SchoolSelect
value={school_name} value={school_name}
onChange={this.onOrgNameChange} onChange={this.onOrgNameChange}
@ -256,37 +255,7 @@ class AddTeacherModal extends Component{
>搜索</a> >搜索</a>
</div> </div>
{/* graduation_groups && !!graduation_groups.length */} {/* graduation_groups && !!graduation_groups.length */}
{ this.hasGraduationModule() && <div className="df" style={{ marginTop: '24px' }} >
<span className="firstLabel label">答辩组:</span>
<Select style={{ width: 457 }} onChange={this.handleGradationGroupChange} value={graduationGroup}
dropdownRender={menu => (
<div>
{menu}
<Divider style={{ margin: '4px 0' }} />
{/* <ActionBtn
onMouseDown={() => { debugger; this.refs['addGraduationGroupModal'].setVisible(true) }}
>添加答辩组</ActionBtn> */}
<div style={{ padding: '8px', cursor: 'pointer' }}
onMouseDown={() => { debugger; this.refs['addGraduationGroupModal'].setVisible(true) }}
>
<Icon type="plus" /> 添加答辩组
</div>
</div>
)}
>
{ graduation_groups && graduation_groups.map((item) => {
return <Option value={item.id}>{item.name}</Option>
})}
</Select>
</div>}
{ course_groups && !!course_groups.length && <div className="df">
<span className="firstLabel label">管理权限:</span>
<Select style={{ width: 457 }} onChange={this.handleCourseGroupChange} value={courseGroup}>
{ course_groups && course_groups.map((item) => {
return <Option value={item.id}>{item.name}</Option>
})}
</Select>
</div> }
<p className="clearfix mb2" style={{ margin: '0px 15px 6px' }}> <p className="clearfix mb2" style={{ margin: '0px 15px 6px' }}>
<Checkbox className="fl" style={{ visibility: 'hidden' }} ></Checkbox> <Checkbox className="fl" style={{ visibility: 'hidden' }} ></Checkbox>
@ -339,6 +308,40 @@ class AddTeacherModal extends Component{
</InfiniteScroll> </InfiniteScroll>
</div> </div>
</div> : <NoneData></NoneData> } </div> : <NoneData></NoneData> }
<div className="df">
{ this.hasGraduationModule() && <div className="df" style={{ marginTop: '24px' }} >
<span className="firstLabel label" style={{ flex: '0 0 96px' }}>添加至答辩组:</span>
<Select style={{ width: 218, marginRight: '18px' }} onChange={this.handleGradationGroupChange} value={graduationGroup}
dropdownRender={menu => (
<div>
{menu}
<Divider style={{ margin: '4px 0' }} />
{/* <ActionBtn
onMouseDown={() => { debugger; this.refs['addGraduationGroupModal'].setVisible(true) }}
>添加答辩组</ActionBtn> */}
<div style={{ padding: '8px', cursor: 'pointer' }}
onMouseDown={() => { debugger; this.refs['addGraduationGroupModal'].setVisible(true) }}
>
<Icon type="plus" /> 添加答辩组
</div>
</div>
)}
>
{ graduation_groups && graduation_groups.map((item) => {
return <Option value={item.id}>{item.name}</Option>
})}
</Select>
</div>}
{ course_groups && !!course_groups.length && <div className="df">
<span className="firstLabel label">管理权限:</span>
<Select style={{ width: 218 }} onChange={this.handleCourseGroupChange} value={courseGroup}>
{ course_groups && course_groups.map((item) => {
return <Option value={item.id}>{item.name}</Option>
})}
</Select>
</div> }
</div>
</ModalWrapper> </ModalWrapper>
) )
} }

@ -22,8 +22,11 @@ import {ImageLayerOfCommentHOC} from '../page/layers/ImageLayerOfCommentHOC'
import MemoDetailKEEditor from './MemoDetailKEEditor' import MemoDetailKEEditor from './MemoDetailKEEditor'
import MemoDetailMDEditor from './MemoDetailMDEditor' import MemoDetailMDEditor from './MemoDetailMDEditor'
import { bytesToSize } from 'educoder' import { bytesToSize, CBreadcrumb } from 'educoder'
import { Tooltip } from 'antd' import { Tooltip } from 'antd'
// import CBreadcrumb from '../courses/common/CBreadcrumb'
import { typeNameMap2 } from './MemoNew'
const $ = window.$ const $ = window.$
function urlStringify(params) { function urlStringify(params) {
let noParams = true; let noParams = true;
@ -682,6 +685,13 @@ class MemoDetail extends Component {
memo.isDetailPage = true; memo.isDetailPage = true;
// TODO 图片上传地址 // TODO 图片上传地址
return ( return (
<React.Fragment>
<CBreadcrumb items={[
{ to: `/forums/categories/${memo.forum_id}`, name: typeNameMap2[memo.forum_id]},
{ name: '详情' },
]}
separator={' / '}
></CBreadcrumb>
<div className="edu-back-white memoDetail" id="forum_index_list"> {/* fl with100 */} <div className="edu-back-white memoDetail" id="forum_index_list"> {/* fl with100 */}
<style>{` <style>{`
.memoDetail .commentsbtn { .memoDetail .commentsbtn {
@ -735,12 +745,12 @@ class MemoDetail extends Component {
</ul> </ul>
</div> </div>
} }
<Link className={`task-hide fr return_btn color-grey-6 mt2 ${ _current_user && (_current_user.admin === true {/* <Link className={`task-hide fr return_btn color-grey-6 mt2 ${ _current_user && (_current_user.admin === true
|| _current_user.user_id === author_info.user_id) ? '': 'no_mr'} `} to="/forums" || _current_user.user_id === author_info.user_id) ? '': 'no_mr'} `} to="/forums"
style={{ marginRight: '10px'}} style={{ marginRight: '10px'}}
> >
返回 返回
</Link> </Link> */}
</div> </div>
</div> </div>
<div className="color-grey-9 clearfix"> <div className="color-grey-9 clearfix">
@ -837,6 +847,7 @@ class MemoDetail extends Component {
</div> </div>
</div> </div>
</React.Fragment>
); );
} }
} }

@ -121,7 +121,7 @@ const typeNameMap = {
'技术分享': 5, '技术分享': 5,
'操作指南': 3, '操作指南': 3,
} }
const typeNameMap2 = { export const typeNameMap2 = {
5: '技术分享', 5: '技术分享',
3: '操作指南', 3: '操作指南',
} }

@ -900,18 +900,25 @@ class TPMBanner extends Component {
</div> </div>
</div> </div>
{this.state.Senttothevcaluetype===true?<div className={"color-red"}>请选择你要发送的课堂</div>:""} {this.state.Senttothevcaluetype===true?<div className={"color-red"}>请选择你要发送的课堂</div>:""}
<div className="mt10 marginauto"> <div className="mt10 marginauto" style={{display: courses_count > 12 ? "block" : "none"}}>
<Pagination size="small" style={{display: courses_count > 12 ? "block" : "none"}} <Pagination size="small" className="mb20"
showQuickJumper defaultCurrent={1} current={pages} pageSize={12} showQuickJumper defaultCurrent={1} current={pages} pageSize={12}
total={courses_count} onChange={this.onChangesendeSenttothe}/> total={courses_count} onChange={this.onChangesendeSenttothe}/>
</div>
<a className="task-btn task-btn-orange fr margin-tp26" <div className="mt10 marginauto flexbannerright">
onClick={this.sendeSenttothevcalue} <div className={"-flex"}></div>
id="submit_send_shixun">确定</a> <div className={"-flex"}></div>
<div className={"-flex"}>
<a onClick={this.hideSenttothevcalue}
className="pop_close task-btn mr10 ml25 margin-tp26">取消</a>
<a className="task-btn task-btn-orange margin-tp26"
onClick={this.sendeSenttothevcalue}
id="submit_send_shixun">确定</a>
</div>
<a onClick={this.hideSenttothevcalue}
className="pop_close task-btn fr mr10 margin-tp26">取消</a> </div>
</div>
</div> </div>
</div> </div>

@ -3,7 +3,7 @@ import React, { Component } from 'react';
import MonacoEditor from 'react-monaco-editor'; import MonacoEditor from 'react-monaco-editor';
//MonacoDiffEditor 对比模式 //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"; // import "antd/dist/antd.css";
@ -30,7 +30,7 @@ let currentValue;
const Option = Select.Option; const Option = Select.Option;
const RadioGroup = Radio.Group; const RadioGroup = Radio.Group;
const confirm = Modal.confirm;
// 处理整点 半点 // 处理整点 半点
// 取传入时间往后的第一个半点 // 取传入时间往后的第一个半点
export function handleDateStrings(dateString) { export function handleDateStrings(dateString) {
@ -207,6 +207,7 @@ export default class TPMsettings extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
fileList: [],
commandLine: 0, commandLine: 0,
Openpublic: 0, Openpublic: 0,
settingsData: undefined, settingsData: undefined,
@ -268,7 +269,8 @@ export default class TPMsettings extends Component {
pod_exist_time: undefined, pod_exist_time: undefined,
pod_exist_timetype: false, pod_exist_timetype: false,
shixunmemoMDvalue:"", shixunmemoMDvalue:"",
language:"" language:"",
deleteisnot:true
} }
} }
descriptionMD=(initValue, id)=> { descriptionMD=(initValue, id)=> {
@ -1011,32 +1013,160 @@ export default class TPMsettings extends Component {
}) })
} }
sendsure_apply = () => { setlanguagewrite = (e)=>{
let {sendsure_applyvalue} = this.state; this.setState({
let url = "/shixuns/apply_shixun_mirror.json"; languagewrite: e.target.value
axios.post(url, { })
note: sendsure_applyvalue }
}).then((response) => {
if (response.status === 200) {
if (response.data.status == 1) {
this.setState({
postapplyvisible: false,
postapplytitle: true
})
}
} setsystemenvironment = (e) => {
}).catch((error) => { this.setState({
console.log(error) 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 = () => { yeshidemodel = () => {
this.setState({ 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});
}
render() { 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() {
let { let {
postapplyvisible, postapplyvisible,
sendsure_applyvalue,
postapplytitle, postapplytitle,
shixunnametype, shixunnametype,
shixunmaintype, shixunmaintype,
evaluate_scripttype, evaluate_scripttype,
exec_timetype,
traineetype, traineetype,
standard_scripts, standard_scripts,
description,
evaluate_script,
name, name,
settingsData, settingsData,
webssh, webssh,
use_scope, use_scope,
shixunsstatus,
shixunsID, shixunsID,
exec_time,
pod_exist_time,
pod_exist_timetype,
can_copy, can_copy,
choice_standard_scripts, choice_standard_scripts,
Executiveordervalue, Executiveordervalue,
@ -1241,19 +1418,15 @@ export default class TPMsettings extends Component {
standard_scriptsModal, standard_scriptsModal,
standard_scriptsModals, standard_scriptsModals,
SelectTheCommandtype, SelectTheCommandtype,
status,
opers,
operss,
opersss,
testscripttiptype, testscripttiptype,
operateshixunstype, operateshixunstype,
opening_time, opening_time,
opensmail,
scope_partmenttype, scope_partmenttype,
newuse_scope, newuse_scope,
scope_partments, scope_partments,
shixunmemoMDvalue,delType, shixunmemoMDvalue,delType,
shixun_service_configs shixun_service_configs,
fileList,
} = this.state; } = this.state;
let options; let options;
@ -1265,7 +1438,45 @@ 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(this.state.file !== undefined){
console.log("763")
this.setState({
file:file
})
}else {
this.setState({
file:file
})
}
console.log("handleChange2");
return isLt150M;
},
}
const dateFormat = 'YYYY-MM-DD HH:mm:ss'; 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; let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.state.status==0?true:false;
@ -1391,13 +1602,13 @@ export default class TPMsettings extends Component {
}) })
} }
</Select> </Select>
{/*<p*/} <p
{/*className="edu-txt-left font-12"*/} className="edu-txt-left font-12"
{/*style={{display:operateauthority?"block":'none'}}*/} style={{display:operateauthority?"block":'none'}}
{/*>*/} >
{/*列表中没有?*/} 列表中没有
{/*<a className="color-blue" onClick={this.post_apply}>申请新建</a>*/} <a className="color-blue" onClick={this.post_apply}>申请新建</a>
{/*</p>*/} </p>
<Modal <Modal
keyboard={false} keyboard={false}
@ -1405,26 +1616,86 @@ export default class TPMsettings extends Component {
visible={postapplyvisible} visible={postapplyvisible}
closable={false} closable={false}
footer={null} footer={null}
width={850}
heigth={720}
> >
<div> <div>
<li className="clearfix mb15"> <li className="clearfix ml82" >
<label className="panel-form-label fl"><span <label className="fl mt10 "><span
className="color-red fl mt3">*</span>&nbsp;&nbsp;</label> className="color-red fl mt3">*</span>&nbsp;&nbsp;</label>
<textarea className="fl task-form-80 task-height-150" <textarea className="fl task-form-80 task-height-150"
style={{width:'100%'}} style={{width:'89%',height:'100px'}}
onInput={this.sendsure_applyvalues} onInput={this.setlanguagewrite}
value={sendsure_applyvalue} value={this.state.languagewrite}
placeholder="请输入新增镜像需要安装的软件及版本等信息" id="demand_info"></textarea> placeholder="请填写该镜像是基于什么语言示例Python"
id="demand_info"></textarea>
</li>
<div className={"color-red shixunspanred"}>{this.state.languagewritetype===true?"请填写该镜像语言":""}</div>
<li className="clearfix ml1">
<label className="panel-form-label fl ml50"><span
className="color-red fl mt3">*</span>&nbsp;&nbsp;</label>
<textarea className="fl task-form-80 task-height-150 "
onInput={this.setsystemenvironment}
style={{height:'100px'}}
value={this.state.systemenvironment}
placeholder="请填写该镜像是基于什么linux系统环境,代码运行环境"
id="demand_info"></textarea>
</li>
<div className={"color-red shixunspanred"}>{this.state.systemenvironmenttype===true?"请填写该镜像语言系统环境":""}</div>
<li className="clearfix">
<label className="fl mt10" ><span
className="color-red fl mt3">*</span>&nbsp;&nbsp;</label>
<textarea className="fl task-form-80 task-height-150 "
onInput={this.settestcoderunmode}
value={this.state.testcoderunmode}
style={{height:'100px'}}
placeholder="请填写该镜像中测试代码运行方式"
id="demand_info"></textarea>
</li>
<div className={"color-red shixunspanred"}>{this.state.testcoderunmodetype===true?"请填写该镜像测试代码运行方式":""}</div>
<li className="clearfix ml50">
<label className="panel-form-label fl mt-5"><span
className="color-red fl">*</span>&nbsp;&nbsp;</label>
<div className="mt10" style={{
display: "inline-block"
}}>
{
this.state.deleteisnot=== true?
<Upload {...uploadProps} >
<Icon type="upload" className="fl mt3" > </Icon>
<span className="color-blue fl cdefault">上传附件</span>
<span className="color-grey-c fl ml10 ">(单个文件50M以内)</span>
</Upload>
:
<Upload {...uploadProps} disabled={true} >
<Icon type="upload" className="fl mt3" > </Icon>
<span className="color-grey-c fl">上传附件</span>
<span className="color-grey-c fl ml10 ">(单个文件50M以内)</span>
</Upload>
}
</div>
</li>
<div className={"color-red shixunspanred"}>
{this.state.attachmentidstype===true?"请上传附件":""}
</div>
<li className="edu-txt-center clearfix ">
<a className="pop_close task-btn mr30"
onClick={() => this.sendhideModaly()}
>取消</a>
<Button type="primary" onClick={()=>this.sendsure_apply()}
className="task-btn task-btn-orange">确定</Button>
</li> </li>
<a onClick={() => this.sendsure_apply()}
className="task-btn task-btn-orange fr mr12">确定</a>
<a className="pop_close task-btn fr mr10"
onClick={() => this.sendhideModaly()}
>取消</a>
<div className="cl"></div> <div className="cl"></div>
</div> </div>
</Modal> </Modal>
<Modal <Modal
keyboard={false} keyboard={false}
title="提示" title="提示"

@ -100,4 +100,14 @@ a.newuse_scope-btn {
.shixunmemoMDdiv{ .shixunmemoMDdiv{
width: 99%; width: 99%;
height: 615px; height: 615px;
} }
.shixunspanred{
margin-left: 142px;
margin-top: 5px;
margin-bottom: 5px;
}
.ml82{
margin-left:82px;
}

@ -837,7 +837,6 @@ class Newshixuns extends Component {
} }
render() { render() {
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
const thiss=this;
let {testcoderunmode ,systemenvironment,languagewrite,deleteisnot, fileList,TimePickervalue, scope_partmenttype, opensmail, newshixunlist, name, scope_partment, departmentslist, postapplyvisible, sendsure_applyvalue, postapplytitle, shixun_nametype, main_types, trainee_types, SelectTheCommandtype, opers, datalisttype, onSearchvalue} = this.state; let {testcoderunmode ,systemenvironment,languagewrite,deleteisnot, fileList,TimePickervalue, scope_partmenttype, opensmail, newshixunlist, name, scope_partment, departmentslist, postapplyvisible, sendsure_applyvalue, postapplytitle, shixun_nametype, main_types, trainee_types, SelectTheCommandtype, opers, datalisttype, onSearchvalue} = this.state;
let options let options
if (departmentslist != undefined) { if (departmentslist != undefined) {
@ -871,14 +870,13 @@ class Newshixuns extends Component {
} }
) )
} }
if(thiss.state.file !== undefined){ if(this.state.file !== undefined){
console.log("763") console.log("763")
// thiss.deleteAttachment(thiss.state.file); this.setState({
thiss.setState({
file:file file:file
}) })
}else { }else {
thiss.setState({ this.setState({
file:file file:file
}) })
} }
@ -1004,7 +1002,7 @@ class Newshixuns extends Component {
> >
{/*<Form onSubmit={this.handleSubmit}>*/} {/*<Form onSubmit={this.handleSubmit}>*/}
<div> <div>
<li className="clearfix ml85" > <li className="clearfix ml82" >
<label className="fl mt10 "><span <label className="fl mt10 "><span
className="color-red fl mt3">*</span>&nbsp;&nbsp;</label> className="color-red fl mt3">*</span>&nbsp;&nbsp;</label>
<textarea className="fl task-form-80 task-height-150" <textarea className="fl task-form-80 task-height-150"
@ -1015,7 +1013,7 @@ class Newshixuns extends Component {
id="demand_info"></textarea> id="demand_info"></textarea>
</li> </li>
<div className={"color-red shixunspanred"}>{this.state.languagewritetype===true?"请填写该镜像语言":""}</div> <div className={"color-red shixunspanred"}>{this.state.languagewritetype===true?"请填写该镜像语言":""}</div>
<li className="clearfix"> <li className="clearfix ml1">
<label className="panel-form-label fl ml50"><span <label className="panel-form-label fl ml50"><span
className="color-red fl mt3">*</span>&nbsp;&nbsp;</label> className="color-red fl mt3">*</span>&nbsp;&nbsp;</label>
<textarea className="fl task-form-80 task-height-150 " <textarea className="fl task-form-80 task-height-150 "
@ -1054,7 +1052,7 @@ class Newshixuns extends Component {
deleteisnot=== true? deleteisnot=== true?
<Upload {...uploadProps} > <Upload {...uploadProps} >
<Icon type="upload" className="fl mt3" > </Icon> <Icon type="upload" className="fl mt3" > </Icon>
<span className="color-blue fl">上传附件</span> <span className="color-blue fl cdefault">上传附件</span>
<span className="color-grey-c fl ml10 ">(单个文件50M以内)</span> <span className="color-grey-c fl ml10 ">(单个文件50M以内)</span>
</Upload> </Upload>
@ -1088,6 +1086,8 @@ class Newshixuns extends Component {
{/*</Form>*/} {/*</Form>*/}
</Modal> </Modal>
<Modal <Modal
keyboard={false} keyboard={false}
title="提示" title="提示"

@ -382,3 +382,6 @@ a.white-btn.use_scope-btn:hover{
margin-bottom: 5px; margin-bottom: 5px;
} }
.ml82{
margin-left: 82px;
}

@ -100,4 +100,9 @@ a:active{text-decoration:none;}
.mr51{ .mr51{
margin-right:51px; margin-right:51px;
}
.flexbannerright{
display: flex;
justify-content: flex-end;
} }

@ -342,16 +342,14 @@ class Infos extends Component{
is_current ? is_current ?
<div className="inline"> <div className="inline">
{ {
data && data.can_apply_trial == false ? data && data.attendance_signed ?
data.attendance_signed ? <React.Fragment>
<React.Fragment> <span className="user_default_btn user_grey_btn mb5">已签到</span>
<span className="user_default_btn user_grey_btn mb5">已签到</span> <p id="attendance_notice" className="none font-12 color-grey-6" style={{"display":"block"}}>明日签到&nbsp;<font className="color-orange">+{next_gold}</font>&nbsp;</p>
<p id="attendance_notice" className="none font-12 color-grey-6" style={{"display":"block"}}>明日签到&nbsp;<font className="color-orange">+{next_gold}</font>&nbsp;</p> </React.Fragment>
</React.Fragment>
:
<a herf="javascript:void(0);" onClick={this.signFor} id="attendance" className="user_default_btn user_orange_btn fl mb15">签到</a>
: :
<a herf="javascript:void(0);" onClick={this.trialapplications} id="authentication_apply" className="user_default_btn user_private_btn fl ml15">试用申请</a> <a herf="javascript:void(0);" onClick={this.signFor} id="attendance" className="user_default_btn user_orange_btn fl mb15">签到</a>
// <a herf="javascript:void(0);" onClick={this.trialapplications} id="authentication_apply" className="user_default_btn user_private_btn fl ml15">试用申请</a>
} }
</div> </div>
: :

Loading…
Cancel
Save