Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_forum
hjm 5 years ago
commit 5af9f4cafd

@ -125,8 +125,8 @@ class AccountsController < ApplicationController
set_autologin_cookie(user) set_autologin_cookie(user)
UserAction.create(:action_id => user.try(:id), :action_type => "Login", :user_id => user.try(:id), :ip => request.remote_ip) 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 end
def set_autologin_cookie(user) def set_autologin_cookie(user)

@ -185,21 +185,29 @@ class ApplicationController < ActionController::Base
render :json => { status: status, message: message } render :json => { status: status, message: message }
end end
# 系统全局认证 # 资料是否完善
def check_auth def check_account
day_cer = UserDayCertification.find_by(user_id: current_user.id) if !current_user.profile_completed?
# 如果注册超过24小时则需要完善资料及授权 info_url = '/account/profile'
if (Time.now.to_i - day_cer.try(:created_at).to_i) > 86400 tip_exception(402, info_url)
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 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) # if current_user.certification != 1 && current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0)

@ -13,6 +13,7 @@ class CoursesController < ApplicationController
before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups,
:left_banner, :top_banner] :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, 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] :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, before_action :set_course, :user_course_identity, only: [:show, :update, :destroy, :settings, :set_invite_code_halt,

@ -37,7 +37,8 @@ class GamesController < ApplicationController
# 上一关、下一关 # 上一关、下一关
prev_game = @game.prev_of_current_game(@shixun.id, @game.myshixun_id, game_challenge.position) prev_game = @game.prev_of_current_game(@shixun.id, @game.myshixun_id, game_challenge.position)
next_game = @game.next_of_current_game(@shixun.id, @game.myshixun_id, game_challenge.position) #next_game = @game.next_of_current_game(@shixun.id, @game.myshixun_id, game_challenge.position)
next_game = user_next_game(@shixun, game_challenge, @game, @identity)
# 关卡点赞数, praise_or_tread = 1则表示赞过 # 关卡点赞数, praise_or_tread = 1则表示赞过
praise_count = game_challenge.praises_count praise_count = game_challenge.praises_count
@ -454,7 +455,7 @@ class GamesController < ApplicationController
tip_exception("初始代码为空,代码重置失败") if @content.nil? tip_exception("初始代码为空,代码重置失败") if @content.nil?
# 将tpm的代码内容同步更新到tpi # 将tpm的代码内容同步更新到tpi
update_file_content(@content, @myshixun.repo_path, path, current_user.mail, current_user.full_name, "reset_original_code") update_file_content(@content, @myshixun.repo_path, path, current_user.git_mail, current_user.real_name, "reset_original_code")
rescue Exception => e rescue Exception => e
uid_logger_error("#{e.message}") uid_logger_error("#{e.message}")
tip_exception("初始化代码失败") tip_exception("初始化代码失败")
@ -471,7 +472,7 @@ class GamesController < ApplicationController
# else # else
# content # content
# end # end
update_file_content(content, @myshixun.repo_path, path, current_user.mail, current_user.full_name, "game passed reset") update_file_content(content, @myshixun.repo_path, path, current_user.git_mail, current_user.real_name, "game passed reset")
else else
tip_exception("代码重置失败,代码为空") tip_exception("代码重置失败,代码为空")
end end
@ -962,4 +963,14 @@ class GamesController < ApplicationController
@identity = current_user.game_identity(@game) @identity = current_user.game_identity(@game)
raise Educoder::TipException.new(403, "..") if @identity > User::EDU_GAME_MANAGER raise Educoder::TipException.new(403, "..") if @identity > User::EDU_GAME_MANAGER
end end
# identity用户身份
def user_next_game(shixun, challenge, game, identity)
next_game = game.next_of_current_game(shixun.id, game.myshixun_id, challenge.position)
# 实训允许跳关 、 当前关卡已经通关、 用户是已认证的老师以上权限的人,允许跳关
if shixun.task_pass || game.status == 2 || identity <= User::EDU_CERTIFICATION_TEACHER
next_game
else
nil
end
end
end end

@ -113,6 +113,15 @@ class HomeworkCommonsController < ApplicationController
else else
if @user_course_identity == Course::STUDENT if @user_course_identity == Course::STUDENT
@work = @homework.user_work(current_user.id) @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) && if @work&.work_status.to_i > 0 && (@homework.work_public || @homework.score_open) &&

@ -7,9 +7,9 @@ class MyshixunsController < ApplicationController
## TPI关卡列表 ## TPI关卡列表
def challenges def challenges
# @challenges = Challenge.where(shixun_id: params[:shixun_id]) # @challenges = Challenge.where(shixun_id: params[:shixun_id])
@shixun = @myshixun.shixun
@shixun_status = @myshixun.shixun.status
@games = @myshixun.games.includes(:challenge).reorder("challenges.position") @games = @myshixun.games.includes(:challenge).reorder("challenges.position")
@identity = current_user.game_identity(@games.first)
end end
@ -42,7 +42,7 @@ class MyshixunsController < ApplicationController
if e.message != "ActiveRecord::RecordInvalid" if e.message != "ActiveRecord::RecordInvalid"
logger.error("######delete_repository_error:#{e.message}") logger.error("######delete_repository_error:#{e.message}")
end end
raise ActiveRecord::Rollback raise "delete_repository_error:#{e.message}"
end end
end end

@ -3,6 +3,8 @@ class ShixunsController < ApplicationController
include ApplicationHelper include ApplicationHelper
before_action :require_login, :check_auth, except: [:download_file, :index, :menus] before_action :require_login, :check_auth, except: [:download_file, :index, :menus]
before_action :check_account, only: [:new, :shixun_exec]
before_action :check_auth, except: [:download_file, :index, :menus] before_action :check_auth, except: [:download_file, :index, :menus]
before_action :find_shixun, :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns, before_action :find_shixun, :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns,
@ -716,7 +718,7 @@ class ShixunsController < ApplicationController
logger.error("##########project_fork error #{e.message}") logger.error("##########project_fork error #{e.message}")
@current_task.destroy! @current_task.destroy!
end end
raise ActiveRecord::Rollback raise "实训云平台繁忙繁忙等级81"
end end
end end
end end
@ -769,7 +771,7 @@ class ShixunsController < ApplicationController
def update_file def update_file
content = params[:content] content = params[:content]
author_name = current_user.full_name author_name = current_user.real_name
author_email = current_user.git_mail author_email = current_user.git_mail
@content = update_file_content content, @repo_path, @path, author_email, author_name, "Edit by browser" @content = update_file_content content, @repo_path, @path, author_email, author_name, "Edit by browser"
end end

@ -1,6 +1,7 @@
class SubjectsController < ApplicationController class SubjectsController < ApplicationController
before_action :require_login, :check_auth, except: [:index] before_action :require_login, :check_auth, except: [:index]
# before_action :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 :find_subject, except: [:index, :create, :new, :append_to_stage]
before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish, before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish,
:search_members, :add_subject_members, :statistics, :shixun_report, :school_report, :search_members, :add_subject_members, :statistics, :shixun_report, :school_report,

@ -1,2 +1,14 @@
module MyshixunsHelper module MyshixunsHelper
# 获取tpi的identifier,
# identity表示用户关卡的身份
# task_pass: 实训是否允许跳关
def get_game_identifier task_pass, game, game_identity
# 允许跳关、 关卡已经开启、 用户是已认证老师以上的身份
if task_pass || game.status != 3 || game_identity <= User::EDU_CERTIFICATION_TEACHER
game.identifier
else
nil
end
end
end end

@ -126,12 +126,13 @@ module ShixunsHelper
challenge_program_name = [] challenge_program_name = []
shixun.challenges.map(&:exec_path).each do |exec_path| shixun.challenges.map(&:exec_path).each do |exec_path|
challenge_program_name << "\"#{exec_path}\"" challenge_program_name << "\"#{exec_path}\""
if shixun.main_mirror_name.try(:first) == "Java" if shixun.main_mirror_name == "Java"
if exec_path.nil? || exec_path.split("src/")[1].nil? if exec_path.nil? || exec_path.split("src/")[1].nil?
source = "\"\"" source = "\"\""
else else
source = "\"#{exec_path.split("src/")[1].split(".java")[0]}\"" source = "\"#{exec_path.split("src/")[1].split(".java")[0]}\""
end end
logger.info("----source: #{source}")
source_class_name << source.gsub("/", ".") if source.present? source_class_name << source.gsub("/", ".") if source.present?
elsif shixun.main_mirror_name.try(:first) == "C#" elsif shixun.main_mirror_name.try(:first) == "C#"
if exec_path.nil? || exec_path.split(".")[1].nil? if exec_path.nil? || exec_path.split(".")[1].nil?

@ -4,6 +4,7 @@ class Shixun < ApplicationRecord
# status: 0编辑 1申请发布 2正式发布 3关闭 -1软删除 # status: 0编辑 1申请发布 2正式发布 3关闭 -1软删除
# hide_code 隐藏代码窗口 # hide_code 隐藏代码窗口
# code_hidden: 隐藏代码目录 # code_hidden: 隐藏代码目录
# task_pass: 跳关
has_many :challenges, dependent: :destroy has_many :challenges, dependent: :destroy
has_many :challenge_tags, through: :challenges has_many :challenge_tags, through: :challenges
has_many :myshixuns, :dependent => :destroy has_many :myshixuns, :dependent => :destroy

@ -2,8 +2,8 @@ json.users do
json.array! @users do |user| json.array! @users do |user|
json.id user.id json.id user.id
json.name user.real_name json.name user.real_name
json.student_id user.user_extension.try(:student_id) json.student_id user&.student_id
json.school_name user.user_extension.school.name json.school_name user&.school_name
json.added @course.course_member?(user.id, 4) json.added @course.course_member?(user.id, 4)
end end
end end

@ -3,7 +3,7 @@ json.array! @games do |game|
json.partial! 'challenges/challenge', locals: { challenge: challenge } json.partial! 'challenges/challenge', locals: { challenge: challenge }
json.status game.status json.status game.status
json.star game.star json.star game.star
json.identifier game.identifier json.identifier get_game_identifier(@shixun.task_pass, game, @identity)
json.get_gold game.user_get_gold_and_experience(@shixun_status, challenge)[0] json.get_gold game.user_get_gold_and_experience(@shixun.status, challenge)[0]
json.get_experience game.user_get_gold_and_experience(@shixun_status, challenge)[1] json.get_experience game.user_get_gold_and_experience(@shixun.status, challenge)[1]
end end

@ -7,6 +7,7 @@ json.is_teacher @user.user_extension&.teacher?
json.user_identity @user.identity json.user_identity @user.identity
json.tidding_count 0 json.tidding_count 0
json.user_phone_binded @user.phone.present? json.user_phone_binded @user.phone.present?
json.profile_completed @user.profile_completed?
if @course if @course
json.course_identity @course_identity json.course_identity @course_identity
json.course_name @course.name json.course_name @course.name

@ -502,7 +502,7 @@ class Coursesleftnav extends Component{
NavmodalValues:"名称不能为空" NavmodalValues:"名称不能为空"
}) })
return return
}else if(NavmodalValue.length>20){ }else if(NavmodalValue.length>60){
this.setState({ this.setState({
NavmodalValuetype:true, NavmodalValuetype:true,
NavmodalValues:"名称不能超过60个字" NavmodalValues:"名称不能超过60个字"

@ -990,8 +990,15 @@ samp {
.newcourses .ant-input{ .newcourses .ant-input{
width:280px; width:280px;
margin-left: 11px; margin-left: 11px;
height: 40px; height: 40px !important;
} }
.newcourses .ant-input{
width:280px;
margin-left: 11px;
height: 40px !important;
}
.newcourses .ant-select-selection--single{ .newcourses .ant-select-selection--single{
width: 280px; width: 280px;
/*margin-left: 11px;*/ /*margin-left: 11px;*/

@ -1,5 +1,5 @@
import React, {Component} from "React"; import React, {Component} from "React";
import {Form, Select, Input, Button, Checkbox, DatePicker,Spin,Icon} from "antd"; import {Form, Select, Input, Button, Checkbox, DatePicker,Spin,Icon,AutoComplete} from "antd";
import ApplyForAddOrgModal from '../../user/modal/ApplyForAddOrgModal'; import ApplyForAddOrgModal from '../../user/modal/ApplyForAddOrgModal';
import axios from 'axios'; import axios from 'axios';
import "../css/Courses.css"; import "../css/Courses.css";
@ -47,8 +47,8 @@ class CoursesNew extends Component {
let coursesId = this.props.match.params.coursesId; let coursesId = this.props.match.params.coursesId;
let user_school=this.props.current_user&&this.props.current_user.user_school; let user_school=this.props.current_user&&this.props.current_user.user_school;
this.getschool("") // this.getschool("")
this.Searchvalue("") // this.Searchvalue("")
if (coursesId != undefined) { if (coursesId != undefined) {
let url = "/courses/" + coursesId + "/settings.json" let url = "/courses/" + coursesId + "/settings.json"
axios.get(url).then((result) => { axios.get(url).then((result) => {
@ -285,8 +285,8 @@ class CoursesNew extends Component {
this.setState({ this.setState({
searchlist: result.data.course_lists, searchlist: result.data.course_lists,
// course:value, // course:value,
fetching: false
}) })
} }
// this.props.form.setFieldsValue({ // this.props.form.setFieldsValue({
@ -298,10 +298,11 @@ class CoursesNew extends Component {
} }
handleSearch=(value)=>{ handleSearch=(value)=>{
if(value!=""){ if(value!=""){
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
classroom:value, classroom:value,
// course:value // course:value
}); });
this.Searchvalue(value) this.Searchvalue(value)
} }
@ -311,7 +312,7 @@ class CoursesNew extends Component {
handleChange=(value)=>{ handleChange=(value)=>{
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
// course:value, // course:value,
classroom:value classroom:value
}) })
}; };
@ -319,21 +320,27 @@ class CoursesNew extends Component {
handleSearchschool=(value)=>{ handleSearchschool=(value)=>{
if(value!="") { if(value!="") {
this.props.form.setFieldsValue({ // this.props.form.setFieldsValue({
// school: value, // // school: value,
// fetching: true,
// });
this.setState({
fetching: true, fetching: true,
}); school: value
})
this.getschool(value) this.getschool(value)
} }
}; };
handleChangeschools=(value)=>{ handleChangeschools=(value)=>{
this.props.form.setFieldsValue({ // this.props.form.setFieldsValue({
// school: value, // // school: value,
fetching: true, // fetching: true,
}); // });
// this.setState({
// fetching: true
// })
} }
handleChangeschool=(value)=>{ handleChangeschool=(value)=>{
@ -359,9 +366,13 @@ class CoursesNew extends Component {
if (result.data.status===0) { if (result.data.status===0) {
this.setState({ this.setState({
searchlistscholl: result.data.school_names, searchlistscholl: result.data.school_names,
// school: value
})
})
if(result.data.school_names.length!=0){
this.setState({
fetching: false
})
}
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error) console.log(error)
@ -420,8 +431,7 @@ class CoursesNew extends Component {
`} `}
</style> </style>
<Form onSubmit={this.handleSubmit} <Form onSubmit={this.handleSubmit} className={"edu-back-white newcourses"}>
className={"edu-back-white newcourses"}>
{/*内容*/} {/*内容*/}
<style> <style>
{` {`
@ -435,15 +445,16 @@ class CoursesNew extends Component {
width: 280px !important; width: 280px !important;
height: 160px; height: 160px;
} }
.construction{ .construction .ant-input{
width: 280px !important; width: 280px !important;
margin-left: 10px; margin-left: 0px !important;
}
.construction {
width: 280px;
margin-left: 10px;
} }
`} `}
</style> </style>
{/*<div className="stud-class-set bor-bottom-greyE padding10200">*/}
{/*</div>*/}
<div className="stud-class-set bor-bottom-greyE padding10200 "> <div className="stud-class-set bor-bottom-greyE padding10200 ">
<div className={"TabsWarpcourse"}> <div className={"TabsWarpcourse"}>
@ -451,18 +462,15 @@ class CoursesNew extends Component {
{getFieldDecorator('course', { {getFieldDecorator('course', {
rules: [{required: true, message: "不能为空"}], rules: [{required: true, message: "不能为空"}],
})( })(
<Select
showSearch <AutoComplete style={{ width: 280 }}
className={"fl construction "} onSearch={this.handleSearch}
placeholder="例如:数据结构" onChange={this.handleChange}
// value={this.state.course} className={"fl construction "}
onSearch={this.handleSearch} placeholder="例如:数据结构"
onChange={this.handleChange} >
onFocus={()=>this.Searchvalue("")} {options}
allowClear={true} </AutoComplete>
>
{options}
</Select>
)} )}
<span className={"newcoursestitle fl"}> <span className={"newcoursestitle fl"}>
{/*错误示例数据结构2017本部数据结构2017秋季数据结构2017电子商务1班*/} {/*错误示例数据结构2017本部数据结构2017秋季数据结构2017电子商务1班*/}
@ -632,18 +640,14 @@ class CoursesNew extends Component {
{getFieldDecorator('school', { {getFieldDecorator('school', {
rules: [{required: true, message: "不能为空"}], rules: [{required: true, message: "不能为空"}],
})( })(
<Select <AutoComplete style={{ width: 280 }}
showSearch onSearch={this.handleSearchschool}
className={"fl construction mr10 "} // onChange={this.handleChangeschools}
placeholder="请输入并选择课本堂的所属单位" className={"fl construction mr10 "}
// value={this.state.school} placeholder="请输入并选择课本堂的所属单位"
onSearch={this.handleSearchschool}
// notFoundContent={this.state.fetching ? <Spin size="small" /> : null}
onChange={this.handleChangeschools}
allowClear={true}
> >
{optionschool} {optionschool}
</Select> </AutoComplete>
)} )}
<span className={"newcoursestitle fl"}> <span className={"newcoursestitle fl"}>
{/*(输入内容出现匹配的下拉菜单←同账号管理的单位信息填写)*/} {/*(输入内容出现匹配的下拉菜单←同账号管理的单位信息填写)*/}
@ -651,7 +655,7 @@ class CoursesNew extends Component {
<div id='isschool'></div> <div id='isschool'></div>
</Form.Item> </Form.Item>
{searchlistscholl.length===0?<div style={{height:"20px",lineHeight:"20px"}} className="ml20"> {searchlistscholl.length===0&&this.state.fetching===true?<div style={{height:"20px",lineHeight:"20px"}} className="ml20">
<span> <span>
<span style={{color: '#CDCDCD'}}>未找到包含{school}的高校</span> <span style={{color: '#CDCDCD'}}>未找到包含{school}的高校</span>
<span style={{color: '#4CACFF', cursor: 'pointer'}} onClick={this.showApplyForAddOrgModal}>申请新增</span> <span style={{color: '#4CACFF', cursor: 'pointer'}} onClick={this.showApplyForAddOrgModal}>申请新增</span>

@ -217,7 +217,7 @@ class ShixunsHome extends Component {
<div className="square-Item" key={key} id={item.id} style={{width:'286px'}}> <div className="square-Item" key={key} id={item.id} style={{width:'286px'}}>
<div className="tag-green"> <div className="tag-green">
<span className="tag-name"> {item.name}</span> <span className="tag-name"> {item.tag_name}</span>
<img style={{display:item.tag_name===null?"none":'block'}} src={require(`./tag2.png`)}/> <img style={{display:item.tag_name===null?"none":'block'}} src={require(`./tag2.png`)}/>
</div> </div>

@ -95,7 +95,8 @@ class NewHeader extends Component {
}); });
//获取游览器地址
window.sessionStorage.setItem("yslgeturls",JSON.stringify(window.location.href))
} }

@ -1869,6 +1869,7 @@ export default class TPMsettings extends Component {
placeholder="请选择开启时间" placeholder="请选择开启时间"
value={opening_time===null||opening_time===""?"":moment(opening_time, dateFormat)} value={opening_time===null||opening_time===""?"":moment(opening_time, dateFormat)}
onChange={this.onChangeTimePicker} onChange={this.onChangeTimePicker}
dropdownClassName="hideDisable"
/> />
<label style={{top:'6px'}} className="color-grey-9 ml10" >为空则学员在实训发布后能随时开启实训挑战否则学员在开启时间后才能开启实训挑战</label> <label style={{top:'6px'}} className="color-grey-9 ml10" >为空则学员在实训发布后能随时开启实训挑战否则学员在开启时间后才能开启实训挑战</label>
</span> </span>

@ -256,11 +256,12 @@ export default class TPMevaluation extends Component {
this.setevaluationlist(newevaluationlist); this.setevaluationlist(newevaluationlist);
} }
getfilepath=(e,shixunfilepath)=>{ getfilepath=(e,shixunfilepath,type)=>{
this.setState({ this.setState({
evaluationvisible: true, evaluationvisible: true,
selectpath:e.target.value, selectpath:e.target.value,
selectpatharr:[], selectpatharr:[],
pathtype:type
}); });
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let url ="/shixuns/"+id+"/repository.json"; let url ="/shixuns/"+id+"/repository.json";
@ -283,9 +284,9 @@ export default class TPMevaluation extends Component {
}); });
} }
sendgetfilepath=(newpath,type)=>{ sendgetfilepath=(newpath,type,newpathtype)=>{
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let{path,main}=this.state; let{path,main,pathtype}=this.state;
let ary=main; let ary=main;
let paths=path; let paths=path;
@ -329,10 +330,18 @@ export default class TPMevaluation extends Component {
}); });
} }
if(pathtype===2){
this.setState({
selectpath: newpathtype,
})
}
} }
goblakepath=(path,key)=>{ goblakepath=(path,key)=>{
let {main,selectpath} =this.state; let {main,selectpath,pathtype} =this.state;
let newmain=[] let newmain=[]
for(var i=0;i<=key;i++){ for(var i=0;i<=key;i++){
newmain.push(main[i]) newmain.push(main[i])
@ -355,6 +364,17 @@ export default class TPMevaluation extends Component {
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
if(pathtype===2){
// var str=path;
// str.slice(0,str.length-1)
// debugger
// console.log(str)
this.setState({
selectpath: path,
})
}
} }
// delesavegetfilepath=(value)=>{ // delesavegetfilepath=(value)=>{
// let {selectpatharr} = this.state // let {selectpatharr} = this.state
@ -381,7 +401,36 @@ export default class TPMevaluation extends Component {
// }) // })
// } // }
savegetfilepath=(value)=>{ savegetfilepath=(value)=>{
let {selectpath,saveshixunfilepath} = this.state let {selectpath,saveshixunfilepath,pathtype} = this.state
if(pathtype===1){
let newselectpath;
if(saveshixunfilepath==="shixunfilepathplay"){
newselectpath=value
}else{
const type = selectpath.split('');
let types=false;
for(var i=0; i<type.length; i++){
if(type[i]===value){
types=true
return
}
}
if(types===false){
newselectpath=selectpath+value+ ""
}else{
newselectpath=selectpath
}
}
this.setState({
// selectpatharr:newarr,
selectpath: newselectpath,
})
}
// let newarr =selectpatharr; // let newarr =selectpatharr;
// let arrtype=false; // let arrtype=false;
// let arrsum=0; // let arrsum=0;
@ -405,31 +454,7 @@ export default class TPMevaluation extends Component {
let newselectpath;
if(saveshixunfilepath==="shixunfilepathplay"){
newselectpath=value
}else{
const type = selectpath.split('');
let types=false;
for(var i=0; i<type.length; i++){
if(type[i]===value){
types=true
return
}
}
if(types===false){
newselectpath=selectpath+value+ ""
}else{
newselectpath=selectpath
}
}
this.setState({
// selectpatharr:newarr,
selectpath: newselectpath,
})
} }
evaluationenter=()=>{ evaluationenter=()=>{
@ -650,9 +675,10 @@ export default class TPMevaluation extends Component {
selectpath:e.target.value selectpath:e.target.value
}) })
} }
updatepath=(e,name)=>{ updatepath=(e,name,type)=>{
this.setState({ this.setState({
[name]:e.target.value [name]:e.target.value,
pathtype:type
}) })
} }
@ -818,8 +844,8 @@ export default class TPMevaluation extends Component {
placeholder="请选择版本库中的代码文件。例: src/step1/HelloWorld.java" placeholder="请选择版本库中的代码文件。例: src/step1/HelloWorld.java"
value={shixunfilepath} value={shixunfilepath}
style={{ width:StudentTaskPapers===true?'100%':""}} style={{ width:StudentTaskPapers===true?'100%':""}}
onInput={(e)=>this.updatepath(e,"shixunfilepath")} onInput={(e)=>this.updatepath(e,"shixunfilepath",1)}
onClick={(e)=>this.getfilepath(e,"shixunfilepath")} onClick={(e)=>this.getfilepath(e,"shixunfilepath",1)}
/> />
<p className="color-grey-9 mt15">该文件将直接显示给学生需要学生在其中填写代码</p> <p className="color-grey-9 mt15">该文件将直接显示给学生需要学生在其中填写代码</p>
</div> </div>
@ -844,7 +870,7 @@ export default class TPMevaluation extends Component {
{ {
main.length===0?"":main.map((item,key)=>{ main.length===0?"":main.map((item,key)=>{
return( return(
<a className="f14 fb" onClick={()=>this.goblakepath(item.path,key)}>{item.val}</a> <a className="f14 fb" onClick={()=>this.goblakepath(item.path,key,item)}>{item.val}</a>
) )
}) })
} }
@ -853,7 +879,7 @@ export default class TPMevaluation extends Component {
return( return(
<li className="entry" key={key}> <li className="entry" key={key}>
<div className="filename_no_report hidden">{ <div className="filename_no_report hidden">{
item.type==="tree"?<a onClick={()=>this.sendgetfilepath(item.name,item.type)} data-remote="true"> item.type==="tree"?<a onClick={()=>this.sendgetfilepath(item.name,item.type,path+item.name)} data-remote="true">
<i className="iconfont icon-wenjianjia color-blue mr2"></i> <i className="iconfont icon-wenjianjia color-blue mr2"></i>
{path+item.name}</a>:<a data-remote="true"> {path+item.name}</a>:<a data-remote="true">
<i className="iconfont icon-zuoye color-blue mr2"></i> <i className="iconfont icon-zuoye color-blue mr2"></i>
@ -873,7 +899,7 @@ export default class TPMevaluation extends Component {
<div className="clearfix mt20"> <div className="clearfix mt20">
<label className="fl mt5 directory_filepath">选中的文件路径</label> <label className="fl mt5 directory_filepath">选中的文件路径</label>
<Input id="points_tusi" placeholder="选中的文件路径" className="fl input-60-40" <Input id="points_tusi" placeholder="选中的文件路径" className="fl input-60-40"
style={{width:"440px"}} style={{width:"400px"}}
onInput={(e)=>this.saveselectpath(e)} onInput={(e)=>this.saveselectpath(e)}
value={selectpath}/> value={selectpath}/>
</div> </div>
@ -897,8 +923,8 @@ export default class TPMevaluation extends Component {
placeholder="请选择版本库中的代码文件。例src/step1/HelloWorldTest.java" placeholder="请选择版本库中的代码文件。例src/step1/HelloWorldTest.java"
value={shixunfilepathplay} value={shixunfilepathplay}
style={{width:StudentTaskDocs===true?'100%':""}} style={{width:StudentTaskDocs===true?'100%':""}}
onInput={(e)=>this.updatepath(e,"shixunfilepathplay")} onInput={(e)=>this.updatepath(e,"shixunfilepathplay",1)}
onClick={(e)=>this.getfilepath(e,"shixunfilepathplay")} onClick={(e)=>this.getfilepath(e,"shixunfilepathplay",1)}
/> />
<p className="color-grey-9 mt15">该文件由平台执行用来测试平台学员代码是否正确</p> <p className="color-grey-9 mt15">该文件由平台执行用来测试平台学员代码是否正确</p>
</div> </div>
@ -958,8 +984,8 @@ export default class TPMevaluation extends Component {
id="shixun_file_expect_picture_path" name="challenge[original_picture_path]" id="shixun_file_expect_picture_path" name="challenge[original_picture_path]"
placeholder="请选择版本库中存储了待处理图片的路径。例src/step1/expectedimages" placeholder="请选择版本库中存储了待处理图片的路径。例src/step1/expectedimages"
value={shixunfileexpectpicturepath} value={shixunfileexpectpicturepath}
onInput={(e)=>this.updatepath(e,"shixunfileexpectpicturepath")} onInput={(e)=>this.updatepath(e,"shixunfileexpectpicturepath",2)}
onClick={(e)=>this.getfilepath(e,"shixunfileexpectpicturepath")} onClick={(e)=>this.getfilepath(e,"shixunfileexpectpicturepath",2)}
/> />
<p className="color-grey-9 mt15"> <p className="color-grey-9 mt15">
该路径下的文件将在学员评测本关任务时作为原始图片显示在查看效果页供学员参考,任务为图片处理时请指定该路径并注意与程序文件所在文件夹分开 该路径下的文件将在学员评测本关任务时作为原始图片显示在查看效果页供学员参考,任务为图片处理时请指定该路径并注意与程序文件所在文件夹分开
@ -980,8 +1006,8 @@ export default class TPMevaluation extends Component {
id="shixun_file_standard_picture_path" name="challenge[expect_picture_path]" id="shixun_file_standard_picture_path" name="challenge[expect_picture_path]"
placeholder="请选择版本库中存储了标准答案代码输出文件的路径。例src/step1/expectedimages" placeholder="请选择版本库中存储了标准答案代码输出文件的路径。例src/step1/expectedimages"
value={shixunfilestandardpicturepath} value={shixunfilestandardpicturepath}
onInput={(e)=>this.updatepath(e,"shixunfilestandardpicturepath")} onInput={(e)=>this.updatepath(e,"shixunfilestandardpicturepath",2)}
onClick={(e)=>this.getfilepath(e,"shixunfilestandardpicturepath")} onClick={(e)=>this.getfilepath(e,"shixunfilestandardpicturepath",2)}
/> />
<p className="color-grey-9 mt15"> <p className="color-grey-9 mt15">
该路径下的文件将在学员评测本关任务时作为参考答案显示在查看效果页供学员参考任务输出结果为文件时请指定该路径并注意与程序文件所在文件夹分开 该路径下的文件将在学员评测本关任务时作为参考答案显示在查看效果页供学员参考任务输出结果为文件时请指定该路径并注意与程序文件所在文件夹分开
@ -1001,8 +1027,8 @@ export default class TPMevaluation extends Component {
<input type="text" className="input-100-45 change" autoComplete="off" <input type="text" className="input-100-45 change" autoComplete="off"
id="shixun_file_picture_path" name="challenge[picture_path]" id="shixun_file_picture_path" name="challenge[picture_path]"
value={shixunfilepicturepath} value={shixunfilepicturepath}
onInput={(e)=>this.updatepath(e,"shixunfilepicturepath")} onInput={(e)=>this.updatepath(e,"shixunfilepicturepath",2)}
onClick={(e)=>this.getfilepath(e,"shixunfilepicturepath")} onClick={(e)=>this.getfilepath(e,"shixunfilepicturepath",2)}
placeholder="请在版本库中指定用来保存学员代码实际输出结果的路径。例src/step1/outputimages"/> placeholder="请在版本库中指定用来保存学员代码实际输出结果的路径。例src/step1/outputimages"/>
<p className="color-grey-9 mt15"> <p className="color-grey-9 mt15">
学员评测本关任务时生成的文件将保存在该路径下并作为实际输出显示在查看效果页供学员确认任务输出结果为文件时请指定该路径并注意与程序文件所在文件夹分开 学员评测本关任务时生成的文件将保存在该路径下并作为实际输出显示在查看效果页供学员确认任务输出结果为文件时请指定该路径并注意与程序文件所在文件夹分开

@ -743,10 +743,12 @@ class Newshixuns extends Component {
onChangeTimePicker = (value, dateString) => { onChangeTimePicker = (value, dateString) => {
this.setState({ this.setState({
TimePickervalue: handleDateStrings(dateString) TimePickervalue: moment(handleDateStrings(dateString))
}) })
} }
// 附件相关 START
// 附件相关 START
handleChange = (info) => { handleChange = (info) => {
console.log("handleChange1"); console.log("handleChange1");
let fileList = info.fileList; let fileList = info.fileList;
@ -1279,14 +1281,16 @@ class Newshixuns extends Component {
<li className="fl"> <li className="fl">
<DatePicker <DatePicker
showToday={false} showToday={false}
showTime
locale={locale} locale={locale}
showTime={{ format: 'HH:mm' }} showTime={{ format: 'HH:mm' }}
style={{"width": "184px"}} style={{"width": "184px"}}
format="YYYY-MM-DD HH:mm" format="YYYY-MM-DD HH:mm"
placeholder="请选择开启时间" placeholder="请选择开启时间"
onChange={this.onChangeTimePicker} onChange={this.onChangeTimePicker}
value={TimePickervalue && moment(TimePickervalue, "YYYY-MM-DD HH:mm")}
disabledTime={disabledDateTime} disabledTime={disabledDateTime}
dropdownClassName="hideDisable"
/> />
<label style={{top: '6px'}} className="color-grey-6 ml10"> <label style={{top: '6px'}} className="color-grey-6 ml10">
为空则学员在实训发布后能随时开启实训挑战否则学员在开启时间后才能开启实训挑战 为空则学员在实训发布后能随时开启实训挑战否则学员在开启时间后才能开启实训挑战

@ -9,6 +9,7 @@ import passoff from '../../../src/images/login/passoff.png';
import axios from 'axios'; import axios from 'axios';
import CheckInputysl1 from './CheckInputysl'; import CheckInputysl1 from './CheckInputysl';
import CheckInputysl2 from './CheckInputysl'; import CheckInputysl2 from './CheckInputysl';
import Notcompletedysl from './Notcompletedysl';
import './common.css' import './common.css'
import './commontwo.css' import './commontwo.css'
const { TabPane } = Tabs; const { TabPane } = Tabs;
@ -63,6 +64,7 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
Whethertoverify:false, Whethertoverify:false,
pciphone:true, pciphone:true,
MyEduCoderModals:false,
} }
} }
@ -98,6 +100,7 @@ class LoginRegisterComponent extends Component {
Phonenumberisnotcodmm:undefined, Phonenumberisnotcodmm:undefined,
Whethertoverify:false, Whethertoverify:false,
pciphone:true, pciphone:true,
MyEduCoderModals:false,
} }
} }
@ -350,7 +353,11 @@ class LoginRegisterComponent extends Component {
this.setState({ this.setState({
isRender: false isRender: false
}) })
window.location.href = "/" var weekArray = JSON.parse(window.sessionStorage.getItem('yslgeturls'));
if(weekArray===undefined){
weekArray="/";
}
window.location.href = weekArray;
} }
} }
@ -458,7 +465,7 @@ class LoginRegisterComponent extends Component {
passwords: "", passwords: "",
Agreetotheterms: "", Agreetotheterms: "",
}) })
this.props.history.push("/interesse"); this.setMyEduCoderModals();
} }
} }
}).catch((error) => { }).catch((error) => {
@ -870,7 +877,18 @@ class LoginRegisterComponent extends Component {
return false; return false;
} }
} };
setNotcompleteds=()=>{
this.setState({
Notcompleteds:true,
MyEduCoderModals:false
})
};
setMyEduCoderModals=()=>{
this.setState({
MyEduCoderModals:true
})
};
render() { render() {
const { const {
// 登录 // 登录
@ -1020,6 +1038,11 @@ class LoginRegisterComponent extends Component {
: <div style={{height:"25px"}}></div> : <div style={{height:"25px"}}></div>
} }
<Notcompletedysl
modalsType={this.state.MyEduCoderModals}
setNotcompleteds={()=>{this.setNotcompleteds()}}
/>
{ {
Whethertoverify===false&&pciphone===true? Whethertoverify===false&&pciphone===true?
<CheckInputysl1 <CheckInputysl1

@ -33,7 +33,11 @@ class Notcompletedysl extends Component {
} }
modalCancel=()=>{ modalCancel=()=>{
window.location.href = "/"; var weekArray = JSON.parse(window.sessionStorage.getItem('yslgeturls'));
if(weekArray===undefined){
weekArray="/";
}
window.location.href = weekArray;
} }
setDownload=()=>{ setDownload=()=>{
@ -55,11 +59,10 @@ class Notcompletedysl extends Component {
width="530px" width="530px"
> >
<div className="educouddiv"> <div className="educouddiv">
<div className={"tabeltext-alignleft mt10"}><p>您尚未完善个人资料</p></div> <div className={"tabeltext-alignleft mt20"}><p>完善您的资料将获得更多的使用权限</p></div>
<div className={"tabeltext-alignleft mt10"}><p>请在完成资料后提交试用申请</p></div>
<div className="clearfix mt30 edu-txt-center"> <div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30" onClick={()=>this.modalCancel()}>取消</a> <a className="task-btn mr30" onClick={()=>this.modalCancel()}>取消</a>
<a className="task-btn task-btn-orange" onClick={()=>this.setDownload()}>立即完善资料</a> <a className="task-btn task-btn-orange" onClick={()=>this.setDownload()}>立即完善</a>
</div> </div>
</div> </div>
</Modal> </Modal>

Loading…
Cancel
Save