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

yslnewtiku
杨树林 5 years ago
commit b07d4ddb4a

@ -22,7 +22,7 @@ class CommentsController < ApplicationController
@discuss = @hack.discusses.new(reply_params)
@discuss.hidden = false
@discuss.user_id = current_user.id
@discuss.root_id = params[:parent_id]
@discuss.root_id = params[:comments][:parent_id]
@discuss.save!
rescue Exception => e
uid_logger_error("reply discuss failed : #{e.message}")
@ -32,9 +32,9 @@ class CommentsController < ApplicationController
# 列表
def index
disscusses = @hack.disscusses.where(:root_id => nil)
@disscuss_count = disscusses.count
@disscusses= paginate disscusses
discusses = @hack.discusses.where(root_id: nil)
@discusses_count = discusses.count
@discusses= paginate discusses
end
# 删除
@ -43,10 +43,20 @@ class CommentsController < ApplicationController
render_ok
end
# 隐藏、取消隐藏
def hidden
if @hack.manager?(current_user)
@discuss.update_attribute(:hidden, params[:hidden] == "1")
sucess_status
else
Educoder::TipException(403, "..")
end
end
private
def find_hack
@hack = Hack.find_by_identifier params[:identifier]
@hack = Hack.find_by_identifier(params[:hack_identifier])
end
def comment_params

@ -117,13 +117,13 @@ class DiscussesController < ApplicationController
# 0 取消赞;
def plus
pt = PraiseTread.where(:praise_tread_object_id => params[:id], :praise_tread_object_type => params[:container_type],
:user_id => current_user, :praise_or_tread => 1).first
:user_id => current_user, :praise_or_tread => 1)
# 如果当前用户已赞过,则不能重复赞
if params[:type] == 1 && pt.blank?
PraiseTread.create!(:praise_tread_object_id => params[:id], :praise_tread_object_type => params[:container_type],
:user_id => current_user.id, :praise_or_tread => 1) if pt.blank?
:user_id => current_user.id, :praise_or_tread => 1)
else
pt.destroy if pt.present? # 如果已赞过,则删掉这条赞(取消);如果没赞过,则为非法请求不处理
pt.destroy_all if pt.present? # 如果已赞过,则删掉这条赞(取消);如果没赞过,则为非法请求不处理
end
@praise_count = PraiseTread.where(:praise_tread_object_id => params[:id], :praise_tread_object_type => params[:container_type],

@ -103,7 +103,7 @@ class GamesController < ApplicationController
begin
@tpm_modified = @myshixun.repository_is_modified(@shixun.repo_path) # 判断TPM和TPI的版本库是否被改了
rescue
uid_logger("实训平台繁忙繁忙等级81")
uid_logger("服务器出现问题,请重置刷新页面")
end
end

@ -782,7 +782,7 @@ class ShixunsController < ApplicationController
end
rescue => e
uid_logger_error(e.message)
tip_exception("#{e.message}")
tip_exception("服务器出现问题,请重置环境")
end
end

@ -214,7 +214,15 @@ class SubjectsController < ApplicationController
GitService.add_repository(repo_path: repo_path)
# todo: 为什么保存的时候要去除后面的.git呢??
@shixun.update_column(:repo_name, repo_path.split(".")[0])
mirror_id = MirrorRepository.find_by(type_name: 'Python3.6')&.id
mirror_id =
if @shixun.is_jupyter?
MirrorRepository.where("type_name like '%Jupyter%'").first&.id
folder = EduSetting.get('shixun_folder')
path = "#{folder}/#{identifier}"
FileUtils.mkdir_p(path, :mode => 0777) unless File.directory?(path)
else
MirrorRepository.find_by(type_name: 'Python3.6')&.id
end
if mirror_id
ShixunMirrorRepository.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror_id)
@shixun.shixun_service_configs.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror_id)

@ -10,7 +10,7 @@ class Discuss < ApplicationRecord
has_one :praise_tread_cache, as: :object, dependent: :destroy
belongs_to :dis, polymorphic: true
belongs_to :challenge
belongs_to :challenge, optional: true
after_create :send_tiding
scope :children, -> (discuss_id){ where(parent_id: discuss_id).includes(:user).reorder(created_at: :asc) }
@ -54,9 +54,14 @@ class Discuss < ApplicationRecord
def send_tiding
base_attrs = {
trigger_user_id: user_id, parent_container_id: challenge_id, parent_container_type: 'Challenge',
belong_container_id: dis_id, belong_container_type: 'Shixun', viewed: 0, tiding_type: 'Comment'
belong_container_id: dis_id, belong_container_type: dis_type, viewed: 0, tiding_type: 'Comment'
}
user_id = has_parent? ? parent.user_id : Challenge.find(challenge_id).user_id
user_id =
if dis_type == 'Shixun'
has_parent? ? parent.user_id : Challenge.find(challenge_id).user_id
elsif dis_type == 'Hack'
has_parent? ? parent.user_id : Hack.find(dis_id).user_id
end
tidings.create!(base_attrs.merge(user_id: user_id))
end
end

@ -11,6 +11,9 @@ class Hack < ApplicationRecord
has_many :hack_codes, :dependent => :destroy
has_many :hack_user_lastest_codes, :dependent => :destroy
has_many :discusses, as: :dis, dependent: :destroy
# 点赞
has_many :praise_treads, as: :praise_tread_object, dependent: :destroy
belongs_to :user
scope :published, -> { where(status: 1) }

@ -1,3 +1,6 @@
json.author do
json.partial! 'users/user', user: discuss.user
end
json.id discuss.id
json.content content_safe(discuss.content)
json.time time_from_now(discuss.created_at)

@ -1,4 +1,4 @@
json.disscuss_count @disscuss_count
json.disscuss_count @discusses_count
json.comments @discusses do |discuss|
json.partial! 'comments/discuss', locals: { discuss: discuss}
json.children discuss.child_discuss(current_user) do |c_d|

@ -0,0 +1 @@
json.praise_count @praise_count

@ -1,11 +1,12 @@
json.hack do
json.(@hack, :name, :difficult, :time_limit, :description, :score, :identifier, :status)
json.(@hack, :name, :difficult, :time_limit, :description, :score, :identifier, :status, :praises_count)
json.language @hack.language
json.username @hack.user.real_name
json.code @my_hack.code
json.pass_count @hack.pass_num
json.submit_count @hack.submit_num
json.modify_code @modify
json.comments_count @hack.discusses.count
end
json.test_case do

@ -77,7 +77,10 @@ Rails.application.routes.draw do
delete :delete_set
end
resources :comments do
post :reply
collection do
post :reply
post :hidden
end
end
end

@ -0,0 +1,8 @@
class ModifyTaskPassForChallenges < ActiveRecord::Migration[5.2]
def change
Challenge.find_each do |challenge|
task_pass = challenge.task_pass.gsub(" ", "").gsub("rac", '\frac')
challenge.update_attribute(:task_pass, task_pass)
end
end
end

@ -0,0 +1,6 @@
class AddPraisesCountForHacks < ActiveRecord::Migration[5.2]
def change
add_column :hacks, :praises_count, :integer, :default => 0
add_column :hacks, :comments_count, :integer, :default => 0
end
end

@ -14,19 +14,19 @@ namespace :excellent_course_exercise do
course = Course.find_by(id: course_id)
course.exercises.each_with_index do |exercise, index|
# if exercise.exercise_users.where(commit_status: 1).count == 0
if exercise.exercise_users.where(commit_status: 1).count == 0
# 第一个试卷的参与人数和通过人数都是传的数据,后续的随机
if index == 0
members = course.students.order("id asc").limit(participant_count)
update_exercise_user(exercise, members, pass_count)
else
new_participant_count = rand((participant_count - 423)..participant_count)
new_pass_count = rand((new_participant_count - 113)..new_participant_count)
new_participant_count = rand((participant_count - 20)..participant_count)
new_pass_count = rand((new_participant_count - 30)..new_participant_count)
members = course.students.order("id asc").limit(new_participant_count)
update_exercise_user(exercise, members, new_pass_count)
end
# end
end
end
end
@ -36,14 +36,15 @@ namespace :excellent_course_exercise do
# index < pass_count 之前的学生都是通关的,之后的未通过
members.each_with_index do |member, index|
exercise_user = exercise.exercise_users.where(user_id: member.user_id).take
if exercise_question_ids.length == 20
question_length = exercise_question_ids.length
if question_length == 20
rand_num = index < pass_count - 1 ? rand(15..20) : rand(1..10)
elsif exercise_question_ids.length == 17
elsif question_length == 17
rand_num = index < pass_count - 1 ? rand(12..17) : rand(1..9)
elsif exercise_question_ids.length == 39
elsif question_length == 39
rand_num = index < pass_count - 1 ? rand(30..39) : rand(1..18)
else
rand_num = exercise_question_ids.length
rand_num = index < pass_count - 1 ? rand((question_length-3)..question_length) : rand(1..(question_length-8))
end
if exercise_user && exercise_user.commit_status == 0

@ -0,0 +1,32 @@
# 执行示例 RAILS_ENV=production bundle exec rake migrate_course_student:student args=3835,2526,21950,1000
# args 第一个课程 course_id第二个参数是学校school_id第三个参数是部门id第四个参数是迁移数量
#
desc "同步学校的学生"
namespace :migrate_course_student do
if ENV['args']
course_id = ENV['args'].split(",")[0] # 对应课堂的id
school_id = ENV['args'].split(",")[1] # 对应学校id
department_id = ENV['args'].split(",")[2] # 对应部门id
limit = ENV['args'].split(",")[3] # 限制导入的数量
end
task :student => :environment do
course = Course.find course_id
users = User.joins(:user_extension).where(user_extensions: {school_id: school_id, department_id: department_id, identity: 1}).limit(limit)
user_ids = []
users.each do |user|
if user.student_id.present? && !course.students.exists?(user_id: user.id)
begin
CourseMember.create!(course_id: course_id, user_id: user.id, role: 4)
user_ids << user.id
rescue Exception => e
Rails.logger(e.message)
end
end
end
CourseAddStudentCreateWorksJob.perform_later(course_id, user_ids)
end
end

@ -360,7 +360,7 @@ label.infolabel{display: block;float: left;width: 56px;text-align: right;margin-
.subshaicontent a{float: left;margin-right: 20px;color: #999;cursor: pointer}
.search-new{width: 248px;height:32px;position: relative;margin-right: 35px;}
.search-new{width: 248px;height:32px;position: relative;}
.search-span{display: block;position: absolute;width: 100%;height: 100%;left:0px;top:0px;background-color: #F4F4F4;border: 1px solid #EAEAEA; border-radius: 4px;z-index: 1}
.search-new-input{height: 32px;padding-left: 5px;width: 225px;border: none;box-sizing: border-box;background: none;outline: none;position: absolute;left:0px;top:1px;z-index: 2}
.search-new img,.search-new a,.search-new .searchicon{cursor: pointer;position: absolute;right:2px;top:2px;z-index: 2}

@ -35,7 +35,7 @@ if (isDev) {
// 老师
//ebugType="teacher";
// 学生
// debugType="student";
//debugType="student";
window._debugType = debugType;
export function initAxiosInterceptors(props) {

@ -336,7 +336,7 @@ class CommonWorkDetailIndex extends Component{
}
`}</style>
{this.props.isAdmin()? <Spin spinning={this.state.donwloading} style={{ }}>
<li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding":"0 20px"}}>
<li className="li_line drop_down fr color-blue font-16 mt20" style={{"padding":"0 20px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
<li>

@ -788,7 +788,7 @@ class CommonWorkList extends Component{
{/* value={search} */}
<div className="fr mr5 search-new mr8" style={{marginBottom:'1px'}}>
<div className="fr search-new mr8" style={{marginBottom:'1px'}}>
<Search
placeholder="请输入姓名或学号搜索"
id="subject_search_input"

@ -147,7 +147,7 @@ class TabRightComponents extends Component{
padding-bottom: 8px;
}
`}</style>
{this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding":"0 20px"}}>
{this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mt20" style={{"padding":"0 20px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
<li><a href={exportResultUrl} onClick={(url)=>this.confirmysl(exportResultUrl)} className="color-dark">导出成绩</a></li>

@ -102,11 +102,26 @@ class CoursesHome extends Component{
})
}
getUser=(url,type)=>{
if(this.props.checkIfLogin()===false){
this.props.showLoginDialog()
return
}
if(this.props.checkIfProfileCompleted()===false){
this.props.showProfileCompleteDialog()
return
}
if(url !== undefined || url!==""){
this.props.history.push(url);
}
}
render() {
let { order,search,page,coursesHomelist }=this.state;
//console.log(this.props)
return (
<div>
{this.state.updata===undefined?"":<UpgradeModals
@ -144,6 +159,7 @@ class CoursesHome extends Component{
onClick={ () => this.changeStatus("created_at")}>最新</a>
<a className={ order == "visits" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"}
onClick={ () => this.changeStatus("visits")}>最热</a>
{this.props.user&&this.props.user.user_identity==="学生"?"":<span className={ "fr font-16 bestChoose color-blue" } onClick={(url)=>this.getUser("/courses/new")}>+新建翻转课堂</span>}
{/*<div className="fr mr5 search-new">*/}
{/*/!* <Search*/}

@ -25,8 +25,15 @@ class NewShixunModel extends Component{
}
componentDidMount() {
let{page,type,keyword,order,diff,limit,status,sort}=this.state;
let newsort=sort
if(this.props&&this.props.user.course_name===undefined){
newsort="created_at";
}else{
newsort="publish_time";
}
if(this.props.type==='shixuns'){
this.getdatalist(page,type,status,keyword,order,diff,limit)
this.getdatalist(page,type,status,keyword,order,diff,limit,undefined,newsort);
}else{
this.getdatalist(page,type,undefined,keyword,order,undefined,limit,undefined,sort);
}
@ -34,6 +41,7 @@ class NewShixunModel extends Component{
}
getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype,sort)=>{
this.setState({
isspinning:true
})
@ -368,6 +376,7 @@ class NewShixunModel extends Component{
// let {visible,patheditarry}=this.props;
// console.log(Grouplist)
// console.log(allGrouplist)
const statusmenus=(
<Menu className="menus">
<Menu.Item>
@ -425,7 +434,6 @@ class NewShixunModel extends Component{
);
console.log(shixun_list)
return(
<div>

@ -1338,7 +1338,7 @@ samp {
width:237px!important;
height: 30px;
margin-bottom: 30px;
margin-right: 35px;
/*margin-right: 35px;*/
}
.search-new-input {
padding-left: 16px;

@ -608,9 +608,9 @@ class Exercisesetting extends Component{
};
// console.log(flagPageEdit===true?polls&&polls.exercise_status===1?3:2:1)
console.log("asdasdasda");
console.log(this.props);
console.log(this.props.Commonheadofthetestpaper);
// console.log("asdasdasda");
// console.log(this.props);
// console.log(this.props.Commonheadofthetestpaper);
return(
<div>
<Modals
@ -681,6 +681,7 @@ class Exercisesetting extends Component{
<div className="clearfix">
<span className="mr15 fl mt10 font-16">截止时间</span>
<div className="fl">
<Tooltip placement="bottom" title={end_timetype===true ? this.props.isAdmin()?"":"截止时间已过,不能再修改":""}>
<DatePicker
dropdownClassName="hideDisable"
placeholder="请选择截止时间"
@ -694,9 +695,10 @@ class Exercisesetting extends Component{
disabledDate={disabledDate}
onChange={this.onChangeTimeEnd}
value={end_time && moment(end_time,"YYYY-MM-DD HH:mm")}
disabled={ end_timetype===true?true:!flagPageEdit}
disabled={ end_timetype===true?this.props.isAdmin()?!flagPageEdit:true:!flagPageEdit}
>
</DatePicker>
</Tooltip>
<p className="color-red lineh-25 clearfix" style={{height:"25px"}}>
{
unit_e_tip && unit_e_tip != "" ? <span className="fl">{ unit_e_tip }</span>:""

@ -2882,7 +2882,7 @@ class Studentshavecompletedthelist extends Component {
})
}
</CheckboxGroup>
<div className="fr mr5 search-new" style={{marginBottom: '1px'}}>
<div className="fr search-new" style={{marginBottom: '1px'}}>
<Search
placeholder="请输入姓名或学号搜索"
id="subject_search_input"
@ -2914,7 +2914,7 @@ class Studentshavecompletedthelist extends Component {
})
}
</CheckboxGroup>
<div className="fr mr5 search-new" style={{marginBottom: '1px'}}>
<div className="fr search-new" style={{marginBottom: '1px'}}>
<Search
placeholder="请输入姓名或学号搜索"
id="subject_search_input"

@ -1158,7 +1158,7 @@ class GraduationTaskssettinglist extends Component{
)
})}
</CheckboxGroup>
<div className="fr mr5 search-new" style={{marginBottom:'1px',marginRight:"0px"}}>
<div className="fr search-new" style={{marginBottom:'1px',marginRight:"0px"}}>
<Search
placeholder="请输入姓名或学号搜索"
id="subject_search_input"
@ -1350,7 +1350,7 @@ class GraduationTaskssettinglist extends Component{
})}
</CheckboxGroup>
<div className="fr mr5 search-new" style={{marginBottom:'1px'}}>
<div className="fr search-new" style={{marginBottom:'1px'}}>
<Search
placeholder="请输入姓名或学号搜索"
id="subject_search_input"

@ -584,7 +584,7 @@ class PollDetailTabForth extends Component{
<div className="clearfix">
<span className="mr15 fl mt10 font-16">截止时间</span>
<div className="fl">
<Tooltip placement="bottom" title={un_change_end ? this.props.isAdmin()?"截止时间已过,不能再修改":"":""}>
<Tooltip placement="bottom" title={un_change_end ? this.props.isAdmin()?"":"截止时间已过,不能再修改":""}>
<span>
<DatePicker
showToday={false}
@ -599,7 +599,7 @@ class PollDetailTabForth extends Component{
disabledTime={disabledDateTime}
onChange={this.onChangeTimeEnd}
value={ end_time && moment(end_time,dataformat) }
disabled={un_change_end == true ? true : !flagPageEdit }
disabled={un_change_end == true ? this.props.isAdmin()?!flagPageEdit:true : !flagPageEdit }
>
</DatePicker>
</span>
@ -619,6 +619,7 @@ class PollDetailTabForth extends Component{
{...this.state}
ref="pollDetailTabForthRules"
rules={rules}
type={"polls"}
course_group={course_group}
flagPageEdit={flagPageEdit}
rulesCheckInfo={(info)=>this.rulesCheckInfo(info)}

@ -461,7 +461,11 @@ class PollDetailTabForthRules extends Component{
format="YYYY-MM-DD HH:mm"
disabledTime={disabledDateTime}
disabledDate={disabledDate}
disabled={rule.e_timeflag === undefined ? rule.publish_time === null ? false : moment(rule.end_time, dataformat) <= moment() ? true : !flagPageEdit : rule.e_timeflag == true ? true : !flagPageEdit}
disabled={
this.props.type==="polls"||this.props.type==="Exercise"?
rule.e_timeflag === undefined ? rule.publish_time === null ? false : moment(rule.end_time, dataformat) <= moment() ?this.props.isAdmin()?!flagPageEdit: true : !flagPageEdit : rule.e_timeflag == true ? this.props.isAdmin()?!flagPageEdit :true : !flagPageEdit:
rule.e_timeflag === undefined ? rule.publish_time === null ? false : moment(rule.end_time, dataformat) <= moment() ? true : !flagPageEdit : rule.e_timeflag == true ? true : !flagPageEdit
}
style={{"height":"42px"}}
></DatePicker>
</span>

@ -1748,10 +1748,11 @@ class Listofworksstudentone extends Component {
} catch (e) {
}
// console.log("table1handleChange");
// console.log(sorter.columnKey);
try {
//学生成绩排序
if (sorter.columnKey === "finalscore") {
if (sorter.columnKey === "work_score") {
if (sorter.order === "ascend") {
//升序
this.setState({
@ -3678,7 +3679,7 @@ class Listofworksstudentone extends Component {
</li>
<li className="clearfix mt10">
<div className="fr mr5 search-newysl" style={{marginBottom: '1px'}}>
<div className="fr search-newysl" style={{marginBottom: '1px'}}>
{/*{course_is_end===true?"":<span>*/}
{/*{teacherdata&&teacherdata.update_score===true&&computeTimetype===true?*/}
{/* (this.props.isNotMember()===false?<div className={"computeTime font-16"} onClick={this.setComputeTimet}>*/}

@ -291,7 +291,7 @@ class ShixunHomeworkPage extends Component {
`}</style>
{this.props.isAdmin() ?
<li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding": "0 20px"}}>
<li className="li_line drop_down fr color-blue font-16 mt20" style={{"padding": "0 20px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right": "-0px", "left": "unset", "height": "auto"}}>
{/*<li><a*/}

@ -898,7 +898,7 @@ class ShixunStudentWork extends Component {
</span>:"":""}
{/*请输入姓名或学号搜索*/}
<div className="fr mr5 search-new" style={{marginBottom: '1px'}}>
<div className="fr search-new" style={{marginBottom: '1px'}}>
<Search
placeholder="请输入姓名或学号搜索"
id="subject_search_input"

@ -49,7 +49,7 @@ let _url_origin = getUrl()
const $ = window.$
$('head').append( $('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/css/edu-admin.css?1525440977`) );
.attr('href', `${_url_origin}/stylesheets/css/edu-admin.css?6`) );
$('head').append( $('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/css/edu-forum.css?1525440977`) );
$('head').append( $('<link rel="stylesheet" type="text/css" />')

@ -574,6 +574,7 @@ class DetailCards extends Component{
</div>
}
<DetailCardsEditAndEdit
{...this.props}
idsum={idsum}
keys={key}
pathCardsedittype={pathCardsedittype}

@ -77,10 +77,6 @@ class DetailTop extends Component{
}
}
})
console.log(courseslist)
}
if(courseslist.length!=0){
this.props.getMenuItemsindex(keys,courseslist[0].course_status.status)

@ -124,10 +124,39 @@ class ShixunPathSearch extends Component{
this.props.history.push(url)
}
//头部获取是否已经登录了
getUser=(url,type)=>{
if(this.props.checkIfLogin()===false){
this.props.showLoginDialog()
return
}
if(this.props.checkIfProfileCompleted()===false){
this.props.showProfileCompleteDialog()
return
}
if(url !== undefined || url!==""){
this.props.history.push(url);
}
}
render() {
let { order,sortList,search,page,total_count,select }=this.state;
let pathstype=false;
if(this.props&&this.props.mygetHelmetapi!=null){
let paths="/paths";
this.props.mygetHelmetapi.navbar.map((item,key)=>{
var reg = RegExp(item.link);
if(paths.match(reg)){
if(item.hidden===true){
pathstype=true
}
}
// console.log()
})
}
// console.log(this.props)
return (
<div>
{this.state.updata===undefined?"":<UpgradeModals
@ -169,6 +198,10 @@ class ShixunPathSearch extends Component{
{/*<a href="javascript:void(0)" className={ order == "mine" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} onClick={ () => this.changeStatus("mine")}>我的</a>*/}
<span className={ order == "updated_at" ? "active" : ""} onClick={ () => this.changeStatus("updated_at")}>最新</span>
<span className={ order == "myshixun_count" ? "active" : ""} onClick={ () => this.changeStatus("myshixun_count")}>最热</span>
{this.props.user&&this.props.user.main_site===false?"":this.props.Headertop===undefined?"":<a className={ "fr font-16 bestChoose color-blue" } onClick={(url)=>this.getUser("/paths/new")}>+新建实践课程</a>}
{this.props.user&&this.props.user.main_site===true?"":this.props.Headertop===undefined?"":
pathstype===true?"":this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.is_teacher===true||this.props.user&&this.props.user.business===true?<a className={ "fr font-16 bestChoose color-blue" } onClick={(url)=>this.getUser("/paths/new")}>+新建实践课程</a>:""
}
{/*<div className="fr mr5 search-new">*/}
{/*/!* <Search*/}
{/*placeholder="请输入路径名称进行搜索"*/}

@ -1214,7 +1214,7 @@ submittojoinclass=(value)=>{
</li>
{
this.props.Headertop && this.props.Headertop.college_identifier &&
<li><a href={`${this.props.Headertop.old_url}/colleges/${this.props.Headertop.college_identifier}/statistics`}>学院统计</a></li>
<li><a href={`/colleges/${this.props.Headertop.college_identifier}/statistics`}>学院统计</a></li>
}
{
this.props.Headertop && this.props.Headertop.laboratory_user &&

@ -15,6 +15,7 @@ import axios from 'axios'
import Modals from '../modals/Modals';
import './shixuns/css/TPMBanner.css';
import types from "../../redux/actions/actionTypes";
let $ = window.$;
@ -22,6 +23,8 @@ const Search = Input.Search;
const RadioGroup = Radio.Group;
const { TextArea } = Input;
class TPMBanner extends Component {
constructor(props) {
super(props)
@ -54,7 +57,9 @@ class TPMBanner extends Component {
Senttothevcaluetype: false,
jupyterbool: false,
openknow:false,
openshowpublictype:false
openshowpublictype:false,
Radiovalue:1,
TextAreaintshow:false
}
}
@ -197,13 +202,46 @@ class TPMBanner extends Component {
})
}
changeTextArea=(e)=>{
this.setState({
TextArea:e.target.value
})
}
addForkvisible = () => {
let reason;
switch (this.state.Radiovalue) {
case 1:
reason="Shixun";
break;
case 2:
reason="Course";
break;
case 3:
reason="Subject";
break;
case 4:
reason=this.state.TextArea;
}
if(this.state.Radiovalue===4){
if(this.state.TextArea===null||this.state.TextArea===undefined||this.state.TextArea=== ""){
this.setState({
TextAreaintshow:true
})
return
}
}
this.setState({
Forkvisibletype: true,
Forkvisibletype:true,
})
let id = this.props.match.params.shixunId;
let url = "/shixuns/" + id + "/copy.json";
axios.post(url).then((response) => {
axios.post(url, {
reason:reason,
}).then((response) => {
if (response.data.status === 401) {
} else {
@ -694,17 +732,9 @@ class TPMBanner extends Component {
}
showonMouseOver = () => {
$("#ratePanel").show();
this.setState({
showradios: true
})
}
hideonMouseOut = () => {
$("#ratePanel").hide();
onChangeRadiovalue=(e)=>{
this.setState({
showradios: false
Radiovalue:e.target.value
})
}
@ -1128,7 +1158,7 @@ class TPMBanner extends Component {
}
{
<a onClick={this.Senttothe}
this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter===true?"":<a onClick={this.Senttothe}
className="fr kaike kkbths mr20 font-18"
data-tip-down=""
style={{display: shixunsDetails.shixun_status === 0 || shixunsDetails.shixun_status === 3 || shixunsDetails.shixun_status === 1 || shixunsDetails.shixun_status === -1 ? "none" : "block"}}
@ -1233,9 +1263,34 @@ class TPMBanner extends Component {
</span>
</Tooltip>
{Forkvisible===true?<style>
{
`
.ant-modal-body{
padding: 10px;
}
`
}
</style>:""}
{
this.state.TextAreaintshow===true?<style>
{
`
.ant-input:hover {
border: 1px solid red !important;
}
.ant-input:focus {
border: 1px solid red !important;
}
`
}
</style>:""
}
<Modal
keyboard={false}
title="提示"
title="Fork原因"
visible={Forkvisible}
closable={false}
footer={null}
@ -1247,8 +1302,25 @@ class TPMBanner extends Component {
>
</Spin> :
<div>
<div className="task-popup-content"><p
className="task-popup-text-center font-16 pb20">复制将在后台执行平台将为你创建<br/>一个新的同名实训和内容请问是否继续</p>
<div className="task-popup-content">
<div className={"forkfactors"}>请根据实际情况填写fork本实训的原因</div>
<Radio.Group onChange={this.onChangeRadiovalue} value={this.state.Radiovalue} className={"ml20 mt20 mb20"} style={{ width: "100%" }}>
<Radio style={radioStyle} value={1}>
实训内容升级
</Radio>
<Radio style={radioStyle} value={2}>
课堂教学使用
</Radio>
<Radio style={radioStyle} value={3}>
实践课程使用
</Radio>
<Radio style={radioStyle} value={4}>
其它原因
</Radio>
{this.state.Radiovalue === 4 ?
<TextArea className={this.state.TextAreaintshow===true?"bor-red mt10":"mt10"} rows={4} style={{ width: '85%', marginLeft: '30px' }} onInput={this.changeTextArea}/>: null}
{this.state.TextAreaintshow===true?<div className={"color-red ml30"}>不能为空</div>:""}
</Radio.Group>
</div>
<div className="task-popup-submit clearfix">
<a onClick={this.hideForkvisible} className="task-btn fl">取消</a>

@ -1,6 +1,6 @@
import React, {Component} from 'react';
import {Redirect} from 'react-router';
import {List, Typography, Tag, Modal, Radio, Checkbox, Table, Pagination,Upload,notification} from 'antd';
import {List, Typography, Tag, Modal, Radio, Checkbox, Table, Pagination,Upload,Button} from 'antd';
import { NoneData } from 'educoder'
import TPMRightSection from './component/TPMRightSection';
@ -85,6 +85,7 @@ class TPMDataset extends Component {
checked: false,
showmodel:false,
itemtypebool:false,
Buttonloading:false
}
}
@ -295,8 +296,17 @@ class TPMDataset extends Component {
handleChange = (info) => {
// console.log("handleChange123123");
// console.log(info);
// debugger
//debugger
this.setState({
Buttonloading:true
})
if(!info.file.status){
this.setState({
Buttonloading:false
})
}
if(info.file.status == "done" || info.file.status == "uploading" || info.file.status === 'removed'){
let fileList = info.fileList;
this.setState({
fileList: appendFileSizeToUploadFileAll(fileList),
@ -306,12 +316,21 @@ class TPMDataset extends Component {
//done 成功就会调用这个方法
if(info.file.response){
if(info.file.response.status===-1||info.file.response.status==="-1"){
this.setState({
Buttonloading:false
})
}else{
this.getdatas();
this.setState({
Buttonloading:false
})
// this.props.showNotification(`上传成功`);
}
}
}else{
// this.setState({
// Buttonloading:false
// })
}
if(info.file.response){
@ -329,9 +348,13 @@ class TPMDataset extends Component {
showmodel:true,
tittest:info.file.response.message,
itemtypebool:itemtype>-1?true:itemtype<=-1?false:false,
Buttonloading:false
})
}else{
}else{
this.setState({
Buttonloading:false
})
}
}
@ -445,7 +468,12 @@ class TPMDataset extends Component {
showmodel: false,
})
}
ButtonloadinghandleChange=()=>{
// this.props.showNotification(`zhzzzzz`);
// this.setState({
// Buttonloading:false
// })
}
render() {
const {tpmLoading, shixun, user, match} = this.props;
const {columns, page, limit, selectedRowKeys,mylistansum,fileList,datalist,data_sets_count,loadingstate} = this.state;
@ -472,12 +500,14 @@ class TPMDataset extends Component {
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {
//上传前的操作
// console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) {
this.props.showNotification('文件大小必须小于150MB!');
console.log('beforeUpload', file);
// this.props.showNotification(`文件上传中`);
const isLt400M = file.size / 1024 / 1024 <= 400;
if (!isLt400M) {
this.props.showNotification('文件大小必须小于等于400MB!');
}
return isLt150M;
return isLt400M;
},
};
// console.log("showmodelshowmodel");
@ -514,12 +544,20 @@ class TPMDataset extends Component {
.ant-upload-list{
display:none
}
.deletebuttom{
color: #fff !important;
}
.deletebuttom:hover{
color: #fff !important;
background: #29BD8B !important;
}
`
}
</style>
<div className="deletebuttom intermediatecenter "> <Upload {...uploadProps}><p className="deletebuttomtest" type="upload">
上传文件</p> </Upload></div>
<div className="intermediatecenter deletebuttom">
<Upload {...uploadProps}>
<Button className={"deletebuttom"} loading={this.state.Buttonloading}>{this.state.Buttonloading===true?"上传中":"上传文件"}</Button>
</Upload></div>
{
data_sets_count>0?
<div

@ -412,7 +412,7 @@ class TPMIndex extends Component {
<span className={"tpmbannernavstyler"}>合作者</span>
</Menu.Item>
{ this.state.is_jupyter===true?<Menu.Item key="6" className={"competitionmr50"}>
{ this.state.identity >4||this.state.identity===undefined ? "":this.state.is_jupyter===true?<Menu.Item key="6" className={"competitionmr50"}>
<span className={"tpmbannernavstyler"}>数据集</span>
</Menu.Item>:""}

@ -35,14 +35,14 @@ if (!window['indexHOCLoaded']) {
// $('head').append($('<link rel="stylesheet" type="text/css" />')
// .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`));
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/css/edu-common.css?1`));
.attr('href', `${_url_origin}/stylesheets/css/edu-common.css?6`));
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?1`));
.attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?6`));
// index.html有加载
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?1`));
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?6`));
// $('head').append($('<link rel="stylesheet" type="text/css" />')

@ -325,7 +325,7 @@ function JupyterTPI (props) {
</span>
</p>
<p className="jupyter_btn">
{/* sync | poweroff */}
{/*sync | poweroff */}
{/*<Button*/}
{/* className="btn_common"*/}
{/* type="link"*/}

@ -187,7 +187,7 @@ line-height: 50px !important;
}
.ant-statistic-content-value{
color:#fff !important;
font-size: 17px !important;
font-size: 14px !important;
}
}

@ -140,11 +140,13 @@
.shixunstartbutton33BD8C{
background: #33BD8C !important;
border: #33BD8C !important;
cursor: inherit !important;
}
.shixunstartbuttonFF6601{
background: #FF6601 !important;
border: #FF6601 !important;
cursor: inherit !important;
}
.shixunstartbutton666666{

@ -159,4 +159,10 @@ a:active{text-decoration:none;}
.forkNumst{display: block;float: left;width: 36px;text-align: center;border-left: 1px solid #ffffff !important;color: #ffffff!important; }
.mlbanner36{
margin-left: 36px;
}
.forkfactors{
text-align: center;
color: #999999;
}

@ -80,7 +80,7 @@
.deletebuttom{
width:85px;
height:30px;
background:#29BD8B;
background:#29BD8B !important;
border-radius:3px;
cursor:pointer
}

@ -214,12 +214,12 @@ class InfosShixun extends Component{
</style>
<div className="white-panel edu-back-white pt20 pb20 clearfix ">
<li className={category ? " font-16 whitepanelyslli" : "active font-16 whitepanelyslli"}><a
href="javascript:void(0)" onClick={() => this.changeCategory()} className="font-16 w32">全部</a></li>
onClick={() => this.changeCategory()} className="font-16 w32">全部</a></li>
<li className={category == "manage" ? "active font-16 whitepanelysllis" : "font-16 whitepanelysllis"}><a
href="javascript:void(0)" onClick={() => this.changeCategory("manage")}
onClick={() => this.changeCategory("manage")}
className={is_current ? "font-16 w66" : "font-16 w80"}>{is_current ? "我" : "TA"}管理的</a></li>
<li className={category == "study" ? "active font-16 whitepanelysllis" : "font-16 whitepanelysllis"}><a
href="javascript:void(0)" onClick={() => this.changeCategory("study")}
onClick={() => this.changeCategory("study")}
className={is_current ? "font-16 w66" : "font-16 w80"}>{is_current ? "我" : "TA"}学习的</a></li>
</div>
<style>
@ -242,29 +242,30 @@ class InfosShixun extends Component{
{
category && category == "manage" && is_current &&
<div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE">
<li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)"
onClick={() => this.changeStatus()}
className="w32">全部</a></li>
<li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}>
<a onClick={() => this.changeStatus()} className="w32">全部</a></li>
<li className={status == "editing" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
href="javascript:void(0)" onClick={() => this.changeStatus("editing")} className="w60">编辑中</a></li>
<li className={status == "applying" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
href="javascript:void(0)" onClick={() => this.changeStatus("applying")} className="w60">待审核</a></li>
onClick={() => this.changeStatus("editing")} className="w60">编辑中</a></li>
<li className={status == "published" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
href="javascript:void(0)" onClick={() => this.changeStatus("published")} className="w60">已发布</a></li>
onClick={() => this.changeStatus("published")} className="w60">已发布</a></li>
<li className={status == "applying" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
onClick={() => this.changeStatus("applying")} className="w60">待审核</a></li>
<li className={status == "publiced" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
onClick={() => this.changeStatus("publiced")} className="w60">已公开</a></li>
<li className={status == "closed" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
href="javascript:void(0)" onClick={() => this.changeStatus("closed")} className="w60">已关闭</a></li>
onClick={() => this.changeStatus("closed")} className="w60">已关闭</a></li>
</div>
}
{
category && category == "study" && is_current &&
<div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE">
<li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)"
<li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a
onClick={() => this.changeStatus()}
className="w32">全部</a></li>
<li className={status == "processing" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
href="javascript:void(0)" onClick={() => this.changeStatus("processing")} className="w60">未通关</a></li>
onClick={() => this.changeStatus("processing")} className="w60">未通关</a></li>
<li className={status == "passed" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
href="javascript:void(0)" onClick={() => this.changeStatus("passed")} className="w60">已通关</a></li>
onClick={() => this.changeStatus("passed")} className="w60">已通关</a></li>
</div>
}
<div className=" clearfix font-12 " style={{
@ -387,12 +388,12 @@ class InfosShixun extends Component{
:""}
<a href="javascript:void(0)" className="square-img">
<a className="square-img">
<img src={setImagesUrl(`${item.image_url}`)}/>
</a>
<div className="square-main">
<p className="task-hide">
<a href="javascript:void(0)" className="justify color-grey-name">{item.name}</a>
<a className="justify color-grey-name">{item.name}</a>
</p>
<div className="user-bar mt10">
<p style={{'width': `${parseFloat(parseInt(item.finished_challenges_count)/parseInt(item.challenges_count)).toFixed(2)*100}%`}}></p>

@ -364,7 +364,7 @@ label.infolabel{display: block;float: left;width: 56px;text-align: right;margin-
.subshaicontent a{float: left;margin-right: 20px;color: #999;cursor: pointer}
.search-new{width: 248px;height:32px;position: relative;margin-right: 35px;}
.search-new{width: 248px;height:32px;position: relative;}
.search-span{display: block;position: absolute;width: 100%;height: 100%;left:0px;top:0px;background-color: #F4F4F4;border: 1px solid #EAEAEA; border-radius: 4px;z-index: 1}
.search-new-input{height: 32px;padding-left: 5px;width: 225px;border: none;box-sizing: border-box;background: none;outline: none;position: absolute;left:0px;top:1px;z-index: 2}
.search-new img,.search-new a,.search-new .searchicon{cursor: pointer;position: absolute;right:2px;top:2px;z-index: 2}

Loading…
Cancel
Save