From 2791de431372437a004bff2248550c7f2e3a8362 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 26 Jul 2019 09:35:41 +0800 Subject: [PATCH 01/44] =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/accounts_controller.rb | 4 +-- app/controllers/application_controller.rb | 36 ++++++++++++++--------- app/controllers/courses_controller.rb | 1 + app/controllers/shixuns_controller.rb | 2 ++ app/controllers/subjects_controller.rb | 1 + 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 324e5bde3..d1357d43f 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -125,8 +125,8 @@ class AccountsController < ApplicationController set_autologin_cookie(user) UserAction.create(:action_id => user.try(:id), :action_type => "Login", :user_id => user.try(:id), :ip => request.remote_ip) - # 注册完成后有一天的试用申请 - UserDayCertification.create(user_id: user.id, status: 1) + # 注册完成后有一天的试用申请(先去掉) + # UserDayCertification.create(user_id: user.id, status: 1) end def set_autologin_cookie(user) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bf8a0651e..af0158cfd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -185,21 +185,29 @@ class ApplicationController < ActionController::Base render :json => { status: status, message: message } end - # 系统全局认证 - def check_auth - day_cer = UserDayCertification.find_by(user_id: current_user.id) - # 如果注册超过24小时则需要完善资料及授权 - if (Time.now.to_i - day_cer.try(:created_at).to_i) > 86400 - if !current_user.profile_completed? - info_url = '/account/profile' - tip_exception(402, info_url) - elsif current_user.certification != 1 - if current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0) - tip_exception(408, "您的试用申请正在审核中,请耐心等待") - end - tip_exception(407, "系统未授权") - end + # 资料是否完善 + def check_account + if !current_user.profile_completed? + info_url = '/account/profile' + tip_exception(402, info_url) end + end + + # 系统全局认证(暂时隐藏试用申请的判断) + def check_auth + # day_cer = UserDayCertification.find_by(user_id: current_user.id) + # # 如果注册超过24小时则需要完善资料及授权 + # if (Time.now.to_i - day_cer.try(:created_at).to_i) > 86400 + # if !current_user.profile_completed? + # info_url = '/account/profile' + # tip_exception(402, info_url) + # elsif current_user.certification != 1 + # if current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0) + # tip_exception(408, "您的试用申请正在审核中,请耐心等待") + # end + # tip_exception(407, "系统未授权") + # end + # end # if current_user.certification != 1 && current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index faad02173..99f942146 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -13,6 +13,7 @@ class CoursesController < ApplicationController before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, :left_banner, :top_banner] + before_action :check_account, only: [:new, :apply_to_join_course] before_action :check_auth, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, :left_banner, :top_banner, :apply_to_join_course, :exit_course] before_action :set_course, :user_course_identity, only: [:show, :update, :destroy, :settings, :set_invite_code_halt, diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 7a2db0666..9585ddc12 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -3,6 +3,8 @@ class ShixunsController < ApplicationController include ApplicationHelper before_action :require_login, :check_auth, except: [:download_file, :index, :menus] + before_action :check_account, only: [:new] + before_action :check_auth, except: [:download_file, :index, :menus] before_action :find_shixun, :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns, diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 5cbb2a462..586b7352f 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -1,6 +1,7 @@ class SubjectsController < ApplicationController before_action :require_login, :check_auth, except: [:index] # before_action :check_auth, except: [:index] + before_action :check_account, only: [:new] before_action :find_subject, except: [:index, :create, :new, :append_to_stage] before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish, :search_members, :add_subject_members, :statistics, :shixun_report, :school_report, From dd5c63f82581c6b2b6c96dc5f2edb097d8a99de2 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 26 Jul 2019 10:27:54 +0800 Subject: [PATCH 02/44] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E5=BC=80=E5=A7=8B?= =?UTF-8?q?=E6=8C=91=E6=88=98=E7=9A=84=E5=AE=8C=E5=96=84=E8=B5=84=E6=96=99?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 9585ddc12..15bd4e5a5 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -3,7 +3,7 @@ class ShixunsController < ApplicationController include ApplicationHelper before_action :require_login, :check_auth, except: [:download_file, :index, :menus] - before_action :check_account, only: [:new] + before_action :check_account, only: [:new, :shixun_exec] before_action :check_auth, except: [:download_file, :index, :menus] From ffdee1893ee0f1fee3443f82cce61fe7a71baa81 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 26 Jul 2019 10:37:58 +0800 Subject: [PATCH 03/44] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=97=B6=E8=AE=A1=E7=AE=97=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E6=88=90=E7=BB=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index f92ed8e2e..2f40f3fc2 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -113,6 +113,15 @@ class HomeworkCommonsController < ApplicationController else if @user_course_identity == Course::STUDENT @work = @homework.user_work(current_user.id) + work = @homework.student_works.find_by(user_id: current_user.id) + + # 学生访问列表时计算个人成绩 + myshixun = Myshixun.find_by(shixun_id: @shixun.id, user_id: current_user.id) + if work && myshixun + challenge_settings = @homework.homework_challenge_settings + games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id)) + HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings + end # 学生已提交作品且补交(提交)已截止、作品公开、非匿评阶段 if @work&.work_status.to_i > 0 && (@homework.work_public || @homework.score_open) && From 0bf516cfa1411e1c9acb97e6c9e35b9e4b4b273a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 26 Jul 2019 10:55:16 +0800 Subject: [PATCH 04/44] =?UTF-8?q?=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/user/Notcompletedysl.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/user/Notcompletedysl.js b/public/react/src/modules/user/Notcompletedysl.js index cc7a78e13..f9c260209 100644 --- a/public/react/src/modules/user/Notcompletedysl.js +++ b/public/react/src/modules/user/Notcompletedysl.js @@ -33,7 +33,11 @@ class Notcompletedysl extends Component { } modalCancel=()=>{ - window.location.href = "/"; + var weekArray = JSON.parse(window.sessionStorage.getItem('yslgeturls')); + if(weekArray===undefined){ + weekArray="/"; + } + window.location.href = weekArray; } setDownload=()=>{ @@ -55,11 +59,10 @@ class Notcompletedysl extends Component { width="530px" >
您尚未完善个人资料
请在完成资料后,提交试用申请
完善您的资料,将获得更多的使用权限
该文件将直接显示给学生,需要学生在其中填写代码
@@ -844,7 +870,7 @@ export default class TPMevaluation extends Component { { main.length===0?"":main.map((item,key)=>{ return( - this.goblakepath(item.path,key)}>{item.val} + this.goblakepath(item.path,key,item)}>{item.val} ) }) } @@ -853,7 +879,7 @@ export default class TPMevaluation extends Component { return(该文件由平台执行,用来测试平台学员代码是否正确
该路径下的文件将在学员评测本关任务时,作为原始图片显示在查看效果页,供学员参考,任务为图片处理时请指定该路径,并注意与程序文件所在文件夹分开 @@ -980,8 +1006,8 @@ export default class TPMevaluation extends Component { id="shixun_file_standard_picture_path" name="challenge[expect_picture_path]" placeholder="请选择版本库中存储了标准答案代码输出文件的路径。例:src/step1/expectedimages" value={shixunfilestandardpicturepath} - onInput={(e)=>this.updatepath(e,"shixunfilestandardpicturepath")} - onClick={(e)=>this.getfilepath(e,"shixunfilestandardpicturepath")} + onInput={(e)=>this.updatepath(e,"shixunfilestandardpicturepath",2)} + onClick={(e)=>this.getfilepath(e,"shixunfilestandardpicturepath",2)} />
该路径下的文件将在学员评测本关任务时,作为参考答案显示在查看效果页,供学员参考任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开 @@ -1001,8 +1027,8 @@ export default class TPMevaluation extends Component { this.updatepath(e,"shixunfilepicturepath")} - onClick={(e)=>this.getfilepath(e,"shixunfilepicturepath")} + onInput={(e)=>this.updatepath(e,"shixunfilepicturepath",2)} + onClick={(e)=>this.getfilepath(e,"shixunfilepicturepath",2)} placeholder="请在版本库中指定用来保存学员代码实际输出结果的路径。例:src/step1/outputimages"/>
学员评测本关任务时生成的文件将保存在该路径下,并作为实际输出显示在查看效果页,供学员确认任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开 diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js index 346be3351..282ab1e43 100644 --- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js +++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js @@ -742,11 +742,14 @@ class Newshixuns extends Component { // } onChangeTimePicker = (value, dateString) => { + debugger this.setState({ - TimePickervalue: handleDateStrings(dateString) + TimePickervalue: moment(handleDateStrings(dateString)) }) } - // 附件相关 START + + + // 附件相关 START handleChange = (info) => { console.log("handleChange1"); let fileList = info.fileList; @@ -1279,13 +1282,14 @@ class Newshixuns extends Component {
您需要去完善您的个人资料,才能使用此功能
+')) { // 普通html处理 + window.$(selector).html(oldContent) + } else { + try { + var markdwonParser = window.editormd.markdownToHTML("md_div", { + markdown: oldContent, // .replace(/▁/g,"▁▁▁"), + emoji: true, + htmlDecode: "style,script,iframe", // you can filter tags decode + taskList: true, + tex: true, // 默认不解析 + flowChart: true, // 默认不解析 + sequenceDiagram: true // 默认不解析 + }); - } catch(e) { - console.error(e) + } catch(e) { + console.error(e) + } + + const content = window.$('#md_div').html() + if (selector) { + window.$(selector).html(content) + } + return content } - - const content = window.$('#md_div').html() - if (selector) { - window.$(selector).html(content) - } - return content } export function appendFileSizeToUploadFile(item) { From bcfe17712f2fd626b5ccdbda1e8a5e62947e42bb Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 26 Jul 2019 16:54:18 +0800 Subject: [PATCH 30/44] selector --- 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 7932311b1..49f1e5158 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkQuestion.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkQuestion.js @@ -87,7 +87,7 @@ class CommonWorkQuestion extends Component{ {/* 内容区 */}
')) { // 普通html处理 + if (selector && oldContent && oldContent.startsWith('
Date: Fri, 26 Jul 2019 17:54:58 +0800
Subject: [PATCH 36/44] =?UTF-8?q?=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/login/LoginDialog.js | 30 +++++++++++++++----
.../modules/user/LoginRegisterComponent.js | 4 +--
2 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js
index d3df6090e..a4dee4b4c 100644
--- a/public/react/src/modules/login/LoginDialog.js
+++ b/public/react/src/modules/login/LoginDialog.js
@@ -13,6 +13,7 @@ import axios from 'axios';
import './LoginDialog.css';
import { broadcastChannelPostMessage } from 'educoder'
+import Notcompletedysl from "../user/Notcompletedysl";
const $ = window.$;
var wait = 60;
@@ -100,6 +101,7 @@ class LoginDialog extends Component {
authCodeType:true,
authCodeclass:'log-botton mt5',
isRender: false,
+ MyEduCoderModals:false,
};
}
@@ -365,11 +367,12 @@ class LoginDialog extends Component {
description:response.data.message,
});
}else{
- if(response.data.identity === null || response.data.identity === undefined){
- this.props.history.push("/interesse");
+ if(response.data.profile_completed !== null || response.data.profile_completed === false){
+ this.setMyEduCoderModals();
return;
}
- broadcastChannelPostMessage('refreshPage')
+
+ broadcastChannelPostMessage('refreshPage')
this.setState({
isRender:false
})
@@ -388,17 +391,28 @@ class LoginDialog extends Component {
console.log(error)
})
- }
+ };
+ setNotcompleteds=()=>{
+ this.setState({
+ Notcompleteds:true,
+ MyEduCoderModals:false
+ })
+ };
+ setMyEduCoderModals=()=>{
+ this.setState({
+ MyEduCoderModals:true
+ })
+ };
onKeydowns=(e)=>{
let {disabled}=this.state;
if( disabled===false&& e.keyCode === 13){
this.loginEDU()
console.log(1)
}
- }
+ };
getloginurl=(url)=>{
window.location.href = url;
- }
+ };
render() {
let{open,login,speedy,loginValue,regular,isGoing,isGoingValue,disabled,bottonclass,
dialogBox,shortcutnum,disabledType,gaincode,authCodeType,authCodeclass, isRender}=this.state;
@@ -414,6 +428,10 @@ class LoginDialog extends Component {
disableBackdropClick={true}
onClose={() => this.handleDialogClose()}
>
+