diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 23f6870c8..a1f6a5495 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 # 用户回复功能 diff --git a/app/models/user.rb b/app/models/user.rb index f2d9c7fb1..a95776be9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/public/react/public/css/edu-all.css b/public/react/public/css/edu-all.css index da28fb736..a9e24da3d 100644 --- a/public/react/public/css/edu-all.css +++ b/public/react/public/css/edu-all.css @@ -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} diff --git a/public/react/src/common/components/markdown/MarkdownToHtml.js b/public/react/src/common/components/markdown/MarkdownToHtml.js index c7d15cf64..63733165e 100644 --- a/public/react/src/common/components/markdown/MarkdownToHtml.js +++ b/public/react/src/common/components/markdown/MarkdownToHtml.js @@ -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) { diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js index cd3355082..778829d72 100644 --- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js +++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js @@ -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{ />

- {courseName} + {courseName} > {data && data.left_banner_name} > @@ -712,7 +712,10 @@ class ExerciseReviewAndAnswer extends Component{

  • -

    + {/*

    */} +
  • { // 选择题和判断题共用 @@ -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} > } { @@ -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} + > } { @@ -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} + > } { @@ -774,6 +782,8 @@ class ExerciseReviewAndAnswer extends Component{ questionType={item} user_exercise_status={user_exercise_status} id={this.state.Id} + index={key} + > } diff --git a/public/react/src/modules/courses/exercise/Exercisestatisticalresult.js b/public/react/src/modules/courses/exercise/Exercisestatisticalresult.js index 6e7b52715..1771d87b3 100644 --- a/public/react/src/modules/courses/exercise/Exercisestatisticalresult.js +++ b/public/react/src/modules/courses/exercise/Exercisestatisticalresult.js @@ -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 { {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?"实训":""}题
    {/*Q{item.ques_position}:*/} -
    - + {/*
    */} + {/**/}
    diff --git a/public/react/src/modules/courses/exercise/new/JudgeDisplay.js b/public/react/src/modules/courses/exercise/new/JudgeDisplay.js index 7beaa50e5..0f8930a8a 100644 --- a/public/react/src/modules/courses/exercise/new/JudgeDisplay.js +++ b/public/react/src/modules/courses/exercise/new/JudgeDisplay.js @@ -87,9 +87,12 @@ class JudgeDisplay extends Component{ return (
    - {item.choice_text} + {/* {item.choice_text} */} + {/* */} + dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}> */}
    ) })} diff --git a/public/react/src/modules/courses/exercise/new/MainDisplay.js b/public/react/src/modules/courses/exercise/new/MainDisplay.js index 0581865d7..44a795374 100644 --- a/public/react/src/modules/courses/exercise/new/MainDisplay.js +++ b/public/react/src/modules/courses/exercise/new/MainDisplay.js @@ -70,10 +70,10 @@ class MainDisplay extends Component{
    参考答案:
    {/*
    */} diff --git a/public/react/src/modules/courses/exercise/new/NullDisplay.js b/public/react/src/modules/courses/exercise/new/NullDisplay.js index eade97474..079b1194f 100644 --- a/public/react/src/modules/courses/exercise/new/NullDisplay.js +++ b/public/react/src/modules/courses/exercise/new/NullDisplay.js @@ -109,7 +109,7 @@ class NullDisplay extends Component{
    { answers.answer_text.map((item, itemIndex) => { return })} diff --git a/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js b/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js index 7b82b14b6..c90d87dac 100644 --- a/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js +++ b/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js @@ -82,9 +82,9 @@ class QestionDisplayHeader extends Component{
    { question_title && - //
    } diff --git a/public/react/src/modules/courses/exercise/new/SingleDisplay.js b/public/react/src/modules/courses/exercise/new/SingleDisplay.js index cbb6da827..bce4dc4c1 100644 --- a/public/react/src/modules/courses/exercise/new/SingleDisplay.js +++ b/public/react/src/modules/courses/exercise/new/SingleDisplay.js @@ -101,10 +101,10 @@ class SingleDisplay extends Component{
    {prefix} {/* */} + dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}> */}
    ) } else { @@ -112,10 +112,10 @@ class SingleDisplay extends Component{
    {prefix} {/* */} + dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}> */}
    ) } })} diff --git a/public/react/src/modules/courses/exercise/question/fillEmpty.js b/public/react/src/modules/courses/exercise/question/fillEmpty.js index 79bc164d8..5179432a2 100644 --- a/public/react/src/modules/courses/exercise/question/fillEmpty.js +++ b/public/react/src/modules/courses/exercise/question/fillEmpty.js @@ -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( -
    + + //
    ) }) } diff --git a/public/react/src/modules/courses/exercise/question/multiple.js b/public/react/src/modules/courses/exercise/question/multiple.js index 3ef3d960f..7e96f8550 100644 --- a/public/react/src/modules/courses/exercise/question/multiple.js +++ b/public/react/src/modules/courses/exercise/question/multiple.js @@ -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{

    {prefix} {/* */} - + {/* */} +

    ) }) diff --git a/public/react/src/modules/courses/exercise/question/simpleAnswer.js b/public/react/src/modules/courses/exercise/question/simpleAnswer.js index 240f775c2..527044968 100644 --- a/public/react/src/modules/courses/exercise/question/simpleAnswer.js +++ b/public/react/src/modules/courses/exercise/question/simpleAnswer.js @@ -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{
  • { user_exercise_status == 1 ? -
    0 ? questionType.user_answer[0]:"")}}>
    + //
    0 ? questionType.user_answer[0]:"")}}>
    + 0 ? questionType.user_answer[0]:""} selector={'simgle_' + (this.props.index + 1)} + className="answerStyle" + > :
    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 ?

    参考答案:

    -
  • + {/*
  • */} +

    this.showAndHide(false)}>隐藏参考答案

    : @@ -82,7 +88,10 @@ class simpleAnswer extends Component{ isStudent && exercise.answer_open==true && exercise.exercise_status == 3 ?

    参考答案:

    -
  • + {/*
  • */} +
    :"" } diff --git a/public/react/src/modules/courses/exercise/question/single.js b/public/react/src/modules/courses/exercise/question/single.js index 4ff4bf12b..510c28b48 100644 --- a/public/react/src/modules/courses/exercise/question/single.js +++ b/public/react/src/modules/courses/exercise/question/single.js @@ -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{

    {prefix} {/* */} - + {/* */} +

    ) }) diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index 363d06c54..6780948ef 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -36,8 +36,10 @@ const buildColumns = (that) => { key: 'login', align:'center', className:"color-grey-6", - render: (name, record) => { - return {name} + render: (login, record) => { + return 10 ? login : ''} + >{login} } }, { title: '姓名', @@ -57,8 +59,8 @@ const buildColumns = (that) => { align:'center', className:"color-grey-6", render: (student_id, record) => { - return {student_id} + return 10 ? student_id : ''} + style={{maxWidth: '160px'}} >{student_id} } }]; if (course_groups && course_groups.length) { diff --git a/public/react/src/modules/user/usersInfo/InfosCourse.js b/public/react/src/modules/user/usersInfo/InfosCourse.js index ff5321a9f..2f7d206b8 100644 --- a/public/react/src/modules/user/usersInfo/InfosCourse.js +++ b/public/react/src/modules/user/usersInfo/InfosCourse.js @@ -130,7 +130,7 @@ class InfosCourse extends Component{ this.props.current_user && this.props.current_user.user_identity != "学生" ? : "" } { - (!data || data.courses.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" ) && + (!data || data.courses.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && } { data && data.courses && data.courses.map((item,key)=>{ @@ -147,7 +147,7 @@ class InfosCourse extends Component{ { item.can_visited ==false?
    - +

    非成员不能访问

    :"" } diff --git a/public/react/src/modules/user/usersInfo/InfosPath.js b/public/react/src/modules/user/usersInfo/InfosPath.js index 759527a6e..d23739280 100644 --- a/public/react/src/modules/user/usersInfo/InfosPath.js +++ b/public/react/src/modules/user/usersInfo/InfosPath.js @@ -152,7 +152,7 @@ class InfosPath extends Component{ this.props.current_user && this.props.current_user.user_identity != "学生" ? :"" } { - (!data || data.subjects.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" ) && + (!data || data.subjects.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && } { data && data.subjects && data.subjects.map((item,key)=>{ diff --git a/public/react/src/modules/user/usersInfo/InfosProject.js b/public/react/src/modules/user/usersInfo/InfosProject.js index 6c1f4a666..195e98b73 100644 --- a/public/react/src/modules/user/usersInfo/InfosProject.js +++ b/public/react/src/modules/user/usersInfo/InfosProject.js @@ -125,7 +125,7 @@ class InfosProject extends Component{ :"" } { - (!data || data.projects.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" ) && + (!data || data.projects.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && } { data && data.projects && data.projects.map((item,key)=>{ @@ -142,7 +142,7 @@ class InfosProject extends Component{ { item.can_visited ==false?
    - +

    非成员不能访问

    :"" } diff --git a/public/react/src/modules/user/usersInfo/InfosShixun.js b/public/react/src/modules/user/usersInfo/InfosShixun.js index bac60fe6f..1550230ab 100644 --- a/public/react/src/modules/user/usersInfo/InfosShixun.js +++ b/public/react/src/modules/user/usersInfo/InfosShixun.js @@ -161,7 +161,7 @@ class InfosShixun extends Component{ :"" } { - (!data || data.shixuns.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" ) && + (!data || data.shixuns.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && } { data && data.shixuns && data.shixuns.map((item,key)=>{ diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 0b2ebc103..c5831dad4 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -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}