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

dev_hs
daiao 6 years ago
commit e769d1d830

@ -80,6 +80,11 @@ class HomeworkCommon < ApplicationRecord
end end
end end
# 实训作业的主目录信息
def main_category_info
{category_id: course.shixun_course_modules.take.try(:id), category_name: course.shixun_course_modules.take.try(:module_name)}
end
# 根据是否统一发布获取作业的作品列表 # 根据是否统一发布获取作业的作品列表
def all_works def all_works
student_works = self.unified_setting ? self.student_works : student_works = self.unified_setting ? self.student_works :

@ -41,7 +41,7 @@ class Subject < ApplicationRecord
# 挑战过路径的成员数(金课统计去重后的报名人数) # 挑战过路径的成员数(金课统计去重后的报名人数)
def member_count def member_count
excellent && CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).uniq.length > 0 ? excellent && CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).uniq.length > shixuns.pluck(:myshixuns_count).sum ?
CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).uniq.length : shixuns.pluck(:myshixuns_count).sum CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).uniq.length : shixuns.pluck(:myshixuns_count).sum
end end

@ -2,6 +2,7 @@ json.course_id course.id
json.course_name course.name json.course_name course.name
json.is_end course.is_end json.is_end course.is_end
json.category homework.category_info json.category homework.category_info
json.main_category homework.main_category_info if homework.homework_type == "practice"
member = course.course_members.find_by(user_id: user.id, is_active: 1) member = course.course_members.find_by(user_id: user.id, is_active: 1)
curr_status = homework_curr_status(homework, user.course_identity(course), course, member, member&.teacher_course_groups) curr_status = homework_curr_status(homework, user.course_identity(course), course, member, member&.teacher_course_groups)
json.homework_status curr_status[:status] json.homework_status curr_status[:status]

@ -350,7 +350,7 @@ class BoardsNew extends Component{
}], }],
})( })(
<Input placeholder={`请输入帖子标题,最大限制${MAX_TITLE_LENGTH}个字符 `}className="searchViewAfter" maxLength={MAX_TITLE_LENGTH} <Input placeholder={`请输入帖子标题,最大限制${MAX_TITLE_LENGTH}个字符 `}className="searchViewAfter" maxLength={MAX_TITLE_LENGTH}
onInput={this.changeTitle} addonAfter={`${title_num}/${MAX_TITLE_LENGTH}`} /> onInput={this.changeTitle} suffix={`${title_num}/${MAX_TITLE_LENGTH}`} />
)} )}
</Form.Item> </Form.Item>

@ -399,7 +399,7 @@ class NewWork extends Component{
required: true, message: '请输入标题' required: true, message: '请输入标题'
}], }],
})( })(
<Input placeholder="请输入作业标题最大限制60个字符" onInput={this.changeTitle} className="searchView searchViewAfter" style={{"width":"100%"}} maxLength={MAX_TITLE_LENGTH} addonAfter={`${String(title_num)}/${MAX_TITLE_LENGTH}`}/> <Input placeholder="请输入作业标题最大限制60个字符" onInput={this.changeTitle} className="searchView searchViewAfter" style={{"width":"100%"}} maxLength={MAX_TITLE_LENGTH} suffix={`${String(title_num)}/${MAX_TITLE_LENGTH}`}/>
)} )}
</Form.Item> </Form.Item>
<style>{` <style>{`

@ -48,8 +48,8 @@ class Addcourses extends Component{
} }
componentDidUpdate = (prevProps) => { componentDidUpdate = (prevProps) => {
console.log(prevProps); // console.log(prevProps);
console.log(this.props); // console.log(this.props);
if(prevProps.occupation!==this.props.occupation){ if(prevProps.occupation!==this.props.occupation){
this.setState({ this.setState({
Addcoursestype:false, Addcoursestype:false,
@ -222,8 +222,8 @@ class Addcourses extends Component{
student:student student:student
} }
).then((response) => { ).then((response) => {
console.log("submittojoinclass"); // console.log("submittojoinclass");
console.log(response); // console.log(response);
if(response === undefined){ if(response === undefined){
this.setState({ this.setState({
// Addcoursestype:false, // Addcoursestype:false,
@ -302,7 +302,7 @@ class Addcourses extends Component{
isSpin:false isSpin:false
}); });
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error);
this.setState({ this.setState({
Addcoursestype:false, Addcoursestype:false,
isSpin:false isSpin:false
@ -326,8 +326,8 @@ class Addcourses extends Component{
Addcoursestypes Addcoursestypes
}=this.state; }=this.state;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />; const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
console.log("Addcourses"); // console.log("Addcourses");
console.log(Addcoursestypes) // console.log(Addcoursestypes)
return( return(
<div> <div>
<Modals <Modals

@ -451,7 +451,7 @@ class ExerciceNew extends Component{
}], }],
})( */} })( */}
<Input placeholder={`请输入试卷标题,最大限制${TITLE_MAX_LENGTH}个字符`} maxLength={TITLE_MAX_LENGTH} className="input-100-40 mt5" value={exercise_name} <Input placeholder={`请输入试卷标题,最大限制${TITLE_MAX_LENGTH}个字符`} maxLength={TITLE_MAX_LENGTH} className="input-100-40 mt5" value={exercise_name}
onChange={this.exercise_name_change} addonAfter={`${exercise_name ? exercise_name.length : 0}/${TITLE_MAX_LENGTH}`} onChange={this.exercise_name_change} suffix={`${exercise_name ? exercise_name.length : 0}/${TITLE_MAX_LENGTH}`}
/> />
{/* )} */} {/* )} */}
</Form.Item> </Form.Item>

@ -479,6 +479,12 @@ class ExerciseReviewAndAnswer extends Component{
}) })
} }
// 返回
returnBtn = () =>{
let coursesId=this.props.match.params.coursesId;
let eId=this.props.match.params.Id;
this.props.history.push(`/courses/${coursesId}/exercises/${eId}/student_exercise_list?tab=0`)
}
render(){ render(){
let coursesId=this.props.match.params.coursesId; let coursesId=this.props.match.params.coursesId;
@ -561,7 +567,7 @@ class ExerciseReviewAndAnswer extends Component{
</span> </span>
{ {
(isAdmin || ( isStudent && exercise && user_exercise_status == 1)) ? (isAdmin || ( isStudent && exercise && user_exercise_status == 1)) ?
<WordsBtn className="fr font-16 lineh-40" style="grey" onClick={()=>this.props.history.goBack()}>返回</WordsBtn> <WordsBtn className="fr font-16 lineh-40" style="grey" onClick={this.returnBtn}>返回</WordsBtn>
: :
time && time != 0 ? time && time != 0 ?
<div className="fr remainingTime"> <div className="fr remainingTime">

@ -316,7 +316,7 @@ class shixunAnswer extends Component{
</span> </span>
<span className="fl mt3 font-16"> <span className="fl mt3 font-16">
<span className="font-bd mr15">{item[0].position}</span> <span className="font-bd mr15">{item[0].position}</span>
<Link to={ "/tasks/" + item[0].game_identifier }> <Link to={ "/tasks/" + item[0].game_identifier } style={{"cursor":"pointer"}}>
<span className={"font-16"}>{item[0].name}</span> <span className={"font-16"}>{item[0].name}</span>
</Link> </Link>
</span> </span>

@ -149,7 +149,7 @@ class Eduinforms extends Component{
</div> </div>
: :
<div className="edu-back-white "> <div className="edu-back-white ">
<div id="MakedownHTML" className={"markdown-body fonttext yslmtopcg"} dangerouslySetInnerHTML={{__html: markdownToHTML(description).replace(/▁/g, "▁▁▁")}}> <div id="MakedownHTML" className={"markdown-body fonttext yslmtopcg"} style={{minHeight:"400px"}} dangerouslySetInnerHTML={{__html: markdownToHTML(description).replace(/▁/g, "▁▁▁")}}>
</div> </div>

@ -379,7 +379,7 @@ class GraduationTasksedit extends Component{
<Form.Item label="任务标题" > <Form.Item label="任务标题" >
{getFieldDecorator('name', { {getFieldDecorator('name', {
rules: [{ required: true, message: "请输入标题" }], rules: [{ required: true, message: "请输入标题" }],
})(<Input placeholder="请输入任务名称最大限制60个字符" value={name} onInput={this.changeTitle} className="searchView searchViewAfter" style={{"width":"100%"}} maxLength="60" addonAfter={String(title_num)}/>)} })(<Input placeholder="请输入任务名称最大限制60个字符" value={name} onInput={this.changeTitle} className="searchView searchViewAfter" style={{"width":"100%"}} maxLength="60" suffix={String(title_num)}/>)}
</Form.Item> </Form.Item>
<input type="hidden" id='nametypes' /> <input type="hidden" id='nametypes' />
</div> </div>

@ -384,7 +384,7 @@ class GraduationTasksnew extends Component {
rules: [{required: true, message: "不能为空"}], rules: [{required: true, message: "不能为空"}],
})(<Input placeholder="请输入任务名称最大限制60个字符" value={title_value} onInput={this.changeTitle} })(<Input placeholder="请输入任务名称最大限制60个字符" value={title_value} onInput={this.changeTitle}
className="searchView searchViewAfter h40" style={{"width": "100%"}} maxLength="60" className="searchView searchViewAfter h40" style={{"width": "100%"}} maxLength="60"
addonAfter={String(title_num)}/>)} suffix={String(title_num)}/>)}
</Form.Item> </Form.Item>
<input type="hidden" id='nametypes' /> <input type="hidden" id='nametypes' />
</div> </div>

@ -366,7 +366,7 @@ class GraduateTopicNew extends Component{
max: 60, message: '最大限制为60个字符', max: 60, message: '最大限制为60个字符',
}], }],
})( })(
<Input placeholder="请输入帖子选题名称最大限制60个字符" maxLength="60" onInput={this.changeTopicName} autoComplete="off" addonAfter={String(addonAfter)} className="searchViewAfter" /> <Input placeholder="请输入帖子选题名称最大限制60个字符" maxLength="60" onInput={this.changeTopicName} autoComplete="off" suffix={String(addonAfter)} className="searchViewAfter" />
)} )}
</Form.Item> </Form.Item>
</div> </div>

@ -136,7 +136,7 @@ class PollDetailIndex extends Component{
<span className="mt3 fl" style={{height:"25px"}}> <span className="mt3 fl" style={{height:"25px"}}>
<CoursesListType typelist={[`${map[pollDetail && pollDetail.polls_status]}`]} typesylename={""} /> <CoursesListType typelist={[`${map[pollDetail && pollDetail.polls_status]}`]} typesylename={""} />
</span> </span>
<WordsBtn className="fr font-16 mt2" style="grey" onClick={()=>this.props.history.goBack()}>返回</WordsBtn> <WordsBtn className="fr font-16 mt2" style="grey" to={`/courses/${this.props.match.params.coursesId}/polls/${user_permission && user_permission.left_banner_id}`}>返回</WordsBtn>
</p> </p>
<div> <div>
<div className="clearfix edu-back-white pl30 pr30 bor-bottom-greyE"> <div className="clearfix edu-back-white pl30 pr30 bor-bottom-greyE">

@ -327,7 +327,7 @@ class PollInfo extends Component{
<span className="color-grey-3 font-24 fl task-hide break-word" style={{maxWidth:"900px",lineHeight:"30px"}}>{poll && poll.polls_name}</span> <span className="color-grey-3 font-24 fl task-hide break-word" style={{maxWidth:"900px",lineHeight:"30px"}}>{poll && poll.polls_name}</span>
<CoursesListType typelist={[`${statudmap[poll && poll.poll_status]}`]} typesylename={""} /> <CoursesListType typelist={[`${statudmap[poll && poll.poll_status]}`]} typesylename={""} />
{ {
isAdmin || (poll && poll.user_poll_status == 1) ? <WordsBtn className="fr font-16 mt5" style="grey" onClick={()=>this.props.history.goBack()}>返回</WordsBtn> :'' isAdmin || (poll && poll.user_poll_status == 1) ? <WordsBtn className="fr font-16 mt5" style="grey" to={`/courses/${coursesId}/polls/${this.props.match.params.pollId}/detail`}>返回</WordsBtn> :''
} }
</p> </p>

@ -1,6 +1,9 @@
import React, {Component} from "react"; import React, {Component} from "react";
import {Form, Input, Tooltip, Checkbox, Radio, Select, message, Modal, Button} from 'antd' import {Form, Input, Tooltip, Checkbox, Radio, Select, message, Modal, Button} from 'antd'
import {WordsBtn, ActionBtn} from 'educoder' import {WordsBtn, ActionBtn} from 'educoder'
import {Link} from 'react-router-dom'
import '../css/members.css' import '../css/members.css'
import "../common/formCommon.css" import "../common/formCommon.css"
@ -65,6 +68,8 @@ class PollNew extends Component {
cancellation: false, cancellation: false,
bindingid:undefined, bindingid:undefined,
Newdisplay:false, Newdisplay:false,
first_category_url:"",
left_banner_id:"",
} }
// console.log("试卷新建和编辑"); // console.log("试卷新建和编辑");
// console.log(JSON.stringify(props)); // console.log(JSON.stringify(props));
@ -72,6 +77,7 @@ class PollNew extends Component {
} }
changeTopicName = (e) => { changeTopicName = (e) => {
console.log("调用了changeTopicName");
let num = 60 - parseInt(e.target.value.length); let num = 60 - parseInt(e.target.value.length);
this.setState({ this.setState({
addonAfter: num < 0 ? 0 : num addonAfter: num < 0 ? 0 : num
@ -124,8 +130,35 @@ class PollNew extends Component {
console.log("问卷返回"); console.log("问卷返回");
console.log(this.props); console.log(this.props);
try {
if(this.props.current_user!==undefined){
this.setState({
first_category_url :this.props.current_user.first_category_url,
});
console.log("=======================");
console.log(this.props.current_user.first_category_url);
}
}catch (e) {
console.log("12312312312")
console.log(e);
}
};
componentDidUpdate = (prevProps) => {
// console.log("componentDidUpdate");
// console.log(prevProps);
// console.log(this.props);
if(prevProps.current_user!=this.props.current_user){
if(this.props.current_user!==undefined){
// console.log(this.props.current_user.login);
// console.log(prevProps.current_user.login);
this.setState({
first_category_url :this.props.current_user.first_category_url,
})
}
}
} }
//获取权限 //获取权限
// getPollInfo(){ // getPollInfo(){
// // console.log(this.props.match); // // console.log(this.props.match);
@ -144,12 +177,12 @@ class PollNew extends Component {
// } // }
//初始化请求网络 //初始化请求网络
Initializatio_data = () => { Initializatio_data = () => {
// console.log("Initializatio_data 582") console.log("Initializatio_data 582")
//课堂id //课堂id
let coursesId = this.props.match.params.coursesId; let coursesId = this.props.match.params.coursesId;
//时间id //时间id
let pollid = this.props.match.params.pollid; let pollid = this.props.match.params.pollid;
// console.log(pollid); console.log(pollid);
// let coursesId = 557; // let coursesId = 557;
if (pollid === undefined) { if (pollid === undefined) {
// console.log("没有问卷新建问卷~~~") // console.log("没有问卷新建问卷~~~")
@ -215,6 +248,19 @@ class PollNew extends Component {
polls_nametest: result.data.poll.polls_name, polls_nametest: result.data.poll.polls_name,
polls_descriptiontest: result.data.poll.polls_description, polls_descriptiontest: result.data.poll.polls_description,
}); });
if(result.data){
if(result.data.poll){
if(result.data.poll.polls_name){
let num = 60 - parseInt(result.data.poll.polls_name.length);
this.setState({
addonAfter: num < 0 ? 0 : num
})
}
}
}
this.setState({ this.setState({
projects: result.data, projects: result.data,
pollid: pollid, pollid: pollid,
@ -229,6 +275,7 @@ class PollNew extends Component {
polls_nametest: result.data.poll.polls_name, polls_nametest: result.data.poll.polls_name,
polls_descriptiontest: result.data.poll.polls_description, polls_descriptiontest: result.data.poll.polls_description,
questionnair: true, questionnair: true,
left_banner_id:result.data.left_banner_id
}) })
// console.log(this.state.polls_nametest) // console.log(this.state.polls_nametest)
// console.log(this.state.polls_descriptiontest) // console.log(this.state.polls_descriptiontest)
@ -2338,10 +2385,13 @@ class PollNew extends Component {
} }
gotohome=()=>{ gotohome=()=>{
// const { current_user} = this.props // const { current_user} = this.props
if(this.state.first_category_url){
window.location.href=this.state.first_category_url;
}else{
this.props.history.goBack();
}
// this.props.history.push(current_user && current_user.first_category_url);
// //
this.props.history.goBack()
// let courseId=this.props.match.params.coursesId; // let courseId=this.props.match.params.coursesId;
// if(courseId===undefined){ // if(courseId===undefined){
// this.props.history.push("/courses"); // this.props.history.push("/courses");
@ -2360,6 +2410,7 @@ class PollNew extends Component {
readOnlys, readOnlys,
newoption, newoption,
cancellation, cancellation,
left_banner_id
} = this.state } = this.state
//获取老师权限 //获取老师权限
// console.log("[`${maps[polls_status && polls_status]}`]]"); // console.log("[`${maps[polls_status && polls_status]}`]]");
@ -2404,16 +2455,29 @@ class PollNew extends Component {
<p className="clearfix mb20 mt10"> <p className="clearfix mb20 mt10">
<a className=" btn colorgrey fl hovercolorblue" onClick={()=>this.gotohome()}>{this.props.coursedata.name}</a> <a className=" btn colorgrey fl hovercolorblue" onClick={()=>this.gotohome()}>{this.props.coursedata.name}</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span> <span className="color-grey-9 fl ml3 mr3">&gt;</span>
<a className=" btn colorgrey fl hovercolorblue" {
href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}>问卷</a> this.props.match.params.news === "new"?
<a className=" btn colorgrey fl hovercolorblue"
href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}>问卷</a>
:
<a className=" btn colorgrey fl hovercolorblue"
href={`/courses/${this.props.match.params.coursesId}/polls/${left_banner_id}`}>问卷</a>
}
<span className="color-grey-9 fl ml3 mr3">&gt;</span> <span className="color-grey-9 fl ml3 mr3">&gt;</span>
<span>{this.props.match.params.news === undefined ? "新建" : this.props.match.params.news === "new" ? "新建" : "编辑"}</span> <span>{this.props.match.params.news === undefined ? "新建" : this.props.match.params.news === "new" ? "新建" : "编辑"}</span>
</p> </p>
<div className="clearfix mb30"> <div className="clearfix mb30">
<p <p
className="fl color-black summaryname mt5">{this.props.match.params.news === undefined ? "新建问卷" : this.props.match.params.news === "new" ? "新建问卷" : "编辑问卷"}</p> className="fl color-black summaryname mt5">{this.props.match.params.news === undefined ? "新建问卷" : this.props.match.params.news === "new" ? "新建问卷" : "编辑问卷"}</p>
<a onClick={()=>this.gotohome()} {
className=" fr font-16">返回</a> this.props.match.params.news === "new" ?
<a href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}
className=" fr font-16">返回</a>
:
<a href={`/courses/${this.props.match.params.coursesId}/polls/${left_banner_id}`}
className=" fr font-16">返回</a>
}
</div> </div>
{/*<Form {...formItemLayout} onSubmit={this.handleSubmit}>*/} {/*<Form {...formItemLayout} onSubmit={this.handleSubmit}>*/}
@ -2461,12 +2525,13 @@ class PollNew extends Component {
} }
</div> </div>
{/*suffix={String(addonAfter)}*/}
<Input placeholder="请输入问卷标题最大限制60个字符" maxLength="60" <Input placeholder="请输入问卷标题最大限制60个字符" maxLength="60"
style={{"margin-top": "15px", "text-align": "left"}} style={{"margin-top": "15px", "text-align": "left"}}
onInput={this.changeTopicName} onInput={this.changeTopicName}
readOnly={readOnlys} readOnly={readOnlys}
autoComplete="off" addonAfter={String(addonAfter)} autoComplete="off"
suffix={String(addonAfter)+"/60"}
value={this.state.polls_nametest} value={this.state.polls_nametest}
className="searchViewAfter"></Input> className="searchViewAfter"></Input>
@ -2491,7 +2556,7 @@ class PollNew extends Component {
readOnly={readOnlys} readOnly={readOnlys}
onInput={this.changeTopicNametwo} onInput={this.changeTopicNametwo}
value={this.state.polls_descriptiontest} value={this.state.polls_descriptiontest}
autoComplete="off" addonAfter={"100"}></TextArea> autoComplete="off" suffix={"100"}></TextArea>
{ {
this.state.Newedit === true || this.state.mysave === true ? this.state.Newedit === true || this.state.mysave === true ?
<div> <div>

@ -1019,8 +1019,8 @@ class ShixunHomework extends Component{
<div className="edu-back-white"> <div className="edu-back-white">
<p className="clearfix padding30 bor-bottom-greyE"> <p className="clearfix padding30 bor-bottom-greyE">
<p style={{height: '20px'}}> <p style={{height: '20px'}}>
{/*<span className="font-18 fl color-dark-21">{datas&&datas.category_name===undefined||datas&&datas.category_name===null?datas&&datas.main_category_name:datas&&datas.category_name+" 作业列表"}</span>*/} <span className="font-18 fl color-dark-21">{datas&&datas.category_name===undefined||datas&&datas.category_name===null?datas&&datas.main_category_name:datas&&datas.category_name+" 作业列表"}</span>
<span className="font-18 fl color-dark-21">实训作业</span> {/* <span className="font-18 fl color-dark-21">实训作业</span>*/}
<li className="fr"> <li className="fr">
{this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null? {this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?
<span> <span>

@ -77,7 +77,7 @@ function EditVideoModal (props) {
}], }],
})( })(
<Input placeholder="" className="titleInput" maxLength={MAX_LENGTH} <Input placeholder="" className="titleInput" maxLength={MAX_LENGTH}
addonAfter={String(_title ? `${String(_title.length)}/${MAX_LENGTH}` : 0)} /> suffix={String(_title ? `${String(_title.length)}/${MAX_LENGTH}` : 0)} />
)} )}
</Form.Item> </Form.Item>
</ModalWrapper> </ModalWrapper>

Loading…
Cancel
Save