dev_aliyun2
harry 5 years ago
parent 89c7c078cf
commit 1c5ac52b68

@ -1,5 +1,5 @@
import md5 from 'md5';
export function setmiyah(logins){
const opens ="79e33abd4b6588941ab7622aed1e67e8";
return md5(opens+logins);
export default function setmiyah(logins) {
const opens = "79e33abd4b6588941ab7622aed1e67e8";
return md5(opens + logins);
}

@ -1,15 +1,12 @@
import React from "react";
import md5 from 'md5';
import {Input} from "antd";
import { Input } from "antd";
const { Search } = Input;
const $ = window.$;
const isDev = window.location.port == 3007;
export const TEST_HOST = "https://test-newweb.educoder.net"
export function getImageUrl(path) {
// https://www.educoder.net
// https://testbdweb.trustie.net
// const local = 'http://localhost:3000'
const local = 'https://test-newweb.educoder.net'
if (isDev) {
return `${local}/${path}`
@ -17,31 +14,22 @@ export function getImageUrl(path) {
return `/${path}`;
}
export function setImagesUrl(path){
export function setImagesUrl(path) {
const local = 'https://test-newweb.educoder.net'
let firstStr=path.substr(0,1);
// console.log(firstStr);
if(firstStr=="/"){
return isDev?`${local}${path}`:`${path}`;
}else{
return isDev?`${local}/${path}`:`/${path}`;
let firstStr = path.substr(0, 1);
if (firstStr == "/") {
return isDev ? `${local}${path}` : `${path}`;
} else {
return isDev ? `${local}/${path}` : `/${path}`;
}
}
export function getUrl(path, goTest) {
// https://www.educoder.net
// https://testbdweb.trustie.net
// 如果想所有url定位到测试版可以反注释掉下面这行
//goTest = true
// testbdweb.educoder.net testbdweb.trustie.net
// const local = goTest ? 'https://testeduplus2.educoder.net' : 'http://localhost:3000'
// const local = 'https://testeduplus2.educoder.net'
export function getUrl(path) {
const local = 'https://test-newweb.educoder.net'
if (isDev) {
return `${local}${path?path:''}`
return `${local}${path ? path : ''}`
}
return `${path ? path: ''}`;
return `${path ? path : ''}`;
}
export function getUrlmys(path, goTest) {
@ -55,9 +43,9 @@ export function getUrlmys(path, goTest) {
// const local = 'https://testeduplus2.educoder.net'
const local = 'https://test-jupyterweb.educoder.net'
if (isDev) {
return `${local}${path?path:''}`
return `${local}${path ? path : ''}`
}
return `${path ? path: ''}`;
return `${path ? path : ''}`;
}
export function getStaticUrl() {
const local = TEST_HOST;
@ -70,25 +58,27 @@ export function getStaticUrl() {
export function getUrl2(path, goTest) {
const local = 'http://localhost:3000'
if (isDev) {
return `${local}${path?path:''}`
return `${local}${path ? path : ''}`
}
return `${path ? path: ''}`;
return `${path ? path : ''}`;
}
const newopens ="79e33abd4b6588941ab7622aed1e67e8";
const newopens = "79e33abd4b6588941ab7622aed1e67e8";
let newtimestamp;
let checkSubmitFlgs = false;
function railsgettimess(proxy) {
if(checkSubmitFlgs===false){
$.ajax({url:proxy,
async:false,success:function(data){
if(data.status===0){
newtimestamp=data.message;
if (checkSubmitFlgs === false) {
$.ajax({
url: proxy,
async: false, success: function (data) {
if (data.status === 0) {
newtimestamp = data.message;
checkSubmitFlgs = true;
}
}})
}
})
window.setTimeout(function () {
checkSubmitFlgs=false;
checkSubmitFlgs = false;
}, 2500);
}
}
@ -107,32 +97,32 @@ export function getmyUrl(geturl) {
export function getUploadActionUrl(path, goTest) {
Railsgettimes()
let anewopens=md5(newopens+newtimestamp);
let anewopens = md5(newopens + newtimestamp);
return `${getUrl()}/api/attachments.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`;
}
export function getUploadActionUrltwo(id) {
Railsgettimes()
let anewopens=md5(newopens+newtimestamp);
let anewopens = md5(newopens + newtimestamp);
return `${getUrlmys()}/api/shixuns/${id}/upload_data_sets.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`
}
export function getUploadActionUrlthree() {
Railsgettimes()
let anewopens=md5(newopens+newtimestamp);
let anewopens = md5(newopens + newtimestamp);
return `${getUrlmys()}/api/jupyters/import_with_tpm.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`
}
export function getUploadActionUrlOfAuth(id) {
Railsgettimes()
let anewopens=md5(newopens+newtimestamp);
let anewopens = md5(newopens + newtimestamp);
return `${getUrl()}/api/users/accounts/${id}/auth_attachment.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`
}
export function getRandomNumber(type) {
Railsgettimes()
let anewopens=md5(newopens+newtimestamp);
return type===true?`randomcode=${newtimestamp}&client_key=${anewopens}`:`?randomcode=${newtimestamp}&client_key=${anewopens}`
let anewopens = md5(newopens + newtimestamp);
return type === true ? `randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`
}
export function test(path) {
@ -150,11 +140,11 @@ export function getTaskUrlById(id) {
export function getRandomcode(url) {
Railsgettimes()
let anewopens=md5(newopens+newtimestamp);
let anewopens = md5(newopens + newtimestamp);
if (url.indexOf('?') == -1) {
return `${url}?randomcode=${newtimestamp}&client_key=${anewopens}`
}else {
} else {
return `${url}&randomcode=${newtimestamp}&client_key=${anewopens}`
}
@ -174,14 +164,14 @@ export function htmlEncode(str) {
return s;
}
export function publicSearchs(Placeholder,onSearch,onInputs,onChanges,loadings) {
return(<Search
placeholder= { Placeholder || "请输入内容进行搜索" }
export function publicSearchs(Placeholder, onSearch, onInputs, onChanges, loadings) {
return (<Search
placeholder={Placeholder || "请输入内容进行搜索"}
onSearch={onSearch}
// value={searchValue}
onInput={onInputs}
onChange={onChanges}
loading={loadings||false}
loading={loadings || false}
allowClear={true}
></Search>)
}

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { Modal } from 'antd';
export function SetAppModel(options={}) {
export default function SetAppModel(options = {}) {
return function wrap(WrappedComponent) {
return class Wrapper extends Component {
constructor(props) {
@ -10,14 +10,14 @@ export function SetAppModel(options={}) {
}
}
modalCancel=()=>{
modalCancel = () => {
window.location.href = "/";
}
setDownload=()=>{
window.location.href ='/account/profile';
setDownload = () => {
window.location.href = '/account/profile';
}
componentDidMount(){
componentDidMount() {
console.log(this.props)
}
@ -38,8 +38,8 @@ export function SetAppModel(options={}) {
<div className={"tabeltext-alignleft mt10"}><p>您尚未完善个人资料</p></div>
<div className={"tabeltext-alignleft mt10"}><p>请在完成资料后提交试用申请</p></div>
<div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30" onClick={()=>this.modalCancel()}>取消</a>
<a className="task-btn task-btn-orange" onClick={()=>this.setDownload()}>立即完善资料</a>
<a className="task-btn mr30" onClick={() => this.modalCancel()}>取消</a>
<a className="task-btn task-btn-orange" onClick={() => this.setDownload()}>立即完善资料</a>
</div>
</div>
</Modal>

@ -4,7 +4,7 @@ export {
, getTaskUrlById as getTaskUrlById, TEST_HOST, htmlEncode as htmlEncode
} from './UrlTool';
export { setmiyah as setmiyah } from './Component';
export { default as setmiyah } from './Component';
export { default as queryString } from './UrlTool2';
export { default as SnackbarHOC } from './SnackbarHOC';
@ -44,7 +44,7 @@ export { themes, ThemeContext } from './context/ThemeContext'
export { default as ModalHOC } from './components/ModalHOC'
export { SetAppModel } from './components/SetAppModel'
export { default as SetAppModel } from './components/SetAppModel'
export { default as LinkAfterLogin } from './components/LinkAfterLogin'
export { default as Cropper } from './components/Cropper'
@ -58,19 +58,12 @@ export { default as City } from './components/form/City'
// course
export { default as WordsBtn } from './course/WordsBtn'
export { default as ActionBtn } from './course/ActionBtn'
export { default as MarkdownToHtml } from './components/markdown/MarkdownToHtml'
export { default as DMDEditor } from './components/markdown/DMDEditor'
export { default as Clappr } from './components/media/Clappr'
export { default as AliyunUploader } from './components/media/AliyunUploader'
export { default as ImageLayer2 } from './hooks/ImageLayer2'
// 外部
export { default as CBreadcrumb } from '../modules/courses/common/CBreadcrumb'
export { default as CNotificationHOC } from '../modules/courses/common/CNotificationHOC'

@ -1,5 +1,5 @@
import React, { Fragment } from 'react';
import { getUploadActionUrl, getUrl } from 'educoder';
import { getUploadActionUrl, getUrl, setmiyah } from 'educoder';
import TPMMDEditor from '../modules/tpm/challengesnew/TPMMDEditor';
import moment from 'moment'
@ -118,6 +118,7 @@ export default () => {
return (
<Fragment >
<p>{getUrl()}</p>
<p>{setmiyah()}</p>
<p>{getUploadActionUrl()}</p>
<TPMMDEditor />
</Fragment>

@ -1,11 +1,9 @@
import React, {Component} from 'react';
import {Link} from "react-router-dom";
import React, { Component } from 'react';
import axios from 'axios';
import { Input , Spin, Icon ,Button,Pagination,DatePicker} from 'antd';
import { handleDateString,getUrl,setmiyah} from 'educoder';
import { Input, Spin, Icon, Button, Pagination, DatePicker } from 'antd';
import { handleDateString, getUrl, setmiyah } from 'educoder';
import locale from 'antd/lib/date-picker/locale/zh_CN';
import MDEditors from '../MDEditors';
import PhoneModel from './PhoneModel';
import moment from 'moment';
import '../packageconcnet.css';
const { Search } = Input;
@ -22,9 +20,9 @@ if (!window.postUpMsg) {
}
function checkPhone(phone){
function checkPhone(phone) {
if(!(/^1[3456789]\d{9}$/.test(phone))){
if (!(/^1[3456789]\d{9}$/.test(phone))) {
// alert("手机号码有误,请重填");
return false;
}
@ -54,62 +52,62 @@ class PackageIndexNEIBannerConcent extends Component {
super(props)
this.contentMdRef = React.createRef();
this.state = {
modalCancel:false,
getverificationcodes:true,
seconds:60,
springtype:false,
category:undefined,
title:undefined,
content:undefined,
attachment_ids:undefined,
deadline_at:undefined,
min_price:undefined,
max_price:undefined,
contact_name:undefined,
contact_phone:undefined,
code:undefined,
publish:false,
categories:[]
modalCancel: false,
getverificationcodes: true,
seconds: 60,
springtype: false,
category: undefined,
title: undefined,
content: undefined,
attachment_ids: undefined,
deadline_at: undefined,
min_price: undefined,
max_price: undefined,
contact_name: undefined,
contact_phone: undefined,
code: undefined,
publish: false,
categories: []
}
}
componentDidMount() {
window.document.title = '众包创新'
if(this.props.match.params.id!=undefined){
if (this.props.match.params.id != undefined) {
let url=`/project_packages/${this.props.match.params.id}.json`
let url = `/project_packages/${this.props.match.params.id}.json`
axios.get((url)).then((response) => {
let data=response.data
let data = response.data
this.setState({
category:data.category_id,
title:data.title,
content:data.content,
deadline_at:moment(data.deadline_at),
min_price:data.min_price,
max_price:data.max_price,
contact_name:data.contact_name==null||data.contact_name==undefined?this.props.current_user.real_name:data.contact_name,
phones:data.contact_phone,
attachments:data.attachments,
category: data.category_id,
title: data.title,
content: data.content,
deadline_at: moment(data.deadline_at),
min_price: data.min_price,
max_price: data.max_price,
contact_name: data.contact_name == null || data.contact_name == undefined ? this.props.current_user.real_name : data.contact_name,
phones: data.contact_phone,
attachments: data.attachments,
})
}).catch((error) => {
console.log(error);
})
}else{
console.log(this.props.current_user&&this.props.current_user.real_name)
} else {
console.log(this.props.current_user && this.props.current_user.real_name)
}
let Url = `/project_package_categories.json`;
axios.get(Url).then((response) => {
// console.log(response)
if(response.data.status===-1){
if (response.data.status === -1) {
}else{
} else {
this.setState({
categories:response.data.categories
categories: response.data.categories
})
}
@ -118,7 +116,7 @@ class PackageIndexNEIBannerConcent extends Component {
})
this.setState({
contact_name:this.props.current_user&&this.props.current_user.real_name
contact_name: this.props.current_user && this.props.current_user.real_name
})
// this.contentMdRef.current.setValue("测试赋值")
@ -126,22 +124,22 @@ class PackageIndexNEIBannerConcent extends Component {
componentDidUpdate = (prevProps) => {
if(prevProps.current_user!=this.props.current_user){
if(this.props.current_user!=undefined){
if (prevProps.current_user != this.props.current_user) {
if (this.props.current_user != undefined) {
this.setState({
contact_name:this.props.current_user.real_name
contact_name: this.props.current_user.real_name
})
}
}
}
//获取验证码;
getverificationcode =()=>{
getverificationcode = () => {
// if (this.state.logins&&this.state.logins.length === 0) {
// // 判断没有输入手机号
// return
// }
if(this.state.getverificationcodes === undefined){
if (this.state.getverificationcodes === undefined) {
console.log("undefined");
return;
}
@ -188,22 +186,22 @@ class PackageIndexNEIBannerConcent extends Component {
}
//短信验证
SMSverification = () => {
let {contact_phone,code}=this.state;
let { contact_phone, code } = this.state;
var url = `/accounts/get_verification_code.json`;
axios.get((url), {
params: {
login: contact_phone,
type: 5,
smscode:setmiyah(contact_phone)
smscode: setmiyah(contact_phone)
}
}).then((result) => {
//验证有问题{"status":1,"message":"success"}
// console.log(result);
// this.openNotification("验证码已发送,请注意查收");
if(result.data.status===1){
if (result.data.status === 1) {
this.openNotification("验证码已发送,请注意查收");
}else if(result.data.status===-2){
} else if (result.data.status === -2) {
this.openNotification(result.data.message);
}
}).catch((error) => {
@ -214,27 +212,27 @@ class PackageIndexNEIBannerConcent extends Component {
onChangeTimePicker = (value, dateString) => {
if(value===null){
if (value === null) {
this.setState({
deadline_at:""
deadline_at: ""
})
}else{
if(moment(handleDateString(dateString))===undefined||moment(handleDateString(dateString))===null||moment(handleDateString(dateString))===""){
} else {
if (moment(handleDateString(dateString)) === undefined || moment(handleDateString(dateString)) === null || moment(handleDateString(dateString)) === "") {
this.setState({
deadline_attypes:true
deadline_attypes: true
})
}else{
} else {
this.setState({
deadline_attypes:false
deadline_attypes: false
})
}
if(moment(handleDateString(dateString))<moment(new Date())){
if (moment(handleDateString(dateString)) < moment(new Date())) {
this.setState({
deadline_attypexy:true
deadline_attypexy: true
})
}else{
} else {
this.setState({
deadline_attypexy:false
deadline_attypexy: false
})
}
@ -246,21 +244,21 @@ class PackageIndexNEIBannerConcent extends Component {
}
setcheckoutcontent=()=>{
setcheckoutcontent = () => {
const content = this.contentMdRef.current.getValue().trim();
if(content===undefined||content===null||content===""){
if (content === undefined || content === null || content === "") {
this.setState({
contenttypes:true
contenttypes: true
})
}else{
} else {
this.setState({
contenttypes:false
contenttypes: false
})
}
}
setcheckout=(min_price,max_price)=>{
setcheckout = (min_price, max_price) => {
// if(min_price===undefined){
// this.setState({
// min_pricetype:true
@ -295,24 +293,24 @@ class PackageIndexNEIBannerConcent extends Component {
// })
// }
if(parseInt(min_price)<=0){
if (parseInt(min_price) <= 0) {
this.setState({
smallstype:true
smallstype: true
})
}else{
} else {
this.setState({
smallstype:false
smallstype: false
})
}
if(parseInt(max_price)<parseInt(min_price)){
if (parseInt(max_price) < parseInt(min_price)) {
this.setState({
minmaxtype:true
minmaxtype: true
})
}else{
} else {
this.setState({
minmaxtype:false
minmaxtype: false
})
}
@ -320,52 +318,52 @@ class PackageIndexNEIBannerConcent extends Component {
setPublication=(type)=>{
setPublication = (type) => {
const content = this.contentMdRef.current.getValue().trim();
// console.log(content)
// console.log(this.state.deadline_at._i)
this.setState({
publish:type
publish: type
})
let types=type;
let {category,title,attachment_ids,deadline_at,min_price,max_price,contact_name,contact_phone,code,modalCancel}=this.state;
let types = type;
let { category, title, attachment_ids, deadline_at, min_price, max_price, contact_name, contact_phone, code, modalCancel } = this.state;
if(category===undefined||category===null||category===""){
if (category === undefined || category === null || category === "") {
this.setState({
categorytypes:true
categorytypes: true
})
this.scrollToAnchor("publishtimestart");
return
}
if(title===undefined||title===null||title===""){
if (title === undefined || title === null || title === "") {
this.setState({
titletypes:true
titletypes: true
})
this.scrollToAnchor("publishtimestart");
return
}
if(content===undefined||content===null||content===""){
if (content === undefined || content === null || content === "") {
this.setState({
contenttypes:true
contenttypes: true
})
this.scrollToAnchor("publishtimestart");
return
}
if(deadline_at===undefined||deadline_at===null||deadline_at===""){
if (deadline_at === undefined || deadline_at === null || deadline_at === "") {
this.setState({
deadline_attypes:true
deadline_attypes: true
})
this.scrollToAnchor("publishtime");
return
}
if(moment(deadline_at)<moment(new Date())){
if (moment(deadline_at) < moment(new Date())) {
this.setState({
deadline_attypexy:true
deadline_attypexy: true
})
return
}
@ -394,24 +392,24 @@ class PackageIndexNEIBannerConcent extends Component {
// return
// }
if(parseInt(min_price)<=0){
if (parseInt(min_price) <= 0) {
this.setState({
smallstype:true
smallstype: true
})
return
}
if(parseInt(max_price)<parseInt(min_price)){
if (parseInt(max_price) < parseInt(min_price)) {
this.setState({
minmaxtype:true
minmaxtype: true
})
return
}
if(contact_name===undefined||contact_name===""||contact_name===null){
if (contact_name === undefined || contact_name === "" || contact_name === null) {
this.setState({
contact_nametype:true
contact_nametype: true
})
return
}
@ -426,33 +424,33 @@ class PackageIndexNEIBannerConcent extends Component {
// }
if(this.props.current_user&&this.props.current_user.phone===null||modalCancel===true){
if(contact_phone===undefined||contact_phone===null||contact_phone===""){
if (this.props.current_user && this.props.current_user.phone === null || modalCancel === true) {
if (contact_phone === undefined || contact_phone === null || contact_phone === "") {
this.setState({
contact_phonetype:true
contact_phonetype: true
})
return
}
if(checkPhone(contact_phone)===false){
if (checkPhone(contact_phone) === false) {
this.setState({
contact_phonetypes:true
contact_phonetypes: true
})
return
}
if(code===undefined||code===""||code===null){
if (code === undefined || code === "" || code === null) {
this.setState({
codeypes:true
codeypes: true
})
return
}
}
this.setState({
springtype:true
springtype: true
})
if(this.props.match.params.id===undefined){
if (this.props.match.params.id === undefined) {
const url = `/project_packages.json`;
axios.post(url, {
@ -460,44 +458,44 @@ class PackageIndexNEIBannerConcent extends Component {
title: title,
content: content,
attachment_ids: attachment_ids,
deadline_at:deadline_at._i,
min_price:parseInt(min_price),
max_price:parseInt(max_price),
contact_name: contact_name===null||contact_name===undefined?this.props.current_user.real_name:contact_name,
contact_phone: contact_phone===undefined?this.props.current_user&&this.props.current_user.phone:contact_phone,
code:code,
publish:types
deadline_at: deadline_at._i,
min_price: parseInt(min_price),
max_price: parseInt(max_price),
contact_name: contact_name === null || contact_name === undefined ? this.props.current_user.real_name : contact_name,
contact_phone: contact_phone === undefined ? this.props.current_user && this.props.current_user.phone : contact_phone,
code: code,
publish: types
}
).then((response) => {
if(response.data.status===0){
if(type===true){
if (response.data.status === 0) {
if (type === true) {
this.props.setPublicationfun(response.data.id)
}else{
window.location.href="/crowdsourcing/"+response.data.id
} else {
window.location.href = "/crowdsourcing/" + response.data.id
}
this.setState({
springtype:false
springtype: false
})
}else if(response.data.status===-1){
if(response.data.message==="无效的验证码"){
} else if (response.data.status === -1) {
if (response.data.message === "无效的验证码") {
this.setState({
codeypesno:true,
springtype:false
codeypesno: true,
springtype: false
})
}
}
this.setState({
springtype:false
springtype: false
})
}).catch((error) => {
console.log(error)
this.setState({
springtype:false
springtype: false
})
})
}else{
} else {
// edit
@ -508,39 +506,39 @@ class PackageIndexNEIBannerConcent extends Component {
title: title,
content: content,
attachment_ids: attachment_ids,
deadline_at:deadline_at._i,
min_price:parseInt(min_price),
max_price:parseInt(max_price),
contact_name: contact_name===null||contact_name===undefined?this.props.current_user.real_name:contact_name,
contact_phone: contact_phone===undefined?this.props.current_user&&this.props.current_user.phone:contact_phone,
code:code,
publish:types
deadline_at: deadline_at._i,
min_price: parseInt(min_price),
max_price: parseInt(max_price),
contact_name: contact_name === null || contact_name === undefined ? this.props.current_user.real_name : contact_name,
contact_phone: contact_phone === undefined ? this.props.current_user && this.props.current_user.phone : contact_phone,
code: code,
publish: types
}
).then((response) => {
if(response.data.status===0){
if(type===true){
if (response.data.status === 0) {
if (type === true) {
this.props.setPublicationfun(response.data.id)
}else{
window.location.href="/crowdsourcing/"+response.data.id
} else {
window.location.href = "/crowdsourcing/" + response.data.id
}
this.setState({
springtype:false
springtype: false
})
}else if(response.data.status===-1){
if(response.data.message==="无效的验证码"){
} else if (response.data.status === -1) {
if (response.data.message === "无效的验证码") {
this.setState({
codeypesno:true,
springtype:false
codeypesno: true,
springtype: false
})
}
}
this.setState({
springtype:false
springtype: false
})
}).catch((error) => {
console.log(error)
this.setState({
springtype:false
springtype: false
})
})
@ -551,92 +549,92 @@ class PackageIndexNEIBannerConcent extends Component {
}
modalCancel=()=>{
modalCancel = () => {
this.setState({
modalCancel:false,
contact_phone:undefined,
code:undefined,
modalCancel: false,
contact_phone: undefined,
code: undefined,
})
}
editmodels=()=>{
editmodels = () => {
this.setState({
modalCancel:true
modalCancel: true
})
}
setcategory=(value)=>{
if(value===undefined||value===null||value===""){
setcategory = (value) => {
if (value === undefined || value === null || value === "") {
this.setState({
categorytypes:true
categorytypes: true
})
}else{
} else {
this.setState({
categorytypes:false
categorytypes: false
})
}
this.setState({
category:value
category: value
})
}
settitlefun=(e)=>{
settitlefun = (e) => {
if(e.target.value===undefined||e.target.value===null||e.target.value===""){
if (e.target.value === undefined || e.target.value === null || e.target.value === "") {
this.setState({
titletypes:true
titletypes: true
})
}else{
} else {
this.setState({
titletypes:false
titletypes: false
})
}
this.setState({
title:e.target.value
title: e.target.value
})
}
onChangemin_prices=(e)=>{
let{max_price}=this.state;
onChangemin_prices = (e) => {
let { max_price } = this.state;
this.setState({
min_price:e.target.value
min_price: e.target.value
})
this.setcheckout(e.target.value,max_price)
this.setcheckout(e.target.value, max_price)
}
onChangemax_prices=(e)=>{
let{min_price}=this.state;
onChangemax_prices = (e) => {
let { min_price } = this.state;
this.setState({
max_price:e.target.value
max_price: e.target.value
})
this.setcheckout(min_price,e.target.value)
this.setcheckout(min_price, e.target.value)
}
onChangeContact_name=(e)=>{
onChangeContact_name = (e) => {
if(e.target.value===undefined||e.target.value===""||e.target.value===null){
if (e.target.value === undefined || e.target.value === "" || e.target.value === null) {
this.setState({
contact_nametype:true
contact_nametype: true
})
}else{
} else {
this.setState({
contact_nametype:false
contact_nametype: false
})
}
this.setState({
contact_name:e.target.value
contact_name: e.target.value
})
}
onChangeContact_phone=(e)=>{
let {modalCancel}=this.state;
onChangeContact_phone = (e) => {
let { modalCancel } = this.state;
// if(modalCancel===false){
// if(this.props.current_user.phone===undefined||this.props.current_user.phone===null||this.props.current_user.phone===""){
// this.setState({
@ -648,46 +646,46 @@ class PackageIndexNEIBannerConcent extends Component {
// })
// }
// }
if(this.props.current_user&&this.props.current_user.phone===null||modalCancel===true){
if(e.target.value===undefined||e.target.value===null||e.target.value===""){
if (this.props.current_user && this.props.current_user.phone === null || modalCancel === true) {
if (e.target.value === undefined || e.target.value === null || e.target.value === "") {
this.setState({
contact_phonetype:true
contact_phonetype: true
})
}else{
} else {
this.setState({
contact_phonetype:false
contact_phonetype: false
})
}
if(checkPhone(e.target.value)===false){
if (checkPhone(e.target.value) === false) {
this.setState({
contact_phonetypes:true
contact_phonetypes: true
})
}else{
} else {
this.setState({
contact_phonetypes:false
contact_phonetypes: false
})
}
}
this.setState({
contact_phone:e.target.value
contact_phone: e.target.value
})
}
onChangeCode=(e)=>{
if(e.target.value===undefined||e.target.value===""||e.target.value===null){
onChangeCode = (e) => {
if (e.target.value === undefined || e.target.value === "" || e.target.value === null) {
this.setState({
codeypes:true
codeypes: true
})
}else{
} else {
this.setState({
codeypes:false
codeypes: false
})
}
this.setState({
code:e.target.value
code: e.target.value
})
}
@ -697,21 +695,21 @@ class PackageIndexNEIBannerConcent extends Component {
// 找到锚点
let anchorElement = document.getElementById(anchorName);
// 如果对应id的锚点存在就跳转到锚点
if(anchorElement) { anchorElement.scrollIntoView(); }
if (anchorElement) { anchorElement.scrollIntoView(); }
}
}
render() {
let {modalCancel,seconds,getverificationcodes,attachments,
category,title}=this.state;
let categorylist=[
{name:"前端开发",value:"front"},
{name:"后端开发",value:"backend"},
{name:"移动开发",value:"mobile"},
{name:"数据库",value:"database"},
{name:"云计算和大数据",value:"cloud_compute_and_big_data"},
{name:"人工智能",value:"ai"},
{name:"其他",value:"other"},
let { modalCancel, seconds, getverificationcodes, attachments,
category, title } = this.state;
let categorylist = [
{ name: "前端开发", value: "front" },
{ name: "后端开发", value: "backend" },
{ name: "移动开发", value: "mobile" },
{ name: "数据库", value: "database" },
{ name: "云计算和大数据", value: "cloud_compute_and_big_data" },
{ name: "人工智能", value: "ai" },
{ name: "其他", value: "other" },
]
@ -733,27 +731,27 @@ class PackageIndexNEIBannerConcent extends Component {
<p className="clearfix mb20 shaiContent" >
<div className="fl pr shaiAllItem pagetype">
{this.state.categories.map((item,key)=>{
return(
<li key={key} className={category===item.id?"shaiItem shixun_repertoire active borderccc":"shaiItem shixun_repertoire borderccc"} value={item.id} onClick={()=>this.setcategory(item.id)}>{item.name}</li>
{this.state.categories.map((item, key) => {
return (
<li key={key} className={category === item.id ? "shaiItem shixun_repertoire active borderccc" : "shaiItem shixun_repertoire borderccc"} value={item.id} onClick={() => this.setcategory(item.id)}>{item.name}</li>
)
})}
</div>
</p>
{this.state.categorytypes===true?<div className={"color-red mb10"}>请选择类型</div>:""}
{this.state.categorytypes === true ? <div className={"color-red mb10"}>请选择类型</div> : ""}
<div className="ant-form-item-label mb15">
<label htmlFor="coursesNew_description" className="ant-form-item-requireds font-16" >需求标题和详情</label>
</div>
<Input placeholder="请输入需求标题示例美食类APP开发最大限制60个字符" maxLength="60" className="input-100-40s mt5 fafafas"
value={title} onInput={this.settitlefun}/>
{this.state.titletypes===true?<div className={"color-red mt10"}>不能为空</div>:""}
value={title} onInput={this.settitlefun} />
{this.state.titletypes === true ? <div className={"color-red mt10"}>不能为空</div> : ""}
<MDEditors ref={this.contentMdRef} placeholder="请填写清晰完整的需求内容" mdID={'courseContentMD'} refreshTimeout={1500}
watch={false} className="courseMessageMD" initValue={this.state.content} setcheckoutcontent={()=>this.setcheckoutcontent()}></MDEditors>
watch={false} className="courseMessageMD" initValue={this.state.content} setcheckoutcontent={() => this.setcheckoutcontent()}></MDEditors>
{/* 请求status 422 */}
{this.state.contenttypes===true?<div className={"color-red"}>不能为空</div>:""}
{this.state.contenttypes === true ? <div className={"color-red"}>不能为空</div> : ""}
{/*<div className="df uploadBtn">*/}
{/*<a href="javascript:void(0);" className="fl" onClick={() => window.$('#_file').click()}*/}
{/*data-tip-down="请选择文件上传">*/}
@ -801,7 +799,7 @@ class PackageIndexNEIBannerConcent extends Component {
</div>
</div>
<div className={"stud-class-set padding30 coursenavbox edu-back-white"} style={{borderTop: '1px solid #EAEAEA'}} id={"publishtime"}>
<div className={"stud-class-set padding30 coursenavbox edu-back-white"} style={{ borderTop: '1px solid #EAEAEA' }} id={"publishtime"}>
<div className={"ant-row contentbox mdInForm "}>
<div className="ant-form-item-label mb10">
<label htmlFor="coursesNew_description" className="ant-form-item-requireds font-16">工期与预算</label>
@ -812,7 +810,7 @@ class PackageIndexNEIBannerConcent extends Component {
showToday={false}
showTime={{ format: 'HH:mm' }}
locale={locale}
style={{"width": "260px"}}
style={{ "width": "260px" }}
format="YYYY-MM-DD HH:mm"
placeholder="请选择任务的竞标截止日期"
className={"fafas"}
@ -823,18 +821,18 @@ class PackageIndexNEIBannerConcent extends Component {
onChange={this.onChangeTimePicker}
/>
{this.state.deadline_attypes===true?<div className={"color-red ml100"}>不能为空</div>:""}
{this.state.deadline_attypes === true ? <div className={"color-red ml100"}>不能为空</div> : ""}
{this.state.deadline_attypexy===true?<div className={"color-red ml100"}>不能早于当前时间</div>:""}
{this.state.deadline_attypexy === true ? <div className={"color-red ml100"}>不能早于当前时间</div> : ""}
</p>
<p className="clearfix mb20 shaiContent">
<span className="shaiTitle fl mt5 ml10">支付费用</span>
<Input
className={"fafas"}
style={{"width": "260px"}}
style={{ "width": "260px" }}
value={this.state.min_price}
placeholder="支付多少费用(最低)"
onInput={(e)=>this.onChangemin_prices(e)}
onInput={(e) => this.onChangemin_prices(e)}
suffix={
<span >¥</span>
}
@ -842,17 +840,17 @@ class PackageIndexNEIBannerConcent extends Component {
<span className={"ml10 mr10"}></span>
<Input
className={"fafas"}
style={{"width": "260px"}}
style={{ "width": "260px" }}
value={this.state.max_price}
placeholder="支付多少费用(最高)"
onInput={(e)=>this.onChangemax_prices(e)}
onInput={(e) => this.onChangemax_prices(e)}
suffix={
<span>¥</span>
}
/><span className={"pagenoedits"}></span>
{this.state.min_pricetype===true?<div className={"color-red ml100"}>不能为空</div>:""}
{this.state.smallstype===true?<div className={"color-red ml100"}>不能小于零</div>:""}
{this.state.minmaxtype===true?<div className={"color-red ml100"}>最高费用不能小于最低费用</div>:""}
{this.state.min_pricetype === true ? <div className={"color-red ml100"}>不能为空</div> : ""}
{this.state.smallstype === true ? <div className={"color-red ml100"}>不能小于零</div> : ""}
{this.state.minmaxtype === true ? <div className={"color-red ml100"}>最高费用不能小于最低费用</div> : ""}
</p>
<div className="ant-form-item-label mb10">
<label htmlFor="coursesNew_description" className="ant-form-item-requireds font-16" >联系方式</label>
@ -861,29 +859,29 @@ class PackageIndexNEIBannerConcent extends Component {
<span className="shaiTitle fl mt5 ml40">姓名</span>
<Input
className={"fafafas"}
style={{"width": "260px"}}
value={this.state.contact_name===null||this.state.contact_name===undefined?this.props.current_user&&this.props.current_user.real_name:this.state.contact_name}
style={{ "width": "260px" }}
value={this.state.contact_name === null || this.state.contact_name === undefined ? this.props.current_user && this.props.current_user.real_name : this.state.contact_name}
placeholder="请输入姓名"
onInput={(e)=>this.onChangeContact_name(e)}
onInput={(e) => this.onChangeContact_name(e)}
/>
{this.state.contact_nametype===true?<div className={"color-red ml100"}>不能为空</div>:""}
{this.state.contact_nametype === true ? <div className={"color-red ml100"}>不能为空</div> : ""}
</p>
{this.props.current_user&&this.props.current_user.phone!=null&&modalCancel===false?<p className="clearfix mb20 shaiContent">
{this.props.current_user && this.props.current_user.phone != null && modalCancel === false ? <p className="clearfix mb20 shaiContent">
<span className="shaiTitle fl mt5 ml25">手机号</span>
<Input
className={"fafafas fl"}
style={{"width": "260px"}}
value={this.state.phones===undefined?this.props.current_user&&this.props.current_user.phone:this.state.phones}
style={{ "width": "260px" }}
value={this.state.phones === undefined ? this.props.current_user && this.props.current_user.phone : this.state.phones}
placeholder="请输入手机号"
disabled={true}
/>
<a className="fl ml20 mt10">
<i className="iconfont icon-bianjidaibeijing font-20 color-blue" onClick={()=>this.editmodels()}></i>
<i className="iconfont icon-bianjidaibeijing font-20 color-blue" onClick={() => this.editmodels()}></i>
</a>
</p>:""}
</p> : ""}
{/*{this.state.current_userphonetype===true?<div className={"color-red ml100"}>不能为空</div>:""}*/}
{this.props.current_user&&this.props.current_user.phone===null||modalCancel===true?<p className="clearfix mb20 shaiContent">
{this.props.current_user && this.props.current_user.phone === null || modalCancel === true ? <p className="clearfix mb20 shaiContent">
<span className="shaiTitle mt5 fl">
<span className="shaiTitle fl mt5 ml25">
{/*未注册才显示!*/}
@ -891,13 +889,13 @@ class PackageIndexNEIBannerConcent extends Component {
手机号</span>
<Input
className={"fafafas fl"}
style={{"width": "260px"}}
style={{ "width": "260px" }}
value={this.state.contact_phone}
placeholder="请输入手机号码"
onInput={(e)=>this.onChangeContact_phone(e)}
onInput={(e) => this.onChangeContact_phone(e)}
/>
{this.state.contact_phonetype===true?<div className={"color-red ml100"}>不能为空</div>:""}
{this.state.contact_phonetypes===true?<div className={"color-red ml100"}>请输入正确的手机号</div>:""}
{this.state.contact_phonetype === true ? <div className={"color-red ml100"}>不能为空</div> : ""}
{this.state.contact_phonetypes === true ? <div className={"color-red ml100"}>请输入正确的手机号</div> : ""}
</span>
<span className="shaiTitle mt5 ml17 fl">
@ -908,21 +906,21 @@ class PackageIndexNEIBannerConcent extends Component {
className="fafas"
placeholder="请输入验证码"
enterButton={
getverificationcodes === undefined ? <span>重新发送 ({seconds}s)</span>: getverificationcodes === true ?<span ></span> :<span ></span>}
onSearch={()=>this.getverificationcode()}
onInput={(e)=>this.onChangeCode(e)}
getverificationcodes === undefined ? <span>重新发送 ({seconds}s)</span> : getverificationcodes === true ? <span ></span> : <span ></span>}
onSearch={() => this.getverificationcode()}
onInput={(e) => this.onChangeCode(e)}
/>
{this.state.codeypes===true?<div className={"color-red"}>验证码不能为空</div>:""}
{this.state.codeypesno===true?<div className={"color-red"}>验证码不正确</div>:""}
{this.state.codeypes === true ? <div className={"color-red"}>验证码不能为空</div> : ""}
{this.state.codeypesno === true ? <div className={"color-red"}>验证码不正确</div> : ""}
</span>
<span>
{/*<Button type="primary" className="defalutSubmitbtn ml10 defalutSubmitbtnmodels">重新发送()</Button>*/}
</span>
</span>
<a className="fl mt8 mt15">
<span className="font-18 color-blue" onClick={()=>this.modalCancel()}>X</span>
<span className="font-18 color-blue" onClick={() => this.modalCancel()}>X</span>
</a>
</p>:""}
</p> : ""}
</div>
@ -930,8 +928,8 @@ class PackageIndexNEIBannerConcent extends Component {
</p>
<div className="clearfix mt30 mb30">
<Button type="primary" className="defalutSubmitbtn fl mr20 defalutSubmitbtns" onClick={()=>this.setPublication(true)}>申请发布</Button>
<a className="defalutCancelbtns fl" onClick={()=>this.setPublication(false)}>保存</ a>
<Button type="primary" className="defalutSubmitbtn fl mr20 defalutSubmitbtns" onClick={() => this.setPublication(true)}>申请发布</Button>
<a className="defalutCancelbtns fl" onClick={() => this.setPublication(false)}>保存</ a>
</div>
</Spin>
</div>

@ -1,44 +1,38 @@
import React, {Component} from 'react';
import React, { Component } from 'react';
import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd';
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
import { Link } from "react-router-dom";
import axios from 'axios';
import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
import {getUrl} from 'educoder';
export default class TPMUpdatepropaede extends Component {
constructor(props) {
super(props)
this.neweditanswerRef=React.createRef();
this.neweditanswerRef = React.createRef();
this.state = {
shixunId:undefined,
shixunId: undefined,
}
}
componentDidMount() {
let id = this.props.match.params.shixunId;
let url="/shixuns/"+id+"/propaedeutics.json";
let url = "/shixuns/" + id + "/propaedeutics.json";
axios.get(url).then((response) => {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) {
}else{
} else {
this.setState({
shixunId:id,
shixunId: id,
})
if(response.data.content[0]!=null){
if (response.data.content[0] != null) {
this.setState({
editanswersRefval:response.data.content,
editanswersRefval: response.data.content,
})
this.neweditanswerRef.current.setValue(response.data.content)
}else{
} else {
this.setState({
editanswersRefval:"",
editanswersRefval: "",
})
this.neweditanswerRef.current.setValue('')
}
@ -49,21 +43,21 @@ export default class TPMUpdatepropaede extends Component {
}
updatepropaedeuticsvalue=()=>{
updatepropaedeuticsvalue = () => {
let id = this.props.match.params.shixunId;
let {shixunId} = this.state;
let url="/shixuns/"+id+"/update_propaedeutics.json";
let { shixunId } = this.state;
let url = "/shixuns/" + id + "/update_propaedeutics.json";
const update_propaedeuticsvalue = this.neweditanswerRef.current.getValue().trim();
axios.post(url,{
content:update_propaedeuticsvalue
axios.post(url, {
content: update_propaedeuticsvalue
}
).then((response) => {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) {
}else{
} else {
this.props.showNotification(response.data.message);
if(response.data.status===1){
this.props.history.replace("/shixuns/"+shixunId+"/propaedeutics");
if (response.data.status === 1) {
this.props.history.replace("/shixuns/" + shixunId + "/propaedeutics");
}
}
}).catch((error) => {
@ -71,7 +65,7 @@ export default class TPMUpdatepropaede extends Component {
});
}
render() {
let {shixunId} = this.state;
let { shixunId } = this.state;
return (
<React.Fragment>
<div className="educontent">
@ -79,7 +73,7 @@ export default class TPMUpdatepropaede extends Component {
<div className="edu-back-white mt30">
<div className="font-16 pt20 pl20 pr20 pb20 bor-bottom-greyE clearfix">
<span className="fl">背景知识</span>
<Link to={"/shixuns/"+shixunId+"/propaedeutics"}className="color-grey-9 fr">返回</Link>
<Link to={"/shixuns/" + shixunId + "/propaedeutics"} className="color-grey-9 fr">返回</Link>
</div>
<div className="padding40-20">
@ -91,7 +85,7 @@ export default class TPMUpdatepropaede extends Component {
<div className="clearfix mb30 mt30">
<a className="defalutSubmitbtn fl mr20"
onClick={this.updatepropaedeuticsvalue}>保存</a>
<Link to={"/shixuns/"+shixunId+"/propaedeutics"} className="defalutCancelbtn fl"
<Link to={"/shixuns/" + shixunId + "/propaedeutics"} className="defalutCancelbtn fl"
>取消</Link>
</div>

@ -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, Upload, Button, notification, Tooltip } from 'antd';
import { Input, Select, Radio, Checkbox, Modal, Icon, DatePicker, Breadcrumb, Upload, Button, notification, Tooltip } from 'antd';
// import "antd/dist/antd.css";
@ -15,9 +15,8 @@ import axios from 'axios';
import './css/TPMsettings.css';
import { getImageUrl, toPath, getUrl, getUploadActionUrl } from 'educoder';
import { getImageUrl, getUrl, getUploadActionUrl } from 'educoder';
let origin = getUrl();
let path = getUrl("/editormd/lib/")

@ -4,11 +4,8 @@ import '../../courses/css/Courses.css'
import './css/TPMchallengesnew.css';
let path = '/editormd/lib/'
path = getUrl("/editormd/lib/")
const $ = window.$;
// 保存数据
function md_add_data(k, mdu, d) {
window.sessionStorage.setItem(k + mdu, d);
@ -86,7 +83,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV
var editorName = window.editormd(id, {
width: width,
height: high === undefined ? 400 : high,
path: path, // "/editormd/lib/"
path: getUrl("/editormd/lib/"), // "/editormd/lib/"
markdown: initValue,
dialogLockScreen: false,

File diff suppressed because it is too large Load Diff

@ -1,10 +1,8 @@
import React, {Component} from 'react';
import React, { Component } from 'react';
import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd';
import { Input, Select, Radio, message } from 'antd';
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
// import "antd/dist/antd.css";
import { Link } from "react-router-dom";
import TPMMDEditor from '../TPMMDEditor';
@ -12,19 +10,13 @@ import axios from 'axios';
import '../css/TPMchallengesnew.css';
import { getImageUrl, toPath } from 'educoder';
import {getUrl} from 'educoder';
import { getImageUrl } from 'educoder';
let origin = getUrl();
import { getUrl } from 'educoder';
let path = getUrl("/editormd/lib/")
const $ = window.$;
let timeout;
let currentValue;
const Option = Select.Option;
@ -33,7 +25,7 @@ const RadioGroup = Radio.Group;
export default class TPMchallengesnew extends Component {
constructor(props) {
super(props)
this.exercisememoMDRef=React.createRef();
this.exercisememoMDRef = React.createRef();
this.state = {
choice_url: undefined,
practice_url: undefined,
@ -41,8 +33,8 @@ export default class TPMchallengesnew extends Component {
task_pass_default: undefined,
submit_url: undefined,
shixunCreatePracticeGroup: 1,
optionsums:[100,200],
activetype:0,
optionsums: [100, 200],
activetype: 0,
setopen: false,
shixunCreatePractice: undefined,
onshixunsmarkvalue: 100,
@ -50,28 +42,28 @@ export default class TPMchallengesnew extends Component {
shixunsskillvaluelist: [],
tab2url: "",
tab3url: "",
prev_challenge:undefined,
next_challenge:undefined,
prev_challenge: undefined,
next_challenge: undefined,
power: false,
shixunCreatePracticetype: false,
shixunsskillvaluelisttype: false,
marktype:false,
editPracticesendtype:false,
CreatePracticesendtype:false,
exec_time:20,
shixunExec_timeType:false
marktype: false,
editPracticesendtype: false,
CreatePracticesendtype: false,
exec_time: 20,
shixunExec_timeType: false
}
}
componentDidMount() {
let id = this.props.match.params.shixunId;
let checkpointId=this.props.match.params.checkpointId;
let checkpointId = this.props.match.params.checkpointId;
let newchoice_url= "/shixuns/"+id+"/challenges/newquestion";
let newpractice_url= "/shixuns/"+id+"/challenges/new";
let newgo_back_url="/shixuns/"+id+"/challenges"
if(checkpointId===undefined){
let newchoice_url = "/shixuns/" + id + "/challenges/newquestion";
let newpractice_url = "/shixuns/" + id + "/challenges/new";
let newgo_back_url = "/shixuns/" + id + "/challenges"
if (checkpointId === undefined) {
//新建模式
let url = "/shixuns/" + id + "/challenges/new.json"
axios.get(url).then((response) => {
@ -82,67 +74,67 @@ export default class TPMchallengesnew extends Component {
position: response.data.position,
task_pass_default: response.data.task_pass_default,
submit_url: response.data.submit_url,
checkpointId:checkpointId,
exercisememoMDRefval:response.data.task_pass_default
checkpointId: checkpointId,
exercisememoMDRefval: response.data.task_pass_default
})
this.exercisememoMDRef.current.setValue(response.data.task_pass_default||'')
this.exercisememoMDRef.current.setValue(response.data.task_pass_default || '')
}).catch((error) => {
console.log(error)
});
}else{
} else {
//编辑模式
let url="/shixuns/"+id+"/challenges/"+checkpointId+".json?tab=0";
let url = "/shixuns/" + id + "/challenges/" + checkpointId + ".json?tab=0";
axios.get(url).then((response) => {
let optionsum;
if(response.data.difficulty===1){
optionsum=[100,200];
}else if(response.data.difficulty===2){
optionsum=[300,400,500,600];
}else if(response.data.difficulty===3){
optionsum=[700,800,900,1000]
}
let newprev_challenge=response.data.prev_challenge;
let next_challenge=response.data.next_challenge;
if (response.data.difficulty === 1) {
optionsum = [100, 200];
} else if (response.data.difficulty === 2) {
optionsum = [300, 400, 500, 600];
} else if (response.data.difficulty === 3) {
optionsum = [700, 800, 900, 1000]
}
let newprev_challenge = response.data.prev_challenge;
let next_challenge = response.data.next_challenge;
if (newprev_challenge != undefined) {
if(newprev_challenge.st===0){
if (newprev_challenge.st === 0) {
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editcheckpoint";
}else{
} else {
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editquestion";
}
}
if (next_challenge != undefined) {
if(next_challenge.st===0){
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editcheckpoint";
}else{
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editquestion";
if (next_challenge.st === 0) {
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id + "/editcheckpoint";
} else {
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id + "/editquestion";
}
}
this.setState({
power: response.data.power,
prev_challenge:newprev_challenge,
next_challenge:next_challenge,
prev_challenge: newprev_challenge,
next_challenge: next_challenge,
choice_url: newchoice_url,
practice_url: newpractice_url,
go_back_url: newgo_back_url,
shixunCreatePractice:response.data.subject,
position:response.data.position,
shixunCreatePracticeGroup:response.data.difficulty,
optionsums:optionsum,
onshixunsmarkvalue:response.data.score,
shixunsskillvaluelist:response.data.tags,
checkpointId:checkpointId,
exec_time:response.data.exec_time,
tab2url: "/shixuns/" + id + "/challenges/"+checkpointId+"/tab=2",
tab3url: "/shixuns/" + id + "/challenges/"+checkpointId+"/tab=3",
exercisememoMDRefval:response.data.task_pass
shixunCreatePractice: response.data.subject,
position: response.data.position,
shixunCreatePracticeGroup: response.data.difficulty,
optionsums: optionsum,
onshixunsmarkvalue: response.data.score,
shixunsskillvaluelist: response.data.tags,
checkpointId: checkpointId,
exec_time: response.data.exec_time,
tab2url: "/shixuns/" + id + "/challenges/" + checkpointId + "/tab=2",
tab3url: "/shixuns/" + id + "/challenges/" + checkpointId + "/tab=3",
exercisememoMDRefval: response.data.task_pass
})
if(response.data.power===false){
if (response.data.power === false) {
this.props.showSnackbar("你没有权限修改");
}
this.exercisememoMDRef.current.setValue(response.data.task_pass||'')
this.exercisememoMDRef.current.setValue(response.data.task_pass || '')
}).catch((error) => {
console.log(error)
});
@ -154,20 +146,20 @@ export default class TPMchallengesnew extends Component {
onshixunCreatePracticeChange = (e) => {
let optionsum;
let onshixunsmark;
if(e.target.value===1){
optionsum=[100,200];
onshixunsmark=100;
}else if(e.target.value===2){
optionsum=[300,400,500,600];
onshixunsmark=300;
}else if(e.target.value===3){
optionsum=[700,800,900,1000]
onshixunsmark=700;
if (e.target.value === 1) {
optionsum = [100, 200];
onshixunsmark = 100;
} else if (e.target.value === 2) {
optionsum = [300, 400, 500, 600];
onshixunsmark = 300;
} else if (e.target.value === 3) {
optionsum = [700, 800, 900, 1000]
onshixunsmark = 700;
}
this.setState({
shixunCreatePracticeGroup: e.target.value,
optionsums:optionsum,
onshixunsmarkvalue:onshixunsmark
optionsums: optionsum,
onshixunsmarkvalue: onshixunsmark
})
}
@ -181,18 +173,18 @@ export default class TPMchallengesnew extends Component {
this.setState({
CreatePracticesendtype:true
CreatePracticesendtype: true
})
if(this.props.status===2){
if (this.props.status === 2) {
this.props.showSnackbar("该实训已经发布不能新建")
this.setState({
CreatePracticesendtype:false
CreatePracticesendtype: false
})
return
}
let {shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvaluelist,exec_time} = this.state;
if (shixunCreatePractice === undefined||shixunCreatePractice=="") {
let { shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvaluelist, exec_time } = this.state;
if (shixunCreatePractice === undefined || shixunCreatePractice == "") {
this.setState({
shixunCreatePracticetype: true
})
@ -202,7 +194,7 @@ export default class TPMchallengesnew extends Component {
}, 1000);
this.setState({
CreatePracticesendtype:false
CreatePracticesendtype: false
})
return
}
@ -210,15 +202,15 @@ export default class TPMchallengesnew extends Component {
if (shixunsskillvaluelist.length === 0) {
this.setState({
shixunsskillvaluelisttype: true,
CreatePracticesendtype:false
CreatePracticesendtype: false
})
this.props.showSnackbar("技能标签为空")
return
}
if(exec_time===null||exec_time===undefined||exec_time===""){
if (exec_time === null || exec_time === undefined || exec_time === "") {
this.setState({
shixunExec_timeType:false
shixunExec_timeType: false
})
return
}
@ -229,19 +221,19 @@ export default class TPMchallengesnew extends Component {
let url = "/shixuns/" + id + "/challenges.json";
axios.post(url, {
identifier:id,
identifier: id,
subject: shixunCreatePractice,
task_pass: exercise_editormdvalue,
difficulty: shixunCreatePracticeGroup,
score: onshixunsmarkvalue,
challenge_tag: shixunsskillvaluelist,
st: 0,
exec_time:exec_time
exec_time: exec_time
}).then((response) => {
if (response.data.status === 1) {
// $("html").animate({ scrollTop: 0 })
//window.location.href=`/shixuns/${id}/challenges/${response.data.challenge_id}/editcheckpoint?tab=2`;
window.location.href=`/shixuns/${id}/challenges/${response.data.challenge_id}/tab=2`;
window.location.href = `/shixuns/${id}/challenges/${response.data.challenge_id}/tab=2`;
// this.setState({
// setopen: true,
// CreatePracticesendtype:false,
@ -273,14 +265,14 @@ export default class TPMchallengesnew extends Component {
clickshixunsskill = () => {
let {shixunsskillvalue, shixunsskillvaluelist} = this.state;
let { shixunsskillvalue, shixunsskillvaluelist } = this.state;
if (shixunsskillvalue === "") {
return
} else if (shixunsskillvalue === undefined) {
return
}
if(shixunsskillvalue == "" || shixunsskillvalue == undefined || shixunsskillvalue == null || (shixunsskillvalue.length>0 && shixunsskillvalue.trim().length == 0)){
if (shixunsskillvalue == "" || shixunsskillvalue == undefined || shixunsskillvalue == null || (shixunsskillvalue.length > 0 && shixunsskillvalue.trim().length == 0)) {
message.error("输入为空,不能保存!");
return
}
@ -294,7 +286,7 @@ export default class TPMchallengesnew extends Component {
}
delshixunsskilllist = (key) => {
let {shixunsskillvaluelist} = this.state;
let { shixunsskillvaluelist } = this.state;
let newshixunsskillvaluelist = shixunsskillvaluelist;
newshixunsskillvaluelist.splice(key, 1);
this.setState({
@ -302,21 +294,21 @@ export default class TPMchallengesnew extends Component {
})
}
editPracticesend=()=>{
editPracticesend = () => {
this.setState({
editPracticesendtype:true
editPracticesendtype: true
})
let {shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvaluelist,checkpointId,exec_time} = this.state;
let { shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvaluelist, checkpointId, exec_time } = this.state;
const exercise_editormdvalue = this.exercisememoMDRef.current.getValue().trim();
let id = this.props.match.params.shixunId;
let url = "/shixuns/"+id+"/challenges/"+checkpointId+".json";
let url = "/shixuns/" + id + "/challenges/" + checkpointId + ".json";
if (shixunCreatePractice === undefined||shixunCreatePractice=="") {
if (shixunCreatePractice === undefined || shixunCreatePractice == "") {
// this.setState({
// shixunCreatePracticetype: true
// })
@ -325,7 +317,7 @@ export default class TPMchallengesnew extends Component {
scrollTop: 10
}, 1000);
this.setState({
editPracticesendtype:false
editPracticesendtype: false
})
return
}
@ -336,39 +328,39 @@ export default class TPMchallengesnew extends Component {
// })
this.props.showSnackbar("技能标签为空")
this.setState({
editPracticesendtype:false
editPracticesendtype: false
})
return
}
if(exec_time===null||exec_time===undefined||exec_time===""){
if (exec_time === null || exec_time === undefined || exec_time === "") {
this.setState({
shixunExec_timeType:false
shixunExec_timeType: false
})
return
}
axios.put(url, {
tab:0,
identifier:id,
id:checkpointId,
challenge:{
tab: 0,
identifier: id,
id: checkpointId,
challenge: {
subject: shixunCreatePractice,
task_pass: exercise_editormdvalue,
difficulty: shixunCreatePracticeGroup,
score: onshixunsmarkvalue,
exec_time:exec_time
exec_time: exec_time
},
challenge_tag:shixunsskillvaluelist
challenge_tag: shixunsskillvaluelist
}).then((response) => {
this.props.showSnackbar(response.data.messages);
if (response.data.status === 1) {
window.location.href=`/shixuns/${id}/challenges/${checkpointId}/tab=2`;
window.location.href = `/shixuns/${id}/challenges/${checkpointId}/tab=2`;
this.setState({
setopen: true,
editPracticesendtype:false,
tab2url: "/shixuns/" + id + "/challenges/"+checkpointId+"/tab=2",
tab3url: "/shixuns/" + id + "/challenges/"+checkpointId+"/tab=3",
editPracticesendtype: false,
tab2url: "/shixuns/" + id + "/challenges/" + checkpointId + "/tab=2",
tab3url: "/shixuns/" + id + "/challenges/" + checkpointId + "/tab=3",
})
// window.location.href = "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=2"
}
@ -379,21 +371,21 @@ export default class TPMchallengesnew extends Component {
}
onshixunsmarks=()=> {
onshixunsmarks = () => {
this.setState({
marktype:true
marktype: true
})
}
onshixunsmarkss=()=> {
onshixunsmarkss = () => {
this.setState({
marktype:false
marktype: false
})
}
setexec_time=(e)=>{
setexec_time = (e) => {
this.setState({
exec_time:e.target.value
exec_time: e.target.value
})
}
render() {
@ -401,15 +393,15 @@ export default class TPMchallengesnew extends Component {
let shixuntype = this.props.match.params.type;
let {marktype,
let { marktype,
shixunCreatePracticetype, shixunsskillvaluelisttype,
choice_url, practice_url, go_back_url, position, task_pass_default, submit_url, setopen,checkpointId,prev_challenge,next_challenge,power,
shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvalue, shixunsskillvaluelist, tab2url, tab3url,optionsums,
CreatePracticesendtype,editPracticesendtype
choice_url, practice_url, go_back_url, position, task_pass_default, submit_url, setopen, checkpointId, prev_challenge, next_challenge, power,
shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvalue, shixunsskillvaluelist, tab2url, tab3url, optionsums,
CreatePracticesendtype, editPracticesendtype
} = this.state;
let options;
if(optionsums!=undefined){
if (optionsums != undefined) {
options = optionsums.map((d, k) => {
return (
<Option key={d} id={k}>{d}</Option>
@ -422,16 +414,16 @@ export default class TPMchallengesnew extends Component {
<div className="educontent mt30 mb30">
<div className="padding10-20 mb10 edu-back-white clearfix">
<span className="fl ring-blue mr10 mt7">
<img src={getImageUrl("images/educoder/icon/code.svg")} data-tip-down="实训任务" className="fl mt2 ml2"/>
<img src={getImageUrl("images/educoder/icon/code.svg")} data-tip-down="实训任务" className="fl mt2 ml2" />
</span>
<span className="font-16 task-hide fl TPMtaskName">{position}</span>
<Link to={go_back_url === undefined ? "" : go_back_url}
className="color-grey-6 fr font-15 mt3">返回</Link>
{ next_challenge===undefined?"":
<a href={next_challenge}className="fr color-blue mr15 mt4">下一关</a>
{next_challenge === undefined ? "" :
<a href={next_challenge} className="fr color-blue mr15 mt4">下一关</a>
}
{ prev_challenge===undefined?"":
{prev_challenge === undefined ? "" :
<a href={prev_challenge} className="fr color-blue mr15 mt4">上一关</a>
}
@ -440,12 +432,12 @@ export default class TPMchallengesnew extends Component {
<a href={practice_url === undefined ? "" : practice_url}
className="fr color-blue mr15 mt4"
style={{display:this.props.identity>4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}}
style={{ display: this.props.identity > 4 || this.props.identity === undefined || this.props.status === 2 || this.props.status === 1 ? "none" : 'block' }}
data-tip-down="新增代码编辑类型的任务">+&nbsp;实践类型</a>
<a href={choice_url === undefined ? "" : choice_url}
className="fr color-blue mr15 mt4"
style={{display:this.props.identity>4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}}
style={{ display: this.props.identity > 4 || this.props.identity === undefined || this.props.status === 2 || this.props.status === 1 ? "none" : 'block' }}
data-tip-down="新增选择题类型的任务">+&nbsp;选择题类型</a>
</div>
@ -474,14 +466,14 @@ export default class TPMchallengesnew extends Component {
<div className="flex1 mr20">
<input type="text"
// className="input-100-45 greyInput"
className={shixunCreatePracticetype===true?"input-100-45 greyInpus wind100":"input-100-45 greyInput "}
className={shixunCreatePracticetype === true ? "input-100-45 greyInpus wind100" : "input-100-45 greyInput "}
maxLength="50"
name="challenge[subject]"
value={shixunCreatePractice}
onInput={this.shixunCreatePractice}
placeholder="请输入任务名称(此信息将提前展示给学员),例:计算学生的课程成绩绩点"/>
placeholder="请输入任务名称(此信息将提前展示给学员),例:计算学生的课程成绩绩点" />
</div>
<div style={{width: '57px'}}>
<div style={{ width: '57px' }}>
<span
className={shixunCreatePracticetype === true ? "color-orange mt8 fl block" : "color-orange mt8 fl none"}
id="new_shixun_name"><i
@ -509,8 +501,8 @@ export default class TPMchallengesnew extends Component {
<div className="clearfix mb40">
<RadioGroup value={shixunCreatePracticeGroup} className="fl mr40"
disabled={this.props.status===2?true:false}
onChange={this.props.status===2?"":this.onshixunCreatePracticeChange}>
disabled={this.props.status === 2 ? true : false}
onChange={this.props.status === 2 ? "" : this.onshixunCreatePracticeChange}>
<Radio value={1}>简单</Radio>
<Radio value={2}>中等</Radio>
<Radio value={3}>困难</Radio>
@ -523,11 +515,11 @@ export default class TPMchallengesnew extends Component {
>
<span className="fl mr30 color-orange pt10">*</span>
<Select style={{width: 120}} className="winput-240-40 fl"
<Select style={{ width: 120 }} className="winput-240-40 fl"
id="challenge_score"
onChange={this.props.status===2?"":this.onshixunsmark}
onChange={this.props.status === 2 ? "" : this.onshixunsmark}
// onMouseEnter={this.props.status===2?"":this.onshixunsmarks}
disabled={this.props.status===2?true:false}
disabled={this.props.status === 2 ? true : false}
// open={marktype}
value={onshixunsmarkvalue}
getPopupContainer={triggerNode => triggerNode.parentNode}
@ -536,7 +528,7 @@ export default class TPMchallengesnew extends Component {
</Select>
<p className="fl color-grey-9 font-12 ml20">
如果学员答题错误则不能得到相应的经验值<br/>
如果学员答题错误则不能得到相应的经验值<br />
如果学员成功得到经验值那么将同时获得等值的金币奖励+10经验值+10金币
</p>
@ -566,7 +558,7 @@ export default class TPMchallengesnew extends Component {
<div className="mt20 clearfix" id="task_tag_content">
{
shixunsskillvaluelist===undefined?"":shixunsskillvaluelist.length === 0 ? "" : shixunsskillvaluelist.map((itme, key) => {
shixunsskillvaluelist === undefined ? "" : shixunsskillvaluelist.length === 0 ? "" : shixunsskillvaluelist.map((itme, key) => {
return (
<li className="task_tag_span" key={key}><span>{itme}</span>
<a onClick={() => this.delshixunsskilllist(key)}>×</a>
@ -591,7 +583,7 @@ export default class TPMchallengesnew extends Component {
<span className="color-orange pt10 fl">*</span>
<label className="panel-form-label fl">评测时限(S)</label>
<div className="pr fl with80 status_con">
<input value={this.state.exec_time} className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" onInput={this.setexec_time}/>
<input value={this.state.exec_time} className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" onInput={this.setexec_time} />
</div>
<span
className={this.state.shixunExec_timeType === true ? "color-orange mt8 fl block ml20" : "color-orange mt8 fl none"}
@ -601,10 +593,10 @@ export default class TPMchallengesnew extends Component {
</div>
<div className="clearfix mt30"
style={{display:this.props.identity>4||this.props.identity===undefined?"none":'block'}}
style={{ display: this.props.identity > 4 || this.props.identity === undefined ? "none" : 'block' }}
>
{checkpointId===undefined?<a className="defalutSubmitbtn fl mr20" onClick={CreatePracticesendtype===true?"":this.CreatePracticesend}>提交</a>:
<a className="defalutSubmitbtn fl mr20" onClick={editPracticesendtype===true?"":this.editPracticesend}>提交</a>}
{checkpointId === undefined ? <a className="defalutSubmitbtn fl mr20" onClick={CreatePracticesendtype === true ? "" : this.CreatePracticesend}>提交</a> :
<a className="defalutSubmitbtn fl mr20" onClick={editPracticesendtype === true ? "" : this.editPracticesend}>提交</a>}
{/*<a href={go_back_url === undefined ? "" : go_back_url} className="defalutCancelbtn fl">取消</a>*/}
<Link to={go_back_url === undefined ? "" : go_back_url} className={"defalutCancelbtn fl"}>取消</Link>
</div>

@ -1,18 +1,15 @@
import React, { Component } from "react";
import { Spin } from "antd";
import axios from 'axios'
import ModalWrapper from "../../courses/common/ModalWrapper"
import { Cropper, getUrl } from 'educoder'
const imageId = 'changeHeaderPic'
const previewId = 'changeHeader_imagePreview'
let uploadedImageType;
let uploadedImageName;
let uploadedImageURL;
class ChangeHeaderPicModal extends Component{
constructor(props){
class ChangeHeaderPicModal extends Component {
constructor(props) {
super(props);
this.state={
this.state = {
uploading: false
}
}
@ -38,7 +35,7 @@ class ChangeHeaderPicModal extends Component{
if (uploadedImageURL) {
URL.revokeObjectURL(uploadedImageURL);
}
const image = document.getElementById( imageId );
const image = document.getElementById(imageId);
// base64
var reader = new FileReader();
@ -55,7 +52,7 @@ class ChangeHeaderPicModal extends Component{
// cropper = new Cropper(image, options);
inputImage.value = null;
};
reader.onerror = function() {
reader.onerror = function () {
console.log('there are some problems');
};
@ -118,8 +115,8 @@ class ChangeHeaderPicModal extends Component{
if (response.data.status == 0) {
// this.props.getBasicInfo()
// https://www.trustie.net/issues/22461
if ( this.props.current_user.image_url.indexOf('avatars/User/b') != -1
|| this.props.current_user.image_url.indexOf('avatars/User/g') != -1 ) {
if (this.props.current_user.image_url.indexOf('avatars/User/b') != -1
|| this.props.current_user.image_url.indexOf('avatars/User/g') != -1) {
window.setTimeout(() => {
this.doAfterUpdated()
}, 1000)
@ -143,15 +140,14 @@ class ChangeHeaderPicModal extends Component{
this.setVisible(false)
}
render(){
const { course_lists } = this.state
const { moduleName, current_user } = this.props
render() {
const { current_user } = this.props
const userHeaderImgUrl = current_user ? `${getUrl()}/images/${current_user.image_url}` : ''
return(
return (
<ModalWrapper
ref="modalWrapper"
title={`上传头像`}
{...this.props }
{...this.props}
onOk={this.onOk}
okText="保存"
width={552}
@ -207,7 +203,7 @@ class ChangeHeaderPicModal extends Component{
<span className="tip">仅支持JPGGIFPNG且文件小于2M</span>
</div>
<div
className="df previewWrap" style ={{flexDirection: 'column'}}
className="df previewWrap" style={{ flexDirection: 'column' }}
>
<div>
<div id="changeHeader_imagePreview">

@ -1,17 +1,17 @@
import React,{ Component } from "react";
import React, { Component } from "react";
import { Input, InputNumber, Form, Button, Checkbox, Upload, Icon, message, Modal } from "antd";
import axios from 'axios'
import { getUploadActionUrl, getUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from 'educoder'
import { getUploadActionUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from 'educoder'
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
const $ = window.$;
const MAX_TITLE_LENGTH = 60;
class NewGtaskForms extends Component{
constructor(props){
class NewGtaskForms extends Component {
constructor(props) {
super(props);
this.contentMdRef = React.createRef();
this.state={
title_num:0,
description:"",
this.state = {
title_num: 0,
description: "",
contentFileList: [],
}
}
@ -19,7 +19,7 @@ class NewGtaskForms extends Component{
initValue = (data) => {
if (data.isEdit===true) {
if (data.isEdit === true) {
const contentFileList = data.attachments.map(item => {
return {
id: item.id,
@ -32,10 +32,10 @@ class NewGtaskForms extends Component{
})
this.setState({
...data,
base_on_project: data.task_type===2?data.group_info.base_on_project:undefined,
base_on_project: data.task_type === 2 ? data.group_info.base_on_project : undefined,
title_num: parseInt(data.name.length),
min_num: data.task_type===2?data.group_info.min_number:undefined,
max_num: data.task_type===2?data.group_info.max_number:undefined,
min_num: data.task_type === 2 ? data.group_info.min_number : undefined,
max_num: data.task_type === 2 ? data.group_info.max_number : undefined,
contentFileList,
}, () => {
setTimeout(() => {
@ -55,7 +55,7 @@ class NewGtaskForms extends Component{
// 输入title
changeTitle=(e)=>{
changeTitle = (e) => {
console.log(e.target.value.length);
this.setState({
title_num: parseInt(e.target.value.length)
@ -93,7 +93,7 @@ class NewGtaskForms extends Component{
}
onAttachmentRemove = (file, stateName) => {
if(file.response!=undefined){
if (file.response != undefined) {
this.props.confirm({
content: '是否确认删除?',
@ -111,10 +111,10 @@ class NewGtaskForms extends Component{
handleSubmit = () => {
let {contentFileList,min_num,max_num,base_on_project}=this.state;
let {data}=this.props;
let task_type=data.task_type
let topicId=this.props.topicId
let { contentFileList, min_num, max_num, base_on_project } = this.state;
let { data } = this.props;
let task_type = data.task_type
let topicId = this.props.topicId
let attachment_ids = contentFileList.map(item => {
return item.response ? item.response.id : item.id
})
@ -125,23 +125,23 @@ class NewGtaskForms extends Component{
values.description = mdContnet;
if (!err) {
if (this.props.data.isEdit===true) {
let url="/task_banks/"+topicId+".json";
if (this.props.data.isEdit === true) {
let url = "/task_banks/" + topicId + ".json";
axios.put(url, {
gtask_bank: {
name: values.title,
description: values.description,
min_num:task_type===1?undefined:min_num,
max_num:task_type===1?undefined:max_num,
base_on_project: task_type===1?task_type:base_on_project===true?1:0
min_num: task_type === 1 ? undefined : min_num,
max_num: task_type === 1 ? undefined : max_num,
base_on_project: task_type === 1 ? task_type : base_on_project === true ? 1 : 0
},
attachment_ids:attachment_ids
attachment_ids: attachment_ids
}
).then((response) => {
if(response.data.status===0){
if (response.data.status === 0) {
this.props.showNotification(response.data.message)
this.props.onCancel()
}else{
} else {
this.props.showNotification(response.data.message)
}
}).catch((error) => {
@ -176,14 +176,14 @@ class NewGtaskForms extends Component{
this.setState({ base_on_project: !this.state.base_on_project })
}
render(){
render() {
const { getFieldDecorator } = this.props.form;
let{
let {
title_value, contentFileList, answerFileList, max_num, min_num, base_on_project,
init_max_num, init_min_num,
title_num, course_name, category, has_commit, has_project,
isEdit
}=this.state
} = this.state
const uploadProps = {
width: 600,
fileList: contentFileList,
@ -205,7 +205,7 @@ class NewGtaskForms extends Component{
};
return(
return (
<div>
<style>
{
@ -226,7 +226,7 @@ class NewGtaskForms extends Component{
<Form className="courseForm" >
<div className={"ant-row ant-form-item AboutInputForm newAboutInputForm "}>
<div className="ant-col ant-form-item-label margin0">
<label htmlFor="coursesNew_course" className="ant-form-item-required ">类型</label> <span className={"tasktypes"}>{this.props.data&&this.props.data.task_type===1?"":this.props.data&&this.props.data.task_type===2?"":""}</span>
<label htmlFor="coursesNew_course" className="ant-form-item-required ">类型</label> <span className={"tasktypes"}>{this.props.data && this.props.data.task_type === 1 ? "" : this.props.data && this.props.data.task_type === 2 ? "" : ""}</span>
</div>
</div>
<Form.Item
@ -241,7 +241,7 @@ class NewGtaskForms extends Component{
<Input placeholder="请输入毕设任务标题最大限制60个字符"
onInput={this.changeTitle}
className="searchView yslnewworkinputaddonAfter searchViewAfter"
style={{"width":"100%"}}
style={{ "width": "100%" }}
maxLength={MAX_TITLE_LENGTH} addonAfter={`${String(title_num)}/${MAX_TITLE_LENGTH}`}
/>
)}
@ -282,7 +282,7 @@ class NewGtaskForms extends Component{
`}</style>
{ <Form.Item
{<Form.Item
label="内容"
className="AboutInputForm workContent mdInForm"
>
@ -294,14 +294,14 @@ class NewGtaskForms extends Component{
<TPMMDEditor ref={this.contentMdRef} placeholder="请输入任务内容说明最大限制5000个字符" mdID={'courseContentMD'} refreshTimeout={1500}
className="courseMessageMD" initValue={this.state.description}></TPMMDEditor>
)}
</Form.Item> }
</Form.Item>}
<Upload {...uploadProps} className="upload_1 newWorkUpload">
<Button className="uploadBtn">
<Icon type="upload" /> 上传附件
</Button>
(单个文件150M以内)
</Upload>
{this.props.data&&this.props.data.task_type===2?
{this.props.data && this.props.data.task_type === 2 ?
<Form.Item
label="分组设置"
className="AboutInputForm"
@ -317,14 +317,14 @@ class NewGtaskForms extends Component{
<ConditionToolTip condition={has_commit} title={'已有提交作品,人数范围只能扩大'}>
{/* max={has_commit ? init_min_num : null } */}
每组最小人数<InputNumber placeholder="请填写每组最小人数" min={1} className="winput-240-40 mr10" value={min_num}
onChange={this.min_num_change} style={{width:'180px'}} />
onChange={this.min_num_change} style={{ width: '180px' }} />
</ConditionToolTip>
<span className="ml15 mr15"></span>
{/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */}
<ConditionToolTip condition={has_commit} title={'已有提交作品,人数范围只能扩大'}>
每组最大人数<InputNumber className="winput-240-40 mr10" placeholder="请填写每组最大人数" value={max_num} max={10}
onChange={this.max_num_change} style={{width:'180px'}} />
onChange={this.max_num_change} style={{ width: '180px' }} />
</ConditionToolTip>
<div className="color-grey-9 mt20 font-14">学生提交作品时需要关联同组成员组内成员作品共享</div>
</p>
@ -338,7 +338,7 @@ class NewGtaskForms extends Component{
</p>
</div>
)}
</Form.Item>:""
</Form.Item> : ""
}
<Form.Item>
<div className="clearfix mt30 mb30">

Loading…
Cancel
Save