From 67e1cae3b4c32d003f5a731feff25159b67e5a10 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 19 Sep 2019 14:13:53 +0800 Subject: [PATCH 01/45] =?UTF-8?q?=E5=BC=80=E6=94=BE=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 26 ++++++++++++++++++++++- app/models/user.rb | 23 -------------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8797c4074..daea45169 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -250,8 +250,9 @@ class ApplicationController < ActionController::Base # 开放课程通过链接访问的用户 if !User.current.logged? && !params[:chinaoocTimestamp].blank? && !params[:websiteName].blank? && !params[:chinaoocKey].blank? content = "#{OPENKEY}#{params[:websiteName]}#{params[:chinaoocTimestamp]}" + if Digest::MD5.hexdigest(content) == params[:chinaoocKey] - user = User.open_class_user + user = open_class_user start_user_session(user) if user User.current = user end @@ -615,4 +616,27 @@ class ApplicationController < ActionController::Base def set_export_cookies cookies[:fileDownload] = true end + + # 149课程的评审用户数据创建(包含创建课堂学生) + def open_class_user + user = User.find_by(login: "OpenClassUser") + unless user + ActiveRecord::Base.transaction do + user_params = {status: 1, login: "OpenClassUser", lastname: "开放课程", + nickname: "开放课程", professional_certification: 1, certification: 1, grade: 0, + password: "12345678", phone: "11122223333", profile_completed: 1} + user = User.create!(user_params) + + UserExtension.create!(user_id: user.id, gender: 0, school_id: 3396, :identity => 1, :student_id => "openclassuser") # 3396 + + subject = Subject.find_by(id: 149) + if subject + subject.courses.each do |course| + CourseMember.create!(course_id: course.id, role: 4, user_id: user.id) if !course.course_members.exists?(user_id: user.id) + end + end + end + end + user + end end diff --git a/app/models/user.rb b/app/models/user.rb index ebf68cce6..12759ea4d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -610,29 +610,6 @@ class User < ApplicationRecord admin? || business? end - # 149课程的评审用户数据创建(包含创建课堂学生) - def open_class_user - user = User.find_by(login: "OpenClassUser") - unless user - ActiveRecord::Base.transaction do - user_params = {status: 1, login: "OpenClassUser", lastname: "开放课程", - nickname: "开放课程", professional_certification: 1, certification: 1, grade: 0, - password: "12345678", phone: "11122223333", profile_completed: 1} - user = User.create!(user_params) - - UserExtension.create!(user_id: user.id, gender: 0, school_id: 117, :identity => 1, :student_id => "openclassuser") - - subject = Subject.find_by(id: 149) - if subject - subject.courses.each do |course| - CourseMember.create!(course_id: course.id, role: 4, user_id: user.id) if !course.course_students.exists?(user_id: user.id) - end - end - end - end - user - end - protected def validate_password_length # 管理员的初始密码是5位 From 8ed659f73ee548b7cd68cdb0d1185f6a0aeb8988 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 19 Sep 2019 15:21:13 +0800 Subject: [PATCH 02/45] expand --- public/react/src/modules/page/VNCContainer.js | 2 +- .../modules/page/component/repo/RepoTree.js | 16 +++++++++++++-- .../modules/page/main/CodeRepositoryView.css | 4 ++++ .../modules/page/main/CodeRepositoryView.js | 20 ++++++++++++++++--- .../page/main/CodeRepositoryViewContainer.js | 2 +- 5 files changed, 37 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/page/VNCContainer.js b/public/react/src/modules/page/VNCContainer.js index 3a85976bb..6ef10888a 100644 --- a/public/react/src/modules/page/VNCContainer.js +++ b/public/react/src/modules/page/VNCContainer.js @@ -85,7 +85,7 @@ class VNCContainer extends Component { }) } onTreeSelect = (selectedKeys, info) => { - const isLeaf = info.node.props.isLeaf; + const isLeaf = info.node.isLeaf(); if (isLeaf) { // 叶子节点 selectedKeys.length && this.setState({ fileTreeSelectedKeys: selectedKeys diff --git a/public/react/src/modules/page/component/repo/RepoTree.js b/public/react/src/modules/page/component/repo/RepoTree.js index fbf1286c3..102f797ef 100644 --- a/public/react/src/modules/page/component/repo/RepoTree.js +++ b/public/react/src/modules/page/component/repo/RepoTree.js @@ -7,7 +7,7 @@ import 'rc-tree/assets/index.css'; const $ = window.$; export default function RepoTree(props) { - const { fileTreeData, onLoadData, onTreeSelect, fileTreeSelectedKeys, loadRepoFiles } = props; + const { fileTreeData, onLoadData, fileTreeSelectedKeys, loadRepoFiles } = props; const [expandedKeys, setExpandedKeys] = useState([]) useEffect(() => { loadRepoFiles() @@ -36,7 +36,19 @@ export default function RepoTree(props) { }; const treeNodes = loop(fileTreeData); - + function onTreeSelect(selectedKeys, info) { + if (!info.node.isLeaf()) { + const _expandedKeys = expandedKeys.slice(0) + const _index = _expandedKeys.indexOf(selectedKeys[0]); + if (_index == -1) { + _expandedKeys.push(selectedKeys[0]) + } else { + _expandedKeys.splice( _index, 1) + } + setExpandedKeys( _expandedKeys ) + } + props.onTreeSelect(selectedKeys, info) + } // selectable={false} return ( { + if (!info.node.isLeaf()) { + const expandedKeys = this.state.expandedKeys.slice(0) + const _index = expandedKeys.indexOf(selectedKeys[0]); + if (_index == -1) { + expandedKeys.push(selectedKeys[0]) + } else { + expandedKeys.splice( _index, 1) + } + this.setState({ expandedKeys }) + } + + this.props.onTreeSelect(selectedKeys, info) + } buildTree() { // TODO http://localhost:3007/tasks/xgffnuomytpj 这个实训没有文件树 - const { fileTreeData, onLoadData, onTreeSelect, fileTreeSelectedKeys } = this.props; + const { fileTreeData, onLoadData, fileTreeSelectedKeys } = this.props; if (!fileTreeData || fileTreeData.length === 0) { return "" } @@ -136,7 +150,7 @@ class CodeRepositoryView extends Component { return ( { - const isLeaf = info.node.props.isLeaf; + const isLeaf = info.node.isLeaf(); if (isLeaf) { // 叶子节点 selectedKeys.length && this.setState({ fileTreeSelectedKeys: selectedKeys From b9266fbbf3b44c8958102003be84a393d6fc0ac6 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 19 Sep 2019 17:41:35 +0800 Subject: [PATCH 03/45] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 3a19a9f87..1dc511513 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -610,29 +610,6 @@ class User < ApplicationRecord admin? || business? end - # 149课程的评审用户数据创建(包含创建课堂学生) - def open_class_user - user = User.find_by(login: "OpenClassUser") - unless user - ActiveRecord::Base.transaction do - user_params = {status: 1, login: "OpenClassUser", lastname: "开放课程", - nickname: "开放课程", professional_certification: 1, certification: 1, grade: 0, - password: "12345678", phone: "11122223333", profile_completed: 1} - user = User.create!(user_params) - - UserExtension.create!(user_id: user.id, gender: 0, school_id: 117, :identity => 1, :student_id => "openclassuser") - - subject = Subject.find_by(id: 149) - if subject - subject.courses.each do |course| - CourseMember.create!(course_id: course.id, role: 4, user_id: user.id) if !course.course_students.exists?(user_id: user.id) - end - end - end - end - user - end - protected def validate_password_length # 管理员的初始密码是5位 From e7afabb08b8bc77f9b7da1eca955f33db2c6dccf Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 19 Sep 2019 17:57:44 +0800 Subject: [PATCH 04/45] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index daea45169..508d005a4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -632,7 +632,7 @@ class ApplicationController < ActionController::Base subject = Subject.find_by(id: 149) if subject subject.courses.each do |course| - CourseMember.create!(course_id: course.id, role: 4, user_id: user.id) if !course.course_members.exists?(user_id: user.id) + CourseMember.create!(course_id: course.id, role: 3, user_id: user.id) if !course.course_members.exists?(user_id: user.id) end end end From 5bbc5a0ef576ce83e7109a9a4b25cf4efeef11a7 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 20 Sep 2019 10:56:43 +0800 Subject: [PATCH 05/45] =?UTF-8?q?hasData=20=20=E8=A1=A5=E4=BA=A4=E9=99=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/busyWork/CommonWorkDetailIndex.js | 4 ++-- .../react/src/modules/courses/busyWork/CommonWorkList.js | 8 +++++--- .../courses/busyWork/common/WorkDetailPageHeader.js | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js index b5fb8b047..8985aa07e 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js @@ -286,8 +286,8 @@ class CommonWorkDetailIndex extends Component{ seeworks={undefined} reviseAttachmentUrl={`/student_works/${work_id || studentWorkId}/revise_attachment.json`} />:""} - 补交附件 diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index a489e7c3d..56ae40e2d 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -640,6 +640,8 @@ class CommonWorkList extends Component{ } else if (time_status === 4) { timeMsg = '申诉剩余时间' } + + const hasData = student_works && !!student_works.length && page == 1 // console.log(StudentData) // console.log(student_works) @@ -691,7 +693,7 @@ class CommonWorkList extends Component{ } `}
- { isAdmin &&