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

dev_forum
杨树林 5 years ago
commit 16fbe898e1

@ -73,8 +73,7 @@ class UsersController < ApplicationController
@user_url = "/users/#{@user.login}"
@career = Career.where(status: true).order("created_at asc").pluck(:id, :name)
ec_user = EcSchoolUser.where(:user_id => current_user.id).first
@auth = ec_user ? "#{@old_domain}/ecs/department?school_id=#{ec_user.school_id}" : nil
@auth = User.current.ec_school.present? ? "#{@old_domain}/ecs/department?school_id=#{User.current.ec_school}" : nil
end
# 用户回复功能

@ -497,6 +497,13 @@ class User < ApplicationRecord
)
end
# 工程认证的学校
def ec_school
school_id = self.ec_school_users.pluck(:school_id).first ||
self.ec_major_schools.pluck(:school_id).first ||
(self.ec_course_users.first && self.ec_course_users.first.try(:ec_course).try(:ec_year).try(:ec_major_school).try(:school_id))
end
# 登录,返回用户名与密码匹配的用户
def self.try_to_login(login, password)
login = login.to_s.strip

@ -5,7 +5,7 @@
margin-top: 16px;
float: left;
width: 97px;}
.head-nav{float: left;width: 780px;text-align: center;height: 60px;box-sizing: border-box; min-width: 400px;}
.head-nav{float: left;width: 830px;text-align: center;height: 60px;box-sizing: border-box; min-width: 400px;}
.head-nav ul#header-nav{position: absolute;top: 0px;z-index: 3;height: 60px;box-sizing: border-box;}
.head-nav ul#header-nav li{float: left;height: 60px;line-height: 60px;margin-right: 30px;cursor: pointer;position: relative;font-size: 16px}
.head-nav ul#header-nav li a{display: block;height: 100%;width: 100%;color: #fff}

@ -3,7 +3,6 @@ import { markdownToHTML } from 'educoder'
import './MarkdownToHtml.css'
/**
selector 需要传入唯一的selector作为id不然会引起冲突
delay 如果有公式需要传入delay={true}
*/
class MarkdownToHtml extends Component{
constructor(props){
@ -11,17 +10,8 @@ class MarkdownToHtml extends Component{
this.state={
}
}
_markdownToHTML = (content, selector) => {
if (this.props.delay == true) {
(function(content, selector) {
// console.log('selector: ', selector)
// setTimeout(() => {
markdownToHTML(content, selector)
// }, 600)
})(content, selector)
} else {
markdownToHTML(content, selector)
}
_markdownToHTML = (content, selector) => {
markdownToHTML(content, selector)
}
componentDidUpdate = (prevProps) => {
if (this.props.content) {

@ -7,7 +7,7 @@ import '../poll/pollStyle.css'
import '../css/Courses.css'
import moment from 'moment'
import { WordsBtn,markdownToHTML,ActionBtn,getImageUrl } from 'educoder'
import { WordsBtn,markdownToHTML,ActionBtn,getImageUrl, MarkdownToHtml } from 'educoder'
import Modals from '../../modals/Modals'
import CoursesListType from '../coursesPublic/CoursesListType';
@ -537,7 +537,7 @@ class ExerciseReviewAndAnswer extends Component{
/>
<div className="educontent mt10 mb50">
<p className="clearfix mb20">
<WordsBtn style="grey" className="fl" to={current_user.first_category_url}>{courseName}</WordsBtn>
<WordsBtn style="grey" className="fl" to={current_user && current_user.first_category_url}>{courseName}</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn style="grey" className="fl" to={`/courses/${coursesId}/exercises/${data && data.left_banner_id}`}>{data && data.left_banner_name}</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
@ -712,7 +712,10 @@ class ExerciseReviewAndAnswer extends Component{
</span>
</p>
<li className="break_word mt15 mb15 pl30 pr30">
<p className="standardAnswer markdown-body" dangerouslySetInnerHTML={{__html: markdownToHTML(item.question_type == 5 ? item.shixun_name : item.question_title).replace(/▁/g,"▁▁▁")}}></p>
{/* <p className="standardAnswer markdown-body" dangerouslySetInnerHTML={{__html: markdownToHTML1(item.question_type == 5 ? item.shixun_name : item.question_title).replace(/▁/g,"▁▁▁")}}></p> */}
<MarkdownToHtml content={(item.question_type == 5 ? item.shixun_name : item.question_title)} selector={'answer_' + key}
className="standardAnswer"
></MarkdownToHtml>
</li>
{
// 选择题和判断题共用
@ -724,6 +727,7 @@ class ExerciseReviewAndAnswer extends Component{
questionType={item}
user_exercise_status={user_exercise_status}
changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
index={key}
></Single>
}
{
@ -736,6 +740,8 @@ class ExerciseReviewAndAnswer extends Component{
questionType={item}
user_exercise_status={user_exercise_status}
changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
index={key}
></Multiple>
}
{
@ -748,6 +754,8 @@ class ExerciseReviewAndAnswer extends Component{
questionType={item}
user_exercise_status={user_exercise_status}
changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
index={key}
></FillEmpty>
}
{
@ -774,6 +782,8 @@ class ExerciseReviewAndAnswer extends Component{
questionType={item}
user_exercise_status={user_exercise_status}
id={this.state.Id}
index={key}
></ShixunAnswer>
}

@ -1,5 +1,5 @@
import React, {Component} from "react";
import {WordsBtn,markdownToHTML} from 'educoder';
import {WordsBtn,markdownToHTML, MarkdownToHtml} from 'educoder';
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider,InputNumber, Tag,DatePicker,Radio,Tooltip,Pagination} from "antd";
import {Link,Switch,Route,Redirect} from 'react-router-dom';
import axios from 'axios';
@ -194,8 +194,10 @@ class Exercisestatisticalresult extends Component {
<span className="CACFF">{item.ques_position+"."}{item.ques_type===0?"单选":item.ques_type===1?"多选":item.ques_type===2?"判断":item.ques_type===3?"填空":item.ques_type===4?"主观":item.ques_type===5?"实训":""}</span>
<div>
{/*Q{item.ques_position}*/}
<div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(item.ques_title).replace(/▁/g,"▁▁▁")}}></div>
{/* <div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML1(item.ques_title).replace(/▁/g,"▁▁▁")}}></div> */}
<MarkdownToHtml content={item.ques_title} selector={'ques_title_' + key}
className=""
></MarkdownToHtml>
{/*<span className="markdown-body" dangerouslySetInnerHTML={createMarkup(item.ques_title)}></span>*/}
</div>
</div>

@ -87,9 +87,12 @@ class JudgeDisplay extends Component{
return (
<div key={optionIndex} className="fl mr30">
<Radio disabled checked={item.standard_boolean}></Radio>
<span>{item.choice_text}</span>
{/* <span>{item.choice_text}</span> */}
<MarkdownToHtml content={item.choice_text} selector={'judge_' + optionIndex}
className=""
></MarkdownToHtml>
{/* <span style={{ display: 'inline-block'}} className="markdown-body"
dangerouslySetInnerHTML={{__html: markdownToHTML(item.choice_text)}}></span> */}
dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
</div>)
})}

@ -70,10 +70,10 @@ class MainDisplay extends Component{
<div style={{color: '#05101A'}} className="font-16 mb5 font-bd">参考答案</div>
<MarkdownToHtml content={standard_answer[0]} selector={'answer_' + qNumber}
delay={true} className=""
className=""
></MarkdownToHtml>
{/* <div className="mainQuestionDisplay markdown-body"
dangerouslySetInnerHTML={{__html: markdownToHTML(standard_answer[0])}}
dangerouslySetInnerHTML={{__html: markdownToHTML1(standard_answer[0])}}
>
</div> */}
</React.Fragment>

@ -109,7 +109,7 @@ class NullDisplay extends Component{
<div className="answers">
{ answers.answer_text.map((item, itemIndex) => {
return <MarkdownToHtml
className="answer" key={itemIndex} delay={true}
className="answer" key={itemIndex}
content={item} selector={'null_' + (index + 1) + '' + (itemIndex + 1)}
></MarkdownToHtml>
})}

@ -82,9 +82,9 @@ class QestionDisplayHeader extends Component{
</div>
{ question_title &&
<MarkdownToHtml content={question_title} selector={'qtitle_' + (index + 1)} style={{ display: 'inline-block', width:'100%' , margin: '10px 0px 15px' }}
delay={true}
></MarkdownToHtml>
// <div className="markdown-body" dangerouslySetInnerHTML={{__html: markdownToHTML(question_title)}}
// <div className="markdown-body" dangerouslySetInnerHTML={{__html: markdownToHTML1(question_title)}}
// style={{ display: 'inline-block', width:'100%' , margin: '10px 0px 15px' }}></div>
}
</React.Fragment>

@ -101,10 +101,10 @@ class SingleDisplay extends Component{
<div className="mb10 clearfix" key={optionIndex}>
<Radio disabled className="fl lineh-20" checked={item.standard_boolean}>{prefix}</Radio>
<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1) + '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }}
delay={true}
></MarkdownToHtml>
{/* <span style={{ display: 'inline-block'}} className="markdown-body fl"
dangerouslySetInnerHTML={{__html: markdownToHTML(item.choice_text)}}></span> */}
dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
</div>)
} else {
@ -112,10 +112,10 @@ class SingleDisplay extends Component{
<div className="mb10 clearfix" key={optionIndex}>
<Checkbox disabled className="fl lineh-20" checked={item.standard_boolean}>{prefix}</Checkbox>
<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1)+ '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }}
delay={true}
></MarkdownToHtml>
{/* <span style={{ display: 'inline-block'}} className="markdown-body fl"
dangerouslySetInnerHTML={{__html: markdownToHTML(item.choice_text)}}></span> */}
dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
</div>)
}
})}

@ -1,6 +1,6 @@
import React,{ Component } from "react";
import {Checkbox,Radio, Input} from "antd";
import {DMDEditor,markdownToHTML } from 'educoder'
import {DMDEditor,markdownToHTML, MarkdownToHtml } from 'educoder'
import axios from 'axios'
@ -140,7 +140,10 @@ class fillEmpty extends Component{
{
item.answer_text && item.answer_text.map((i,index)=>{
return(
<div className="standardAnswer markdown-body answerStyle mb10" dangerouslySetInnerHTML={{__html: markdownToHTML(i)}}></div>
<MarkdownToHtml content={i} selector={'empty_' + (this.props.index + 1) +(k + 1) + (index + 1)}
className="standardAnswer answerStyle mb10"
></MarkdownToHtml>
// <div className="standardAnswer markdown-body answerStyle mb10" dangerouslySetInnerHTML={{__html: markdownToHTML1(i)}}></div>
)
})
}

@ -1,6 +1,6 @@
import React,{ Component } from "react";
import {Checkbox,Radio, Input} from "antd";
import {markdownToHTML} from 'educoder'
import {markdownToHTML, MarkdownToHtml} from 'educoder'
import axios from 'axios'
const tagArray = [
@ -51,7 +51,10 @@ class Multiple extends Component{
<p className="clearfix mb15 df">
<Checkbox className="fl lineh-20 " value={item.choice_id}>{prefix}</Checkbox>
{/* <span class="fl lineh-20 mt1"></span> */}
<span style={{display:"inline-block"}} className="markdown-body " dangerouslySetInnerHTML={{__html: markdownToHTML(item.choice_text)}}></span>
{/* <span style={{display:"inline-block"}} className="markdown-body " dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
<MarkdownToHtml content={item.choice_text} selector={'multiple_' + (this.props.index + 1) + (key + 1)}
className="" style={{display:"inline-block"}}
></MarkdownToHtml>
</p>
)
})

@ -1,6 +1,6 @@
import React,{ Component } from "react";
import {Checkbox,Radio, Input} from "antd";
import {markdownToHTML} from 'educoder'
import {markdownToHTML, MarkdownToHtml} from 'educoder'
import TPMMDEditor from '../../../../modules/tpm/challengesnew/TPMMDEditor'
import axios from 'axios'
@ -54,7 +54,10 @@ class simpleAnswer extends Component{
<li className="with100">
{
user_exercise_status == 1 ?
<div className="markdown-body answerStyle" dangerouslySetInnerHTML={{__html: markdownToHTML(questionType.user_answer.length>0 ? questionType.user_answer[0]:"")}}></div>
// <div className="markdown-body answerStyle" dangerouslySetInnerHTML={{__html: markdownToHTML1(questionType.user_answer.length>0 ? questionType.user_answer[0]:"")}}></div>
<MarkdownToHtml content={questionType.user_answer.length>0 ? questionType.user_answer[0]:""} selector={'simgle_' + (this.props.index + 1)}
className="answerStyle"
></MarkdownToHtml>
:
<div>
<TPMMDEditor ref={this.mdRef} initValue={questionType.user_answer.length > 0 ? questionType.user_answer[0]:''} mdID={'simpleEditor'+questionType.question_id} placeholder="请输入你的答案"
@ -70,7 +73,10 @@ class simpleAnswer extends Component{
exercise.answer_status == 1 || questionType.a_flag ?
<div className="standardAnswer">
<p className="mb10 font-16">参考答案</p>
<li className="markdown-body answerStyle" dangerouslySetInnerHTML={{__html: markdownToHTML(questionType.standard_answer && questionType.standard_answer[0])}}></li>
{/* <li className="markdown-body answerStyle" dangerouslySetInnerHTML={{__html: markdownToHTML1(questionType.standard_answer && questionType.standard_answer[0])}}></li> */}
<MarkdownToHtml content={questionType.standard_answer && questionType.standard_answer[0]} selector={'simgle_standard_' + (this.props.index + 1)}
className="answerStyle"
></MarkdownToHtml>
<p className="mt15"><a className="color-blue font-16" onClick={()=>this.showAndHide(false)}>隐藏参考答案</a></p>
</div>
:
@ -82,7 +88,10 @@ class simpleAnswer extends Component{
isStudent && exercise.answer_open==true && exercise.exercise_status == 3 ?
<div className="bor-top-greyE pt20 mt20 standardAnswer">
<p>参考答案</p>
<li className="markdown-body answerStyle" dangerouslySetInnerHTML={{__html: markdownToHTML(questionType.standard_answer && questionType.standard_answer[0])}}></li>
{/* <li className="markdown-body answerStyle" dangerouslySetInnerHTML={{__html: markdownToHTML1(questionType.standard_answer && questionType.standard_answer[0])}}></li> */}
<MarkdownToHtml content={questionType.standard_answer && questionType.standard_answer[0]} selector={'simgle_standard2_' + (this.props.index + 1)}
className="answerStyle"
></MarkdownToHtml>
</div>:""
}
</div>

@ -1,7 +1,7 @@
import React,{ Component } from "react";
import {Checkbox,Radio, Input} from "antd";
import {markdownToHTML} from 'educoder'
import {markdownToHTML, MarkdownToHtml} from 'educoder'
import axios from 'axios'
const tagArray = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
@ -46,7 +46,10 @@ class single extends Component{
<p className={parseInt(questionType.question_type) == 0 ? "clearfix mb15 df" : "fl mr40"}>
<Radio className="fl lineh-20" value={item.choice_id}>{prefix}</Radio>
{/* <span className="fl lineh-20 mr3 "></span> */}
<span style={{display:"inline-block", 'margin-top': '-1px'}} className="markdown-body fl " dangerouslySetInnerHTML={{__html: markdownToHTML(item.choice_text)}}></span>
{/* <span style={{display:"inline-block", 'margin-top': '-1px'}} className="markdown-body fl " dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
<MarkdownToHtml content={item.choice_text} selector={'single_' + (this.props.index + 1) + (key + 1)}
className="fl" style={{display:"inline-block", 'margin-top': '-1px'}}
></MarkdownToHtml>
</p>
)
})

@ -36,8 +36,10 @@ const buildColumns = (that) => {
key: 'login',
align:'center',
className:"color-grey-6",
render: (name, record) => {
return <span className="color-dark overflowHidden1" style={{maxWidth: '110px'}}>{name}</span>
render: (login, record) => {
return <span className="color-dark overflowHidden1" style={{maxWidth: '160px'}}
title={login && login.length > 10 ? login : ''}
>{login}</span>
}
}, {
title: '姓名',
@ -57,8 +59,8 @@ const buildColumns = (that) => {
align:'center',
className:"color-grey-6",
render: (student_id, record) => {
return <span className="color-dark overflowHidden1"
style={{maxWidth: '110px'}} >{student_id}</span>
return <span className="color-dark overflowHidden1 "title={student_id && student_id.length > 10 ? student_id : ''}
style={{maxWidth: '160px'}} >{student_id}</span>
}
}];
if (course_groups && course_groups.length) {

@ -130,7 +130,7 @@ class InfosCourse extends Component{
this.props.current_user && this.props.current_user.user_identity != "学生" ? <Create href={"/courses/new"} name={"新建课堂"} index="1"></Create> : ""
}
{
(!data || data.courses.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" ) && <NoneData></NoneData>
(!data || data.courses.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && <NoneData></NoneData>
}
{
data && data.courses && data.courses.map((item,key)=>{
@ -147,7 +147,7 @@ class InfosCourse extends Component{
{
item.can_visited ==false?
<div className="closeSquare">
<img src={getImageUrl("/images/educoder/icon/lockclose.svg")} className="mt80 mb25"/>
<img src={getImageUrl("images/educoder/icon/lockclose.svg")} className="mt80 mb25"/>
<p className="font-14 color-white">非成员不能访问</p>
</div>:""
}

@ -152,7 +152,7 @@ class InfosPath extends Component{
this.props.current_user && this.props.current_user.user_identity != "学生" ? <Create href={"/paths/new"} name={"新建实践课程"} index="3"></Create>:""
}
{
(!data || data.subjects.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" ) && <NoneData></NoneData>
(!data || data.subjects.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && <NoneData></NoneData>
}
{
data && data.subjects && data.subjects.map((item,key)=>{

@ -125,7 +125,7 @@ class InfosProject extends Component{
<Create href={`${this.props.Headertop && this.props.Headertop.old_url}/projects/new`} name={"新建项目"} index="4"></Create>:""
}
{
(!data || data.projects.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" ) && <NoneData></NoneData>
(!data || data.projects.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && <NoneData></NoneData>
}
{
data && data.projects && data.projects.map((item,key)=>{
@ -142,7 +142,7 @@ class InfosProject extends Component{
{
item.can_visited ==false?
<div className="closeSquare">
<img src={getImageUrl("/images/educoder/icon/lockclose.svg")} className="mt80 mb25"/>
<img src={getImageUrl("images/educoder/icon/lockclose.svg")} className="mt80 mb25"/>
<p className="font-14 color-white">非成员不能访问</p>
</div>:""
}

@ -161,7 +161,7 @@ class InfosShixun extends Component{
<Create href={"/shixuns/new"} name={"新建实训"} index="2"></Create>:""
}
{
(!data || data.shixuns.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" ) && <NoneData></NoneData>
(!data || data.shixuns.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && <NoneData></NoneData>
}
{
data && data.shixuns && data.shixuns.map((item,key)=>{

@ -5,7 +5,7 @@
margin-top: 16px;
float: left;
width: 97px;}
.head-nav{float: left;width: 780px;text-align: center;height: 60px;box-sizing: border-box; min-width: 400px;}
.head-nav{float: left;width:830px;text-align: center;height: 60px;box-sizing: border-box; min-width: 400px;}
.head-nav ul#header-nav{position: absolute;top: 0px;z-index: 3;height: 60px;box-sizing: border-box;}
.head-nav ul#header-nav li{float: left;height: 60px;line-height: 60px;margin-right: 30px;cursor: pointer;position: relative;font-size: 16px}
.head-nav ul#header-nav li a{display: block;height: 100%;width: 100%;color: #fff}

Loading…
Cancel
Save