From 9e043e2ec4ecd61df21a8892e34b898375045944 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 21 Aug 2019 10:23:15 +0800 Subject: [PATCH 001/130] issue --- .../src/modules/courses/busyWork/commonWork.js | 4 +++- .../modules/courses/coursesPublic/NoneData.js | 17 +++++++++++++++-- .../courses/exercise/ExerciseReviewAndAnswer.js | 12 ++++++++++++ .../courses/exercise/question/multiple.js | 14 +++++++------- .../modules/courses/exercise/question/single.js | 16 ++++++++-------- .../modules/courses/graduation/tasks/index.js | 4 +++- .../courses/shixunHomework/shixunHomework.js | 2 ++ .../src/modules/user/usersInfo/InfosBanner.js | 11 +++++++++-- .../src/modules/user/usersInfo/InfosCourse.js | 2 +- .../src/modules/user/usersInfo/InfosPath.js | 2 +- .../src/modules/user/usersInfo/InfosProject.js | 2 +- .../src/modules/user/usersInfo/InfosShixun.js | 4 ++-- 12 files changed, 64 insertions(+), 26 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/commonWork.js b/public/react/src/modules/courses/busyWork/commonWork.js index f9c34cfcf..d5ac0be68 100644 --- a/public/react/src/modules/courses/busyWork/commonWork.js +++ b/public/react/src/modules/courses/busyWork/commonWork.js @@ -143,7 +143,9 @@ class commonWork extends Component{ this.setState({ order:e.key==="all"?"":e.key, page:1, - isSpin:true + isSpin:true, + checkBoxValues:[], + checkAll:false }) let {search}=this.state; this.getList(1,search,e.key==="all"?"":e.key); diff --git a/public/react/src/modules/courses/coursesPublic/NoneData.js b/public/react/src/modules/courses/coursesPublic/NoneData.js index 73406ab5c..4066cea8b 100644 --- a/public/react/src/modules/courses/coursesPublic/NoneData.js +++ b/public/react/src/modules/courses/coursesPublic/NoneData.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import {getImageUrl} from 'educoder'; +import { getImageUrl , getUrl } from 'educoder'; class NoneData extends Component{ constructor(props) { @@ -9,7 +9,20 @@ class NoneData extends Component{ const { style } = this.props; return(
- + +

暂时还没有相关数据哦!

) diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js index 91ca19e7d..abfe5eff7 100644 --- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js +++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js @@ -535,6 +535,18 @@ class ExerciseReviewAndAnswer extends Component{ .inputNumber30 .ant-input-number-input-wrap .ant-input-number-input{ height: 28px; } + .setRadioStyle{ + width:100%; + cursor:pointer; + } + .setRadioStyle span:last-child{ + flex:1; + display:flex; + } + .setRadioStyle .ant-radio,.setRadioStyle .ant-checkbox{ + height:16px; + margin-top:2px; + } `} {/*

*/} - + { questionType.question_choices && questionType.question_choices.map((item,key)=>{ let prefix = `${tagArray[key]}.` return(

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

) }) diff --git a/public/react/src/modules/courses/exercise/question/single.js b/public/react/src/modules/courses/exercise/question/single.js index a879bad74..5156019d4 100644 --- a/public/react/src/modules/courses/exercise/question/single.js +++ b/public/react/src/modules/courses/exercise/question/single.js @@ -40,18 +40,18 @@ class single extends Component{ let isJudge = questionType.question_type == 2 return(
- + { questionType.question_choices && questionType.question_choices.map((item,key)=>{ let prefix = isJudge ? undefined : `${tagArray[key]}.` return( -

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

+ + {prefix} + +

) }) diff --git a/public/react/src/modules/courses/graduation/tasks/index.js b/public/react/src/modules/courses/graduation/tasks/index.js index b54815b2f..f405f69c9 100644 --- a/public/react/src/modules/courses/graduation/tasks/index.js +++ b/public/react/src/modules/courses/graduation/tasks/index.js @@ -384,7 +384,9 @@ class GraduationTasks extends Component{ this.setState({ order: e.key, - isSpin:true + isSpin:true, + checkBoxValues:[], + checkAllValue:false }); let newkey=e.key; diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index e168dcf6e..d84453fc8 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -587,6 +587,8 @@ class ShixunHomework extends Component{ let {Coursename,page}=this.state; this.setState({ order: e.key, + checkBoxValues:[], + checkedtype:false, isSpin:true }); let newkey=e.key; diff --git a/public/react/src/modules/user/usersInfo/InfosBanner.js b/public/react/src/modules/user/usersInfo/InfosBanner.js index fe86db2de..b76347f16 100644 --- a/public/react/src/modules/user/usersInfo/InfosBanner.js +++ b/public/react/src/modules/user/usersInfo/InfosBanner.js @@ -8,7 +8,7 @@ import "./usersInfo.css" import "../../courses/css/members.css" import "../../courses/css/Courses.css" -import banner from '../../../images/account/infobanner.png' +import { LinkAfterLogin } from 'educoder' class InfosBanner extends Component{ constructor(props){ @@ -68,7 +68,14 @@ class InfosBanner extends Component{ : - 私信 + + 私信 + }
diff --git a/public/react/src/modules/user/usersInfo/InfosCourse.js b/public/react/src/modules/user/usersInfo/InfosCourse.js index c4c1c77e0..bc401d4d7 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) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && + (!data || (data && data.courses.length==0)) && category && } { 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 d2ed2900c..8ba8d6af8 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) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && + (!data || (data && data.subjects.length==0)) && category && } { 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 082c18a71..de003a5dd 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) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && + (!data || (data && data.projects.length==0)) && category && } { 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 b86e69983..dfcf5985a 100644 --- a/public/react/src/modules/user/usersInfo/InfosShixun.js +++ b/public/react/src/modules/user/usersInfo/InfosShixun.js @@ -115,7 +115,7 @@ class InfosShixun extends Component{ totalCount, isSpin } = this.state; - let isStudent = this.props.isStudent(); + let is_current=this.props.is_current; return(
@@ -161,7 +161,7 @@ class InfosShixun extends Component{ :"" } { - (!data || data.shixuns.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && + (!data || (data && data.shixuns.length==0)) && category && } { data && data.shixuns && data.shixuns.map((item,key)=>{ From cd80ea20f84e547e97e41fc0e2af3b53f9a4abfa Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 21 Aug 2019 10:35:02 +0800 Subject: [PATCH 002/130] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E6=A8=A1=E5=9D=97=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/user/usersInfo/InfosShixun.js | 228 +----------------- 1 file changed, 9 insertions(+), 219 deletions(-) diff --git a/public/react/src/modules/user/usersInfo/InfosShixun.js b/public/react/src/modules/user/usersInfo/InfosShixun.js index 7a5329729..4799626a9 100644 --- a/public/react/src/modules/user/usersInfo/InfosShixun.js +++ b/public/react/src/modules/user/usersInfo/InfosShixun.js @@ -1,218 +1,11 @@ -<<<<<<< HEAD -import React, { Component } from 'react'; -import { SnackbarHOC } from 'educoder'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; -import {Tooltip,Menu,Pagination,Spin} from 'antd'; -import Loadable from 'react-loadable'; -import Loading from '../../../Loading'; -import NoneData from '../../courses/coursesPublic/NoneData' -import axios from 'axios'; -import {getImageUrl,setImagesUrl} from 'educoder'; -import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; -import { CNotificationHOC } from '../../courses/common/CNotificationHOC' -import "./usersInfo.css" - -import Create from './publicCreatNew' - -class InfosShixun extends Component{ - constructor(props){ - super(props); - this.state={ - category:undefined, - page:1, - sort_by:'time', - status:undefined, - per_page:16, - isSpin:false, - - totalCount:undefined, - data:undefined - } - } - - componentDidMount=()=>{ - this.setState({ - isSpin:true - }) - let{category,status,sort_by,page}=this.state; - this.getCourses(category,status,sort_by,page); - } - - getCourses=(category,status,sort_by,page)=>{ - let url=`/users/${this.props.match.params.username}/shixuns.json`; - axios.get((url),{params:{ - category, - status, - sort_by, - page, - per_page:this.props.is_current && category && page ==1?17:16 - }}).then((result)=>{ - if(result){ - this.setState({ - totalCount:result.data.count, - data:result.data, - isSpin:false - }) - } - }).catch((error)=>{ - console.log(error); - }) - } - - //切换种类 - changeCategory=(cate)=>{ - this.setState({ - category:cate, - status:undefined, - page:1, - isSpin:true - }) - let{sort_by}=this.state; - this.getCourses(cate,undefined,sort_by,1); - } - // 切换状态 - changeStatus=(status)=>{ - this.setState({ - status, - page:1, - isSpin:true - }) - let{category,sort_by}=this.state; - this.getCourses(category,status,sort_by,1); - } - //切换页数 - changePage=(page)=>{ - this.setState({ - page, - isSpin:true - }) - let{category,sort_by,status}=this.state; - this.getCourses(category,status,sort_by,page); - } - - // 进入课堂 - turnToCourses=(url)=>{ - this.props.history.push(url); - } - - - // 切换排序方式 - changeOrder= (sort)=>{ - this.setState({ - sort_by:sort, - isSpin:true - }) - let{category,status,page}=this.state; - this.getCourses(category,status,sort,page); - } - - render(){ - let{ - category, - status, - sort_by, - page, - data, - totalCount, - isSpin - } = this.state; - - let is_current=this.props.is_current; - return( -
- - - { - category && category == "manage" && is_current && - - } - { - category && category == "study" && is_current && - - } -
- 共参与{totalCount}个{category?category=="manage"?"发布":"学习":"实训"} -
-
  • - {sort_by=="time"?"时间最新":"语言类别"} -
      -
    • this.changeOrder("time")}>时间最新
    • -
    • this.changeOrder("language")}>语言类别
    • -
    -
  • -
    -
    -
    - { - page == 1 && is_current && !category && this.props.current_user && this.props.current_user.user_identity != "学生" ? - :"" - } - { - (!data || (data && data.shixuns.length==0)) && category && - } - { - data && data.shixuns && data.shixuns.map((item,key)=>{ - return( -
    this.turnToCourses(`/shixuns/${item.identifier}/challenges`)}> - { - item.tag &&
    {item.tag}
    - } - - - -
    -

    - {item.name} -

    -
    -

    -
    -

    - 已完成 {item.finished_challenges_count} / {item.challenges_count} -

    -
    -
    - ) - }) - } -
    - { - totalCount > 15 && -
    - -
    - } -
    -
    - ) - } -} -======= import React, { Component } from 'react'; -import { SnackbarHOC } from 'educoder'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; -import {Tooltip,Menu,Pagination,Spin} from 'antd'; -import Loadable from 'react-loadable'; -import Loading from '../../../Loading'; + +import { Pagination , Spin } from 'antd'; + import NoneData from '../../courses/coursesPublic/NoneData' import axios from 'axios'; -import {getImageUrl,setImagesUrl} from 'educoder'; -import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; -import { CNotificationHOC } from '../../courses/common/CNotificationHOC' +import { setImagesUrl } from 'educoder'; + import "./usersInfo.css" import Create from './publicCreatNew' @@ -319,7 +112,7 @@ class InfosShixun extends Component{ totalCount, isSpin } = this.state; - let isStudent = this.props.isStudent(); + let is_current=this.props.is_current; return(
    @@ -361,20 +154,18 @@ class InfosShixun extends Component{
    { - page == 1 && is_current && !category && this.props.current_user && this.props.current_user.user_identity != "学生" ? + page == 1 && is_current && !category && 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 && data.shixuns.length==0)) && category && } { data && data.shixuns && data.shixuns.map((item,key)=>{ return(
    this.turnToCourses(`/shixuns/${item.identifier}/challenges`)}> { - item.tag &&
    {item.tag} - {/**/} -
    + item.tag &&
    {item.tag}
    } @@ -406,5 +197,4 @@ class InfosShixun extends Component{ ) } } ->>>>>>> dev_aliyun export default InfosShixun; \ No newline at end of file From f50b79c3433d23837d717dda66091f16294c84ee Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 21 Aug 2019 13:42:28 +0800 Subject: [PATCH 003/130] issue --- .../react/src/modules/courses/boards/BoardsNew.js | 13 +++++++++---- .../src/modules/courses/coursesPublic/NoneData.js | 2 +- public/react/src/modules/courses/poll/Poll.js | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/courses/boards/BoardsNew.js b/public/react/src/modules/courses/boards/BoardsNew.js index 43be980ed..c96667283 100644 --- a/public/react/src/modules/courses/boards/BoardsNew.js +++ b/public/react/src/modules/courses/boards/BoardsNew.js @@ -358,10 +358,15 @@ class BoardsNew extends Component{ dropdownRender={menu => (
    {menu} - -
    this.refs['addDirModal'].open()}> - 添加目录 -
    + { + isAdmin && + + +
    this.refs['addDirModal'].open()}> + 添加目录 +
    +
    + }
    )} > diff --git a/public/react/src/modules/courses/coursesPublic/NoneData.js b/public/react/src/modules/courses/coursesPublic/NoneData.js index 4066cea8b..35d7a5271 100644 --- a/public/react/src/modules/courses/coursesPublic/NoneData.js +++ b/public/react/src/modules/courses/coursesPublic/NoneData.js @@ -22,7 +22,7 @@ class NoneData extends Component{ } `} - +

    暂时还没有相关数据哦!

    ) diff --git a/public/react/src/modules/courses/poll/Poll.js b/public/react/src/modules/courses/poll/Poll.js index 07be2196c..9574f2492 100644 --- a/public/react/src/modules/courses/poll/Poll.js +++ b/public/react/src/modules/courses/poll/Poll.js @@ -288,6 +288,7 @@ class Poll extends Component{ }) let{type,StudentList_value}=this.state this.InitList(type,StudentList_value,1); + this.props.updataleftNavfun(); } }).catch((error)=>{ console.log(error); From 8a174c3a06bf421090a2cdce66dc389bbc34d635 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 21 Aug 2019 14:38:53 +0800 Subject: [PATCH 004/130] cdn test --- public/react/scripts/build.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/public/react/scripts/build.js b/public/react/scripts/build.js index b2bac24ec..037b0ee42 100644 --- a/public/react/scripts/build.js +++ b/public/react/scripts/build.js @@ -194,7 +194,7 @@ function generateNewIndexJsp() { const newVersion = '1.1.1' let cdnHost = 'https://shixun.educoder.net' cdnHost = 'https://ali-cdn.educoder.net' - // cdnHost = '' + cdnHost = '' var result = data.replace('/js/js_min_all.js', `${cdnHost}/react/build/js/js_min_all.js?v=${newVersion}`) // .replace('/js/js_min_all_2.js', `${cdnHost}/react/build/js/js_min_all_2.js?v=${newVersion}`) @@ -207,11 +207,28 @@ function generateNewIndexJsp() { // .replace('/react/build/./static/css/main', `${cdnHost}/react/build/./static/css/main`) // .replace('/react/build/./static/js/main', `${cdnHost}/react/build/./static/js/main`) - .replace(/https:\/\/testeduplus2.educoder.net/g, ''); + // .replace(/https:\/\/testeduplus2.educoder.net/g, ''); // .replace(/http:\/\/testbdweb.educoder.net/g, ''); // .replace('/css/css_min_all.css', '/react/build/css/css_min_all.css'); + var mainRegex = / + ` + result = data.replace(mainRegex, code) + fs2.writeFile(outputPath, result, 'utf8', function (err) { if (err) return console.log(err); commitAndPush(); From 48e5f9f84b7c15b1e70951ed1d4fa72ba755dba0 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 21 Aug 2019 14:48:38 +0800 Subject: [PATCH 005/130] import './public-path.js'; --- public/react/src/App.js | 1 + public/react/src/public-path.js | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 public/react/src/public-path.js diff --git a/public/react/src/App.js b/public/react/src/App.js index 9621fdc18..3fd121268 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -1,4 +1,5 @@ import React, {Component} from 'react'; +import './public-path.js'; import logo from './logo.svg'; import './App.css'; import {LocaleProvider} from 'antd' diff --git a/public/react/src/public-path.js b/public/react/src/public-path.js new file mode 100644 index 000000000..fb82840d4 --- /dev/null +++ b/public/react/src/public-path.js @@ -0,0 +1,6 @@ +/*global __webpack_public_path__ */ +if (window.location.host == '47.96.87.25:48080') { + __webpack_public_path__ = 'http://testali-cdn.educoder.net/react/build/' +} else if (window.location.host == 'www.educoder.net') { + __webpack_public_path__ = 'https://ali-newweb.educoder.net/react/build/' +} \ No newline at end of file From cba575146d3c0ed774a5d4df74bb6046c452b448 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 21 Aug 2019 14:50:42 +0800 Subject: [PATCH 006/130] =?UTF-8?q?=E6=AF=95=E8=AE=BE=E9=80=89=E9=A2=98?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E7=9A=84=E9=99=84=E4=BB=B6=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/components/attachment/AttachmentList.js | 11 ++++++++--- .../graduation/topics/GraduateTopicDetailInfo.js | 8 +++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/public/react/src/common/components/attachment/AttachmentList.js b/public/react/src/common/components/attachment/AttachmentList.js index 8ece1c39d..afc55fe1f 100644 --- a/public/react/src/common/components/attachment/AttachmentList.js +++ b/public/react/src/common/components/attachment/AttachmentList.js @@ -1,4 +1,5 @@ import React,{ Component } from "react"; +import { ConditionToolTip } from 'educoder' class AttachmentsList extends Component{ constructor(props){ @@ -12,14 +13,18 @@ class AttachmentsList extends Component{ attachments.map((item,key)=>{ return(

    - + { item.is_pdf && item.is_pdf == true ? - {item.title} + 30 }> + {item.title} + : - {item.title} + 30 }> + {item.title} + } {item.filesize}

    diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailInfo.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailInfo.js index 0c76cd9de..9ba334421 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailInfo.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailInfo.js @@ -6,7 +6,7 @@ import '../style.css' import axios from "axios"; import GraduateTopicReply from './GraduateTopicReply' -import { ConditionToolTip,MarkdownToHtml } from 'educoder' +import { ConditionToolTip , MarkdownToHtml , AttachmentList } from 'educoder' const $=window.$; const type={1: "设计",2: "论文", 3: "创作"} @@ -60,9 +60,10 @@ class GraduateTopicDetailTable extends Component{ { topicInfo && topicInfo.attachment_list.length>0 &&

    - { + {/* { topicInfo.attachment_list.map((item,key)=>{ return( +

  • 30 }> @@ -72,7 +73,8 @@ class GraduateTopicDetailTable extends Component{
  • ) }) - } + } */} +

    }
    From 5b56c36344f17442eec8647fde0c24eb441f7a81 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 21 Aug 2019 15:16:47 +0800 Subject: [PATCH 007/130] \\ --- public/react/scripts/build.js | 42 ++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/public/react/scripts/build.js b/public/react/scripts/build.js index 037b0ee42..9ec7f5166 100644 --- a/public/react/scripts/build.js +++ b/public/react/scripts/build.js @@ -195,22 +195,7 @@ function generateNewIndexJsp() { let cdnHost = 'https://shixun.educoder.net' cdnHost = 'https://ali-cdn.educoder.net' cdnHost = '' - var result = data.replace('/js/js_min_all.js', `${cdnHost}/react/build/js/js_min_all.js?v=${newVersion}`) - // .replace('/js/js_min_all_2.js', `${cdnHost}/react/build/js/js_min_all_2.js?v=${newVersion}`) - - // ${cdnHost} 加了cdn后,这个文件里的字体文件加载会有跨域的报错 ../fonts/fontawesome-webfont.eot - // TODO tpi 评测结果关闭也使用了fontawesome - .replace('/css/css_min_all.css', `${cdnHost}/react/build/css/css_min_all.css?v=${newVersion}`) - .replace('/css/iconfont.css', `${cdnHost}/react/build/css/iconfont.css?v=${newVersion}`) - .replace(/\/js\/create_kindeditor.js/g, `${cdnHost}/react/build/js/create_kindeditor.js?v=${newVersion}`) - - // .replace('/react/build/./static/css/main', `${cdnHost}/react/build/./static/css/main`) - // .replace('/react/build/./static/js/main', `${cdnHost}/react/build/./static/js/main`) - - // .replace(/https:\/\/testeduplus2.educoder.net/g, ''); - // .replace(/http:\/\/testbdweb.educoder.net/g, ''); - - // .replace('/css/css_min_all.css', '/react/build/css/css_min_all.css'); + var mainRegex = / ` - result = data.replace(mainRegex, code) + var jsMinAllRegex = / + var result = data + .replace(jsMinAllRegex, '') + // .replace('/js/js_min_all.js', `${cdnHost}/react/build/js/js_min_all.js?v=${newVersion}`) + // .replace('/js/js_min_all_2.js', `${cdnHost}/react/build/js/js_min_all_2.js?v=${newVersion}`) + + // ${cdnHost} 加了cdn后,这个文件里的字体文件加载会有跨域的报错 ../fonts/fontawesome-webfont.eot + // TODO tpi 评测结果关闭也使用了fontawesome + .replace('/css/css_min_all.css', `${cdnHost}/react/build/css/css_min_all.css?v=${newVersion}`) + .replace('/css/iconfont.css', `${cdnHost}/react/build/css/iconfont.css?v=${newVersion}`) + .replace(/\/js\/create_kindeditor.js/g, `${cdnHost}/react/build/js/create_kindeditor.js?v=${newVersion}`) + + .replace(mainRegex, code) + // .replace('/react/build/./static/css/main', `${cdnHost}/react/build/./static/css/main`) + // .replace('/react/build/./static/js/main', `${cdnHost}/react/build/./static/js/main`) + + // .replace(/https:\/\/testeduplus2.educoder.net/g, ''); + // .replace(/http:\/\/testbdweb.educoder.net/g, ''); + + // .replace('/css/css_min_all.css', '/react/build/css/css_min_all.css'); fs2.writeFile(outputPath, result, 'utf8', function (err) { if (err) return console.log(err); From f794810ddd04348bfe10843a39da6d61e86dfaa6 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 21 Aug 2019 15:39:10 +0800 Subject: [PATCH 008/130] =?UTF-8?q?=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/scripts/build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/scripts/build.js b/public/react/scripts/build.js index 9ec7f5166..fe18e93e5 100644 --- a/public/react/scripts/build.js +++ b/public/react/scripts/build.js @@ -208,8 +208,8 @@ function generateNewIndexJsp() { } else if (window.location.host == 'www.educoder.net') { _host = 'https://ali-newweb.educoder.net/react/build/' } - document.write(' ` From 6e9b9c62649f1cd77108049cdca41f91e37fc5e0 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 21 Aug 2019 15:39:30 +0800 Subject: [PATCH 009/130] js --- public/react/src/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index 3fd121268..3949c26a2 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -1,5 +1,5 @@ import React, {Component} from 'react'; -import './public-path.js'; +import './public-path'; import logo from './logo.svg'; import './App.css'; import {LocaleProvider} from 'antd' From 26b78bcfb31ff8e82ae73c2b6a31a49bb4bd9cdd Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 21 Aug 2019 16:12:05 +0800 Subject: [PATCH 010/130] =?UTF-8?q?updateFile=E5=88=87=E6=8D=A2=E5=85=B3?= =?UTF-8?q?=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/page/MainContentContainer.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index 33257703d..3dc3d07d4 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -230,6 +230,7 @@ class MainContentContainer extends Component { && prevProps.game.identifier !== game.identifier) { // 切换关卡时,停止轮训 this.oldGameIdentifier = prevProps.game.identifier; + this.doFileUpdateRequestOnCodeMirrorBlur(prevProps) } } @@ -384,8 +385,8 @@ class MainContentContainer extends Component { } - doFileUpdateRequestOnCodeMirrorBlur = () => { - var fileUpdatePromise = this.doFileUpdateRequest(true) + doFileUpdateRequestOnCodeMirrorBlur = (props) => { + var fileUpdatePromise = this.doFileUpdateRequest(true, undefined, props) if (fileUpdatePromise) { fileUpdatePromise.then((resData) => { if (resData.status === -1) { // 保存文件出现异常 @@ -494,7 +495,8 @@ class MainContentContainer extends Component { } // forTest true 是评测时触发的file_update - doFileUpdateRequest(checkIfCodeChanged, forTest) { + doFileUpdateRequest(checkIfCodeChanged, forTest, props) { + const _props = props || this.props; const { codeStatus } = this.state; if (!forTest && codeStatus !== UPDATED) { // 已修改状态才能保存 return; @@ -519,7 +521,7 @@ class MainContentContainer extends Component { }) return null; } - const { challenge, output_sets, onRunCodeTestFinish, myshixun } = this.props + const { challenge, output_sets, onRunCodeTestFinish, myshixun } = _props // var url = `${locationPath}/file_update?path=${encodeURIComponent(challenge.path)}` var url = `/myshixuns/${myshixun.identifier}/update_file.json` From 76e41f84c1196a7fc3b1a406b3267b603f082784 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 21 Aug 2019 16:55:16 +0800 Subject: [PATCH 011/130] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E5=B8=96=E5=AD=90?= =?UTF-8?q?=E8=AF=A6=E6=83=85-=E6=96=B0=E5=A2=9E=E4=BD=9C=E8=80=85?= =?UTF-8?q?=E5=A4=B4=E5=83=8F=E5=92=8C=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/boards/TopicDetail.js | 95 ++++++++++--------- 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/public/react/src/modules/courses/boards/TopicDetail.js b/public/react/src/modules/courses/boards/TopicDetail.js index 7d0e6d37d..542157bfb 100644 --- a/public/react/src/modules/courses/boards/TopicDetail.js +++ b/public/react/src/modules/courses/boards/TopicDetail.js @@ -24,7 +24,7 @@ import '../../forums/RightSection.css' import './TopicDetail.css' import '../common/courseMessage.css' import { Pagination, Tooltip } from 'antd' -import { bytesToSize, ConditionToolTip, markdownToHTML, MarkdownToHtml } from 'educoder' +import { bytesToSize, ConditionToolTip, markdownToHTML, MarkdownToHtml , setImagesUrl } from 'educoder' import SendToCourseModal from '../coursesPublic/modal/SendToCourseModal' import CBreadcrumb from '../common/CBreadcrumb' import { generateComments, generateChildComments, _findById, handleContentBeforeCreateNew, addNewComment @@ -57,6 +57,7 @@ class TopicDetail extends Component { pageCount: 1, comments: [], goldRewardDialogOpen: false, + author:undefined } } componentDidMount() { @@ -85,7 +86,8 @@ class TopicDetail extends Component { memo: Object.assign({}, { ...response.data.data, replies_count: response.data.data.total_replies_count - }, {...this.state.memo}) + }, {...this.state.memo}), + author:response.data.data.author }, () => { }) @@ -514,7 +516,7 @@ class TopicDetail extends Component { render() { const { match, history } = this.props const { recommend_shixun, current_user,author_info } = this.props; - const { memo, comments, hasMoreComments, goldRewardDialogOpen, pageCount, total_count } = this.state; + const { memo, comments, hasMoreComments, goldRewardDialogOpen, pageCount, total_count , author } = this.state; const messageId = match.params.topicId if (this.state.memoLoading || !current_user) { return
    @@ -599,51 +601,54 @@ class TopicDetail extends Component { }
    -
    - {moment(memo.created_on).fromNow()} 发布 -
    - -
    -
    - -
    - - {/* { current_user.admin && - - - - } */} - - - - {memo.visits || '1'} - - - { !!memo.total_replies_count && - - - - { memo.total_replies_count } - - - } - {!!memo.total_praises_count && - - - - { memo.total_praises_count } +
    + +
    +
    + {author && author.name} + {moment(memo.created_on).fromNow()} 发布 +
    + +
    + + {/* { current_user.admin && + + - + } */} + + + + {memo.visits || '1'} + + + { !!memo.total_replies_count && + + + + { memo.total_replies_count } + + } - - + {!!memo.total_praises_count && + + + + { memo.total_praises_count } + + + } + + +
    +
    From b7634406e92f7b40fce6cfe07c16969aeb3d007a Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 22 Aug 2019 10:17:10 +0800 Subject: [PATCH 012/130] =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=85=B3=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/page/MainContentContainer.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index 3dc3d07d4..a51f00902 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -224,13 +224,15 @@ class MainContentContainer extends Component { } componentDidUpdate(prevProps, prevState, snapshot) { - const { game } = this.props + const { game, challenge } = this.props if (game && prevProps.game && prevProps.game.identifier !== game.identifier) { // 切换关卡时,停止轮训 this.oldGameIdentifier = prevProps.game.identifier; this.doFileUpdateRequestOnCodeMirrorBlur(prevProps) + } else if (challenge && (challenge.pathIndex || prevProps.challenge.pathIndex) && challenge.pathIndex != prevProps.challenge.pathIndex) { + this.doFileUpdateRequestOnCodeMirrorBlur(prevProps) } } From dee7e226bea21805e4ed352809a91e363b387e82 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 22 Aug 2019 18:23:06 +0800 Subject: [PATCH 013/130] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E5=90=84=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=88=97=E8=A1=A8=E7=9A=84=E7=82=B9=E5=87=BB=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/config/webpack.config.dev.js | 3 +- .../courses/exercise/ExerciseListItem.js | 8 ++--- .../graduation/tasks/GraduateTaskItem.js | 15 ++++----- .../modules/courses/graduation/tasks/index.js | 3 +- .../graduation/topics/GraduateTopicItem.js | 4 +-- .../members/modal/CreateGroupByImportModal.js | 32 +++++++------------ .../src/modules/courses/poll/PollListItem.js | 6 ++-- 7 files changed, 30 insertions(+), 41 deletions(-) diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index 510bcaa4f..f126bc363 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -30,7 +30,8 @@ module.exports = { // You may want 'eval' instead if you prefer to see the compiled output in DevTools. // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s // devtool: "cheap-module-eval-source-map", - // 开启调试 + // 开启调试 + devtool: "source-map", // 开启调试 // These are the "entry points" to our application. // This means they will be the "root" imports that are included in JS bundle. // The first two entry points enable "hot" CSS and auto-refreshes for JS. diff --git a/public/react/src/modules/courses/exercise/ExerciseListItem.js b/public/react/src/modules/courses/exercise/ExerciseListItem.js index e890b92ef..639f5bdc8 100644 --- a/public/react/src/modules/courses/exercise/ExerciseListItem.js +++ b/public/react/src/modules/courses/exercise/ExerciseListItem.js @@ -52,17 +52,17 @@ class ExerciseListItem extends Component{ }) } render(){ - let{item,checkBox}=this.props; + let{item,checkBox,key}=this.props; let {coursesId,Id}=this.props.match.params const IsAdmin =this.props.isAdmin(); const IsStudent =this.props.isStudent(); // console.log(this.props.current_user.user_id) return( -
    +
    window.$(`.exerciseitem${key} input`).click() }> { - IsAdmin && - + IsAdmin && + {checkBox} } diff --git a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js index d30944ef0..92a4832db 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js @@ -151,16 +151,12 @@ class GraduateTaskItem extends Component{ coursesId, categoryid, taskid, - + index, + isAdmin } = this.props; - // console.log(discussMessage) - - - - return( -
    +
    window.$(`.taskitem${index} input`).click() }> - { checkBox } - + + { checkBox } + {/* style={{borderTop:data===undefined?"":data.course_identity<4?'1px solid #EBEBEB':'1px solid transparent'}} */} diff --git a/public/react/src/modules/courses/graduation/tasks/index.js b/public/react/src/modules/courses/graduation/tasks/index.js index f405f69c9..1610ff772 100644 --- a/public/react/src/modules/courses/graduation/tasks/index.js +++ b/public/react/src/modules/courses/graduation/tasks/index.js @@ -731,7 +731,7 @@ class GraduationTasks extends Component{ { tasks.map((item, index) => { // console.log(item) return ( -
    +
    diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js index 9f61e69d4..bac04c699 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js @@ -47,7 +47,7 @@ class GraduateTopicItem extends Component{ } -
    +
    window.$(`.topicItem${index} input`).click() }> - { isAdmin ? checkBox : ""} + { isAdmin ? {checkBox} : ""}
    -
    - - - -
    - -

    - -

    -

    点击或拖拽文件到这里上传

    -

    - 单个文件最大150MB -

    -
    + +

    + +

    +

    点击或拖拽文件到这里上传

    +

    + 单个文件最大150MB +

    +
    ) } diff --git a/public/react/src/modules/courses/poll/PollListItem.js b/public/react/src/modules/courses/poll/PollListItem.js index 50c471e76..368fda32b 100644 --- a/public/react/src/modules/courses/poll/PollListItem.js +++ b/public/react/src/modules/courses/poll/PollListItem.js @@ -16,7 +16,7 @@ class PollListItem extends Component{ super(props); } render(){ - let{item,checkBox,courseType}=this.props; + let{item,checkBox,courseType,key}=this.props; let {coursesId}=this.props.match.params; const IsAdmin =this.props.isAdmin(); @@ -28,10 +28,10 @@ class PollListItem extends Component{ let canNotLink = !isAdminOrStudent && item.lock_status == 0 return( -
    +
    window.$(`.pollitem${key} input`).click() }> { IsAdmin && - + {checkBox} } From 89c57f155ee81b2543b2ffb7017ee472e2d350f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 23 Aug 2019 09:53:09 +0800 Subject: [PATCH 014/130] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=AF=95=E8=AE=BE?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=96=B0=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/graduation/tasks/GraduationTasksedit.js | 12 ++++++------ .../courses/graduation/tasks/GraduationTasksnew.js | 8 ++++---- public/stylesheets/educoder/edu-all.css | 4 ++++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js index 559144ecf..425441acf 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js @@ -18,7 +18,7 @@ class GraduationTasksedit extends Component{ this.state={ coursename:"", coursesearch:"", - title_num:60, + title_num:0, title_value:"", fileList: [], contents: [{val:"",id:1}], @@ -53,14 +53,14 @@ class GraduationTasksedit extends Component{ // // } let namelength=result.data.task_name.length; - let sixlength=title_num-namelength + // let sixlength=title_num-namelength this.setState({ // fileList:newfilelist, description:result.data.description, tasktype:result.data.task_type, name:result.data.task_name, data:result.data, - title_num:sixlength, + title_num:namelength, attachments:result.data.attachments, }) @@ -94,9 +94,9 @@ class GraduationTasksedit extends Component{ // 输入title changeTitle=(e)=>{ - + // title_num:60-parseInt(e.target.value.length), this.setState({ - title_num:60-parseInt(e.target.value.length), + title_num:e.target.value.length, title_value:e.target.value }) @@ -379,7 +379,7 @@ class GraduationTasksedit extends Component{ {getFieldDecorator('name', { rules: [{ required: true, message: "请输入标题" }], - })()} + })()}
    diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js index 1d3c7578f..5c1acfb22 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js @@ -19,7 +19,7 @@ class GraduationTasksnew extends Component { this.state = { coursename: "", coursesearch: "", - title_num: 60, + title_num: 0, title_value: "", fileList: [], contents: [{val: "", id: 1}], @@ -119,9 +119,9 @@ class GraduationTasksnew extends Component { // 输入title changeTitle = (e) => { - + // title_num: 60 - parseInt(e.target.value.length), this.setState({ - title_num: 60 - parseInt(e.target.value.length), + title_num: e.target.value.length, title_value: e.target.value }) @@ -384,7 +384,7 @@ class GraduationTasksnew extends Component { rules: [{required: true, message: "不能为空"}], })()} + addonAfter={String(title_num)+"/60"}/>)}
    diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 4f6dadcf9..4b0412180 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -3743,4 +3743,8 @@ a.singlepublishtwo{ .square-main p{ margin-bottom: 0em; +} + +.has-error .ant-input:focus{ + border-color: #ff4d4f !important; } \ No newline at end of file From 6f2fe96e9046d3a5fe0c7785a5f0cc2615f12e9b Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 23 Aug 2019 11:17:36 +0800 Subject: [PATCH 015/130] issue --- .../busyWork/common/WorkDetailPageHeader.js | 11 +- .../src/modules/courses/exercise/Exercise.js | 2 +- .../courses/exercise/ExerciseListItem.js | 20 +- public/react/src/modules/courses/poll/Poll.js | 2 +- .../src/modules/courses/poll/PollListItem.js | 6 +- .../shixunHomework/ShixunhomeWorkItem.js | 177 +++++++++--------- .../courses/shixunHomework/shixunHomework.js | 3 +- 7 files changed, 109 insertions(+), 112 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js b/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js index a092c5066..4177be8a4 100644 --- a/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js +++ b/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js @@ -85,8 +85,7 @@ class WorkDetailPageHeader extends Component{ background: #fff; } .workDetailPageHeader .summaryname { - line-height: 20px; - margin-top: 13px; + line-height:30px } `} -
    - +
    + {homework_name} {/* {homework_name} */} - {category && 返回} + {category && 返回} {this.props.update_atta && diff --git a/public/react/src/modules/courses/exercise/Exercise.js b/public/react/src/modules/courses/exercise/Exercise.js index 4331bdc6f..044dc87f0 100644 --- a/public/react/src/modules/courses/exercise/Exercise.js +++ b/public/react/src/modules/courses/exercise/Exercise.js @@ -559,7 +559,7 @@ class Exercise extends Component{ {...this.props} {...this.state} item={item} - key={key} + index={key} checkBox={ this.onItemClick(item)} >} diff --git a/public/react/src/modules/courses/exercise/ExerciseListItem.js b/public/react/src/modules/courses/exercise/ExerciseListItem.js index 639f5bdc8..5248f4c1a 100644 --- a/public/react/src/modules/courses/exercise/ExerciseListItem.js +++ b/public/react/src/modules/courses/exercise/ExerciseListItem.js @@ -52,17 +52,17 @@ class ExerciseListItem extends Component{ }) } render(){ - let{item,checkBox,key}=this.props; + let{item,checkBox,index}=this.props; let {coursesId,Id}=this.props.match.params const IsAdmin =this.props.isAdmin(); const IsStudent =this.props.isStudent(); // console.log(this.props.current_user.user_id) return( -
    window.$(`.exerciseitem${key} input`).click() }> +
    window.$(`.exerciseitem${index} input`).click() }> { IsAdmin && - + {checkBox} } @@ -96,20 +96,20 @@ class ExerciseListItem extends Component{ {/*{item.exercise_name}*/} { - this.props.isAdmin()? {item.exercise_name}:"" + to={`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`}>{item.exercise_name}:"" } { this.props.isStudent()? - {item.exercise_name}:"" + {item.exercise_name}:"" } { this.props.isNotMember()? item.lock_status === 0 ? {item.exercise_name} - : {item.exercise_name}:"" + : {item.exercise_name}:"" } { @@ -165,8 +165,8 @@ class ExerciseListItem extends Component{ { IsAdmin &&
    - 编辑 - 设置 + 编辑 + 设置
    }

    @@ -193,7 +193,7 @@ class ExerciseListItem extends Component{
    {item.current_status ===0&&item.exercise_status>1?
  • 继续答题
  • : item.current_status ===1&&item.exercise_status>1?
  • 查看答题
  • : - item.current_status ===2&&item.exercise_status>1?
  • this.setgameexercise(`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`)}>开始答题
  • :""} + item.current_status ===2&&item.exercise_status>1?
  • this.setgameexercise(`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`)}>开始答题
  • :""}
    }
    diff --git a/public/react/src/modules/courses/poll/Poll.js b/public/react/src/modules/courses/poll/Poll.js index 9574f2492..b064c289b 100644 --- a/public/react/src/modules/courses/poll/Poll.js +++ b/public/react/src/modules/courses/poll/Poll.js @@ -596,7 +596,7 @@ class Poll extends Component{ {...this.state} courseType={course_types} item={item} - key={key} + index={key} checkBox={ this.onItemClick(item)}>} > ) diff --git a/public/react/src/modules/courses/poll/PollListItem.js b/public/react/src/modules/courses/poll/PollListItem.js index 368fda32b..c4f1c8209 100644 --- a/public/react/src/modules/courses/poll/PollListItem.js +++ b/public/react/src/modules/courses/poll/PollListItem.js @@ -16,7 +16,7 @@ class PollListItem extends Component{ super(props); } render(){ - let{item,checkBox,courseType,key}=this.props; + let{item,checkBox,courseType,index}=this.props; let {coursesId}=this.props.match.params; const IsAdmin =this.props.isAdmin(); @@ -28,10 +28,10 @@ class PollListItem extends Component{ let canNotLink = !isAdminOrStudent && item.lock_status == 0 return( -
    window.$(`.pollitem${key} input`).click() }> +
    window.$(`.pollitem${index} input`).click() }> { IsAdmin && - + {checkBox} } diff --git a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js index 38ab63a4f..942c06800 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js @@ -124,13 +124,19 @@ class ShixunhomeWorkItem extends Component{ }) } - editname = (name,id) => { + // 实训详情,阻止冒泡 + stopPro = (event) => { + event.stopPropagation() + } + + editname = (name,id,event) => { this.setState({ ModalsRenametype:true, NavmodalValue:name, Navmodalname:"重命名", url:`/homework_commons/${id}/alter_name.json` }) + event.stopPropagation() } cannerNavmoda=()=>{ this.setState({ @@ -157,88 +163,74 @@ class ShixunhomeWorkItem extends Component{ const { checkBox, discussMessage, - taskid, + taskid,index } = this.props; - // - - // allow_late: true //是否开启补交 - - // homework_id: 9250 - - // shixun_identifier: "25ykhpvl" - - // - // console.log("this.props.isAdmin"); - - return( -
    - {this.state.ModalsRenametype===true? - this.cannerNavmoda()} - /> - :""} - - - - {visible===true?:""} - - - -
    -

    实训已经更新了,正在为您重置!

    -
    - -
    - -
    -

    本实训的开启时间:{shixunsmessage}
    开启时间之前不能挑战 -

    -
    -
    - {/*取消*/} - 知道啦 -
    - {/*

    */} - {/*知道了*/} - {/*

    */} -
    - + + { + this.state.ModalsRenametype===true? + this.cannerNavmoda()} + /> + :""} + + {visible===true?:""} + +
    +

    实训已经更新了,正在为您重置!

    +
    + +
    + + +
    +

    本实训的开启时间:{shixunsmessage}
    开启时间之前不能挑战 +

    +
    +
    + {/*取消*/} + 知道啦 +
    + {/*

    */} + {/*知道了*/} + {/*

    */} +
    +
    window.$(`.shixunitem${index} input`).click() } > - {this.props.isAdmin?checkBox:""} + {this.props.isAdmin? + {checkBox} + : + "" + }
    - {this.props.isAdmin?
    - 实训详情 - {this.props.isAdminOrCreator()?this.editname(discussMessage.name,discussMessage.homework_id)} className={"btn colorblue ml20 font-16"}>重命名:""} + {this.props.isAdmin?
    this.stopPro(event)} className={this.props.isAdminOrCreator()?"homepagePostSetting homepagePostSettingname":"homepagePostSetting homepagePostSettingbox"} style={{"right":"-2px","top":"44px","display":"block"}}> + 实训详情 + {this.props.isAdminOrCreator()?this.editname(discussMessage.name,discussMessage.homework_id,event)} className={"btn colorblue ml20 font-16"}>重命名:""} {/* 设置*/} 设置
    :""} @@ -408,6 +404,7 @@ class ShixunhomeWorkItem extends Component{
    + ) } } diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index d84453fc8..cdbac6760 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -1163,8 +1163,9 @@ class ShixunHomework extends Component{ isStudent={this.props.isStudent()} isNotMember={this.props.isNotMember()} isClassManagement={this.props.isClassManagement()} - checkBox={this.props.isAdmin()?:""} + checkBox={this.props.isAdmin()?:""} match={this.props.match} + index={index} coursedata={this.props.coursedata} coursupdata={()=>this.homeworkupdatalist(Coursename,page,order)} course_identity={datas.course_identity} From 05ed4802f2c3463c9cac104302a81404158ae91f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 23 Aug 2019 11:20:15 +0800 Subject: [PATCH 016/130] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=AF=95=E8=AE=BE?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E7=BC=96=E8=BE=91=E5=B9=B6=E5=B0=81=E8=A3=85?= =?UTF-8?q?textarea=E5=AD=97=E6=95=B0=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/common/educoder.js | 2 + .../courses/coursesPublic/AccessoryModal.js | 24 ++++++----- .../graduation/tasks/GraduationTasksedit.js | 2 +- .../graduation/tasks/GraduationTasksnew.js | 2 +- .../src/modules/modals/WordNumberTextarea.css | 42 +++++++++++++++++++ .../src/modules/modals/WordNumberTextarea.js | 22 ++++++++++ 6 files changed, 81 insertions(+), 13 deletions(-) create mode 100644 public/react/src/modules/modals/WordNumberTextarea.css create mode 100644 public/react/src/modules/modals/WordNumberTextarea.js diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js index 6f3284db2..8eb34ef55 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -70,3 +70,5 @@ export { CNotificationHOC as CNotificationHOC } from '../modules/courses/common/ export { default as ModalWrapper } from '../modules/courses/common/ModalWrapper' export { default as NoneData } from '../modules/courses/coursesPublic/NoneData' +export {default as WordNumberTextarea} from '../modules/modals/WordNumberTextarea' + diff --git a/public/react/src/modules/courses/coursesPublic/AccessoryModal.js b/public/react/src/modules/courses/coursesPublic/AccessoryModal.js index 5541a01a6..0ea699ce9 100644 --- a/public/react/src/modules/courses/coursesPublic/AccessoryModal.js +++ b/public/react/src/modules/courses/coursesPublic/AccessoryModal.js @@ -1,9 +1,11 @@ import React,{ Component } from "react"; -import { Modal,Checkbox,Upload,Button,Icon,message,notification} from "antd"; -import { WordsBtn,getUrl, getUploadActionUrl} from 'educoder'; +import { Modal,Checkbox,Upload,Button,Icon,message,notification,Input} from "antd"; +import { WordsBtn,getUrl, getUploadActionUrl,WordNumberTextarea} from 'educoder'; import axios from 'axios'; import Modals from '../../modals/Modals'; + const CheckboxGroup = Checkbox.Group; +const { TextArea } = Input; class AccessoryModal extends Component{ constructor(props){ @@ -258,7 +260,6 @@ class AccessoryModal extends Component{ }, }; - return( @@ -335,23 +336,24 @@ class AccessoryModal extends Component{

    - + this.settextarea(e)} + thisValue={this.state.description} + startFontLength={description===undefined?0:description.length} + maxFontLength={100} + /> + { this.state.Errormessage && this.state.Errormessage === true ?

    还未上传附件

    - :
    + : "" } {this.state.updatas===true?请上传附件:""} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js index 425441acf..4036a0a99 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js @@ -379,7 +379,7 @@ class GraduationTasksedit extends Component{ {getFieldDecorator('name', { rules: [{ required: true, message: "请输入标题" }], - })()} + })()}
    diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js index 5c1acfb22..6247f54c2 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js @@ -384,7 +384,7 @@ class GraduationTasksnew extends Component { rules: [{required: true, message: "不能为空"}], })()} + suffix={String(title_num)+"/60"}/>)}
    diff --git a/public/react/src/modules/modals/WordNumberTextarea.css b/public/react/src/modules/modals/WordNumberTextarea.css new file mode 100644 index 000000000..59ed95038 --- /dev/null +++ b/public/react/src/modules/modals/WordNumberTextarea.css @@ -0,0 +1,42 @@ +.WordNumberTextarea { + outline: none; /* 去掉输入字符时的默认样式 */ + appearance:none; + -webkit-appearance:none; + -moz-appearance:none; + background-color: white; + text-shadow: none; + -webkit-writing-mode: horizontal-tb !important; + -webkit-tap-highlight-color:rgba(0,0,0,0); + resize:none; /*禁止拉伸*/ + border: none; /*去掉默认边框*/ + width: 100%; + height:150px; + border:none; + padding: 10px; + display: block; +} + +.WordNumbernote { + padding: 0; + margin: 0; + list-style: none; + text-decoration: none; + box-sizing: border-box; + overflow: hidden; + height: auto; + border: 1px solid rgba(234,234,234,1); + border-radius: 0.125rem; + margin: 0.31rem; + padding: 0.19rem; + backgroud:rgba(234,234,234,1); + padding-bottom: 10px; + padding-right: 10px; + +} +.WordNumberTextarea-count { + display: inline-block; + float: right; + font-size: 0.28rem; + color: #adadad; + padding-right: 0.25rem; +} \ No newline at end of file diff --git a/public/react/src/modules/modals/WordNumberTextarea.js b/public/react/src/modules/modals/WordNumberTextarea.js new file mode 100644 index 000000000..7f5a0288b --- /dev/null +++ b/public/react/src/modules/modals/WordNumberTextarea.js @@ -0,0 +1,22 @@ +import React, { Component } from 'react'; +import './WordNumberTextarea.css'; +class WordNumberTextarea extends Component { + constructor(props) { + super(props); + } +render() { + return( +
    + + {/**/} + + this.settextarea(e)} + thisValue={textareaval} + startFontLength={textareaval===undefined?0:textareaval.length} + maxFontLength={100} + /> +
  • 原因不能为空
  • diff --git a/public/react/src/modules/modals/WordNumberTextarea.css b/public/react/src/modules/modals/WordNumberTextarea.css index 59ed95038..9bd8c820c 100644 --- a/public/react/src/modules/modals/WordNumberTextarea.css +++ b/public/react/src/modules/modals/WordNumberTextarea.css @@ -39,4 +39,4 @@ font-size: 0.28rem; color: #adadad; padding-right: 0.25rem; -} \ No newline at end of file +} diff --git a/public/react/src/modules/modals/WordNumberTextarea.js b/public/react/src/modules/modals/WordNumberTextarea.js index 7f5a0288b..812ed3fd3 100644 --- a/public/react/src/modules/modals/WordNumberTextarea.js +++ b/public/react/src/modules/modals/WordNumberTextarea.js @@ -7,7 +7,7 @@ class WordNumberTextarea extends Component { render() { return(
    - */} this.settextarea(e)} - thisValue={textareaval} - startFontLength={textareaval===undefined?0:textareaval.length} + PlaceholderValue={"请填写您对作品调分的原因"} + InputValue={(e)=>this.settextarea(e)} + Value={textareaval} maxFontLength={100} /> diff --git a/public/react/src/modules/modals/WordNumberTextarea.js b/public/react/src/modules/modals/WordNumberTextarea.js index 812ed3fd3..23d500cc0 100644 --- a/public/react/src/modules/modals/WordNumberTextarea.js +++ b/public/react/src/modules/modals/WordNumberTextarea.js @@ -7,13 +7,13 @@ class WordNumberTextarea extends Component { render() { return(
    - */} this.settextarea(e)} - Value={textareaval} - maxFontLength={100} + placeholder={"请填写您对作品调分的原因"} + onInput={(e)=>this.settextarea(e)} + value={textareaval} + maxlength={100} />
  • 原因不能为空
  • diff --git a/public/react/src/modules/modals/WordNumberTextarea.js b/public/react/src/modules/modals/WordNumberTextarea.js index 23d500cc0..52711de2c 100644 --- a/public/react/src/modules/modals/WordNumberTextarea.js +++ b/public/react/src/modules/modals/WordNumberTextarea.js @@ -7,13 +7,14 @@ class WordNumberTextarea extends Component { render() { return(
    - + this.settextarea(e)} + value={description} + maxlength={100} + /> + { this.state.Errormessage && this.state.Errormessage === true ?

    还未上传附件

    - :
    + : "" } {this.state.updatas===true?请上传附件:""} diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js index a4599bffb..f03608c8b 100644 --- a/public/react/src/modules/courses/coursesPublic/Addcourses.js +++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js @@ -48,8 +48,8 @@ class Addcourses extends Component{ } componentDidUpdate = (prevProps) => { - console.log(prevProps); - console.log(this.props); + // console.log(prevProps); + // console.log(this.props); if(prevProps.occupation!==this.props.occupation){ this.setState({ Addcoursestype:false, @@ -222,8 +222,8 @@ class Addcourses extends Component{ student:student } ).then((response) => { - console.log("submittojoinclass"); - console.log(response); + // console.log("submittojoinclass"); + // console.log(response); if(response === undefined){ this.setState({ // Addcoursestype:false, @@ -302,7 +302,7 @@ class Addcourses extends Component{ isSpin:false }); }).catch((error) => { - console.log(error) + console.log(error); this.setState({ Addcoursestype:false, isSpin:false @@ -326,8 +326,8 @@ class Addcourses extends Component{ Addcoursestypes }=this.state; const antIcon = ; - console.log("Addcourses"); - console.log(Addcoursestypes) + // console.log("Addcourses"); + // console.log(Addcoursestypes) return(
    document.querySelector('.TabsWarp')} key={key}> - {item==="公开"?公开:""} + {item==="公开"?公开:""} {item==="已开启补交"?已开启补交:""} {item==="未开启补交"?未开启补交:""} {item==="匿名作品"?匿名作品:""} @@ -55,6 +55,8 @@ class CoursesListType extends Component { {item==="未提交"?未提交:""} {item==="已确认"?已确认:""} {item==="已截止"?已截止:""} + {item==="开放课程"?开放课程:""} + ) diff --git a/public/react/src/modules/courses/coursesPublic/HomeworkModal.js b/public/react/src/modules/courses/coursesPublic/HomeworkModal.js index deb329fb9..89e747004 100644 --- a/public/react/src/modules/courses/coursesPublic/HomeworkModal.js +++ b/public/react/src/modules/courses/coursesPublic/HomeworkModal.js @@ -241,6 +241,7 @@ class HomeworkModal extends Component{ className="task-hide edu-txt-left" name="shixun_homework[]" value={item.id} + key={item.id} > {item.name} diff --git a/public/react/src/modules/courses/coursesPublic/ModulationModal.js b/public/react/src/modules/courses/coursesPublic/ModulationModal.js index 46dc3becf..974077793 100644 --- a/public/react/src/modules/courses/coursesPublic/ModulationModal.js +++ b/public/react/src/modules/courses/coursesPublic/ModulationModal.js @@ -1,6 +1,6 @@ import React,{ Component } from "react"; import { Modal,Checkbox,Upload,Button,Icon,message,Input} from "antd"; - +import { WordNumberTextarea } from 'educoder'; class ModulationModal extends Component{ constructor(props){ @@ -78,12 +78,20 @@ class ModulationModal extends Component{
    - + {/**/} + + this.settextarea(e)} + value={textareaval} + maxlength={100} + /> +
  • 原因不能为空
  • diff --git a/public/react/src/modules/courses/coursesPublic/SelectResource.js b/public/react/src/modules/courses/coursesPublic/SelectResource.js index 84afa9e2c..f9433ddf7 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectResource.js +++ b/public/react/src/modules/courses/coursesPublic/SelectResource.js @@ -351,6 +351,7 @@ class Selectresource extends Component{
  • { return (

    - +

    ) diff --git a/public/react/src/modules/courses/coursesPublic/modal/CheckCodeModal.js b/public/react/src/modules/courses/coursesPublic/modal/CheckCodeModal.js index d38c0a515..b0061445a 100644 --- a/public/react/src/modules/courses/coursesPublic/modal/CheckCodeModal.js +++ b/public/react/src/modules/courses/coursesPublic/modal/CheckCodeModal.js @@ -208,7 +208,7 @@ class CheckCodeModal extends Component{ { candidates && candidates.map( candidate => { return (

    - + 12 }> diff --git a/public/react/src/modules/courses/coursesPublic/modal/SendToCourseModal.js b/public/react/src/modules/courses/coursesPublic/modal/SendToCourseModal.js index 3ad35f6ea..c4c306a12 100644 --- a/public/react/src/modules/courses/coursesPublic/modal/SendToCourseModal.js +++ b/public/react/src/modules/courses/coursesPublic/modal/SendToCourseModal.js @@ -182,7 +182,7 @@ class SendToCourseModal extends Component{ { course_lists && course_lists.map( course => { return (

    - +

    ) diff --git a/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js b/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js index 127abf5cf..59f157597 100644 --- a/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js +++ b/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js @@ -286,7 +286,9 @@ class ShixunModal extends Component{
  • { + 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({ + userlogin :this.props.current_user.login, + }) + } + } + } - - }; //开始学习 Startlearning=()=>{ let {userlogin} = this.state; + console.log("userlogin"); + console.log(userlogin); if (userlogin === undefined) { this.setState({ isRender: true @@ -95,46 +113,62 @@ class Elearning extends Component{ }else { let {stages}=this.state; if(stages.length>0){ + var stagesdatas=[]; for(var i=0;i { - - if (response.data.status === -2) { - this.setState({ - - shixunsreplaces:true, - hidestartshixunsreplacevalues:response.data.message+".json" - }) - } else if (response.data.status === -1) { - console.log(response) - }else if(response.data.status===-3){ - this.setState({ - shixunsmessages:response.data.message, - startshixunCombattypes:true, - }) - } else { - console.log("开始学习了"); - window.open("/tasks/" + response.data.game_identifier,'_blank'); - //这个是传过来 调用刷新 - this.Myreload(); - // window.location.href = path - // let path="/tasks/"+response.data.game_identifier; - // this.props.history.push(path); - } - }).catch((error) => { - - }); - break; - } - console.log("这是"+i); + for(var ki=0;ki0){ + this.kaishishixun(stagesdatas[0]); + + }else { + notification.open({ + message:"提示", + description: "实训暂未公开!" + }); + } + console.log("这是"+i); } - - } }; + kaishishixun=(id)=>{ + let url = "/shixuns/" + id + "/shixun_exec.json"; + axios.get(url).then((response) => { + console.log("精品课堂开发学习"); + console.log(response); + // console.log(JSON.stringify(response)); + if (response.data.status === -2) { + this.setState({ + + shixunsreplaces:true, + hidestartshixunsreplacevalues:response.data.message+".json" + }) + } else if (response.data.status === -1) { + console.log(response) + }else if(response.data.status===-3){ + this.setState({ + shixunsmessages:response.data.message, + startshixunCombattypes:true, + }) + } else { + console.log("开始学习了"); + window.open("/tasks/" + response.data.game_identifier,'_blank'); + //这个是传过来 调用刷新 + this.Myreload(); + // window.location.href = path + // let path="/tasks/"+response.data.game_identifier; + // this.props.history.push(path); + } + }).catch((error) => { + + }); + } Startlearningtwo=()=>{ this.setState({ diff --git a/public/react/src/modules/courses/exercise/ExerciseNew.js b/public/react/src/modules/courses/exercise/ExerciseNew.js index b790086b8..cbde30a5e 100644 --- a/public/react/src/modules/courses/exercise/ExerciseNew.js +++ b/public/react/src/modules/courses/exercise/ExerciseNew.js @@ -34,7 +34,7 @@ const { TextArea } = Input; const confirm = Modal.confirm; const $ = window.$ const { Option } = Select; - +const TITLE_MAX_LENGTH = 60; class ExerciceNew extends Component{ constructor(props){ super(props); @@ -48,6 +48,36 @@ class ExerciceNew extends Component{ editMode: !this.props.match.params.Id, } } + + // 已发布试卷编辑保存的确认弹框 + changeScore = (question_id,answerArray) =>{ + this.props.confirm({ + content:'修改了标准答案', + subContent:"是否重新计算学生答题的成绩?", + onOk:()=>{ + this.sureChangeScore(question_id,answerArray) + }, + onCancel:()=>{ + this.addSuccess(); + } + }) + } + + // 已发布试卷修改答案确认修改分数 + sureChangeScore = (question_id,answerArray) =>{ + let url=`/exercise_questions/${question_id}/update_scores.json` + axios.post((url),{ + standard_answers:answerArray + }).then((result)=>{ + if(result){ + this.props.showNotification(`${result.data.message}`); + this.addSuccess(); + } + }).catch((error)=>{ + console.log(error); + }) + } + fetchExercise = () => { const Id = this.props.match.params.Id this.isEdit = !!Id @@ -382,6 +412,7 @@ class ExerciceNew extends Component{ addSuccess: this.addSuccess, addQuestion: this.addQuestion, onEditorCancel: this.onEditorCancel, + changeScore:this.changeScore, editQestion: this.editQestion, onSortDown: this.onSortDown, onSortUp: this.onSortUp, @@ -418,7 +449,8 @@ class ExerciceNew extends Component{

    {this.isEdit ? "编辑" : "新建"}试卷 this.props.history.length == 1 ? this.props.history.push(`/courses/${courseId}/exercises/${left_banner_id}`): this.props.history.goBack()}> + // () => this.props.history.length == 1 ? : this.props.history.goBack() + onClick={() => this.props.history.push(`/courses/${courseId}/exercises/${left_banner_id}`)}> 返回

    @@ -449,7 +481,9 @@ class ExerciceNew extends Component{ max: 20, message: '最大限制为20个字符', }], })( */} - + {/* )} */} @@ -504,7 +538,7 @@ class ExerciceNew extends Component{ { exercise_questions.map((item, index) => { if (item.question_type == 0 || item.question_type == 1) { if (item.isNew) { - return + return } else { return + return } else { return } } else if (item.question_type == 3) { if (item.isNew) { - return + return } else { return } diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js index 6bda01cba..b958faa5c 100644 --- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js +++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js @@ -299,9 +299,9 @@ class Testpapersettinghomepage extends Component{

    - {this.props.coursedata.name} + {this.props.coursedata.name} > - 试卷 + 试卷 > 试卷详情

    @@ -322,7 +322,7 @@ class Testpapersettinghomepage extends Component{ - 返回 + 返回

    diff --git a/public/react/src/modules/courses/exercise/new/JudgeEditor.js b/public/react/src/modules/courses/exercise/new/JudgeEditor.js index ab93b5bc5..41bc5bac4 100644 --- a/public/react/src/modules/courses/exercise/new/JudgeEditor.js +++ b/public/react/src/modules/courses/exercise/new/JudgeEditor.js @@ -93,10 +93,12 @@ class SingleEditor extends Component{ question_choices, standard_answers: answerArray, insert_id: question_id_to_insert_after || undefined - }) - .then((response) => { + }).then((response) => { if (response.data.status == 0) { this.props.addSuccess() + }else if(response.data.status == 3){ + // 已发布试卷编辑保存 + this.props.changeScore(question_id,answerArray); } }) .catch(function (error) { diff --git a/public/react/src/modules/courses/exercise/new/NullEditor.js b/public/react/src/modules/courses/exercise/new/NullEditor.js deleted file mode 100644 index dca67032f..000000000 --- a/public/react/src/modules/courses/exercise/new/NullEditor.js +++ /dev/null @@ -1,361 +0,0 @@ -import React,{ Component } from "react"; - -import { - Form, Input, InputNumber, Switch, Radio, - Slider, Button, Upload, Icon, Rate, Checkbox, message, - Row, Col, Select, Modal, Tooltip -} from 'antd'; -import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import axios from 'axios' -import update from 'immutability-helper' -import { qNameArray } from './common' -import NullMDEditor from './NullMDEditor' -import NullChildEditor from './NullChildEditor' -import {getUrl, ActionBtn, DMDEditor} from 'educoder'; -const { TextArea } = Input; -const confirm = Modal.confirm; -const $ = window.$ -const { Option } = Select; - -class NullEditor extends Component{ - constructor(props){ - super(props); - /** - choice_id: 32076 - choice_position: 1 - choice_text: "1" - standard_boolean: true - standard_answer: [{choice_id: 1, answer_text: ["2", "22"]}] - - */ - const {question_choices, standard_answer} = this.props; - let _standard_answers = undefined; - if (standard_answer) { - _standard_answers = [] - - standard_answer.forEach((answers, index) => { - _standard_answers.push([]) - answers.answer_text.forEach((item, itemIndex) => { - _standard_answers[index].push(item) - }) - - }) - } - this.state = { - standard_answers: _standard_answers || [], - question_title: this.props.question_title || '', - question_type: this.props.question_type || 3, - question_score: this.props.question_score || this.props.init_question_score, - is_ordered: !!this.props.is_ordered, - } - } - on_is_ordered_change = (e) => { - this.setState({ is_ordered: e.target.checked}) - - } - - onSave = () => { - const {question_title, question_score, question_type, question_choices, standard_answers, is_ordered } = this.state; - const { question_id_to_insert_after, question_id } = this.props - - let newis_ordered= is_ordered; - - if(newis_ordered===true){ - if(standard_answers.length===1){ - newis_ordered=false - } - } - // TODO check - // const answerArray = standard_answers.map((item, index) => { return item == true ? index+1 : -1 }).filter(item => item != -1); - let answerArray = [] - if(!question_title) { - this.refs['titleEditor'].showError() - this.props.showNotification('题目:不能为空'); return; - - } - const intScore = parseFloat(question_score) - if (intScore == 0) { - this.props.showNotification('分值:必须大于0'); return; - } else if(!question_score || intScore == NaN) { - this.props.showNotification('分值:不能为空'); return; - } - - - let isEmpty = false; - standard_answers.forEach((answers, index) => { - answerArray.push({ - "choice_id": index + 1, - "answer_text":[] - }) - answers.forEach((item, itemIndex) => { - answerArray[index].answer_text.push(item) - if(!item) { - this.refs[`nullChildEditor${index}`].showError(itemIndex) - // this.props.showNotification(`请先输入第${index+1}个填空的第${itemIndex+1}参考答案。`); - this.props.showNotification(`答案:不能为空`); - isEmpty = true; - } - }) - }) - if (isEmpty == true) { - return; - } - if(!question_title) { - this.refs['titleEditor'].showError() - this.props.showNotification('题目:不能为空'); return; - - } - - /** - { - "question_title":"社会主义核心价值观(),(),()...", - "question_type":3, - "question_score":5, - "standard_answers":[ - {"choice_id":1, - "answer_text":["abbc","xxx","sssss"] - }, - {"choice_id":2, - "answer_text":["abbc","xxx","sssss"] - } - ] - "is_ordered":true -} - }*/ - const Id = this.props.match.params.Id - if (question_id) { - const editUrl = `/exercise_questions/${question_id}.json` - axios.put(editUrl, { - question_title, - question_type: 3, - question_score, - question_choices, - standard_answers: answerArray, - insert_id: question_id_to_insert_after || undefined, - is_ordered:newis_ordered, - }) - .then((response) => { - if (response.data.status == 0) { - this.props.addSuccess() - } - }) - .catch(function (error) { - console.log(error); - }); - } else { - const url = `/exercises/${Id}/exercise_questions.json` - - axios.post(url, { - question_title, - question_type: 3, - question_score, - question_choices, - standard_answers: answerArray, - insert_id: question_id_to_insert_after || undefined, - is_ordered:newis_ordered, - }) - .then((response) => { - if (response.data.status == 0) { - this.props.addSuccess() - } - }) - .catch(function (error) { - console.log(error); - }); - } - } - onCancel = () => { - this.props.onEditorCancel() - } - componentDidMount = () => { - - } - on_question_score_change = (e) => { - this.setState({ question_score: e }) - } - - - // placeholderCountInRange 被删除的个数 - onPlaceholderChange = (placeholderCountBefore, placeholderCountInRange, totalPlaceholderCount) => { - const { standard_answers } = this.state; - const new_standard_answers = standard_answers.slice() - if (placeholderCountInRange) { - new_standard_answers.splice(placeholderCountBefore, placeholderCountInRange) - } - if (totalPlaceholderCount) { - for(let i = 0; i < totalPlaceholderCount; i++) { - new_standard_answers.splice(placeholderCountBefore + i, 0, [""]) - } - } - this.setState({ standard_answers: new_standard_answers }, () => { - if (this.mdReactObject) { - this.mdReactObject.toShowMode() - } - }) - - } - - onAnswerChange = (index, itemIndex, val) => { - if (this.state.standard_answers[index]) { - this.setState( - (prevState) => ({ - standard_answers : update(prevState.standard_answers - , {[index]: {$splice: [[itemIndex, 1, val]]}}), - }) - ) - } - } - addChildAnswer = (index) => { - this.setState( - (prevState) => ({ - standard_answers : update(prevState.standard_answers - , {[index]: {$push: ['']}}), - }) - ) - } - - deleteChildAnswer = (index, childIndex) => { - if(!this.state.standard_answers[index][childIndex]) { - this.setState( - (prevState) => ({ - standard_answers : update(prevState.standard_answers, - {[index]: - {$splice: [[childIndex, 1]]} - } - ) - }) - ) - return; - } - this.props.confirm({ - content: `确认要删除这个参考答案吗?`, - onOk: () => { - this.setState( - (prevState) => ({ - standard_answers : update(prevState.standard_answers, - {[index]: - {$splice: [[childIndex, 1]]} - } - ) - }) - ) - - } - }) - - } - - toMDMode = (that) => { - if (this.mdReactObject) { - let mdReactObject = this.mdReactObject; - this.mdReactObject = null - if (that != mdReactObject) { - mdReactObject.toShowMode() - } - } - this.mdReactObject = that; - } - - render() { - let { question_title, question_score, question_type, question_choices, standard_answers - , is_ordered } = this.state; - let { question_id, index, exerciseIsPublish, - // question_title, - // question_type, - // question_score, - isNew } = this.props; - - // const { getFieldDecorator } = this.props.form; - - const isAdmin = this.props.isAdmin() - const courseId=this.props.match.params.coursesId; - const isEdit = !!this.props.question_id - const qNumber = `question_${index}`; - - // console.log(this.state.showtype) - // const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1); - return( -
    - -

    {/*!question_id ? '新建' : '编辑'*/} - {qNameArray[question_type]} - (客观题,由系统自动评分,允许手动调分,请设置标准答案 ;支持最多5个空,每空得分按照本题的总分平均计算) -

    - - this.setState({ question_title: val})} - onPlaceholderChange={this.onPlaceholderChange} showNullButton={exerciseIsPublish ? false : true} - ref="titleEditor" - > - -
    - { - standard_answers.map((answers, index) => { - - return - // answer.map((item, itemIndex) => { - // return this.onAnswerChange(index, itemIndex, val)} - // > - // }) - }) - } - -
    - -
    - {standard_answers.length>1? - - 多个填空的答案有顺序要求 - (选中,每个填空的答案顺序必须与参考答案一致) - :""} -
    -
    - 分值: - 分 - - - - 取消 - 保存 - - -
    - -
    - ) - } -} -// RouteHOC() -export default (NullEditor); \ No newline at end of file diff --git a/public/react/src/modules/courses/exercise/new/SingleEditor.js b/public/react/src/modules/courses/exercise/new/SingleEditor.js deleted file mode 100644 index b979b62c1..000000000 --- a/public/react/src/modules/courses/exercise/new/SingleEditor.js +++ /dev/null @@ -1,320 +0,0 @@ -import React,{ Component } from "react"; - -import { - Form, Input, InputNumber, Switch, Radio, - Slider, Button, Upload, Icon, Rate, Checkbox, message, - Row, Col, Select, Modal, Tooltip -} from 'antd'; -import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import axios from 'axios' -import update from 'immutability-helper' - -import {getUrl, ActionBtn, DMDEditor, ConditionToolTip} from 'educoder'; -const { TextArea } = Input; -const confirm = Modal.confirm; -const $ = window.$ -const { Option } = Select; - -const tagArray = [ - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', - 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', - 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' -] -class SingleEditor extends Component{ - constructor(props){ - super(props); - /** - choice_id: 32076 - choice_position: 1 - choice_text: "1" - standard_boolean: true - */ - const {question_choices} = this.props; - let _standard_answers = undefined; - let _question_choices = undefined; - if (question_choices) { - _standard_answers = [] - _question_choices = [] - - question_choices.forEach((item, index) => { - _standard_answers.push(item.standard_boolean) - _question_choices.push(item.choice_text) - }) - } - this.state = { - question_choices: _question_choices || ['', '', '', ''], - standard_answers: _standard_answers || [false, false, false, false], - question_title: this.props.question_title || '', - question_type: this.props.question_type || 0, - question_score: this.props.question_score || this.props.init_question_score, - } - } - addOption = () => { - const { question_choices, standard_answers } = this.state; - question_choices.push('') - standard_answers.push(false) - this.setState({ question_choices, standard_answers }) - } - deleteOption = (index) => { - let {question_choices}=this.state; - if(question_choices[index]===""){ - // repeat code - this.toMDMode(null) - this.setState( - (prevState) => ({ - question_choices : update(prevState.question_choices, {$splice: [[index, 1]]}), - standard_answers : update(prevState.standard_answers, {$splice: [[index, 1]]}) - }) - ) - }else{ - this.props.confirm({ - content: `确认要删除这个选项吗?`, - onOk: () => { - this.toMDMode(null) - this.setState( - (prevState) => ({ - question_choices : update(prevState.question_choices, {$splice: [[index, 1]]}), - standard_answers : update(prevState.standard_answers, {$splice: [[index, 1]]}) - }) - ) - } - }) - } - } - onSave = () => { - const {question_title, question_score, question_type, question_choices, standard_answers } = this.state; - const { question_id_to_insert_after, question_id } = this.props - // TODO check - const answerArray = standard_answers.map((item, index) => { return item == true ? index+1 : -1 }).filter(item => item != -1); - if(!question_title) { - this.refs['titleEditor'].showError() - this.props.showNotification('题目:不能为空'); return; - - - } - - const intScore = parseFloat(question_score) - if (intScore == 0) { - this.props.showNotification('分值:必须大于0'); return; - } else if(!question_score || intScore == NaN) { - this.props.showNotification('分值:不能为空'); return; - } - if(!answerArray || answerArray.length == 0) { - this.props.showNotification('请先点击选择本选择题的正确选项'); return; - } - if(!question_title) { - this.refs['titleEditor'].showError() - this.props.showNotification('题目:不能为空'); return; - - - } - - for(let i = 0; i < question_choices.length; i++) { - if (!question_choices[i]) { - this.refs[`optionEditor${i}`].showError() - this.props.showNotification(`请先输入 ${tagArray[i]} 选项的内容`); return; - } - } - - /** - { - "question_title":"同学朋友间常用的沟通工具是什么?", - "question_type":1, - "question_score":5, - "question_choices":["a答案","b答案","c答案","d答案"], - "standard_answers":[1] - }*/ - const Id = this.props.match.params.Id - if (question_id) { - const editUrl = `/exercise_questions/${question_id}.json` - axios.put(editUrl, { - question_title, - question_type: answerArray.length > 1 ? 1 : 0, - question_score, - question_choices, - standard_answers: answerArray, - insert_id: question_id_to_insert_after || undefined - }) - .then((response) => { - if (response.data.status == 0) { - this.props.addSuccess() - } - }) - .catch(function (error) { - console.log(error); - }); - } else { - const url = `/exercises/${Id}/exercise_questions.json` - - axios.post(url, { - question_title, - question_type: answerArray.length > 1 ? 1 : 0, - question_score, - question_choices, - standard_answers: answerArray, - insert_id: question_id_to_insert_after || undefined - }) - .then((response) => { - if (response.data.status == 0) { - this.props.addSuccess() - } - }) - .catch(function (error) { - console.log(error); - }); - } - } - onCancel = () => { - this.props.onEditorCancel() - } - componentDidMount = () => { - - } - onOptionClick = (index) => { - // if (this.props.exerciseIsPublish) { - // return; - // } - let standard_answers = this.state.standard_answers.slice(0) - standard_answers[index] = !standard_answers[index] - this.setState({ standard_answers }) - } - onOptionContentChange = (value, index) => { - let question_choices = this.state.question_choices.slice(0); - question_choices[index] = value; - this.setState({ question_choices }) - } - on_question_score_change = (e) => { - this.setState({ question_score: e }) - } - toMDMode = (that) => { - if (this.mdReactObject) { - let mdReactObject = this.mdReactObject; - this.mdReactObject = null - mdReactObject.toShowMode() - } - this.mdReactObject = that; - - } - toShowMode = () => { - - } - render() { - let { question_title, question_score, question_type, question_choices, standard_answers } = this.state; - let { question_id, index, exerciseIsPublish, - // question_title, - // question_type, - // question_score, - isNew } = this.props; - - // const { getFieldDecorator } = this.props.form; - - const isAdmin = this.props.isAdmin() - const courseId=this.props.match.params.coursesId; - const isEdit = !!this.props.question_id - const qNumber = `question_${index}`; - // TODO show模式 isNew为false isEdit为false - - // [true, false, true] -> [0, 2] - - const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1); - return( -
    - -

    - {/* {!question_id ? '新建' : '编辑'} */} - 选择题 - (客观题,由系统自动评分,请设置标准答案) -

    - - this.setState({ question_title: val})} - ref="titleEditor" - - > - - {question_choices.map( (item, index) => { - const bg = standard_answers[index] ? 'check-option-bg' : '' - return
    - {/* 点击设置答案 */} - {/* TODO 加了tooltip后,会丢失掉span的class */} - {/* */} - this.onOptionClick(index)} style={{flex: '0 0 38px'}}> - -
    {tagArray[index]}
    -
    -
    - {/*
    */} -
    - this.onOptionContentChange(value, index)} - initValue={item} - > -
    - {exerciseIsPublish || index===0? - - : - this.deleteOption(index)}> - } - { !exerciseIsPublish && - this.addOption()} - style={{float: 'right', visibility: index == question_choices.length - 1 ? '' : 'hidden', marginTop: '2px'}} - > - } - -
    - }) } - -
    - {/* {!exerciseIsPublish && 新增选项} */} - - {!exerciseIsPublish ? '温馨提示:点击选项标题,可以直接设置答案;选择多个答案即为多选题' : ' '} - { answerTagArray && !!answerTagArray.length ? - - {answerTagArray.join(' ')} - 标准答案: - - : - 请点击正确选项 - } -
    - -
    - 分值: -  分 - - - 取消 - 保存 - - -
    - -
    - ) - } -} -// RouteHOC() -export default (SingleEditor); \ No newline at end of file diff --git a/public/react/src/modules/courses/exercise/question/shixunAnswer.js b/public/react/src/modules/courses/exercise/question/shixunAnswer.js index d8644f8c4..cdffe08b8 100644 --- a/public/react/src/modules/courses/exercise/question/shixunAnswer.js +++ b/public/react/src/modules/courses/exercise/question/shixunAnswer.js @@ -316,7 +316,7 @@ class shixunAnswer extends Component{ 第{item[0].position}关 - + {item[0].name} diff --git a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js new file mode 100644 index 000000000..c7f773190 --- /dev/null +++ b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js @@ -0,0 +1,330 @@ +import React,{ Component } from "react"; +import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip,Spin,Button,Form } from "antd"; +import { WordsBtn,on, off, trigger,markdownToHTML,getImageUrl} from 'educoder'; +import './myysleduinforms.css' +import axios from 'axios'; +import TPMMDEditor from "../../tpm/challengesnew/TPMMDEditor"; +import moment from "../new/CoursesNew"; +import Fileslistitem from "../Resource/Fileslistitem"; +// 公告栏 +class Bullsubdirectory extends Component{ + constructor(props){ + super(props); + this.messageRef = React.createRef(); + + this.state={ + description:null, + isSpinysl:false, + whethertoeditysl:false, + addonAfter:0, + eduintits:"", + informs:[], + + + } + } + + componentDidMount() { + console.log("获取到数据"); + console.log(this.props); + let{id,myname,mydescription} =this.props + this.props.form.setFieldsValue({ + id:id, + eduintits:myname, + description:mydescription, + }); + this.setState({ + id:id, + eduintits:myname, + description:mydescription, + + }) + if(myname!=undefined){ + this.setState({ + addonAfter:myname.length + }) + } + + } + + + bianji = (bians)=>{ + this.setState({ + whethertoeditysl:bians, + }) + if(bians===true){ + this.props.getyslbooltrue(); + }else { + this.props.getyslboolfalse(); + } + }; + changeTopicName = (e) => { + console.log("调用了changeTopicName"); + let num = e.target.value.length; + + if(num>60){ + return; + } + this.setState({ + addonAfter: num < 0 ? 0 : num + }); + if(num<=60){ + this.setState({ + eduintits: e.target.value + }) + + this.props.form.setFieldsValue({ + eduintits: e.target.value, + }); + } + + + } + handleSubmit=(e) => { + e.preventDefault(); + this.props.form.validateFields((err, values) => { + if (!err) { + console.log(values.description); + if(values.eduintits === undefined|| values.eduintits === "" || values.eduintits ===null){ + this.props.showNotification(`请输入标题`); + return + + } + if(values.description === undefined|| values.description === "" || values.description ===null){ + this.props.showNotification(`请输入内容`); + return + + } + var id=this.props.match.params.coursesId + var titname=""; + try { + if(values.eduintits.length>0){ + if( values.eduintits.length>60){ + var str=values.eduintits; + titname=str.substring(0,60); + }else { + titname=values.eduintits; + } + }else { + titname=values.eduintits; + } + }catch (e) { + titname=values.eduintits; + } + var url = `/courses/${id}/update_informs.json`; + axios.post(url,{ + inform_id:this.state.id, + name:titname, + description:values.description, + }).then((result) => { + if(result){ + if(result.data){ + if(result.data.status === 0){ + this.props.form.setFieldsValue({ + id:this.state.id, + eduintits:titname, + description:values.description, + }); + this.setState({ + whethertoeditysl:false, + id:this.state.id, + eduintits:titname, + description:values.description, + }); + this.props.getinputdata(); + this.props.getyslboolfalse(); + this.props.showNotification(result.data.message); + }else { + this.props.showNotification(result.data.message); + + } + } + + } + }).catch((error) => { + console.log(error) + }) + }else{ + console.log(err); + } + + }); + } + + + render(){ + let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl} =this.state; + let{myname,mydescription}=this.props; + const {getFieldDecorator} = this.props.form; + + return( + +
    + +
    + { + whethertoeditysl === false? +
    +
    +
    {myname}
    + { + this.props.isAdmin() === true ? + (this.props.yslbool===false? + this.bianji(true)}> + : + "" + ) + + :"" + } +
    +
    +
    +
    +
    + : +
    +
    + + + {getFieldDecorator('eduintits',{ initialValue: this.state.eduintits }, { + rules: [{ + required: true, message: '请在此输入标题,最多60个字符', + }], + })( +
    +
    + * +
    +
    + +
    + +
    + )} +
    + + +
    +
    + + + {getFieldDecorator('description', { initialValue: this.state.description },{ + rules: [{ + required: true, message: '请在此输入内容,最多5000个字符', + }, { + len: 5000, message: '最大限制为5000个字符', + }], + })( + + )} + +
    +
    + + +
    + this.bianji(false)}>取消 + +
    +
    +
    +
    +
    + } +
    + + +
    + + ) + } +} +const Bullsubdirectorys = Form.create({ name: 'bullsubdirectorys' })(Bullsubdirectory); +export default Bullsubdirectorys; diff --git a/public/react/src/modules/courses/gradinforms/Eduinforms.js b/public/react/src/modules/courses/gradinforms/Eduinforms.js index aef54ab13..f847c87d3 100644 --- a/public/react/src/modules/courses/gradinforms/Eduinforms.js +++ b/public/react/src/modules/courses/gradinforms/Eduinforms.js @@ -4,7 +4,12 @@ import { WordsBtn,on, off, trigger,markdownToHTML,getImageUrl} from 'educoder'; import './myysleduinforms.css' import axios from 'axios'; import TPMMDEditor from "../../tpm/challengesnew/TPMMDEditor"; +import Bullsubdirectory from "./Bullsubdirectory"; +import moment from "../new/CoursesNew"; +import Fileslistitem from "../Resource/Fileslistitem"; // 公告栏 +// var isOnComposition = false; +// const isChrome = !!window.chrome && !!window.chrome.webstore class Eduinforms extends Component{ constructor(props){ super(props); @@ -14,33 +19,57 @@ class Eduinforms extends Component{ description:null, isSpin:true, whethertoedit:false, - + addonAfter:0, + eduintits:"", + informs:[], + yslbool:false, } } componentDidMount() { console.log("获取到数据"); console.log(this.props); - let url = `/courses/${this.props.match.params.coursesId}/informs.json`; + + this.getinputdata(); + } + + getyslbooltrue(){ + console.log("调用了getyslbooltrue"); + this.setState({ + yslbool:true, + }); + } + + getyslboolfalse(){ + console.log("调用了getyslboolfalse"); + this.setState({ + yslbool:false, + }); + } + getinputdata=()=>{ + this.setState({ + isSpin:true, + }) + let url = `/courses/${this.props.match.params.coursesId}/informs.json`; // axios.get(url).then((response) => { if(response){ - if(response.data){ - this.setState({ - description:response.data.description, - isSpin:false, - }) - }else { - this.setState({ - description:null, - isSpin:false, - - }) - - } + if(response.data){ + this.setState({ + informs:response.data.informs, + isSpin:false, + }) + }else { + this.setState({ + informs:[], + isSpin:false, + + }) + + } }else { this.setState({ - description:null, + informs:[], isSpin:false, }) @@ -48,14 +77,12 @@ class Eduinforms extends Component{ }).catch((error) => { console.log(error) this.setState({ - description:null, + informs:[], isSpin:false, }) }); - } - componentDidUpdate = (prevProps) => { @@ -64,33 +91,113 @@ class Eduinforms extends Component{ bianji = (bians)=>{ this.setState({ whethertoedit:bians, - }) + description:"", + eduintits:"", + addonAfter:0, + }); + this.props.form.setFieldsValue({ + description:"", + eduintits:"", + }); + if(bians===true){ + this.getyslbooltrue(); + }else { + this.getyslboolfalse(); + } }; + changeTopicName = (e) => { + console.log("调用了changeTopicName"); + let num = e.target.value.length; + if(num>60){ + return; + } + this.setState({ + addonAfter: num < 0 ? 0 : num + }); + if(num<=60){ + this.setState({ + eduintits: e.target.value + }) + this.props.form.setFieldsValue({ + eduintits: e.target.value, + }); + } + }; + // handleComposition=(e)=>{ + // if (e.type === 'compositionend') { + // // composition is end + // isOnComposition = false + // + // if (!isOnComposition && isChrome) { + // // fire onChange + // console.log(!isOnComposition); + // this.changeTopicName(e); + // } + // } else { + // // in composition + // isOnComposition = true + // } + // }; + // handleComposition = (e) => { + // console.log(e.type + ": " + e.target.value); + // if (e.type === 'compositionend') { + // // composition is end + // const value = e.target.value; + // this.setState({ isOnComposition: false },()=>{ + // // this.handleFixedChange(value); + // }); + // } else { + // // in composition + // this.setState({ isOnComposition: true }); + // } + // } handleSubmit=(e) => { e.preventDefault(); this.props.form.validateFields((err, values) => { if (!err) { console.log(values.description); + if(values.eduintits === undefined|| values.eduintits === "" || values.eduintits ===null){ + this.props.showNotification(`请输入标题`); + return + + } if(values.description === undefined|| values.description === "" || values.description ===null){ - this.props.showNotification(`请输入提交内容`); + this.props.showNotification(`请输入内容`); return } var id=this.props.match.params.coursesId - - var url = `/courses/${id}/update_informs.json`; + var titname=""; + try { + if(values.eduintits.length>0){ + if( values.eduintits.length>60){ + var str=values.eduintits; + titname=str.substring(0,60); + }else { + titname=values.eduintits; + } + }else { + titname=values.eduintits; + } + }catch (e) { + titname=values.eduintits; + } + var url = `/courses/${id}/new_informs.json`; axios.post(url,{ + name:titname, description:values.description, }).then((result) => { if(result){ if(result.data){ if(result.data.status === 0){ this.setState({ - description:values.description, whethertoedit:false, - }) + + }); + this.getinputdata(); + this.getyslboolfalse(); this.props.showNotification(result.data.message); }else { this.props.showNotification(result.data.message); @@ -111,22 +218,25 @@ class Eduinforms extends Component{ render(){ - let{description,whethertoedit} =this.state; + let{description,whethertoedit,addonAfter,eduintits,informs,yslbool} =this.state; const {getFieldDecorator} = this.props.form; return(
    -

    +

    公告栏 { this.props.isAdmin()===true? -

  • this.bianji(true)}> - 编辑 -
  • + (this.state.yslbool===false? +
  • this.bianji(true)}> + 发布公告 +
  • + :"") + :"" } @@ -138,36 +248,71 @@ class Eduinforms extends Component{
    { - whethertoedit === false? -
    - { - description === null || description=== undefined ||description === "" ? -
    -
    -

    暂时还没有相关数据哦!

    -
    - : -
    -
    + whethertoedit === false?"" + : +
    -
    -
    - } -
    - : -
    - -
    -
    + + {getFieldDecorator('eduintits', { + rules: [{ + required: true, message: '请在此输入标题,最多60个字符', + }], + })( +
    +
    + * +
    +
    + +
    + +
    + )} +
    + + +
    +
    + - - {getFieldDecorator('description', { - rules: [{ - required: true, message: '请在此输入内容,最多5000个字符', - }, { - max: 5000, message: '最大限制为5000个字符', - }], - })( - - )} - -
    -
    + } + + + {getFieldDecorator('description', { + rules: [{ + required: true, message: '请在此输入内容,最多5000个字符', + }, { + max: 5000, message: '最大限制为5000个字符', + }], + })( + + )} + +
    +
    -
    - this.bianji(false)}>取消 - -
    +
    + this.bianji(false)}>取消 + +
    +
    } +
    + { + informs === null || informs=== undefined ||informs.length === 0 ? +
    +
    +

    暂时还没有相关数据哦!

    +
    + : + +
    + { informs&&informs.map((item, index) => { + return ( + this.getyslbooltrue()} + getyslboolfalse={()=>this.getyslboolfalse()} + getinputdata={()=>this.getinputdata()} > + ) + }) + } +
    + } +
    + +
    @@ -257,3 +428,7 @@ class Eduinforms extends Component{ } const Eduinformss = Form.create({ name: 'eduinforms' })(Eduinforms); export default Eduinformss; +{/*
    */} +{/* {item.name===""?"":item.name===undefined?"":item.name===null?"":
    {item.name}
    }*/} +{/*
    */} +{/*
    */} \ No newline at end of file diff --git a/public/react/src/modules/courses/gradinforms/myysleduinforms.css b/public/react/src/modules/courses/gradinforms/myysleduinforms.css index f3fa2fb1a..1e86607ec 100644 --- a/public/react/src/modules/courses/gradinforms/myysleduinforms.css +++ b/public/react/src/modules/courses/gradinforms/myysleduinforms.css @@ -1,5 +1,5 @@ .yslmt16px{ - padding-top: 25px !important; + padding-top: 12px !important; padding-left: 25px !important; padding-right: 25px !important; padding-bottom: 1px !important; @@ -10,4 +10,72 @@ padding: 25px !important; -} \ No newline at end of file +} + +.bluebkbk{ + border: 1px solid #4CADFF; + width: 79px; + height: 30px; + text-align: center; + line-height: 30px; + border-radius: 2px; +} +.ysleduinwh{ + + padding-right: 25px; + margin-top: 26px; + display: flex; + justify-content:flex-start; +} +.yslduincolorred{ + color: red; + line-height: 40px; + height: 40px; + text-align: center; +} +.yslduinleft{ + width: 100% ; +} +.yslduinlefts{ + width: 25px; + line-height: 40px; + height: 40px; + text-align: center; +} +.mtyslduin25{ + margin-top: 25px; +} + +.newbianji1{ + font-size: 16px !important; + margin-right: 10px; + color: #4CACFF; + margin-bottom: 3px; + display: inline-block; +} + +.ysltitbt{ + float: left; + padding-top: 31px; + padding-left: 25px; + font-size: 16px; + color: #333333; + text-align: left; +} +.markdownysltext{ + font-size: 14px; + color: #999999; +} +.fudonyingxiangysl{ + width: 100%; + height: 66px; +} +.yslbianji{ + padding-top: 31px; +} +.yslmaxheigth80{ + max-height: 80px; +} +.ysldashed{ + border:1px dashed #EEE; +} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js index fcbe6b9aa..ce704ef6e 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js @@ -77,16 +77,6 @@ class GraduationTasksSubmitedit extends Component{ } - setedit=()=>{ - // let coursesId=this.props.match.params.coursesId; - // let workId=this.props.match.params.work_Id; - // let {workslist}=this.state - // let task_id=workslist&&workslist.task_id; - // window.location.href="/courses/"+coursesId+"/graduation_tasks/"+task_id+"/"+workId+"/works/edit"; - this.goback() - } - - handleSelectChange = (value) => { console.log(value); @@ -103,7 +93,8 @@ class GraduationTasksSubmitedit extends Component{ // }else{ // this.props.history.push(this.props.current_user.first_category_url); // } - this.props.history.goBack() + this.props.history.replace(`/courses/${this.state.workslist.course_id}/graduation_tasks/${this.state.workslist.graduation_id}`); + } @@ -378,6 +369,9 @@ class GraduationTasksSubmitedit extends Component{ } Commoninterface =(fileList,selectmemberslist,workslist)=>{ + let coursesIds=this.props.match.params.coursesId + let workId=this.props.match.params.work_Id; + let userids=[]; for(var list of selectmemberslist){ @@ -424,7 +418,7 @@ class GraduationTasksSubmitedit extends Component{ this.setState({ spinnings:true }) - let workId=this.props.match.params.work_Id; + // if(fileList.length===0){ // this.setState({ @@ -444,8 +438,8 @@ class GraduationTasksSubmitedit extends Component{ spinnings:false }) if(response!== undefined){ - this.setedit() - + // this.goback() + window.location.href=`/courses/${coursesIds}/graduation_tasks/${workId}/appraise` } // if(response.status===200) { // GraduationTasksnewtype=false; diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js index dadc621b2..3c8318796 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js @@ -105,7 +105,7 @@ class GraduationTasksSubmitnew extends Component{ // }else{ // this.props.history.push(this.props.current_user.first_category_url); // } - this.props.history.goBack() + this.props.history.replace(`/courses/${this.state.workslist.course_id}/graduation_tasks/${this.state.workslist.graduation_id}`); } @@ -361,9 +361,7 @@ class GraduationTasksSubmitnew extends Component{ return false; } } - gocannel=()=>{ - this.props.history.goBack() - } + //公用数据 Commoninterface = (fileList,selectmemberslist,workslist)=>{ diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js index d01be4676..c03ffc1e0 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js @@ -76,7 +76,9 @@ class GraduationTasksappraise extends Component{ // }else{ // this.props.history.push(this.props.current_user.first_category_url); // } - this.props.history.goBack() + + this.props.history.replace(`/courses/${this.state.datalist.course_id}/graduation_tasks/${this.state.datalist.graduation_id}/${this.state.datalist.task_id}/list`); + } Cancelvisible=()=>{ diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js index 559144ecf..42a128719 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js @@ -18,7 +18,7 @@ class GraduationTasksedit extends Component{ this.state={ coursename:"", coursesearch:"", - title_num:60, + title_num:0, title_value:"", fileList: [], contents: [{val:"",id:1}], @@ -53,14 +53,14 @@ class GraduationTasksedit extends Component{ // // } let namelength=result.data.task_name.length; - let sixlength=title_num-namelength + // let sixlength=title_num-namelength this.setState({ // fileList:newfilelist, description:result.data.description, tasktype:result.data.task_type, name:result.data.task_name, data:result.data, - title_num:sixlength, + title_num:namelength, attachments:result.data.attachments, }) @@ -88,15 +88,15 @@ class GraduationTasksedit extends Component{ // }else{ // this.props.history.push(this.props.current_user.first_category_url); // } - this.props.history.goBack() + this.props.history.replace(`/courses/${this.state.data.course_id}/graduation_tasks/${this.state.data.graduation_id}`); } // 输入title changeTitle=(e)=>{ - + // title_num:60-parseInt(e.target.value.length), this.setState({ - title_num:60-parseInt(e.target.value.length), + title_num:e.target.value.length, title_value:e.target.value }) @@ -379,7 +379,7 @@ class GraduationTasksedit extends Component{ {getFieldDecorator('name', { rules: [{ required: true, message: "请输入标题" }], - })()} + })()}
    diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js index 1d3c7578f..7c499430a 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js @@ -19,7 +19,7 @@ class GraduationTasksnew extends Component { this.state = { coursename: "", coursesearch: "", - title_num: 60, + title_num: 0, title_value: "", fileList: [], contents: [{val: "", id: 1}], @@ -113,15 +113,16 @@ class GraduationTasksnew extends Component { // }else{ // this.props.history.push(this.props.current_user.first_category_url); // } - this.props.history.goBack() + // this.props.history.goBack() + this.props.history.replace(`/courses/${this.props.match.params.coursesId}/graduation_tasks/${this.props.match.params.category_id}`); } // 输入title changeTitle = (e) => { - + // title_num: 60 - parseInt(e.target.value.length), this.setState({ - title_num: 60 - parseInt(e.target.value.length), + title_num: e.target.value.length, title_value: e.target.value }) @@ -384,7 +385,7 @@ class GraduationTasksnew extends Component { rules: [{required: true, message: "不能为空"}], })()} + suffix={String(title_num)+"/60"}/>)}
    diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js index e679702da..7e5707695 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js @@ -771,7 +771,10 @@ class GraduationTaskssettingapp extends Component{ // }else{ // this.props.history.push(this.props.current_user.first_category_url); // } - this.props.history.goBack() + // this.props.history.goBack() + // this.props.history.replace(this.props.current_user.first_category_url); + this.props.history.replace(`/courses/${this.state.settingdata.course_id}/graduation_tasks/${this.state.settingdata.graduation_id}`); + } isgoback=()=>{ diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 816d53526..9718de28a 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -64,9 +64,10 @@ class GraduationTaskssettinglist extends Component{ // if(courseId===undefined){ // this.props.history.push("/courses"); // }else{ - // this.props.history.push(this.props.current_user.first_category_url); + // this.props.history.push(this.props.current_user.first_category_url); // } - this.props.history.goBack() + // this.props.history.goBack() + this.props.history.replace(`/courses/${this.state.taskslistdata.course_id}/graduation_tasks/${this.state.taskslistdata.graduation_id}`); } seacthdata=(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,pages)=>{ diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js index 22ce6fa04..b8296f9ef 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js @@ -62,7 +62,8 @@ class GraduationTasksquestions extends Component{ // this.props.history.push(this.props.current_user.first_category_url); // } - this.props.history.goBack() + // this.props.history.goBack() + this.props.history.replace(`/courses/${this.state.questionslist.course_id}/graduation_tasks/${this.state.questionslist.graduation_id}`); } end=()=>{ diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicDetail.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicDetail.js index b24277a2c..b518c44f3 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicDetail.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicDetail.js @@ -114,7 +114,7 @@ class GraduateTopicDetail extends Component{

    {tableData && tableData.graduation_topic_name} - this.props.history.goBack()}>返回 + 返回

    diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js index 8c46bfa0e..3845721be 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js @@ -12,6 +12,8 @@ import "../../common/formCommon.css" import '../style.css' import '../../css/Courses.css' import { WordsBtn, City } from 'educoder' + +import {Link} from 'react-router-dom' // import City from './City' // import './board.css' @@ -20,6 +22,7 @@ import { WordsBtn, City } from 'educoder' const confirm = Modal.confirm; const $ = window.$ const { Option } = Select; +const NAME_COUNT=60; // 新建毕设选题 // https://lanhuapp.com/web/#/item/project/board/detail?pid=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&project_id=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&image_id=c6d9b36f-7701-4035-afdb-62404681108c class GraduateTopicNew extends Component{ @@ -38,7 +41,7 @@ class GraduateTopicNew extends Component{ topic_source:[], topic_type:[], attachments:undefined, - addonAfter:60, + addonAfter:0, left_banner_id:undefined, course_name:undefined } @@ -99,7 +102,7 @@ class GraduateTopicNew extends Component{ topic_source:result.data.topic_source, topic_type:result.data.topic_type, attachments:result.data.attachments, - addonAfter:20-parseInt(result.data.selected_data.name.length) + addonAfter:parseInt(result.data.selected_data.name.length) }) this.props.form.setFieldsValue({ tea_id:result.data.selected_data.tea_id, @@ -257,9 +260,9 @@ class GraduateTopicNew extends Component{ // 附件相关 ------------ END changeTopicName=(e)=>{ - let num= 60 - parseInt(e.target.value.length); + // let num= 60 - parseInt(e.target.value.length); this.setState({ - addonAfter:num < 0 ? 0 : num + addonAfter:e.target.value.length }) } render() { @@ -331,7 +334,7 @@ class GraduateTopicNew extends Component{

    {topicId==undefined?"新建":"编辑"}毕设选题

    - this.props.history.goBack()} className="color-grey-6 fr font-16">返回 + 返回
    @@ -366,7 +369,7 @@ class GraduateTopicNew extends Component{ max: 60, message: '最大限制为60个字符', }], })( - + )}
    diff --git a/public/react/src/modules/courses/members/CourseGroupChooser.js b/public/react/src/modules/courses/members/CourseGroupChooser.js index 1a03c978f..ba9c64bb1 100644 --- a/public/react/src/modules/courses/members/CourseGroupChooser.js +++ b/public/react/src/modules/courses/members/CourseGroupChooser.js @@ -75,6 +75,7 @@ function CourseGroupChooser({ course_groups, isAdminOrCreator = true, item, inde return(
  • diff --git a/public/react/src/modules/courses/members/modal/AddStudentModal.js b/public/react/src/modules/courses/members/modal/AddStudentModal.js index 958b4f134..de95bc741 100644 --- a/public/react/src/modules/courses/members/modal/AddStudentModal.js +++ b/public/react/src/modules/courses/members/modal/AddStudentModal.js @@ -237,7 +237,7 @@ class AddStudentModal extends Component{ { users.map( candidate => { return (

    - + 12 }>

    - + {/* "color":"#4c4c4c" */} 12 }> diff --git a/public/react/src/modules/courses/new/Goldsubject.js b/public/react/src/modules/courses/new/Goldsubject.js index da7a12b3f..7214f46a8 100644 --- a/public/react/src/modules/courses/new/Goldsubject.js +++ b/public/react/src/modules/courses/new/Goldsubject.js @@ -214,7 +214,7 @@ class Goldsubject extends Component { datatime: dateString, }); this.props.form.setFieldsValue({ - endtime: moment(dateString, dateFormat).add(1, 'days'), + endtime: moment(dateString, dateFormat), }); } @@ -237,7 +237,7 @@ class Goldsubject extends Component { datatimetwo: dateString, }) this.props.form.setFieldsValue({ - starttime: moment(dateString, dateFormat).add(1, 'days'), + starttime: moment(dateString, dateFormat), }); } @@ -318,14 +318,23 @@ class Goldsubject extends Component { name: values.classroom, class_period: values.period, credit: parseFloat(values.credit), - start_date:values.starttime, - end_date: values.endtime, + start_date:moment(values.starttime).format("YYYY-MM-DD"), + end_date: moment(values.endtime).format("YYYY-MM-DD"), is_public: this.state.is_public, //这是也是带过来的值 course_module_types: values.checkboxgroup, school:values.school }; - console.log("327"); - console.log(datasysl); + try { + console.log("327"); + console.log(datasysl); + // console.log(JSON.stringify(datasysl)); + console.log("88887777"); + console.log(moment(values.starttime).format("YYYY-MM-DD")); + console.log(moment(values.endtime).format("YYYY-MM-DD")); + }catch (e) { + + } + let url = "/courses/" + coursesId + ".json"; axios.put(url, datasysl @@ -392,15 +401,22 @@ class Goldsubject extends Component { name: values.classroom, class_period: values.period, credit: parseFloat(values.credit), - start_date:values.starttime, - end_date: values.endtime, + start_date:moment(values.starttime).format("YYYY-MM-DD"), + end_date: moment(values.endtime).format("YYYY-MM-DD"), is_public: is_public, //这是也是带过来的值 course_module_types: values.checkboxgroup, school:values.school }; - console.log("提交的ysldatas数据"); - console.log(ysldatas); - console.log(JSON.stringify(ysldatas)); + try { + console.log("提交的ysldatas数据"); + console.log(ysldatas); + // console.log(JSON.stringify(ysldatas)); + console.log(moment(values.starttime).format("YYYY-MM-DD")); + console.log(moment(values.endtime).format("YYYY-MM-DD")); + }catch (e) { + + } + axios.post(url, ysldatas ).then((response) => { @@ -442,7 +458,8 @@ class Goldsubject extends Component { var subjectids=this.props.match.params.subjectid; window.location.href=`/paths/${subjectids}` }else{ - this.props.history.goBack(); + // this.props.history.goBack(); + window.location.href=`/courses/${this.props.match.params.coursesId}/informs` } } diff --git a/public/react/src/modules/courses/poll/PollDetailIndex.js b/public/react/src/modules/courses/poll/PollDetailIndex.js index a141db961..e92a0e352 100644 --- a/public/react/src/modules/courses/poll/PollDetailIndex.js +++ b/public/react/src/modules/courses/poll/PollDetailIndex.js @@ -136,7 +136,7 @@ class PollDetailIndex extends Component{ - this.props.history.goBack()}>返回 + 返回

    diff --git a/public/react/src/modules/courses/poll/PollDetailTabThird.js b/public/react/src/modules/courses/poll/PollDetailTabThird.js index b0bc95cea..47fcaf52f 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabThird.js +++ b/public/react/src/modules/courses/poll/PollDetailTabThird.js @@ -108,8 +108,8 @@ class PollDetailTabThird extends Component{ { item.question.answers.map((index,k)=>{ return( -
  • - +
  • + {index.answer_text} { index.answer_text=="其他" ?

    :"" diff --git a/public/react/src/modules/courses/poll/PollInfo.js b/public/react/src/modules/courses/poll/PollInfo.js index dfbfd3a74..2476e0bc3 100644 --- a/public/react/src/modules/courses/poll/PollInfo.js +++ b/public/react/src/modules/courses/poll/PollInfo.js @@ -327,7 +327,7 @@ class PollInfo extends Component{ {poll && poll.polls_name} { - isAdmin || (poll && poll.user_poll_status == 1) ? this.props.history.goBack()}>返回 :'' + isAdmin || (poll && poll.user_poll_status == 1) ? 返回 :'' }

    @@ -445,7 +445,7 @@ class PollInfo extends Component{ item.question.answers && item.question.answers.map((i,k)=>{ return(
  • - + {i.answer_text} { i.answer_text=="其他"? diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index ce602afc3..48bc69c79 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -1,6 +1,9 @@ import React, {Component} from "react"; import {Form, Input, Tooltip, Checkbox, Radio, Select, message, Modal, Button} from 'antd' import {WordsBtn, ActionBtn} from 'educoder' + +import {Link} from 'react-router-dom' + import '../css/members.css' import "../common/formCommon.css" @@ -36,7 +39,7 @@ class PollNew extends Component { visible: false, poll_questions: [], user_permission: "", - addonAfter: 60, + addonAfter: 0, addonAftertwo: 100, mysingles: 0, mydoubles: 0, @@ -65,6 +68,8 @@ class PollNew extends Component { cancellation: false, bindingid:undefined, Newdisplay:false, + first_category_url:"", + left_banner_id:"", } // console.log("试卷新建和编辑"); // console.log(JSON.stringify(props)); @@ -72,10 +77,14 @@ class PollNew extends Component { } changeTopicName = (e) => { - let num = 60 - parseInt(e.target.value.length); + console.log("调用了changeTopicName"); + let num = parseInt(e.target.value.length); + if(num>60){ + return; + } this.setState({ addonAfter: num < 0 ? 0 : num - }) + }); this.setState({ polls_nametest: e.target.value }) @@ -124,8 +133,35 @@ class PollNew extends Component { console.log("问卷返回"); 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(){ // // console.log(this.props.match); @@ -144,12 +180,12 @@ class PollNew extends Component { // } //初始化请求网络 Initializatio_data = () => { - // console.log("Initializatio_data 582") + console.log("Initializatio_data 582") //课堂id let coursesId = this.props.match.params.coursesId; //时间id let pollid = this.props.match.params.pollid; - // console.log(pollid); + console.log(pollid); // let coursesId = 557; if (pollid === undefined) { // console.log("没有问卷新建问卷~~~") @@ -215,6 +251,19 @@ class PollNew extends Component { polls_nametest: result.data.poll.polls_name, polls_descriptiontest: result.data.poll.polls_description, }); + + if(result.data){ + if(result.data.poll){ + if(result.data.poll.polls_name){ + let num = parseInt(result.data.poll.polls_name.length); + this.setState({ + addonAfter: num < 0 ? 0 : num + }) + } + } + + } + this.setState({ projects: result.data, pollid: pollid, @@ -229,6 +278,7 @@ class PollNew extends Component { polls_nametest: result.data.poll.polls_name, polls_descriptiontest: result.data.poll.polls_description, questionnair: true, + left_banner_id:result.data.left_banner_id }) // console.log(this.state.polls_nametest) // console.log(this.state.polls_descriptiontest) @@ -2338,10 +2388,13 @@ class PollNew extends Component { } gotohome=()=>{ // 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; // if(courseId===undefined){ // this.props.history.push("/courses"); @@ -2360,6 +2413,7 @@ class PollNew extends Component { readOnlys, newoption, cancellation, + left_banner_id } = this.state //获取老师权限 // console.log("[`${maps[polls_status && polls_status]}`]]"); @@ -2404,16 +2458,29 @@ class PollNew extends Component {

    this.gotohome()}>{this.props.coursedata.name} > - 问卷 + { + this.props.match.params.news === "new"? + 问卷 + : + 问卷 + } + > {this.props.match.params.news === undefined ? "新建" : this.props.match.params.news === "new" ? "新建" : "编辑"}

    {this.props.match.params.news === undefined ? "新建问卷" : this.props.match.params.news === "new" ? "新建问卷" : "编辑问卷"}

    - this.gotohome()} - className=" fr font-16">返回 + { + this.props.match.params.news === "new" ? + 返回 + : + 返回 + }
    {/**/} @@ -2461,12 +2528,13 @@ class PollNew extends Component { }
  • - + {/*suffix={String(addonAfter)}*/} @@ -2491,7 +2559,7 @@ class PollNew extends Component { readOnly={readOnlys} onInput={this.changeTopicNametwo} value={this.state.polls_descriptiontest} - autoComplete="off" addonAfter={"100"}> + autoComplete="off" suffix={"100"}> { this.state.Newedit === true || this.state.mysave === true ?
    diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index a37e58a92..64e2e6a99 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -369,9 +369,9 @@ class Listofworksstudentone extends Component { { record.submitstate === "未提交" ?-- : - this.Viewstudenttraininginformation(record)}>{record.operating} + onClick={() => this.Viewstudenttraininginformation(record)}>{record.operating} } diff --git a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js index f46d3f6b1..dddd39989 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js @@ -113,21 +113,19 @@ class ShixunHomeworkPage extends Component { bindRef = ref => { this.child = ref } ///////////////教师截止 gotohome=()=>{ - // let courseId=this.props.match.params.coursesId; - // if(courseId===undefined){ - // this.props.history.push("/courses"); - // }else{ - // this.props.history.push(this.props.current_user.first_category_url); - // } - this.props.history.goBack() + // console.log(this.props) + let {jobsettingsdatapage}=this.state + + this.props.history.replace(`/courses/${this.props.match.params.coursesId}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.main === 1 ? "shixun_homeworks" :"shixun_homework"}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.category_id === undefined ? "" : jobsettingsdatapage.data.category.category_id}`); } render() { let {tab, teacherdatapage, jobsettingsdatapage} = this.state; const isAdmin = this.props.isAdmin(); // console.log(119) - // console.log(jobsettingsdatapage); - // console.log(teacherdatapage); + console.log(jobsettingsdatapage); + + return (
    @@ -136,11 +134,11 @@ class ShixunHomeworkPage extends Component {

    - this.gotohome()}>{jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.course_name} + {jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.course_name} > {jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.category_name} + href={`/courses/${this.props.match.params.coursesId}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.main === 1 ? "shixun_homeworks" :"shixun_homework"}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.category_id === undefined ? "" : jobsettingsdatapage.data.category.category_id}`}>{jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.category_name} > 作业详情

    @@ -240,14 +238,14 @@ class ShixunHomeworkPage extends Component { this.workshowmodels(this.child)}>代码查重 : "" : ""} {this.state.view_report === true ? + to={`/courses/${this.props.match.params.coursesId}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.main === 1 ? "shixun_homeworks" :"shixun_homework"}/${teacherdatapage&&teacherdatapage.work_id}/shixun_work_report`}> 查看实训报告 : ""} { teacherdatapage === undefined ? "" : teacherdatapage.commit_des === null || teacherdatapage.commit_des === undefined ? "" : {teacherdatapage.commit_des} + href={`/courses/${this.props.match.params.coursesId}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.main === 1 ? "shixun_homeworks" :"shixun_homework"}/${teacherdatapage === undefined ? "" : teacherdatapage.id}/commitsummary/${this.props.match.params.homeworkid}`}>{teacherdatapage.commit_des} } {teacherdatapage === undefined ? "" : { - - this.props.history.goBack() + this.props.history.replace(`/courses/${this.props.match.params.coursesId}/shixun_homeworks/${this.state.data.homework_common_id}/list?tab=0`); } render() { let{data} =this.state; @@ -159,7 +158,7 @@ class ShixunWorkReport extends Component { {/*className="fr color-blue font-16"*/} {/*onClick={()=>this.confirmysl(`/student_works/${homeworkid}/export_shixun_work_report.pdf`)}*/} {/*>导出实训报告数据 : ""}*/} - {/*返回*/} + 返回
    diff --git a/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunWorkModal.js b/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunWorkModal.js index 977b459d4..293310a90 100644 --- a/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunWorkModal.js +++ b/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunWorkModal.js @@ -288,6 +288,7 @@ class ShixunWorkModal extends Component{ className="fl task-hide edu-txt-left" name="shixun_homework[]" value={item=== undefined?"":item.id} + key={item=== undefined?"":item.id} > diff --git a/public/react/src/modules/courses/shixunHomework/TraineetraininginformationModal.js b/public/react/src/modules/courses/shixunHomework/TraineetraininginformationModal.js index 9b86483df..7babe1e6b 100644 --- a/public/react/src/modules/courses/shixunHomework/TraineetraininginformationModal.js +++ b/public/react/src/modules/courses/shixunHomework/TraineetraininginformationModal.js @@ -236,11 +236,11 @@ class TraineetraininginformationModal extends Component {
  • {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.username} 通关:{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.complete_count}/{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.challenges_count}
  • -
  • 完成效率:{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.efficiency}
  • + {this.props.viewtrainingdata === undefined ?
  • :this.props.viewtrainingdata.efficiency === undefined ?
  • :this.props.viewtrainingdata.efficiency === null ?
  • :this.props.viewtrainingdata.efficiency === "null" ?
  • :this.props.viewtrainingdata.efficiency === "" ?
  • :
  • 完成效率:{this.props.viewtrainingdata.efficiency}
  • }
  • 通关时间: {this.props.viewtrainingdata === undefined ? "":moment(this.props.viewtrainingdata.passed_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"--":moment(this.props.viewtrainingdata.passed_time).format('YYYY-MM-DD HH:mm')}
  • -
  • 课堂最高完成效率: {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.max_efficiency}
  • + {this.props.viewtrainingdata === undefined ?
  • :this.props.viewtrainingdata.max_efficiency === undefined ?
  • :this.props.viewtrainingdata.max_efficiency === null ?
  • :this.props.viewtrainingdata.max_efficiency === "null" ?
  • : this.props.viewtrainingdata.max_efficiency === "" ?
  • :
  • 课堂最高完成效率: {this.props.viewtrainingdata.max_efficiency}
  • }
  • 总耗时: {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.total_spend_time}
  • diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index 9cb2bd973..bd90db42f 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -322,9 +322,14 @@ class Trainingjobsetting extends Component { }; challenge_scoredata.push(datas[i].challenge_score); array.push(object) + console.log("datas[i].challenge_score"); + console.log(i); + console.log(datas[i].challenge_score); } } + console.log("提交的数据"+"pustdate"); + console.log("提交的数据"+"pustdate"); if (this.state.jobsettingsdata.data.unified_setting === true) { if (this.state.unifiedsetting === true) { @@ -560,14 +565,20 @@ class Trainingjobsetting extends Component { if(challenge_scoredata.length>0){ var len = 0; for (var k = 0; k < challenge_scoredata.length; k++) { - len = len + challenge_scoredata[k]; + len = len + parseFloat(challenge_scoredata[k]); + console.log(len); + console.log(challenge_scoredata[k]); + console.log(len); + } var max = latedeductiontwos + len; if (max > 100) { + console.log("max>100"); this.props.showNotification(`总分值+效率占比分之和要等于100,现在分值为` + max); return; } if(max<100){ + console.log("max<100"); this.props.showNotification(`总分值+效率占比分之和要等于100,现在分值为` + max); return; } diff --git a/public/react/src/modules/home/shixunsHome.js b/public/react/src/modules/home/shixunsHome.js index d366426c8..690baf28b 100644 --- a/public/react/src/modules/home/shixunsHome.js +++ b/public/react/src/modules/home/shixunsHome.js @@ -294,7 +294,7 @@ class ShixunsHome extends Component { {/*精选实训 改为 开发社区*/}
    -

    开发社区

    +

    实训项目

    DEVELOPMENT COMMUNITY

    更多 diff --git a/public/react/src/modules/modals/Certifiedprofessional.js b/public/react/src/modules/modals/Certifiedprofessional.js index 5e3df4abb..ca1691809 100644 --- a/public/react/src/modules/modals/Certifiedprofessional.js +++ b/public/react/src/modules/modals/Certifiedprofessional.js @@ -19,19 +19,9 @@ class Certifiedprofessional extends Component { // console.log("加入金品课堂"); // console.log(this.props); + } - componentDidMount() { - // axios.interceptors.response.use((response) => { - // if (response != undefined) - // if (response && response.data.status === -1) { - // - // } - // return response; - // }, (error) => { - // //TODO 这里如果样式变了会出现css不加载的情况 - // - // }); - } + modalCancel=()=>{ this.props.ModalCancelsy(); }; diff --git a/public/react/src/modules/modals/Jointheclass.js b/public/react/src/modules/modals/Jointheclass.js index 7d8ce788a..0ad13c158 100644 --- a/public/react/src/modules/modals/Jointheclass.js +++ b/public/react/src/modules/modals/Jointheclass.js @@ -1,6 +1,7 @@ import React, { Component } from 'react'; import { Modal} from 'antd'; import axios from 'axios'; +import Modals from './Modals'; //加入精品课堂 class Jointheclass extends Component { @@ -11,6 +12,12 @@ class Jointheclass extends Component { componentDidMount() { // console.log("加入精品课堂"); // console.log(this.props); + let type=this.props.yslJointhe===undefined?false:this.props.yslJointhe; + if(type===true){ + this.setState({ + Modalstype:true + }) + } } @@ -19,6 +26,7 @@ class Jointheclass extends Component { }; setDownload=()=>{ + let cousestype=this.props.pathcousestypeid; let id=this.props.Pathcourseid===undefined?this.props.match.params.coursesId:this.props.Pathcourseid let url = `/courses/${id}/join_excellent_course.json`; axios.post(url).then((result) => { @@ -27,6 +35,9 @@ class Jointheclass extends Component { if(result.data.status === 0){ this.props.showNotification(result.data.message); this.props.ysljoinmodalCanceltwo(); + if(cousestype===1){ + window.open(`/courses/${id}/informs`) + } }else { this.props.showNotification(result.data.message); } @@ -44,35 +55,15 @@ class Jointheclass extends Component { // console.log("加入精品课堂2"); //console.log(this.props.Pathcourseid); return( - -
    -

    是否确认该加入课堂?

    -
    - - this.modalCancel()}>取消 - this.setDownload()}>确认 -
    -
    -
    + this.modalCancel()} + modalSave={()=>this.setDownload()} + > ) } } -export default Jointheclass; \ No newline at end of file +export default Jointheclass; + diff --git a/public/react/src/modules/modals/WordNumberTextarea.css b/public/react/src/modules/modals/WordNumberTextarea.css new file mode 100644 index 000000000..9bd8c820c --- /dev/null +++ b/public/react/src/modules/modals/WordNumberTextarea.css @@ -0,0 +1,42 @@ +.WordNumberTextarea { + outline: none; /* 去掉输入字符时的默认样式 */ + appearance:none; + -webkit-appearance:none; + -moz-appearance:none; + background-color: white; + text-shadow: none; + -webkit-writing-mode: horizontal-tb !important; + -webkit-tap-highlight-color:rgba(0,0,0,0); + resize:none; /*禁止拉伸*/ + border: none; /*去掉默认边框*/ + width: 100%; + height:150px; + border:none; + padding: 10px; + display: block; +} + +.WordNumbernote { + padding: 0; + margin: 0; + list-style: none; + text-decoration: none; + box-sizing: border-box; + overflow: hidden; + height: auto; + border: 1px solid rgba(234,234,234,1); + border-radius: 0.125rem; + margin: 0.31rem; + padding: 0.19rem; + backgroud:rgba(234,234,234,1); + padding-bottom: 10px; + padding-right: 10px; + +} +.WordNumberTextarea-count { + display: inline-block; + float: right; + font-size: 0.28rem; + color: #adadad; + padding-right: 0.25rem; +} diff --git a/public/react/src/modules/modals/WordNumberTextarea.js b/public/react/src/modules/modals/WordNumberTextarea.js new file mode 100644 index 000000000..52711de2c --- /dev/null +++ b/public/react/src/modules/modals/WordNumberTextarea.js @@ -0,0 +1,23 @@ +import React, { Component } from 'react'; +import './WordNumberTextarea.css'; +class WordNumberTextarea extends Component { + constructor(props) { + super(props); + } +render() { + return( +
    + - } +
    + }
    {tags === undefined ? "" :tags === null ? "": diff --git a/public/react/src/modules/paths/PathDetail/sendPanel.js b/public/react/src/modules/paths/PathDetail/sendPanel.js index ae7dd5b00..450afc75e 100644 --- a/public/react/src/modules/paths/PathDetail/sendPanel.js +++ b/public/react/src/modules/paths/PathDetail/sendPanel.js @@ -180,7 +180,7 @@ class sendPanel extends Component{ { this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_send===true? - + 发送至 :'' diff --git a/public/react/src/modules/paths/PathNew.js b/public/react/src/modules/paths/PathNew.js index 4616660f0..95e343b13 100644 --- a/public/react/src/modules/paths/PathNew.js +++ b/public/react/src/modules/paths/PathNew.js @@ -107,8 +107,8 @@ class PathNew extends Component{ window.location.href="#part_Des"; return; } - if (des.length > 5000) { - this.props.showSnackbar("实践课程的简介最大限制5000个字符"); + if (des.length > 8000) { + this.props.showSnackbar("实践课程的简介最大限制8000个字符"); window.location.href="#part_Des"; return; } @@ -118,8 +118,8 @@ class PathNew extends Component{ window.location.href="#part_point"; return; } - if(point.length > 500){ - this.props.showSnackbar("实践课程的学习须知最大限制500个字符"); + if(point.length > 2000){ + this.props.showSnackbar("实践课程的学习须知最大限制2000个字符"); window.location.href="#part_point"; return; } @@ -186,10 +186,10 @@ class PathNew extends Component{ }) const Des_editMD = create_editorMD("shixun_introduction","100%","490px" - ,"请在此输入实践课程的简介,最大限制5000个字符","/api/attachments.json", response.data.description,""); + ,"请在此输入实践课程的简介,最大限制8000个字符","/api/attachments.json", response.data.description,""); this.Des_editMD=Des_editMD; const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px" - ,"请在此输入实践课程的学习须知,最大限制500个字符","/api/attachments.json",response.data.learning_notes,""); + ,"请在此输入实践课程的学习须知,最大限制2000个字符","/api/attachments.json",response.data.learning_notes,""); this.Point_editMD=Point_editMD; } }).catch((error)=>{ @@ -198,9 +198,9 @@ class PathNew extends Component{ } else { this.isEditPage = false - const Des_editMD = create_editorMD("shixun_introduction","100%","490px","请在此输入实践课程的简介,最大限制5000个字符","/api/attachments.json","",""); + const Des_editMD = create_editorMD("shixun_introduction","100%","490px","请在此输入实践课程的简介,最大限制8000个字符","/api/attachments.json","",""); this.Des_editMD=Des_editMD; - const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px","请在此输入实践课程的学习须知,最大限制500个字符","/api/attachments.json","",""); + const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px","请在此输入实践课程的学习须知,最大限制2000个字符","/api/attachments.json","",""); this.Point_editMD=Point_editMD; } diff --git a/public/react/src/modules/paths/ShixunPathSearch.js b/public/react/src/modules/paths/ShixunPathSearch.js index b5ba1563d..c0060a528 100644 --- a/public/react/src/modules/paths/ShixunPathSearch.js +++ b/public/react/src/modules/paths/ShixunPathSearch.js @@ -139,8 +139,8 @@ class ShixunPathSearch extends Component{
    {/* this.changeStatus("publish_time")}>全部*/} {/* this.changeStatus("mine")}>我的*/} - this.changeStatus("updated_at")}>最新 - this.changeStatus("myshixun_count")}>最热 + this.changeStatus("updated_at")}>最新 + this.changeStatus("myshixun_count")}>最热 {/*
    */} {/*/!* {
  • - 开发社区 + 实训项目
  • @@ -814,7 +814,7 @@ submittojoinclass=(value)=>{ onBlur={(e)=>this.hideshowSearchOpen(e)} onMouseLeave={()=>this.setevaluatinghides()}> this.onKeywordSearchKeyDowns()} onSearch={(value) => this.onKeywordSearchKeyDown(value)} // onPressEnter={this.onKeywordSearchKeyDown} @@ -860,15 +860,15 @@ submittojoinclass=(value)=>{
      {user.username} -
    • 我的课堂
    • +
    • 我的翻转课堂
    • {/* p 老师 l 学生 */} -
    • 我的实训
    • +
    • 我的实训项目
    • 我的实践课程
    • +
    • 我的开发项目
    • +
    • 我的众包
    • 客户管理
    • -
    • 我的项目
    • -
    • 我的众包
    • 账号管理
    • {/*
    • this.educoderlogin()} >登入测试接口
    • */} {/*
    • this.trialapplications()} >试用申请
    • */} @@ -902,17 +902,17 @@ submittojoinclass=(value)=>{
      • - 加入课堂 + 加入翻转课堂
      • {Addcoursestypes===true?{ {/* /courses/join_course_multi_role */}
      • - 加入项目 + 加入开发项目
      • {tojoinitemtype===true?{ + placeholder="请输入6位开发项目邀请码" value={tojoinclasstitle} onInput={this.inputjoinclassvalue}/>

        ') // .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`)); $('head').append($('') - .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?1`)); + .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?8`)); $('head').append($('') - .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?1`)); + .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?8`)); // index.html有加载 $('head').append($('') - .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?1`)); + .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?8`)); // $('head').append($('') @@ -141,7 +141,7 @@ export function TPMIndexHOC(WrappedComponent) { }else if(this.props.match.path==="/nopage"){ document.title="没有找到该页面"; }else if(this.props.match.path==="/shixuns"){ - document.title="开发社区"; + document.title="实训项目"; }else if(this.props.match.path==="/paths"){ document.title="实践课程"; }else if(this.props.match.path==="/courses"){ diff --git a/public/react/src/modules/tpm/component/TPMright.css b/public/react/src/modules/tpm/component/TPMright.css index b0f8315e6..41b87c0d0 100644 --- a/public/react/src/modules/tpm/component/TPMright.css +++ b/public/react/src/modules/tpm/component/TPMright.css @@ -45,12 +45,12 @@ } .newedboxheight{ max-height:204px; - overflow-y: auto; + overflow-y: hidden; } .newminheight{ /*max-height: 670px;*/ max-height: 300px; - overflow: auto; + overflow-y: auto; } .delSubentry{ diff --git a/public/react/src/modules/tpm/shixuns/shixunCss/shixunCard.css b/public/react/src/modules/tpm/shixuns/shixunCss/shixunCard.css index 1bd948427..4470aaec1 100644 --- a/public/react/src/modules/tpm/shixuns/shixunCss/shixunCard.css +++ b/public/react/src/modules/tpm/shixuns/shixunCss/shixunCard.css @@ -7,7 +7,7 @@ } .square-Item{ - min-height: 324px; + /*min-height: 324px;*/ } .square-img{ min-height: 210px; diff --git a/public/react/src/modules/user/usersInfo/InfosBank.js b/public/react/src/modules/user/usersInfo/InfosBank.js index eb07a066c..2abc15220 100644 --- a/public/react/src/modules/user/usersInfo/InfosBank.js +++ b/public/react/src/modules/user/usersInfo/InfosBank.js @@ -211,7 +211,7 @@ class InfosBank extends Component{ return(

        - +

        diff --git a/public/react/src/modules/user/usersInfo/banner_out.js b/public/react/src/modules/user/usersInfo/banner_out.js index 644c9e02a..986a66cd3 100644 --- a/public/react/src/modules/user/usersInfo/banner_out.js +++ b/public/react/src/modules/user/usersInfo/banner_out.js @@ -168,7 +168,7 @@ class banner_out extends Component{

      • this.setState({moduleName: 'projects'})} - to={`/users/${username}/projects`}>项目 + to={`/users/${username}/projects`}>开发项目
      • diff --git a/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js b/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js index 19d38020f..78c58a1db 100644 --- a/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js +++ b/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js @@ -6,7 +6,9 @@ let _path = isDev() ? 'public' : 'build' let _testHost = '' ; // 'http://192.168.2.63:3001/api' ; // '' ; let login = 'innov' - +// 工单注释 +// https://workorder.console.aliyun.com/console.htm#/ticket/detail/?ticketId=FLASELR +// https://workorder.console.aliyun.com/console.htm#/ticket/detail/?ticketId=1FB4APN // https://help.aliyun.com/document_detail/52204.html?spm=5176.2020520165.120.d52204.19a47029YWhro7#%E4%B8%8A%E4%BC%A0%E5%9C%B0%E5%9D%80%E5%92%8C%E5%87%AD%E8%AF%81%E6%96%B9%E5%BC%8F(%E6%8E%A8%E8%8D%90%E4%BD%BF%E7%94%A8) let uploader; let $ = window.$ diff --git a/public/react/src/modules/user/usersInfo/video/EditVideoModal.js b/public/react/src/modules/user/usersInfo/video/EditVideoModal.js index 4ed20d3cd..fc05cc932 100644 --- a/public/react/src/modules/user/usersInfo/video/EditVideoModal.js +++ b/public/react/src/modules/user/usersInfo/video/EditVideoModal.js @@ -77,7 +77,7 @@ function EditVideoModal (props) { }], })( + suffix={String(_title ? `${String(_title.length)}/${MAX_LENGTH}` : 0)} /> )} diff --git a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js index f3d6b4f7a..cb6c2f382 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js +++ b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js @@ -412,7 +412,7 @@ function VideoUploadList (props) {
        视频大小:不支持断点续传,单个视频文件最大200M;单次最多支持3个视频文件上传
        视频规格:avi、flv、f4v、m4v、mov、mp4、rmvb、swf、webm
        -
        温馨提示:请勿上传违法视频。平台将为每一个视频分配一个地址,您可以通过引用该地址将视频使用在开发社区等模块
        +
        温馨提示:请勿上传违法视频。平台将为每一个视频分配一个地址,您可以通过引用该地址将视频使用在实训项目等模块
        {!noUploads && diff --git a/public/react/src/search/SearchPage.js b/public/react/src/search/SearchPage.js index 499eb2f68..c2afca884 100644 --- a/public/react/src/search/SearchPage.js +++ b/public/react/src/search/SearchPage.js @@ -152,7 +152,7 @@ class SearchPage extends Component{ 实践课程 翻转课堂 - 开发社区 + 实训项目 交流问答
      • diff --git a/public/stylesheets/css/edu-common.css b/public/stylesheets/css/edu-common.css index 14b7de1d6..d785959fb 100644 --- a/public/stylesheets/css/edu-common.css +++ b/public/stylesheets/css/edu-common.css @@ -95,6 +95,10 @@ a:hover.link-color-grey03{color:#3498db!important;} /*通用文字大小样式*/ +.font-8{ font-size: 8px!important;} +.font-9{ font-size: 9px!important;} +.font-10{ font-size: 10px!important;} +.font-11{ font-size: 11px!important;} .font-12{ font-size: 12px!important;} .font-13{ font-size: 13px!important;} .font-14{ font-size: 14px!important;} diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index bc6af002c..c4718c076 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -120,12 +120,13 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px} bottom: 90px;} .tag-green .tag-name{display: block;width: auto; /*background-image: url("/images/educoder/tag1.png");*/ - background: #000000; + background: rgba(000,000,000,0.56); border: 1px solid #fff; border-radius: 3px; - font-size: 14px; - opacity: 0.56; - background-size: 100% 100%;padding: 0px 8px;color: #fff;float: left;} + font-size: 12px; + /*opacity: 0.56;*/ + background-size: 100% 100%; + padding: 0px 8px;color: #fff;float: left;} .tag-orange{position: absolute;right: 0px;top:12px;} .tag-orange .tag-name{display: block;width: auto;background-color:#FF6800; background-size: 100% 100%;padding: 0px 8px;color: #fff;float: left; @@ -3739,4 +3740,24 @@ a.singlepublishtwo{ .ant-tooltip{ max-width: 100% !important; -} \ No newline at end of file +} + +.square-main p{ + margin-bottom: 0em; +} + +.bestChoose{ + cursor: pointer; +} + +.pointer{ + cursor: pointer; +} + +.has-error .ant-input:focus{ + border-color: #ff4d4f !important; +} +/*.ant-notification{*/ + /*width: auto !important;*/ + /*max-width: 600px !important;*/ +/*}*/ \ No newline at end of file diff --git a/public/stylesheets/educoder/edu-main.css b/public/stylesheets/educoder/edu-main.css index 4aa426192..f59827f45 100644 --- a/public/stylesheets/educoder/edu-main.css +++ b/public/stylesheets/educoder/edu-main.css @@ -761,9 +761,9 @@ html>body #ajax-indicator { position: fixed; } .paddingLeft28{padding-left:28px;} -.ant-modal-header{ - border-radius: 10px; -} +/*.ant-modal-header{*/ + /*border-radius: 10px;*/ +/*}*/ .color656565{ color:#656565; diff --git a/spec/jobs/create_student_work_job_spec.rb b/spec/jobs/create_student_work_job_spec.rb new file mode 100644 index 000000000..401160f80 --- /dev/null +++ b/spec/jobs/create_student_work_job_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe CreateStudentWorkJob, type: :job do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/old_message_detail_spec.rb b/spec/models/old_message_detail_spec.rb new file mode 100644 index 000000000..0aadef6ee --- /dev/null +++ b/spec/models/old_message_detail_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OldMessageDetail, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end From 35bc6e9679eb0b4d44c0c34e5d5b5ff2ba50c9a6 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 26 Aug 2019 09:55:17 +0800 Subject: [PATCH 076/130] =?UTF-8?q?md=E6=98=BE=E7=A4=BAke=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E6=97=B6=EF=BC=8C=E8=A1=8C=E9=97=B4=E8=B7=9D=E8=BF=87?= =?UTF-8?q?=E9=AB=98=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.css | 4 ++++ public/react/src/common/TextUtil.js | 1 + 2 files changed, 5 insertions(+) diff --git a/public/react/src/App.css b/public/react/src/App.css index a6f1d45e7..2b3d8d08c 100644 --- a/public/react/src/App.css +++ b/public/react/src/App.css @@ -55,6 +55,10 @@ html, body { .markdown-body p { white-space: pre-wrap; } +/* https://www.educoder.net/courses/2346/group_homeworks/34405/question */ +.renderAsHtml.markdown-body p { + white-space: inherit; +} /* resize */ .editormd .CodeMirror { border-right: none !important; diff --git a/public/react/src/common/TextUtil.js b/public/react/src/common/TextUtil.js index 4c83131f1..74cdef3e6 100644 --- a/public/react/src/common/TextUtil.js +++ b/public/react/src/common/TextUtil.js @@ -9,6 +9,7 @@ export function markdownToHTML(oldContent, selector) { window.$('#md_div').html('') // markdown to html if (selector && oldContent && oldContent.startsWith(' Date: Mon, 26 Aug 2019 10:00:43 +0800 Subject: [PATCH 077/130] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=88=E4=BD=9C?= =?UTF-8?q?=E8=80=85=E6=8F=90=E7=A4=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../paths/PathDetail/addCollaborators.js | 27 ++++++++++++--- .../Collaborators/Collaborators.js | 33 +++++++++++++++---- 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/public/react/src/modules/paths/PathDetail/addCollaborators.js b/public/react/src/modules/paths/PathDetail/addCollaborators.js index 0b99fd467..056e69b31 100644 --- a/public/react/src/modules/paths/PathDetail/addCollaborators.js +++ b/public/react/src/modules/paths/PathDetail/addCollaborators.js @@ -14,7 +14,8 @@ class addCollaborators extends Component{ search:'', partnerListid:[], checkAll: false, - optionss:[] + optionss:[], + useristrue:false } } addBox=()=>{ @@ -70,6 +71,13 @@ class addCollaborators extends Component{ let {partnerListid} =this.state; let id=this.props.match.params.pathId; let url="/paths/"+id+"/add_subject_members.json" + + if(partnerListid.length===0){ + this.setState({ + useristrue:true + }) + return + } axios.post(url,{ user_ids:partnerListid }).then((response) => { @@ -87,9 +95,17 @@ class addCollaborators extends Component{ } addCollaboratorsid=(id)=>{ - this.setState({ - partnerListid:id - }) + if(id.length===0){ + this.setState({ + partnerListid:id, + }) + }else{ + this.setState({ + partnerListid:id, + useristrue:false + }) + } + } onCheckAllChange = (e) => { @@ -145,7 +161,7 @@ class addCollaborators extends Component{ } render(){ - let {addPartner,search,partnerList,optionss,checkAll,partnerListid} = this.state; + let {addPartner,search,partnerList,optionss,checkAll,partnerListid,useristrue} = this.state; return( this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_add_member===true? @@ -199,6 +215,7 @@ class addCollaborators extends Component{ }
      + {useristrue===true?请先选择用户:""}
      取消 确定 diff --git a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js index 1662635ba..ea99b740d 100644 --- a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js +++ b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js @@ -45,7 +45,8 @@ class Collaborators extends Component { collaboratorListsumtype:true, user_name:undefined, school_name:undefined, - spinnings:false + spinnings:false, + useristrue:false } } componentDidMount() { @@ -217,10 +218,20 @@ class Collaborators extends Component { } else { alltype = false } - this.setState({ - Searchadmin: newlist, - allChangechecked: alltype - }) + + if(newlist.length===0){ + this.setState({ + Searchadmin: newlist, + allChangechecked: alltype, + }) + }else{ + this.setState({ + Searchadmin: newlist, + allChangechecked: alltype, + useristrue:false + }) + } + } allChange = (e) => { @@ -260,6 +271,13 @@ class Collaborators extends Component { } } } + + if(user_ids.length===0){ + this.setState({ + useristrue:true + }) + return + } let url = "/shixuns/" + id + "/shixun_members_added.json"; axios.post(url, { user_ids: user_ids @@ -405,7 +423,8 @@ class Collaborators extends Component { collaboratorListsum, collaboratorListsumtype, user_name, - school_name + school_name, + useristrue } = this.state; let {loadingContent} = this.props; const radioStyle = { @@ -547,7 +566,7 @@ class Collaborators extends Component {
      - + {useristrue===true?请先选择用户:""}
      this.CollaboratorsshowModal("cooperation")}>取消 From 94049f7592501621bd4f97d6f25c6ad7dd126111 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Mon, 26 Aug 2019 10:13:11 +0800 Subject: [PATCH 078/130] admins: identity and professional auth feature --- app/assets/javascripts/admin.js | 27 ++++- .../javascripts/admins/common-refuse-modal.js | 54 ++++++++++ .../admins/identity_authentications/index.js | 18 ++++ .../professional_authentications/index.js | 18 ++++ .../javascripts/admins/search-form-tab.js | 10 ++ app/assets/javascripts/bootstrap.viewer.js | 50 +++++++++ app/assets/stylesheets/admin.scss | 6 +- app/assets/stylesheets/admins/common.scss | 6 ++ .../admins/identity-authentications.scss | 9 ++ .../admins/professional-authentications.scss | 9 ++ .../identity_authentications_controller.rb | 26 +++++ ...professional_authentications_controller.rb | 26 +++++ .../concerns/admins/render_helper.rb | 1 + app/helpers/admins/base_helper.rb | 102 ++++++++++++++++++ app/helpers/application_helper.rb | 101 +++-------------- app/libs/util/file_manage.rb | 40 +++++++ app/models/apply_user_authentication.rb | 6 ++ .../admins/apply_user_authentication_query.rb | 34 ++++++ .../identity_auths/agree_apply_service.rb | 38 +++++++ .../identity_auths/refuse_apply_service.rb | 40 +++++++ .../professional_auths/agree_apply_service.rb | 38 +++++++ .../refuse_apply_service.rb | 40 +++++++ .../identity_authentications/index.html.erb | 32 ++++++ .../identity_authentications/index.js.erb | 1 + .../shared/_list.html.erb | 74 +++++++++++++ .../index.html.erb | 32 ++++++ .../professional_authentications/index.js.erb | 1 + .../shared/_list.html.erb | 72 +++++++++++++ .../admins/school_statistics/index.html.erb | 4 +- .../_admin_common_refuse_modal.html.erb | 26 +++++ app/views/admins/shared/_sidebar.html.erb | 7 ++ .../admins/shared/after_render_js_hook.js.erb | 3 +- app/views/admins/shared/delete.js.erb | 2 + .../admins/users/shared/_user_list.html.erb | 22 ++-- .../apply_user_authentications/zh-CN.yml | 7 ++ config/routes.rb | 15 ++- 36 files changed, 886 insertions(+), 111 deletions(-) create mode 100644 app/assets/javascripts/admins/common-refuse-modal.js create mode 100644 app/assets/javascripts/admins/identity_authentications/index.js create mode 100644 app/assets/javascripts/admins/professional_authentications/index.js create mode 100644 app/assets/javascripts/admins/search-form-tab.js create mode 100755 app/assets/javascripts/bootstrap.viewer.js create mode 100644 app/assets/stylesheets/admins/identity-authentications.scss create mode 100644 app/assets/stylesheets/admins/professional-authentications.scss create mode 100644 app/controllers/admins/identity_authentications_controller.rb create mode 100644 app/controllers/admins/professional_authentications_controller.rb create mode 100644 app/helpers/admins/base_helper.rb create mode 100644 app/libs/util/file_manage.rb create mode 100644 app/queries/admins/apply_user_authentication_query.rb create mode 100644 app/services/admins/identity_auths/agree_apply_service.rb create mode 100644 app/services/admins/identity_auths/refuse_apply_service.rb create mode 100644 app/services/admins/professional_auths/agree_apply_service.rb create mode 100644 app/services/admins/professional_auths/refuse_apply_service.rb create mode 100644 app/views/admins/identity_authentications/index.html.erb create mode 100644 app/views/admins/identity_authentications/index.js.erb create mode 100644 app/views/admins/identity_authentications/shared/_list.html.erb create mode 100644 app/views/admins/professional_authentications/index.html.erb create mode 100644 app/views/admins/professional_authentications/index.js.erb create mode 100644 app/views/admins/professional_authentications/shared/_list.html.erb create mode 100644 app/views/admins/shared/_admin_common_refuse_modal.html.erb create mode 100644 config/locales/apply_user_authentications/zh-CN.yml diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js index 27844be53..72a2ff118 100644 --- a/app/assets/javascripts/admin.js +++ b/app/assets/javascripts/admin.js @@ -11,6 +11,7 @@ //= require select2 //= require jquery.cxselect //= require bootstrap-datepicker +//= require bootstrap.viewer //= require_tree ./i18n //= require_tree ./admins @@ -25,6 +26,9 @@ $(document).on('turbolinks:load', function(){ $('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="popover"]').popover(); + // 图片查看大图 + $('img.preview-image').bootstrapViewer(); + // flash alert提示框自动关闭 if($('.admin-alert-container .alert').length > 0){ setTimeout(function(){ @@ -33,10 +37,25 @@ $(document).on('turbolinks:load', function(){ } }); -$(document).on("turbolinks:before-cache", function () { - $('[data-toggle="tooltip"]').tooltip('hide'); - $('[data-toggle="popover"]').popover('hide'); -}); +// var progressBar = new Turbolinks.ProgressBar(); + +// $(document).on('ajax:send', function(event){ +// console.log('ajax send', event); +// progressBar.setValue(0) +// progressBar.show() +// }); +// +// $(document).on('ajax:complete', function(event){ +// console.log('ajax complete', event); +// progressBar.setValue(1) +// progressBar.hide() // 分页时不触发,奇怪 +// }); +// $(document).on('ajax:success', function(event){ +// console.log('ajax success', event); +// }); +// $(document).on('ajax:error', function(event){ +// console.log('ajax error', event); +// }); $(function () { }); \ No newline at end of file diff --git a/app/assets/javascripts/admins/common-refuse-modal.js b/app/assets/javascripts/admins/common-refuse-modal.js new file mode 100644 index 000000000..5eb2f3f46 --- /dev/null +++ b/app/assets/javascripts/admins/common-refuse-modal.js @@ -0,0 +1,54 @@ +$(document).on('turbolinks:load', function() { + var $refuseModal = $('.admin-common-refuse-modal'); + if ($refuseModal.length > 0) { + var $form = $refuseModal.find('form.admin-common-refuse-form'); + var $applyIdInput = $refuseModal.find('.modal-body input[name="apply_id"]'); + + $form.validate({ + errorElement: 'span', + errorClass: 'danger text-danger', + rules: { + reason: { + required: true, + maxlength: 200 + }, + } + }); + + // modal ready fire + $refuseModal.on('show.bs.modal', function (event) { + var $link = $(event.relatedTarget); + + var applyId = $link.data('id'); + var url = $link.data('url'); + + $applyIdInput.val(applyId); + $form.data('url', url); + }); + // modal visited fire + $refuseModal.on('shown.bs.modal', function(){ + $refuseModal.find('.modal-body input[name="reason"]').focus(); + }); + $refuseModal.on('hide.bs.modal', function () { + $applyIdInput.val(''); + $form.data('url', ''); + }) + + $refuseModal.on('click', '.submit-btn', function(){ + $form.find('.error').html(''); + + if ($form.valid()) { + var url = $form.data('url'); + + $.ajax({ + method: 'POST', + dataType: 'script', + url: url, + data: $form.serialize(), + }).done(function(){ + $refuseModal.modal('hide'); + }); + } + }); + } +}); \ No newline at end of file diff --git a/app/assets/javascripts/admins/identity_authentications/index.js b/app/assets/javascripts/admins/identity_authentications/index.js new file mode 100644 index 000000000..2da644ec2 --- /dev/null +++ b/app/assets/javascripts/admins/identity_authentications/index.js @@ -0,0 +1,18 @@ +$(document).on('turbolinks:load', function() { + if ($('body.admins-identity-authentications-index-page').length > 0) { + var $searchFrom = $('.identity-authentication-list-form'); + + $searchFrom.on('click', '.search-form-tab', function(){ + var $link = $(this); + + $searchFrom.find('input[name="keyword"]').val(''); + $searchFrom.find('select[name="status"]').val('processed'); + + if($link.data('value') === 'processed'){ + $searchFrom.find('.status-filter').show(); + } else { + $searchFrom.find('.status-filter').hide(); + } + }); + } +}) \ No newline at end of file diff --git a/app/assets/javascripts/admins/professional_authentications/index.js b/app/assets/javascripts/admins/professional_authentications/index.js new file mode 100644 index 000000000..769a6b2fc --- /dev/null +++ b/app/assets/javascripts/admins/professional_authentications/index.js @@ -0,0 +1,18 @@ +$(document).on('turbolinks:load', function() { + if ($('body.admins-professional-authentications-index-page').length > 0) { + var $searchFrom = $('.professional-authentication-list-form'); + + $searchFrom.on('click', '.search-form-tab', function(){ + var $link = $(this); + + $searchFrom.find('input[name="keyword"]').val(''); + $searchFrom.find('select[name="status"]').val('processed'); + + if($link.data('value') === 'processed'){ + $searchFrom.find('.status-filter').show(); + } else { + $searchFrom.find('.status-filter').hide(); + } + }); + } +}) \ No newline at end of file diff --git a/app/assets/javascripts/admins/search-form-tab.js b/app/assets/javascripts/admins/search-form-tab.js new file mode 100644 index 000000000..6009412d5 --- /dev/null +++ b/app/assets/javascripts/admins/search-form-tab.js @@ -0,0 +1,10 @@ +$(document).on('turbolinks:load', function() { + var $tabs = $('.search-form-container .search-form-tabs'); + if ($tabs.length > 0) { + $tabs.on('click', '.search-form-tab', function(){ + var $activeTab = $(this); + $tabs.find('.search-form-tab').removeClass('active'); + $activeTab.addClass('active'); + }); + } +}); \ No newline at end of file diff --git a/app/assets/javascripts/bootstrap.viewer.js b/app/assets/javascripts/bootstrap.viewer.js new file mode 100755 index 000000000..4c6aa549a --- /dev/null +++ b/app/assets/javascripts/bootstrap.viewer.js @@ -0,0 +1,50 @@ +/* + * Copyright 2018-2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * WebSite: http://bootstrap-viewer.leftso.com + */ +$.fn.bootstrapViewer = function (options) { + $(this).on('click', function () { + var opts = $.extend({}, $.fn.bootstrapViewer.defaults, options); + var viewer = $(''); + $('body').append(viewer); + if ($(this).attr(opts.src)) { + $("#bootstrapViewer").find(".img-viewer").attr("src", $(this).attr(opts.src)); + $("#bootstrapViewer").modal(); + } else { + throw "图片不存在" + } + + }) + + $(this).on('mouseover', function () { + $(this).css('cursor', 'zoom-in'); + }) + +} +$.fn.bootstrapViewer.defaults = { + src: 'src' +} \ No newline at end of file diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index 33d585d83..0aa1329ca 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -25,7 +25,7 @@ a { } } -input.danger { +textarea.danger, input.danger { border-color: #dc3545!important; } @@ -43,4 +43,8 @@ label.error { height: calc(1.5em + 0.75rem + 2px) } } +} + +.flex-1 { + flex: 1; } \ No newline at end of file diff --git a/app/assets/stylesheets/admins/common.scss b/app/assets/stylesheets/admins/common.scss index 9830df3c7..2254166fd 100644 --- a/app/assets/stylesheets/admins/common.scss +++ b/app/assets/stylesheets/admins/common.scss @@ -100,5 +100,11 @@ font-size: 24px; } } + + .nav-tabs { + .nav-link { + padding: 0.5rem 2rem; + } + } } diff --git a/app/assets/stylesheets/admins/identity-authentications.scss b/app/assets/stylesheets/admins/identity-authentications.scss new file mode 100644 index 000000000..417581058 --- /dev/null +++ b/app/assets/stylesheets/admins/identity-authentications.scss @@ -0,0 +1,9 @@ +.admins-identity-authentications-index-page { + .identity-authentication-list-container { + span { + &.apply-status-1 { color: #28a745; } + &.apply-status-2 { color: #dc3545; } + &.apply-status-3 { color: #6c757d; } + } + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/admins/professional-authentications.scss b/app/assets/stylesheets/admins/professional-authentications.scss new file mode 100644 index 000000000..6ef78f92d --- /dev/null +++ b/app/assets/stylesheets/admins/professional-authentications.scss @@ -0,0 +1,9 @@ +.admins-professional-authentications-index-page { + .professional-authentication-list-container { + span { + &.apply-status-1 { color: #28a745; } + &.apply-status-2 { color: #dc3545; } + &.apply-status-3 { color: #6c757d; } + } + } +} \ No newline at end of file diff --git a/app/controllers/admins/identity_authentications_controller.rb b/app/controllers/admins/identity_authentications_controller.rb new file mode 100644 index 000000000..90758ace8 --- /dev/null +++ b/app/controllers/admins/identity_authentications_controller.rb @@ -0,0 +1,26 @@ +class Admins::IdentityAuthenticationsController < Admins::BaseController + def index + params[:status] ||= 'pending' + + applies = Admins::ApplyUserAuthenticationQuery.call(params.merge(type: 1)) + + @applies = paginate applies.preload(user: { user_extension: [:school, :department] }) + end + + def agree + Admins::IdentityAuths::AgreeApplyService.call(current_apply) + render_success_js + end + + def refuse + Admins::IdentityAuths::RefuseApplyService.call(current_apply, params) + + render_success_js + end + + private + + def current_apply + @_current_apply ||= ApplyUserAuthentication.real_name_auth.find(params[:id]) + end +end \ No newline at end of file diff --git a/app/controllers/admins/professional_authentications_controller.rb b/app/controllers/admins/professional_authentications_controller.rb new file mode 100644 index 000000000..327ee696c --- /dev/null +++ b/app/controllers/admins/professional_authentications_controller.rb @@ -0,0 +1,26 @@ +class Admins::ProfessionalAuthenticationsController < Admins::BaseController + def index + params[:status] ||= 'pending' + + applies = Admins::ApplyUserAuthenticationQuery.call(params.merge(type: 2)) + + @applies = paginate applies.preload(user: { user_extension: [:school, :department] }) + end + + def agree + Admins::ProfessionalAuths::AgreeApplyService.call(current_apply) + render_success_js + end + + def refuse + Admins::ProfessionalAuths::RefuseApplyService.call(current_apply, params) + + render_success_js + end + + private + + def current_apply + @_current_apply ||= ApplyUserAuthentication.professional_auth.find(params[:id]) + end +end \ No newline at end of file diff --git a/app/controllers/concerns/admins/render_helper.rb b/app/controllers/concerns/admins/render_helper.rb index c77c0ad32..3651f892b 100644 --- a/app/controllers/concerns/admins/render_helper.rb +++ b/app/controllers/concerns/admins/render_helper.rb @@ -40,6 +40,7 @@ module Admins::RenderHelper def render_delete_success render_js_template 'admins/shared/delete' end + alias_method :render_success_js, :render_delete_success def render_js_error(message) render_js_template 'admins/shared/error', locals: { message: message } diff --git a/app/helpers/admins/base_helper.rb b/app/helpers/admins/base_helper.rb new file mode 100644 index 000000000..c655be2e7 --- /dev/null +++ b/app/helpers/admins/base_helper.rb @@ -0,0 +1,102 @@ +module Admins::BaseHelper + def sidebar_item_group(url, text, **opts) + link_opts = url.start_with?('/') ? {} : { 'data-toggle': 'collapse', 'aria-expanded': false } + content = + link_to url, link_opts do + content_tag(:i, '', class: "fa fa-#{opts[:icon]}", 'data-toggle': 'tooltip', 'data-placement': 'right', 'data-boundary': 'window', title: text) + + content_tag(:span, text) + end + + content += + content_tag(:ul, id: url[1..-1], class: 'collapse list-unstyled', "data-parent": '#sidebar') do + yield + end + + raw content + end + + def sidebar_item(url, text, **opts) + content = + link_to url, 'data-controller': opts[:controller] do + content_tag(:i, '', class: "fa fa-#{opts[:icon]}", 'data-toggle': 'tooltip', 'data-placement': 'right', 'data-boundary': 'window', title: text) + + content_tag(:span, text) + end + + raw content + end + + def admin_sidebar_controller + key = params[:controller].to_s.gsub(/\//, '-') + SidebarUtil.controller_name(key) || key + end + + def define_admin_breadcrumbs(&block) + content_for(:setup_admin_breadcrumb, &block) + end + + def add_admin_breadcrumb(text, url = nil) + @_admin_breadcrumbs ||= [] + @_admin_breadcrumbs << OpenStruct.new(text: text, url: url) + end + + def display_text(str, default = '--') + str.presence || default + end + + def overflow_hidden_span(text, width: 300) + opts = { class: 'd-inline-block text-truncate', style: "max-width: #{width}px" } + opts.merge!('data-toggle': 'tooltip', title: text) if text != '--' + + content_tag(:span, text, opts) + end + + def sort_tag(content = '', **opts) + options = {} + options[:sort_by] = opts.delete(:name) + is_current_sort = params[:sort_by].to_s == options[:sort_by] + options[:sort_direction] = is_current_sort && params[:sort_direction].to_s == 'desc' ? 'asc' : 'desc' + + path = opts.delete(:path) + "?" + unsafe_params.merge(options).to_query + arrow_class = case params[:sort_direction].to_s + when 'desc' then 'fa-sort-amount-desc' + when 'asc' then 'fa-sort-amount-asc' + else '' + end + opts[:style] = "#{opts[:style]} ;position: relative;" + + content_tag(:span, opts) do + link_to path, remote: true do + content = content_tag(:span) { yield } if block_given? + + content += content_tag(:i, '', class: "fa color-light-green ml-1 #{arrow_class}", style: 'position: absolute;top:0;') if is_current_sort + raw content + end + end + end + + def javascript_void_link(name, **opts) + raw link_to(name, 'javascript:void(0)', opts) + end + + def agree_link(name, url, **opts) + klass = ['action agree-action', opts.delete(:class)].compact.join(' ') + + refresh_url_data = "refresh_url=#{CGI::escape(request.fullpath)}" + url = url + (url.index('?') ? '&' : '?') + refresh_url_data + + raw link_to(name, url, { method: :post, remote: true, class: klass, 'data-confirm': '确认审核通过?'}.merge(opts)) + end + + def delete_link(name, url, **opts) + klass = ['action delete-action', opts.delete(:class)].compact.join(' ') + + refresh_url_data = "refresh_url=#{CGI::escape(request.fullpath)}" + url = url + (url.index('?') ? '&' : '?') + refresh_url_data + + raw link_to(name, url, { method: :delete, remote: true, class: klass, 'data-confirm': '确认删除?'}.merge(opts)) + end + + def unsafe_params + params.except(:controller, :action).to_unsafe_h + end +end \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0f536433d..44169dc59 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -158,10 +158,22 @@ module ApplicationHelper disk_auth_filename('UserAuthentication', source_id, 'ID') end + def auth_file_url(source_type, source_id, type) + File.join('/images', relative_path, source_type, "#{source_id}#{type}") + end + + def real_name_auth_file_url(source_id) + auth_file_url('UserAuthentication', source_id, 'ID') + end + def disk_professional_auth_filename(source_id) disk_auth_filename('UserAuthentication', source_id, 'PRO') end + def professional_auth_file_url(source_id) + auth_file_url('UserAuthentication', source_id, 'PRO') + end + def shixun_url_to_avatar(shixun) if File.exist?(disk_filename(shixun.class, shixun.id)) File.join("images/#{relative_path}", "#{shixun.class}", "#{shixun.id}") @@ -386,95 +398,6 @@ module ApplicationHelper m_t&.include?("src=\"") ? m_t&.gsub("src=\"","src=\"#{origin_url}") : m_t end - # =========== Admin Helpers Begin =========== - def sidebar_item_group(url, text, **opts) - link_opts = url.start_with?('/') ? {} : { 'data-toggle': 'collapse', 'aria-expanded': false } - content = - link_to url, link_opts do - content_tag(:i, '', class: "fa fa-#{opts[:icon]}", 'data-toggle': 'tooltip', 'data-placement': 'right', 'data-boundary': 'window', title: text) + - content_tag(:span, text) - end - - content += - content_tag(:ul, id: url[1..-1], class: 'collapse list-unstyled', "data-parent": '#sidebar') do - yield - end - - raw content - end - - def sidebar_item(url, text, **opts) - content = - link_to url, 'data-controller': opts[:controller] do - content_tag(:i, '', class: "fa fa-#{opts[:icon]}", 'data-toggle': 'tooltip', 'data-placement': 'right', 'data-boundary': 'window', title: text) + - content_tag(:span, text) - end - - raw content - end - - def admin_sidebar_controller - key = params[:controller].to_s.gsub(/\//, '-') - SidebarUtil.controller_name(key) || key - end - - def define_admin_breadcrumbs(&block) - content_for(:setup_admin_breadcrumb, &block) - end - - def add_admin_breadcrumb(text, url = nil) - @_admin_breadcrumbs ||= [] - @_admin_breadcrumbs << OpenStruct.new(text: text, url: url) - end - - def display_text(str, default = '--') - str.presence || default - end - - def overflow_hidden_span(text, width: 300) - opts = { class: 'd-inline-block text-truncate', style: "max-width: #{width}px" } - opts.merge!('data-toggle': 'tooltip', title: text) if text != '--' - - content_tag(:span, text, opts) - end - - def sort_tag(content = '', **opts) - options = {} - options[:sort_by] = opts.delete(:name) - is_current_sort = params[:sort_by].to_s == options[:sort_by] - options[:sort_direction] = is_current_sort && params[:sort_direction].to_s == 'desc' ? 'asc' : 'desc' - - path = opts.delete(:path) + "?" + params.slice(:action, :controller).merge(options).to_unsafe_h.to_query - arrow_class = case params[:sort_direction].to_s - when 'desc' then 'fa-sort-amount-desc' - when 'asc' then 'fa-sort-amount-asc' - else '' - end - opts[:style] = "#{opts[:style]} ;position: relative;" - - content_tag(:span, opts) do - link_to path, remote: true do - content = content_tag(:span) { yield } if block_given? - - content += content_tag(:i, '', class: "fa color-light-green ml-1 #{arrow_class}", style: 'position: absolute;top:0;') if is_current_sort - raw content - end - end - end - - def javascript_void_link(name, **opts) - raw link_to(name, 'javascript:void(0)', opts) - end - - def delete_link(name, url, **opts) - klass = ['action delete-action', opts.delete(:class)].compact.join(' ') - - refresh_url_data = "refresh_url=#{CGI::escape(request.fullpath)}" - url = url + (url.index('?') ? '&' : '?') + refresh_url_data - - raw link_to(name, url, { method: :delete, remote: true, class: klass, 'data-confirm': '确认删除?'}.merge(opts)) - end - # =========== Admin Helpers End =========== end diff --git a/app/libs/util/file_manage.rb b/app/libs/util/file_manage.rb new file mode 100644 index 000000000..620fd7f01 --- /dev/null +++ b/app/libs/util/file_manage.rb @@ -0,0 +1,40 @@ +module Util::FileManage + module_function + + # 不同的类型扩展不同的目录 + def relative_path + "avatars" + end + + def storage_path + File.join(Rails.root, "public", "images", relative_path) + end + + def disk_filename(source_type,source_id,image_file=nil) + File.join(storage_path, "#{source_type}", "#{source_id}") + end + + def disk_auth_filename(source_type, source_id, type) + File.join(storage_path, "#{source_type}", "#{source_id}#{type}") + end + + def disk_real_name_auth_filename(source_id) + disk_auth_filename('UserAuthentication', source_id, 'ID') + end + + def auth_file_url(source_type, source_id, type) + File.join('/images', relative_path, source_type, "#{source_id}#{type}") + end + + def real_name_auth_file_url(source_id) + auth_file_url('UserAuthentication', source_id, 'ID') + end + + def disk_professional_auth_filename(source_id) + disk_auth_filename('UserAuthentication', source_id, 'PRO') + end + + def professional_auth_file_url(source_id) + auth_file_url('UserAuthentication', source_id, 'PRO') + end +end \ No newline at end of file diff --git a/app/models/apply_user_authentication.rb b/app/models/apply_user_authentication.rb index d467eb850..c379fb82e 100644 --- a/app/models/apply_user_authentication.rb +++ b/app/models/apply_user_authentication.rb @@ -12,6 +12,12 @@ class ApplyUserAuthentication < ApplicationRecord after_create :send_tiding + def status_text + I18n.t!("apply_user_authentication.status.#{status}") + rescue I18n::MissingTranslationData + nil + end + private def send_tiding diff --git a/app/queries/admins/apply_user_authentication_query.rb b/app/queries/admins/apply_user_authentication_query.rb new file mode 100644 index 000000000..a4d1c2a4a --- /dev/null +++ b/app/queries/admins/apply_user_authentication_query.rb @@ -0,0 +1,34 @@ +class Admins::ApplyUserAuthenticationQuery < ApplicationQuery + include CustomSortable + + attr_reader :params + + sort_columns :updated_at, default_by: :updated_at, default_direction: :desc + + def initialize(params) + @params = params + end + + def call + applies = ApplyUserAuthentication.where(auth_type: params[:type].presence || 1) + + status = + case params[:status] + when 'pending' then 0 + when 'processed' then [1, 2] + when 'agreed' then 1 + when 'refused' then 2 + else 0 + end + applies = applies.where(status: status) if status.present? + + # 关键字模糊查询 + keyword = params[:keyword].to_s.strip + if keyword.present? + applies = applies.joins(user: { user_extension: :school }) + .where('CONCAT(lastname,firstname) LIKE :keyword OR schools.name LIKE :keyword', keyword: "%#{keyword}%") + end + + custom_sort(applies, params[:sort_by], params[:sort_direction]) + end +end \ No newline at end of file diff --git a/app/services/admins/identity_auths/agree_apply_service.rb b/app/services/admins/identity_auths/agree_apply_service.rb new file mode 100644 index 000000000..65a3b2376 --- /dev/null +++ b/app/services/admins/identity_auths/agree_apply_service.rb @@ -0,0 +1,38 @@ +class Admins::IdentityAuths::AgreeApplyService < ApplicationService + attr_reader :apply, :user + + def initialize(apply) + @apply = apply + @user = apply.user + end + + def call + ActiveRecord::Base.transaction do + apply.update!(status: 1) + user.update!(authentication: true) + + RewardGradeService.call(user, container_id: user.id, container_type: 'Authentication', score: 500) + + deal_tiding! + delete_auth_file! + end + end + + private + + def deal_tiding! + apply.tidings.where(tiding_type: 'Apply').update_all(status: 1) + + Tiding.create!(user_id: apply.user_id, trigger_user_id: 0, + container_id: apply.id, container_type: 'ApplyUserAuthentication', + belong_container_id: apply.user_id, belong_container_type: 'User', + status: 1, tiding_type: 'System') + end + + def delete_auth_file! + path = Util::FileManage.disk_real_name_auth_filename(user.id) + File.delete(path) if File.exists?(path) + + apply.update!(is_delete: true) + end +end \ No newline at end of file diff --git a/app/services/admins/identity_auths/refuse_apply_service.rb b/app/services/admins/identity_auths/refuse_apply_service.rb new file mode 100644 index 000000000..57581dd40 --- /dev/null +++ b/app/services/admins/identity_auths/refuse_apply_service.rb @@ -0,0 +1,40 @@ +class Admins::IdentityAuths::RefuseApplyService < ApplicationService + attr_reader :apply, :user, :params + + def initialize(apply, params) + @apply = apply + @user = apply.user + @params = params + end + + def call + ActiveRecord::Base.transaction do + apply.update!(status: 2, remarks: reason) + + deal_tiding! + delete_auth_file! + end + end + + private + + def reason + params[:reason].to_s.strip + end + + def deal_tiding! + apply.tidings.where(tiding_type: 'Apply').update_all(status: 1) + + Tiding.create!(user_id: apply.user_id, trigger_user_id: 0, + container_id: apply.id, container_type: 'ApplyUserAuthentication', + belong_container_id: apply.user_id, belong_container_type: 'User', + status: 2, tiding_type: 'System') + end + + def delete_auth_file! + path = Util::FileManage.disk_real_name_auth_filename(user.id) + File.delete(path) if File.exists?(path) + + apply.update!(is_delete: true) + end +end \ No newline at end of file diff --git a/app/services/admins/professional_auths/agree_apply_service.rb b/app/services/admins/professional_auths/agree_apply_service.rb new file mode 100644 index 000000000..81654f0d3 --- /dev/null +++ b/app/services/admins/professional_auths/agree_apply_service.rb @@ -0,0 +1,38 @@ +class Admins::ProfessionalAuths::AgreeApplyService < ApplicationService + attr_reader :apply, :user + + def initialize(apply) + @apply = apply + @user = apply.user + end + + def call + ActiveRecord::Base.transaction do + apply.update!(status: 1) + user.update!(professional_certification: true) + + RewardGradeService.call(user, container_id: user.id, container_type: 'Professional', score: 500) + + deal_tiding! + delete_auth_file! + end + end + + private + + def deal_tiding! + apply.tidings.where(tiding_type: 'Apply').update_all(status: 1) + + Tiding.create!(user_id: apply.user_id, trigger_user_id: 0, + container_id: apply.id, container_type: 'ApplyUserAuthentication', + belong_container_id: apply.user_id, belong_container_type: 'User', + status: 1, tiding_type: 'System') + end + + def delete_auth_file! + path = Util::FileManage.disk_professional_auth_filename(user.id) + File.delete(path) if File.exists?(path) + + apply.update!(is_delete: true) + end +end \ No newline at end of file diff --git a/app/services/admins/professional_auths/refuse_apply_service.rb b/app/services/admins/professional_auths/refuse_apply_service.rb new file mode 100644 index 000000000..b5332c999 --- /dev/null +++ b/app/services/admins/professional_auths/refuse_apply_service.rb @@ -0,0 +1,40 @@ +class Admins::ProfessionalAuths::RefuseApplyService < ApplicationService + attr_reader :apply, :user, :params + + def initialize(apply, params) + @apply = apply + @user = apply.user + @params = params + end + + def call + ActiveRecord::Base.transaction do + apply.update!(status: 2, remarks: reason) + + deal_tiding! + delete_auth_file! + end + end + + private + + def reason + params[:reason].to_s.strip + end + + def deal_tiding! + apply.tidings.where(tiding_type: 'Apply').update_all(status: 1) + + Tiding.create!(user_id: apply.user_id, trigger_user_id: 0, + container_id: apply.id, container_type: 'ApplyUserAuthentication', + belong_container_id: apply.user_id, belong_container_type: 'User', + status: 2, tiding_type: 'System') + end + + def delete_auth_file! + path = Util::FileManage.disk_professional_auth_filename(user.id) + File.delete(path) if File.exists?(path) + + apply.update!(is_delete: true) + end +end \ No newline at end of file diff --git a/app/views/admins/identity_authentications/index.html.erb b/app/views/admins/identity_authentications/index.html.erb new file mode 100644 index 000000000..170a8fc4a --- /dev/null +++ b/app/views/admins/identity_authentications/index.html.erb @@ -0,0 +1,32 @@ +<% define_admin_breadcrumbs do %> + <% add_admin_breadcrumb('实名认证') %> +<% end %> + +
      + + + <%= form_tag(admins_identity_authentications_path(unsafe_params), method: :get, class: 'form-inline search-form justify-content-end mt-3', remote: true) do %> +
      + + <% status_options = [['全部', 'processed'], ['已同意', 'agreed'], ['已拒绝', 'refused']] %> + <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> +
      + <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '姓名/学校/单位检索') %> + <%= submit_tag('搜索', class: 'btn btn-primary ml-3') %> + <% end %> +
      + +
      + <%= render(partial: 'admins/identity_authentications/shared/list', locals: { applies: @applies }) %> +
      + +<%= render(partial: 'admins/shared/admin_common_refuse_modal') %> \ No newline at end of file diff --git a/app/views/admins/identity_authentications/index.js.erb b/app/views/admins/identity_authentications/index.js.erb new file mode 100644 index 000000000..81d108b0d --- /dev/null +++ b/app/views/admins/identity_authentications/index.js.erb @@ -0,0 +1 @@ +$('.identity-authentication-list-container').html("<%= j( render partial: 'admins/identity_authentications/shared/list', locals: { applies: @applies } ) %>"); \ No newline at end of file diff --git a/app/views/admins/identity_authentications/shared/_list.html.erb b/app/views/admins/identity_authentications/shared/_list.html.erb new file mode 100644 index 000000000..1cd849e72 --- /dev/null +++ b/app/views/admins/identity_authentications/shared/_list.html.erb @@ -0,0 +1,74 @@ +<% is_processed = params[:status].to_s != 'pending' %> + + + + + + + + + + <% unless is_processed %> + + <% end %> + + <% if is_processed %> + + + <% else %> + + <% end %> + + + + <% if applies.present? %> + <% applies.each do |apply| %> + <% user = apply.user %> + + + + + + + + <% unless is_processed %> + + <% end %> + + + + <% if is_processed %> + + + <% else %> + + <% end %> + + <% end %> + <% else %> + <%= render 'admins/shared/no_data_for_table' %> + <% end %> + +
      头像姓名身份证号学校/单位职称 + 照片 + + 时间拒绝原因状态操作
      + <%= link_to "/users/#{user.login}", class: 'identity-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %> + + <% end %> + <%= user.real_name %><%= user.ID_number %><%= raw [user.school_name.presence, user.department_name.presence].compact.join('
      ') %>
      <%= user.identity %> <%= raw user.user_extension.student? && user.student_id ? "
      #{user.student_id}" : '' %>
      + <% if File.exists?(disk_real_name_auth_filename(user.id)) %> + <%= image_tag(real_name_auth_file_url(user.id).to_s + "?#{Time.now.to_i}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %> + <% else %> + <%= content_tag(:span, '图片已删除', class: 'text-secondary') %> + <% end %> + <%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %><%= overflow_hidden_span apply.remarks, width: 140 %><%= apply.status_text %> + <%= agree_link '同意', agree_admins_identity_authentication_path(apply, element: ".identity-authentication-#{user.id}"), 'data-confirm': '确认审核通过?' %> + <%= javascript_void_link('拒绝', class: 'action refuse-action', + data: { + toggle: 'modal', target: '.admin-common-refuse-modal', id: apply.id, + url: refuse_admins_identity_authentication_path(apply, element: ".identity-authentication-#{user.id}") + }) %> +
      + +<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %> \ No newline at end of file diff --git a/app/views/admins/professional_authentications/index.html.erb b/app/views/admins/professional_authentications/index.html.erb new file mode 100644 index 000000000..e10d2bd80 --- /dev/null +++ b/app/views/admins/professional_authentications/index.html.erb @@ -0,0 +1,32 @@ +<% define_admin_breadcrumbs do %> + <% add_admin_breadcrumb('职业认证') %> +<% end %> + +
      + + + <%= form_tag(admins_professional_authentications_path(unsafe_params), method: :get, class: 'form-inline search-form justify-content-end mt-3', remote: true) do %> +
      + + <% status_options = [['全部', 'processed'], ['已同意', 'agreed'], ['已拒绝', 'refused']] %> + <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> +
      + <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '姓名/学校/单位检索') %> + <%= submit_tag('搜索', class: 'btn btn-primary ml-3') %> + <% end %> +
      + +
      + <%= render(partial: 'admins/professional_authentications/shared/list', locals: { applies: @applies }) %> +
      + +<%= render(partial: 'admins/shared/admin_common_refuse_modal') %> \ No newline at end of file diff --git a/app/views/admins/professional_authentications/index.js.erb b/app/views/admins/professional_authentications/index.js.erb new file mode 100644 index 000000000..468c131d6 --- /dev/null +++ b/app/views/admins/professional_authentications/index.js.erb @@ -0,0 +1 @@ +$('.professional-authentication-list-container').html("<%= j( render partial: 'admins/professional_authentications/shared/list', locals: { applies: @applies } ) %>"); \ No newline at end of file diff --git a/app/views/admins/professional_authentications/shared/_list.html.erb b/app/views/admins/professional_authentications/shared/_list.html.erb new file mode 100644 index 000000000..acd62eae5 --- /dev/null +++ b/app/views/admins/professional_authentications/shared/_list.html.erb @@ -0,0 +1,72 @@ +<% is_processed = params[:status].to_s != 'pending' %> + + + + + + + + + <% unless is_processed %> + + <% end %> + + <% if is_processed %> + + + <% else %> + + <% end %> + + + + <% if applies.present? %> + <% applies.each do |apply| %> + <% user = apply.user %> + + + + + + + <% unless is_processed %> + + <% end %> + + + + <% if is_processed %> + + + <% else %> + + <% end %> + + <% end %> + <% else %> + <%= render 'admins/shared/no_data_for_table' %> + <% end %> + +
      头像姓名学校/单位职称 + 照片 + + 时间拒绝原因状态操作
      + <%= link_to "/users/#{user.login}", class: 'professional-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %> + + <% end %> + <%= user.real_name %><%= raw [user.school_name.presence, user.department_name.presence].compact.join('
      ') %>
      <%= user.identity %> <%= raw user.user_extension.student? && user.student_id ? "
      #{user.student_id}" : '' %>
      + <% if File.exists?(disk_professional_auth_filename(user.id)) %> + <%= image_tag(professional_auth_file_url(user.id).to_s + "?#{Time.now.to_i}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %> + <% else %> + <%= content_tag(:span, '图片已删除', class: 'text-secondary') %> + <% end %> + <%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %><%= overflow_hidden_span apply.remarks, width: 140 %><%= apply.status_text %> + <%= agree_link '同意', agree_admins_professional_authentication_path(apply, element: ".professional-authentication-#{user.id}"), 'data-confirm': '确认审核通过?' %> + <%= javascript_void_link('拒绝', class: 'action refuse-action', + data: { + toggle: 'modal', target: '.admin-common-refuse-modal', id: apply.id, + url: refuse_admins_professional_authentication_path(apply, element: ".professional-authentication-#{user.id}") + }) %> +
      + +<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %> \ No newline at end of file diff --git a/app/views/admins/school_statistics/index.html.erb b/app/views/admins/school_statistics/index.html.erb index fd0c7cac1..0453dfffa 100644 --- a/app/views/admins/school_statistics/index.html.erb +++ b/app/views/admins/school_statistics/index.html.erb @@ -32,9 +32,9 @@
      <%= hidden_field_tag :data_type, params[:data_type] || 'grow' %> - <%= javascript_void_link '时段对比', class: "btn btn-outline-primary btn-sm contrast-btn #{params[:data_type] == 'contrast' ? 'active' : ''}", + <%= javascript_void_link '时段对比', class: "btn btn-outline-info btn-sm contrast-btn #{params[:data_type] == 'contrast' ? 'active' : ''}", data: { toggle: 'tooltip', trigger: 'hover', title: '请在左侧分别选择需进行对比的两个时段,具体从当日5:00开始计算,下表显示两时段选定指标两时段变化情况对比' } %> - <%= javascript_void_link '数据变化', class: "btn btn-outline-primary btn-sm grow-btn #{params[:data_type] == 'contrast' ? '' : 'active'}", + <%= javascript_void_link '数据变化', class: "btn btn-outline-info btn-sm grow-btn #{params[:data_type] == 'contrast' ? '' : 'active'}", data: { toggle: 'tooltip', trigger: 'hover', title: '请在左侧选择时间段,具体从当日5:00开始计算,下表显示选定时间段内各项指标数据变化情况' } %>
      diff --git a/app/views/admins/shared/_admin_common_refuse_modal.html.erb b/app/views/admins/shared/_admin_common_refuse_modal.html.erb new file mode 100644 index 000000000..a2daf7f0c --- /dev/null +++ b/app/views/admins/shared/_admin_common_refuse_modal.html.erb @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/app/views/admins/shared/_sidebar.html.erb b/app/views/admins/shared/_sidebar.html.erb index cd64f3d0f..2be899ebd 100644 --- a/app/views/admins/shared/_sidebar.html.erb +++ b/app/views/admins/shared/_sidebar.html.erb @@ -37,6 +37,13 @@ <% end %> +
    • + <%= sidebar_item_group('#apply-review-submenu', '审核', icon: 'gavel') do %> +
    • <%= sidebar_item(admins_identity_authentications_path, '实名认证', icon: 'id-card-o', controller: 'admins-identity_authentications') %>
    • +
    • <%= sidebar_item(admins_professional_authentications_path, '职业认证', icon: 'drivers-license', controller: 'admins-professional_authentications') %>
    • + <% end %> + +
    • <%= sidebar_item('/', '返回主站', icon: 'sign-out', controller: 'root') %>
    \ No newline at end of file diff --git a/app/views/admins/shared/after_render_js_hook.js.erb b/app/views/admins/shared/after_render_js_hook.js.erb index 9ceb13f5c..efc1e9295 100644 --- a/app/views/admins/shared/after_render_js_hook.js.erb +++ b/app/views/admins/shared/after_render_js_hook.js.erb @@ -1,3 +1,4 @@ ; $('[data-toggle="tooltip"]').tooltip(); -$('[data-toggle="popover"]').popover(); \ No newline at end of file +$('[data-toggle="popover"]').popover(); +$('img.preview-image').bootstrapViewer(); \ No newline at end of file diff --git a/app/views/admins/shared/delete.js.erb b/app/views/admins/shared/delete.js.erb index a10e1ae28..74512d55b 100644 --- a/app/views/admins/shared/delete.js.erb +++ b/app/views/admins/shared/delete.js.erb @@ -1,6 +1,8 @@ var deleteRow = $('<%= params[:element] %>'); var refreshUrl = '<%= params[:refresh_url] %>'; +$.notify({ message: '操作成功' },{ type: 'success' }); + var refreshFunc = function(url) { $.ajax({ url: url.length > 0 ? url : window.location.href, diff --git a/app/views/admins/users/shared/_user_list.html.erb b/app/views/admins/users/shared/_user_list.html.erb index e23e918fb..36b5d0f6e 100644 --- a/app/views/admins/users/shared/_user_list.html.erb +++ b/app/views/admins/users/shared/_user_list.html.erb @@ -1,29 +1,23 @@ - - + - - - - - + + + + + <% if users.present? %> <% users.each do |user| %> - - @@ -35,6 +29,8 @@
    ID真实姓名真实姓名 邮件地址 手机号码 单位<%= sort_tag('创建于', name: 'created_on', path: admins_users_path) %><%= sort_tag('最后登录', name: 'last_login_on', path: admins_users_path) %><%= sort_tag('经验值', name: 'experience', path: admins_users_path) %><%= sort_tag('金币', name: 'grade', path: admins_users_path) %>操作<%= sort_tag('创建于', name: 'created_on', path: admins_users_path) %><%= sort_tag('最后登录', name: 'last_login_on', path: admins_users_path) %><%= sort_tag('经验值', name: 'experience', path: admins_users_path) %><%= sort_tag('金币', name: 'grade', path: admins_users_path) %>操作
    + <%= link_to "/users/#{user.login}", target: '_blank' do %> - <%= overflow_hidden_span user.login, width: 100 %> - <% end %> - - <%= link_to edit_admins_user_path(user) do %> <%= overflow_hidden_span user.real_name, width: 100 %> <% end %> <%= user.experience.to_i %> <%= user.grade.to_i %> + <%= link_to '编辑', edit_admins_user_path(user), class: 'action' %> + <%= javascript_void_link('奖励', class: 'action reward-grade-action', data: { toggle: 'modal', target: '.admin-users-reward-grade-modal', id: user.id }) %> <%= javascript_void_link '解锁', class: 'action unlock-action', data: { id: user.id, confirm: '确认解锁吗?' }, style: user.locked? ? '' : 'display: none;' %> diff --git a/config/locales/apply_user_authentications/zh-CN.yml b/config/locales/apply_user_authentications/zh-CN.yml new file mode 100644 index 000000000..e886c2695 --- /dev/null +++ b/config/locales/apply_user_authentications/zh-CN.yml @@ -0,0 +1,7 @@ +zh-CN: + apply_user_authentication: + status: + '0': '待处理' + '1': '已同意' + '2': '已拒绝' + '3': '已撤销' \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 5ed8ecd69..4fc660a45 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -753,7 +753,7 @@ Rails.application.routes.draw do get :contrast, on: :collection end - resources :users, only: [:index, :edit, :update] do + resources :users, only: [:index, :edit, :update, :destroy] do member do post :reward_grade post :lock @@ -761,6 +761,19 @@ Rails.application.routes.draw do post :active end end + + resources :identity_authentications, only: [:index] do + member do + post :agree + post :refuse + end + end + resources :professional_authentications, only: [:index] do + member do + post :agree + post :refuse + end + end end #git 认证回调 From e490266891be9c2790523c1532ce54b81f0ab9b8 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, 26 Aug 2019 10:14:11 +0800 Subject: [PATCH 079/130] =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E6=B5=81=E7=A8=8B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/coursesPublic/PathModal.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/PathModal.js b/public/react/src/modules/courses/coursesPublic/PathModal.js index 07ce55024..33a2cb68d 100644 --- a/public/react/src/modules/courses/coursesPublic/PathModal.js +++ b/public/react/src/modules/courses/coursesPublic/PathModal.js @@ -180,11 +180,13 @@ class PathModal extends Component{ }else{ // this.homeworkstart //调用立即发布弹窗 + // this.props.showNotification(response.data.message) this.props.hidecouseShixunModal(); - this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) + this.props.updataleftNavfun() + // this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) // this.props.showNotification("选用成功") // this.props.showNotification(response.data.message) - // this.props.homeworkupdatalists(Coursename,page,order); + this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order); } // if(response.status===200) { From 7cef8ee60889b2e2338a61038de65276ca4fda9f Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 26 Aug 2019 10:16:07 +0800 Subject: [PATCH 080/130] cdn --- public/react/scripts/build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/scripts/build.js b/public/react/scripts/build.js index fe18e93e5..049e2eda1 100644 --- a/public/react/scripts/build.js +++ b/public/react/scripts/build.js @@ -203,7 +203,7 @@ function generateNewIndexJsp() { var result = data - .replace(jsMinAllRegex, '') + .replace(jsMinAllRegex, code) // .replace('/js/js_min_all.js', `${cdnHost}/react/build/js/js_min_all.js?v=${newVersion}`) // .replace('/js/js_min_all_2.js', `${cdnHost}/react/build/js/js_min_all_2.js?v=${newVersion}`) @@ -226,7 +226,7 @@ function generateNewIndexJsp() { .replace('/css/iconfont.css', `${cdnHost}/react/build/css/iconfont.css?v=${newVersion}`) .replace(/\/js\/create_kindeditor.js/g, `${cdnHost}/react/build/js/create_kindeditor.js?v=${newVersion}`) - .replace(mainRegex, code) + .replace(mainRegex, '') // .replace('/react/build/./static/css/main', `${cdnHost}/react/build/./static/css/main`) // .replace('/react/build/./static/js/main', `${cdnHost}/react/build/./static/js/main`) From 0993a0d485290cc6f8174295f2c87308c9e27d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 26 Aug 2019 11:13:54 +0800 Subject: [PATCH 084/130] =?UTF-8?q?=E8=B0=83=E6=95=B4=20=E5=85=AC=E5=91=8A?= =?UTF-8?q?=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/gradinforms/Bullsubdirectory.js | 10 +++++++++- .../src/modules/courses/gradinforms/Eduinforms.js | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js index c7f773190..ebfd2d51b 100644 --- a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js +++ b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js @@ -218,11 +218,19 @@ class Bullsubdirectory extends Component{ *
    +
    diff --git a/public/react/src/modules/courses/gradinforms/Eduinforms.js b/public/react/src/modules/courses/gradinforms/Eduinforms.js index f847c87d3..10beb4507 100644 --- a/public/react/src/modules/courses/gradinforms/Eduinforms.js +++ b/public/react/src/modules/courses/gradinforms/Eduinforms.js @@ -287,11 +287,19 @@ class Eduinforms extends Component{ *
    +
    From ad4cf27615c40bf823e41e0b7c3e46776dc85db1 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, 26 Aug 2019 11:28:14 +0800 Subject: [PATCH 085/130] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=97=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=83=85=E5=86=B5=E4=B8=8B=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/Resource/index.js | 4 ++-- public/react/src/modules/courses/boards/index.js | 6 +++--- public/react/src/modules/courses/exercise/Exercise.js | 2 +- .../src/modules/courses/graduation/tasks/index.js | 6 +++--- .../modules/courses/shixunHomework/shixunHomework.js | 10 ++++++---- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index 29c4a4ff5..3ecdef549 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -787,7 +787,7 @@ class Fileslists extends Component{ showSearchInput={true} > - {this.props.isAdmin()?
    + {this.props.isAdmin()? files===undefined?'' :files.length===0? "":
    {this.props.isAdmin()? 已选 {checkBoxValues.length} 个:""}
    @@ -948,7 +948,7 @@ class Fileslists extends Component{ />:""}
    -
    */} - {isAdmin &&
    -
    - {isAdmin && 已选 {checkBoxValues.length} 个} + {messages&&messages.length == 0?"": isAdmin &&
    +
    + {isAdmin&&已选 {checkBoxValues.length} 个}
    { !!isAdmin && diff --git a/public/react/src/modules/courses/exercise/Exercise.js b/public/react/src/modules/courses/exercise/Exercise.js index 4331bdc6f..05478b6f9 100644 --- a/public/react/src/modules/courses/exercise/Exercise.js +++ b/public/react/src/modules/courses/exercise/Exercise.js @@ -507,7 +507,7 @@ class Exercise extends Component{
    - {this.props.isAdmin()?
    + {this.props.isAdmin()?exercises && exercises.length ===0?"":
    已选 {checkBoxValues.length} 个
    diff --git a/public/react/src/modules/courses/graduation/tasks/index.js b/public/react/src/modules/courses/graduation/tasks/index.js index b54815b2f..8405e4964 100644 --- a/public/react/src/modules/courses/graduation/tasks/index.js +++ b/public/react/src/modules/courses/graduation/tasks/index.js @@ -667,7 +667,7 @@ class GraduationTasks extends Component{ // } secondRowLeft={ -
    +
    共{all_count}个毕设任务 已发布:{this.state.published_count}个 未发布:{this.state.unpublished_count}个 @@ -696,7 +696,7 @@ class GraduationTasks extends Component{ */} - {this.props.isAdmin()?
    + {this.props.isAdmin()?all_count===undefined?'' :all_count===0?"":
    已选 {checkBoxValues.length} 个
    @@ -770,7 +770,7 @@ class GraduationTasks extends Component{ />
    } -
    -

    +

    共 {datas&&datas.all_count}个实训作业 已发布:{datas&&datas.published_count}个 @@ -1062,7 +1062,9 @@ class ShixunHomework extends Component{
    - {this.props.isAdmin()===true?
    + {this.props.isAdmin()===true? + datas===undefined?'' :datas.task_count===0?"": +
    已选 {checkBoxValues&&checkBoxValues.length} 个 @@ -1211,8 +1213,8 @@ class ShixunHomework extends Component{ } } > -
    +
    +

    暂时还没有相关数据哦!

    From 0124871bf586bb62e9fc44e99da16dab3dff3b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 26 Aug 2019 11:49:50 +0800 Subject: [PATCH 086/130] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dsuffix=20=E9=80=A0?= =?UTF-8?q?=E6=88=90=E7=9A=84=E9=87=8D=E5=8F=A0=20=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/boards/BoardsNew.js | 15 ++++++++-- .../src/modules/courses/busyWork/NewWork.js | 13 ++++++++- .../modules/courses/exercise/ExerciseNew.js | 15 ++++++++-- .../graduation/tasks/GraduationTasksedit.js | 14 ++++++++-- .../graduation/tasks/GraduationTasksnew.js | 14 ++++++++-- .../graduation/topics/GraduateTopicNew.js | 13 ++++++++- .../react/src/modules/courses/poll/PollNew.js | 14 ++++++++-- .../modules/user/LoginRegisterComponent.js | 6 +++- .../modules/user/account/AccountBasicEdit.js | 28 ++++++++++++++++--- .../user/usersInfo/video/EditVideoModal.js | 16 +++++++++-- .../user/usersInfo/video/VideoUpload.js | 16 +++++++++-- 11 files changed, 140 insertions(+), 24 deletions(-) diff --git a/public/react/src/modules/courses/boards/BoardsNew.js b/public/react/src/modules/courses/boards/BoardsNew.js index b02f6a73f..2df6270c2 100644 --- a/public/react/src/modules/courses/boards/BoardsNew.js +++ b/public/react/src/modules/courses/boards/BoardsNew.js @@ -337,6 +337,17 @@ class BoardsNew extends Component{ } + + )} diff --git a/public/react/src/modules/courses/busyWork/NewWork.js b/public/react/src/modules/courses/busyWork/NewWork.js index ca79e8ac5..525e13922 100644 --- a/public/react/src/modules/courses/busyWork/NewWork.js +++ b/public/react/src/modules/courses/busyWork/NewWork.js @@ -389,6 +389,17 @@ class NewWork extends Component{

    {/* onSubmit={this.handleSubmit} */} +
    + )} + {/* )} */} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js index 42a128719..869295c59 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js @@ -375,11 +375,21 @@ class GraduationTasksedit extends Component{ (选择确认后,无法修改) - + {getFieldDecorator('name', { rules: [{ required: true, message: "请输入标题" }], - })()} + })()}
    diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js index 7c499430a..fae87fb65 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js @@ -377,15 +377,23 @@ class GraduationTasksnew extends Component { margin-top: 0px; margin-bottom: 0px; } + .yslgts .ant-input{ + border-right: none !important; + height: 40px !important; + } ` } {getFieldDecorator('name', { rules: [{required: true, message: "不能为空"}], - })()} + })( + + + + )}
    diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js index 3845721be..329cd169b 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js @@ -358,6 +358,17 @@ class GraduateTopicNew extends Component{ )} + + )}
    diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index 48bc69c79..27194e5e0 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -2529,14 +2529,24 @@ class PollNew extends Component {
    {/*suffix={String(addonAfter)}*/} + + className="searchViewAfter yslpollls">
    @@ -1112,7 +1116,7 @@ class LoginRegisterComponent extends Component { autoComplete="new-password" onClick={this.changeType} value={this.state.passwords} onChange={this.passwordonChanges} - suffix={ + addonAfter={ this.Showandhide(key)}> }> diff --git a/public/react/src/modules/user/account/AccountBasicEdit.js b/public/react/src/modules/user/account/AccountBasicEdit.js index cb6941070..27aae8893 100644 --- a/public/react/src/modules/user/account/AccountBasicEdit.js +++ b/public/react/src/modules/user/account/AccountBasicEdit.js @@ -492,7 +492,17 @@ class AccountBasic extends Component { } `}
    基本信息
    - + {String(nameLength)}/{MAX_NICKNAME_LENGTH} }> )} - + this.showOrHide(showRealName)}> }> diff --git a/public/react/src/modules/user/usersInfo/video/EditVideoModal.js b/public/react/src/modules/user/usersInfo/video/EditVideoModal.js index fc05cc932..7420d6750 100644 --- a/public/react/src/modules/user/usersInfo/video/EditVideoModal.js +++ b/public/react/src/modules/user/usersInfo/video/EditVideoModal.js @@ -63,7 +63,17 @@ function EditVideoModal (props) { onOk={onOk} onCancel={onCancel} className="editVideoModal" - > + > + )} diff --git a/public/react/src/modules/user/usersInfo/video/VideoUpload.js b/public/react/src/modules/user/usersInfo/video/VideoUpload.js index 26036529a..8efc308a7 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoUpload.js +++ b/public/react/src/modules/user/usersInfo/video/VideoUpload.js @@ -36,13 +36,23 @@ function VideoUpload (props) { cancelUpload(index, loaded == '100' )}>{loaded == '100' ? "删除" : "取消上传"}
    - +
    标题: - {String(title.length)}/{MAX_LENGTH} } - className="titleInput" + className="titleInput titleInputysl" >
    From 7c58af52ced0c1062525dea811f6ff93f21b0448 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 26 Aug 2019 13:50:20 +0800 Subject: [PATCH 087/130] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E6=9B=B4=E6=96=B0mys?= =?UTF-8?q?hixun=E7=9A=84=E7=8A=B6=E6=80=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index c7a598a43..019211e7b 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -13,8 +13,8 @@ class GamesController < ApplicationController def show uid_logger("--games show start") # 防止评测中途ajaxE被取消;3改成0是为了处理首次进入下一关的问题 - @game.update_attribute(:status, 0) if @game.status == 1 - @game.update_attributes(status: 0, open_time: Time.now) if @game.status == 3 + update_game_parameter(@game) + game_challenge = Challenge.base_attrs.find(@game.challenge_id) # 选择题类型的实训关卡总分 @@ -964,4 +964,13 @@ class GamesController < ApplicationController nil end end + + # 更新关卡状态和一些学习进度 + def update_game_parameter game + game.update_attribute(:status, 0) if game.status == 1 + game.update_attributes(status: 0, open_time: Time.now) if game.status == 3 + # 开启实训更新myshixuns的时间,方便跟踪用于的学习进度。 + game.myshixun.update_column(:update_at, Time.now) + end + end From e9fb87759f26d61ae0864d557277a54b9b56607c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 26 Aug 2019 14:03:39 +0800 Subject: [PATCH 088/130] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dsuffix=20=E9=80=A0?= =?UTF-8?q?=E6=88=90=E7=9A=84=E9=87=8D=E5=8F=A0=20=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/new/CoursesNew.js | 17 +++++++++++++++- .../src/modules/courses/new/Goldsubject.js | 20 ++++++++++++------- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index 8c68dd4c5..ed07d5c4a 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -1,11 +1,12 @@ import React, {Component} from "React"; -import {Form, Select, Input, Button, Checkbox, DatePicker,Spin,Icon,AutoComplete,InputNumber} from "antd"; +import {Form, Select, Input, Button, Checkbox, DatePicker,Spin,Icon,AutoComplete,InputNumber,Breadcrumb} from "antd"; import ApplyForAddOrgModal from '../../user/modal/ApplyForAddOrgModal'; import axios from 'axios'; import "../css/Courses.css"; import locale from 'antd/lib/date-picker/locale/zh_CN'; import moment from 'moment'; import Modals from '../../modals/Modals'; +import {WordsBtn, ActionBtn} from 'educoder'; @@ -503,6 +504,20 @@ class CoursesNew extends Component { />
    + {/**/} + {/* */} + {/* 翻转课堂*/} + {/* */} + {/* {this.props.match.params.coursesId === undefined ?"新建课堂":"编辑课堂"}*/} + {/**/} + +

    + 翻转课堂 + > + {this.props.match.params.coursesId === undefined ?"新建课堂":"编辑课堂"} +

    + +

    {this.props.match.params.coursesId === undefined ? "新建课堂" : "编辑课堂"}

    返回 diff --git a/public/react/src/modules/courses/new/Goldsubject.js b/public/react/src/modules/courses/new/Goldsubject.js index ee1d3b9c7..a51e535e9 100644 --- a/public/react/src/modules/courses/new/Goldsubject.js +++ b/public/react/src/modules/courses/new/Goldsubject.js @@ -6,7 +6,7 @@ import "../css/Courses.css"; import locale from 'antd/lib/date-picker/locale/zh_CN'; import moment from 'moment'; import Modals from '../../modals/Modals'; - +import {WordsBtn, ActionBtn} from 'educoder'; const { Option } = Select; @@ -651,12 +651,18 @@ class Goldsubject extends Component {
    - - - 首页 - - {Whethertocreateanewclassroom===true?"新建课堂":"编辑课堂"} - + {/**/} + {/* */} + {/* 翻转课堂*/} + {/* */} + {/* {Whethertocreateanewclassroom===true?"新建课堂":"编辑课堂"}*/} + {/**/} +

    + 翻转课堂 + > + {Whethertocreateanewclassroom===true?"新建课堂":"编辑课堂"} +

    +

    {Whethertocreateanewclassroom===true ? "新建课堂" : "编辑课堂"}

    From dc2478b88b36662ffcb146aa6e87fbbf42c271f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 26 Aug 2019 14:10:16 +0800 Subject: [PATCH 089/130] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/new/CoursesNew.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index ed07d5c4a..46380d85b 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -519,7 +519,7 @@ class CoursesNew extends Component {
    -

    {this.props.match.params.coursesId === undefined ? "新建课堂" : "编辑课堂"}

    +

    {this.props.match.params.coursesId === undefined ? "新建课堂" : "编辑课堂"}

    返回
    - { tasks.map((item, index) => { + { tasks&&tasks.map((item, index) => { // console.log(item) return ( -
    +
    this.onItemClick(item)}>
    +
    this.props.onItemClick(discussMessage)}> -
    -
    - +
    window.$(`.sourceitem${index} input`).click() }> +
    this.eventStop(event)}> + {checkBox} { @@ -283,16 +287,15 @@ class Fileslistitem extends Component{ {this.props.isAdmin? - - + this.eventStop(event)}> - this.settingList()}>设置 - + this.settingList()}>设置 + :""} {this.props.isStudent===true&&this.props.current_user.login===discussMessage.author.login? - + this.eventStop(event)}> :""} Settingtypes={(id)=>this.Settingtypes(id)} coursesId={this.props.match.params.coursesId} - updatafiledfun={()=>this.updatafiled()} + updatafiledfun={()=>this.updatafiled()} + index={index} >
    diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index cdbac6760..045b0f67a 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -1163,7 +1163,7 @@ class ShixunHomework extends Component{ isStudent={this.props.isStudent()} isNotMember={this.props.isNotMember()} isClassManagement={this.props.isClassManagement()} - checkBox={this.props.isAdmin()?:""} + checkBox={this.props.isAdmin()?:""} match={this.props.match} index={index} coursedata={this.props.coursedata} From 0f59e0f66b7c99034c714909000c48e4ed7b4aa4 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 26 Aug 2019 14:37:07 +0800 Subject: [PATCH 093/130] =?UTF-8?q?=E9=97=B4=E8=B7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/busyWork/CommonWorkQuestion.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkQuestion.js b/public/react/src/modules/courses/busyWork/CommonWorkQuestion.js index f400cd9a2..d2ce6b8e4 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkQuestion.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkQuestion.js @@ -91,7 +91,7 @@ class CommonWorkQuestion extends Component{ {/* 内容区 */}
    - + { attachments && attachments.map((item) => { return (
    From d259c4e83d259c0987f407a75573030e75b72352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 26 Aug 2019 14:38:30 +0800 Subject: [PATCH 094/130] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/new/CoursesNew.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index 46380d85b..25459fcc6 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -710,6 +710,12 @@ class CoursesNew extends Component { { checkbofrups===undefined?"":checkbofrups.length===0?"":checkbofrups.map((item,key)=>{ return( + item.module_type==="announcement"? + "" + : + item.module_type==="online_learning"? + "" + : {item.module_name} ) }) From 9b897c639985dc26468945898e88161e2f2c87a4 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, 26 Aug 2019 14:56:43 +0800 Subject: [PATCH 095/130] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/exercise/ExerciseListItem.js | 2 +- .../src/modules/courses/graduation/topics/GraduateTopicItem.js | 2 +- public/react/src/modules/courses/poll/PollListItem.js | 2 +- .../react/src/modules/courses/shixunHomework/shixunHomework.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/courses/exercise/ExerciseListItem.js b/public/react/src/modules/courses/exercise/ExerciseListItem.js index 77bb01d04..5248f4c1a 100644 --- a/public/react/src/modules/courses/exercise/ExerciseListItem.js +++ b/public/react/src/modules/courses/exercise/ExerciseListItem.js @@ -59,7 +59,7 @@ class ExerciseListItem extends Component{ // console.log(this.props.current_user.user_id) return( -
    this.props.onItemClick(this.props.item)}> +
    window.$(`.exerciseitem${index} input`).click() }> { IsAdmin && diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js index 7d504090f..bac04c699 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js @@ -31,7 +31,7 @@ class GraduateTopicItem extends Component{ return ''; } return( -
    this.props.onItemClick(discussMessage)}> +
    - +

    微信扫一扫

    关注公众号

    From 4374223f7dff0eefe865d9f030c83076d2443929 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Mon, 26 Aug 2019 15:41:31 +0800 Subject: [PATCH 099/130] admins: shixun publish and subject publish feature --- .../admins/shixun_authorizations/index.js | 18 ++++++ .../admins/subject_authorizations/index.js | 18 ++++++ ...tics.scss => daily_school_statistics.scss} | 0 ...ons.scss => identity_authentications.scss} | 0 ...scss => professional_authentications.scss} | 0 ...statistics.scss => school_statistics.scss} | 0 .../admins/shixun_authorizations.scss | 9 +++ .../admins/subject_authorizations.scss | 9 +++ .../shixun_authorizations_controller.rb | 48 ++++++++++++++ .../subject_authorizations_controller.rb | 49 ++++++++++++++ .../concerns/admins/error_rescue_handler.rb | 2 +- .../concerns/admins/render_helper.rb | 2 +- app/models/apply_action.rb | 8 +++ .../shixun_auths/agree_apply_service.rb | 43 +++++++++++++ .../shixun_auths/refuse_apply_service.rb | 35 ++++++++++ .../subject_auths/agree_apply_service.rb | 30 +++++++++ .../subject_auths/refuse_apply_service.rb | 35 ++++++++++ app/views/admins/shared/_sidebar.html.erb | 2 + app/views/admins/shared/error.js.erb | 5 +- .../shixun_authorizations/index.html.erb | 32 ++++++++++ .../admins/shixun_authorizations/index.js.erb | 1 + .../shared/_list.html.erb | 60 +++++++++++++++++ .../subject_authorizations/index.html.erb | 33 ++++++++++ .../subject_authorizations/index.js.erb | 1 + .../shared/_list.html.erb | 64 +++++++++++++++++++ config/locales/apply_actions/zh-CN.yml | 7 ++ config/routes.rb | 12 ++++ 27 files changed, 520 insertions(+), 3 deletions(-) create mode 100644 app/assets/javascripts/admins/shixun_authorizations/index.js create mode 100644 app/assets/javascripts/admins/subject_authorizations/index.js rename app/assets/stylesheets/admins/{daily-school-statistics.scss => daily_school_statistics.scss} (100%) rename app/assets/stylesheets/admins/{identity-authentications.scss => identity_authentications.scss} (100%) rename app/assets/stylesheets/admins/{professional-authentications.scss => professional_authentications.scss} (100%) rename app/assets/stylesheets/admins/{school-statistics.scss => school_statistics.scss} (100%) create mode 100644 app/assets/stylesheets/admins/shixun_authorizations.scss create mode 100644 app/assets/stylesheets/admins/subject_authorizations.scss create mode 100644 app/controllers/admins/shixun_authorizations_controller.rb create mode 100644 app/controllers/admins/subject_authorizations_controller.rb create mode 100644 app/services/admins/shixun_auths/agree_apply_service.rb create mode 100644 app/services/admins/shixun_auths/refuse_apply_service.rb create mode 100644 app/services/admins/subject_auths/agree_apply_service.rb create mode 100644 app/services/admins/subject_auths/refuse_apply_service.rb create mode 100644 app/views/admins/shixun_authorizations/index.html.erb create mode 100644 app/views/admins/shixun_authorizations/index.js.erb create mode 100644 app/views/admins/shixun_authorizations/shared/_list.html.erb create mode 100644 app/views/admins/subject_authorizations/index.html.erb create mode 100644 app/views/admins/subject_authorizations/index.js.erb create mode 100644 app/views/admins/subject_authorizations/shared/_list.html.erb create mode 100644 config/locales/apply_actions/zh-CN.yml diff --git a/app/assets/javascripts/admins/shixun_authorizations/index.js b/app/assets/javascripts/admins/shixun_authorizations/index.js new file mode 100644 index 000000000..ba7b23821 --- /dev/null +++ b/app/assets/javascripts/admins/shixun_authorizations/index.js @@ -0,0 +1,18 @@ +$(document).on('turbolinks:load', function() { + if ($('body.admins-shixun-authorizations-index-page').length > 0) { + var $searchFrom = $('.shixun-authorization-list-form'); + + $searchFrom.on('click', '.search-form-tab', function(){ + var $link = $(this); + + $searchFrom.find('input[name="keyword"]').val(''); + $searchFrom.find('select[name="status"]').val('processed'); + + if($link.data('value') === 'processed'){ + $searchFrom.find('.status-filter').show(); + } else { + $searchFrom.find('.status-filter').hide(); + } + }); + } +}) \ No newline at end of file diff --git a/app/assets/javascripts/admins/subject_authorizations/index.js b/app/assets/javascripts/admins/subject_authorizations/index.js new file mode 100644 index 000000000..d80f0850c --- /dev/null +++ b/app/assets/javascripts/admins/subject_authorizations/index.js @@ -0,0 +1,18 @@ +$(document).on('turbolinks:load', function() { + if ($('body.admins-subject-authorizations-index-page').length > 0) { + var $searchFrom = $('.subject-authorization-list-form'); + + $searchFrom.on('click', '.search-form-tab', function(){ + var $link = $(this); + + $searchFrom.find('input[name="keyword"]').val(''); + $searchFrom.find('select[name="status"]').val('processed'); + + if($link.data('value') === 'processed'){ + $searchFrom.find('.status-filter').show(); + } else { + $searchFrom.find('.status-filter').hide(); + } + }); + } +}) \ No newline at end of file diff --git a/app/assets/stylesheets/admins/daily-school-statistics.scss b/app/assets/stylesheets/admins/daily_school_statistics.scss similarity index 100% rename from app/assets/stylesheets/admins/daily-school-statistics.scss rename to app/assets/stylesheets/admins/daily_school_statistics.scss diff --git a/app/assets/stylesheets/admins/identity-authentications.scss b/app/assets/stylesheets/admins/identity_authentications.scss similarity index 100% rename from app/assets/stylesheets/admins/identity-authentications.scss rename to app/assets/stylesheets/admins/identity_authentications.scss diff --git a/app/assets/stylesheets/admins/professional-authentications.scss b/app/assets/stylesheets/admins/professional_authentications.scss similarity index 100% rename from app/assets/stylesheets/admins/professional-authentications.scss rename to app/assets/stylesheets/admins/professional_authentications.scss diff --git a/app/assets/stylesheets/admins/school-statistics.scss b/app/assets/stylesheets/admins/school_statistics.scss similarity index 100% rename from app/assets/stylesheets/admins/school-statistics.scss rename to app/assets/stylesheets/admins/school_statistics.scss diff --git a/app/assets/stylesheets/admins/shixun_authorizations.scss b/app/assets/stylesheets/admins/shixun_authorizations.scss new file mode 100644 index 000000000..05bcbc2bb --- /dev/null +++ b/app/assets/stylesheets/admins/shixun_authorizations.scss @@ -0,0 +1,9 @@ +.admins-shixun-authorizations-index-page { + .shixun-authorization-list-container { + span { + &.apply-status-1 { color: #28a745; } + &.apply-status-2 { color: #dc3545; } + &.apply-status-3 { color: #6c757d; } + } + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/admins/subject_authorizations.scss b/app/assets/stylesheets/admins/subject_authorizations.scss new file mode 100644 index 000000000..f16c30151 --- /dev/null +++ b/app/assets/stylesheets/admins/subject_authorizations.scss @@ -0,0 +1,9 @@ +.admins-subject-authorizations-index-page { + .subject-authorization-list-container { + span { + &.apply-status-1 { color: #28a745; } + &.apply-status-2 { color: #dc3545; } + &.apply-status-3 { color: #6c757d; } + } + } +} \ No newline at end of file diff --git a/app/controllers/admins/shixun_authorizations_controller.rb b/app/controllers/admins/shixun_authorizations_controller.rb new file mode 100644 index 000000000..31bd5faf7 --- /dev/null +++ b/app/controllers/admins/shixun_authorizations_controller.rb @@ -0,0 +1,48 @@ +class Admins::ShixunAuthorizationsController < Admins::BaseController + def index + params[:status] ||= 'pending' + + applies = ApplyAction.where(container_type: 'ApplyShixun') + + status = + case params[:status] + when 'pending' then 0 + when 'processed' then [1, 2] + when 'agreed' then 1 + when 'refused' then 2 + else 0 + end + applies = applies.where(status: status) if status.present? + + # 关键字模糊查询 + keyword = params[:keyword].to_s.strip + if keyword.present? + applies = applies.joins('JOIN shixuns ON shixuns.id = apply_actions.container_id') + .where('shixuns.name LIKE :keyword', keyword: "%#{keyword}%") + end + + applies = applies.order(updated_at: :desc) + + @applies = paginate applies.includes(user: :user_extension) + + shixun_ids = @applies.map(&:container_id) + @shixun_map = Shixun.where(id: shixun_ids).each_with_object({}) { |s, h| h[s.id] = s } + end + + def agree + Admins::ShixunAuths::AgreeApplyService.call(current_apply, current_user) + render_success_js + end + + def refuse + Admins::ShixunAuths::RefuseApplyService.call(current_apply, current_user, params) + + render_success_js + end + + private + + def current_apply + @_current_apply ||= ApplyAction.where(container_type: 'ApplyShixun').find(params[:id]) + end +end \ No newline at end of file diff --git a/app/controllers/admins/subject_authorizations_controller.rb b/app/controllers/admins/subject_authorizations_controller.rb new file mode 100644 index 000000000..3d3733fa4 --- /dev/null +++ b/app/controllers/admins/subject_authorizations_controller.rb @@ -0,0 +1,49 @@ +class Admins::SubjectAuthorizationsController < Admins::BaseController + def index + params[:status] ||= 'pending' + + applies = ApplyAction.where(container_type: 'ApplySubject') + + status = + case params[:status] + when 'pending' then 0 + when 'processed' then [1, 2] + when 'agreed' then 1 + when 'refused' then 2 + else 0 + end + applies = applies.where(status: status) if status.present? + + # 关键字模糊查询 + keyword = params[:keyword].to_s.strip + if keyword.present? + applies = applies.joins('JOIN subjects ON subjects.id = apply_actions.container_id') + .where('subjects.name LIKE :keyword', keyword: "%#{keyword}%") + end + + applies = applies.order(updated_at: :desc) + + @applies = paginate applies.includes(user: :user_extension) + + subject_ids = @applies.map(&:container_id) + @subject_map = Subject.where(id: subject_ids).each_with_object({}) { |s, h| h[s.id] = s } + @challenge_count_map = Challenge.joins(shixun: :stage_shixuns).where(st: 0, stage_shixuns: { subject_id: subject_ids}).group('subject_id').count + end + + def agree + Admins::SubjectAuths::AgreeApplyService.call(current_apply, current_user) + render_success_js + end + + def refuse + Admins::SubjectAuths::RefuseApplyService.call(current_apply, current_user, params) + + render_success_js + end + + private + + def current_apply + @_current_apply ||= ApplyAction.where(container_type: 'ApplySubject').find(params[:id]) + end +end \ No newline at end of file diff --git a/app/controllers/concerns/admins/error_rescue_handler.rb b/app/controllers/concerns/admins/error_rescue_handler.rb index b1e29d5ce..ceb810f36 100644 --- a/app/controllers/concerns/admins/error_rescue_handler.rb +++ b/app/controllers/concerns/admins/error_rescue_handler.rb @@ -2,7 +2,7 @@ module Admins::ErrorRescueHandler extend ActiveSupport::Concern included do - rescue_from Exception, Educoder::TipException do |e| + rescue_from Exception do |e| raise e if Rails.env.development? Util.logger_error e diff --git a/app/controllers/concerns/admins/render_helper.rb b/app/controllers/concerns/admins/render_helper.rb index 3651f892b..0ccc16a09 100644 --- a/app/controllers/concerns/admins/render_helper.rb +++ b/app/controllers/concerns/admins/render_helper.rb @@ -28,7 +28,7 @@ module Admins::RenderHelper def internal_server_error respond_to do |format| format.html { render 'admins/shared/500' } - format.js { render_js_error(message) } + format.js { render_js_error('系统错误') } format.json { render status: 500, json: { message: '系统错误' } } end end diff --git a/app/models/apply_action.rb b/app/models/apply_action.rb index 2d31f394d..54bdaa396 100644 --- a/app/models/apply_action.rb +++ b/app/models/apply_action.rb @@ -1,8 +1,16 @@ # 申请消息 class ApplyAction < ApplicationRecord + belongs_to :user + has_many :tidings, :as => :container, :dependent => :destroy after_create :send_tiding + def status_text + I18n.t!("apply_action.status.#{status}") + rescue I18n::MissingTranslationData + nil + end + def send_tiding if container_type == 'TrialAuthorization' && status == 1 tidings.create(user_id: user_id, trigger_user_id: 0, status: 1, viewed: 0, tiding_type: 'System', diff --git a/app/services/admins/shixun_auths/agree_apply_service.rb b/app/services/admins/shixun_auths/agree_apply_service.rb new file mode 100644 index 000000000..4734e03bb --- /dev/null +++ b/app/services/admins/shixun_auths/agree_apply_service.rb @@ -0,0 +1,43 @@ +class Admins::ShixunAuths::AgreeApplyService < ApplicationService + attr_reader :apply, :user, :shixun + + def initialize(apply, user) + @apply = apply + @user = user + @shixun = Shixun.find(apply.container_id) + end + + def call + ActiveRecord::Base.transaction do + apply.update!(status: 1, dealer_id: user.id) + shixun.update!(status: 2, publish_time: Time.now) + + # 奖励金币、经验 + reward_grade_and_experience! + + deal_tiding! + end + end + + private + + def reward_grade_and_experience! + score = shixun.all_score + shixun_creator = shixun.user + + RewardGradeService.call(shixun_creator, container_id: shixun.id, container_type: 'shixunPublish', score: score) + + Experience.create!(user_id: shixun_creator.id, container_id: shixun.id, container_type: 'shixunPublish', score: score) + shixun_creator.update_column(:experience, shixun_creator.experience.to_i + score) + end + + def deal_tiding! + apply.tidings.where(tiding_type: 'Apply', status: 0).update_all(status: 1) + + Tiding.create!(user_id: apply.user_id, trigger_user_id: 0, + container_id: apply.id, container_type: 'ApplyAction', + parent_container_id: apply.container_id, parent_container_type: apply.container_type, + belong_container_id: apply.container_id, belong_container_type: 'Shixun', + status: 1, tiding_type: 'System') + end +end \ No newline at end of file diff --git a/app/services/admins/shixun_auths/refuse_apply_service.rb b/app/services/admins/shixun_auths/refuse_apply_service.rb new file mode 100644 index 000000000..49416a2b0 --- /dev/null +++ b/app/services/admins/shixun_auths/refuse_apply_service.rb @@ -0,0 +1,35 @@ +class Admins::ShixunAuths::RefuseApplyService < ApplicationService + attr_reader :apply, :user, :shixun, :params + + def initialize(apply, user, params) + @apply = apply + @user = user + @shixun = Shixun.find(apply.container_id) + @params = params + end + + def call + ActiveRecord::Base.transaction do + shixun.update!(status: 0) + apply.update!(status: 2, reason: reason, dealer_id: user.id) + + deal_tiding! + end + end + + private + + def reason + params[:reason].to_s.strip + end + + def deal_tiding! + apply.tidings.where(tiding_type: 'Apply', status: 0).update_all(status: 1) + + Tiding.create!(user_id: apply.user_id, trigger_user_id: 0, + container_id: apply.id, container_type: 'ApplyAction', + parent_container_id: apply.container_id, parent_container_type: apply.container_type, + belong_container_id: apply.container_id, belong_container_type: 'Shixun', + status: 2, tiding_type: 'System') + end +end \ No newline at end of file diff --git a/app/services/admins/subject_auths/agree_apply_service.rb b/app/services/admins/subject_auths/agree_apply_service.rb new file mode 100644 index 000000000..465e3e903 --- /dev/null +++ b/app/services/admins/subject_auths/agree_apply_service.rb @@ -0,0 +1,30 @@ +class Admins::SubjectAuths::AgreeApplyService < ApplicationService + attr_reader :apply, :user, :subject + + def initialize(apply, user) + @apply = apply + @user = user + @subject = Subject.find(apply.container_id) + end + + def call + ActiveRecord::Base.transaction do + apply.update!(status: 1, dealer_id: user.id) + subject.update!(status: 2, publish_time: Time.now) + + deal_tiding! + end + end + + private + + def deal_tiding! + apply.tidings.where(tiding_type: 'Apply', status: 0).update_all(status: 1) + + Tiding.create!(user_id: apply.user_id, trigger_user_id: 0, + container_id: apply.id, container_type: 'ApplyAction', + parent_container_id: apply.container_id, parent_container_type: apply.container_type, + belong_container_id: apply.container_id, belong_container_type: 'Subject', + status: 1, tiding_type: 'System') + end +end \ No newline at end of file diff --git a/app/services/admins/subject_auths/refuse_apply_service.rb b/app/services/admins/subject_auths/refuse_apply_service.rb new file mode 100644 index 000000000..f51d55185 --- /dev/null +++ b/app/services/admins/subject_auths/refuse_apply_service.rb @@ -0,0 +1,35 @@ +class Admins::SubjectAuths::RefuseApplyService < ApplicationService + attr_reader :apply, :user, :subject, :params + + def initialize(apply, user, params) + @apply = apply + @user = user + @subject = Subject.find(apply.container_id) + @params = params + end + + def call + ActiveRecord::Base.transaction do + subject.update!(status: 0) + apply.update!(status: 2, reason: reason, dealer_id: user.id) + + deal_tiding! + end + end + + private + + def reason + params[:reason].to_s.strip + end + + def deal_tiding! + apply.tidings.where(tiding_type: 'Apply', status: 0).update_all(status: 1) + + Tiding.create!(user_id: apply.user_id, trigger_user_id: 0, + container_id: apply.id, container_type: 'ApplyAction', + parent_container_id: apply.container_id, parent_container_type: apply.container_type, + belong_container_id: apply.container_id, belong_container_type: 'Subject', + status: 2, tiding_type: 'System') + end +end \ No newline at end of file diff --git a/app/views/admins/shared/_sidebar.html.erb b/app/views/admins/shared/_sidebar.html.erb index 2be899ebd..ab30e8bd3 100644 --- a/app/views/admins/shared/_sidebar.html.erb +++ b/app/views/admins/shared/_sidebar.html.erb @@ -41,6 +41,8 @@ <%= sidebar_item_group('#apply-review-submenu', '审核', icon: 'gavel') do %>
  • <%= sidebar_item(admins_identity_authentications_path, '实名认证', icon: 'id-card-o', controller: 'admins-identity_authentications') %>
  • <%= sidebar_item(admins_professional_authentications_path, '职业认证', icon: 'drivers-license', controller: 'admins-professional_authentications') %>
  • +
  • <%= sidebar_item(admins_shixun_authorizations_path, '实训发布', icon: 'object-ungroup', controller: 'admins-shixun_authorizations') %>
  • +
  • <%= sidebar_item(admins_subject_authorizations_path, '实践课程发布', icon: 'object-group', controller: 'admins-subject_authorizations') %>
  • <% end %> diff --git a/app/views/admins/shared/error.js.erb b/app/views/admins/shared/error.js.erb index ebb78aec6..261796d0b 100644 --- a/app/views/admins/shared/error.js.erb +++ b/app/views/admins/shared/error.js.erb @@ -4,4 +4,7 @@ setTimeout(function() { if ($('.admin-alert-container button.close').length > 0) { $('.admin-alert-container button.close').trigger('click'); } -}, 2000) \ No newline at end of file +}, 5000) +$(".admin-body-container").animate({ + scrollTop: 0 +}, 200); \ No newline at end of file diff --git a/app/views/admins/shixun_authorizations/index.html.erb b/app/views/admins/shixun_authorizations/index.html.erb new file mode 100644 index 000000000..743f2e1b2 --- /dev/null +++ b/app/views/admins/shixun_authorizations/index.html.erb @@ -0,0 +1,32 @@ +<% define_admin_breadcrumbs do %> + <% add_admin_breadcrumb('实训发布') %> +<% end %> + +
    + + + <%= form_tag(admins_shixun_authorizations_path(unsafe_params), method: :get, class: 'form-inline search-form justify-content-end mt-3', remote: true) do %> +
    + + <% status_options = [['全部', 'processed'], ['已同意', 'agreed'], ['已拒绝', 'refused']] %> + <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> +
    + <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '实训名称检索') %> + <%= submit_tag('搜索', class: 'btn btn-primary ml-3') %> + <% end %> +
    + +
    + <%= render(partial: 'admins/shixun_authorizations/shared/list', locals: { applies: @applies, shixun_map: @shixun_map }) %> +
    + +<%= render(partial: 'admins/shared/admin_common_refuse_modal') %> \ No newline at end of file diff --git a/app/views/admins/shixun_authorizations/index.js.erb b/app/views/admins/shixun_authorizations/index.js.erb new file mode 100644 index 000000000..caa8bb389 --- /dev/null +++ b/app/views/admins/shixun_authorizations/index.js.erb @@ -0,0 +1 @@ +$('.shixun-authorization-list-container').html("<%= j( render partial: 'admins/shixun_authorizations/shared/list', locals: { applies: @applies, shixun_map: @shixun_map } ) %>"); \ No newline at end of file diff --git a/app/views/admins/shixun_authorizations/shared/_list.html.erb b/app/views/admins/shixun_authorizations/shared/_list.html.erb new file mode 100644 index 000000000..ce3b4ca43 --- /dev/null +++ b/app/views/admins/shixun_authorizations/shared/_list.html.erb @@ -0,0 +1,60 @@ +<% is_processed = params[:status].to_s != 'pending' %> + + + + + + + + + + <% if is_processed %> + + + <% else %> + + <% end %> + + + + <% if applies.present? %> + <% applies.each do |apply| %> + <% user = apply.user %> + <% shixun = shixun_map[apply.container_id] %> + + + + + + + + <% if is_processed %> + + + <% else %> + + <% end %> + + <% end %> + <% else %> + <%= render 'admins/shared/no_data_for_table' %> + <% end %> + +
    头像创建者实训名称任务数时间拒绝原因状态操作
    + <%= link_to "/users/#{user.login}", class: 'shixun-authorization-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %> + + <% end %> + <%= user.real_name %> + <%= link_to "/shixuns/#{shixun.identifier}", target: '_blank' do %> + <%= overflow_hidden_span shixun.name, width: 300 %> + <% end %> + <%= shixun.challenges_count %><%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %><%= overflow_hidden_span apply.reason, width: 140 %><%= apply.status_text %> + <%= agree_link '同意', agree_admins_shixun_authorization_path(apply, element: ".shixun-authorization-#{apply.id}"), 'data-confirm': '确认审核通过?' %> + <%= javascript_void_link('拒绝', class: 'action refuse-action', + data: { + toggle: 'modal', target: '.admin-common-refuse-modal', id: apply.id, + url: refuse_admins_shixun_authorization_path(apply, element: ".shixun-authorization-#{apply.id}") + }) %> +
    + +<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %> \ No newline at end of file diff --git a/app/views/admins/subject_authorizations/index.html.erb b/app/views/admins/subject_authorizations/index.html.erb new file mode 100644 index 000000000..3d5539663 --- /dev/null +++ b/app/views/admins/subject_authorizations/index.html.erb @@ -0,0 +1,33 @@ +<% define_admin_breadcrumbs do %> + <% add_admin_breadcrumb('实践课程发布') %> +<% end %> + +
    + + + <%= form_tag(admins_subject_authorizations_path(unsafe_params), method: :get, class: 'form-inline search-form justify-content-end mt-3', remote: true) do %> +
    + + <% status_options = [['全部', 'processed'], ['已同意', 'agreed'], ['已拒绝', 'refused']] %> + <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> +
    + <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '实训课程名称检索') %> + <%= submit_tag('搜索', class: 'btn btn-primary ml-3') %> + <% end %> +
    + +
    + <%= render(partial: 'admins/subject_authorizations/shared/list', + locals: { applies: @applies, subject_map: @subject_map, challenge_count_map: @challenge_count_map }) %> +
    + +<%= render(partial: 'admins/shared/admin_common_refuse_modal') %> \ No newline at end of file diff --git a/app/views/admins/subject_authorizations/index.js.erb b/app/views/admins/subject_authorizations/index.js.erb new file mode 100644 index 000000000..a21809041 --- /dev/null +++ b/app/views/admins/subject_authorizations/index.js.erb @@ -0,0 +1 @@ +$('.subject-authorization-list-container').html("<%= j( render partial: 'admins/subject_authorizations/shared/list', locals: { applies: @applies, subject_map: @subject_map, challenge_count_map: @challenge_count_map } ) %>"); \ No newline at end of file diff --git a/app/views/admins/subject_authorizations/shared/_list.html.erb b/app/views/admins/subject_authorizations/shared/_list.html.erb new file mode 100644 index 000000000..7b8da800d --- /dev/null +++ b/app/views/admins/subject_authorizations/shared/_list.html.erb @@ -0,0 +1,64 @@ +<% is_processed = params[:status].to_s != 'pending' %> + + + + + + + + + + + + <% if is_processed %> + + + <% else %> + + <% end %> + + + + <% if applies.present? %> + <% applies.each do |apply| %> + <% user = apply.user %> + <% subject = subject_map[apply.container_id] %> + + + + + + + + + + <% if is_processed %> + + + <% else %> + + <% end %> + + <% end %> + <% else %> + <%= render 'admins/shared/no_data_for_table' %> + <% end %> + +
    头像创建者实践课程名称阶段数实训数关卡数时间拒绝原因状态操作
    + <%= link_to "/users/#{user.login}", class: 'subject-authorization-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %> + + <% end %> + <%= user.real_name %> + <%= link_to "/paths/#{subject.id}", target: '_blank' do %> + <%= overflow_hidden_span subject.name, width: 300 %> + <% end %> + <%= subject.stages_count %><%= subject.shixuns_count %><%= challenge_count_map.fetch(subject.id, 0) %><%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %><%= overflow_hidden_span apply.reason, width: 140 %><%= apply.status_text %> + <%= agree_link '同意', agree_admins_subject_authorization_path(apply, element: ".subject-authorization-#{apply.id}"), 'data-confirm': '确认审核通过?' %> + <%= javascript_void_link('拒绝', class: 'action refuse-action', + data: { + toggle: 'modal', target: '.admin-common-refuse-modal', id: apply.id, + url: refuse_admins_subject_authorization_path(apply, element: ".subject-authorization-#{apply.id}") + }) %> +
    + +<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %> \ No newline at end of file diff --git a/config/locales/apply_actions/zh-CN.yml b/config/locales/apply_actions/zh-CN.yml new file mode 100644 index 000000000..933ef6223 --- /dev/null +++ b/config/locales/apply_actions/zh-CN.yml @@ -0,0 +1,7 @@ +zh-CN: + apply_action: + status: + '0': '待处理' + '1': '已同意' + '2': '已拒绝' + '3': '已撤销' \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 4fc660a45..7e2cf72f3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -774,6 +774,18 @@ Rails.application.routes.draw do post :refuse end end + resources :shixun_authorizations, only: [:index] do + member do + post :agree + post :refuse + end + end + resources :subject_authorizations, only: [:index] do + member do + post :agree + post :refuse + end + end end #git 认证回调 From e96286c24ad66f5fc4de54b27520cb0a70913e67 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 26 Aug 2019 15:42:38 +0800 Subject: [PATCH 100/130] =?UTF-8?q?cdn=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/scripts/build.js | 3 ++- public/react/src/public-path.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/public/react/scripts/build.js b/public/react/scripts/build.js index 269304764..419450dae 100644 --- a/public/react/scripts/build.js +++ b/public/react/scripts/build.js @@ -203,11 +203,12 @@ function generateNewIndexJsp() {