hjm 5 years ago
commit 60f72e1e25

@ -9,7 +9,7 @@ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
const eslintFormatter = require('react-dev-utils/eslintFormatter'); const eslintFormatter = require('react-dev-utils/eslintFormatter');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
// const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const getClientEnvironment = require('./env'); const getClientEnvironment = require('./env');
const paths = require('./paths'); const paths = require('./paths');
@ -249,7 +249,8 @@ module.exports = {
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
// You can remove this if you don't use Moment.js: // You can remove this if you don't use Moment.js:
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
], new MonacoWebpackPlugin(),
],
// Some libraries import Node modules but don't use them in the browser. // Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works. // Tell Webpack to provide empty mocks for them so importing them works.
node: { node: {

File diff suppressed because it is too large Load Diff

@ -3,7 +3,6 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@flatten/array": "^1.1.7",
"@icedesign/base": "^0.2.5", "@icedesign/base": "^0.2.5",
"@novnc/novnc": "^1.1.0", "@novnc/novnc": "^1.1.0",
"antd": "^3.20.1", "antd": "^3.20.1",
@ -48,6 +47,7 @@
"moment": "^2.23.0", "moment": "^2.23.0",
"monaco-editor": "^0.15.6", "monaco-editor": "^0.15.6",
"monaco-editor-webpack-plugin": "^1.7.0", "monaco-editor-webpack-plugin": "^1.7.0",
"npm": "^6.10.1",
"object-assign": "4.1.1", "object-assign": "4.1.1",
"postcss-flexbugs-fixes": "3.2.0", "postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.8", "postcss-loader": "2.0.8",
@ -159,7 +159,6 @@
"port": "3007", "port": "3007",
"devDependencies": { "devDependencies": {
"@babel/runtime": "7.0.0-beta.51", "@babel/runtime": "7.0.0-beta.51",
"antd": "^3.6.5",
"babel-plugin-import": "^1.11.0", "babel-plugin-import": "^1.11.0",
"concat": "^1.0.3", "concat": "^1.0.3",
"happypack": "^5.0.1", "happypack": "^5.0.1",

@ -0,0 +1,114 @@
import React, { Component } from 'react';
const $ = window.jQuery
const jQuery = $;
if (!$.drag) {
(function($){
$.fn.dragValidator = function(options){
var x, drag = this, isMove = false, defaults = {
};
var options = $.extend(defaults, options);
//添加背景,文字,滑块
var html = '<div class="drag_bg"></div>'+
'<div class="drag_text" onselectstart="return false;" unselectable="on">拖动滑块验证</div>'+
'<div class="handler handler_bg"></div>';
this.append(html);
var handler = drag.find('.handler');
var drag_bg = drag.find('.drag_bg');
var text = drag.find('.drag_text');
var maxWidth = text.width() - handler.width(); //能滑动的最大间距
//鼠标按下时候的x轴的位置
handler.mousedown(function(e){
isMove = true;
x = e.pageX - parseInt(handler.css('left'), 10);
});
//鼠标指针在上下文移动时移动距离大于0小于最大间距滑块x轴位置等于鼠标移动距离
$(document).mousemove(function(e){
var _x = e.pageX - x;
var handler_offset = handler.offset();
var lastX = e.clientX -x;
lastX = Math.max(0,Math.min(maxWidth,lastX));
if(isMove){
if(_x > 0 && _x <= maxWidth){
handler.css({'left': lastX});
drag_bg.css({'width': lastX});
}
else if(lastX > maxWidth - 5 && lastX < maxWidth + 5 ){ //鼠标指针移动距离达到最大时清空事件
dragOk();
}
}
});
handler.mouseup(function(e){
isMove = false;
var _x = e.pageX - x;
if(text.text() != '验证通过' && _x < maxWidth){ //鼠标松开时,如果没有达到最大距离位置,滑块就返回初始位置
handler.animate({'left': 0});
drag_bg.animate({'width': 0});
}
});
//清空事件
function dragOk(){
options.dragOkCallback && options.dragOkCallback()
var kuaiwidth=drag.width() - handler.width() - 2;
handler.removeClass('handler_bg').addClass('handler_ok_bg');
handler.css({'left':kuaiwidth+'px'})
text.css({'width':kuaiwidth+'px'});
text.text('验证通过');
drag.css({'color': '#fff'});
drag_bg.css({'width':kuaiwidth+'px'})
handler.unbind('mousedown');
$(document).unbind('mousemove');
$(document).unbind('mouseup');
$("#user_verification_notice").html("");
$('#user_verification_notice').parent().hide();
}
};
})(jQuery);
}
class DragValidator extends Component {
componentDidMount () {
// if($("#reg-drag").length>0 && IsPC()){
$("#reg-drag").dragValidator({
height: this.props.height,
dragOkCallback: () => {
this.props.dragOkCallback && this.props.dragOkCallback()
}
});
// }else{
// $("#reg-drag").empty();
// }
}
empty() {
$("#reg-drag").empty();
}
render() {
const height = this.props.height || 45;
const className = this.props.className
const successGreenColor = this.props.successGreenColor || '#29bd8b'
// newMain clearfix
return (
<div id="reg-drag" className={`drag_slider ${className}`}>
<style>{`
.drag_slider .handler {
height: 100%;
}
.drag_slider {
height: ${height}px;
line-height: ${height}px;
}
.drag_slider .drag_bg {
height: ${height}px;
background-color: ${successGreenColor};
}
`}</style>
</div>
);
}
}
export default ( DragValidator );

@ -152,8 +152,8 @@ class UseBank extends Component{
) )
.then((response) => { .then((response) => {
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.useBankSuccess && this.props.useBankSuccess(checkBoxValues,response.data.object_ids);
this.props.showNotification('题库选用成功') this.props.showNotification('题库选用成功')
this.props.useBankSuccess && this.props.useBankSuccess(checkBoxValues,response.data.object_ids);
this.closeSelectBank(); this.closeSelectBank();
this.props.updataleftNavfun() this.props.updataleftNavfun()
this.setState({ this.setState({

@ -1,10 +1,11 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {getImageUrl} from 'educoder';
import CoursesHomeCard from "./coursesHomeCard.js" import CoursesHomeCard from "./coursesHomeCard.js"
import axios from 'axios'; import axios from 'axios';
import {Input,Pagination,Tooltip} from 'antd'; import {Input,Tooltip} from 'antd';
import './css/CoursesHome.css'; import './css/CoursesHome.css';
import Pagination from '@icedesign/base/lib/pagination';
import '@icedesign/base/lib/pagination/style.js';
const Search = Input.Search; const Search = Input.Search;
class coursesHome extends Component{ class coursesHome extends Component{
@ -38,13 +39,14 @@ class coursesHome extends Component{
} }
//搜索 //搜索
searchValue=(e)=>{ searchValue=(e)=>{
let { search }=this.state; let { search ,order}=this.state;
this.setState({ this.setState({
order:'all', order:order,
page:1 page:1
}) })
this.searchcourses(16,1,'all',search) this.searchcourses(16,1,order,search)
} }
@ -89,7 +91,7 @@ class coursesHome extends Component{
render() { render() {
let { order,search,page,coursesHomelist }=this.state; let { order,search,page,coursesHomelist }=this.state;
console.log(coursesHomelist)
return ( return (
<div> <div>
@ -126,10 +128,16 @@ class coursesHome extends Component{
<CoursesHomeCard {...this.props} {...this.state} <CoursesHomeCard {...this.props} {...this.state}
coursesHomelist={coursesHomelist}></CoursesHomeCard> coursesHomelist={coursesHomelist}></CoursesHomeCard>
{coursesHomelist===undefined?"":coursesHomelist.courses.length===0?<div className="edu-tab-con-box clearfix edu-txt-center mb50">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">暂无数据哦~</p>
</div>:""}
{ {
coursesHomelist===undefined?"":coursesHomelist.courses_count > 16? coursesHomelist===undefined?"":coursesHomelist.courses_count > 16?
<div className="educontent mb80 edu-txt-center mt10"> <div className="educontent mb80 edu-txt-center mt10">
<Pagination showQuickJumper current={page} pageSize={16} total={coursesHomelist.courses_count} onChange={this.onChange} /> <Pagination current={page} total={ coursesHomelist.courses_count || 1299 } type="mini" pageSize={16} onChange={this.onChange} />
</div>:"" </div>:""
} }
</div> </div>
@ -138,4 +146,7 @@ class coursesHome extends Component{
) )
} }
} }
export default coursesHome; export default coursesHome;
// {/*<Pagination showQuickJumper current={page} pageSize={16} total={coursesHomelist.courses_count} onChange={this.onChange} />*/}

@ -42,7 +42,7 @@ class Exercisetablesmubus extends Component {
key: 'commit_percent', key: 'commit_percent',
render: (text, record) => ( render: (text, record) => (
<span style={{color:text.type===true? "#29BD8B":'#333333'}}> <span style={{color:text.type===true? "#29BD8B":'#333333'}}>
{text.value!="有效填写量"&&text.value!="wrong"?text.num +"."+ text.value:false} {text.value!="有效填写量"&&text.value!="wrong"?text.value:false}
{text.value==="wrong"?"填写了错误答案":false} {text.value==="wrong"?"填写了错误答案":false}
{text.value==="有效填写量"?"有效填写量":false} {text.value==="有效填写量"?"有效填写量":false}
</span> </span>

@ -1,159 +1,159 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import {Checkbox,Radio, Input} from "antd"; import {Checkbox,Radio, Input} from "antd";
import {DMDEditor,markdownToHTML } from 'educoder' import {DMDEditor,markdownToHTML } from 'educoder'
import axios from 'axios' import axios from 'axios'
const tagArray = [ const tagArray = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', // 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', // 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' // 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
] ]
class fillEmpty extends Component{ class fillEmpty extends Component{
constructor(props){ constructor(props){
super(props); super(props);
this.mdRef = React.createRef() this.mdRef = React.createRef()
let { questionType }=this.props; let { questionType }=this.props;
let array=[]; let array=[];
for(var i=0;i < questionType.multi_count; i++){ for(var i=0;i < questionType.multi_count; i++){
let item=""; let item="";
if(questionType.user_answer.length>0){ if(questionType.user_answer.length>0){
if(questionType.user_answer[i]){ if(questionType.user_answer[i]){
item=questionType.user_answer[i].answer_text; item=questionType.user_answer[i].answer_text;
} }
} }
array.push({ array.push({
value:item, value:item,
q_id:questionType.question_number q_id:questionType.question_number
}) })
} }
this.state={ this.state={
array array
} }
} }
toMDMode = (that) => { toMDMode = (that) => {
// if ( this.mdReactObject) { // if ( this.mdReactObject) {
// let mdReactObject = this.mdReactObject; // let mdReactObject = this.mdReactObject;
// this.mdReactObject = null // this.mdReactObject = null
// mdReactObject.toShowMode() // mdReactObject.toShowMode()
// } // }
this.mdReactObject = that; this.mdReactObject = that;
} }
onOptionContentChange = (value, index) => { onOptionContentChange = (value, index) => {
let array = this.state.array.slice(0); let array = this.state.array.slice(0);
array[index].value = value; array[index].value = value;
this.setState({ array }) this.setState({ array })
} }
onBlurEmpty=(index,number)=>{ onBlurEmpty=(index,number)=>{
let array = this.state.array.slice(0); let array = this.state.array.slice(0);
let v=array[index].value; let v=array[index].value;
let question_id=this.props.questionType.question_id; let question_id=this.props.questionType.question_id;
let url=`/exercise_questions/${question_id}/exercise_answers.json` let url=`/exercise_questions/${question_id}/exercise_answers.json`
axios.post((url),{ axios.post((url),{
exercise_choice_id:parseInt(index)+1, exercise_choice_id:parseInt(index)+1,
answer_text:v answer_text:v
}).then((result)=>{ }).then((result)=>{
if(result.status==200){ if(result.status==200){
//this.refs[`md${number}${index}`].toShowMode(); //this.refs[`md${number}${index}`].toShowMode();
let count=0; let count=0;
for(var i=0;i<array.length;i++){ for(var i=0;i<array.length;i++){
if(array[i].value ==""){ count++; } if(array[i].value ==""){ count++; }
} }
let k = count==array.length ? 0 : 1; let k = count==array.length ? 0 : 1;
this.props.changeQuestionStatus && this.props.changeQuestionStatus(parseInt(this.props.questionType.q_position)-1,k); this.props.changeQuestionStatus && this.props.changeQuestionStatus(parseInt(this.props.questionType.q_position)-1,k);
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
}) })
} }
render(){ render(){
let { let {
questionType , questionType ,
exercise , exercise ,
user_exercise_status, user_exercise_status,
}=this.props }=this.props
let { let {
array array
}=this.state }=this.state
let isAdmin = this.props.isAdmin(); let isAdmin = this.props.isAdmin();
let isStudent = this.props.isStudent(); let isStudent = this.props.isStudent();
return( return(
<div className="pl30 pr30"> <div className="pl30 pr30">
<style>{` <style>{`
.emptyPanel div#content_editorMd_show{ .emptyPanel div#content_editorMd_show{
width: 100%; width: 100%;
border-radius: 4px; border-radius: 4px;
height: 35px; height: 35px;
margin-top:0px; margin-top:0px;
background-color:#fafafa; background-color:#fafafa;
color:#999; color:#999;
line-height:25px; line-height:25px;
} }
.answerStyle{ .answerStyle{
background:#f5f5f5; background:#f5f5f5;
border-radius:4px; border-radius:4px;
border: 1px solid #eaeaea; border: 1px solid #eaeaea;
padding:5px; padding:5px;
min-height:35px; min-height:35px;
box-sizing:border-box; box-sizing:border-box;
} }
`}</style> `}</style>
{ {
array.map((item,key)=>{ array.map((item,key)=>{
return( return(
<li className="df mb10 emptyPanel"> <li className="df mb10 emptyPanel">
<span className="mr10 lineh-35 font-16">答案(填空{key+1})</span> <span className="mr10 lineh-35 font-16">答案(填空{key+1})</span>
<div className="flex1" style={{width:"0"}}> <div className="flex1" style={{width:"0"}}>
{ {
user_exercise_status == 1 ? user_exercise_status == 1 ?
<input value={item.value} className="input-100-35" style={{backgroundColor: "#F5F5F5",cursor:"default"}} placeholder={ isStudent && item.value ? `请输入填空${key+1}的答案` : "" } readOnly/> <input value={item.value} className="input-100-35" style={{backgroundColor: "#F5F5F5",cursor:"default"}} placeholder={ isStudent && item.value ? `请输入填空${key+1}的答案` : "" } readOnly/>
: :
<DMDEditor <DMDEditor
ref={`md${questionType.q_position}${key}`} ref={`md${questionType.q_position}${key}`}
toMDMode={this.toMDMode} toShowMode={this.toShowMode} toMDMode={this.toMDMode} toShowMode={this.toShowMode}
height={150} className={'optionMdEditor'} watch={false} noStorage={true} height={150} className={'optionMdEditor'} watch={false} noStorage={true}
mdID={questionType.question_id +"_"+ key} placeholder={`输入填空${key+1}的答案`} onChange={(value) => this.onOptionContentChange(value, key)} mdID={questionType.question_id +"_"+ key} placeholder={`输入填空${key+1}的答案`} onChange={(value) => this.onOptionContentChange(value, key)}
initValue={item.value} onCMBlur={()=>this.onBlurEmpty(key,questionType.q_position)} initValue={item.value} onCMBlur={()=>this.onBlurEmpty(key,questionType.q_position)}
></DMDEditor> ></DMDEditor>
} }
</div> </div>
</li> </li>
) )
}) })
} }
{ {
// 答案公开,且试卷已经截止 // 答案公开,且试卷已经截止
isAdmin && isAdmin &&
<div> <div>
<p className="bor-top-greyE pt20 mt20 font-16 mb10">参考答案</p> <p className="bor-top-greyE pt20 mt20 font-16 mb10">参考答案</p>
{ questionType.standard_answer && questionType.standard_answer.map((item,k)=>{ { questionType.standard_answer && questionType.standard_answer.map((item,k)=>{
return( return(
<ul className="df font-16"> <ul className="df font-16">
<span className="mr10">填空{k+1}:</span> <span className="mr10">填空{k+1}:</span>
<li className="flex1"> <li className="flex1">
{ {
item.answer_text && item.answer_text.map((i,index)=>{ item.answer_text && item.answer_text.map((i,index)=>{
return( return(
<div className="standardAnswer markdown-body answerStyle mb10" dangerouslySetInnerHTML={{__html: markdownToHTML(i)}}></div> <div className="standardAnswer markdown-body answerStyle mb10" dangerouslySetInnerHTML={{__html: markdownToHTML(i)}}></div>
) )
}) })
} }
</li> </li>
</ul> </ul>
) )
}) })
} }
</div> </div>
} }
</div> </div>
) )
} }
} }
export default fillEmpty export default fillEmpty

@ -1,73 +1,73 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import {Checkbox,Radio, Input} from "antd"; import {Checkbox,Radio, Input} from "antd";
import {markdownToHTML} from 'educoder' import {markdownToHTML} from 'educoder'
import axios from 'axios' import axios from 'axios'
const tagArray = [ const tagArray = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', // 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', // 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' // 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
] ]
class Multiple extends Component{ class Multiple extends Component{
constructor(props){ constructor(props){
super(props); super(props);
} }
saveId=(value)=>{ saveId=(value)=>{
let question_id=this.props.questionType.question_id; let question_id=this.props.questionType.question_id;
let url=`/exercise_questions/${question_id}/exercise_answers.json`; let url=`/exercise_questions/${question_id}/exercise_answers.json`;
axios.post((url),{ axios.post((url),{
exercise_choice_id:value exercise_choice_id:value
}).then((result)=>{ }).then((result)=>{
if(result.status==200){ if(result.status==200){
let k=0; let k=0;
if(value.length > 0 ){ if(value.length > 0 ){
k=1; k=1;
}else{ }else{
k=0; k=0;
} }
this.props.changeQuestionStatus && this.props.changeQuestionStatus(parseInt(this.props.questionType.q_position)-1,k); this.props.changeQuestionStatus && this.props.changeQuestionStatus(parseInt(this.props.questionType.q_position)-1,k);
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
}) })
} }
render(){ render(){
let { let {
questionType , questionType ,
exercise, exercise,
user_exercise_status user_exercise_status
}=this.props }=this.props
let isStudent =this.props.isStudent(); let isStudent =this.props.isStudent();
console.log(questionType); console.log(questionType);
return( return(
<div className="pl30 pr30"> <div className="pl30 pr30">
<Checkbox.Group disabled={ user_exercise_status == 1 ? true : false } onChange={this.saveId} defaultValue={questionType.user_answer}> <Checkbox.Group disabled={ user_exercise_status == 1 ? true : false } onChange={this.saveId} defaultValue={questionType.user_answer}>
{ {
questionType.question_choices && questionType.question_choices.map((item,key)=>{ questionType.question_choices && questionType.question_choices.map((item,key)=>{
return( return(
<p className="clearfix mb15 df"> <p className="clearfix mb15 df">
<Checkbox className="fl lineh-20 " value={item.choice_id}></Checkbox> <Checkbox className="fl lineh-20 " value={item.choice_id}></Checkbox>
<span class="fl lineh-20 mt1">{tagArray[key]}.</span><span style={{display:"inline-block"}} className="markdown-body mt1" dangerouslySetInnerHTML={{__html: markdownToHTML(item.choice_text)}}></span> <span class="fl lineh-20 mt1"></span><span style={{display:"inline-block"}} className="markdown-body mt1" dangerouslySetInnerHTML={{__html: markdownToHTML(item.choice_text)}}></span>
</p> </p>
) )
}) })
} }
</Checkbox.Group> </Checkbox.Group>
{ {
// 答案公开,且试卷已经截止 // 答案公开,且试卷已经截止
isStudent && exercise && exercise.answer_open==true && exercise.exercise_status == 3 && isStudent && exercise && exercise.answer_open==true && exercise.exercise_status == 3 &&
<p className="bor-top-greyE pt20 mt10 font-16">参考答案 <p className="bor-top-greyE pt20 mt10 font-16">参考答案
{questionType.standard_answer.map((i,k)=>{ {questionType.standard_answer.map((i,k)=>{
return( return(
<span value={k}>{tagArray[parseInt(i)-1]}</span> <span value={k}>{tagArray[parseInt(i)-1]}</span>
) )
}) })
} }
</p> </p>
} }
</div> </div>
) )
} }
} }
export default Multiple export default Multiple

@ -1,68 +1,68 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import {Checkbox,Radio, Input} from "antd"; import {Checkbox,Radio, Input} from "antd";
import {markdownToHTML} from 'educoder' import {markdownToHTML} from 'educoder'
import axios from 'axios' import axios from 'axios'
const tagArray = [ const tagArray = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', // 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', // 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' // 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
] ]
class single extends Component{ class single extends Component{
constructor(props){ constructor(props){
super(props); super(props);
} }
changeItem=(e)=>{ changeItem=(e)=>{
let choiceId=e.target.value; let choiceId=e.target.value;
let question_id=this.props.questionType.question_id; let question_id=this.props.questionType.question_id;
let url=`/exercise_questions/${question_id}/exercise_answers.json`; let url=`/exercise_questions/${question_id}/exercise_answers.json`;
axios.post((url),{ axios.post((url),{
exercise_choice_id:choiceId exercise_choice_id:choiceId
}).then((result)=>{ }).then((result)=>{
if(result){ if(result){
this.props.changeQuestionStatus && this.props.changeQuestionStatus(parseInt(this.props.questionType.q_position)-1,1); this.props.changeQuestionStatus && this.props.changeQuestionStatus(parseInt(this.props.questionType.q_position)-1,1);
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
}) })
} }
render(){ render(){
let { let {
questionType , questionType ,
exercise, exercise,
user_exercise_status user_exercise_status
}=this.props }=this.props
let isStudent =this.props.isStudent(); let isStudent =this.props.isStudent();
return( return(
<div className="pl30 pr30"> <div className="pl30 pr30">
<Radio.Group disabled={ user_exercise_status == 1 ? true : false } defaultValue={questionType.user_answer[0]} onChange={this.changeItem}> <Radio.Group disabled={ user_exercise_status == 1 ? true : false } defaultValue={questionType.user_answer[0]} onChange={this.changeItem}>
{ {
questionType.question_choices && questionType.question_choices.map((item,key)=>{ questionType.question_choices && questionType.question_choices.map((item,key)=>{
return( return(
<p className={parseInt(questionType.question_type) == 0 ? "clearfix mb15 df" : "fl mr40"}> <p className={parseInt(questionType.question_type) == 0 ? "clearfix mb15 df" : "fl mr40"}>
<Radio className="fl lineh-20" value={item.choice_id}></Radio> <Radio className="fl lineh-20" value={item.choice_id}></Radio>
<span className="fl lineh-20 mr3 mt1">{tagArray[key]}.</span><span style={{display:"inline-block"}} className="markdown-body fl mt1" dangerouslySetInnerHTML={{__html: markdownToHTML(item.choice_text)}}></span> <span className="fl lineh-20 mr3 mt1"></span><span style={{display:"inline-block"}} className="markdown-body fl mt1" dangerouslySetInnerHTML={{__html: markdownToHTML(item.choice_text)}}></span>
</p> </p>
) )
}) })
} }
</Radio.Group> </Radio.Group>
{ {
// 答案公开,且试卷已经截止 // 答案公开,且试卷已经截止
isStudent && exercise && exercise.answer_open==true && (exercise.exercise_status == 3 || user_exercise_status == 1) && isStudent && exercise && exercise.answer_open==true && (exercise.exercise_status == 3 || user_exercise_status == 1) &&
<p className="bor-top-greyE pt20 mt10 font-16">参考答案 <p className="bor-top-greyE pt20 mt10 font-16">参考答案
{questionType.standard_answer.map((i,k)=>{ {questionType.standard_answer.map((i,k)=>{
return( return(
<span value={k}>{tagArray[parseInt(i)-1]}</span> <span value={k}>{tagArray[parseInt(i)-1]}</span>
) )
}) })
} }
</p> </p>
} }
</div> </div>
) )
} }
} }
export default single export default single

@ -388,11 +388,12 @@ class GraduationTasksSubmitedit extends Component{
} }
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
if (!err) {
console.log(values.description);
// console.log(fileList); // console.log(fileList);
if(values.description===undefined||values.description===""){ if(values.description===undefined||values.description===""){
this.scrollToAnchor("valuestypes");
debugger
return return
} }
if(workslist.task_type===2){ if(workslist.task_type===2){
@ -418,12 +419,12 @@ class GraduationTasksSubmitedit extends Component{
}) })
let workId=this.props.match.params.work_Id; let workId=this.props.match.params.work_Id;
if(fileList.length===0){ // if(fileList.length===0){
this.setState({ // this.setState({
shixunsreplace:true, // shixunsreplace:true,
}) // })
return // return
} // }
let url="/graduation_works/"+workId+".json"; let url="/graduation_works/"+workId+".json";
axios.put(url, { axios.put(url, {
@ -456,7 +457,7 @@ class GraduationTasksSubmitedit extends Component{
console.log(error) console.log(error)
}) })
}
}); });
} }
@ -472,10 +473,18 @@ class GraduationTasksSubmitedit extends Component{
hidestartshixunsreplacetwo= ()=>{ hidestartshixunsreplacetwo= ()=>{
this.setState({ this.setState({
shixunsreplace:false, shixunsreplace:false,
spinnings:false
}) })
} }
scrollToAnchor = (anchorName) => {
if (anchorName) {
// 找到锚点
let anchorElement = document.getElementById(anchorName);
// 如果对应id的锚点存在就跳转到锚点
if(anchorElement) { anchorElement.scrollIntoView({block: 'start', behavior: 'smooth'}); }
}
}
render(){ render(){
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
let {search,fileList, workslist,setvalue,minvalue,minmaxtype,Loadtype,description,attachments, let {search,fileList, workslist,setvalue,minvalue,minmaxtype,Loadtype,description,attachments,
@ -573,7 +582,7 @@ class GraduationTasksSubmitedit extends Component{
{description&&description? {description&&description?
<div> <div>
{/*<Form onSubmit={this.handleSubmit} >*/} {/*<Form onSubmit={this.handleSubmit} >*/}
<div className="stud-class-set pd20 coursenavbox edu-back-white"> <div className="stud-class-set pd20 coursenavbox edu-back-white" id={"valuestypes"}>
<style>{` <style>{`
.uploadBtn.ant-btn { .uploadBtn.ant-btn {
border: none; border: none;

@ -358,6 +358,7 @@ class GraduationTasksSubmitnew extends Component{
//公用数据 //公用数据
Commoninterface = (fileList,selectmemberslist,workslist)=>{ Commoninterface = (fileList,selectmemberslist,workslist)=>{
debugger
let userids=[]; let userids=[];
for(var list of selectmemberslist){ for(var list of selectmemberslist){
@ -379,11 +380,11 @@ class GraduationTasksSubmitnew extends Component{
} }
// if( GraduationTasksnewtype===true){ // if( GraduationTasksnewtype===true){
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
if (!err) {
console.log(values.description);
// console.log(fileList); // console.log(fileList);
if(values.description===undefined||values.description===""){ if(values.description===undefined||values.description===""){
this.scrollToAnchor("valuestypes");
debugger
return return
} }
if(workslist&&workslist.task_type===2){ if(workslist&&workslist.task_type===2){
@ -414,13 +415,12 @@ class GraduationTasksSubmitnew extends Component{
let id=this.props.match.params.task_Id; let id=this.props.match.params.task_Id;
if(fileList.length === 0){ // if(fileList.length === 0){
this.setState({ // this.setState({
shixunsreplace:true, // shixunsreplace:true,
}) // })
return // return
} // }
debugger
let url="/graduation_tasks/"+id+"/graduation_works.json"; let url="/graduation_tasks/"+id+"/graduation_works.json";
axios.post(url, { axios.post(url, {
description:values.description, description:values.description,
@ -452,7 +452,7 @@ debugger
console.log(error) console.log(error)
}) })
}
}); });
// } // }
@ -460,6 +460,7 @@ debugger
//确认 //确认
hidestartshixunsreplace=()=>{ hidestartshixunsreplace=()=>{
debugger
let {fileList,selectmemberslist,workslist}=this.state; let {fileList,selectmemberslist,workslist}=this.state;
this.Commoninterface(fileList,selectmemberslist,workslist); this.Commoninterface(fileList,selectmemberslist,workslist);
@ -468,9 +469,17 @@ debugger
hidestartshixunsreplacetwo=()=>{ hidestartshixunsreplacetwo=()=>{
this.setState({ this.setState({
shixunsreplace:false, shixunsreplace:false,
spinnings:false
}) })
} }
scrollToAnchor = (anchorName) => {
if (anchorName) {
// 找到锚点
let anchorElement = document.getElementById(anchorName);
// 如果对应id的锚点存在就跳转到锚点
if(anchorElement) { anchorElement.scrollIntoView({block: 'start', behavior: 'smooth'}); }
}
}
render(){ render(){
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
let {search,fileList, workslist,setvalue,minvalue,minmaxtype,Loadtype, let {search,fileList, workslist,setvalue,minvalue,minmaxtype,Loadtype,
@ -570,7 +579,7 @@ render(){
{/*<Form onSubmit={GraduationTasksnewtype===true?this.handleSubmit:"return false"}*/} {/*<Form onSubmit={GraduationTasksnewtype===true?this.handleSubmit:"return false"}*/}
{/*>*/} {/*>*/}
<div className="stud-class-set pd20 coursenavbox edu-back-white"> <div className="stud-class-set pd20 coursenavbox edu-back-white" id={"valuestypes"}>
<style>{` <style>{`
.uploadBtn.ant-btn { .uploadBtn.ant-btn {
border: none; border: none;

@ -65,12 +65,12 @@ class GraduationTasksappraise extends Component{
} }
goback=()=>{ goback=()=>{
let {datalist}=this.state; // let {datalist}=this.state;
let courseId=this.props.match.params.coursesId; // let courseId=this.props.match.params.coursesId;
let category_id=this.props.match.params.category_id; // let category_id=this.props.match.params.category_id;
//
window.location.href="/courses/"+courseId+"/graduation_tasks/"+datalist.graduation_id; // window.location.href="/courses/"+courseId+"/graduation_tasks/"+datalist.graduation_id;
window.history.go(-1)
} }
Cancelvisible=()=>{ Cancelvisible=()=>{

@ -459,15 +459,15 @@ class GraduationTaskssettingapp extends Component{
}) })
} }
//跳转道描点的地方 // //跳转道描点的地方
scrollToAnchor = (anchorName) => { // scrollToAnchor = (anchorName) => {
if (anchorName) { // if (anchorName) {
// 找到锚点 // // 找到锚点
let anchorElement = document.getElementById(anchorName); // let anchorElement = document.getElementById(anchorName);
// 如果对应id的锚点存在就跳转到锚点 // // 如果对应id的锚点存在就跳转到锚点
if(anchorElement) { anchorElement.scrollIntoView(); } // if(anchorElement) { anchorElement.scrollIntoView(); }
} // }
} // }
saveTaskssetting=()=>{ saveTaskssetting=()=>{

@ -143,13 +143,22 @@ class GraduationTaskssettinglist extends Component{
// console.log(e.target.value) // console.log(e.target.value)
let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search} = this.state; let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search} = this.state;
this.setState({ let listype =list instanceof Array;
teacher_comment:list.length===key?undefined:list[0], if(listype===false||list.length===key){
loadingstate:true this.setState({
}) teacher_comment:null,
loadingstate:true
})
}else{
this.setState({
teacher_comment:list,
loadingstate:true
})
}
if(list.length===key){
if(list.length===key){
this.seacthdata(undefined, task_status, course_group, cross_comment, order, b_order, search,this.state.page);
}else{ }else{
this.seacthdata(list[0], task_status, course_group, cross_comment, order, b_order, search,this.state.page); this.seacthdata(list[0], task_status, course_group, cross_comment, order, b_order, search,this.state.page);
@ -783,16 +792,30 @@ class GraduationTaskssettinglist extends Component{
{this.props.isAdmin()?operation.map((tag,key) => { {this.props.isAdmin()?operation.map((tag,key) => {
return( return(
<div key={key}> <div key={key}>
{/*<Tooltip placement="bottom" title={tag.name==="分配"?"指定该作品的交叉评阅人":tag.name==="调分"?<pre>调整学生最终成绩<br/>*/}
{/*其它历史评分将全部失效</pre>:""}>*/}
{/*{tag.name==="评阅"?tag.status===0?"--":<a style={{color:'#4CACFF'}} href={"/courses/"+courseId+"/graduation_tasks/"+tag.id+"/appraise"} >*/}
{/*{tag.name}*/}
{/*</a>*/}
{/*:*/}
{/*<a style={{color:tag.name==="调分"?"#000":'#4CACFF'}}*/}
{/*onClick={tag.name==="调分"?()=>this.showModulationtype(tag.id):tag.name==="分配"?()=>this.showAllocationModal(tag.id):""}>*/}
{/*{tag.status===0?"":tag.name}*/}
{/*</a>*/}
{/*}*/}
{/*</Tooltip>*/}
<Tooltip placement="bottom" title={tag.name==="分配"?"指定该作品的交叉评阅人":tag.name==="调分"?<pre>调整学生最终成绩<br/> <Tooltip placement="bottom" title={tag.name==="分配"?"指定该作品的交叉评阅人":tag.name==="调分"?<pre>调整学生最终成绩<br/>
其它历史评分将全部失效</pre>:""}> 其它历史评分将全部失效</pre>:""}>
{tag.name==="评阅"?tag.status===0?"--":<a style={{color:'#4CACFF'}} href={"/courses/"+courseId+"/graduation_tasks/"+tag.id+"/appraise"} > {tag.name==="评阅"?<a style={{color:'#4CACFF'}} href={"/courses/"+courseId+"/graduation_tasks/"+tag.id+"/appraise"} >
{tag.name} {tag.name}
</a> </a>
: :
<a style={{color:tag.name==="调分"?"#000":'#4CACFF'}} <a style={{color:tag.name==="调分"?"#000":'#4CACFF'}}
onClick={tag.name==="调分"?()=>this.showModulationtype(tag.id):tag.name==="分配"?()=>this.showAllocationModal(tag.id):""}> onClick={tag.name==="调分"?()=>this.showModulationtype(tag.id):tag.name==="分配"?()=>this.showAllocationModal(tag.id):""}>
{tag.status===0?"":tag.name} {tag.name}
</a> </a>
} }
@ -855,8 +878,7 @@ class GraduationTaskssettinglist extends Component{
) )
} }
if(taskslistdata&&taskslistdata.have_project===false){
if(taskslistdata&&taskslistdata.have_grouping===false){
columns.some((item,key)=> { columns.some((item,key)=> {
if (item.title === "关联项目") { if (item.title === "关联项目") {
@ -866,6 +888,10 @@ class GraduationTaskssettinglist extends Component{
} }
) )
}
if(taskslistdata&&taskslistdata.have_grouping===false){
columns.some((item,key)=> { columns.some((item,key)=> {
if (item.title === "分组") { if (item.title === "分组") {
@ -1087,7 +1113,7 @@ class GraduationTaskssettinglist extends Component{
{taskslistdata.search_assistants && taskslistdata.search_assistants.teacher_comment && taskslistdata.search_assistants.teacher_comment.map((item,key)=>{ {taskslistdata.search_assistants && taskslistdata.search_assistants.teacher_comment && taskslistdata.search_assistants.teacher_comment.map((item,key)=>{
return( return(
<span key={key}> <span key={key}>
<Checkbox value={item.id} key={item.id} onClick={this.funteachercomment} className="fl ">{item.name} <Checkbox value={item.id} key={item.id} className="fl ">{item.name}
<span>({item.count})</span> <span>({item.count})</span>
</Checkbox> </Checkbox>
</span> </span>
@ -1354,7 +1380,7 @@ class GraduationTaskssettinglist extends Component{
{taskslistdata.search_assistants&&taskslistdata.search_assistants.teacher_comment.map((item,key)=>{ {taskslistdata.search_assistants&&taskslistdata.search_assistants.teacher_comment.map((item,key)=>{
return( return(
<span key={key}> <span key={key}>
<Checkbox value={item.id} onClick={this.funteachercomment} className="fl ">{item.name} <Checkbox value={item.id} className="fl ">{item.name}
<span>({item.count})</span> <span>({item.count})</span>
</Checkbox> </Checkbox>
</span> </span>

@ -50,9 +50,10 @@ class GraduationTasksquestions extends Component{
} }
goback=()=>{ goback=()=>{
let courseId=this.props.match.params.coursesId; // let courseId=this.props.match.params.coursesId;
let category_id=this.props.match.params.category_id; // let category_id=this.props.match.params.category_id;
window.location.href="/courses/"+courseId+"/graduation_tasks/"+category_id; // window.location.href="/courses/"+courseId+"/graduation_tasks/"+category_id;
window.history.go(-1)
} }
end=()=>{ end=()=>{

@ -37,7 +37,7 @@ class GraduationTasks extends Component{
} }
} }
fetchAll = (search,page,order,count) => { fetchAll = (search,page,order,count) => {
debugger
const cid = this.props.match.params.coursesId const cid = this.props.match.params.coursesId
@ -553,7 +553,8 @@ class GraduationTasks extends Component{
}) })
} }
// 题库选用成功后刷新页面 // 题库选用成功后刷新页面
useBankSuccess=()=>{ useBankSuccess=(checkBoxValues,object_ids)=>{
debugger
let {search,page,order,all_count} = this.state; let {search,page,order,all_count} = this.state;
this.fetchAll(search,page,order,all_count) this.fetchAll(search,page,order,all_count)
} }
@ -650,7 +651,7 @@ class GraduationTasks extends Component{
</Link> </Link>
</WordsBtn> : ""} </WordsBtn> : ""}
{this.props.isAdmin() ?<UseBank {...this.props} {...this.state} object_type={"gtask"} useBankSuccess={this.useBankSuccess}></UseBank>:""} {this.props.isAdmin() ?<UseBank {...this.props} {...this.state} object_type={"gtask"} useBankSuccess={()=>this.useBankSuccess()}></UseBank>:""}
</React.Fragment> </React.Fragment>
} }

@ -66,7 +66,7 @@ class ShixunPathCard extends Component{
} }
</div> </div>
):( ):(
<div className="edu-tab-con-box clearfix edu-txt-center"> <div className="edu-tab-con-box clearfix edu-txt-center mb50">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/> <img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">暂无数据哦~</p> <p className="edu-nodata-p mb20">暂无数据哦~</p>
</div> </div>

@ -1,7 +1,9 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PathCard from "./ShixunPathCard.js" import PathCard from "./ShixunPathCard.js"
import axios from 'axios'; import axios from 'axios';
import {Input,Pagination} from 'antd'; import {Input} from 'antd';
import Pagination from '@icedesign/base/lib/pagination';
import '@icedesign/base/lib/pagination/style.js';
import './ShixunPaths.css' import './ShixunPaths.css'
@ -129,7 +131,7 @@ class ShixunPathSearch extends Component{
{ {
total_count > 16 && total_count > 16 &&
<div className="educontent mb80 edu-txt-center mt10"> <div className="educontent mb80 edu-txt-center mt10">
<Pagination showQuickJumper defaultCurrent={page} current={page} pageSize={16} total={total_count} onChange={this.onChange} /> <Pagination current={page} total={ total_count || 1299 } type="mini" pageSize={16} onChange={this.onChange} />
</div> </div>
} }
@ -137,4 +139,7 @@ class ShixunPathSearch extends Component{
) )
} }
} }
export default ShixunPathSearch; export default ShixunPathSearch;
// <Pagination showQuickJumper defaultCurrent={page} current={page} pageSize={16} total={total_count} onChange={this.onChange} />

@ -3,6 +3,8 @@ import React, {Component} from 'react';
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
import {getImageUrl, DragValidator} from 'educoder'; import {getImageUrl, DragValidator} from 'educoder';
import DragValidatortwo from '../../../src/common/components/DragValidatortwo'
import {Tabs, Input, Checkbox, Button, notification} from 'antd'; import {Tabs, Input, Checkbox, Button, notification} from 'antd';
import axios from 'axios'; import axios from 'axios';
import './common.css' import './common.css'
@ -21,7 +23,7 @@ class LoginRegisterComponent extends Component {
login: "", login: "",
password: "", password: "",
passwords: "", passwords: "",
seconds: 60, seconds: 35,
codes: "", codes: "",
getverificationcodes: true, getverificationcodes: true,
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
@ -29,6 +31,8 @@ class LoginRegisterComponent extends Component {
s: 'text', s: 'text',
classpass: "text", classpass: "text",
readonlyInput: true, readonlyInput: true,
dragOk: false,
Whethertoverify:false,
} }
} }
@ -57,15 +61,27 @@ class LoginRegisterComponent extends Component {
} }
//倒计时 //倒计时
getverificationcode = () => { getverificationcode = () => {
if (this.state.Phonenumberisnotcobool === false || this.state.Phonenumberisnotcobool === undefined) {
if (this.state.login && this.state.login.length === 0) { if(this.state.login === undefined || this.state.login.length===0){
this.openNotification("请输入手机号或邮箱"); this.openNotification("请输入手机号或邮箱");
return return;
} else { }
this.openNotification("请输入正确的手机号或邮箱");
} //这是判断是否手机正确
if(this.state.Phonenumberisnotcobool === true){
this.openNotification(this.state.Phonenumberisnotcos);
this.setState({
Whethertoverify:this.state.Whethertoverify===true?false:true,
})
return;
}
//拖动滑动验证
if(this.state.dragOk===undefined||this.state.dragOk === false){
this.openNotification("拖动滑块验证");
return; return;
} }
if (this.state.getverificationcodes === true) { if (this.state.getverificationcodes === true) {
this.setState({ this.setState({
getverificationcodes: undefined, getverificationcodes: undefined,
@ -78,7 +94,7 @@ class LoginRegisterComponent extends Component {
clearInterval(timer); clearInterval(timer);
this.setState({ this.setState({
getverificationcodes: false, getverificationcodes: false,
seconds: 60, seconds: 35,
}) })
} }
}); });
@ -96,7 +112,7 @@ class LoginRegisterComponent extends Component {
clearInterval(timer); clearInterval(timer);
this.setState({ this.setState({
getverificationcodes: false, getverificationcodes: false,
seconds: 60, seconds: 35,
}) })
} }
@ -115,8 +131,7 @@ class LoginRegisterComponent extends Component {
} }
}).then((result) => { }).then((result) => {
//验证有问题{"status":1,"message":"success"} //验证有问题{"status":1,"message":"success"}
console.log(result); this.openNotification("验证码已发送,请注意查收!",2);
}).catch((error) => { }).catch((error) => {
console.log(error); console.log(error);
@ -133,26 +148,28 @@ class LoginRegisterComponent extends Component {
Retrievepassword = () => { Retrievepassword = () => {
if (this.state.Phonenumberisnotcobool === false) { if (this.state.Phonenumberisnotcobool === false) {
if (this.state.login.length === 0) { if (this.state.login.length === 0) {
this.openNotification("请输入手机号或邮箱"); this.openNotification("请输入正确的手机号或邮箱");
return return
} }
this.openNotification("请输入正确的手机号或邮箱");
return;
} }
if (this.state.login === undefined || this.state.login == "") { if (this.state.login === undefined || this.state.login === "") {
this.openNotification(`请输入登录手机号码或邮箱`); this.openNotification(`请输入登录手机号码或邮箱`);
return return
} else if (this.state.password === undefined || this.state.password == "") { }
if (this.state.password === undefined || this.state.password === "") {
this.openNotification(`请输入密码`); this.openNotification(`请输入密码`);
return return
} else if (this.state.passwords === undefined || this.state.passwords == "") { }
if (this.state.passwords === undefined || this.state.passwords === "") {
this.openNotification(`请输入密码`); this.openNotification(`请输入密码`);
return return
} else if (this.state.password !== this.state.passwords) { }
if (this.state.password !== this.state.passwords) {
this.openNotification(`两次密码不相同`); this.openNotification(`两次密码不相同`);
return return
} else if (this.state.codes === undefined || this.state.codes == "") { }
if (this.state.codes === undefined || this.state.codes === "") {
this.openNotification(`请输入验证码`); this.openNotification(`请输入验证码`);
return return
} }
@ -286,6 +303,12 @@ class LoginRegisterComponent extends Component {
return return
} }
} }
//是否验证通过
dragOkCallback = () => {
console.log(this.state.login);
this.Emailphonenumberverification(this.state.login)
}
//邮箱手机号验证 //邮箱手机号验证
Emailphonenumberverification = (value) => { Emailphonenumberverification = (value) => {
var url = `/accounts/valid_email_and_phone.json`; var url = `/accounts/valid_email_and_phone.json`;
@ -295,17 +318,31 @@ class LoginRegisterComponent extends Component {
type: 2, type: 2,
} }
}).then((result) => { }).then((result) => {
//验证有问题{"status":1,"message":"success"} console.log(result);
// console.log(result); if(result){
this.openNotification("验证码已发送,请注意查收!", 2); if(result.data.status===-2){
console.log(value.length);
this.setState({
Phonenumberisnotco: result.data.message,
Phonenumberisnotcobool: true,
dragOk:false,
Whethertoverify:this.state.Whethertoverify===true?false:true,
})
return;
}else {
this.setState({
Phonenumberisnotco: undefined,
Phonenumberisnotcobool: false,
dragOk:true,
})
return;
}
}
}).catch((error) => { }).catch((error) => {
console.log(error); console.log(error);
// this.setState({
// login:"",
// logins:"",
// })
}) })
} }
@ -325,6 +362,7 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotco, Phonenumberisnotco,
readonlyInput, readonlyInput,
codes, codes,
Whethertoverify,
} = this.state } = this.state
// height: 346px; // height: 346px;
return ( return (
@ -390,9 +428,10 @@ class LoginRegisterComponent extends Component {
` `
} }
</style> </style>
{/*onBlur={(e) => this.inputOnBlur(e)}*/}
<Input style={loginInputsyl} type="text" autoComplete="off" onClick={this.changeTypey} <Input style={loginInputsyl} type="text" autoComplete="off" onClick={this.changeTypey}
className={"loginInputzhuche"} className={"loginInputzhuche"}
placeholder="输入注册手机号或邮箱" value={this.state.login} onBlur={(e) => this.inputOnBlur(e)} placeholder="输入注册手机号或邮箱" value={this.state.login}
onChange={this.loginInputonChange} style={{marginTop: '10px', height: "38px"}}></Input> onChange={this.loginInputonChange} style={{marginTop: '10px', height: "38px"}}></Input>
{ {
Phonenumberisnotco && Phonenumberisnotco != "" ? Phonenumberisnotco && Phonenumberisnotco != "" ?
@ -401,11 +440,29 @@ class LoginRegisterComponent extends Component {
</p> </p>
: <div style={{height: "25px"}}></div> : <div style={{height: "25px"}}></div>
} }
<DragValidator
height={38} successGreenColor="#29bd8b" {
style={{height: "38px", width: "100%"}} Whethertoverify===false?
dragOkCallback={this.dragOkCallback} <DragValidator
></DragValidator> height={38} successGreenColor="#29bd8b"
style={{height: "38px", width: "100%"}}
dragOkCallback={()=>this.dragOkCallback()}
></DragValidator>
:
""
}
{
Whethertoverify===true?
<DragValidatortwo
height={38} successGreenColor="#29bd8b"
style={{height: "38px", width: "100%"}}
dragOkCallback={()=>this.dragOkCallback()}
></DragValidatortwo>
:
""
}
<Input type={classpass} <Input type={classpass}
className={"loginInputzhuche"} className={"loginInputzhuche"}
onClick={this.changeType} autoComplete="new-password" onChange={this.loginInputonChanges} onClick={this.changeType} autoComplete="new-password" onChange={this.loginInputonChanges}

@ -2,11 +2,12 @@ import React, {Component} from 'react';
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
import {getImageUrl, DragValidator, broadcastChannelPostMessage} from 'educoder'; import {getImageUrl, DragValidator,broadcastChannelPostMessage} from 'educoder';
import {Tabs, Input, Checkbox, Button, notification,Menu} from 'antd'; import {Tabs, Input, Checkbox, Button, notification,Menu} from 'antd';
import passopen from '../../../src/images/login/passopen.png'; import passopen from '../../../src/images/login/passopen.png';
import passoff from '../../../src/images/login/passoff.png'; import passoff from '../../../src/images/login/passoff.png';
import axios from 'axios'; import axios from 'axios';
import DragValidatortwo from '../../../src/common/components/DragValidatortwo'
import './common.css' import './common.css'
const { TabPane } = Tabs; const { TabPane } = Tabs;
const loginInputsyl = { const loginInputsyl = {
@ -26,16 +27,17 @@ class LoginRegisterComponent extends Component {
// //
// console.log("LoginRegisterComponent"); // console.log("LoginRegisterComponent");
// console.log(props); // console.log("29");
// console.log(props.loginstatus); // console.log(props.loginstatus);
if(props.loginstatus === true){ if(props.loginstatus === true){
// console.log(props.loginstatus);
this.state = { this.state = {
tab:["0"], tab:["0"],
activeKey: 0, activeKey: 0,
classpass: "text", classpass: "text",
// 登录 // 登录
passopens: passopen, passopens: passopen,
seconds: 60, seconds: 35,
discodeBtn: false, discodeBtn: false,
clearInterval: false, clearInterval: false,
autoLogin: true, autoLogin: true,
@ -53,17 +55,19 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcos: undefined, Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
Whethertoverify:false,
} }
} }
else if(props.loginstatus === false){ if(props.loginstatus === false){
// console.log(props.loginstatus);
this.state = { this.state = {
tab:["1"], tab:["1"],
activeKey: '1', activeKey: '1',
classpass: "text", classpass: "text",
// 登录 // 登录
passopens: passopen, passopens: passopen,
seconds: 60, seconds: 35,
discodeBtn: false, discodeBtn: false,
clearInterval: false, clearInterval: false,
autoLogin: true, autoLogin: true,
@ -81,6 +85,7 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcos: undefined, Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
Whethertoverify:false,
} }
} }
@ -163,81 +168,8 @@ class LoginRegisterComponent extends Component {
return; return;
} }
} }
// var telephone = $("#telephoneAdd.tianjia_phone").val(); this.Emailphonenumberverification(value, id)
var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/;
// var email = $("#add_email.tianjia_email").val();
var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
// [1]手机号开头必须是1 [3,4,5,6,7,8] 第二位是3-8中的一个 [0-9]{9} 后边9位可以是0-9的任意数字。
var stringdata = undefined;
if (!regph.test(value)) {
stringdata = "手机号格式不正确";
if (id === 1) {
this.setState({
Phonenumberisnotco: stringdata,
Phonenumberisnotcobool: false,
})
} else if (id === 2) {
this.setState({
Phonenumberisnotcos: stringdata,
Phonenumberisnotcobool: false,
})
}
} else {
if (id === 1) {
this.setState({
Phonenumberisnotco: undefined,
Phonenumberisnotcobool: true,
})
} else if (id === 2) {
this.setState({
Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: true,
})
this.Emailphonenumberverification(value, id)
}
return
}
if (!regemail.test(value)) {
if ((value.indexOf("@") != -1) === true) {
stringdata = "邮箱格式不正确";
} else {
stringdata = "手机号格式不正确";
// if (!regph.test(value)) {
// // 这里先判断是不是手机号然后在判断是不是邮箱然后又判断是不是手机号,如果不是手机号就是账号
// stringdata=undefined;
// }
}
if (id === 1) {
this.setState({
Phonenumberisnotco: stringdata,
Phonenumberisnotcobool: false,
})
} else if (id === 2) {
this.setState({
Phonenumberisnotcos: stringdata,
Phonenumberisnotcobool: false,
})
this.Emailphonenumberverification(value, id)
}
return
} else {
if (id === 1) {
this.setState({
Phonenumberisnotco: undefined,
Phonenumberisnotcobool: true,
})
} else if (id === 2) {
this.setState({
Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: true,
})
this.Emailphonenumberverification(value, id)
}
return
}
} }
// -------------------- REGISTER START // -------------------- REGISTER START
onReadAgreementChange = (e) => { onReadAgreementChange = (e) => {
@ -245,7 +177,9 @@ class LoginRegisterComponent extends Component {
} }
//是否验证通过 //是否验证通过
dragOkCallback = () => { dragOkCallback = () => {
this.setState({dragOk: true}) console.log(this.state.logins);
this.Emailphonenumberverification(this.state.logins, 2)
} }
// -------------------- REGISTER END // -------------------- REGISTER END
@ -294,7 +228,7 @@ class LoginRegisterComponent extends Component {
} }
//注册接口 //注册接口
postregistered = () => { postregistered = () => {
if (this.state.logins === undefined || this.state.logins == "") { if (this.state.logins === undefined || this.state.logins === "") {
this.openNotification(`请输入登录手机号码或邮箱`,2); this.openNotification(`请输入登录手机号码或邮箱`,2);
return return
@ -348,14 +282,58 @@ class LoginRegisterComponent extends Component {
}).then((result) => { }).then((result) => {
//验证有问题{"status":1,"message":"success"} //验证有问题{"status":1,"message":"success"}
// console.log(result); // console.log(result);
// this.setState({dragOk: true})
if(result){
if(result.data.status===-2){
if (id === 1) {
console.log(value.length);
if(result.data.message==="该手机号码或邮箱已被注册"){
this.setState({
Phonenumberisnotco: undefined,
Phonenumberisnotcobool: false,
dragOk:true,
})
}else {
this.setState({
Phonenumberisnotco: result.data.message,
Phonenumberisnotcobool: true,
dragOk:false,
Whethertoverify:this.state.Whethertoverify===true?false:true,
})
}
return;
} else if (id === 2) {
this.setState({
Phonenumberisnotcos: result.data.message,
Phonenumberisnotcobool: true,
dragOk:false,
Whethertoverify:this.state.Whethertoverify===true?false:true,
})
return;
}
}else {
if (id === 1) {
console.log(value.length);
this.setState({
Phonenumberisnotco: undefined,
Phonenumberisnotcobool: false,
dragOk:true,
})
return;
} else if (id === 2) {
this.setState({
Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: false,
dragOk:true,
})
return;
}
}
}
}).catch((error) => { }).catch((error) => {
// console.log(error);
// this.setState({
// login:"",
// logins:"",
// })
}) })
} }
//短信验证 //短信验证
@ -398,13 +376,22 @@ class LoginRegisterComponent extends Component {
//倒计时 //倒计时
getverificationcode = () => { getverificationcode = () => {
if (this.state.Phonenumberisnotcobool === false ||this.state.Phonenumberisnotcobool === undefined) { console.log(this.state.Phonenumberisnotcobool);
if (this.state.logins&&this.state.logins.length === 0) { console.log(this.state.dragOk);
this.openNotification("请输入手机号或邮箱",2); if(this.state.logins === undefined || this.state.logins.length===0){
return this.openNotification("请输入手机号或邮箱");
}else { return;
this.openNotification("请输入正确的手机号或邮箱",2); }
} //这是判断是否手机正确
if(this.state.Phonenumberisnotcobool === true){
this.openNotification(this.state.Phonenumberisnotcos);
this.setState({
Whethertoverify:this.state.Whethertoverify===true?false:true,
})
return;
}
if(this.state.dragOk===undefined||this.state.dragOk === false){
this.openNotification("拖动滑块验证");
return; return;
} }
@ -420,7 +407,7 @@ class LoginRegisterComponent extends Component {
clearInterval(timer); clearInterval(timer);
this.setState({ this.setState({
getverificationcodes: false, getverificationcodes: false,
seconds: 60, seconds: 35,
}) })
} }
}); });
@ -438,7 +425,7 @@ class LoginRegisterComponent extends Component {
clearInterval(timer); clearInterval(timer);
this.setState({ this.setState({
getverificationcodes: false, getverificationcodes: false,
seconds: 60, seconds: 35,
}) })
} }
@ -459,9 +446,18 @@ class LoginRegisterComponent extends Component {
}else{ }else{
stirngt= e.target.value; stirngt= e.target.value;
} }
this.setState({
login: stirngt, if (e.target.value.length === 0) {
}) this.setState({
Phonenumberisnotco: undefined,
Phonenumberisnotcobool: false,
login: stirngt,
})
}else{
this.setState({
login: stirngt,
})
}
} }
//失去焦点判断 //失去焦点判断
@ -488,8 +484,7 @@ class LoginRegisterComponent extends Component {
} }
//获取注册登入 //获取注册登入
loginInputonChanges = (e) => { loginInputonChanges = (e) => {
// console.log(e.target.value); console.log(e.target.value);
var stirngt; var stirngt;
if(e.target.value.length>0){ if(e.target.value.length>0){
var str= e.target.value.replace(/\s*/g,"") var str= e.target.value.replace(/\s*/g,"")
@ -497,9 +492,17 @@ class LoginRegisterComponent extends Component {
}else{ }else{
stirngt= e.target.value; stirngt= e.target.value;
} }
this.setState({ if (e.target.value.length === 0) {
logins: stirngt, this.setState({
}) Phonenumberisnotcos: undefined,
Phonenumberisnotcobool: false,
logins: stirngt,
})
}else{
this.setState({
logins: stirngt,
})
}
} }
//获取注册密码 //获取注册密码
@ -562,8 +565,10 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotcos, Phonenumberisnotcos,
codes, codes,
tab, tab,
dragOk,
Whethertoverify,
// 注册 // 注册
readAgreement, dragOk, readAgreement,
} = this.state } = this.state
// height: 346px; // height: 346px;
if (this.state.seconds === 0) { if (this.state.seconds === 0) {
@ -685,7 +690,6 @@ class LoginRegisterComponent extends Component {
value={this.state.logins} value={this.state.logins}
type="text" autoComplete="off" type="text" autoComplete="off"
onChange={this.loginInputonChanges} onChange={this.loginInputonChanges}
onBlur={(e) => this.inputOnBlur(e, 2)}
style={{marginTop: '30px' , height: '38px',color:'#999999',fontSize:"14px"}}></Input> style={{marginTop: '30px' , height: '38px',color:'#999999',fontSize:"14px"}}></Input>
{ {
Phonenumberisnotcos && Phonenumberisnotcos != "" ? Phonenumberisnotcos && Phonenumberisnotcos != "" ?
@ -695,12 +699,29 @@ class LoginRegisterComponent extends Component {
: <div style={{height:"25px"}}></div> : <div style={{height:"25px"}}></div>
} }
{
Whethertoverify===false?
<DragValidator
height={38} className="loginInput" successGreenColor="#29bd8b"
style={{ height: '38px'}}
dragOkCallback={this.dragOkCallback}
></DragValidator>
:
""
}
{
Whethertoverify===true?
<DragValidatortwo
height={38} className="loginInput" successGreenColor="#29bd8b"
style={{ height: '38px'}}
dragOkCallback={this.dragOkCallback}
></DragValidatortwo>
:
""
}
<DragValidator
height={38} className="loginInput" successGreenColor="#29bd8b"
style={{ height: '38px'}}
dragOkCallback={this.dragOkCallback}
></DragValidator>
<div className="mt25"> <div className="mt25">
<Input className="fl mr5 font-14 color-grey-9 loginInputzhuche" name="codes" type="text" autoComplete="off" readonly <Input className="fl mr5 font-14 color-grey-9 loginInputzhuche" name="codes" type="text" autoComplete="off" readonly
@ -726,10 +747,7 @@ class LoginRegisterComponent extends Component {
</div> </div>
{/*<Input type="text" name="username"*/}
{/* style={{height: '0', width: '0', border: 'none', display: "none"}}/>*/}
{/*<Input type="password" name="password" id="password" autoComplete="new-password"*/}
{/* style={{height: '0', width: '0', border: 'none', display: "none"}}/>*/}
<style> <style>
{ {
` `

Loading…
Cancel
Save