From 80ed63dab32f68f33472416c8887cd1344d84a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 29 Jul 2019 09:22:15 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/public/css/edu-all.css | 2 +- public/stylesheets/educoder/edu-all.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/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} From 0f491426c503bdd6908271dca86bc834ccd80076 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 29 Jul 2019 09:26:31 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=B7=A5=E7=A8=8B=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E6=A0=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 3 +-- app/models/user.rb | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) 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 From 199c603ac93553454da7269b77a2c3d5f901905b Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 29 Jul 2019 09:38:49 +0800 Subject: [PATCH 3/7] md --- .../components/markdown/MarkdownToHtml.js | 14 ++------------ .../courses/exercise/ExerciseReviewAndAnswer.js | 16 +++++++++++++--- .../exercise/Exercisestatisticalresult.js | 8 +++++--- .../courses/exercise/new/JudgeDisplay.js | 7 +++++-- .../modules/courses/exercise/new/MainDisplay.js | 4 ++-- .../modules/courses/exercise/new/NullDisplay.js | 2 +- .../exercise/new/QestionDisplayHeader.js | 4 ++-- .../courses/exercise/new/SingleDisplay.js | 8 ++++---- .../courses/exercise/question/fillEmpty.js | 7 +++++-- .../courses/exercise/question/multiple.js | 7 +++++-- .../courses/exercise/question/simpleAnswer.js | 17 +++++++++++++---- .../modules/courses/exercise/question/single.js | 7 +++++-- 12 files changed, 62 insertions(+), 39 deletions(-) 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} {/* */} - + {/* */} +

    ) }) From 71091bfe5384c8b92bad30df4177b1bedc4ec3da Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 29 Jul 2019 14:51:26 +0800 Subject: [PATCH 4/7] / --- public/react/src/modules/user/usersInfo/InfosProject.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/user/usersInfo/InfosProject.js b/public/react/src/modules/user/usersInfo/InfosProject.js index 6c1f4a666..c3f023171 100644 --- a/public/react/src/modules/user/usersInfo/InfosProject.js +++ b/public/react/src/modules/user/usersInfo/InfosProject.js @@ -142,7 +142,7 @@ class InfosProject extends Component{ { item.can_visited ==false?
    - +

    非成员不能访问

    :"" } From fa5f65787a152b0517b5df9a56876203e26717be Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 29 Jul 2019 14:57:48 +0800 Subject: [PATCH 5/7] / --- public/react/src/modules/user/usersInfo/InfosCourse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/user/usersInfo/InfosCourse.js b/public/react/src/modules/user/usersInfo/InfosCourse.js index ff5321a9f..c4cefd2b6 100644 --- a/public/react/src/modules/user/usersInfo/InfosCourse.js +++ b/public/react/src/modules/user/usersInfo/InfosCourse.js @@ -147,7 +147,7 @@ class InfosCourse extends Component{ { item.can_visited ==false?
    - +

    非成员不能访问

    :"" } From 802de5004677d9e5d4e9199c6c9196cbe11f24f5 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 29 Jul 2019 14:58:43 +0800 Subject: [PATCH 6/7] w --- .../react/src/modules/courses/members/studentsList.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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) { From 308c3cc50dd9ab1a8e64eed4df4de5ae52635ea5 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 29 Jul 2019 15:13:23 +0800 Subject: [PATCH 7/7] none data --- public/react/src/modules/user/usersInfo/InfosCourse.js | 2 +- public/react/src/modules/user/usersInfo/InfosPath.js | 2 +- public/react/src/modules/user/usersInfo/InfosProject.js | 2 +- public/react/src/modules/user/usersInfo/InfosShixun.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/user/usersInfo/InfosCourse.js b/public/react/src/modules/user/usersInfo/InfosCourse.js index c4cefd2b6..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)=>{ 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 c3f023171..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)=>{ 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)=>{